@clicktap/state 0.14.2 → 0.14.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/index.js +13 -13
- package/index.mjs +224 -209
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +60 -24
- package/quote/checkout/actions/index.d.ts +1 -0
- package/quote/checkout/actions/updateQuote.d.ts +210 -0
- package/quote/checkout.d.ts +20 -8
package/package.json
CHANGED
|
@@ -17,10 +17,16 @@ export declare const CheckoutContext: import("react").Context<Actor<import("xsta
|
|
|
17
17
|
src: "submitStepData";
|
|
18
18
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
19
19
|
id: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}, import("xstate").Values<{
|
|
21
|
+
nextStep: {
|
|
22
|
+
type: "nextStep";
|
|
23
|
+
params: import("xstate").NonReducibleUnknown;
|
|
24
|
+
};
|
|
25
|
+
updateQuote: {
|
|
26
|
+
type: "updateQuote";
|
|
27
|
+
params: import("xstate").NonReducibleUnknown;
|
|
28
|
+
};
|
|
29
|
+
}>, {
|
|
24
30
|
type: "quoteExists";
|
|
25
31
|
params: unknown;
|
|
26
32
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
@@ -30,10 +36,16 @@ export declare const CheckoutContext: import("react").Context<Actor<import("xsta
|
|
|
30
36
|
src: "submitStepData";
|
|
31
37
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
32
38
|
id: string | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
}, import("xstate").Values<{
|
|
40
|
+
nextStep: {
|
|
41
|
+
type: "nextStep";
|
|
42
|
+
params: import("xstate").NonReducibleUnknown;
|
|
43
|
+
};
|
|
44
|
+
updateQuote: {
|
|
45
|
+
type: "updateQuote";
|
|
46
|
+
params: import("xstate").NonReducibleUnknown;
|
|
47
|
+
};
|
|
48
|
+
}>, {
|
|
37
49
|
type: "quoteExists";
|
|
38
50
|
params: unknown;
|
|
39
51
|
}, never, string, import("xstate").EventObject>>>>;
|
|
@@ -47,10 +59,16 @@ export declare const useCheckout: () => {
|
|
|
47
59
|
src: "submitStepData";
|
|
48
60
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
49
61
|
id: string | undefined;
|
|
50
|
-
}, {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
}, import("xstate").Values<{
|
|
63
|
+
nextStep: {
|
|
64
|
+
type: "nextStep";
|
|
65
|
+
params: import("xstate").NonReducibleUnknown;
|
|
66
|
+
};
|
|
67
|
+
updateQuote: {
|
|
68
|
+
type: "updateQuote";
|
|
69
|
+
params: import("xstate").NonReducibleUnknown;
|
|
70
|
+
};
|
|
71
|
+
}>, {
|
|
54
72
|
type: "quoteExists";
|
|
55
73
|
params: unknown;
|
|
56
74
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
@@ -60,10 +78,16 @@ export declare const useCheckout: () => {
|
|
|
60
78
|
src: "submitStepData";
|
|
61
79
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
62
80
|
id: string | undefined;
|
|
63
|
-
}, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
}, import("xstate").Values<{
|
|
82
|
+
nextStep: {
|
|
83
|
+
type: "nextStep";
|
|
84
|
+
params: import("xstate").NonReducibleUnknown;
|
|
85
|
+
};
|
|
86
|
+
updateQuote: {
|
|
87
|
+
type: "updateQuote";
|
|
88
|
+
params: import("xstate").NonReducibleUnknown;
|
|
89
|
+
};
|
|
90
|
+
}>, {
|
|
67
91
|
type: "quoteExists";
|
|
68
92
|
params: unknown;
|
|
69
93
|
}, never, string, import("xstate").EventObject>>>;
|
|
@@ -89,10 +113,16 @@ export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<i
|
|
|
89
113
|
src: "submitStepData";
|
|
90
114
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
91
115
|
id: string | undefined;
|
|
92
|
-
}, {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
116
|
+
}, import("xstate").Values<{
|
|
117
|
+
nextStep: {
|
|
118
|
+
type: "nextStep";
|
|
119
|
+
params: import("xstate").NonReducibleUnknown;
|
|
120
|
+
};
|
|
121
|
+
updateQuote: {
|
|
122
|
+
type: "updateQuote";
|
|
123
|
+
params: import("xstate").NonReducibleUnknown;
|
|
124
|
+
};
|
|
125
|
+
}>, {
|
|
96
126
|
type: "quoteExists";
|
|
97
127
|
params: unknown;
|
|
98
128
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
@@ -102,10 +132,16 @@ export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<i
|
|
|
102
132
|
src: "submitStepData";
|
|
103
133
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
104
134
|
id: string | undefined;
|
|
105
|
-
}, {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
135
|
+
}, import("xstate").Values<{
|
|
136
|
+
nextStep: {
|
|
137
|
+
type: "nextStep";
|
|
138
|
+
params: import("xstate").NonReducibleUnknown;
|
|
139
|
+
};
|
|
140
|
+
updateQuote: {
|
|
141
|
+
type: "updateQuote";
|
|
142
|
+
params: import("xstate").NonReducibleUnknown;
|
|
143
|
+
};
|
|
144
|
+
}>, {
|
|
109
145
|
type: "quoteExists";
|
|
110
146
|
params: unknown;
|
|
111
147
|
}, never, string, import("xstate").EventObject>>>>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { CheckoutMachineContext, CheckoutMachineEvents } from '../types';
|
|
2
|
+
export declare function updateQuote({ context, event, }: {
|
|
3
|
+
context: CheckoutMachineContext;
|
|
4
|
+
event: CheckoutMachineEvents;
|
|
5
|
+
}): CheckoutMachineContext | {
|
|
6
|
+
quote: {
|
|
7
|
+
quote?: Partial<{
|
|
8
|
+
id: string | null;
|
|
9
|
+
locale: string | null;
|
|
10
|
+
baseCurrency: string | null;
|
|
11
|
+
currency: string | null;
|
|
12
|
+
currencyConversionRate: number | null;
|
|
13
|
+
dateCreated: Date | null;
|
|
14
|
+
dateLastUpdated: Date | null;
|
|
15
|
+
items: Record<string, any>[] | null;
|
|
16
|
+
promotions: Record<string, any>[] | null;
|
|
17
|
+
shippingAddresses: {
|
|
18
|
+
available: import("../../quote/types").QuoteAddress[];
|
|
19
|
+
applied: (import("../../quote/types").QuoteAddress & {
|
|
20
|
+
availableAddressId?: string | undefined;
|
|
21
|
+
itemIds: Record<string, any>[];
|
|
22
|
+
})[];
|
|
23
|
+
};
|
|
24
|
+
paymentMethods: {
|
|
25
|
+
available: import("../../quote/types").PaymentMethod[];
|
|
26
|
+
applied: {
|
|
27
|
+
paymentMethod: import("../../quote/types").PaymentMethod;
|
|
28
|
+
options: Record<string, any>[];
|
|
29
|
+
amount: number;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
shipments: {
|
|
33
|
+
id: string;
|
|
34
|
+
shippingAddress: {
|
|
35
|
+
id: string;
|
|
36
|
+
address: import("../../quote/types").QuoteAddress;
|
|
37
|
+
};
|
|
38
|
+
items: Record<string, any>[];
|
|
39
|
+
shippingMethods: {
|
|
40
|
+
available: {
|
|
41
|
+
shippingMethod: {
|
|
42
|
+
id: string;
|
|
43
|
+
code: string;
|
|
44
|
+
name: string;
|
|
45
|
+
carrier: {
|
|
46
|
+
id: string;
|
|
47
|
+
code: string;
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
estimatedTotal: number;
|
|
52
|
+
earliestShipDate: Date;
|
|
53
|
+
latestShipDate: Date;
|
|
54
|
+
earliestArrivalDate: Date;
|
|
55
|
+
latestArrivalDate: Date;
|
|
56
|
+
}[];
|
|
57
|
+
applied: {
|
|
58
|
+
shippingMethod: {
|
|
59
|
+
id: string;
|
|
60
|
+
code: string;
|
|
61
|
+
name: string;
|
|
62
|
+
carrier: {
|
|
63
|
+
id: string;
|
|
64
|
+
code: string;
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
estimatedTotal: number;
|
|
69
|
+
earliestShipDate: Date;
|
|
70
|
+
latestShipDate: Date;
|
|
71
|
+
earliestArrivalDate: Date;
|
|
72
|
+
latestArrivalDate: Date;
|
|
73
|
+
}[];
|
|
74
|
+
};
|
|
75
|
+
}[];
|
|
76
|
+
totals: {
|
|
77
|
+
discount: number;
|
|
78
|
+
tax: number;
|
|
79
|
+
shipping: number;
|
|
80
|
+
shippingTax: number;
|
|
81
|
+
subtotal: number;
|
|
82
|
+
grandTotal: number;
|
|
83
|
+
} | null;
|
|
84
|
+
appliedPriceRules: Record<string, any>[] | null;
|
|
85
|
+
appliedPromotions: Record<string, any>[] | null;
|
|
86
|
+
shippingMethods: Record<string, any>[] | null;
|
|
87
|
+
storeCredit: Record<string, any>[] | null;
|
|
88
|
+
rewards: Record<string, any>[] | null;
|
|
89
|
+
giftCards: Record<string, any>[] | null;
|
|
90
|
+
user: {
|
|
91
|
+
id: string | null;
|
|
92
|
+
email: string | null;
|
|
93
|
+
firstName: string | null;
|
|
94
|
+
lastName: string | null;
|
|
95
|
+
} | null;
|
|
96
|
+
}> | undefined;
|
|
97
|
+
errors?: string[] | undefined;
|
|
98
|
+
endpoints?: {
|
|
99
|
+
client?: string | undefined;
|
|
100
|
+
server?: string | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
graphql?: {
|
|
103
|
+
refresh: {
|
|
104
|
+
document: import("graphql-request").RequestDocument | import("@graphql-typed-document-node/core").TypedDocumentNode<unknown, {}>;
|
|
105
|
+
requestHeaders?: import("graphql-request/build/esm/types").GraphQLClientRequestHeaders | undefined;
|
|
106
|
+
};
|
|
107
|
+
addItems: {
|
|
108
|
+
document: import("graphql-request").RequestDocument | import("@graphql-typed-document-node/core").TypedDocumentNode<unknown, {}>;
|
|
109
|
+
requestHeaders?: import("graphql-request/build/esm/types").GraphQLClientRequestHeaders | undefined;
|
|
110
|
+
};
|
|
111
|
+
removeItems: {
|
|
112
|
+
document: import("graphql-request").RequestDocument | import("@graphql-typed-document-node/core").TypedDocumentNode<unknown, {}>;
|
|
113
|
+
requestHeaders?: import("graphql-request/build/esm/types").GraphQLClientRequestHeaders | undefined;
|
|
114
|
+
};
|
|
115
|
+
updateItems: {
|
|
116
|
+
document: import("graphql-request").RequestDocument | import("@graphql-typed-document-node/core").TypedDocumentNode<unknown, {}>;
|
|
117
|
+
requestHeaders?: import("graphql-request/build/esm/types").GraphQLClientRequestHeaders | undefined;
|
|
118
|
+
};
|
|
119
|
+
} | undefined;
|
|
120
|
+
id?: string | null | undefined;
|
|
121
|
+
locale?: string | null | undefined;
|
|
122
|
+
baseCurrency?: string | null | undefined;
|
|
123
|
+
currency?: string | null | undefined;
|
|
124
|
+
currencyConversionRate?: number | null | undefined;
|
|
125
|
+
dateCreated?: Date | null | undefined;
|
|
126
|
+
dateLastUpdated?: Date | null | undefined;
|
|
127
|
+
items?: Record<string, any>[] | null | undefined;
|
|
128
|
+
promotions?: Record<string, any>[] | null | undefined;
|
|
129
|
+
shippingAddresses?: {
|
|
130
|
+
available: import("../../quote/types").QuoteAddress[];
|
|
131
|
+
applied: (import("../../quote/types").QuoteAddress & {
|
|
132
|
+
availableAddressId?: string | undefined;
|
|
133
|
+
itemIds: Record<string, any>[];
|
|
134
|
+
})[];
|
|
135
|
+
} | undefined;
|
|
136
|
+
paymentMethods?: {
|
|
137
|
+
available: import("../../quote/types").PaymentMethod[];
|
|
138
|
+
applied: {
|
|
139
|
+
paymentMethod: import("../../quote/types").PaymentMethod;
|
|
140
|
+
options: Record<string, any>[];
|
|
141
|
+
amount: number;
|
|
142
|
+
}[];
|
|
143
|
+
} | undefined;
|
|
144
|
+
shipments?: {
|
|
145
|
+
id: string;
|
|
146
|
+
shippingAddress: {
|
|
147
|
+
id: string;
|
|
148
|
+
address: import("../../quote/types").QuoteAddress;
|
|
149
|
+
};
|
|
150
|
+
items: Record<string, any>[];
|
|
151
|
+
shippingMethods: {
|
|
152
|
+
available: {
|
|
153
|
+
shippingMethod: {
|
|
154
|
+
id: string;
|
|
155
|
+
code: string;
|
|
156
|
+
name: string;
|
|
157
|
+
carrier: {
|
|
158
|
+
id: string;
|
|
159
|
+
code: string;
|
|
160
|
+
name: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
estimatedTotal: number;
|
|
164
|
+
earliestShipDate: Date;
|
|
165
|
+
latestShipDate: Date;
|
|
166
|
+
earliestArrivalDate: Date;
|
|
167
|
+
latestArrivalDate: Date;
|
|
168
|
+
}[];
|
|
169
|
+
applied: {
|
|
170
|
+
shippingMethod: {
|
|
171
|
+
id: string;
|
|
172
|
+
code: string;
|
|
173
|
+
name: string;
|
|
174
|
+
carrier: {
|
|
175
|
+
id: string;
|
|
176
|
+
code: string;
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
estimatedTotal: number;
|
|
181
|
+
earliestShipDate: Date;
|
|
182
|
+
latestShipDate: Date;
|
|
183
|
+
earliestArrivalDate: Date;
|
|
184
|
+
latestArrivalDate: Date;
|
|
185
|
+
}[];
|
|
186
|
+
};
|
|
187
|
+
}[] | undefined;
|
|
188
|
+
totals?: {
|
|
189
|
+
discount: number;
|
|
190
|
+
tax: number;
|
|
191
|
+
shipping: number;
|
|
192
|
+
shippingTax: number;
|
|
193
|
+
subtotal: number;
|
|
194
|
+
grandTotal: number;
|
|
195
|
+
} | null | undefined;
|
|
196
|
+
appliedPriceRules?: Record<string, any>[] | null | undefined;
|
|
197
|
+
appliedPromotions?: Record<string, any>[] | null | undefined;
|
|
198
|
+
shippingMethods?: Record<string, any>[] | null | undefined;
|
|
199
|
+
storeCredit?: Record<string, any>[] | null | undefined;
|
|
200
|
+
rewards?: Record<string, any>[] | null | undefined;
|
|
201
|
+
giftCards?: Record<string, any>[] | null | undefined;
|
|
202
|
+
user?: {
|
|
203
|
+
id: string | null;
|
|
204
|
+
email: string | null;
|
|
205
|
+
firstName: string | null;
|
|
206
|
+
lastName: string | null;
|
|
207
|
+
} | null | undefined;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
export default updateQuote;
|
package/quote/checkout.d.ts
CHANGED
|
@@ -9,10 +9,16 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
9
9
|
src: "submitStepData";
|
|
10
10
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
11
11
|
id: string | undefined;
|
|
12
|
-
}, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}, import("xstate").Values<{
|
|
13
|
+
nextStep: {
|
|
14
|
+
type: "nextStep";
|
|
15
|
+
params: import("xstate").NonReducibleUnknown;
|
|
16
|
+
};
|
|
17
|
+
updateQuote: {
|
|
18
|
+
type: "updateQuote";
|
|
19
|
+
params: import("xstate").NonReducibleUnknown;
|
|
20
|
+
};
|
|
21
|
+
}>, {
|
|
16
22
|
type: "quoteExists";
|
|
17
23
|
params: unknown;
|
|
18
24
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
@@ -22,10 +28,16 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
22
28
|
src: "submitStepData";
|
|
23
29
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
24
30
|
id: string | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
}, import("xstate").Values<{
|
|
32
|
+
nextStep: {
|
|
33
|
+
type: "nextStep";
|
|
34
|
+
params: import("xstate").NonReducibleUnknown;
|
|
35
|
+
};
|
|
36
|
+
updateQuote: {
|
|
37
|
+
type: "updateQuote";
|
|
38
|
+
params: import("xstate").NonReducibleUnknown;
|
|
39
|
+
};
|
|
40
|
+
}>, {
|
|
29
41
|
type: "quoteExists";
|
|
30
42
|
params: unknown;
|
|
31
43
|
}, never, string, import("xstate").EventObject>>;
|