@alore/auth-react-ui 1.2.0-alpha.23 → 1.2.0-alpha.25

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.
Files changed (73) hide show
  1. package/dist/cjs/auth/ForgotPassword.js +28 -5
  2. package/dist/cjs/auth/ForgotPassword.js.map +1 -1
  3. package/dist/cjs/auth/Login.js +206 -57
  4. package/dist/cjs/auth/Login.js.map +1 -1
  5. package/dist/cjs/auth/Register.js +216 -63
  6. package/dist/cjs/auth/Register.js.map +1 -1
  7. package/dist/cjs/components/Auth.js +47 -11
  8. package/dist/cjs/components/Auth.js.map +1 -1
  9. package/dist/cjs/components/AuthProvider.d.ts +20 -0
  10. package/dist/cjs/components/BackButton.js +1 -1
  11. package/dist/cjs/components/BackButton.js.map +1 -1
  12. package/dist/cjs/components/CheckboxForm.js +2 -2
  13. package/dist/cjs/components/CheckboxForm.js.map +1 -1
  14. package/dist/cjs/components/InputForm.d.ts +2 -1
  15. package/dist/cjs/components/InputForm.js +2 -2
  16. package/dist/cjs/components/InputForm.js.map +1 -1
  17. package/dist/cjs/components/InputOTP.js +1 -1
  18. package/dist/cjs/components/InputOTP.js.map +1 -1
  19. package/dist/cjs/components/LinkButton.d.ts +14 -0
  20. package/dist/cjs/components/LinkButton.js +29 -0
  21. package/dist/cjs/components/LinkButton.js.map +1 -0
  22. package/dist/cjs/components/index.d.ts +1 -0
  23. package/dist/cjs/components/index.js +3 -1
  24. package/dist/cjs/components/index.js.map +1 -1
  25. package/dist/cjs/dictionaries/en.json +5 -1
  26. package/dist/cjs/dictionaries/pt.json +12 -8
  27. package/dist/cjs/get-dictionary.d.ts +12 -0
  28. package/dist/cjs/hooks/useAuthService.d.ts +60 -0
  29. package/dist/cjs/hooks/useAuthServiceInstance.d.ts +20 -0
  30. package/dist/cjs/hooks/useDictionary.d.ts +4 -0
  31. package/dist/cjs/machine/index.d.ts +40 -0
  32. package/dist/cjs/machine/index.js +101 -0
  33. package/dist/cjs/machine/index.js.map +1 -1
  34. package/dist/cjs/machine/types.d.ts +22 -1
  35. package/dist/cjs/styles/themes.js +2 -2
  36. package/dist/cjs/styles/themes.js.map +1 -1
  37. package/dist/mjs/auth/ForgotPassword.js +29 -6
  38. package/dist/mjs/auth/ForgotPassword.js.map +1 -1
  39. package/dist/mjs/auth/Login.js +213 -59
  40. package/dist/mjs/auth/Login.js.map +1 -1
  41. package/dist/mjs/auth/Register.js +188 -34
  42. package/dist/mjs/auth/Register.js.map +1 -1
  43. package/dist/mjs/components/Auth.js +44 -11
  44. package/dist/mjs/components/Auth.js.map +1 -1
  45. package/dist/mjs/components/AuthProvider.d.ts +20 -0
  46. package/dist/mjs/components/BackButton.js +1 -1
  47. package/dist/mjs/components/BackButton.js.map +1 -1
  48. package/dist/mjs/components/CheckboxForm.js +2 -2
  49. package/dist/mjs/components/CheckboxForm.js.map +1 -1
  50. package/dist/mjs/components/InputForm.d.ts +2 -1
  51. package/dist/mjs/components/InputForm.js +2 -2
  52. package/dist/mjs/components/InputForm.js.map +1 -1
  53. package/dist/mjs/components/InputOTP.js +1 -1
  54. package/dist/mjs/components/InputOTP.js.map +1 -1
  55. package/dist/mjs/components/LinkButton.d.ts +14 -0
  56. package/dist/mjs/components/LinkButton.js +10 -0
  57. package/dist/mjs/components/LinkButton.js.map +1 -0
  58. package/dist/mjs/components/index.d.ts +1 -0
  59. package/dist/mjs/components/index.js +1 -0
  60. package/dist/mjs/components/index.js.map +1 -1
  61. package/dist/mjs/dictionaries/en.json +5 -1
  62. package/dist/mjs/dictionaries/pt.json +12 -8
  63. package/dist/mjs/get-dictionary.d.ts +12 -0
  64. package/dist/mjs/hooks/useAuthService.d.ts +60 -0
  65. package/dist/mjs/hooks/useAuthServiceInstance.d.ts +20 -0
  66. package/dist/mjs/hooks/useDictionary.d.ts +4 -0
  67. package/dist/mjs/machine/index.d.ts +40 -0
  68. package/dist/mjs/machine/index.js +95 -0
  69. package/dist/mjs/machine/index.js.map +1 -1
  70. package/dist/mjs/machine/types.d.ts +22 -1
  71. package/dist/mjs/styles/themes.js +3 -2
  72. package/dist/mjs/styles/themes.js.map +1 -1
  73. package/package.json +2 -2
