@smartcrab/react 0.4.0-next-20261016193833 → 0.4.0-next-20261102230503

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.
@@ -56,9 +56,6 @@ export const createSessionListController = (client) => {
56
56
  transition(IDLE);
57
57
  return ok({ revoked: true });
58
58
  };
59
- const clear = () => {
60
- transition(IDLE);
61
- };
62
59
  return {
63
60
  getSnapshot: () => snapshot,
64
61
  subscribe: (listener) => {
@@ -68,6 +65,6 @@ export const createSessionListController = (client) => {
68
65
  load,
69
66
  revoke,
70
67
  revokeAll,
71
- clear,
68
+ clear: () => transition(IDLE),
72
69
  };
73
70
  };
@@ -78,14 +78,13 @@ export const createSignInFlow = (client) => {
78
78
  return invalidState("awaiting_method", flowState.step);
79
79
  }
80
80
  const state = flowState;
81
- const retry = (token, attemptId) => run(token, attemptId);
82
81
  async function run(challengeToken, attemptId) {
83
82
  const outcome = await client.startEmailOtp(state.transactionId, challengeToken === undefined ? { email } : { email, challenge_token: challengeToken });
84
83
  if (attemptId !== undefined && attemptId !== challengeAttemptId) {
85
84
  return invalidState("challenge_required", snapshot.state.step);
86
85
  }
87
86
  if (!outcome.ok) {
88
- handleOperationFailure(outcome.error, "email_start", state, "send_email", retry);
87
+ handleOperationFailure(outcome.error, "email_start", state, "send_email", run);
89
88
  return outcome;
90
89
  }
91
90
  pendingAdaptiveChallenge = null;
@@ -107,7 +106,6 @@ export const createSignInFlow = (client) => {
107
106
  return invalidState("email_challenge_sent", flowState.step);
108
107
  }
109
108
  const state = flowState;
110
- const retry = (token, attemptId) => run(token, attemptId);
111
109
  async function run(challengeToken, attemptId) {
112
110
  const outcome = await client.resendEmailOtp(state.transactionId, challengeToken === undefined
113
111
  ? { challenge_id: state.challengeId }
@@ -116,7 +114,7 @@ export const createSignInFlow = (client) => {
116
114
  return invalidState("challenge_required", snapshot.state.step);
117
115
  }
118
116
  if (!outcome.ok) {
119
- handleOperationFailure(outcome.error, "email_resend", state, "resend_email", retry);
117
+ handleOperationFailure(outcome.error, "email_resend", state, "resend_email", run);
120
118
  return outcome;
121
119
  }
122
120
  pendingAdaptiveChallenge = null;
@@ -158,7 +156,6 @@ export const createSignInFlow = (client) => {
158
156
  transactionId: state.transactionId,
159
157
  ceremony: "passkey_authentication",
160
158
  };
161
- const retry = (token, attemptId) => run(token, attemptId);
162
159
  async function run(challengeToken, attemptId) {
163
160
  const outcome = challengeToken === undefined
164
161
  ? await client.startPasskeyAuthentication(state.transactionId)
@@ -169,7 +166,7 @@ export const createSignInFlow = (client) => {
169
166
  return invalidState("challenge_required", snapshot.state.step);
170
167
  }
171
168
  if (!outcome.ok) {
172
- handleOperationFailure(outcome.error, "passkey_auth_options", resumeState, "passkey", retry);
169
+ handleOperationFailure(outcome.error, "passkey_auth_options", resumeState, "passkey", run);
173
170
  return outcome;
174
171
  }
175
172
  pendingAdaptiveChallenge = null;
@@ -197,7 +194,6 @@ export const createSignInFlow = (client) => {
197
194
  return invalidState("awaiting_method", flowState.step);
198
195
  }
199
196
  const state = flowState;
200
- const retry = (token, attemptId) => run(token, attemptId);
201
197
  async function run(challengeToken, attemptId) {
202
198
  const outcome = challengeToken === undefined
203
199
  ? await client.startSocialSignIn(state.transactionId, provider)
@@ -208,7 +204,7 @@ export const createSignInFlow = (client) => {
208
204
  return invalidState("challenge_required", snapshot.state.step);
209
205
  }
210
206
  if (!outcome.ok) {
211
- handleOperationFailure(outcome.error, "social_start", state, "social", retry);
207
+ handleOperationFailure(outcome.error, "social_start", state, "social", run);
212
208
  return outcome;
213
209
  }
214
210
  pendingAdaptiveChallenge = null;
@@ -51,9 +51,6 @@ export const createUserProfileController = (client) => {
51
51
  transition({ status: "loaded", user: outcome.value, error: null });
52
52
  return ok(outcome.value);
53
53
  };
54
- const clear = () => {
55
- transition(IDLE);
56
- };
57
54
  return {
58
55
  getSnapshot: () => snapshot,
59
56
  subscribe: (listener) => {
@@ -62,6 +59,6 @@ export const createUserProfileController = (client) => {
62
59
  },
63
60
  load,
64
61
  update,
65
- clear,
62
+ clear: () => transition(IDLE),
66
63
  };
67
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartcrab/react",
3
- "version": "0.4.0-next-20261016193833",
3
+ "version": "0.4.0-next-20261102230503",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,16 +27,16 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@smartcrab/browser": "0.4.0-next-20261016193833"
30
+ "@smartcrab/browser": "0.4.0-next-20261102230503"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=19"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "5.9.3",
37
- "vitest": "4.1.11",
37
+ "vitest": "4.1.12",
38
38
  "@types/react": "19.3.0",
39
- "react": "19.3.0"
39
+ "react": "19.3.1"
40
40
  },
41
41
  "scripts": {
42
42
  "typecheck": "tsc --noEmit",
@@ -102,10 +102,6 @@ export const createSessionListController = (client: SessionListClient): SessionL
102
102
  return ok({ revoked: true });
103
103
  };
104
104
 
105
- const clear = (): void => {
106
- transition(IDLE);
107
- };
108
-
109
105
  return {
110
106
  getSnapshot: () => snapshot,
111
107
  subscribe: (listener) => {
@@ -115,6 +111,6 @@ export const createSessionListController = (client: SessionListClient): SessionL
115
111
  load,
116
112
  revoke,
117
113
  revokeAll,
118
- clear,
114
+ clear: () => transition(IDLE),
119
115
  };
120
116
  };
@@ -262,7 +262,6 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
262
262
  return invalidState("awaiting_method", flowState.step);
263
263
  }
264
264
  const state: AwaitingMethodState = flowState;
265
- const retry: AdaptiveChallengeRetry = (token, attemptId) => run(token, attemptId);
266
265
  async function run(
267
266
  challengeToken?: string,
268
267
  attemptId?: number,
@@ -275,7 +274,7 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
275
274
  return invalidState("challenge_required", snapshot.state.step);
276
275
  }
277
276
  if (!outcome.ok) {
278
- handleOperationFailure(outcome.error, "email_start", state, "send_email", retry);
277
+ handleOperationFailure(outcome.error, "email_start", state, "send_email", run);
279
278
  return outcome;
280
279
  }
281
280
  pendingAdaptiveChallenge = null;
@@ -298,7 +297,6 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
298
297
  return invalidState("email_challenge_sent", flowState.step);
299
298
  }
300
299
  const state: EmailChallengeSentState = flowState;
301
- const retry: AdaptiveChallengeRetry = (token, attemptId) => run(token, attemptId);
302
300
  async function run(
303
301
  challengeToken?: string,
304
302
  attemptId?: number,
@@ -313,7 +311,7 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
313
311
  return invalidState("challenge_required", snapshot.state.step);
314
312
  }
315
313
  if (!outcome.ok) {
316
- handleOperationFailure(outcome.error, "email_resend", state, "resend_email", retry);
314
+ handleOperationFailure(outcome.error, "email_resend", state, "resend_email", run);
317
315
  return outcome;
318
316
  }
319
317
  pendingAdaptiveChallenge = null;
@@ -359,7 +357,6 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
359
357
  transactionId: state.transactionId,
360
358
  ceremony: "passkey_authentication",
361
359
  };
362
- const retry: AdaptiveChallengeRetry = (token, attemptId) => run(token, attemptId);
363
360
  async function run(
364
361
  challengeToken?: string,
365
362
  attemptId?: number,
@@ -374,13 +371,7 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
374
371
  return invalidState("challenge_required", snapshot.state.step);
375
372
  }
376
373
  if (!outcome.ok) {
377
- handleOperationFailure(
378
- outcome.error,
379
- "passkey_auth_options",
380
- resumeState,
381
- "passkey",
382
- retry,
383
- );
374
+ handleOperationFailure(outcome.error, "passkey_auth_options", resumeState, "passkey", run);
384
375
  return outcome;
385
376
  }
386
377
  pendingAdaptiveChallenge = null;
@@ -417,7 +408,6 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
417
408
  return invalidState("awaiting_method", flowState.step);
418
409
  }
419
410
  const state: AwaitingMethodState = flowState;
420
- const retry: AdaptiveChallengeRetry = (token, attemptId) => run(token, attemptId);
421
411
  async function run(
422
412
  challengeToken?: string,
423
413
  attemptId?: number,
@@ -432,7 +422,7 @@ export const createSignInFlow = (client: SignInFlowClient): SignInFlow => {
432
422
  return invalidState("challenge_required", snapshot.state.step);
433
423
  }
434
424
  if (!outcome.ok) {
435
- handleOperationFailure(outcome.error, "social_start", state, "social", retry);
425
+ handleOperationFailure(outcome.error, "social_start", state, "social", run);
436
426
  return outcome;
437
427
  }
438
428
  pendingAdaptiveChallenge = null;
@@ -89,10 +89,6 @@ export const createUserProfileController = (client: UserProfileClient): UserProf
89
89
  return ok(outcome.value);
90
90
  };
91
91
 
92
- const clear = (): void => {
93
- transition(IDLE);
94
- };
95
-
96
92
  return {
97
93
  getSnapshot: () => snapshot,
98
94
  subscribe: (listener) => {
@@ -101,6 +97,6 @@ export const createUserProfileController = (client: UserProfileClient): UserProf
101
97
  },
102
98
  load,
103
99
  update,
104
- clear,
100
+ clear: () => transition(IDLE),
105
101
  };
106
102
  };