@clicktap/state 0.14.4 → 0.14.6
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 +31 -31
- package/index.mjs +408 -375
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +30 -6
- package/quote/checkout/actions/changeStep.d.ts +8 -0
- package/quote/checkout/actions/index.d.ts +1 -0
- package/quote/checkout/actions/updateQuote.d.ts +14 -10
- package/quote/checkout/types.d.ts +6 -7
- package/quote/checkout.d.ts +10 -2
- package/quote/quote/actions/addItems.d.ts +14 -10
- package/quote/quote/actions/refresh.d.ts +14 -10
- package/quote/quote/actions/removeItems.d.ts +14 -10
- package/quote/quote/actions/updateItems.d.ts +14 -10
- package/quote/quote/types.d.ts +13 -4
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ 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").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
11
|
+
export declare const CheckoutContext: import("react").Context<Actor<import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
12
12
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>, {
|
|
13
13
|
[k: string]: unknown;
|
|
14
14
|
type: string;
|
|
@@ -18,6 +18,10 @@ export declare const CheckoutContext: import("react").Context<Actor<import("xsta
|
|
|
18
18
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
19
19
|
id: string | undefined;
|
|
20
20
|
}, import("xstate").Values<{
|
|
21
|
+
changeStep: {
|
|
22
|
+
type: "changeStep";
|
|
23
|
+
params: import("xstate").NonReducibleUnknown;
|
|
24
|
+
};
|
|
21
25
|
nextStep: {
|
|
22
26
|
type: "nextStep";
|
|
23
27
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -32,11 +36,15 @@ export declare const CheckoutContext: import("react").Context<Actor<import("xsta
|
|
|
32
36
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
33
37
|
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
34
38
|
initialState?: string | undefined;
|
|
35
|
-
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
39
|
+
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
36
40
|
src: "submitStepData";
|
|
37
41
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
38
42
|
id: string | undefined;
|
|
39
43
|
}, import("xstate").Values<{
|
|
44
|
+
changeStep: {
|
|
45
|
+
type: "changeStep";
|
|
46
|
+
params: import("xstate").NonReducibleUnknown;
|
|
47
|
+
};
|
|
40
48
|
nextStep: {
|
|
41
49
|
type: "nextStep";
|
|
42
50
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -50,7 +58,7 @@ export declare const CheckoutContext: import("react").Context<Actor<import("xsta
|
|
|
50
58
|
params: unknown;
|
|
51
59
|
}, never, string, import("xstate").EventObject>>>>;
|
|
52
60
|
export declare const useCheckout: () => {
|
|
53
|
-
checkoutActor: Actor<import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
61
|
+
checkoutActor: Actor<import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
54
62
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>, {
|
|
55
63
|
[k: string]: unknown;
|
|
56
64
|
type: string;
|
|
@@ -60,6 +68,10 @@ export declare const useCheckout: () => {
|
|
|
60
68
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
61
69
|
id: string | undefined;
|
|
62
70
|
}, import("xstate").Values<{
|
|
71
|
+
changeStep: {
|
|
72
|
+
type: "changeStep";
|
|
73
|
+
params: import("xstate").NonReducibleUnknown;
|
|
74
|
+
};
|
|
63
75
|
nextStep: {
|
|
64
76
|
type: "nextStep";
|
|
65
77
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -74,11 +86,15 @@ export declare const useCheckout: () => {
|
|
|
74
86
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
75
87
|
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
76
88
|
initialState?: string | undefined;
|
|
77
|
-
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
89
|
+
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
78
90
|
src: "submitStepData";
|
|
79
91
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
80
92
|
id: string | undefined;
|
|
81
93
|
}, import("xstate").Values<{
|
|
94
|
+
changeStep: {
|
|
95
|
+
type: "changeStep";
|
|
96
|
+
params: import("xstate").NonReducibleUnknown;
|
|
97
|
+
};
|
|
82
98
|
nextStep: {
|
|
83
99
|
type: "nextStep";
|
|
84
100
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -104,7 +120,7 @@ type CheckoutOptions = {
|
|
|
104
120
|
/**
|
|
105
121
|
* runs on server side as part of withQuote HOF
|
|
106
122
|
*/
|
|
107
|
-
export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
123
|
+
export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
108
124
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>, {
|
|
109
125
|
[k: string]: unknown;
|
|
110
126
|
type: string;
|
|
@@ -114,6 +130,10 @@ export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<i
|
|
|
114
130
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
115
131
|
id: string | undefined;
|
|
116
132
|
}, import("xstate").Values<{
|
|
133
|
+
changeStep: {
|
|
134
|
+
type: "changeStep";
|
|
135
|
+
params: import("xstate").NonReducibleUnknown;
|
|
136
|
+
};
|
|
117
137
|
nextStep: {
|
|
118
138
|
type: "nextStep";
|
|
119
139
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -128,11 +148,15 @@ export declare const getCheckout: (options?: CheckoutOptions) => Promise<Actor<i
|
|
|
128
148
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
129
149
|
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
130
150
|
initialState?: string | undefined;
|
|
131
|
-
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
151
|
+
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
132
152
|
src: "submitStepData";
|
|
133
153
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
134
154
|
id: string | undefined;
|
|
135
155
|
}, import("xstate").Values<{
|
|
156
|
+
changeStep: {
|
|
157
|
+
type: "changeStep";
|
|
158
|
+
params: import("xstate").NonReducibleUnknown;
|
|
159
|
+
};
|
|
136
160
|
nextStep: {
|
|
137
161
|
type: "nextStep";
|
|
138
162
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -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;
|
|
@@ -7,6 +7,7 @@ export declare function updateQuote({ context, event, }: {
|
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
9
|
locale: string | null;
|
|
10
|
+
checkoutSteps: import("../../..").CheckoutStep[];
|
|
10
11
|
baseCurrency: string | null;
|
|
11
12
|
currency: string | null;
|
|
12
13
|
currencyConversionRate: number | null;
|
|
@@ -16,10 +17,11 @@ export declare function updateQuote({ context, event, }: {
|
|
|
16
17
|
promotions: Record<string, any>[] | null;
|
|
17
18
|
shippingAddresses: {
|
|
18
19
|
available: import("../../..").QuoteAddress[];
|
|
19
|
-
applied:
|
|
20
|
+
applied: {
|
|
20
21
|
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../../..").QuoteAddress;
|
|
21
23
|
itemIds: Record<string, any>[];
|
|
22
|
-
}
|
|
24
|
+
}[];
|
|
23
25
|
};
|
|
24
26
|
paymentMethods: {
|
|
25
27
|
available: import("../../..").PaymentMethod[];
|
|
@@ -75,9 +77,9 @@ export declare function updateQuote({ context, event, }: {
|
|
|
75
77
|
}[];
|
|
76
78
|
totals: {
|
|
77
79
|
discount: number;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
81
83
|
subtotal: number;
|
|
82
84
|
grandTotal: number;
|
|
83
85
|
} | null;
|
|
@@ -119,6 +121,7 @@ export declare function updateQuote({ context, event, }: {
|
|
|
119
121
|
} | undefined;
|
|
120
122
|
id?: string | null | undefined;
|
|
121
123
|
locale?: string | null | undefined;
|
|
124
|
+
checkoutSteps?: import("../../..").CheckoutStep[] | undefined;
|
|
122
125
|
baseCurrency?: string | null | undefined;
|
|
123
126
|
currency?: string | null | undefined;
|
|
124
127
|
currencyConversionRate?: number | null | undefined;
|
|
@@ -128,10 +131,11 @@ export declare function updateQuote({ context, event, }: {
|
|
|
128
131
|
promotions?: Record<string, any>[] | null | undefined;
|
|
129
132
|
shippingAddresses?: {
|
|
130
133
|
available: import("../../..").QuoteAddress[];
|
|
131
|
-
applied:
|
|
134
|
+
applied: {
|
|
132
135
|
availableAddressId?: string | undefined;
|
|
136
|
+
address: import("../../..").QuoteAddress;
|
|
133
137
|
itemIds: Record<string, any>[];
|
|
134
|
-
}
|
|
138
|
+
}[];
|
|
135
139
|
} | undefined;
|
|
136
140
|
paymentMethods?: {
|
|
137
141
|
available: import("../../..").PaymentMethod[];
|
|
@@ -187,9 +191,9 @@ export declare function updateQuote({ context, event, }: {
|
|
|
187
191
|
}[] | undefined;
|
|
188
192
|
totals?: {
|
|
189
193
|
discount: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
taxAmount: number;
|
|
195
|
+
shippingAmount: number;
|
|
196
|
+
shippingTaxAmount: number;
|
|
193
197
|
subtotal: number;
|
|
194
198
|
grandTotal: number;
|
|
195
199
|
} | null | undefined;
|
|
@@ -2,12 +2,7 @@ import { RequestDocument } from 'graphql-request';
|
|
|
2
2
|
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
3
3
|
import { GraphQLClientRequestHeaders } from 'graphql-request/build/esm/types';
|
|
4
4
|
import { DoneActorEvent } from 'xstate';
|
|
5
|
-
import { QuoteMachineContext } from '../quote/types';
|
|
6
|
-
export interface CheckoutStep {
|
|
7
|
-
name: string;
|
|
8
|
-
prev: string | null;
|
|
9
|
-
next: string | null;
|
|
10
|
-
}
|
|
5
|
+
import { QuoteMachineContext, CheckoutStep } from '../quote/types';
|
|
11
6
|
export interface CheckoutMachineContext {
|
|
12
7
|
currentStep: string;
|
|
13
8
|
/** @todo DeepPartial should play nicer with props like steps */
|
|
@@ -25,6 +20,10 @@ export interface CheckoutMachineContext {
|
|
|
25
20
|
};
|
|
26
21
|
};
|
|
27
22
|
}
|
|
23
|
+
export interface ChangeStepEvent {
|
|
24
|
+
type: 'CHANGE_STEP';
|
|
25
|
+
step: string;
|
|
26
|
+
}
|
|
28
27
|
export interface SubmitStepDataEvent {
|
|
29
28
|
type: 'SUBMIT_STEP_DATA';
|
|
30
29
|
data: Record<string, any>;
|
|
@@ -33,4 +32,4 @@ export interface SubmitStepDataSuccessEvent {
|
|
|
33
32
|
type: 'SUBMIT_STEP_DATA_SUCCESS';
|
|
34
33
|
quote: Partial<QuoteMachineContext>;
|
|
35
34
|
}
|
|
36
|
-
export type CheckoutMachineEvents = SubmitStepDataEvent | DoneActorEvent<SubmitStepDataSuccessEvent>;
|
|
35
|
+
export type CheckoutMachineEvents = ChangeStepEvent | SubmitStepDataEvent | DoneActorEvent<SubmitStepDataSuccessEvent>;
|
package/quote/checkout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CheckoutMachineContext } from './checkout/types';
|
|
2
2
|
import { DeepPartial } from './types';
|
|
3
|
-
export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
3
|
+
export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMachineContext, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
4
4
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>, {
|
|
5
5
|
[k: string]: unknown;
|
|
6
6
|
type: string;
|
|
@@ -10,6 +10,10 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
10
10
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
11
11
|
id: string | undefined;
|
|
12
12
|
}, import("xstate").Values<{
|
|
13
|
+
changeStep: {
|
|
14
|
+
type: "changeStep";
|
|
15
|
+
params: import("xstate").NonReducibleUnknown;
|
|
16
|
+
};
|
|
13
17
|
nextStep: {
|
|
14
18
|
type: "nextStep";
|
|
15
19
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -24,11 +28,15 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
24
28
|
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
25
29
|
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
26
30
|
initialState?: string | undefined;
|
|
27
|
-
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
31
|
+
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./checkout/types").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
28
32
|
src: "submitStepData";
|
|
29
33
|
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
30
34
|
id: string | undefined;
|
|
31
35
|
}, import("xstate").Values<{
|
|
36
|
+
changeStep: {
|
|
37
|
+
type: "changeStep";
|
|
38
|
+
params: import("xstate").NonReducibleUnknown;
|
|
39
|
+
};
|
|
32
40
|
nextStep: {
|
|
33
41
|
type: "nextStep";
|
|
34
42
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -7,6 +7,7 @@ export declare function addItems({ context, event, }: {
|
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
9
|
locale: string | null;
|
|
10
|
+
checkoutSteps: import("../types").CheckoutStep[];
|
|
10
11
|
baseCurrency: string | null;
|
|
11
12
|
currency: string | null;
|
|
12
13
|
currencyConversionRate: number | null;
|
|
@@ -16,10 +17,11 @@ export declare function addItems({ context, event, }: {
|
|
|
16
17
|
promotions: Record<string, any>[] | null;
|
|
17
18
|
shippingAddresses: {
|
|
18
19
|
available: import("../types").QuoteAddress[];
|
|
19
|
-
applied:
|
|
20
|
+
applied: {
|
|
20
21
|
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../types").QuoteAddress;
|
|
21
23
|
itemIds: Record<string, any>[];
|
|
22
|
-
}
|
|
24
|
+
}[];
|
|
23
25
|
};
|
|
24
26
|
paymentMethods: {
|
|
25
27
|
available: import("../types").PaymentMethod[];
|
|
@@ -75,9 +77,9 @@ export declare function addItems({ context, event, }: {
|
|
|
75
77
|
}[];
|
|
76
78
|
totals: {
|
|
77
79
|
discount: number;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
81
83
|
subtotal: number;
|
|
82
84
|
grandTotal: number;
|
|
83
85
|
} | null;
|
|
@@ -119,6 +121,7 @@ export declare function addItems({ context, event, }: {
|
|
|
119
121
|
} | undefined;
|
|
120
122
|
id?: string | null | undefined;
|
|
121
123
|
locale?: string | null | undefined;
|
|
124
|
+
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
122
125
|
baseCurrency?: string | null | undefined;
|
|
123
126
|
currency?: string | null | undefined;
|
|
124
127
|
currencyConversionRate?: number | null | undefined;
|
|
@@ -128,10 +131,11 @@ export declare function addItems({ context, event, }: {
|
|
|
128
131
|
promotions?: Record<string, any>[] | null | undefined;
|
|
129
132
|
shippingAddresses?: {
|
|
130
133
|
available: import("../types").QuoteAddress[];
|
|
131
|
-
applied:
|
|
134
|
+
applied: {
|
|
132
135
|
availableAddressId?: string | undefined;
|
|
136
|
+
address: import("../types").QuoteAddress;
|
|
133
137
|
itemIds: Record<string, any>[];
|
|
134
|
-
}
|
|
138
|
+
}[];
|
|
135
139
|
} | undefined;
|
|
136
140
|
paymentMethods?: {
|
|
137
141
|
available: import("../types").PaymentMethod[];
|
|
@@ -187,9 +191,9 @@ export declare function addItems({ context, event, }: {
|
|
|
187
191
|
}[] | undefined;
|
|
188
192
|
totals?: {
|
|
189
193
|
discount: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
taxAmount: number;
|
|
195
|
+
shippingAmount: number;
|
|
196
|
+
shippingTaxAmount: number;
|
|
193
197
|
subtotal: number;
|
|
194
198
|
grandTotal: number;
|
|
195
199
|
} | null | undefined;
|
|
@@ -7,6 +7,7 @@ export declare function refresh({ context, event, }: {
|
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
9
|
locale: string | null;
|
|
10
|
+
checkoutSteps: import("../types").CheckoutStep[];
|
|
10
11
|
baseCurrency: string | null;
|
|
11
12
|
currency: string | null;
|
|
12
13
|
currencyConversionRate: number | null;
|
|
@@ -16,10 +17,11 @@ export declare function refresh({ context, event, }: {
|
|
|
16
17
|
promotions: Record<string, any>[] | null;
|
|
17
18
|
shippingAddresses: {
|
|
18
19
|
available: import("../types").QuoteAddress[];
|
|
19
|
-
applied:
|
|
20
|
+
applied: {
|
|
20
21
|
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../types").QuoteAddress;
|
|
21
23
|
itemIds: Record<string, any>[];
|
|
22
|
-
}
|
|
24
|
+
}[];
|
|
23
25
|
};
|
|
24
26
|
paymentMethods: {
|
|
25
27
|
available: import("../types").PaymentMethod[];
|
|
@@ -75,9 +77,9 @@ export declare function refresh({ context, event, }: {
|
|
|
75
77
|
}[];
|
|
76
78
|
totals: {
|
|
77
79
|
discount: number;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
81
83
|
subtotal: number;
|
|
82
84
|
grandTotal: number;
|
|
83
85
|
} | null;
|
|
@@ -119,6 +121,7 @@ export declare function refresh({ context, event, }: {
|
|
|
119
121
|
} | undefined;
|
|
120
122
|
id?: string | null | undefined;
|
|
121
123
|
locale?: string | null | undefined;
|
|
124
|
+
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
122
125
|
baseCurrency?: string | null | undefined;
|
|
123
126
|
currency?: string | null | undefined;
|
|
124
127
|
currencyConversionRate?: number | null | undefined;
|
|
@@ -128,10 +131,11 @@ export declare function refresh({ context, event, }: {
|
|
|
128
131
|
promotions?: Record<string, any>[] | null | undefined;
|
|
129
132
|
shippingAddresses?: {
|
|
130
133
|
available: import("../types").QuoteAddress[];
|
|
131
|
-
applied:
|
|
134
|
+
applied: {
|
|
132
135
|
availableAddressId?: string | undefined;
|
|
136
|
+
address: import("../types").QuoteAddress;
|
|
133
137
|
itemIds: Record<string, any>[];
|
|
134
|
-
}
|
|
138
|
+
}[];
|
|
135
139
|
} | undefined;
|
|
136
140
|
paymentMethods?: {
|
|
137
141
|
available: import("../types").PaymentMethod[];
|
|
@@ -187,9 +191,9 @@ export declare function refresh({ context, event, }: {
|
|
|
187
191
|
}[] | undefined;
|
|
188
192
|
totals?: {
|
|
189
193
|
discount: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
taxAmount: number;
|
|
195
|
+
shippingAmount: number;
|
|
196
|
+
shippingTaxAmount: number;
|
|
193
197
|
subtotal: number;
|
|
194
198
|
grandTotal: number;
|
|
195
199
|
} | null | undefined;
|
|
@@ -7,6 +7,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
9
|
locale: string | null;
|
|
10
|
+
checkoutSteps: import("../types").CheckoutStep[];
|
|
10
11
|
baseCurrency: string | null;
|
|
11
12
|
currency: string | null;
|
|
12
13
|
currencyConversionRate: number | null;
|
|
@@ -16,10 +17,11 @@ export declare function removeItems({ context, event, }: {
|
|
|
16
17
|
promotions: Record<string, any>[] | null;
|
|
17
18
|
shippingAddresses: {
|
|
18
19
|
available: import("../types").QuoteAddress[];
|
|
19
|
-
applied:
|
|
20
|
+
applied: {
|
|
20
21
|
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../types").QuoteAddress;
|
|
21
23
|
itemIds: Record<string, any>[];
|
|
22
|
-
}
|
|
24
|
+
}[];
|
|
23
25
|
};
|
|
24
26
|
paymentMethods: {
|
|
25
27
|
available: import("../types").PaymentMethod[];
|
|
@@ -75,9 +77,9 @@ export declare function removeItems({ context, event, }: {
|
|
|
75
77
|
}[];
|
|
76
78
|
totals: {
|
|
77
79
|
discount: number;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
81
83
|
subtotal: number;
|
|
82
84
|
grandTotal: number;
|
|
83
85
|
} | null;
|
|
@@ -119,6 +121,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
119
121
|
} | undefined;
|
|
120
122
|
id?: string | null | undefined;
|
|
121
123
|
locale?: string | null | undefined;
|
|
124
|
+
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
122
125
|
baseCurrency?: string | null | undefined;
|
|
123
126
|
currency?: string | null | undefined;
|
|
124
127
|
currencyConversionRate?: number | null | undefined;
|
|
@@ -128,10 +131,11 @@ export declare function removeItems({ context, event, }: {
|
|
|
128
131
|
promotions?: Record<string, any>[] | null | undefined;
|
|
129
132
|
shippingAddresses?: {
|
|
130
133
|
available: import("../types").QuoteAddress[];
|
|
131
|
-
applied:
|
|
134
|
+
applied: {
|
|
132
135
|
availableAddressId?: string | undefined;
|
|
136
|
+
address: import("../types").QuoteAddress;
|
|
133
137
|
itemIds: Record<string, any>[];
|
|
134
|
-
}
|
|
138
|
+
}[];
|
|
135
139
|
} | undefined;
|
|
136
140
|
paymentMethods?: {
|
|
137
141
|
available: import("../types").PaymentMethod[];
|
|
@@ -187,9 +191,9 @@ export declare function removeItems({ context, event, }: {
|
|
|
187
191
|
}[] | undefined;
|
|
188
192
|
totals?: {
|
|
189
193
|
discount: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
taxAmount: number;
|
|
195
|
+
shippingAmount: number;
|
|
196
|
+
shippingTaxAmount: number;
|
|
193
197
|
subtotal: number;
|
|
194
198
|
grandTotal: number;
|
|
195
199
|
} | null | undefined;
|
|
@@ -7,6 +7,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
9
|
locale: string | null;
|
|
10
|
+
checkoutSteps: import("../types").CheckoutStep[];
|
|
10
11
|
baseCurrency: string | null;
|
|
11
12
|
currency: string | null;
|
|
12
13
|
currencyConversionRate: number | null;
|
|
@@ -16,10 +17,11 @@ export declare function updateItems({ context, event, }: {
|
|
|
16
17
|
promotions: Record<string, any>[] | null;
|
|
17
18
|
shippingAddresses: {
|
|
18
19
|
available: import("../types").QuoteAddress[];
|
|
19
|
-
applied:
|
|
20
|
+
applied: {
|
|
20
21
|
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../types").QuoteAddress;
|
|
21
23
|
itemIds: Record<string, any>[];
|
|
22
|
-
}
|
|
24
|
+
}[];
|
|
23
25
|
};
|
|
24
26
|
paymentMethods: {
|
|
25
27
|
available: import("../types").PaymentMethod[];
|
|
@@ -75,9 +77,9 @@ export declare function updateItems({ context, event, }: {
|
|
|
75
77
|
}[];
|
|
76
78
|
totals: {
|
|
77
79
|
discount: number;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
81
83
|
subtotal: number;
|
|
82
84
|
grandTotal: number;
|
|
83
85
|
} | null;
|
|
@@ -119,6 +121,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
119
121
|
} | undefined;
|
|
120
122
|
id?: string | null | undefined;
|
|
121
123
|
locale?: string | null | undefined;
|
|
124
|
+
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
122
125
|
baseCurrency?: string | null | undefined;
|
|
123
126
|
currency?: string | null | undefined;
|
|
124
127
|
currencyConversionRate?: number | null | undefined;
|
|
@@ -128,10 +131,11 @@ export declare function updateItems({ context, event, }: {
|
|
|
128
131
|
promotions?: Record<string, any>[] | null | undefined;
|
|
129
132
|
shippingAddresses?: {
|
|
130
133
|
available: import("../types").QuoteAddress[];
|
|
131
|
-
applied:
|
|
134
|
+
applied: {
|
|
132
135
|
availableAddressId?: string | undefined;
|
|
136
|
+
address: import("../types").QuoteAddress;
|
|
133
137
|
itemIds: Record<string, any>[];
|
|
134
|
-
}
|
|
138
|
+
}[];
|
|
135
139
|
} | undefined;
|
|
136
140
|
paymentMethods?: {
|
|
137
141
|
available: import("../types").PaymentMethod[];
|
|
@@ -187,9 +191,9 @@ export declare function updateItems({ context, event, }: {
|
|
|
187
191
|
}[] | undefined;
|
|
188
192
|
totals?: {
|
|
189
193
|
discount: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
taxAmount: number;
|
|
195
|
+
shippingAmount: number;
|
|
196
|
+
shippingTaxAmount: number;
|
|
193
197
|
subtotal: number;
|
|
194
198
|
grandTotal: number;
|
|
195
199
|
} | null | undefined;
|
package/quote/quote/types.d.ts
CHANGED
|
@@ -26,10 +26,18 @@ export type PaymentMethod = {
|
|
|
26
26
|
name: string;
|
|
27
27
|
sortOrder: number;
|
|
28
28
|
};
|
|
29
|
+
export type CheckoutStep = {
|
|
30
|
+
code: string;
|
|
31
|
+
isAvailable: boolean;
|
|
32
|
+
isComplete: boolean;
|
|
33
|
+
prev?: string;
|
|
34
|
+
next?: string;
|
|
35
|
+
};
|
|
29
36
|
export interface QuoteMachineContext {
|
|
30
37
|
quote: Partial<{
|
|
31
38
|
id: string | null;
|
|
32
39
|
locale: string | null;
|
|
40
|
+
checkoutSteps: Array<CheckoutStep>;
|
|
33
41
|
baseCurrency: string | null;
|
|
34
42
|
currency: string | null;
|
|
35
43
|
currencyConversionRate: number | null;
|
|
@@ -39,8 +47,9 @@ export interface QuoteMachineContext {
|
|
|
39
47
|
promotions: Array<Record<string, any>> | null;
|
|
40
48
|
shippingAddresses: {
|
|
41
49
|
available: Array<QuoteAddress>;
|
|
42
|
-
applied: Array<
|
|
50
|
+
applied: Array<{
|
|
43
51
|
availableAddressId?: string;
|
|
52
|
+
address: QuoteAddress;
|
|
44
53
|
itemIds: Array<Record<string, any>>;
|
|
45
54
|
}>;
|
|
46
55
|
};
|
|
@@ -98,9 +107,9 @@ export interface QuoteMachineContext {
|
|
|
98
107
|
}>;
|
|
99
108
|
totals: {
|
|
100
109
|
discount: number;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
taxAmount: number;
|
|
111
|
+
shippingAmount: number;
|
|
112
|
+
shippingTaxAmount: number;
|
|
104
113
|
subtotal: number;
|
|
105
114
|
grandTotal: number;
|
|
106
115
|
} | null;
|