@clicktap/state 0.14.7 → 0.15.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/auth/AuthProvider.d.ts +24 -8
- package/auth/actions/index.d.ts +1 -0
- package/auth/actions/notifyAuthenticated.d.ts +6 -0
- package/auth/auth.d.ts +12 -4
- package/auth/types.d.ts +9 -1
- package/index.js +34 -34
- package/index.mjs +1262 -1036
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +135 -36
- package/quote/QuoteProvider.d.ts +57 -9
- package/quote/checkout/actions/index.d.ts +2 -0
- package/quote/checkout/actions/resetCheckout.d.ts +104 -0
- package/quote/checkout/actions/updateQuote.d.ts +4 -2
- package/quote/checkout/actions/updateSuccessId.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +1 -0
- package/quote/checkout/actors/placeOrder.d.ts +20 -0
- package/quote/checkout/types.d.ts +21 -1
- package/quote/checkout.d.ts +45 -12
- package/quote/quote/actions/addItems.d.ts +4 -2
- package/quote/quote/actions/index.d.ts +2 -0
- package/quote/quote/actions/refresh.d.ts +4 -2
- package/quote/quote/actions/removeItems.d.ts +4 -2
- package/quote/quote/actions/reset.d.ts +40 -0
- package/quote/quote/actions/syncAccessToken.d.ts +100 -0
- package/quote/quote/actions/updateItems.d.ts +4 -2
- package/quote/quote/actors/addItems.d.ts +1 -0
- package/quote/quote/actors/refresh.d.ts +1 -0
- package/quote/quote/actors/removeItems.d.ts +3 -0
- package/quote/quote/actors/updateItems.d.ts +1 -0
- package/quote/quote/types.d.ts +22 -3
- package/quote/quote.d.ts +19 -3
package/auth/AuthProvider.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface AuthContextType {
|
|
|
5
5
|
authActor: Actor<typeof authMachine>;
|
|
6
6
|
isLoggedIn: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const AuthContext: import("react").Context<Actor<import("xstate").StateMachine<import("./types").AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
8
|
+
export declare const AuthContext: import("react").Context<Actor<import("xstate").StateMachine<import("./types").AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
9
9
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>, {
|
|
10
10
|
[k: string]: unknown;
|
|
11
11
|
type: string;
|
|
@@ -41,6 +41,10 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
41
41
|
type: "clearErrors";
|
|
42
42
|
params: import("xstate").NonReducibleUnknown;
|
|
43
43
|
};
|
|
44
|
+
notifyAuthenticated: {
|
|
45
|
+
type: "notifyAuthenticated";
|
|
46
|
+
params: import("xstate").NonReducibleUnknown;
|
|
47
|
+
};
|
|
44
48
|
setAccessToken: {
|
|
45
49
|
type: "setAccessToken";
|
|
46
50
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -61,10 +65,10 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
61
65
|
type: "unsetUserContext";
|
|
62
66
|
params: import("xstate").NonReducibleUnknown;
|
|
63
67
|
};
|
|
64
|
-
}>, never,
|
|
68
|
+
}>, never, "refresh", "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating" | "loggedInReady", string, {
|
|
65
69
|
initialContext: Partial<import("./types").AuthMachineContext>;
|
|
66
70
|
initialState?: string | undefined;
|
|
67
|
-
}, import("xstate").NonReducibleUnknown, import("
|
|
71
|
+
}, import("xstate").NonReducibleUnknown, import("./types").AuthenticatedEmittedEvent, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, import("xstate").Values<{
|
|
68
72
|
authenticate: {
|
|
69
73
|
src: "authenticate";
|
|
70
74
|
logic: import("xstate").PromiseActorLogic<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>;
|
|
@@ -89,6 +93,10 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
89
93
|
type: "clearErrors";
|
|
90
94
|
params: import("xstate").NonReducibleUnknown;
|
|
91
95
|
};
|
|
96
|
+
notifyAuthenticated: {
|
|
97
|
+
type: "notifyAuthenticated";
|
|
98
|
+
params: import("xstate").NonReducibleUnknown;
|
|
99
|
+
};
|
|
92
100
|
setAccessToken: {
|
|
93
101
|
type: "setAccessToken";
|
|
94
102
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -109,7 +117,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
109
117
|
type: "unsetUserContext";
|
|
110
118
|
params: import("xstate").NonReducibleUnknown;
|
|
111
119
|
};
|
|
112
|
-
}>, never,
|
|
120
|
+
}>, never, "refresh", string, import("./types").AuthenticatedEmittedEvent>>>>;
|
|
113
121
|
export declare const useAuth: () => AuthContextType;
|
|
114
122
|
type AuthOptions = {
|
|
115
123
|
inspect: Observer<InspectionEvent> | undefined;
|
|
@@ -126,7 +134,7 @@ type AuthOptions = {
|
|
|
126
134
|
* @todo should probably update signature to pass Partial<AuthContext> and
|
|
127
135
|
* Options, endpoints should probably be moved into context
|
|
128
136
|
*/
|
|
129
|
-
export declare const getAuth: (refreshToken?: string, options?: AuthOptions) => Promise<Actor<import("xstate").StateMachine<import("./types").AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
137
|
+
export declare const getAuth: (refreshToken?: string, options?: AuthOptions) => Promise<Actor<import("xstate").StateMachine<import("./types").AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
130
138
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>, {
|
|
131
139
|
[k: string]: unknown;
|
|
132
140
|
type: string;
|
|
@@ -162,6 +170,10 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
162
170
|
type: "clearErrors";
|
|
163
171
|
params: import("xstate").NonReducibleUnknown;
|
|
164
172
|
};
|
|
173
|
+
notifyAuthenticated: {
|
|
174
|
+
type: "notifyAuthenticated";
|
|
175
|
+
params: import("xstate").NonReducibleUnknown;
|
|
176
|
+
};
|
|
165
177
|
setAccessToken: {
|
|
166
178
|
type: "setAccessToken";
|
|
167
179
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -182,10 +194,10 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
182
194
|
type: "unsetUserContext";
|
|
183
195
|
params: import("xstate").NonReducibleUnknown;
|
|
184
196
|
};
|
|
185
|
-
}>, never,
|
|
197
|
+
}>, never, "refresh", "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating" | "loggedInReady", string, {
|
|
186
198
|
initialContext: Partial<import("./types").AuthMachineContext>;
|
|
187
199
|
initialState?: string | undefined;
|
|
188
|
-
}, import("xstate").NonReducibleUnknown, import("
|
|
200
|
+
}, import("xstate").NonReducibleUnknown, import("./types").AuthenticatedEmittedEvent, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, import("xstate").Values<{
|
|
189
201
|
authenticate: {
|
|
190
202
|
src: "authenticate";
|
|
191
203
|
logic: import("xstate").PromiseActorLogic<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>;
|
|
@@ -210,6 +222,10 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
210
222
|
type: "clearErrors";
|
|
211
223
|
params: import("xstate").NonReducibleUnknown;
|
|
212
224
|
};
|
|
225
|
+
notifyAuthenticated: {
|
|
226
|
+
type: "notifyAuthenticated";
|
|
227
|
+
params: import("xstate").NonReducibleUnknown;
|
|
228
|
+
};
|
|
213
229
|
setAccessToken: {
|
|
214
230
|
type: "setAccessToken";
|
|
215
231
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -230,7 +246,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
230
246
|
type: "unsetUserContext";
|
|
231
247
|
params: import("xstate").NonReducibleUnknown;
|
|
232
248
|
};
|
|
233
|
-
}>, never,
|
|
249
|
+
}>, never, "refresh", string, import("./types").AuthenticatedEmittedEvent>>>>;
|
|
234
250
|
type Props = {
|
|
235
251
|
children: ReactNode;
|
|
236
252
|
actor: Actor<typeof authMachine>;
|
package/auth/actions/index.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AuthenticatedEmittedEvent, AuthMachineContext, AuthMachineEvents } from '../types';
|
|
2
|
+
export declare function notifyAuthenticated({ event, }: {
|
|
3
|
+
context: AuthMachineContext;
|
|
4
|
+
event: AuthMachineEvents;
|
|
5
|
+
}): AuthenticatedEmittedEvent;
|
|
6
|
+
export default notifyAuthenticated;
|
package/auth/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthMachineContext } from './types';
|
|
2
|
-
export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
2
|
+
export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
3
3
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>, {
|
|
4
4
|
[k: string]: unknown;
|
|
5
5
|
type: string;
|
|
@@ -35,6 +35,10 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
|
|
|
35
35
|
type: "clearErrors";
|
|
36
36
|
params: import("xstate").NonReducibleUnknown;
|
|
37
37
|
};
|
|
38
|
+
notifyAuthenticated: {
|
|
39
|
+
type: "notifyAuthenticated";
|
|
40
|
+
params: import("xstate").NonReducibleUnknown;
|
|
41
|
+
};
|
|
38
42
|
setAccessToken: {
|
|
39
43
|
type: "setAccessToken";
|
|
40
44
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -55,10 +59,10 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
|
|
|
55
59
|
type: "unsetUserContext";
|
|
56
60
|
params: import("xstate").NonReducibleUnknown;
|
|
57
61
|
};
|
|
58
|
-
}>, never,
|
|
62
|
+
}>, never, "refresh", "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating" | "loggedInReady", string, {
|
|
59
63
|
initialContext: Partial<AuthMachineContext>;
|
|
60
64
|
initialState?: string | undefined;
|
|
61
|
-
}, import("xstate").NonReducibleUnknown, import("
|
|
65
|
+
}, import("xstate").NonReducibleUnknown, import("./types").AuthenticatedEmittedEvent, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./types").RefreshTokenEvent | import("./types").RestoreEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, import("xstate").Values<{
|
|
62
66
|
authenticate: {
|
|
63
67
|
src: "authenticate";
|
|
64
68
|
logic: import("xstate").PromiseActorLogic<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>;
|
|
@@ -83,6 +87,10 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
|
|
|
83
87
|
type: "clearErrors";
|
|
84
88
|
params: import("xstate").NonReducibleUnknown;
|
|
85
89
|
};
|
|
90
|
+
notifyAuthenticated: {
|
|
91
|
+
type: "notifyAuthenticated";
|
|
92
|
+
params: import("xstate").NonReducibleUnknown;
|
|
93
|
+
};
|
|
86
94
|
setAccessToken: {
|
|
87
95
|
type: "setAccessToken";
|
|
88
96
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -103,5 +111,5 @@ export declare const authMachine: import("xstate").StateMachine<AuthMachineConte
|
|
|
103
111
|
type: "unsetUserContext";
|
|
104
112
|
params: import("xstate").NonReducibleUnknown;
|
|
105
113
|
};
|
|
106
|
-
}>, never,
|
|
114
|
+
}>, never, "refresh", string, import("./types").AuthenticatedEmittedEvent>>;
|
|
107
115
|
export default authMachine;
|
package/auth/types.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ export interface LogoutEvent {
|
|
|
27
27
|
export interface ClearErrorsEvent {
|
|
28
28
|
type: 'CLEAR_ERRORS';
|
|
29
29
|
}
|
|
30
|
+
export interface RestoreEvent {
|
|
31
|
+
type: 'RESTORE';
|
|
32
|
+
}
|
|
30
33
|
export interface AuthenticateSuccessEvent {
|
|
31
34
|
type: 'AUTHENTICATE_SUCCESS';
|
|
32
35
|
user: Partial<AuthMachineContext['user']>;
|
|
@@ -39,4 +42,9 @@ export interface RefreshTokenSuccessEvent {
|
|
|
39
42
|
export interface UnauthenticateSuccessEvent {
|
|
40
43
|
type: 'UNAUTHENTICATE_SUCCESS';
|
|
41
44
|
}
|
|
42
|
-
export
|
|
45
|
+
export interface AuthenticatedEmittedEvent {
|
|
46
|
+
type: 'EMIT_AUTHENTICATED';
|
|
47
|
+
accessToken: AuthMachineContext['accessToken'];
|
|
48
|
+
}
|
|
49
|
+
export type AuthMachineEvents = RefreshTokenEvent | RestoreEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>;
|
|
50
|
+
export type AuthMachineEmittedEvents = AuthenticatedEmittedEvent;
|