Merged in feat/LOY-486-consent-prompt-date (pull request #3221)
Feat/LOY-486 consent prompt date * chore(LOY-486): update name on date * chore(LOY-486): open links in new tab * chore(LOY-486): send prompt date + refactor modal * chore(LOY-486): update README Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
@@ -60,6 +60,10 @@ export const profilingConsentInput = z.object({
|
||||
profilingConsent: z.boolean(),
|
||||
})
|
||||
|
||||
export const profilingConsentPromptDateInput = z.object({
|
||||
profilingConsentPromptDate: z.string(),
|
||||
})
|
||||
|
||||
export const getSavedPaymentCardsInput = z.object({
|
||||
supportedCards: z.array(z.string()),
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
addPromoCampaignInput,
|
||||
deleteCreditCardInput,
|
||||
profilingConsentInput,
|
||||
profilingConsentPromptDateInput,
|
||||
saveCreditCardInput,
|
||||
signupInput,
|
||||
} from "./input"
|
||||
@@ -246,6 +247,35 @@ export const userMutationRouter = router({
|
||||
return true
|
||||
}),
|
||||
}),
|
||||
profilingConsentPromptDate: router({
|
||||
update: protectedProcedure
|
||||
.input(profilingConsentPromptDateInput)
|
||||
.mutation(async function ({ ctx, input }) {
|
||||
const profilingConsentPromptDateCounter = createCounter(
|
||||
"trpc.user",
|
||||
"profilingConsentPromptDate"
|
||||
)
|
||||
const metricsProfilingConsentPromptDate =
|
||||
profilingConsentPromptDateCounter.init()
|
||||
|
||||
const apiResponse = await api.patch(api.endpoints.v2.Profile.profile, {
|
||||
body: input,
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
})
|
||||
|
||||
if (!apiResponse.ok) {
|
||||
await metricsProfilingConsentPromptDate.httpError(apiResponse)
|
||||
const text = await apiResponse.text()
|
||||
throw serverErrorByStatus(apiResponse.status, text)
|
||||
}
|
||||
|
||||
metricsProfilingConsentPromptDate.success()
|
||||
|
||||
return true
|
||||
}),
|
||||
}),
|
||||
promoCampaign: router({
|
||||
add: protectedProcedure
|
||||
.input(addPromoCampaignInput)
|
||||
|
||||
@@ -114,7 +114,7 @@ export const getUserSchema = z
|
||||
loyalty: userLoyaltySchema.optional(),
|
||||
employmentDetails: employmentDetailsSchema,
|
||||
profilingConsent: z.boolean().optional(),
|
||||
profilingConsentUpdate: z.string().optional(),
|
||||
profilingConsentUpdateDate: z.string().optional(),
|
||||
promotions: z.array(z.string()).nullish(),
|
||||
}),
|
||||
type: z.string(),
|
||||
|
||||
@@ -29,7 +29,7 @@ export function parsedUser(data: User, maskValues: boolean) {
|
||||
phoneNumber: data.phoneNumber,
|
||||
profileId: data.profileId,
|
||||
profilingConsent: data.profilingConsent,
|
||||
profilingConsentUpdate: data.profilingConsentUpdate,
|
||||
profilingConsentUpdateDate: data.profilingConsentUpdateDate,
|
||||
promotions: data.promotions || null,
|
||||
} satisfies User
|
||||
|
||||
|
||||
Reference in New Issue
Block a user