@clicktap/state 0.14.7 → 0.15.0
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/auth/AuthProvider.d.ts +24 -8
- package/auth/actions/index.d.ts +1 -0
- package/auth/actions/notifyAuthenticated.d.ts +6 -0
- package/auth/auth.d.ts +12 -4
- package/auth/types.d.ts +9 -1
- package/index.js +34 -34
- package/index.mjs +1262 -1036
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +135 -36
- package/quote/QuoteProvider.d.ts +57 -9
- package/quote/checkout/actions/index.d.ts +2 -0
- package/quote/checkout/actions/resetCheckout.d.ts +104 -0
- package/quote/checkout/actions/updateQuote.d.ts +4 -2
- package/quote/checkout/actions/updateSuccessId.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +1 -0
- package/quote/checkout/actors/placeOrder.d.ts +20 -0
- package/quote/checkout/types.d.ts +21 -1
- package/quote/checkout.d.ts +45 -12
- package/quote/quote/actions/addItems.d.ts +4 -2
- package/quote/quote/actions/index.d.ts +2 -0
- package/quote/quote/actions/refresh.d.ts +4 -2
- package/quote/quote/actions/removeItems.d.ts +4 -2
- package/quote/quote/actions/reset.d.ts +40 -0
- package/quote/quote/actions/syncAccessToken.d.ts +100 -0
- package/quote/quote/actions/updateItems.d.ts +4 -2
- package/quote/quote/actors/addItems.d.ts +1 -0
- package/quote/quote/actors/refresh.d.ts +1 -0
- package/quote/quote/actors/removeItems.d.ts +3 -0
- package/quote/quote/actors/updateItems.d.ts +1 -0
- package/quote/quote/types.d.ts +22 -3
- package/quote/quote.d.ts +19 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckoutMachineContext, CheckoutMachineEvents } from '../types';
|
|
2
|
+
export declare function updateSuccessId({ context, event, }: {
|
|
3
|
+
context: CheckoutMachineContext;
|
|
4
|
+
event: CheckoutMachineEvents;
|
|
5
|
+
}): CheckoutMachineContext | {
|
|
6
|
+
successId: string;
|
|
7
|
+
};
|
|
8
|
+
export default updateSuccessId;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CheckoutMachineContext, PlaceOrderSuccessEvent } from '../types';
|
|
2
|
+
export type PlaceOrderDataInput = {
|
|
3
|
+
endpoint: CheckoutMachineContext['endpoints']['client'];
|
|
4
|
+
document: CheckoutMachineContext['graphql']['placeOrder']['document'];
|
|
5
|
+
requestHeaders?: CheckoutMachineContext['graphql']['placeOrder']['requestHeaders'];
|
|
6
|
+
};
|
|
7
|
+
export type PlaceOrderDataOutput = Partial<{
|
|
8
|
+
placeOrder: {
|
|
9
|
+
checkoutSuccess: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
userErrors: Array<{
|
|
13
|
+
code: string;
|
|
14
|
+
field: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export declare const placeOrder: import("xstate").PromiseActorLogic<PlaceOrderSuccessEvent, PlaceOrderDataInput>;
|
|
20
|
+
export default placeOrder;
|
|
@@ -13,7 +13,12 @@ export interface CheckoutMachineContext {
|
|
|
13
13
|
client?: string;
|
|
14
14
|
server?: string;
|
|
15
15
|
};
|
|
16
|
+
successId: string;
|
|
16
17
|
graphql: {
|
|
18
|
+
placeOrder: {
|
|
19
|
+
document: RequestDocument | TypedDocumentNode<unknown, {}>;
|
|
20
|
+
requestHeaders?: GraphQLClientRequestHeaders;
|
|
21
|
+
};
|
|
17
22
|
submitStepData: {
|
|
18
23
|
document: RequestDocument | TypedDocumentNode<unknown, {}>;
|
|
19
24
|
requestHeaders?: GraphQLClientRequestHeaders;
|
|
@@ -24,6 +29,17 @@ export interface ChangeStepEvent {
|
|
|
24
29
|
type: 'CHANGE_STEP';
|
|
25
30
|
step: string;
|
|
26
31
|
}
|
|
32
|
+
export interface PlaceOrderEvent {
|
|
33
|
+
type: 'PLACE_ORDER';
|
|
34
|
+
}
|
|
35
|
+
export interface ResetCheckoutEvent {
|
|
36
|
+
type: 'RESET_CHECKOUT';
|
|
37
|
+
data: {
|
|
38
|
+
currentStep: string;
|
|
39
|
+
steps: Array<CheckoutStep>;
|
|
40
|
+
quote: QuoteMachineContext['quote'];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
27
43
|
export interface SubmitStepDataEvent {
|
|
28
44
|
type: 'SUBMIT_STEP_DATA';
|
|
29
45
|
data: Record<string, any>;
|
|
@@ -32,4 +48,8 @@ export interface SubmitStepDataSuccessEvent {
|
|
|
32
48
|
type: 'SUBMIT_STEP_DATA_SUCCESS';
|
|
33
49
|
quote: Partial<QuoteMachineContext>;
|
|
34
50
|
}
|
|
35
|
-
export
|
|
51
|
+
export interface PlaceOrderSuccessEvent {
|
|
52
|
+
type: 'PLACE_ORDER_SUCCESS';
|
|
53
|
+
successId: string;
|
|
54
|
+
}
|
|
55
|
+
export type CheckoutMachineEvents = ChangeStepEvent | PlaceOrderEvent | ResetCheckoutEvent | SubmitStepDataEvent | DoneActorEvent<PlaceOrderSuccessEvent> | DoneActorEvent<SubmitStepDataSuccessEvent>;
|
package/quote/checkout.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
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").ChangeStepEvent | import("./checkout/types").SubmitStepDataEvent | import("xstate").DoneActorEvent<import("./checkout/types").SubmitStepDataSuccessEvent>, {
|
|
4
|
-
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").
|
|
3
|
+
export declare const checkoutMachine: 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>, {
|
|
4
|
+
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").PlaceOrderSuccessEvent, import("./checkout/actors").PlaceOrderDataInput>, {
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
type: string;
|
|
7
|
+
}, import("xstate").EventObject> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>, {
|
|
5
8
|
[k: string]: unknown;
|
|
6
9
|
type: string;
|
|
7
10
|
}, import("xstate").EventObject> | undefined;
|
|
8
|
-
}, {
|
|
9
|
-
src: "submitStepData";
|
|
10
|
-
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
11
|
-
id: string | undefined;
|
|
12
11
|
}, import("xstate").Values<{
|
|
12
|
+
placeOrder: {
|
|
13
|
+
src: "placeOrder";
|
|
14
|
+
logic: import("xstate").PromiseActorLogic<import("./checkout/types").PlaceOrderSuccessEvent, import("./checkout/actors").PlaceOrderDataInput>;
|
|
15
|
+
id: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
submitStepData: {
|
|
18
|
+
src: "submitStepData";
|
|
19
|
+
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
20
|
+
id: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
}>, import("xstate").Values<{
|
|
13
23
|
changeStep: {
|
|
14
24
|
type: "changeStep";
|
|
15
25
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -18,21 +28,36 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
18
28
|
type: "nextStep";
|
|
19
29
|
params: import("xstate").NonReducibleUnknown;
|
|
20
30
|
};
|
|
31
|
+
resetCheckout: {
|
|
32
|
+
type: "resetCheckout";
|
|
33
|
+
params: import("xstate").NonReducibleUnknown;
|
|
34
|
+
};
|
|
21
35
|
updateQuote: {
|
|
22
36
|
type: "updateQuote";
|
|
23
37
|
params: import("xstate").NonReducibleUnknown;
|
|
24
38
|
};
|
|
39
|
+
updateSuccessId: {
|
|
40
|
+
type: "updateSuccessId";
|
|
41
|
+
params: import("xstate").NonReducibleUnknown;
|
|
42
|
+
};
|
|
25
43
|
}>, {
|
|
26
44
|
type: "quoteExists";
|
|
27
45
|
params: unknown;
|
|
28
|
-
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep", string, {
|
|
46
|
+
}, never, "uninitialized" | "initializing" | "showStep" | "submittingStepData" | "changingStep" | "placingOrder" | "success", string, {
|
|
29
47
|
initialContext: DeepPartial<CheckoutMachineContext>;
|
|
30
48
|
initialState?: string | undefined;
|
|
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>, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
}, 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<{
|
|
50
|
+
placeOrder: {
|
|
51
|
+
src: "placeOrder";
|
|
52
|
+
logic: import("xstate").PromiseActorLogic<import("./checkout/types").PlaceOrderSuccessEvent, import("./checkout/actors").PlaceOrderDataInput>;
|
|
53
|
+
id: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
submitStepData: {
|
|
56
|
+
src: "submitStepData";
|
|
57
|
+
logic: import("xstate").PromiseActorLogic<import("./checkout/types").SubmitStepDataSuccessEvent, import("./checkout/actors").SubmitStepDataInput>;
|
|
58
|
+
id: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
}>, import("xstate").Values<{
|
|
36
61
|
changeStep: {
|
|
37
62
|
type: "changeStep";
|
|
38
63
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -41,10 +66,18 @@ export declare const checkoutMachine: import("xstate").StateMachine<CheckoutMach
|
|
|
41
66
|
type: "nextStep";
|
|
42
67
|
params: import("xstate").NonReducibleUnknown;
|
|
43
68
|
};
|
|
69
|
+
resetCheckout: {
|
|
70
|
+
type: "resetCheckout";
|
|
71
|
+
params: import("xstate").NonReducibleUnknown;
|
|
72
|
+
};
|
|
44
73
|
updateQuote: {
|
|
45
74
|
type: "updateQuote";
|
|
46
75
|
params: import("xstate").NonReducibleUnknown;
|
|
47
76
|
};
|
|
77
|
+
updateSuccessId: {
|
|
78
|
+
type: "updateSuccessId";
|
|
79
|
+
params: import("xstate").NonReducibleUnknown;
|
|
80
|
+
};
|
|
48
81
|
}>, {
|
|
49
82
|
type: "quoteExists";
|
|
50
83
|
params: unknown;
|
|
@@ -6,6 +6,7 @@ export declare function addItems({ context, event, }: {
|
|
|
6
6
|
quote: {
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
|
+
accessToken: string | null;
|
|
9
10
|
locale: string | null;
|
|
10
11
|
checkoutSteps: import("../types").CheckoutStep[];
|
|
11
12
|
baseCurrency: string | null;
|
|
@@ -72,7 +73,7 @@ export declare function addItems({ context, event, }: {
|
|
|
72
73
|
latestShipDate: Date;
|
|
73
74
|
earliestArrivalDate: Date;
|
|
74
75
|
latestArrivalDate: Date;
|
|
75
|
-
}
|
|
76
|
+
};
|
|
76
77
|
};
|
|
77
78
|
}[];
|
|
78
79
|
totals: {
|
|
@@ -120,6 +121,7 @@ export declare function addItems({ context, event, }: {
|
|
|
120
121
|
};
|
|
121
122
|
} | undefined;
|
|
122
123
|
id?: string | null | undefined;
|
|
124
|
+
accessToken?: string | null | undefined;
|
|
123
125
|
locale?: string | null | undefined;
|
|
124
126
|
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
125
127
|
baseCurrency?: string | null | undefined;
|
|
@@ -186,7 +188,7 @@ export declare function addItems({ context, event, }: {
|
|
|
186
188
|
latestShipDate: Date;
|
|
187
189
|
earliestArrivalDate: Date;
|
|
188
190
|
latestArrivalDate: Date;
|
|
189
|
-
}
|
|
191
|
+
};
|
|
190
192
|
};
|
|
191
193
|
}[] | undefined;
|
|
192
194
|
totals?: {
|
|
@@ -6,6 +6,7 @@ export declare function refresh({ context, event, }: {
|
|
|
6
6
|
quote: {
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
|
+
accessToken: string | null;
|
|
9
10
|
locale: string | null;
|
|
10
11
|
checkoutSteps: import("../types").CheckoutStep[];
|
|
11
12
|
baseCurrency: string | null;
|
|
@@ -72,7 +73,7 @@ export declare function refresh({ context, event, }: {
|
|
|
72
73
|
latestShipDate: Date;
|
|
73
74
|
earliestArrivalDate: Date;
|
|
74
75
|
latestArrivalDate: Date;
|
|
75
|
-
}
|
|
76
|
+
};
|
|
76
77
|
};
|
|
77
78
|
}[];
|
|
78
79
|
totals: {
|
|
@@ -120,6 +121,7 @@ export declare function refresh({ context, event, }: {
|
|
|
120
121
|
};
|
|
121
122
|
} | undefined;
|
|
122
123
|
id?: string | null | undefined;
|
|
124
|
+
accessToken?: string | null | undefined;
|
|
123
125
|
locale?: string | null | undefined;
|
|
124
126
|
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
125
127
|
baseCurrency?: string | null | undefined;
|
|
@@ -186,7 +188,7 @@ export declare function refresh({ context, event, }: {
|
|
|
186
188
|
latestShipDate: Date;
|
|
187
189
|
earliestArrivalDate: Date;
|
|
188
190
|
latestArrivalDate: Date;
|
|
189
|
-
}
|
|
191
|
+
};
|
|
190
192
|
};
|
|
191
193
|
}[] | undefined;
|
|
192
194
|
totals?: {
|
|
@@ -6,6 +6,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
6
6
|
quote: {
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
|
+
accessToken: string | null;
|
|
9
10
|
locale: string | null;
|
|
10
11
|
checkoutSteps: import("../types").CheckoutStep[];
|
|
11
12
|
baseCurrency: string | null;
|
|
@@ -72,7 +73,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
72
73
|
latestShipDate: Date;
|
|
73
74
|
earliestArrivalDate: Date;
|
|
74
75
|
latestArrivalDate: Date;
|
|
75
|
-
}
|
|
76
|
+
};
|
|
76
77
|
};
|
|
77
78
|
}[];
|
|
78
79
|
totals: {
|
|
@@ -120,6 +121,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
120
121
|
};
|
|
121
122
|
} | undefined;
|
|
122
123
|
id?: string | null | undefined;
|
|
124
|
+
accessToken?: string | null | undefined;
|
|
123
125
|
locale?: string | null | undefined;
|
|
124
126
|
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
125
127
|
baseCurrency?: string | null | undefined;
|
|
@@ -186,7 +188,7 @@ export declare function removeItems({ context, event, }: {
|
|
|
186
188
|
latestShipDate: Date;
|
|
187
189
|
earliestArrivalDate: Date;
|
|
188
190
|
latestArrivalDate: Date;
|
|
189
|
-
}
|
|
191
|
+
};
|
|
190
192
|
};
|
|
191
193
|
}[] | undefined;
|
|
192
194
|
totals?: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { QuoteMachineContext, QuoteMachineEvents } from '../types';
|
|
2
|
+
export declare function reset({ context, event, }: {
|
|
3
|
+
context: QuoteMachineContext;
|
|
4
|
+
event: QuoteMachineEvents;
|
|
5
|
+
}): QuoteMachineContext | {
|
|
6
|
+
quote: {
|
|
7
|
+
id: string;
|
|
8
|
+
locale: string;
|
|
9
|
+
baseCurrency: string;
|
|
10
|
+
currencyConversionRate: number;
|
|
11
|
+
dateCreated: null;
|
|
12
|
+
dateLastUpdated: null;
|
|
13
|
+
currency: string;
|
|
14
|
+
items: never[];
|
|
15
|
+
promotions: never[];
|
|
16
|
+
shippingAddresses: {
|
|
17
|
+
available: never[];
|
|
18
|
+
applied: never[];
|
|
19
|
+
};
|
|
20
|
+
paymentMethods: {
|
|
21
|
+
available: never[];
|
|
22
|
+
applied: never[];
|
|
23
|
+
};
|
|
24
|
+
totals: {
|
|
25
|
+
discount: number;
|
|
26
|
+
taxAmount: number;
|
|
27
|
+
shippingAmount: number;
|
|
28
|
+
shippingTaxAmount: number;
|
|
29
|
+
subtotal: number;
|
|
30
|
+
grandTotal: number;
|
|
31
|
+
};
|
|
32
|
+
appliedPriceRules: never[];
|
|
33
|
+
appliedPromotions: never[];
|
|
34
|
+
shippingMethods: never[];
|
|
35
|
+
storeCredit: never[];
|
|
36
|
+
rewards: never[];
|
|
37
|
+
giftCards: never[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default reset;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { QuoteMachineContext, QuoteMachineEvents } from '../types';
|
|
2
|
+
export declare function syncAccessToken({ context, event, }: {
|
|
3
|
+
context: QuoteMachineContext;
|
|
4
|
+
event: QuoteMachineEvents;
|
|
5
|
+
}): QuoteMachineContext | {
|
|
6
|
+
quote: {
|
|
7
|
+
accessToken: string;
|
|
8
|
+
id?: string | null | undefined;
|
|
9
|
+
locale?: string | null | undefined;
|
|
10
|
+
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
11
|
+
baseCurrency?: string | null | undefined;
|
|
12
|
+
currency?: string | null | undefined;
|
|
13
|
+
currencyConversionRate?: number | null | undefined;
|
|
14
|
+
dateCreated?: Date | null | undefined;
|
|
15
|
+
dateLastUpdated?: Date | null | undefined;
|
|
16
|
+
items?: Record<string, any>[] | null | undefined;
|
|
17
|
+
promotions?: Record<string, any>[] | null | undefined;
|
|
18
|
+
shippingAddresses?: {
|
|
19
|
+
available: import("../types").QuoteAddress[];
|
|
20
|
+
applied: {
|
|
21
|
+
availableAddressId?: string | undefined;
|
|
22
|
+
address: import("../types").QuoteAddress;
|
|
23
|
+
itemIds: Record<string, any>[];
|
|
24
|
+
}[];
|
|
25
|
+
} | undefined;
|
|
26
|
+
paymentMethods?: {
|
|
27
|
+
available: import("../types").PaymentMethod[];
|
|
28
|
+
applied: {
|
|
29
|
+
paymentMethod: import("../types").PaymentMethod;
|
|
30
|
+
options: Record<string, any>[];
|
|
31
|
+
amount: number;
|
|
32
|
+
}[];
|
|
33
|
+
} | undefined;
|
|
34
|
+
shipments?: {
|
|
35
|
+
id: string;
|
|
36
|
+
shippingAddress: {
|
|
37
|
+
id: string;
|
|
38
|
+
address: import("../types").QuoteAddress;
|
|
39
|
+
};
|
|
40
|
+
items: Record<string, any>[];
|
|
41
|
+
shippingMethods: {
|
|
42
|
+
available: {
|
|
43
|
+
shippingMethod: {
|
|
44
|
+
id: string;
|
|
45
|
+
code: string;
|
|
46
|
+
name: string;
|
|
47
|
+
carrier: {
|
|
48
|
+
id: string;
|
|
49
|
+
code: string;
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
estimatedTotal: number;
|
|
54
|
+
earliestShipDate: Date;
|
|
55
|
+
latestShipDate: Date;
|
|
56
|
+
earliestArrivalDate: Date;
|
|
57
|
+
latestArrivalDate: Date;
|
|
58
|
+
}[];
|
|
59
|
+
applied: {
|
|
60
|
+
shippingMethod: {
|
|
61
|
+
id: string;
|
|
62
|
+
code: string;
|
|
63
|
+
name: string;
|
|
64
|
+
carrier: {
|
|
65
|
+
id: string;
|
|
66
|
+
code: string;
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
estimatedTotal: number;
|
|
71
|
+
earliestShipDate: Date;
|
|
72
|
+
latestShipDate: Date;
|
|
73
|
+
earliestArrivalDate: Date;
|
|
74
|
+
latestArrivalDate: Date;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}[] | undefined;
|
|
78
|
+
totals?: {
|
|
79
|
+
discount: number;
|
|
80
|
+
taxAmount: number;
|
|
81
|
+
shippingAmount: number;
|
|
82
|
+
shippingTaxAmount: number;
|
|
83
|
+
subtotal: number;
|
|
84
|
+
grandTotal: number;
|
|
85
|
+
} | null | undefined;
|
|
86
|
+
appliedPriceRules?: Record<string, any>[] | null | undefined;
|
|
87
|
+
appliedPromotions?: Record<string, any>[] | null | undefined;
|
|
88
|
+
shippingMethods?: Record<string, any>[] | null | undefined;
|
|
89
|
+
storeCredit?: Record<string, any>[] | null | undefined;
|
|
90
|
+
rewards?: Record<string, any>[] | null | undefined;
|
|
91
|
+
giftCards?: Record<string, any>[] | null | undefined;
|
|
92
|
+
user?: {
|
|
93
|
+
id: string | null;
|
|
94
|
+
email: string | null;
|
|
95
|
+
firstName: string | null;
|
|
96
|
+
lastName: string | null;
|
|
97
|
+
} | null | undefined;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export default syncAccessToken;
|
|
@@ -6,6 +6,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
6
6
|
quote: {
|
|
7
7
|
quote?: Partial<{
|
|
8
8
|
id: string | null;
|
|
9
|
+
accessToken: string | null;
|
|
9
10
|
locale: string | null;
|
|
10
11
|
checkoutSteps: import("../types").CheckoutStep[];
|
|
11
12
|
baseCurrency: string | null;
|
|
@@ -72,7 +73,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
72
73
|
latestShipDate: Date;
|
|
73
74
|
earliestArrivalDate: Date;
|
|
74
75
|
latestArrivalDate: Date;
|
|
75
|
-
}
|
|
76
|
+
};
|
|
76
77
|
};
|
|
77
78
|
}[];
|
|
78
79
|
totals: {
|
|
@@ -120,6 +121,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
120
121
|
};
|
|
121
122
|
} | undefined;
|
|
122
123
|
id?: string | null | undefined;
|
|
124
|
+
accessToken?: string | null | undefined;
|
|
123
125
|
locale?: string | null | undefined;
|
|
124
126
|
checkoutSteps?: import("../types").CheckoutStep[] | undefined;
|
|
125
127
|
baseCurrency?: string | null | undefined;
|
|
@@ -186,7 +188,7 @@ export declare function updateItems({ context, event, }: {
|
|
|
186
188
|
latestShipDate: Date;
|
|
187
189
|
earliestArrivalDate: Date;
|
|
188
190
|
latestArrivalDate: Date;
|
|
189
|
-
}
|
|
191
|
+
};
|
|
190
192
|
};
|
|
191
193
|
}[] | undefined;
|
|
192
194
|
totals?: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddItemsEvent, AddItemsSuccessEvent, QuoteMachineContext } from '../types';
|
|
2
2
|
export type AddItemsInput = {
|
|
3
|
+
accessToken: QuoteMachineContext['quote']['accessToken'];
|
|
3
4
|
endpoint: QuoteMachineContext['endpoints']['client'];
|
|
4
5
|
items: AddItemsEvent['items'];
|
|
5
6
|
document: QuoteMachineContext['graphql']['addItems']['document'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RefreshSuccessEvent, QuoteMachineContext } from '../types';
|
|
2
2
|
export type RefreshInput = {
|
|
3
|
+
accessToken: QuoteMachineContext['quote']['accessToken'];
|
|
3
4
|
endpoint: QuoteMachineContext['endpoints']['client'];
|
|
4
5
|
endpointSsr: QuoteMachineContext['endpoints']['server'];
|
|
5
6
|
quoteId: QuoteMachineContext['quote']['id'];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { RemoveItemsEvent, RemoveItemsSuccessEvent, QuoteMachineContext } from '../types';
|
|
2
2
|
export type RemoveItemsInput = {
|
|
3
|
+
accessToken: QuoteMachineContext['quote']['accessToken'];
|
|
3
4
|
endpoint: QuoteMachineContext['endpoints']['client'];
|
|
4
5
|
items: RemoveItemsEvent['items'];
|
|
6
|
+
document: QuoteMachineContext['graphql']['removeItems']['document'];
|
|
7
|
+
requestHeaders?: QuoteMachineContext['graphql']['removeItems']['requestHeaders'];
|
|
5
8
|
};
|
|
6
9
|
export type RemoveItemsOutput = Partial<{
|
|
7
10
|
quoteRemoveItem: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UpdateItemsEvent, UpdateItemsSuccessEvent, QuoteMachineContext } from '../types';
|
|
2
2
|
export type UpdateItemsInput = {
|
|
3
|
+
accessToken: QuoteMachineContext['quote']['accessToken'];
|
|
3
4
|
endpoint: QuoteMachineContext['endpoints']['client'];
|
|
4
5
|
items: UpdateItemsEvent['items'];
|
|
5
6
|
document: QuoteMachineContext['graphql']['updateItems']['document'];
|
package/quote/quote/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type QuoteAddress = {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
country: {
|
|
9
9
|
code: string;
|
|
10
|
+
name: string;
|
|
10
11
|
};
|
|
11
12
|
firstName: string;
|
|
12
13
|
lastName: string;
|
|
@@ -16,9 +17,15 @@ export type QuoteAddress = {
|
|
|
16
17
|
city: string;
|
|
17
18
|
region: {
|
|
18
19
|
code: string;
|
|
20
|
+
shortCode: string;
|
|
21
|
+
name: string;
|
|
19
22
|
};
|
|
20
23
|
postalCode: string;
|
|
21
24
|
phone?: string;
|
|
25
|
+
availableAddress?: {
|
|
26
|
+
id?: string;
|
|
27
|
+
isDefault?: boolean;
|
|
28
|
+
};
|
|
22
29
|
};
|
|
23
30
|
export type PaymentMethod = {
|
|
24
31
|
id: string;
|
|
@@ -28,6 +35,7 @@ export type PaymentMethod = {
|
|
|
28
35
|
};
|
|
29
36
|
export type CheckoutStep = {
|
|
30
37
|
code: string;
|
|
38
|
+
name: string;
|
|
31
39
|
isAvailable: boolean;
|
|
32
40
|
isComplete: boolean;
|
|
33
41
|
prev?: string;
|
|
@@ -36,6 +44,7 @@ export type CheckoutStep = {
|
|
|
36
44
|
export interface QuoteMachineContext {
|
|
37
45
|
quote: Partial<{
|
|
38
46
|
id: string | null;
|
|
47
|
+
accessToken: string | null;
|
|
39
48
|
locale: string | null;
|
|
40
49
|
checkoutSteps: Array<CheckoutStep>;
|
|
41
50
|
baseCurrency: string | null;
|
|
@@ -86,7 +95,7 @@ export interface QuoteMachineContext {
|
|
|
86
95
|
earliestArrivalDate: Date;
|
|
87
96
|
latestArrivalDate: Date;
|
|
88
97
|
}>;
|
|
89
|
-
applied:
|
|
98
|
+
applied: {
|
|
90
99
|
shippingMethod: {
|
|
91
100
|
id: string;
|
|
92
101
|
code: string;
|
|
@@ -102,7 +111,7 @@ export interface QuoteMachineContext {
|
|
|
102
111
|
latestShipDate: Date;
|
|
103
112
|
earliestArrivalDate: Date;
|
|
104
113
|
latestArrivalDate: Date;
|
|
105
|
-
}
|
|
114
|
+
};
|
|
106
115
|
};
|
|
107
116
|
}>;
|
|
108
117
|
totals: {
|
|
@@ -189,6 +198,12 @@ export interface ClearItemsEvent {
|
|
|
189
198
|
export interface RefreshEvent {
|
|
190
199
|
type: 'REFRESH';
|
|
191
200
|
}
|
|
201
|
+
export interface ResetEvent {
|
|
202
|
+
type: 'RESET';
|
|
203
|
+
data: {
|
|
204
|
+
locale: string;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
192
207
|
export interface ApplyPromotionEvent {
|
|
193
208
|
type: 'APPLY_PROMOTION';
|
|
194
209
|
}
|
|
@@ -244,7 +259,11 @@ export interface RefreshSuccessEvent {
|
|
|
244
259
|
type: 'REFRESH_SUCCESS';
|
|
245
260
|
quote: Partial<QuoteMachineContext>;
|
|
246
261
|
}
|
|
247
|
-
export
|
|
262
|
+
export interface SyncAccessTokenEvent {
|
|
263
|
+
type: 'SYNC_ACCESS_TOKEN';
|
|
264
|
+
accessToken: string;
|
|
265
|
+
}
|
|
266
|
+
export type QuoteMachineEvents = SetQuoteEmptyEvent | SetQuoteActiveEvent | AddItemsEvent | RemoveItemsEvent | UpdateItemsEvent | ClearItemsEvent | RefreshEvent | ResetEvent | ApplyPromotionEvent | RemovePromotionEvent | AddAddressEvent | RemoveAddressEvent | ApplyPaymentMethodEvent | AddRewardEvent | RemoveRewardEvent | AddStoreCreditEvent | RemoveStoreCreditEvent | AddGiftCardEvent | RemoveGiftCardEvent | SyncAccessTokenEvent | DoneActorEvent<AddItemsSuccessEvent> | DoneActorEvent<RemoveItemsSuccessEvent> | DoneActorEvent<UpdateItemsSuccessEvent> | DoneActorEvent<ClearItemsSuccessEvent> | DoneActorEvent<RefreshSuccessEvent>;
|
|
248
267
|
export interface AddItemsEmittedEvent {
|
|
249
268
|
type: 'EMIT_ADD_ITEMS';
|
|
250
269
|
itemsAdded: QuoteMachineContext['quote']['items'];
|
package/quote/quote.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepPartial } from './types';
|
|
2
2
|
import { QuoteMachineContext } from './quote/types';
|
|
3
|
-
export declare const quoteMachine: 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").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("xstate").DoneActorEvent<import("./quote/types").AddItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").UpdateItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RefreshSuccessEvent>, {
|
|
3
|
+
export declare const quoteMachine: 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> | import("xstate").DoneActorEvent<import("./quote/types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").UpdateItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RefreshSuccessEvent>, {
|
|
4
4
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./quote/types").RefreshSuccessEvent, import("./quote/actors").RefreshInput>, {
|
|
5
5
|
[k: string]: unknown;
|
|
6
6
|
type: string;
|
|
@@ -60,6 +60,14 @@ export declare const quoteMachine: import("xstate").StateMachine<QuoteMachineCon
|
|
|
60
60
|
type: "removeItems";
|
|
61
61
|
params: import("xstate").NonReducibleUnknown;
|
|
62
62
|
};
|
|
63
|
+
reset: {
|
|
64
|
+
type: "reset";
|
|
65
|
+
params: import("xstate").NonReducibleUnknown;
|
|
66
|
+
};
|
|
67
|
+
syncAccessToken: {
|
|
68
|
+
type: "syncAccessToken";
|
|
69
|
+
params: import("xstate").NonReducibleUnknown;
|
|
70
|
+
};
|
|
63
71
|
updateItems: {
|
|
64
72
|
type: "updateItems";
|
|
65
73
|
params: import("xstate").NonReducibleUnknown;
|
|
@@ -73,10 +81,10 @@ export declare const quoteMachine: import("xstate").StateMachine<QuoteMachineCon
|
|
|
73
81
|
type: "hasItems";
|
|
74
82
|
params: unknown;
|
|
75
83
|
};
|
|
76
|
-
}>, never, "active" | "refreshing" | "uninitialized" | "initializing" | "empty" | "addingItems" | "updatingItems" | "removingItems" | "checkingItems", string, {
|
|
84
|
+
}>, never, "active" | "refreshing" | "uninitialized" | "initializing" | "empty" | "addingItems" | "updatingItems" | "removingItems" | "resetting" | "checkingItems", string, {
|
|
77
85
|
initialContext: DeepPartial<QuoteMachineContext>;
|
|
78
86
|
initialState?: string | undefined;
|
|
79
|
-
}, import("xstate").NonReducibleUnknown, import("./quote/types").AddItemsEmittedEvent | import("./quote/types").RemoveItemsEmittedEvent | import("./quote/types").UpdateItemsEmittedEvent, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, 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").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("xstate").DoneActorEvent<import("./quote/types").AddItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").UpdateItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RefreshSuccessEvent>, import("xstate").Values<{
|
|
87
|
+
}, import("xstate").NonReducibleUnknown, import("./quote/types").AddItemsEmittedEvent | import("./quote/types").RemoveItemsEmittedEvent | import("./quote/types").UpdateItemsEmittedEvent, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, 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> | import("xstate").DoneActorEvent<import("./quote/types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").UpdateItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./quote/types").RefreshSuccessEvent>, import("xstate").Values<{
|
|
80
88
|
refresh: {
|
|
81
89
|
src: "refresh";
|
|
82
90
|
logic: import("xstate").PromiseActorLogic<import("./quote/types").RefreshSuccessEvent, import("./quote/actors").RefreshInput>;
|
|
@@ -122,6 +130,14 @@ export declare const quoteMachine: import("xstate").StateMachine<QuoteMachineCon
|
|
|
122
130
|
type: "removeItems";
|
|
123
131
|
params: import("xstate").NonReducibleUnknown;
|
|
124
132
|
};
|
|
133
|
+
reset: {
|
|
134
|
+
type: "reset";
|
|
135
|
+
params: import("xstate").NonReducibleUnknown;
|
|
136
|
+
};
|
|
137
|
+
syncAccessToken: {
|
|
138
|
+
type: "syncAccessToken";
|
|
139
|
+
params: import("xstate").NonReducibleUnknown;
|
|
140
|
+
};
|
|
125
141
|
updateItems: {
|
|
126
142
|
type: "updateItems";
|
|
127
143
|
params: import("xstate").NonReducibleUnknown;
|