@djangocfg/api 2.1.476 → 2.1.478
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.cjs +173 -121
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +36 -2
- package/dist/auth.d.ts +36 -2
- package/dist/auth.mjs +173 -121
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +18 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +49 -0
- package/dist/clients.d.ts +49 -0
- package/dist/clients.mjs +18 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +133 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +61 -1
- package/dist/hooks.d.ts +61 -1
- package/dist/hooks.mjs +133 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -4
- package/dist/index.d.ts +72 -4
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +1 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +74 -0
- package/src/_api/generated/_cfg_accounts/openapi.json +76 -0
- package/src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/MarketingConsentDefaultEnum.ts +9 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts +2 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +2 -0
- package/src/_api/generated/openapi.json +76 -0
- package/src/_api/generated/sdk.gen.ts +40 -21
- package/src/_api/generated/types.gen.ts +47 -0
- package/src/auth/context/AuthContext.tsx +12 -4
- package/src/auth/context/types.ts +2 -2
- package/src/auth/hooks/useAuthForm.ts +15 -3
- package/src/auth/hooks/useAuthFormState.ts +5 -0
- package/src/auth/types/form.ts +27 -0
- package/src/auth/types/index.ts +1 -0
- package/src/hooks/index.ts +6 -0
package/dist/auth.d.cts
CHANGED
|
@@ -72,6 +72,14 @@ type OtpRequestRequest = {
|
|
|
72
72
|
* Source URL for tracking registration (e.g., https://my.djangocfg.com)
|
|
73
73
|
*/
|
|
74
74
|
source_url?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Marketing-consent choice made at signup (absent/null = not asked, false = declined)
|
|
77
|
+
*/
|
|
78
|
+
marketing_consent?: boolean | null;
|
|
79
|
+
/**
|
|
80
|
+
* Version of the consent disclosure text shown (e.g. product-updates-reg-v1)
|
|
81
|
+
*/
|
|
82
|
+
consent_disclosure_version?: string;
|
|
75
83
|
};
|
|
76
84
|
/**
|
|
77
85
|
* OTP request response.
|
|
@@ -338,6 +346,16 @@ interface OTPRequestResult {
|
|
|
338
346
|
/** Webmail deep-link for the recipient's provider, or null if unknown. */
|
|
339
347
|
webmail?: WebmailLink | null;
|
|
340
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Marketing-consent payload attached to an OTP request when the consuming
|
|
351
|
+
* app enables the opt-in checkbox. Absent ⇒ the request body is unchanged.
|
|
352
|
+
*/
|
|
353
|
+
interface OTPRequestConsent {
|
|
354
|
+
/** Checkbox value at submit time. */
|
|
355
|
+
marketingConsent: boolean;
|
|
356
|
+
/** Version tag of the disclosure copy the user saw (e.g. "product-updates-reg-v1"). */
|
|
357
|
+
disclosureVersion: string;
|
|
358
|
+
}
|
|
341
359
|
interface AuthFormState {
|
|
342
360
|
/** Email address */
|
|
343
361
|
identifier: string;
|
|
@@ -347,6 +365,12 @@ interface AuthFormState {
|
|
|
347
365
|
isLoading: boolean;
|
|
348
366
|
/** Terms acceptance state */
|
|
349
367
|
acceptedTerms: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Marketing-consent checkbox state. `null` = feature not initialised (no
|
|
370
|
+
* checkbox rendered, or default not yet resolved); the layout owns the
|
|
371
|
+
* jurisdiction-aware default on mount.
|
|
372
|
+
*/
|
|
373
|
+
marketingConsent: boolean | null;
|
|
350
374
|
/** Current form step */
|
|
351
375
|
step: AuthStep;
|
|
352
376
|
/** Error message */
|
|
@@ -372,6 +396,7 @@ interface AuthFormStateHandlers {
|
|
|
372
396
|
setIdentifier: (identifier: string) => void;
|
|
373
397
|
setOtp: (otp: string) => void;
|
|
374
398
|
setAcceptedTerms: (accepted: boolean) => void;
|
|
399
|
+
setMarketingConsent: (consent: boolean | null) => void;
|
|
375
400
|
setError: (error: string) => void;
|
|
376
401
|
clearError: () => void;
|
|
377
402
|
setStep: (step: AuthStep) => void;
|
|
@@ -429,6 +454,15 @@ interface UseAuthFormOptions {
|
|
|
429
454
|
redirectUrl?: string;
|
|
430
455
|
/** If true, user must accept terms before submitting. Default: false */
|
|
431
456
|
requireTermsAcceptance?: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Enables the marketing-consent opt-in: when set, the checkbox value +
|
|
459
|
+
* this disclosure version are sent with the OTP request. Absent ⇒ the
|
|
460
|
+
* request body is unchanged (backward compatible).
|
|
461
|
+
*/
|
|
462
|
+
marketingConsent?: {
|
|
463
|
+
/** Version tag of the disclosure copy shown next to the checkbox. */
|
|
464
|
+
disclosureVersion: string;
|
|
465
|
+
};
|
|
432
466
|
/** Path to auth page for auto-OTP detection. Default: '/auth' */
|
|
433
467
|
authPath?: string;
|
|
434
468
|
}
|
|
@@ -467,7 +501,7 @@ interface AuthContextType {
|
|
|
467
501
|
getSavedEmail: () => string | null;
|
|
468
502
|
saveEmail: (email: string) => void;
|
|
469
503
|
clearSavedEmail: () => void;
|
|
470
|
-
requestOTP: (identifier: string, sourceUrl?: string) => Promise<OTPRequestResult>;
|
|
504
|
+
requestOTP: (identifier: string, sourceUrl?: string, consent?: OTPRequestConsent) => Promise<OTPRequestResult>;
|
|
471
505
|
verifyOTP: (identifier: string, otpCode: string, sourceUrl?: string, redirectUrl?: string, skipRedirect?: boolean) => Promise<{
|
|
472
506
|
success: boolean;
|
|
473
507
|
message: string;
|
|
@@ -1114,4 +1148,4 @@ declare const Analytics: {
|
|
|
1114
1148
|
setUser(userId: string | null): void;
|
|
1115
1149
|
};
|
|
1116
1150
|
|
|
1117
|
-
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AnalyticsSink, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UseTwoFactorVerifyOptions, type UseTwoFactorVerifyReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setAnalyticsSink, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, useTwoFactorVerify, validateEmail, validateIdentifier };
|
|
1151
|
+
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AnalyticsSink, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestConsent, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UseTwoFactorVerifyOptions, type UseTwoFactorVerifyReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setAnalyticsSink, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, useTwoFactorVerify, validateEmail, validateIdentifier };
|
package/dist/auth.d.ts
CHANGED
|
@@ -72,6 +72,14 @@ type OtpRequestRequest = {
|
|
|
72
72
|
* Source URL for tracking registration (e.g., https://my.djangocfg.com)
|
|
73
73
|
*/
|
|
74
74
|
source_url?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Marketing-consent choice made at signup (absent/null = not asked, false = declined)
|
|
77
|
+
*/
|
|
78
|
+
marketing_consent?: boolean | null;
|
|
79
|
+
/**
|
|
80
|
+
* Version of the consent disclosure text shown (e.g. product-updates-reg-v1)
|
|
81
|
+
*/
|
|
82
|
+
consent_disclosure_version?: string;
|
|
75
83
|
};
|
|
76
84
|
/**
|
|
77
85
|
* OTP request response.
|
|
@@ -338,6 +346,16 @@ interface OTPRequestResult {
|
|
|
338
346
|
/** Webmail deep-link for the recipient's provider, or null if unknown. */
|
|
339
347
|
webmail?: WebmailLink | null;
|
|
340
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Marketing-consent payload attached to an OTP request when the consuming
|
|
351
|
+
* app enables the opt-in checkbox. Absent ⇒ the request body is unchanged.
|
|
352
|
+
*/
|
|
353
|
+
interface OTPRequestConsent {
|
|
354
|
+
/** Checkbox value at submit time. */
|
|
355
|
+
marketingConsent: boolean;
|
|
356
|
+
/** Version tag of the disclosure copy the user saw (e.g. "product-updates-reg-v1"). */
|
|
357
|
+
disclosureVersion: string;
|
|
358
|
+
}
|
|
341
359
|
interface AuthFormState {
|
|
342
360
|
/** Email address */
|
|
343
361
|
identifier: string;
|
|
@@ -347,6 +365,12 @@ interface AuthFormState {
|
|
|
347
365
|
isLoading: boolean;
|
|
348
366
|
/** Terms acceptance state */
|
|
349
367
|
acceptedTerms: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Marketing-consent checkbox state. `null` = feature not initialised (no
|
|
370
|
+
* checkbox rendered, or default not yet resolved); the layout owns the
|
|
371
|
+
* jurisdiction-aware default on mount.
|
|
372
|
+
*/
|
|
373
|
+
marketingConsent: boolean | null;
|
|
350
374
|
/** Current form step */
|
|
351
375
|
step: AuthStep;
|
|
352
376
|
/** Error message */
|
|
@@ -372,6 +396,7 @@ interface AuthFormStateHandlers {
|
|
|
372
396
|
setIdentifier: (identifier: string) => void;
|
|
373
397
|
setOtp: (otp: string) => void;
|
|
374
398
|
setAcceptedTerms: (accepted: boolean) => void;
|
|
399
|
+
setMarketingConsent: (consent: boolean | null) => void;
|
|
375
400
|
setError: (error: string) => void;
|
|
376
401
|
clearError: () => void;
|
|
377
402
|
setStep: (step: AuthStep) => void;
|
|
@@ -429,6 +454,15 @@ interface UseAuthFormOptions {
|
|
|
429
454
|
redirectUrl?: string;
|
|
430
455
|
/** If true, user must accept terms before submitting. Default: false */
|
|
431
456
|
requireTermsAcceptance?: boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Enables the marketing-consent opt-in: when set, the checkbox value +
|
|
459
|
+
* this disclosure version are sent with the OTP request. Absent ⇒ the
|
|
460
|
+
* request body is unchanged (backward compatible).
|
|
461
|
+
*/
|
|
462
|
+
marketingConsent?: {
|
|
463
|
+
/** Version tag of the disclosure copy shown next to the checkbox. */
|
|
464
|
+
disclosureVersion: string;
|
|
465
|
+
};
|
|
432
466
|
/** Path to auth page for auto-OTP detection. Default: '/auth' */
|
|
433
467
|
authPath?: string;
|
|
434
468
|
}
|
|
@@ -467,7 +501,7 @@ interface AuthContextType {
|
|
|
467
501
|
getSavedEmail: () => string | null;
|
|
468
502
|
saveEmail: (email: string) => void;
|
|
469
503
|
clearSavedEmail: () => void;
|
|
470
|
-
requestOTP: (identifier: string, sourceUrl?: string) => Promise<OTPRequestResult>;
|
|
504
|
+
requestOTP: (identifier: string, sourceUrl?: string, consent?: OTPRequestConsent) => Promise<OTPRequestResult>;
|
|
471
505
|
verifyOTP: (identifier: string, otpCode: string, sourceUrl?: string, redirectUrl?: string, skipRedirect?: boolean) => Promise<{
|
|
472
506
|
success: boolean;
|
|
473
507
|
message: string;
|
|
@@ -1114,4 +1148,4 @@ declare const Analytics: {
|
|
|
1114
1148
|
setUser(userId: string | null): void;
|
|
1115
1149
|
};
|
|
1116
1150
|
|
|
1117
|
-
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AnalyticsSink, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UseTwoFactorVerifyOptions, type UseTwoFactorVerifyReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setAnalyticsSink, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, useTwoFactorVerify, validateEmail, validateIdentifier };
|
|
1151
|
+
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AnalyticsSink, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestConsent, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UseTwoFactorVerifyOptions, type UseTwoFactorVerifyReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setAnalyticsSink, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, useTwoFactorVerify, validateEmail, validateIdentifier };
|
package/dist/auth.mjs
CHANGED
|
@@ -948,6 +948,7 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "") => {
|
|
|
948
948
|
const [otp, setOtp] = useState2("");
|
|
949
949
|
const [isLoading, setIsLoading] = useState2(false);
|
|
950
950
|
const [acceptedTerms, setAcceptedTerms] = useState2(true);
|
|
951
|
+
const [marketingConsent, setMarketingConsent] = useState2(null);
|
|
951
952
|
const [step, setStep] = useState2("identifier");
|
|
952
953
|
const [error, setError] = useState2("");
|
|
953
954
|
const [webmail, setWebmail] = useState2(null);
|
|
@@ -981,6 +982,7 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "") => {
|
|
|
981
982
|
otp,
|
|
982
983
|
isLoading,
|
|
983
984
|
acceptedTerms,
|
|
985
|
+
marketingConsent,
|
|
984
986
|
step,
|
|
985
987
|
error,
|
|
986
988
|
twoFactorSessionId,
|
|
@@ -995,6 +997,7 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "") => {
|
|
|
995
997
|
setIdentifier,
|
|
996
998
|
setOtp,
|
|
997
999
|
setAcceptedTerms,
|
|
1000
|
+
setMarketingConsent,
|
|
998
1001
|
setError,
|
|
999
1002
|
clearError,
|
|
1000
1003
|
setStep,
|
|
@@ -1992,6 +1995,24 @@ var CfgAccounts = class {
|
|
|
1992
1995
|
static {
|
|
1993
1996
|
__name(this, "CfgAccounts");
|
|
1994
1997
|
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Marketing-consent checkbox policy for the caller's jurisdiction.
|
|
2000
|
+
*
|
|
2001
|
+
* Derived from the edge-provided CF-IPCountry — the same signal stored
|
|
2002
|
+
* as consent evidence at request time. Unknown country fails safe to
|
|
2003
|
+
* "unchecked".
|
|
2004
|
+
*/
|
|
2005
|
+
static cfgAccountsOtpConsentPolicyRetrieve(options) {
|
|
2006
|
+
return (options?.client ?? client).get({
|
|
2007
|
+
security: [
|
|
2008
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2009
|
+
{ scheme: "bearer", type: "http" },
|
|
2010
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2011
|
+
],
|
|
2012
|
+
url: "/cfg/accounts/otp/consent-policy/",
|
|
2013
|
+
...options
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
1995
2016
|
/**
|
|
1996
2017
|
* Request OTP code to email.
|
|
1997
2018
|
*/
|
|
@@ -2793,6 +2814,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2793
2814
|
sourceUrl,
|
|
2794
2815
|
redirectUrl,
|
|
2795
2816
|
requireTermsAcceptance = false,
|
|
2817
|
+
marketingConsent: marketingConsentOption,
|
|
2796
2818
|
authPath = "/auth"
|
|
2797
2819
|
} = options;
|
|
2798
2820
|
const formState = useAuthFormState();
|
|
@@ -2810,6 +2832,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2810
2832
|
otp,
|
|
2811
2833
|
isLoading,
|
|
2812
2834
|
acceptedTerms,
|
|
2835
|
+
marketingConsent,
|
|
2813
2836
|
twoFactorSessionId,
|
|
2814
2837
|
twoFactorCode,
|
|
2815
2838
|
useBackupCode,
|
|
@@ -2873,7 +2896,8 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2873
2896
|
setIsLoading(true);
|
|
2874
2897
|
clearError();
|
|
2875
2898
|
try {
|
|
2876
|
-
const
|
|
2899
|
+
const consent = marketingConsentOption ? { marketingConsent: marketingConsent === true, disclosureVersion: marketingConsentOption.disclosureVersion } : void 0;
|
|
2900
|
+
const result = await requestOTP(identifier, sourceUrl, consent);
|
|
2877
2901
|
if (result.success) {
|
|
2878
2902
|
saveIdentifierToStorage(identifier);
|
|
2879
2903
|
setWebmail(result.webmail ?? null);
|
|
@@ -2899,6 +2923,8 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2899
2923
|
identifier,
|
|
2900
2924
|
acceptedTerms,
|
|
2901
2925
|
requireTermsAcceptance,
|
|
2926
|
+
marketingConsent,
|
|
2927
|
+
marketingConsentOption,
|
|
2902
2928
|
validateIdentifier2,
|
|
2903
2929
|
requestOTP,
|
|
2904
2930
|
saveIdentifierToStorage,
|
|
@@ -2959,7 +2985,8 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2959
2985
|
setIsLoading(true);
|
|
2960
2986
|
clearError();
|
|
2961
2987
|
try {
|
|
2962
|
-
const
|
|
2988
|
+
const consent = marketingConsentOption ? { marketingConsent: marketingConsent === true, disclosureVersion: marketingConsentOption.disclosureVersion } : void 0;
|
|
2989
|
+
const result = await requestOTP(identifier, sourceUrl, consent);
|
|
2963
2990
|
if (result.success) {
|
|
2964
2991
|
saveIdentifierToStorage(identifier);
|
|
2965
2992
|
setWebmail(result.webmail ?? null);
|
|
@@ -2980,7 +3007,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
|
|
|
2980
3007
|
} finally {
|
|
2981
3008
|
setIsLoading(false);
|
|
2982
3009
|
}
|
|
2983
|
-
}, [identifier, requestOTP, saveIdentifierToStorage, setOtp, setError, setIsLoading, clearError, startRateLimitCountdown, setWebmail, onError, sourceUrl]);
|
|
3010
|
+
}, [identifier, marketingConsent, marketingConsentOption, requestOTP, saveIdentifierToStorage, setOtp, setError, setIsLoading, clearError, startRateLimitCountdown, setWebmail, onError, sourceUrl]);
|
|
2984
3011
|
const handleBackToIdentifier = useCallback5(() => {
|
|
2985
3012
|
setStep("identifier");
|
|
2986
3013
|
clearError();
|
|
@@ -3820,30 +3847,46 @@ var OAuthProvidersResponseSchema = z11.object({
|
|
|
3820
3847
|
providers: z11.array(z11.object({}).passthrough())
|
|
3821
3848
|
});
|
|
3822
3849
|
|
|
3850
|
+
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts
|
|
3851
|
+
import useSWR4 from "swr";
|
|
3852
|
+
|
|
3853
|
+
// src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts
|
|
3854
|
+
import { z as z13 } from "zod";
|
|
3855
|
+
|
|
3856
|
+
// src/_api/generated/_cfg_accounts/schemas/MarketingConsentDefaultEnum.ts
|
|
3857
|
+
import { z as z12 } from "zod";
|
|
3858
|
+
var MarketingConsentDefaultEnumSchema = z12.enum(["checked", "unchecked"]);
|
|
3859
|
+
|
|
3860
|
+
// src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts
|
|
3861
|
+
var ConsentPolicySchema = z13.object({
|
|
3862
|
+
country: z13.string(),
|
|
3863
|
+
marketing_consent_default: MarketingConsentDefaultEnumSchema
|
|
3864
|
+
});
|
|
3865
|
+
|
|
3823
3866
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts
|
|
3824
3867
|
import useSWRMutation7 from "swr/mutation";
|
|
3825
3868
|
|
|
3826
3869
|
// src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts
|
|
3827
|
-
import { z as
|
|
3870
|
+
import { z as z16 } from "zod";
|
|
3828
3871
|
|
|
3829
3872
|
// src/_api/generated/_cfg_accounts/schemas/WebmailLink.ts
|
|
3830
|
-
import { z as
|
|
3873
|
+
import { z as z15 } from "zod";
|
|
3831
3874
|
|
|
3832
3875
|
// src/_api/generated/_cfg_accounts/schemas/WebmailLinkProviderEnum.ts
|
|
3833
|
-
import { z as
|
|
3834
|
-
var WebmailLinkProviderEnumSchema =
|
|
3876
|
+
import { z as z14 } from "zod";
|
|
3877
|
+
var WebmailLinkProviderEnumSchema = z14.enum(["gmail", "outlook", "yahoo", "icloud", "proton", "zoho", "aol", "fastmail", "gmx", "mailcom", "mail_ru", "yandex", "rambler", "qq", "netease", "sina", "aliyun", "naver", "daum", "web_de", "tonline", "seznam", "wp_pl", "o2_pl", "interia", "libero", "virgilio", "orange", "laposte", "free_fr", "sfr"]);
|
|
3835
3878
|
|
|
3836
3879
|
// src/_api/generated/_cfg_accounts/schemas/WebmailLink.ts
|
|
3837
|
-
var WebmailLinkSchema =
|
|
3880
|
+
var WebmailLinkSchema = z15.object({
|
|
3838
3881
|
provider: WebmailLinkProviderEnumSchema,
|
|
3839
|
-
provider_name:
|
|
3840
|
-
url:
|
|
3841
|
-
is_search:
|
|
3882
|
+
provider_name: z15.string(),
|
|
3883
|
+
url: z15.string(),
|
|
3884
|
+
is_search: z15.boolean()
|
|
3842
3885
|
});
|
|
3843
3886
|
|
|
3844
3887
|
// src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts
|
|
3845
|
-
var OTPRequestResponseSchema =
|
|
3846
|
-
message:
|
|
3888
|
+
var OTPRequestResponseSchema = z16.object({
|
|
3889
|
+
message: z16.string(),
|
|
3847
3890
|
webmail: WebmailLinkSchema.nullable().optional()
|
|
3848
3891
|
});
|
|
3849
3892
|
|
|
@@ -3898,52 +3941,52 @@ __name(useCfgAccountsOtpRequestCreate, "useCfgAccountsOtpRequestCreate");
|
|
|
3898
3941
|
import useSWRMutation8 from "swr/mutation";
|
|
3899
3942
|
|
|
3900
3943
|
// src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
|
|
3901
|
-
import { z as
|
|
3944
|
+
import { z as z19 } from "zod";
|
|
3902
3945
|
|
|
3903
3946
|
// src/_api/generated/_cfg_accounts/schemas/User.ts
|
|
3904
|
-
import { z as
|
|
3947
|
+
import { z as z18 } from "zod";
|
|
3905
3948
|
|
|
3906
3949
|
// src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts
|
|
3907
|
-
import { z as
|
|
3908
|
-
var CentrifugoTokenSchema =
|
|
3909
|
-
token:
|
|
3910
|
-
centrifugo_url:
|
|
3911
|
-
expires_at:
|
|
3912
|
-
channels:
|
|
3950
|
+
import { z as z17 } from "zod";
|
|
3951
|
+
var CentrifugoTokenSchema = z17.object({
|
|
3952
|
+
token: z17.string(),
|
|
3953
|
+
centrifugo_url: z17.string(),
|
|
3954
|
+
expires_at: z17.string().datetime({ offset: true }),
|
|
3955
|
+
channels: z17.array(z17.string())
|
|
3913
3956
|
});
|
|
3914
3957
|
|
|
3915
3958
|
// src/_api/generated/_cfg_accounts/schemas/User.ts
|
|
3916
|
-
var UserSchema =
|
|
3917
|
-
id:
|
|
3918
|
-
email:
|
|
3919
|
-
first_name:
|
|
3920
|
-
last_name:
|
|
3921
|
-
full_name:
|
|
3922
|
-
initials:
|
|
3923
|
-
display_username:
|
|
3924
|
-
company:
|
|
3925
|
-
phone:
|
|
3926
|
-
position:
|
|
3927
|
-
language:
|
|
3928
|
-
timezone:
|
|
3929
|
-
avatar:
|
|
3930
|
-
is_staff:
|
|
3931
|
-
is_superuser:
|
|
3932
|
-
date_joined:
|
|
3933
|
-
last_login:
|
|
3934
|
-
unanswered_messages_count:
|
|
3959
|
+
var UserSchema = z18.object({
|
|
3960
|
+
id: z18.number().int(),
|
|
3961
|
+
email: z18.email(),
|
|
3962
|
+
first_name: z18.string().max(50).nullable().optional(),
|
|
3963
|
+
last_name: z18.string().max(50).nullable().optional(),
|
|
3964
|
+
full_name: z18.string(),
|
|
3965
|
+
initials: z18.string(),
|
|
3966
|
+
display_username: z18.string(),
|
|
3967
|
+
company: z18.string().max(100).nullable().optional(),
|
|
3968
|
+
phone: z18.string().max(20).nullable().optional(),
|
|
3969
|
+
position: z18.string().max(100).nullable().optional(),
|
|
3970
|
+
language: z18.string().max(10).nullable().optional(),
|
|
3971
|
+
timezone: z18.string().max(64).nullable().optional(),
|
|
3972
|
+
avatar: z18.string().nullable(),
|
|
3973
|
+
is_staff: z18.boolean(),
|
|
3974
|
+
is_superuser: z18.boolean(),
|
|
3975
|
+
date_joined: z18.string().datetime({ offset: true }),
|
|
3976
|
+
last_login: z18.string().datetime({ offset: true }).nullable(),
|
|
3977
|
+
unanswered_messages_count: z18.number().int().default(0),
|
|
3935
3978
|
centrifugo: CentrifugoTokenSchema.nullable(),
|
|
3936
|
-
api_key:
|
|
3979
|
+
api_key: z18.string().nullable()
|
|
3937
3980
|
});
|
|
3938
3981
|
|
|
3939
3982
|
// src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
|
|
3940
|
-
var OTPVerifyResponseSchema =
|
|
3941
|
-
requires_2fa:
|
|
3942
|
-
session_id:
|
|
3943
|
-
refresh:
|
|
3944
|
-
access:
|
|
3983
|
+
var OTPVerifyResponseSchema = z19.object({
|
|
3984
|
+
requires_2fa: z19.boolean().default(false).optional(),
|
|
3985
|
+
session_id: z19.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
|
|
3986
|
+
refresh: z19.string().nullable().optional(),
|
|
3987
|
+
access: z19.string().nullable().optional(),
|
|
3945
3988
|
user: UserSchema.nullable().optional(),
|
|
3946
|
-
should_prompt_2fa:
|
|
3989
|
+
should_prompt_2fa: z19.boolean().optional()
|
|
3947
3990
|
});
|
|
3948
3991
|
|
|
3949
3992
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts
|
|
@@ -4045,10 +4088,10 @@ __name(useCfgAccountsProfileAvatarCreate, "useCfgAccountsProfileAvatarCreate");
|
|
|
4045
4088
|
import useSWRMutation10 from "swr/mutation";
|
|
4046
4089
|
|
|
4047
4090
|
// src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts
|
|
4048
|
-
import { z as
|
|
4049
|
-
var AccountDeleteResponseSchema =
|
|
4050
|
-
success:
|
|
4051
|
-
message:
|
|
4091
|
+
import { z as z20 } from "zod";
|
|
4092
|
+
var AccountDeleteResponseSchema = z20.object({
|
|
4093
|
+
success: z20.boolean(),
|
|
4094
|
+
message: z20.string()
|
|
4052
4095
|
});
|
|
4053
4096
|
|
|
4054
4097
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts
|
|
@@ -4103,7 +4146,7 @@ function useCfgAccountsProfilePartialUpdate(config) {
|
|
|
4103
4146
|
__name(useCfgAccountsProfilePartialUpdate, "useCfgAccountsProfilePartialUpdate");
|
|
4104
4147
|
|
|
4105
4148
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts
|
|
4106
|
-
import
|
|
4149
|
+
import useSWR5 from "swr";
|
|
4107
4150
|
|
|
4108
4151
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts
|
|
4109
4152
|
import useSWRMutation13 from "swr/mutation";
|
|
@@ -4163,111 +4206,113 @@ import useSWRMutation15 from "swr/mutation";
|
|
|
4163
4206
|
import useSWRMutation16 from "swr/mutation";
|
|
4164
4207
|
|
|
4165
4208
|
// src/_api/generated/_cfg_accounts/schemas/TokenRefresh.ts
|
|
4166
|
-
import { z as
|
|
4167
|
-
var TokenRefreshSchema =
|
|
4168
|
-
access:
|
|
4169
|
-
refresh:
|
|
4209
|
+
import { z as z21 } from "zod";
|
|
4210
|
+
var TokenRefreshSchema = z21.object({
|
|
4211
|
+
access: z21.string(),
|
|
4212
|
+
refresh: z21.string()
|
|
4170
4213
|
});
|
|
4171
4214
|
|
|
4172
4215
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyRequest.ts
|
|
4173
|
-
import { z as
|
|
4174
|
-
var APIKeyRequestSchema =
|
|
4175
|
-
key:
|
|
4176
|
-
reissued_at:
|
|
4177
|
-
created_at:
|
|
4216
|
+
import { z as z22 } from "zod";
|
|
4217
|
+
var APIKeyRequestSchema = z22.object({
|
|
4218
|
+
key: z22.string().min(1),
|
|
4219
|
+
reissued_at: z22.string().datetime({ offset: true }).nullable(),
|
|
4220
|
+
created_at: z22.string().datetime({ offset: true })
|
|
4178
4221
|
});
|
|
4179
4222
|
|
|
4180
4223
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyTestRequest.ts
|
|
4181
|
-
import { z as
|
|
4182
|
-
var APIKeyTestRequestSchema =
|
|
4183
|
-
key:
|
|
4224
|
+
import { z as z23 } from "zod";
|
|
4225
|
+
var APIKeyTestRequestSchema = z23.object({
|
|
4226
|
+
key: z23.string().min(1)
|
|
4184
4227
|
});
|
|
4185
4228
|
|
|
4186
4229
|
// src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts
|
|
4187
|
-
import { z as
|
|
4188
|
-
var CfgUserUpdateRequestSchema =
|
|
4189
|
-
first_name:
|
|
4190
|
-
last_name:
|
|
4191
|
-
company:
|
|
4192
|
-
phone:
|
|
4193
|
-
position:
|
|
4194
|
-
language:
|
|
4195
|
-
timezone:
|
|
4230
|
+
import { z as z24 } from "zod";
|
|
4231
|
+
var CfgUserUpdateRequestSchema = z24.object({
|
|
4232
|
+
first_name: z24.string().max(50).optional(),
|
|
4233
|
+
last_name: z24.string().max(50).optional(),
|
|
4234
|
+
company: z24.string().max(100).optional(),
|
|
4235
|
+
phone: z24.string().max(20).optional(),
|
|
4236
|
+
position: z24.string().max(100).optional(),
|
|
4237
|
+
language: z24.string().max(10).optional(),
|
|
4238
|
+
timezone: z24.string().max(64).optional()
|
|
4196
4239
|
});
|
|
4197
4240
|
|
|
4198
4241
|
// src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
|
|
4199
|
-
import { z as
|
|
4200
|
-
var OAuthAuthorizeRequestRequestSchema =
|
|
4201
|
-
redirect_uri:
|
|
4202
|
-
source_url:
|
|
4242
|
+
import { z as z25 } from "zod";
|
|
4243
|
+
var OAuthAuthorizeRequestRequestSchema = z25.object({
|
|
4244
|
+
redirect_uri: z25.string().optional(),
|
|
4245
|
+
source_url: z25.string().optional()
|
|
4203
4246
|
});
|
|
4204
4247
|
|
|
4205
4248
|
// src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
|
|
4206
|
-
import { z as
|
|
4207
|
-
var OAuthCallbackRequestRequestSchema =
|
|
4208
|
-
code:
|
|
4209
|
-
state:
|
|
4210
|
-
redirect_uri:
|
|
4249
|
+
import { z as z26 } from "zod";
|
|
4250
|
+
var OAuthCallbackRequestRequestSchema = z26.object({
|
|
4251
|
+
code: z26.string().min(10).max(500),
|
|
4252
|
+
state: z26.string().min(20).max(100),
|
|
4253
|
+
redirect_uri: z26.string().optional()
|
|
4211
4254
|
});
|
|
4212
4255
|
|
|
4213
4256
|
// src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
|
|
4214
|
-
import { z as
|
|
4215
|
-
var OAuthDisconnectRequestRequestSchema =
|
|
4257
|
+
import { z as z27 } from "zod";
|
|
4258
|
+
var OAuthDisconnectRequestRequestSchema = z27.object({
|
|
4216
4259
|
provider: OAuthProviderEnumSchema
|
|
4217
4260
|
});
|
|
4218
4261
|
|
|
4219
4262
|
// src/_api/generated/_cfg_accounts/schemas/OAuthError.ts
|
|
4220
|
-
import { z as
|
|
4221
|
-
var OAuthErrorSchema =
|
|
4222
|
-
error:
|
|
4223
|
-
error_description:
|
|
4263
|
+
import { z as z28 } from "zod";
|
|
4264
|
+
var OAuthErrorSchema = z28.object({
|
|
4265
|
+
error: z28.string(),
|
|
4266
|
+
error_description: z28.string().optional()
|
|
4224
4267
|
});
|
|
4225
4268
|
|
|
4226
4269
|
// src/_api/generated/_cfg_accounts/schemas/OTPErrorResponse.ts
|
|
4227
|
-
import { z as
|
|
4228
|
-
var OTPErrorResponseSchema =
|
|
4229
|
-
error:
|
|
4230
|
-
error_code:
|
|
4231
|
-
retry_after:
|
|
4270
|
+
import { z as z29 } from "zod";
|
|
4271
|
+
var OTPErrorResponseSchema = z29.object({
|
|
4272
|
+
error: z29.string(),
|
|
4273
|
+
error_code: z29.string().nullable().optional(),
|
|
4274
|
+
retry_after: z29.number().int().nullable().optional()
|
|
4232
4275
|
});
|
|
4233
4276
|
|
|
4234
4277
|
// src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts
|
|
4235
|
-
import { z as
|
|
4236
|
-
var OTPRequestRequestSchema =
|
|
4237
|
-
identifier:
|
|
4238
|
-
source_url:
|
|
4278
|
+
import { z as z30 } from "zod";
|
|
4279
|
+
var OTPRequestRequestSchema = z30.object({
|
|
4280
|
+
identifier: z30.string().min(1),
|
|
4281
|
+
source_url: z30.string().optional(),
|
|
4282
|
+
marketing_consent: z30.boolean().nullable().optional(),
|
|
4283
|
+
consent_disclosure_version: z30.string().max(64).optional()
|
|
4239
4284
|
});
|
|
4240
4285
|
|
|
4241
4286
|
// src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts
|
|
4242
|
-
import { z as
|
|
4243
|
-
var OTPVerifyRequestSchema =
|
|
4244
|
-
identifier:
|
|
4245
|
-
otp:
|
|
4246
|
-
source_url:
|
|
4287
|
+
import { z as z31 } from "zod";
|
|
4288
|
+
var OTPVerifyRequestSchema = z31.object({
|
|
4289
|
+
identifier: z31.string().min(1),
|
|
4290
|
+
otp: z31.string().min(4).max(4),
|
|
4291
|
+
source_url: z31.string().optional()
|
|
4247
4292
|
});
|
|
4248
4293
|
|
|
4249
4294
|
// src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
|
|
4250
|
-
import { z as
|
|
4251
|
-
var PatchedCfgUserUpdateRequestSchema =
|
|
4252
|
-
first_name:
|
|
4253
|
-
last_name:
|
|
4254
|
-
company:
|
|
4255
|
-
phone:
|
|
4256
|
-
position:
|
|
4257
|
-
language:
|
|
4258
|
-
timezone:
|
|
4295
|
+
import { z as z32 } from "zod";
|
|
4296
|
+
var PatchedCfgUserUpdateRequestSchema = z32.object({
|
|
4297
|
+
first_name: z32.string().max(50).optional(),
|
|
4298
|
+
last_name: z32.string().max(50).optional(),
|
|
4299
|
+
company: z32.string().max(100).optional(),
|
|
4300
|
+
phone: z32.string().max(20).optional(),
|
|
4301
|
+
position: z32.string().max(100).optional(),
|
|
4302
|
+
language: z32.string().max(10).optional(),
|
|
4303
|
+
timezone: z32.string().max(64).optional()
|
|
4259
4304
|
});
|
|
4260
4305
|
|
|
4261
4306
|
// src/_api/generated/_cfg_accounts/schemas/TokenBlacklistRequest.ts
|
|
4262
|
-
import { z as
|
|
4263
|
-
var TokenBlacklistRequestSchema =
|
|
4264
|
-
refresh:
|
|
4307
|
+
import { z as z33 } from "zod";
|
|
4308
|
+
var TokenBlacklistRequestSchema = z33.object({
|
|
4309
|
+
refresh: z33.string().min(1)
|
|
4265
4310
|
});
|
|
4266
4311
|
|
|
4267
4312
|
// src/_api/generated/_cfg_accounts/schemas/TokenRefreshRequest.ts
|
|
4268
|
-
import { z as
|
|
4269
|
-
var TokenRefreshRequestSchema =
|
|
4270
|
-
refresh:
|
|
4313
|
+
import { z as z34 } from "zod";
|
|
4314
|
+
var TokenRefreshRequestSchema = z34.object({
|
|
4315
|
+
refresh: z34.string().min(1)
|
|
4271
4316
|
});
|
|
4272
4317
|
|
|
4273
4318
|
// src/auth/context/AccountsContext.tsx
|
|
@@ -4522,13 +4567,20 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
|
|
|
4522
4567
|
}
|
|
4523
4568
|
}, [loadCurrentProfile, router]);
|
|
4524
4569
|
const requestOTP = useCallback11(
|
|
4525
|
-
async (identifier, sourceUrl) => {
|
|
4570
|
+
async (identifier, sourceUrl, consent) => {
|
|
4526
4571
|
auth.clearSession();
|
|
4527
4572
|
try {
|
|
4528
|
-
const
|
|
4573
|
+
const body = {
|
|
4529
4574
|
identifier,
|
|
4530
|
-
source_url: sourceUrl
|
|
4531
|
-
|
|
4575
|
+
source_url: sourceUrl,
|
|
4576
|
+
// Absent when the consuming app didn't enable the opt-in checkbox —
|
|
4577
|
+
// the backend treats absent/null as "not asked".
|
|
4578
|
+
...consent && {
|
|
4579
|
+
marketing_consent: consent.marketingConsent,
|
|
4580
|
+
consent_disclosure_version: consent.disclosureVersion
|
|
4581
|
+
}
|
|
4582
|
+
};
|
|
4583
|
+
const result = await accountsRef.current.requestOTP(body);
|
|
4532
4584
|
Analytics.event("auth_otp_request" /* AUTH_OTP_REQUEST */, {
|
|
4533
4585
|
category: "auth" /* AUTH */,
|
|
4534
4586
|
label: "email"
|