@clicktap/state 0.16.2 → 0.16.4

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.
Files changed (61) hide show
  1. package/__mocks__/nanoid.d.ts +7 -0
  2. package/auth/AuthProvider.d.ts +133 -0
  3. package/auth/actions/addError.d.ts +8 -0
  4. package/auth/actions/clearErrors.d.ts +5 -0
  5. package/auth/actions/index.d.ts +8 -0
  6. package/auth/actions/notifyAuthenticated.d.ts +6 -0
  7. package/auth/actions/setAccessToken.d.ts +9 -0
  8. package/auth/actions/setIgnoreRefreshToken.d.ts +4 -0
  9. package/auth/actions/setUserContext.d.ts +9 -0
  10. package/auth/actions/unsetRefreshToken.d.ts +4 -0
  11. package/auth/actions/unsetUserContext.d.ts +8 -0
  12. package/auth/actors/authenticate.d.ts +16 -0
  13. package/auth/actors/index.d.ts +3 -0
  14. package/auth/actors/refreshAccessToken.d.ts +18 -0
  15. package/auth/actors/unauthenticate.d.ts +14 -0
  16. package/auth/auth.d.ts +54 -0
  17. package/auth/types.d.ts +50 -0
  18. package/helpers/request.d.ts +2 -0
  19. package/index.js +41 -34
  20. package/index.mjs +1979 -1636
  21. package/package.json +2 -2
  22. package/quote/CheckoutProvider.d.ts +159 -0
  23. package/quote/QuoteProvider.d.ts +242 -0
  24. package/quote/checkout/actions/changeStep.d.ts +8 -0
  25. package/quote/checkout/actions/index.d.ts +5 -0
  26. package/quote/checkout/actions/nextStep.d.ts +8 -0
  27. package/quote/checkout/actions/resetCheckout.d.ts +104 -0
  28. package/quote/checkout/actions/updateQuote.d.ts +216 -0
  29. package/quote/checkout/actions/updateSuccessId.d.ts +8 -0
  30. package/quote/checkout/actors/index.d.ts +2 -0
  31. package/quote/checkout/actors/placeOrder.d.ts +20 -0
  32. package/quote/checkout/actors/submitStepData.d.ts +19 -0
  33. package/quote/checkout/guards/index.d.ts +1 -0
  34. package/quote/checkout/guards/quoteExists.d.ts +10 -0
  35. package/quote/checkout/types.d.ts +55 -0
  36. package/quote/checkout.d.ts +46 -0
  37. package/quote/quote/actions/addItems.d.ts +217 -0
  38. package/quote/quote/actions/index.d.ts +9 -0
  39. package/quote/quote/actions/notifyAddItems.d.ts +6 -0
  40. package/quote/quote/actions/notifyRemoveItems.d.ts +6 -0
  41. package/quote/quote/actions/notifyUpdateItems.d.ts +6 -0
  42. package/quote/quote/actions/refresh.d.ts +216 -0
  43. package/quote/quote/actions/removeItems.d.ts +217 -0
  44. package/quote/quote/actions/reset.d.ts +40 -0
  45. package/quote/quote/actions/syncAccessToken.d.ts +100 -0
  46. package/quote/quote/actions/updateItems.d.ts +217 -0
  47. package/quote/quote/actors/addItems.d.ts +24 -0
  48. package/quote/quote/actors/index.d.ts +4 -0
  49. package/quote/quote/actors/refresh.d.ts +22 -0
  50. package/quote/quote/actors/removeItems.d.ts +24 -0
  51. package/quote/quote/actors/updateItems.d.ts +24 -0
  52. package/quote/quote/guards/canRefresh.d.ts +10 -0
  53. package/quote/quote/guards/hasItems.d.ts +5 -0
  54. package/quote/quote/guards/index.d.ts +2 -0
  55. package/quote/quote/types.d.ts +291 -0
  56. package/quote/quote.d.ts +72 -0
  57. package/quote/types.d.ts +5 -0
  58. package/toast/ToastProvider.d.ts +80 -0
  59. package/toast/timer.d.ts +23 -0
  60. package/toast/toast.d.ts +69 -0
  61. package/toast/types.d.ts +58 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clicktap/state",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "private": false,
5
5
  "author": "Clicktap",
