@clicktap/state 0.2.0 → 0.9.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clicktap/state",
3
- "version": "0.2.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "author": "Clicktap",
6
6
  "description": "A state management library for Clicktap reference frontend.",
@@ -12,10 +12,6 @@
12
12
  "access": "public"
13
13
  },
14
14
  "type": "module",
15
- "dependencies": {
16
- "cookie": "^0.5.0",
17
- "axios": "^1.5.0"
18
- },
19
15
  "devDependencies": {
20
16
  "@types/cookie": "^0.5.1",
21
17
  "@types/react": "18.0.28"
@@ -26,9 +22,11 @@
26
22
  "xstate": "^4.38.1",
27
23
  "@xstate/immer": "^0.3.3",
28
24
  "@xstate/inspect": "^0.8.0",
29
- "@xstate/react": "^3.2.2"
25
+ "@xstate/react": "^3.2.2",
26
+ "cookie": "^0.5.0",
27
+ "axios": "^1.5.0",
28
+ "framer-motion": "^10.16.4"
30
29
  },
31
- "module": "./index.js",
32
- "main": "./index.js",
33
- "types": "./src/index.d.ts"
30
+ "module": "./index.esm.js",
31
+ "main": "./index.esm.js"
34
32
  }
@@ -1,31 +1,282 @@
1
- import type { InterpreterFrom } from 'xstate';
2
- import type { ReactNode } from 'react';
3
- import type { NextPageContext } from 'next';
1
+ import { ReactNode } from 'react';
2
+ import { Actor, InspectionEvent, Observer } from 'xstate';
4
3
  import { authMachine } from './auth';
