@aws-amplify/ui 6.15.5 → 6.15.6
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.
|
@@ -73,6 +73,9 @@ function createAuthenticatorMachine(options) {
|
|
|
73
73
|
onDone: { actions: 'setUser', target: 'setup' },
|
|
74
74
|
onError: { target: 'setup' },
|
|
75
75
|
},
|
|
76
|
+
// handle a sign out occurring while `handleGetCurrentUser` is in flight,
|
|
77
|
+
// exiting cancels the invoke so a stale user cannot be applied
|
|
78
|
+
on: { SIGN_OUT: '#authenticator.signOut' },
|
|
76
79
|
},
|
|
77
80
|
setup: {
|
|
78
81
|
initial: 'initConfig',
|
|
@@ -118,6 +121,7 @@ function createAuthenticatorMachine(options) {
|
|
|
118
121
|
},
|
|
119
122
|
onError: { target: '#authenticator.setup' },
|
|
120
123
|
},
|
|
124
|
+
on: { SIGN_OUT: '#authenticator.signOut' },
|
|
121
125
|
},
|
|
122
126
|
signInActor: {
|
|
123
127
|
initial: 'spawnActor',
|
|
@@ -271,6 +275,14 @@ function createAuthenticatorMachine(options) {
|
|
|
271
275
|
},
|
|
272
276
|
},
|
|
273
277
|
on: {
|
|
278
|
+
// `SIGN_OUT` handled by `setup.initConfig` moves the machine past setup without
|
|
279
|
+
// the UI ever sending `INIT`, leaving it configured with defaults. Accept `INIT`
|
|
280
|
+
// late so a subsequently rendered UI can still apply its `config` and `services`.
|
|
281
|
+
INIT: {
|
|
282
|
+
cond: 'shouldInitialize',
|
|
283
|
+
actions: 'configure',
|
|
284
|
+
target: '#authenticator.setup.getConfig',
|
|
285
|
+
},
|
|
274
286
|
SIGN_IN_WITH_REDIRECT: { target: '#authenticator.getCurrentUser' },
|
|
275
287
|
CHANGE: { actions: 'forwardToActor' },
|
|
276
288
|
BLUR: { actions: 'forwardToActor' },
|
|
@@ -362,6 +374,7 @@ function createAuthenticatorMachine(options) {
|
|
|
362
374
|
return {
|
|
363
375
|
services: { ...defaultServices, ...customServices },
|
|
364
376
|
config,
|
|
377
|
+
hasInitialized: true,
|
|
365
378
|
};
|
|
366
379
|
}),
|
|
367
380
|
setHasSetup: assign({ hasSetup: true }),
|
|
@@ -372,6 +385,9 @@ function createAuthenticatorMachine(options) {
|
|
|
372
385
|
isInitialStateSignUp: ({ config }) => config.initialState === 'signUp',
|
|
373
386
|
isInitialStateResetPassword: ({ config }) => config.initialState === 'forgotPassword',
|
|
374
387
|
shouldSetup: ({ hasSetup }) => !hasSetup,
|
|
388
|
+
// `hasSetup` prevents the late `INIT` from interrupting `idle`, which must
|
|
389
|
+
// resolve `handleGetCurrentUser` before the machine leaves it
|
|
390
|
+
shouldInitialize: ({ hasSetup, hasInitialized }) => hasSetup && !hasInitialized,
|
|
375
391
|
hasUser: ({ user }) => {
|
|
376
392
|
return !!user;
|
|
377
393
|
},
|
package/dist/index.js
CHANGED
|
@@ -6154,6 +6154,9 @@ function createAuthenticatorMachine(options) {
|
|
|
6154
6154
|
onDone: { actions: 'setUser', target: 'setup' },
|
|
6155
6155
|
onError: { target: 'setup' },
|
|
6156
6156
|
},
|
|
6157
|
+
// handle a sign out occurring while `handleGetCurrentUser` is in flight,
|
|
6158
|
+
// exiting cancels the invoke so a stale user cannot be applied
|
|
6159
|
+
on: { SIGN_OUT: '#authenticator.signOut' },
|
|
6157
6160
|
},
|
|
6158
6161
|
setup: {
|
|
6159
6162
|
initial: 'initConfig',
|
|
@@ -6199,6 +6202,7 @@ function createAuthenticatorMachine(options) {
|
|
|
6199
6202
|
},
|
|
6200
6203
|
onError: { target: '#authenticator.setup' },
|
|
6201
6204
|
},
|
|
6205
|
+
on: { SIGN_OUT: '#authenticator.signOut' },
|
|
6202
6206
|
},
|
|
6203
6207
|
signInActor: {
|
|
6204
6208
|
initial: 'spawnActor',
|
|
@@ -6352,6 +6356,14 @@ function createAuthenticatorMachine(options) {
|
|
|
6352
6356
|
},
|
|
6353
6357
|
},
|
|
6354
6358
|
on: {
|
|
6359
|
+
// `SIGN_OUT` handled by `setup.initConfig` moves the machine past setup without
|
|
6360
|
+
// the UI ever sending `INIT`, leaving it configured with defaults. Accept `INIT`
|
|
6361
|
+
// late so a subsequently rendered UI can still apply its `config` and `services`.
|
|
6362
|
+
INIT: {
|
|
6363
|
+
cond: 'shouldInitialize',
|
|
6364
|
+
actions: 'configure',
|
|
6365
|
+
target: '#authenticator.setup.getConfig',
|
|
6366
|
+
},
|
|
6355
6367
|
SIGN_IN_WITH_REDIRECT: { target: '#authenticator.getCurrentUser' },
|
|
6356
6368
|
CHANGE: { actions: 'forwardToActor' },
|
|
6357
6369
|
BLUR: { actions: 'forwardToActor' },
|
|
@@ -6443,6 +6455,7 @@ function createAuthenticatorMachine(options) {
|
|
|
6443
6455
|
return {
|
|
6444
6456
|
services: { ...defaultServices, ...customServices },
|
|
6445
6457
|
config,
|
|
6458
|
+
hasInitialized: true,
|
|
6446
6459
|
};
|
|
6447
6460
|
}),
|
|
6448
6461
|
setHasSetup: xstate.assign({ hasSetup: true }),
|
|
@@ -6453,6 +6466,9 @@ function createAuthenticatorMachine(options) {
|
|
|
6453
6466
|
isInitialStateSignUp: ({ config }) => config.initialState === 'signUp',
|
|
6454
6467
|
isInitialStateResetPassword: ({ config }) => config.initialState === 'forgotPassword',
|
|
6455
6468
|
shouldSetup: ({ hasSetup }) => !hasSetup,
|
|
6469
|
+
// `hasSetup` prevents the late `INIT` from interrupting `idle`, which must
|
|
6470
|
+
// resolve `handleGetCurrentUser` before the machine leaves it
|
|
6471
|
+
shouldInitialize: ({ hasSetup, hasInitialized }) => hasSetup && !hasInitialized,
|
|
6456
6472
|
hasUser: ({ user }) => {
|
|
6457
6473
|
return !!user;
|
|
6458
6474
|
},
|
|
@@ -96,6 +96,7 @@ export interface AuthContext {
|
|
|
96
96
|
user?: AuthUser;
|
|
97
97
|
actorDoneData?: ActorDoneData;
|
|
98
98
|
hasSetup?: boolean;
|
|
99
|
+
hasInitialized?: boolean;
|
|
99
100
|
passwordlessCapabilities?: PasswordlessCapabilities;
|
|
100
101
|
}
|
|
101
102
|
export type InitialStep = 'FORGOT_PASSWORD' | 'SIGN_IN' | 'SIGN_UP';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui",
|
|
3
|
-
"version": "6.15.
|
|
3
|
+
"version": "6.15.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/webpack-env": "^1.16.2",
|
|
65
65
|
"autoprefixer": "^10.3.1",
|
|
66
66
|
"glob": "^10.5.0",
|
|
67
|
-
"postcss": "^8.5.
|
|
67
|
+
"postcss": "^8.5.18",
|
|
68
68
|
"sass": "^1.35.2",
|
|
69
69
|
"style-dictionary": "3.9.1",
|
|
70
70
|
"ts-node": "^10.9.1"
|