@@ -22,10 +22,14 @@
22
22
  "continueWith": "Ou continue com:",
23
23
  "selectAnOption": "Selecione uma das opções",
24
24
  "continueGoogle": "Google",
25
- "continueMicrosoft": "Microsoft",
25
+ "continueMicrosoft": "Continuar com a Microsoft",
26
+ "signupMicrosoft": "Inscrever-se na Microsoft",
26
27
  "signWithPasskey": "Entrar com uma passkey",
27
28
  "continueApple": "Continuar com a Apple",
28
29
  "emailDomainNotAllowed": "Domínio de e-mail não permitido",
30
+ "socialEmailMissing": "Esta conta Microsoft não possui e-mail",
31
+ "socialEmailMissingDescription": "A Microsoft não informou um endereço de e-mail para esta conta, então não é possível enviar o código de confirmação. Entre com o Google ou com e-mail e senha, ou peça ao administrador para definir um e-mail na conta.",
32
+ "togglePasswordVisibility": "Mostrar ou ocultar senha",
29
33
  "layout": {
30
34
  "default": {
31
35
  "title": "Onde a experiência do usuário e DeFi se encontram.",
@@ -42,7 +46,7 @@
42
46
  "typeEmail": "Digite o e-mail que você forneceu para o"
43
47
  },
44
48
  "login": {
45
- "login": "Conecte-se",
49
+ "login": "Entrar",
46
50
  "passkeyLogin": "Entrar com passkey",
47
51
  "password": "Senha",
48
52
  "continue": "Continuar",
@@ -54,8 +58,8 @@
54
58
  "defaultError": "Não foi possível processar seu login neste momento. ",
55
59
  "loginAccount": "Fazer login",
56
60
  "enterEmail": "Digite seu e-mail",
57
- "dontHaveAccount": "Não tem uma conta ainda? ",
58
- "signUp": "Inscrever-se",
61
+ "dontHaveAccount": "Ainda não possui uma conta? ",
62
+ "signUp": "Cadastre-se",
59
63
  "createAccount": "Criar uma account",
60
64
  "enterPassword": "Coloque sua senha",
61
65
  "verifyEmail": "Verifique seu e-mail",
@@ -83,7 +87,7 @@
83
87
  "passkeyNotSupportedDescription": "A Passkey selecionada não é suportada no seu navegador.",
84
88
  "noPasskey": "Nenhuma passkey encontrada",
85
89
  "noPasskeyDescription": "Nenhuma passkey encontrada para sua conta.",
86
- "forgotPassword": "Esqueceu sua senha?",
90
+ "forgotPassword": "Esqueceu sua senha? Clique aqui",
87
91
  "errorCode": "Código de erro:",
88
92
  "metamaskWalletConnect": "Metamask/WalletConnect"
89
93
  },
@@ -97,14 +101,14 @@
97
101
  "passkeyCreatedButNotAuthenticatedDescription": "Sua passkey foi criada, mas você precisa autenticar para completar o processo de autenticação.",
98
102
  "backToLogin": "Voltar para login",
99
103
  "forgeTitle": "Crie uma conta e resgate sua NFT",
100
- "emailLabel": "Seu email",
104
+ "emailLabel": "Insira seu e-mail",
101
105
  "emailPlaceholder": "seuemail@email.com",
102
106
  "emailInvitePlaceholder": "Este e-mail será seu login",
103
107
  "nicknameLabel": "Nome ou apelido",
104
108
  "agreeTermsPart1": "Eu concordo com os ",
105
109
  "agreeTermsPart2": "termos de serviço",
106
- "buttonStart": "Prosseguir",
107
- "alreadyHaveAccount": "Já tem uma conta? ",
110
+ "buttonStart": "Criar conta",
111
+ "alreadyHaveAccount": "Já possui uma conta? ",
108
112
  "loginHere": "Entre aqui",
109
113
  "welcome": "Bem-vindo a Alore!",
110
114
  "invitedBy": "Você foi convidado por",
@@ -29,9 +29,13 @@ export declare const dictionaries: {
29
29
  selectAnOption: string;
30
30
  continueGoogle: string;
31
31
  continueMicrosoft: string;
32
+ signupMicrosoft: string;
32
33
  signWithPasskey: string;
33
34
  continueApple: string;
34
35
  emailDomainNotAllowed: string;
36
+ socialEmailMissing: string;
37
+ socialEmailMissingDescription: string;
38
+ togglePasswordVisibility: string;
35
39
  layout: {
36
40
  default: {
37
41
  title: string;
@@ -181,9 +185,13 @@ export declare const dictionaries: {
181
185
  selectAnOption: string;
182
186
  continueGoogle: string;
183
187
  continueMicrosoft: string;
188
+ signupMicrosoft: string;
184
189
  signWithPasskey: string;
185
190
  continueApple: string;
186
191
  emailDomainNotAllowed: string;
192
+ socialEmailMissing: string;
193
+ socialEmailMissingDescription: string;
194
+ togglePasswordVisibility: string;
187
195
  layout: {
188
196
  default: {
189
197
  title: string;
@@ -334,9 +342,13 @@ export declare const getDictionary: (locale: Locale) => Promise<{
334
342
  selectAnOption: string;
335
343
  continueGoogle: string;
336
344
  continueMicrosoft: string;
345
+ signupMicrosoft: string;
337
346
  signWithPasskey: string;
338
347
  continueApple: string;
339
348
  emailDomainNotAllowed: string;
349
+ socialEmailMissing: string;
350
+ socialEmailMissingDescription: string;
351
+ togglePasswordVisibility: string;
340
352
  layout: {
341
353
  default: {
342
354
  title: string;
@@ -38,6 +38,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
38
38
  accessToken: string;
39
39
  providerName: string;
40
40
  };
41
+ } | {
42
+ type: "SOCIAL_LOGIN";
43
+ payload: {
44
+ idToken: string;
45
+ providerName: string;
46
+ device?: string | undefined;
47
+ nonce?: string | undefined;
48
+ sessionId?: string | undefined;
49
+ emailCode?: string | undefined;
50
+ };
41
51
  } | {
42
52
  type: "START_PASSKEY_LOGIN";
43
53
  payload: {
@@ -303,6 +313,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
303
313
  accessToken: string;
304
314
  providerName: string;
305
315
  };
316
+ } | {
317
+ type: "SOCIAL_LOGIN";
318
+ payload: {
319
+ idToken: string;
320
+ providerName: string;
321
+ device?: string | undefined;
322
+ nonce?: string | undefined;
323
+ sessionId?: string | undefined;
324
+ emailCode?: string | undefined;
325
+ };
306
326
  } | {
307
327
  type: "START_PASSKEY_LOGIN";
308
328
  payload: {
@@ -565,6 +585,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
565
585
  accessToken: string;
566
586
  providerName: string;
567
587
  };
588
+ } | {
589
+ type: "SOCIAL_LOGIN";
590
+ payload: {
591
+ idToken: string;
592
+ providerName: string;
593
+ device?: string | undefined;
594
+ nonce?: string | undefined;
595
+ sessionId?: string | undefined;
596
+ emailCode?: string | undefined;
597
+ };
568
598
  } | {
569
599
  type: "START_PASSKEY_LOGIN";
570
600
  payload: {
@@ -827,6 +857,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
827
857
  accessToken: string;
828
858
  providerName: string;
829
859
  };
860
+ } | {
861
+ type: "SOCIAL_LOGIN";
862
+ payload: {
863
+ idToken: string;
864
+ providerName: string;
865
+ device?: string | undefined;
866
+ nonce?: string | undefined;
867
+ sessionId?: string | undefined;
868
+ emailCode?: string | undefined;
869
+ };
830
870
  } | {
831
871
  type: "START_PASSKEY_LOGIN";
832
872
  payload: {
@@ -1089,6 +1129,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
1089
1129
  accessToken: string;
1090
1130
  providerName: string;
1091
1131
  };
1132
+ } | {
1133
+ type: "SOCIAL_LOGIN";
1134
+ payload: {
1135
+ idToken: string;
1136
+ providerName: string;
1137
+ device?: string | undefined;
1138
+ nonce?: string | undefined;
1139
+ sessionId?: string | undefined;
1140
+ emailCode?: string | undefined;
1141
+ };
1092
1142
  } | {
1093
1143
  type: "START_PASSKEY_LOGIN";
1094
1144
  payload: {
@@ -1354,6 +1404,16 @@ declare const useAuthService: () => readonly [import("xstate").State<import("../
1354
1404
  accessToken: string;
1355
1405
  providerName: string;
1356
1406
  };
1407
+ } | {
1408
+ type: "SOCIAL_LOGIN";
1409
+ payload: {
1410
+ idToken: string;
1411
+ providerName: string;
1412
+ device?: string | undefined;
1413
+ nonce?: string | undefined;
1414
+ sessionId?: string | undefined;
1415
+ emailCode?: string | undefined;
1416
+ };
1357
1417
  } | {
1358
1418
  type: "START_PASSKEY_LOGIN";
1359
1419
  payload: {
@@ -38,6 +38,16 @@ declare const useAuthServiceInstance: () => import("xstate").Interpreter<import(
38
38
  accessToken: string;
39
39
  providerName: string;
40
40
  };
41
+ } | {
42
+ type: "SOCIAL_LOGIN";
43
+ payload: {
44
+ idToken: string;
45
+ providerName: string;
46
+ device?: string | undefined;
47
+ nonce?: string | undefined;
48
+ sessionId?: string | undefined;
49
+ emailCode?: string | undefined;
50
+ };
41
51
  } | {
42
52
  type: "START_PASSKEY_LOGIN";
43
53
  payload: {
@@ -303,6 +313,16 @@ declare const useAuthServiceInstance: () => import("xstate").Interpreter<import(
303
313
  accessToken: string;
304
314
  providerName: string;
305
315
  };
316
+ } | {
317
+ type: "SOCIAL_LOGIN";
318
+ payload: {
319
+ idToken: string;
320
+ providerName: string;
321
+ device?: string | undefined;
322
+ nonce?: string | undefined;
323
+ sessionId?: string | undefined;
324
+ emailCode?: string | undefined;
325
+ };
306
326
  } | {
307
327
  type: "START_PASSKEY_LOGIN";
308
328
  payload: {
@@ -24,9 +24,13 @@ declare const useDictionary: (locale: Locale) => {
24
24
  selectAnOption: string;
25
25
  continueGoogle: string;
26
26
  continueMicrosoft: string;
27
+ signupMicrosoft: string;
27
28
  signWithPasskey: string;
28
29
  continueApple: string;
29
30
  emailDomainNotAllowed: string;
31
+ socialEmailMissing: string;
32
+ socialEmailMissingDescription: string;
33
+ togglePasswordVisibility: string;
30
34
  layout: {
31
35
  default: {
32
36
  title: string;
@@ -39,6 +39,16 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
39
39
  accessToken: string;
40
40
  providerName: string;
41
41
  };
42
+ } | {
43
+ type: "SOCIAL_LOGIN";
44
+ payload: {
45
+ idToken: string;
46
+ providerName: string;
47
+ device?: string | undefined;
48
+ nonce?: string | undefined;
49
+ sessionId?: string | undefined;
50
+ emailCode?: string | undefined;
51
+ };
42
52
  } | {
43
53
  type: "START_PASSKEY_LOGIN";
44
54
  payload: {
@@ -304,6 +314,16 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
304
314
  accessToken: string;
305
315
  providerName: string;
306
316
  };
317
+ } | {
318
+ type: "SOCIAL_LOGIN";
319
+ payload: {
320
+ idToken: string;
321
+ providerName: string;
322
+ device?: string | undefined;
323
+ nonce?: string | undefined;
324
+ sessionId?: string | undefined;
325
+ emailCode?: string | undefined;
326
+ };
307
327
  } | {
308
328
  type: "START_PASSKEY_LOGIN";
309
329
  payload: {
@@ -567,6 +587,16 @@ export declare const authService: (services: {}, context: AuthMachineContext) =>
567
587
  accessToken: string;
568
588
  providerName: string;
569
589
  };
590
+ } | {
591
+ type: "SOCIAL_LOGIN";
592
+ payload: {
593
+ idToken: string;
594
+ providerName: string;
595
+ device?: string | undefined;
596
+ nonce?: string | undefined;
597
+ sessionId?: string | undefined;
598
+ emailCode?: string | undefined;
599
+ };
570
600
  } | {
571
601
  type: "START_PASSKEY_LOGIN";
572
602
  payload: {
@@ -832,6 +862,16 @@ export declare const authService: (services: {}, context: AuthMachineContext) =>
832
862
  accessToken: string;
833
863
  providerName: string;
834
864
  };
865
+ } | {
866
+ type: "SOCIAL_LOGIN";
867
+ payload: {
868
+ idToken: string;
869
+ providerName: string;
870
+ device?: string | undefined;
871
+ nonce?: string | undefined;
872
+ sessionId?: string | undefined;
873
+ emailCode?: string | undefined;
874
+ };
835
875
  } | {
836
876
  type: "START_PASSKEY_LOGIN";
837
877
  payload: {
@@ -18,6 +18,7 @@ const initialContext = {
18
18
  error: undefined,
19
19
  active2fa: undefined,
20
20
  sessionId: undefined,
21
+ socialChallenge: undefined,
21
22
  registerUser: undefined,
22
23
  socialProviderRegisterUser: undefined,
23
24
  googleOtpCode: undefined,
@@ -195,6 +196,7 @@ exports.authMachine = (0, xstate_1.createMachine)({
195
196
  on: {
196
197
  LOGIN_WITH_WEB3CONNECTOR: '#authMachine.active.web3Connector',
197
198
  GOOGLE_LOGIN: 'googleLogin',
199
+ SOCIAL_LOGIN: 'socialLogin',
198
200
  ADVANCE_TO_PASSWORD: 'inputPassword',
199
201
  SIGN_IN_WITH_PASSKEY: '#authMachine.active.login.idle.signWithPasskey',
200
202
  SELECT_PASSWORD_METHOD: [
@@ -672,6 +674,87 @@ exports.authMachine = (0, xstate_1.createMachine)({
672
674
  },
673
675
  ],
674
676
  },
677
+ socialLogin: {
678
+ invoke: {
679
+ src: 'socialLogin',
680
+ onDone: [
681
+ {
682
+ // The provider did not vouch for the address, so the
683
+ // backend emailed a code to it. The token is kept so the
684
+ // second call can present the same one alongside the
685
+ // code — the session binds both, and a token for another
686
+ // account would not satisfy it.
687
+ target: 'socialEmailCode',
688
+ actions: (0, xstate_1.assign)({
689
+ socialChallenge: (_, event) => event.data.emailChallenge,
690
+ sessionId: (_, event) => event.data.emailChallenge.sessionId,
691
+ }),
692
+ cond: 'isSocialEmailChallenge',
693
+ },
694
+ {
695
+ // 201: the backend created the account on this call, so
696
+ // the consuming app must see onRegister, not onLogin.
697
+ target: '#authMachine.active.register.userCreated',
698
+ actions: 'setSocialSessionUser',
699
+ cond: 'isNewUser',
700
+ },
701
+ {
702
+ target: 'successfulLogin',
703
+ actions: 'setSocialSessionUser',
704
+ },
705
+ ],
706
+ onError: [
707
+ {
708
+ // A wrong or expired code must land back on the code
709
+ // screen with the challenge intact, not drop the user to
710
+ // the start with no way to retype it.
711
+ target: 'socialEmailCode',
712
+ cond: 'hasSocialChallenge',
713
+ actions: (0, xstate_1.assign)((ctx, event) => {
714
+ var _a, _b, _c;
715
+ return ({
716
+ error: {
717
+ code: (_a = event.data) === null || _a === void 0 ? void 0 : _a.type,
718
+ message: ((_b = event.data) === null || _b === void 0 ? void 0 : _b.message) || ((_c = event.data) === null || _c === void 0 ? void 0 : _c.error) || event.data,
719
+ email: ctx.credentialEmail,
720
+ },
721
+ });
722
+ }),
723
+ },
724
+ {
725
+ target: 'idle',
726
+ actions: (0, xstate_1.assign)((ctx, event) => {
727
+ var _a, _b, _c, _d;
728
+ return ({
729
+ error: {
730
+ code: (_a = event.data) === null || _a === void 0 ? void 0 : _a.type,
731
+ message: ((_b = event.data) === null || _b === void 0 ? void 0 : _b.type) === 'EMAIL_DOMAIN_NOT_ALLOWED'
732
+ ? 'EMAIL_DOMAIN_NOT_ALLOWED'
733
+ : ((_c = event.data) === null || _c === void 0 ? void 0 : _c.message) || ((_d = event.data) === null || _d === void 0 ? void 0 : _d.error) || event.data,
734
+ email: ctx.credentialEmail,
735
+ },
736
+ });
737
+ }),
738
+ },
739
+ ],
740
+ },
741
+ },
742
+ // Waiting on the code emailed to the address the provider
743
+ // claimed. SOCIAL_LOGIN re-enters the same state above, this
744
+ // time carrying the session and the code.
745
+ socialEmailCode: {
746
+ on: {
747
+ SOCIAL_LOGIN: 'socialLogin',
748
+ BACK: {
749
+ target: 'idle',
750
+ actions: (0, xstate_1.assign)({
751
+ socialChallenge: () => undefined,
752
+ sessionId: () => undefined,
753
+ error: () => undefined,
754
+ }),
755
+ },
756
+ },
757
+ },
675
758
  googleLogin: {
676
759
  invoke: {
677
760
  src: 'googleLogin',
@@ -845,6 +928,10 @@ exports.authMachine = (0, xstate_1.createMachine)({
845
928
  actions: 'setupRegisterUser',
846
929
  },
847
930
  GOOGLE_LOGIN: 'googleLogin',
931
+ // Signing up with Google enters the SAME state as login: the backend's
932
+ // 201-vs-200 answer decides whether this ends in register.userCreated
933
+ // or successfulLogin, so the entry point does not need its own branch.
934
+ SOCIAL_LOGIN: '#authMachine.active.login.socialLogin',
848
935
  SEND_REGISTRATION_EMAIL: {
849
936
  target: 'sendingEmail',
850
937
  actions: (0, xstate_1.assign)({
@@ -1444,6 +1531,9 @@ exports.authMachine = (0, xstate_1.createMachine)({
1444
1531
  fetchForgeData: (_, event) => __awaiter(void 0, void 0, void 0, function* () {
1445
1532
  throw new Error('Not implemented');
1446
1533
  }),
1534
+ socialLogin: (_, event) => __awaiter(void 0, void 0, void 0, function* () {
1535
+ throw new Error('Not implemented');
1536
+ }),
1447
1537
  googleLogin: (_, event) => __awaiter(void 0, void 0, void 0, function* () {
1448
1538
  throw new Error('Not implemented');
1449
1539
  }),
@@ -1454,6 +1544,8 @@ exports.authMachine = (0, xstate_1.createMachine)({
1454
1544
  guards: {
1455
1545
  // @ts-ignore
1456
1546
  isNewUser: (_, event) => !!event.data.isNewUser,
1547
+ isSocialEmailChallenge: (_, event) => { var _a; return !!((_a = event.data) === null || _a === void 0 ? void 0 : _a.emailChallenge); },
1548
+ hasSocialChallenge: (context) => !!context.socialChallenge,
1457
1549
  forgeClaim: (_, event) => !!event.forgeId,
1458
1550
  hasSalt: (context) => !!context.salt,
1459
1551
  hasHardware2FA: (context, event) => {
@@ -1494,6 +1586,13 @@ exports.authMachine = (0, xstate_1.createMachine)({
1494
1586
  setSessionUser: (0, xstate_1.assign)({
1495
1587
  sessionUser: (_, event) => event.data,
1496
1588
  }),
1589
+ // socialLogin resolves { sessionUser, isNewUser } rather than the user
1590
+ // itself, because the 201-vs-200 distinction drives which callback the
1591
+ // consuming app sees. Unwrap it, or every reader of sessionUser gets the
1592
+ // envelope and reads undefined off it.
1593
+ setSocialSessionUser: (0, xstate_1.assign)({
1594
+ sessionUser: (_, event) => { var _a; return (_a = event.data) === null || _a === void 0 ? void 0 : _a.sessionUser; },
1595
+ }),
1497
1596
  setupRegisterUser: (0, xstate_1.assign)({
1498
1597
  registerUser: (_, event) => (event === null || event === void 0 ? void 0 : event.registerUser) || undefined,
1499
1598
  }),
@@ -1555,6 +1654,8 @@ const authService = (services, context) => {
1555
1654
  guards: {
1556
1655
  // @ts-ignore
1557
1656
  isNewUser: (_, event) => !!event.data.isNewUser,
1657
+ isSocialEmailChallenge: (_, event) => { var _a; return !!((_a = event.data) === null || _a === void 0 ? void 0 : _a.emailChallenge); },
1658
+ hasSocialChallenge: (ctx) => !!ctx.socialChallenge,
1558
1659
  forgeClaim: (_, event) => !!event.forgeId,
1559
1660
  hasSalt: (ctx) => !!ctx.salt,
1560
1661
  hasHardware2FA: (ctx, event) => {