5
- export declare const AuthContext: import("react").Context<import("xstate").Interpreter<import("./auth").AuthMachineContext, any, import("./auth").AuthMachineEvents, {
6
- value: any;
7
- context: import("./auth").AuthMachineContext;
8
- }, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").AuthMachineEvents, import("xstate").BaseActionObject, import("xstate").ServiceMap>>>;
9
- export declare const useAuth: () => import("xstate").Interpreter<import("./auth").AuthMachineContext, any, import("./auth").AuthMachineEvents, {
10
- value: any;
11
- context: import("./auth").AuthMachineContext;
12
- }, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").AuthMachineEvents, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
13
- export declare const useUser: () => {
14
- email: string;
15
- username: string;
16
- firstName: string;
17
- lastName: string;
18
- birthdate?: Date | undefined;
19
- gender?: string | undefined;
20
- createdAt: Date;
21
- updatedAt: Date;
22
- role?: string | undefined;
23
- locked: boolean;
24
- affiliateId: string;
25
- stripeId: string;
26
- } | null;
4
+ export declare const AuthContext: import("react").Context<Actor<import("xstate").StateMachine<import("./auth").AuthMachineContext, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
5
+ [x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
6
+ type: string;
7
+ accessToken: string;
8
+ }, {
9
+ context: import("./auth").AuthMachineContext;
10
+ }>, {
11
+ [k: string]: unknown;
12
+ type: string;
13
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
14
+ type: string;
15
+ accessToken: string;
16
+ }, {
17
+ context: import("./auth").AuthMachineContext;
18
+ username: string;
19
+ password: string;
20
+ }>, {
21
+ [k: string]: unknown;
22
+ type: string;
23
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
24
+ type: string;
25
+ }, {
26
+ context: import("./auth").AuthMachineContext;
27
+ }>, {
28
+ [k: string]: unknown;
29
+ type: string;
30
+ }> | undefined;
31
+ }, {
32
+ src: "refreshAccessToken";
33
+ logic: import("xstate").PromiseActorLogic<{
34
+ type: string;
35
+ accessToken: string;
36
+ }, {
37
+ context: import("./auth").AuthMachineContext;
38
+ }>;
39
+ id: string | undefined;
40
+ } | {
41
+ src: "authenticate";
42
+ logic: import("xstate").PromiseActorLogic<{
43
+ type: string;
44
+ accessToken: string;
45
+ }, {
46
+ context: import("./auth").AuthMachineContext;
47
+ username: string;
48
+ password: string;
49
+ }>;
50
+ id: string | undefined;
51
+ } | {
52
+ src: "unauthenticate";
53
+ logic: import("xstate").PromiseActorLogic<{
54
+ type: string;
55
+ }, {
56
+ context: import("./auth").AuthMachineContext;
57
+ }>;
58
+ id: string | undefined;
59
+ }, {
60
+ type: "setUserContext";
61
+ params: import("xstate").NonReducibleUnknown;
62
+ } | {
63
+ type: "unsetUserContext";
64
+ params: import("xstate").NonReducibleUnknown;
65
+ } | {
66
+ type: "setAccessToken";
67
+ params: import("xstate").NonReducibleUnknown;
68
+ } | {
69
+ type: "unsetRefreshToken";
70
+ params: import("xstate").NonReducibleUnknown;
71
+ } | {
72
+ type: "setIgnoreRefreshToken";
73
+ params: import("xstate").NonReducibleUnknown;
74
+ } | {
75
+ type: "addError";
76
+ params: import("xstate").NonReducibleUnknown;
77
+ } | {
78
+ type: "clearErrors";
79
+ params: import("xstate").NonReducibleUnknown;
80
+ }, {
81
+ type: string;
82
+ params: import("xstate").NonReducibleUnknown;
83
+ }, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
84
+ initialContext: Partial<import("./auth").AuthMachineContext>;
85
+ initialState?: string | undefined;
86
+ }, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
87
+ src: "refreshAccessToken";
88
+ logic: import("xstate").PromiseActorLogic<{
89
+ type: string;
90
+ accessToken: string;
91
+ }, {
92
+ context: import("./auth").AuthMachineContext;
93
+ }>;
94
+ id: string | undefined;
95
+ } | {
96
+ src: "authenticate";
97
+ logic: import("xstate").PromiseActorLogic<{
98
+ type: string;
99
+ accessToken: string;
100
+ }, {
101
+ context: import("./auth").AuthMachineContext;
102
+ username: string;
103
+ password: string;
104
+ }>;
105
+ id: string | undefined;
106
+ } | {
107
+ src: "unauthenticate";
108
+ logic: import("xstate").PromiseActorLogic<{
109
+ type: string;
110
+ }, {
111
+ context: import("./auth").AuthMachineContext;
112
+ }>;
113
+ id: string | undefined;
114
+ }, {
115
+ type: "setUserContext";
116
+ params: import("xstate").NonReducibleUnknown;
117
+ } | {
118
+ type: "unsetUserContext";
119
+ params: import("xstate").NonReducibleUnknown;
120
+ } | {
121
+ type: "setAccessToken";
122
+ params: import("xstate").NonReducibleUnknown;
123
+ } | {
124
+ type: "unsetRefreshToken";
125
+ params: import("xstate").NonReducibleUnknown;
126
+ } | {
127
+ type: "setIgnoreRefreshToken";
128
+ params: import("xstate").NonReducibleUnknown;
129
+ } | {
130
+ type: "addError";
131
+ params: import("xstate").NonReducibleUnknown;
132
+ } | {
133
+ type: "clearErrors";
134
+ params: import("xstate").NonReducibleUnknown;
135
+ }, {
136
+ type: string;
137
+ params: import("xstate").NonReducibleUnknown;
138
+ }, string, string>>>>;
139
+ export declare const useAuth: () => {
140
+ authActor: Actor<import("xstate").StateMachine<import("./auth").AuthMachineContext, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
141
+ [x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
142
+ type: string;
143
+ accessToken: string;
144
+ }, {
145
+ context: import("./auth").AuthMachineContext;
146
+ }>, {
147
+ [k: string]: unknown;
148
+ type: string;
149
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
150
+ type: string;
151
+ accessToken: string;
152
+ }, {
153
+ context: import("./auth").AuthMachineContext;
154
+ username: string;
155
+ password: string;
156
+ }>, {
157
+ [k: string]: unknown;
158
+ type: string;
159
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
160
+ type: string;
161
+ }, {
162
+ context: import("./auth").AuthMachineContext;
163
+ }>, {
164
+ [k: string]: unknown;
165
+ type: string;
166
+ }> | undefined;
167
+ }, {
168
+ src: "refreshAccessToken";
169
+ logic: import("xstate").PromiseActorLogic<{
170
+ type: string;
171
+ accessToken: string;
172
+ }, {
173
+ context: import("./auth").AuthMachineContext;
174
+ }>;
175
+ id: string | undefined;
176
+ } | {
177
+ src: "authenticate";
178
+ logic: import("xstate").PromiseActorLogic<{
179
+ type: string;
180
+ accessToken: string;
181
+ }, {
182
+ context: import("./auth").AuthMachineContext;
183
+ username: string;
184
+ password: string;
185
+ }>;
186
+ id: string | undefined;
187
+ } | {
188
+ src: "unauthenticate";
189
+ logic: import("xstate").PromiseActorLogic<{
190
+ type: string;
191
+ }, {
192
+ context: import("./auth").AuthMachineContext;
193
+ }>;
194
+ id: string | undefined;
195
+ }, {
196
+ type: "setUserContext";
197
+ params: import("xstate").NonReducibleUnknown;
198
+ } | {
199
+ type: "unsetUserContext";
200
+ params: import("xstate").NonReducibleUnknown;
201
+ } | {
202
+ type: "setAccessToken";
203
+ params: import("xstate").NonReducibleUnknown;
204
+ } | {
205
+ type: "unsetRefreshToken";
206
+ params: import("xstate").NonReducibleUnknown;
207
+ } | {
208
+ type: "setIgnoreRefreshToken";
209
+ params: import("xstate").NonReducibleUnknown;
210
+ } | {
211
+ type: "addError";
212
+ params: import("xstate").NonReducibleUnknown;
213
+ } | {
214
+ type: "clearErrors";
215
+ params: import("xstate").NonReducibleUnknown;
216
+ }, {
217
+ type: string;
218
+ params: import("xstate").NonReducibleUnknown;
219
+ }, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
220
+ initialContext: Partial<import("./auth").AuthMachineContext>;
221
+ initialState?: string | undefined;
222
+ }, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
223
+ src: "refreshAccessToken";
224
+ logic: import("xstate").PromiseActorLogic<{
225
+ type: string;
226
+ accessToken: string;
227
+ }, {
228
+ context: import("./auth").AuthMachineContext;
229
+ }>;
230
+ id: string | undefined;
231
+ } | {
232
+ src: "authenticate";
233
+ logic: import("xstate").PromiseActorLogic<{
234
+ type: string;
235
+ accessToken: string;
236
+ }, {
237
+ context: import("./auth").AuthMachineContext;
238
+ username: string;
239
+ password: string;
240
+ }>;
241
+ id: string | undefined;
242
+ } | {
243
+ src: "unauthenticate";
244
+ logic: import("xstate").PromiseActorLogic<{
245
+ type: string;
246
+ }, {
247
+ context: import("./auth").AuthMachineContext;
248
+ }>;
249
+ id: string | undefined;
250
+ }, {
251
+ type: "setUserContext";
252
+ params: import("xstate").NonReducibleUnknown;
253
+ } | {
254
+ type: "unsetUserContext";
255
+ params: import("xstate").NonReducibleUnknown;
256
+ } | {
257
+ type: "setAccessToken";
258
+ params: import("xstate").NonReducibleUnknown;
259
+ } | {
260
+ type: "unsetRefreshToken";
261
+ params: import("xstate").NonReducibleUnknown;
262
+ } | {
263
+ type: "setIgnoreRefreshToken";
264
+ params: import("xstate").NonReducibleUnknown;
265
+ } | {
266
+ type: "addError";
267
+ params: import("xstate").NonReducibleUnknown;
268
+ } | {
269
+ type: "clearErrors";
270
+ params: import("xstate").NonReducibleUnknown;
271
+ }, {
272
+ type: string;
273
+ params: import("xstate").NonReducibleUnknown;
274
+ }, string, string>>>;
275
+ isLoggedIn: boolean;
276
+ };
277
+ export declare const useUser: () => Record<string, any> | null;
27
278
  type AuthOptions = {
28
- devTools: boolean;
279
+ inspect: Observer<InspectionEvent> | undefined;
29
280
  endpoints: {
30
281
  login: string;
31
282
  logout: string;
@@ -34,16 +285,149 @@ type AuthOptions = {
34
285
  };
35
286
  };
36
287
  /**
37
- * this will run on the server side as part of app.getInitialProps
38
- * @todo is it possible to share state from client to server? headers? cookies?
288
+ * runs on server side as part of withAuth HOF
289
+ *
290
+ * @todo should probably update signature to pass Partial<AuthContext> and
291
+ * Options, endpoints should probably be moved into context
39
292
  */
40
- export declare const getAuth: (context: NextPageContext, options: AuthOptions) => Promise<import("xstate").Interpreter<import("./auth").AuthMachineContext, any, import("./auth").AuthMachineEvents, {
41
- value: any;
42
- context: import("./auth").AuthMachineContext;
43
- }, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").AuthMachineEvents, import("xstate").BaseActionObject, import("xstate").ServiceMap>>>;
293
+ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) => Promise<Actor<import("xstate").StateMachine<import("./auth").AuthMachineContext, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
294
+ [x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
295
+ type: string;
296
+ accessToken: string;
297
+ }, {
298
+ context: import("./auth").AuthMachineContext;
299
+ }>, {
300
+ [k: string]: unknown;
301
+ type: string;
302
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
303
+ type: string;
304
+ accessToken: string;
305
+ }, {
306
+ context: import("./auth").AuthMachineContext;
307
+ username: string;
308
+ password: string;
309
+ }>, {
310
+ [k: string]: unknown;
311
+ type: string;
312
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
313
+ type: string;
314
+ }, {
315
+ context: import("./auth").AuthMachineContext;
316
+ }>, {
317
+ [k: string]: unknown;
318
+ type: string;
319
+ }> | undefined;
320
+ }, {
321
+ src: "refreshAccessToken";
322
+ logic: import("xstate").PromiseActorLogic<{
323
+ type: string;
324
+ accessToken: string;
325
+ }, {
326
+ context: import("./auth").AuthMachineContext;
327
+ }>;
328
+ id: string | undefined;
329
+ } | {
330
+ src: "authenticate";
331
+ logic: import("xstate").PromiseActorLogic<{
332
+ type: string;
333
+ accessToken: string;
334
+ }, {
335
+ context: import("./auth").AuthMachineContext;
336
+ username: string;
337
+ password: string;
338
+ }>;
339
+ id: string | undefined;
340
+ } | {
341
+ src: "unauthenticate";
342
+ logic: import("xstate").PromiseActorLogic<{
343
+ type: string;
344
+ }, {
345
+ context: import("./auth").AuthMachineContext;
346
+ }>;
347
+ id: string | undefined;
348
+ }, {
349
+ type: "setUserContext";
350
+ params: import("xstate").NonReducibleUnknown;
351
+ } | {
352
+ type: "unsetUserContext";
353
+ params: import("xstate").NonReducibleUnknown;
354
+ } | {
355
+ type: "setAccessToken";
356
+ params: import("xstate").NonReducibleUnknown;
357
+ } | {
358
+ type: "unsetRefreshToken";
359
+ params: import("xstate").NonReducibleUnknown;
360
+ } | {
361
+ type: "setIgnoreRefreshToken";
362
+ params: import("xstate").NonReducibleUnknown;
363
+ } | {
364
+ type: "addError";
365
+ params: import("xstate").NonReducibleUnknown;
366
+ } | {
367
+ type: "clearErrors";
368
+ params: import("xstate").NonReducibleUnknown;
369
+ }, {
370
+ type: string;
371
+ params: import("xstate").NonReducibleUnknown;
372
+ }, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
373
+ initialContext: Partial<import("./auth").AuthMachineContext>;
374
+ initialState?: string | undefined;
375
+ }, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
376
+ src: "refreshAccessToken";
377
+ logic: import("xstate").PromiseActorLogic<{
378
+ type: string;
379
+ accessToken: string;
380
+ }, {
381
+ context: import("./auth").AuthMachineContext;
382
+ }>;
383
+ id: string | undefined;
384
+ } | {
385
+ src: "authenticate";
386
+ logic: import("xstate").PromiseActorLogic<{
387
+ type: string;
388
+ accessToken: string;
389
+ }, {
390
+ context: import("./auth").AuthMachineContext;
391
+ username: string;
392
+ password: string;
393
+ }>;
394
+ id: string | undefined;
395
+ } | {
396
+ src: "unauthenticate";
397
+ logic: import("xstate").PromiseActorLogic<{
398
+ type: string;
399
+ }, {
400
+ context: import("./auth").AuthMachineContext;
401
+ }>;
402
+ id: string | undefined;
403
+ }, {
404
+ type: "setUserContext";
405
+ params: import("xstate").NonReducibleUnknown;
406
+ } | {
407
+ type: "unsetUserContext";
408
+ params: import("xstate").NonReducibleUnknown;
409
+ } | {
410
+ type: "setAccessToken";
411
+ params: import("xstate").NonReducibleUnknown;
412
+ } | {
413
+ type: "unsetRefreshToken";
414
+ params: import("xstate").NonReducibleUnknown;
415
+ } | {
416
+ type: "setIgnoreRefreshToken";
417
+ params: import("xstate").NonReducibleUnknown;
418
+ } | {
419
+ type: "addError";
420
+ params: import("xstate").NonReducibleUnknown;
421
+ } | {
422
+ type: "clearErrors";
423
+ params: import("xstate").NonReducibleUnknown;
424
+ }, {
425
+ type: string;
426
+ params: import("xstate").NonReducibleUnknown;
427
+ }, string, string>>>>;
44
428
  type Props = {
45
429
  children: ReactNode;
46
- service: InterpreterFrom<typeof authMachine>;
430
+ actor: Actor<typeof authMachine>;
47
431
  };
