@clicktap/state 0.16.3 → 0.16.5

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.16.3",
3
+ "version": "0.16.5",
4
4
  "private": false,
5
5
  "author": "Clicktap",
6
6
  "description": "A state management library for Clicktap reference frontend.",
@@ -24,11 +24,14 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/cookie": "^0.5.1",
27
- "@types/react": "18.0.28"
27
+ "@types/react": "18.3.28"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "next": ">=13.4.0",
31
31
  "react": ">=18.2.0",
32
32
  "framer-motion": ">=10.16.0"
33
+ },
34
+ "scripts": {
35
+ "preinstall": "if [ \"$INIT_CWD\" = \"$PWD\" ]; then echo 'ERROR: Run pnpm install from the monorepo root, not from this directory.' && exit 1; fi"
33
36
  }
34
37
  }
@@ -8,171 +8,93 @@ export interface CheckoutContextType {
8
8
  checkoutActor: Actor<typeof checkoutMachine>;
9
9
  currentStep: CheckoutMachineContext['currentStep'];
10
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
- }>, {
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, string> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent, string>, {
12
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>> | undefined;
13
+ }, {
14
+ src: "placeOrder";
15
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>;
16
+ id: string | undefined;
17
+ } | {
18
+ src: "submitStepData";
19
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>;
20
+ id: string | undefined;
21
+ }, {
22
+ type: "changeStep";
23
+ params: import('xstate').NonReducibleUnknown;
24
+ } | {
25
+ type: "nextStep";
26
+ params: import('xstate').NonReducibleUnknown;
27
+ } | {
28
+ type: "resetCheckout";
29
+ params: import('xstate').NonReducibleUnknown;
30
+ } | {
31
+ type: "updateQuote";
32
+ params: import('xstate').NonReducibleUnknown;
33
+ } | {
34
+ type: "updateSuccessId";
35
+ params: import('xstate').NonReducibleUnknown;
36
+ }, {
52
37
  type: "quoteExists";
53
38
  params: unknown;
54
39
  }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
55
40
  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: {
41
+ initialState?: string;
42
+ }, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
43
+ id: "checkout";
44
+ states: {
45
+ readonly uninitialized: {};
46
+ readonly initializing: {};
47
+ readonly showStep: {};
48
+ readonly submittingStepData: {};
49
+ readonly changingStep: {};
50
+ readonly placingOrder: {};
51
+ readonly success: {};
52
+ };
53
+ }>>>;
54
+ export declare const useCheckout: () => {
55
+ 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, string> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent, string>, {
56
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>> | undefined;
57
+ }, {
59
58
  src: "placeOrder";
60
- logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput>;
59
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>;
61
60
  id: string | undefined;
62
- };
63
- submitStepData: {
61
+ } | {
64
62
  src: "submitStepData";
65
- logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput>;
63
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>;
66
64
  id: string | undefined;
67
- };
68
- }>, import('xstate').Values<{
69
- changeStep: {
65
+ }, {
70
66
  type: "changeStep";
71
67
  params: import('xstate').NonReducibleUnknown;
72
- };
73
- nextStep: {
68
+ } | {
74
69
  type: "nextStep";
75
70
  params: import('xstate').NonReducibleUnknown;
76
- };
77
- resetCheckout: {
71
+ } | {
78
72
  type: "resetCheckout";
79
73
  params: import('xstate').NonReducibleUnknown;
80
- };
81
- updateQuote: {
74
+ } | {
82
75
  type: "updateQuote";
83
76
  params: import('xstate').NonReducibleUnknown;
84
- };
85
- updateSuccessId: {
77
+ } | {
86
78
  type: "updateSuccessId";
87
79
  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
- }>, {
80
+ }, {
135
81
  type: "quoteExists";
136
82
  params: unknown;
137
83
  }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
138
84
  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;
85
+ initialState?: string;
86
+ }, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
87
+ id: "checkout";
88
+ states: {
89
+ readonly uninitialized: {};
90
+ readonly initializing: {};
91
+ readonly showStep: {};
92
+ readonly submittingStepData: {};
93
+ readonly changingStep: {};
94
+ readonly placingOrder: {};
95
+ readonly success: {};
155
96
  };
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>>>;
97
+ }>>;
176
98
  currentStep: string;
177
99
  };
178
100
  type CheckoutOptions = {
@@ -186,88 +108,49 @@ type CheckoutOptions = {
186
108
  /**
187
109
  * runs on server side as part of withQuote HOF
188
110
  */
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
- }>, {
111
+ 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, string> | import('xstate').DoneActorEvent<import('./checkout/types').SubmitStepDataSuccessEvent, string>, {
112
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>> | undefined;
113
+ }, {
114
+ src: "placeOrder";
115
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>;
116
+ id: string | undefined;
117
+ } | {
118
+ src: "submitStepData";
119
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>;
120
+ id: string | undefined;
121
+ }, {
122
+ type: "changeStep";
123
+ params: import('xstate').NonReducibleUnknown;
124
+ } | {
125
+ type: "nextStep";
126
+ params: import('xstate').NonReducibleUnknown;
127
+ } | {
128
+ type: "resetCheckout";
129
+ params: import('xstate').NonReducibleUnknown;
130
+ } | {
131
+ type: "updateQuote";
132
+ params: import('xstate').NonReducibleUnknown;
133
+ } | {
134
+ type: "updateSuccessId";
135
+ params: import('xstate').NonReducibleUnknown;
136
+ }, {
230
137
  type: "quoteExists";
231
138
  params: unknown;
232
139
  }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
233
140
  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>>>>;
141
+ initialState?: string;
142
+ }, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
143
+ id: "checkout";
144
+ states: {
145
+ readonly uninitialized: {};
146
+ readonly initializing: {};
147
+ readonly showStep: {};
148
+ readonly submittingStepData: {};
149
+ readonly changingStep: {};
150
+ readonly placingOrder: {};
151
+ readonly success: {};
152
+ };
153
+ }>>>;
271
154
  type Props = {
272
155
  children: ReactNode;
273
156
  actor: Actor<typeof checkoutMachine>;