@clicktap/state 0.16.2 → 0.16.3
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/__mocks__/nanoid.d.ts +7 -0
- package/auth/AuthProvider.d.ts +255 -0
- package/auth/actions/addError.d.ts +8 -0
- package/auth/actions/clearErrors.d.ts +5 -0
- package/auth/actions/index.d.ts +8 -0
- package/auth/actions/notifyAuthenticated.d.ts +6 -0
- package/auth/actions/setAccessToken.d.ts +9 -0
- package/auth/actions/setIgnoreRefreshToken.d.ts +4 -0
- package/auth/actions/setUserContext.d.ts +9 -0
- package/auth/actions/unsetRefreshToken.d.ts +4 -0
- package/auth/actions/unsetUserContext.d.ts +8 -0
- package/auth/actors/authenticate.d.ts +16 -0
- package/auth/actors/index.d.ts +3 -0
- package/auth/actors/refreshAccessToken.d.ts +18 -0
- package/auth/actors/unauthenticate.d.ts +14 -0
- package/auth/auth.d.ts +115 -0
- package/auth/types.d.ts +50 -0
- package/helpers/request.d.ts +2 -0
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +276 -0
- package/quote/QuoteProvider.d.ts +491 -0
- package/quote/checkout/actions/changeStep.d.ts +8 -0
- package/quote/checkout/actions/index.d.ts +5 -0
- package/quote/checkout/actions/nextStep.d.ts +8 -0
- package/quote/checkout/actions/resetCheckout.d.ts +104 -0
- package/quote/checkout/actions/updateQuote.d.ts +216 -0
- package/quote/checkout/actions/updateSuccessId.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +2 -0
- package/quote/checkout/actors/placeOrder.d.ts +20 -0
- package/quote/checkout/actors/submitStepData.d.ts +19 -0
- package/quote/checkout/guards/index.d.ts +1 -0
- package/quote/checkout/guards/quoteExists.d.ts +10 -0
- package/quote/checkout/types.d.ts +55 -0
- package/quote/checkout.d.ts +85 -0
- package/quote/quote/actions/addItems.d.ts +217 -0
- package/quote/quote/actions/index.d.ts +9 -0
- package/quote/quote/actions/notifyAddItems.d.ts +6 -0
- package/quote/quote/actions/notifyRemoveItems.d.ts +6 -0
- package/quote/quote/actions/notifyUpdateItems.d.ts +6 -0
- package/quote/quote/actions/refresh.d.ts +216 -0
- package/quote/quote/actions/removeItems.d.ts +217 -0
- 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 +217 -0
- package/quote/quote/actors/addItems.d.ts +24 -0
- package/quote/quote/actors/index.d.ts +4 -0
- package/quote/quote/actors/refresh.d.ts +22 -0
- package/quote/quote/actors/removeItems.d.ts +24 -0
- package/quote/quote/actors/updateItems.d.ts +24 -0
- package/quote/quote/guards/canRefresh.d.ts +10 -0
- package/quote/quote/guards/hasItems.d.ts +5 -0
- package/quote/quote/guards/index.d.ts +2 -0
- package/quote/quote/types.d.ts +291 -0
- package/quote/quote.d.ts +155 -0
- package/quote/types.d.ts +5 -0
- package/toast/ToastProvider.d.ts +93 -0
- package/toast/timer.d.ts +22 -0
- package/toast/toast.d.ts +82 -0
- package/toast/types.d.ts +58 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Actor, InspectionEvent, Observer } from 'xstate';
|
|
3
|
+
import { checkoutMachine } from './checkout';
|
|
4
|
+
import { DeepPartial } from './types';
|
|
5
|
+
import { CheckoutMachineContext } from './checkout/types';
|
|
6
|
+
import { QuoteMachineContext } from './quote/types';
|
|
7
|
+
export interface CheckoutContextType {
|
|
8
|
+
checkoutActor: Actor<typeof checkoutMachine>;
|
|
9
|
+
currentStep: CheckoutMachineContext['currentStep'];
|
|
10
|
+
}
|
|
11
|
+
export declare const CheckoutContext: import('react').Context<Actor<import('xstate').StateMachine<CheckoutMachineContext, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, {
|
|
12
|
+
[x: string]: import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>, {
|
|
13
|
+
[k: string]: unknown;
|
|
14
|
+
type: string;
|
|
15
|
+
}, import('xstate').EventObject> | import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>, {
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
type: string;
|
|
18
|
+
}, import('xstate').EventObject> | undefined;
|
|
19
|
+
}, import('xstate').Values<{
|
|
20
|
+
placeOrder: {
|
|
21
|
+
src: "placeOrder";
|
|
22
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
23
|
+
id: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
submitStepData: {
|
|
26
|
+
src: "submitStepData";
|
|
27
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
28
|
+
id: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
}>, import('xstate').Values<{
|
|
31
|
+
changeStep: {
|
|
32
|
+
type: "changeStep";
|
|
33
|
+
params: import('xstate').NonReducibleUnknown;
|
|
34
|
+
};
|
|
35
|
+
nextStep: {
|
|
36
|
+
type: "nextStep";
|
|
37
|
+
params: import('xstate').NonReducibleUnknown;
|
|
38
|
+
};
|
|
39
|
+
resetCheckout: {
|
|
40
|
+
type: "resetCheckout";
|
|
41
|
+
params: import('xstate').NonReducibleUnknown;
|
|
42
|
+
};
|
|
43
|
+
updateQuote: {
|
|
44
|
+
type: "updateQuote";
|
|
45
|
+
params: import('xstate').NonReducibleUnknown;
|
|
46
|
+
};
|
|
47
|
+
updateSuccessId: {
|
|
48
|
+
type: "updateSuccessId";
|
|
49
|
+
params: import('xstate').NonReducibleUnknown;
|
|
50
|
+
};
|
|
51
|
+
}>, {
|
|
52
|
+
type: "quoteExists";
|
|
53
|
+
params: unknown;
|
|
54
|
+
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
|
|
55
|
+
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
56
|
+
initialState?: string | undefined;
|
|
57
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, import('xstate').ResolveTypegenMeta<import('xstate').TypegenDisabled, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, import('xstate').Values<{
|
|
58
|
+
placeOrder: {
|
|
59
|
+
src: "placeOrder";
|
|
60
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
submitStepData: {
|
|
64
|
+
src: "submitStepData";
|
|
65
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
66
|
+
id: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
}>, import('xstate').Values<{
|
|
69
|
+
changeStep: {
|
|
70
|
+
type: "changeStep";
|
|
71
|
+
params: import('xstate').NonReducibleUnknown;
|
|
72
|
+
};
|
|
73
|
+
nextStep: {
|
|
74
|
+
type: "nextStep";
|
|
75
|
+
params: import('xstate').NonReducibleUnknown;
|
|
76
|
+
};
|
|
77
|
+
resetCheckout: {
|
|
78
|
+
type: "resetCheckout";
|
|
79
|
+
params: import('xstate').NonReducibleUnknown;
|
|
80
|
+
};
|
|
81
|
+
updateQuote: {
|
|
82
|
+
type: "updateQuote";
|
|
83
|
+
params: import('xstate').NonReducibleUnknown;
|
|
84
|
+
};
|
|
85
|
+
updateSuccessId: {
|
|
86
|
+
type: "updateSuccessId";
|
|
87
|
+
params: import('xstate').NonReducibleUnknown;
|
|
88
|
+
};
|
|
89
|
+
}>, {
|
|
90
|
+
type: "quoteExists";
|
|
91
|
+
params: unknown;
|
|
92
|
+
}, never, string, import('xstate').EventObject>>>>;
|
|
93
|
+
export declare const useCheckout: () => {
|
|
94
|
+
checkoutActor: Actor<import('xstate').StateMachine<CheckoutMachineContext, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, {
|
|
95
|
+
[x: string]: import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>, {
|
|
96
|
+
[k: string]: unknown;
|
|
97
|
+
type: string;
|
|
98
|
+
}, import('xstate').EventObject> | import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>, {
|
|
99
|
+
[k: string]: unknown;
|
|
100
|
+
type: string;
|
|
101
|
+
}, import('xstate').EventObject> | undefined;
|
|
102
|
+
}, import('xstate').Values<{
|
|
103
|
+
placeOrder: {
|
|
104
|
+
src: "placeOrder";
|
|
105
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
106
|
+
id: string | undefined;
|
|
107
|
+
};
|
|
108
|
+
submitStepData: {
|
|
109
|
+
src: "submitStepData";
|
|
110
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
111
|
+
id: string | undefined;
|
|
112
|
+
};
|
|
113
|
+
}>, import('xstate').Values<{
|
|
114
|
+
changeStep: {
|
|
115
|
+
type: "changeStep";
|
|
116
|
+
params: import('xstate').NonReducibleUnknown;
|
|
117
|
+
};
|
|
118
|
+
nextStep: {
|
|
119
|
+
type: "nextStep";
|
|
120
|
+
params: import('xstate').NonReducibleUnknown;
|
|
121
|
+
};
|
|
122
|
+
resetCheckout: {
|
|
123
|
+
type: "resetCheckout";
|
|
124
|
+
params: import('xstate').NonReducibleUnknown;
|
|
125
|
+
};
|
|
126
|
+
updateQuote: {
|
|
127
|
+
type: "updateQuote";
|
|
128
|
+
params: import('xstate').NonReducibleUnknown;
|
|
129
|
+
};
|
|
130
|
+
updateSuccessId: {
|
|
131
|
+
type: "updateSuccessId";
|
|
132
|
+
params: import('xstate').NonReducibleUnknown;
|
|
133
|
+
};
|
|
134
|
+
}>, {
|
|
135
|
+
type: "quoteExists";
|
|
136
|
+
params: unknown;
|
|
137
|
+
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
|
|
138
|
+
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
139
|
+
initialState?: string | undefined;
|
|
140
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, import('xstate').ResolveTypegenMeta<import('xstate').TypegenDisabled, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, import('xstate').Values<{
|
|
141
|
+
placeOrder: {
|
|
142
|
+
src: "placeOrder";
|
|
143
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
144
|
+
id: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
submitStepData: {
|
|
147
|
+
src: "submitStepData";
|
|
148
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
149
|
+
id: string | undefined;
|
|
150
|
+
};
|
|
151
|
+
}>, import('xstate').Values<{
|
|
152
|
+
changeStep: {
|
|
153
|
+
type: "changeStep";
|
|
154
|
+
params: import('xstate').NonReducibleUnknown;
|
|
155
|
+
};
|
|
156
|
+
nextStep: {
|
|
157
|
+
type: "nextStep";
|
|
158
|
+
params: import('xstate').NonReducibleUnknown;
|
|
159
|
+
};
|
|
160
|
+
resetCheckout: {
|
|
161
|
+
type: "resetCheckout";
|
|
162
|
+
params: import('xstate').NonReducibleUnknown;
|
|
163
|
+
};
|
|
164
|
+
updateQuote: {
|
|
165
|
+
type: "updateQuote";
|
|
166
|
+
params: import('xstate').NonReducibleUnknown;
|
|
167
|
+
};
|
|
168
|
+
updateSuccessId: {
|
|
169
|
+
type: "updateSuccessId";
|
|
170
|
+
params: import('xstate').NonReducibleUnknown;
|
|
171
|
+
};
|
|
172
|
+
}>, {
|
|
173
|
+
type: "quoteExists";
|
|
174
|
+
params: unknown;
|
|
175
|
+
}, never, string, import('xstate').EventObject>>>;
|
|
176
|
+
currentStep: string;
|
|
177
|
+
};
|
|
178
|
+
type CheckoutOptions = {
|
|
179
|
+
inspect: Observer<InspectionEvent> | undefined;
|
|
180
|
+
currentStep: CheckoutMachineContext['currentStep'];
|
|
181
|
+
steps: CheckoutMachineContext['steps'];
|
|
182
|
+
quote: DeepPartial<QuoteMachineContext['quote']>;
|
|
183
|
+
endpoints?: Partial<CheckoutMachineContext['endpoints']>;
|
|
184
|
+
graphql?: Partial<CheckoutMachineContext['graphql']>;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* runs on server side as part of withQuote HOF
|
|
188
|
+
*/
|
|
189
|
+
export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<import('xstate').StateMachine<CheckoutMachineContext, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, {
|
|
190
|
+
[x: string]: import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>, {
|
|
191
|
+
[k: string]: unknown;
|
|
192
|
+
type: string;
|
|
193
|
+
}, import('xstate').EventObject> | import('xstate').ActorRef<import('xstate').PromiseSnapshot<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>, {
|
|
194
|
+
[k: string]: unknown;
|
|
195
|
+
type: string;
|
|
196
|
+
}, import('xstate').EventObject> | undefined;
|
|
197
|
+
}, import('xstate').Values<{
|
|
198
|
+
placeOrder: {
|
|
199
|
+
src: "placeOrder";
|
|
200
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
201
|
+
id: string | undefined;
|
|
202
|
+
};
|
|
203
|
+
submitStepData: {
|
|
204
|
+
src: "submitStepData";
|
|
205
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
206
|
+
id: string | undefined;
|
|
207
|
+
};
|
|
208
|
+
}>, import('xstate').Values<{
|
|
209
|
+
changeStep: {
|
|
210
|
+
type: "changeStep";
|
|
211
|
+
params: import('xstate').NonReducibleUnknown;
|
|
212
|
+
};
|
|
213
|
+
nextStep: {
|
|
214
|
+
type: "nextStep";
|
|
215
|
+
params: import('xstate').NonReducibleUnknown;
|
|
216
|
+
};
|
|
217
|
+
resetCheckout: {
|
|
218
|
+
type: "resetCheckout";
|
|
219
|
+
params: import('xstate').NonReducibleUnknown;
|
|
220
|
+
};
|
|
221
|
+
updateQuote: {
|
|
222
|
+
type: "updateQuote";
|
|
223
|
+
params: import('xstate').NonReducibleUnknown;
|
|
224
|
+
};
|
|
225
|
+
updateSuccessId: {
|
|
226
|
+
type: "updateSuccessId";
|
|
227
|
+
params: import('xstate').NonReducibleUnknown;
|
|
228
|
+
};
|
|
229
|
+
}>, {
|
|
230
|
+
type: "quoteExists";
|
|
231
|
+
params: unknown;
|
|
232
|
+
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
|
|
233
|
+
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
234
|
+
initialState?: string | undefined;
|
|
235
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, import('xstate').ResolveTypegenMeta<import('xstate').TypegenDisabled, import('./checkout/types').ChangeStepEvent | import('./checkout/types').PlaceOrderEvent | import('./checkout/types').ResetCheckoutEvent | import('./checkout/types').SubmitStepDataEvent | import('xstate').DoneActorEvent<import('./checkout/types').PlaceOrderSuccessEvent> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent>, import('xstate').Values<{
|
|
236
|
+
placeOrder: {
|
|
237
|
+
src: "placeOrder";
|
|
238
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
|
|
239
|
+
id: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
submitStepData: {
|
|
242
|
+
src: "submitStepData";
|
|
243
|
+
logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
|
|
244
|
+
id: string | undefined;
|
|
245
|
+
};
|
|
246
|
+
}>, import('xstate').Values<{
|
|
247
|
+
changeStep: {
|
|
248
|
+
type: "changeStep";
|
|
249
|
+
params: import('xstate').NonReducibleUnknown;
|
|
250
|
+
};
|
|
251
|
+
nextStep: {
|
|
252
|
+
type: "nextStep";
|
|
253
|
+
params: import('xstate').NonReducibleUnknown;
|
|
254
|
+
};
|
|
255
|
+
resetCheckout: {
|
|
256
|
+
type: "resetCheckout";
|
|
257
|
+
params: import('xstate').NonReducibleUnknown;
|
|
258
|
+
};
|
|
259
|
+
updateQuote: {
|
|
260
|
+
type: "updateQuote";
|
|
261
|
+
params: import('xstate').NonReducibleUnknown;
|
|
262
|
+
};
|
|
263
|
+
updateSuccessId: {
|
|
264
|
+
type: "updateSuccessId";
|
|
265
|
+
params: import('xstate').NonReducibleUnknown;
|
|
266
|
+
};
|
|
267
|
+
}>, {
|
|
268
|
+
type: "quoteExists";
|
|
269
|
+
params: unknown;
|
|
270
|
+
}, never, string, import('xstate').EventObject>>>>;
|
|
271
|
+
type Props = {
|
|
272
|
+
children: ReactNode;
|
|
273
|
+
actor: Actor<typeof checkoutMachine>;
|
|
274
|
+
};
|
|
275
|
+
export declare function CheckoutProvider({ actor, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
276
|
+
export {};
|