48
- export declare function AuthProvider({ children, service, }: Props): JSX.Element;
432
+ export declare function AuthProvider({ actor, children }: Props): import("react/jsx-runtime").JSX.Element;
49
433
  export {};
@@ -1,19 +1,6 @@
1
- import type { DoneInvokeEvent } from 'xstate';
1
+ import { DoneActorEvent } from 'xstate';
2
2
  export interface AuthMachineContext {
3
- user: {
4
- email: string;
5
- username: string;
6
- firstName: string;
7
- lastName: string;
8
- birthdate?: Date;
9
- gender?: string /** @todo use enum? */;
10
- createdAt: Date;
11
- updatedAt: Date;
12
- role?: string /** @todo use enum? */;
13
- locked: boolean;
14
- affiliateId: string;
15
- stripeId: string;
16
- } | null;
3
+ user: Record<string, any> | null;
17
4
  accessToken: string;
18
5
  refreshToken: string;
19
6
  ignoreRefreshToken: boolean;
@@ -23,6 +10,7 @@ export interface AuthMachineContext {
23
10
  refresh: string;
24
11
  ssrRefresh: string;
25
12
  };
13
+ errors: Array<string>;
26
14
  }
27
15
  export interface RefreshTokenEvent {
28
16
  type: 'REFRESH_TOKEN';
@@ -36,17 +24,155 @@ export interface LoginEvent {
36
24
  export interface LogoutEvent {
37
25
  type: 'LOGOUT';
38
26
  }
27
+ export interface ClearErrorsEvent {
28
+ type: 'CLEAR_ERRORS';
29
+ }
39
30
  export interface AuthenticateSuccessEvent {
40
31
  type: 'AUTHENTICATE_SUCCESS';
41
- user: AuthMachineContext['user'];
32
+ user: Partial<AuthMachineContext['user']>;
42
33
  accessToken: AuthMachineContext['accessToken'];
43
34
  }
44
35
  export interface RefreshTokenSuccessEvent {
45
36
  type: 'REFRESH_TOKEN_SUCCESS';
46
37
  accessToken: AuthMachineContext['accessToken'];
47
38
  }
48
- export type AuthMachineEvents = RefreshTokenEvent | LoginEvent | LogoutEvent | DoneInvokeEvent<AuthenticateSuccessEvent> | DoneInvokeEvent<RefreshTokenSuccessEvent>;
49
- export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, any, AuthMachineEvents, {
50
- value: any;
51
- context: AuthMachineContext;
52
- }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, AuthMachineEvents, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
39
+ export type AuthMachineEvents = RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>;
40
+ /**
41
+ * still need a factory pattern to pass context and state
42
+ * until xstate supports both
43
+ */
44
+ export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>, {
45
+ [x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
46
+ type: string;
47
+ accessToken: string;
48
+ }, {
49
+ context: AuthMachineContext;
50
+ }>, {
51
+ [k: string]: unknown;
52
+ type: string;
53
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
54
+ type: string;
55
+ accessToken: string;
56
+ }, {
57
+ context: AuthMachineContext;
58
+ username: string;
59
+ password: string;
60
+ }>, {
61
+ [k: string]: unknown;
62
+ type: string;
63
+ }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
64
+ type: string;
65
+ }, {
66
+ context: AuthMachineContext;
67
+ }>, {
68
+ [k: string]: unknown;
69
+ type: string;
70
+ }> | undefined;
71
+ }, {
72
+ src: "refreshAccessToken";
73
+ logic: import("xstate").PromiseActorLogic<{
74
+ type: string;
75
+ accessToken: string;
76
+ }, {
77
+ context: AuthMachineContext;
78
+ }>;
79
+ id: string | undefined;
80
+ } | {
81
+ src: "authenticate";
82
+ logic: import("xstate").PromiseActorLogic<{
83
+ type: string;
84
+ accessToken: string;
85
+ }, {
86
+ context: AuthMachineContext;
87
+ username: string;
88
+ password: string;
89
+ }>;
90
+ id: string | undefined;
91
+ } | {
92
+ src: "unauthenticate";
93
+ logic: import("xstate").PromiseActorLogic<{
94
+ type: string;
95
+ }, {
96
+ context: AuthMachineContext;
97
+ }>;
98
+ id: string | undefined;
99
+ }, {
100
+ type: "setUserContext";
101
+ params: import("xstate").NonReducibleUnknown;
102
+ } | {
103
+ type: "unsetUserContext";
104
+ params: import("xstate").NonReducibleUnknown;
105
+ } | {
106
+ type: "setAccessToken";
107
+ params: import("xstate").NonReducibleUnknown;
108
+ } | {
109
+ type: "unsetRefreshToken";
110
+ params: import("xstate").NonReducibleUnknown;
111
+ } | {
112
+ type: "setIgnoreRefreshToken";
113
+ params: import("xstate").NonReducibleUnknown;
114
+ } | {
115
+ type: "addError";
116
+ params: import("xstate").NonReducibleUnknown;
117
+ } | {
118
+ type: "clearErrors";
119
+ params: import("xstate").NonReducibleUnknown;
120
+ }, {
121
+ type: string;
122
+ params: import("xstate").NonReducibleUnknown;
123
+ }, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
124
+ initialContext: Partial<AuthMachineContext>;
125
+ initialState?: string | undefined;
126
+ }, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>, {
127
+ src: "refreshAccessToken";
128
+ logic: import("xstate").PromiseActorLogic<{
129
+ type: string;
130
+ accessToken: string;
131
+ }, {
132
+ context: AuthMachineContext;
133
+ }>;
134
+ id: string | undefined;
135
+ } | {
136
+ src: "authenticate";
137
+ logic: import("xstate").PromiseActorLogic<{
138
+ type: string;
139
+ accessToken: string;
140
+ }, {
141
+ context: AuthMachineContext;
142
+ username: string;
143
+ password: string;
144
+ }>;
145
+ id: string | undefined;
146
+ } | {
147
+ src: "unauthenticate";
148
+ logic: import("xstate").PromiseActorLogic<{
149
+ type: string;
150
+ }, {
151
+ context: AuthMachineContext;
152
+ }>;
153
+ id: string | undefined;
154
+ }, {
155
+ type: "setUserContext";
156
+ params: import("xstate").NonReducibleUnknown;
157
+ } | {
158
+ type: "unsetUserContext";
159
+ params: import("xstate").NonReducibleUnknown;
160
+ } | {
161
+ type: "setAccessToken";
162
+ params: import("xstate").NonReducibleUnknown;
163
+ } | {
164
+ type: "unsetRefreshToken";
165
+ params: import("xstate").NonReducibleUnknown;
166
+ } | {
167
+ type: "setIgnoreRefreshToken";
168
+ params: import("xstate").NonReducibleUnknown;
169
+ } | {
170
+ type: "addError";
171
+ params: import("xstate").NonReducibleUnknown;
172
+ } | {
173
+ type: "clearErrors";
174
+ params: import("xstate").NonReducibleUnknown;
175
+ }, {
176
+ type: string;
177
+ params: import("xstate").NonReducibleUnknown;
178
+ }, string, string>>;