6
6
  "description": "A state management library for Clicktap reference frontend.",
@@ -24,7 +24,7 @@
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",
@@ -0,0 +1,159 @@
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, 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
+ }, {
37
+ type: "quoteExists";
38
+ params: unknown;
39
+ }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
40
+ initialContext: DeepPartial<CheckoutMachineContext>;
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
+ }, {
58
+ src: "placeOrder";
59
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').PlaceOrderSuccessEvent, import('./checkout/actors').PlaceOrderDataInput, import('xstate').EventObject>;
60
+ id: string | undefined;
61
+ } | {
62
+ src: "submitStepData";
63
+ logic: import('xstate').PromiseActorLogic<import('./checkout/types').SubmitStepDataSuccessEvent, import('./checkout/actors').SubmitStepDataInput, import('xstate').EventObject>;
64
+ id: string | undefined;
65
+ }, {
66
+ type: "changeStep";
67
+ params: import('xstate').NonReducibleUnknown;
68
+ } | {
69
+ type: "nextStep";
70
+ params: import('xstate').NonReducibleUnknown;
71
+ } | {
72
+ type: "resetCheckout";
73
+ params: import('xstate').NonReducibleUnknown;
74
+ } | {
75
+ type: "updateQuote";
76
+ params: import('xstate').NonReducibleUnknown;
77
+ } | {
78
+ type: "updateSuccessId";
79
+ params: import('xstate').NonReducibleUnknown;
80
+ }, {
81
+ type: "quoteExists";
82
+ params: unknown;
83
+ }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
84
+ initialContext: DeepPartial<CheckoutMachineContext>;
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: {};
96
+ };
97
+ }>>;
98
+ currentStep: string;
99
+ };
100
+ type CheckoutOptions = {
101
+ inspect: Observer<InspectionEvent> | undefined;
102
+ currentStep: CheckoutMachineContext['currentStep'];
103
+ steps: CheckoutMachineContext['steps'];
104
+ quote: DeepPartial<QuoteMachineContext['quote']>;
105
+ endpoints?: Partial<CheckoutMachineContext['endpoints']>;
106
+ graphql?: Partial<CheckoutMachineContext['graphql']>;
107
+ };
108
+ /**
109
+ * runs on server side as part of withQuote HOF
110
+ */
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
+ }, {
137
+ type: "quoteExists";
138
+ params: unknown;
139
+ }, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
140
+ initialContext: DeepPartial<CheckoutMachineContext>;
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
+ }>>>;
154
+ type Props = {
155
+ children: ReactNode;
156
+ actor: Actor<typeof checkoutMachine>;
157
+ };
158
+ export declare function CheckoutProvider({ actor, children }: Props): import("react/jsx-runtime").JSX.Element;
159
+ export {};
@@ -0,0 +1,242 @@
1
+ import { ReactNode } from 'react';
2
+ import { Actor, InspectionEvent, Observer } from 'xstate';
3
+ import { quoteMachine } from './quote';
4
+ import { DeepPartial } from './types';
5
+ import { QuoteMachineContext } from './quote/types';
6
+ export interface QuoteContextType {
7
+ quoteActor: Actor<typeof quoteMachine>;
8
+ isAddingItems: boolean;
9
+ isRemovingItems: boolean;
10
+ isUpdatingItems: boolean;
11
+ items: QuoteMachineContext['quote']['items'];
12
+ itemsCount: number;
13
+ }
14
+ export declare const QuoteContext: import('react').Context<Actor<import('xstate').StateMachine<QuoteMachineContext, import('./quote/types').SetQuoteEmptyEvent | import('./quote/types').SetQuoteActiveEvent | import('./quote/types').AddItemsEvent | import('./quote/types').RemoveItemsEvent | import('./quote/types').UpdateItemsEvent | import('./quote/types').ClearItemsEvent | import('./quote/types').RefreshEvent | import('./quote/types').ResetEvent | import('./quote/types').ApplyPromotionEvent | import('./quote/types').RemovePromotionEvent | import('./quote/types').AddAddressEvent | import('./quote/types').RemoveAddressEvent | import('./quote/types').ApplyPaymentMethodEvent | import('./quote/types').AddRewardEvent | import('./quote/types').RemoveRewardEvent | import('./quote/types').AddStoreCreditEvent | import('./quote/types').RemoveStoreCreditEvent | import('./quote/types').AddGiftCardEvent | import('./quote/types').RemoveGiftCardEvent | import('./quote/types').SyncAccessTokenEvent | import('xstate').DoneActorEvent<import('./quote/types').AddItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RemoveItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').UpdateItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').ClearItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RefreshSuccessEvent, string>, {
15
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>> | undefined;
16
+ }, {
17
+ src: "refresh";
18
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>;
19
+ id: string | undefined;
20
+ } | {
21
+ src: "addItems";
22
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>;
23
+ id: string | undefined;
24
+ } | {
25
+ src: "removeItems";
26
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>;
27
+ id: string | undefined;
28
+ } | {
29
+ src: "updateItems";
30
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>;
31
+ id: string | undefined;
32
+ }, {
33
+ type: "refresh";
34
+ params: import('xstate').NonReducibleUnknown;
35
+ } | {
36
+ type: "addItems";
37
+ params: import('xstate').NonReducibleUnknown;
38
+ } | {
39
+ type: "removeItems";
40
+ params: import('xstate').NonReducibleUnknown;
41
+ } | {
42
+ type: "updateItems";
43
+ params: import('xstate').NonReducibleUnknown;
44
+ } | {
45
+ type: "notifyAddItems";
46
+ params: import('xstate').NonReducibleUnknown;
47
+ } | {
48
+ type: "notifyRemoveItems";
49
+ params: import('xstate').NonReducibleUnknown;
50
+ } | {
51
+ type: "notifyUpdateItems";
52
+ params: import('xstate').NonReducibleUnknown;
53
+ } | {
54
+ type: "reset";
55
+ params: import('xstate').NonReducibleUnknown;
56
+ } | {
57
+ type: "syncAccessToken";
58
+ params: import('xstate').NonReducibleUnknown;
59
+ }, {
60
+ type: "canRefresh";
61
+ params: unknown;
62
+ } | {
63
+ type: "hasItems";
64
+ params: unknown;
65
+ }, never, "active" | "refreshing" | "uninitialized" | "initializing" | "empty" | "addingItems" | "updatingItems" | "removingItems" | "resetting" | "checkingItems", string, {
66
+ initialContext: DeepPartial<QuoteMachineContext>;
67
+ initialState?: string;
68
+ }, import('xstate').NonReducibleUnknown, import('./quote/types').AddItemsEmittedEvent | import('./quote/types').RemoveItemsEmittedEvent | import('./quote/types').UpdateItemsEmittedEvent, import('xstate').MetaObject, {
69
+ id: "quote";
70
+ states: {
71
+ readonly uninitialized: {};
72
+ readonly empty: {};
73
+ readonly active: {};
74
+ readonly initializing: {};
75
+ readonly refreshing: {};
76
+ readonly checkingItems: {};
77
+ readonly addingItems: {};
78
+ readonly removingItems: {};
79
+ readonly updatingItems: {};
80
+ readonly resetting: {};
81
+ };
82
+ }>>>;
83
+ export declare const useQuote: () => {
84
+ quoteActor: Actor<import('xstate').StateMachine<QuoteMachineContext, import('./quote/types').SetQuoteEmptyEvent | import('./quote/types').SetQuoteActiveEvent | import('./quote/types').AddItemsEvent | import('./quote/types').RemoveItemsEvent | import('./quote/types').UpdateItemsEvent | import('./quote/types').ClearItemsEvent | import('./quote/types').RefreshEvent | import('./quote/types').ResetEvent | import('./quote/types').ApplyPromotionEvent | import('./quote/types').RemovePromotionEvent | import('./quote/types').AddAddressEvent | import('./quote/types').RemoveAddressEvent | import('./quote/types').ApplyPaymentMethodEvent | import('./quote/types').AddRewardEvent | import('./quote/types').RemoveRewardEvent | import('./quote/types').AddStoreCreditEvent | import('./quote/types').RemoveStoreCreditEvent | import('./quote/types').AddGiftCardEvent | import('./quote/types').RemoveGiftCardEvent | import('./quote/types').SyncAccessTokenEvent | import('xstate').DoneActorEvent<import('./quote/types').AddItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RemoveItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').UpdateItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').ClearItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RefreshSuccessEvent, string>, {
85
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>> | undefined;
86
+ }, {
87
+ src: "refresh";
88
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>;
89
+ id: string | undefined;
90
+ } | {
91
+ src: "addItems";
92
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>;
93
+ id: string | undefined;
94
+ } | {
95
+ src: "removeItems";
96
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>;
97
+ id: string | undefined;
98
+ } | {
99
+ src: "updateItems";
100
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>;
101
+ id: string | undefined;
102
+ }, {
103
+ type: "refresh";
104
+ params: import('xstate').NonReducibleUnknown;
105
+ } | {
106
+ type: "addItems";
107
+ params: import('xstate').NonReducibleUnknown;
108
+ } | {
109
+ type: "removeItems";
110
+ params: import('xstate').NonReducibleUnknown;
111
+ } | {
112
+ type: "updateItems";
113
+ params: import('xstate').NonReducibleUnknown;
114
+ } | {
115
+ type: "notifyAddItems";
116
+ params: import('xstate').NonReducibleUnknown;
117
+ } | {
118
+ type: "notifyRemoveItems";
119
+ params: import('xstate').NonReducibleUnknown;
120
+ } | {
121
+ type: "notifyUpdateItems";
122
+ params: import('xstate').NonReducibleUnknown;
123
+ } | {
124
+ type: "reset";
125
+ params: import('xstate').NonReducibleUnknown;
126
+ } | {
127
+ type: "syncAccessToken";
128
+ params: import('xstate').NonReducibleUnknown;
129
+ }, {
130
+ type: "canRefresh";
131
+ params: unknown;
132
+ } | {
133
+ type: "hasItems";
134
+ params: unknown;
135
+ }, never, "active" | "refreshing" | "uninitialized" | "initializing" | "empty" | "addingItems" | "updatingItems" | "removingItems" | "resetting" | "checkingItems", string, {
136
+ initialContext: DeepPartial<QuoteMachineContext>;
137
+ initialState?: string;
138
+ }, import('xstate').NonReducibleUnknown, import('./quote/types').AddItemsEmittedEvent | import('./quote/types').RemoveItemsEmittedEvent | import('./quote/types').UpdateItemsEmittedEvent, import('xstate').MetaObject, {
139
+ id: "quote";
140
+ states: {
141
+ readonly uninitialized: {};
142
+ readonly empty: {};
143
+ readonly active: {};
144
+ readonly initializing: {};
145
+ readonly refreshing: {};
146
+ readonly checkingItems: {};
147
+ readonly addingItems: {};
148
+ readonly removingItems: {};
149
+ readonly updatingItems: {};
150
+ readonly resetting: {};
151
+ };
152
+ }>>;
153
+ items: Record<string, any>[];
154
+ itemsCount: number;
155
+ isAddingItems: boolean;
156
+ isRemovingItems: boolean;
157
+ isUpdatingItems: boolean;
158
+ };
159
+ type QuoteOptions = {
160
+ inspect: Observer<InspectionEvent> | undefined;
161
+ quote: DeepPartial<QuoteMachineContext['quote']>;
162
+ endpoints?: Partial<QuoteMachineContext['endpoints']>;
163
+ graphql?: Partial<QuoteMachineContext['graphql']>;
164
+ };
165
+ /**
166
+ * runs on server side as part of withQuote HOF
167
+ */
168
+ export declare const getQuote: (options?: QuoteOptions) => Promise<Actor<import('xstate').StateMachine<QuoteMachineContext, import('./quote/types').SetQuoteEmptyEvent | import('./quote/types').SetQuoteActiveEvent | import('./quote/types').AddItemsEvent | import('./quote/types').RemoveItemsEvent | import('./quote/types').UpdateItemsEvent | import('./quote/types').ClearItemsEvent | import('./quote/types').RefreshEvent | import('./quote/types').ResetEvent | import('./quote/types').ApplyPromotionEvent | import('./quote/types').RemovePromotionEvent | import('./quote/types').AddAddressEvent | import('./quote/types').RemoveAddressEvent | import('./quote/types').ApplyPaymentMethodEvent | import('./quote/types').AddRewardEvent | import('./quote/types').RemoveRewardEvent | import('./quote/types').AddStoreCreditEvent | import('./quote/types').RemoveStoreCreditEvent | import('./quote/types').AddGiftCardEvent | import('./quote/types').RemoveGiftCardEvent | import('./quote/types').SyncAccessTokenEvent | import('xstate').DoneActorEvent<import('./quote/types').AddItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RemoveItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').UpdateItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').ClearItemsSuccessEvent, string> | import('xstate').DoneActorEvent<import('./quote/types').RefreshSuccessEvent, string>, {
169
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>> | undefined;
170
+ }, {
171
+ src: "refresh";
172
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RefreshSuccessEvent, import('./quote/actors').RefreshInput, import('xstate').EventObject>;
173
+ id: string | undefined;
174
+ } | {
175
+ src: "addItems";
176
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').AddItemsSuccessEvent, import('./quote/actors').AddItemsInput, import('xstate').EventObject>;
177
+ id: string | undefined;
178
+ } | {
179
+ src: "removeItems";
180
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').RemoveItemsSuccessEvent, import('./quote/actors').RemoveItemsInput, import('xstate').EventObject>;
181
+ id: string | undefined;
182
+ } | {
183
+ src: "updateItems";
184
+ logic: import('xstate').PromiseActorLogic<import('./quote/types').UpdateItemsSuccessEvent, import('./quote/actors').UpdateItemsInput, import('xstate').EventObject>;
185
+ id: string | undefined;
186
+ }, {
187
+ type: "refresh";
188
+ params: import('xstate').NonReducibleUnknown;
189
+ } | {
190
+ type: "addItems";
191
+ params: import('xstate').NonReducibleUnknown;
192
+ } | {
193
+ type: "removeItems";
194
+ params: import('xstate').NonReducibleUnknown;
195
+ } | {
196
+ type: "updateItems";
197
+ params: import('xstate').NonReducibleUnknown;
198
+ } | {
199
+ type: "notifyAddItems";
200
+ params: import('xstate').NonReducibleUnknown;
201
+ } | {
202
+ type: "notifyRemoveItems";
203
+ params: import('xstate').NonReducibleUnknown;
204
+ } | {
205
+ type: "notifyUpdateItems";
206
+ params: import('xstate').NonReducibleUnknown;
207
+ } | {
208
+ type: "reset";
209
+ params: import('xstate').NonReducibleUnknown;
210
+ } | {
211
+ type: "syncAccessToken";
212
+ params: import('xstate').NonReducibleUnknown;
213
+ }, {
214
+ type: "canRefresh";
215
+ params: unknown;
216
+ } | {
217
+ type: "hasItems";
218
+ params: unknown;
219
+ }, never, "active" | "refreshing" | "uninitialized" | "initializing" | "empty" | "addingItems" | "updatingItems" | "removingItems" | "resetting" | "checkingItems", string, {
220
+ initialContext: DeepPartial<QuoteMachineContext>;
221
+ initialState?: string;
222
+ }, import('xstate').NonReducibleUnknown, import('./quote/types').AddItemsEmittedEvent | import('./quote/types').RemoveItemsEmittedEvent | import('./quote/types').UpdateItemsEmittedEvent, import('xstate').MetaObject, {
223
+ id: "quote";
224
+ states: {
225
+ readonly uninitialized: {};
226
+ readonly empty: {};
227
+ readonly active: {};
228
+ readonly initializing: {};
229
+ readonly refreshing: {};
230
+ readonly checkingItems: {};
231
+ readonly addingItems: {};
232
+ readonly removingItems: {};
233
+ readonly updatingItems: {};
234
+ readonly resetting: {};
235
+ };
236
+ }>>>;
237
+ type Props = {
238
+ children: ReactNode;
239
+ actor: Actor<typeof quoteMachine>;
240
+ };
241
+ export declare function QuoteProvider({ actor, children }: Props): import("react/jsx-runtime").JSX.Element;
242
+ export {};
@@ -0,0 +1,8 @@
1
+ import { CheckoutMachineContext, CheckoutMachineEvents } from '../types';
2
+ export declare function changeStep({ context, event, }: {
3
+ context: CheckoutMachineContext;
4
+ event: CheckoutMachineEvents;
5
+ }): CheckoutMachineContext | {
6
+ currentStep: string;
7
+ };
8
+ export default changeStep;
@@ -0,0 +1,5 @@
1
+ export * from './changeStep';
2
+ export * from './nextStep';
3
+ export * from './resetCheckout';
4
+ export * from './updateQuote';
5
+ export * from './updateSuccessId';
@@ -0,0 +1,8 @@
1
+ import { CheckoutMachineContext, CheckoutMachineEvents } from '../types';
2
+ export declare function nextStep({ context, event, }: {
3
+ context: CheckoutMachineContext;
4
+ event: CheckoutMachineEvents;
5
+ }): CheckoutMachineContext | {
6
+ currentStep: string;
7
+ };
8
+ export default nextStep;
@@ -0,0 +1,104 @@
1
+ import { CheckoutMachineContext, CheckoutMachineEvents } from '../types';
2
+ export declare function resetCheckout({ context, event, }: {
3
+ context: CheckoutMachineContext;
4
+ event: CheckoutMachineEvents;
5
+ }): CheckoutMachineContext | {
6
+ currentStep: string;
7
+ errors: never[];
8
+ steps: import('../../..').CheckoutStep[];
9
+ successId: string;
10
+ quote: Partial<{
11
+ id: string | null;
12
+ accessToken: string | null;
13
+ locale: string | null;
14
+ checkoutSteps: Array<import('../../..').CheckoutStep>;
15
+ baseCurrency: string | null;
16
+ currency: string | null;
17
+ currencyConversionRate: number | null;
18
+ dateCreated: Date | null;
19
+ dateLastUpdated: Date | null;
20
+ items: Array<Record<string, any>> | null;
21
+ promotions: Array<Record<string, any>> | null;
22
+ shippingAddresses: {
23
+ available: Array<import('../../..').QuoteAddress>;
24
+ applied: Array<{
25
+ availableAddressId?: string;
26
+ address: import('../../..').QuoteAddress;
27
+ itemIds: Array<Record<string, any>>;
28
+ }>;
29
+ };
30
+ paymentMethods: {
31
+ available: Array<import('../../..').PaymentMethod>;
32
+ applied: Array<{
33
+ paymentMethod: import('../../..').PaymentMethod;
34
+ options: Array<Record<string, any>>;
35
+ amount: number;
36
+ }>;
37
+ };
38
+ shipments: Array<{
39
+ id: string;
40
+ shippingAddress: {
41
+ id: string;
42
+ address: import('../../..').QuoteAddress;
43
+ };
44
+ items: Array<Record<string, any>>;
45
+ shippingMethods: {
46
+ available: Array<{
47
+ shippingMethod: {
48
+ id: string;
49
+ code: string;
50
+ name: string;
51
+ carrier: {
52
+ id: string;
53
+ code: string;
54
+ name: string;
55
+ };
56
+ };
57
+ estimatedTotal: number;
58
+ earliestShipDate: Date;
59
+ latestShipDate: Date;
60
+ earliestArrivalDate: Date;
61
+ latestArrivalDate: Date;
62
+ }>;
63
+ applied: {
64
+ shippingMethod: {
65
+ id: string;
66
+ code: string;
67
+ name: string;
68
+ carrier: {
69
+ id: string;
70
+ code: string;
71
+ name: string;
72
+ };
73
+ };
74
+ estimatedTotal: number;
75
+ earliestShipDate: Date;
76
+ latestShipDate: Date;
77
+ earliestArrivalDate: Date;
78
+ latestArrivalDate: Date;
79
+ };
80
+ };
81
+ }>;
82
+ totals: {
83
+ discount: number;
84
+ taxAmount: number;
85
+ shippingAmount: number;
86
+ shippingTaxAmount: number;
87
+ subtotal: number;
88
+ grandTotal: number;
89
+ } | null;
90
+ appliedPriceRules: Array<Record<string, any>> | null;
91
+ appliedPromotions: Array<Record<string, any>> | null;
92
+ shippingMethods: Array<Record<string, any>> | null;
93
+ storeCredit: Array<Record<string, any>> | null;
94
+ rewards: Array<Record<string, any>> | null;
95
+ giftCards: Array<Record<string, any>> | null;
96
+ user: {
97
+ id: string | null;
98
+ email: string | null;
99
+ firstName: string | null;
100
+ lastName: string | null;
101
+ } | null;
102
+ }>;
103
+ };
104
+ export default resetCheckout;