@clicktap/state 0.13.19 → 0.14.1

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 (54) hide show
  1. package/auth/AuthProvider.d.ts +88 -184
  2. package/auth/actions/addError.d.ts +8 -0
  3. package/auth/actions/clearErrors.d.ts +5 -0
  4. package/auth/actions/index.d.ts +7 -0
  5. package/auth/actions/setAccessToken.d.ts +9 -0
  6. package/auth/actions/setIgnoreRefreshToken.d.ts +4 -0
  7. package/auth/actions/setUserContext.d.ts +9 -0
  8. package/auth/actions/unsetRefreshToken.d.ts +4 -0
  9. package/auth/actions/unsetUserContext.d.ts +8 -0
  10. package/auth/actors/authenticate.d.ts +16 -0
  11. package/auth/actors/index.d.ts +3 -0
  12. package/auth/actors/refreshAccessToken.d.ts +18 -0
  13. package/auth/actors/unauthenticate.d.ts +14 -0
  14. package/auth/auth.d.ts +45 -130
  15. package/auth/types.d.ts +42 -0
  16. package/helpers/request.d.ts +2 -0
  17. package/index.d.ts +2 -0
  18. package/index.js +33 -33
  19. package/index.mjs +1479 -1210
  20. package/package.json +2 -3
  21. package/quote/CheckoutProvider.d.ts +117 -0
  22. package/quote/QuoteProvider.d.ts +98 -97
  23. package/quote/checkout/actions/index.d.ts +1 -0
  24. package/quote/checkout/actions/nextStep.d.ts +8 -0
  25. package/quote/checkout/actors/index.d.ts +1 -0
  26. package/quote/checkout/actors/submitStepData.d.ts +19 -0
  27. package/quote/checkout/guards/index.d.ts +1 -0
  28. package/quote/checkout/guards/quoteExists.d.ts +10 -0
  29. package/quote/checkout/types.d.ts +36 -0
  30. package/quote/checkout.d.ts +32 -0
  31. package/quote/quote/actions/addItems.d.ts +211 -0
  32. package/quote/quote/actions/refresh.d.ts +210 -0
  33. package/quote/quote/actions/removeItems.d.ts +211 -0
  34. package/quote/quote/actions/updateItems.d.ts +211 -0
  35. package/quote/quote/types.d.ts +263 -0
  36. package/quote/quote.d.ts +34 -33
  37. package/quote/types.d.ts +1 -180
  38. package/toast/ToastProvider.d.ts +5 -81
  39. package/quote/actions/addItems.d.ts +0 -91
  40. package/quote/actions/refresh.d.ts +0 -90
  41. package/quote/actions/removeItems.d.ts +0 -91
  42. package/quote/actions/updateItems.d.ts +0 -91
  43. /package/quote/{actions → quote/actions}/index.d.ts +0 -0
  44. /package/quote/{actions → quote/actions}/notifyAddItems.d.ts +0 -0
  45. /package/quote/{actions → quote/actions}/notifyRemoveItems.d.ts +0 -0
  46. /package/quote/{actions → quote/actions}/notifyUpdateItems.d.ts +0 -0
  47. /package/quote/{actors → quote/actors}/addItems.d.ts +0 -0
  48. /package/quote/{actors → quote/actors}/index.d.ts +0 -0
  49. /package/quote/{actors → quote/actors}/refresh.d.ts +0 -0
  50. /package/quote/{actors → quote/actors}/removeItems.d.ts +0 -0
  51. /package/quote/{actors → quote/actors}/updateItems.d.ts +0 -0
  52. /package/quote/{guards → quote/guards}/canRefresh.d.ts +0 -0
  53. /package/quote/{guards → quote/guards}/hasItems.d.ts +0 -0
  54. /package/quote/{guards → quote/guards}/index.d.ts +0 -0
@@ -0,0 +1,211 @@
1
+ import { QuoteMachineContext, QuoteMachineEvents } from '../types';
2
+ export declare function removeItems({ context, event, }: {
3
+ context: QuoteMachineContext;
4
+ event: QuoteMachineEvents;
5
+ }): QuoteMachineContext | {
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("../types").QuoteAddress[];
19
+ applied: (import("../types").QuoteAddress & {
20
+ availableAddressId?: string | undefined;
21
+ itemIds: Record<string, any>[];
22
+ })[];
23
+ };
24
+ paymentMethods: {
25
+ available: import("../types").PaymentMethod[];
26
+ applied: {
27
+ paymentMethod: import("../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("../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("../types").QuoteAddress[];
131
+ applied: (import("../types").QuoteAddress & {
132
+ availableAddressId?: string | undefined;
133
+ itemIds: Record<string, any>[];
134
+ })[];
135
+ } | undefined;
136
+ paymentMethods?: {
137
+ available: import("../types").PaymentMethod[];
138
+ applied: {
139
+ paymentMethod: import("../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("../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
+ itemsRemoved: Record<string, any>[] | null | undefined;
210
+ };
211
+ export default removeItems;
@@ -0,0 +1,211 @@
1
+ import { QuoteMachineContext, QuoteMachineEvents } from '../types';
2
+ export declare function updateItems({ context, event, }: {
3
+ context: QuoteMachineContext;
4
+ event: QuoteMachineEvents;
5
+ }): QuoteMachineContext | {
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("../types").QuoteAddress[];
19
+ applied: (import("../types").QuoteAddress & {
20
+ availableAddressId?: string | undefined;
21
+ itemIds: Record<string, any>[];
22
+ })[];
23
+ };
24
+ paymentMethods: {
25
+ available: import("../types").PaymentMethod[];
26
+ applied: {
27
+ paymentMethod: import("../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("../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("../types").QuoteAddress[];
131
+ applied: (import("../types").QuoteAddress & {
132
+ availableAddressId?: string | undefined;
133
+ itemIds: Record<string, any>[];
134
+ })[];
135
+ } | undefined;
136
+ paymentMethods?: {
137
+ available: import("../types").PaymentMethod[];
138
+ applied: {
139
+ paymentMethod: import("../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("../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
+ itemsUpdated: Record<string, any>[] | null | undefined;
210
+ };
211
+ export default updateItems;
@@ -0,0 +1,263 @@
1
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
2
+ import { RequestDocument } from 'graphql-request';
3
+ import { GraphQLClientRequestHeaders } from 'graphql-request/build/esm/types';
4
+ import { DoneActorEvent } from 'xstate';
5
+ /** @todo how do we want to handle quote items? */
6
+ export type QuoteAddress = {
7
+ id?: string;
8
+ country: {
9
+ code: string;
10
+ };
11
+ firstName: string;
12
+ lastName: string;
13
+ company?: string;
14
+ addressLine1: string;
15
+ addressLine2?: string;
16
+ city: string;
17
+ region: {
18
+ code: string;
19
+ };
20
+ postalCode: string;
21
+ phone?: string;
22
+ };
23
+ export type PaymentMethod = {
24
+ id: string;
25
+ code: string;
26
+ name: string;
27
+ sortOrder: number;
28
+ };
29
+ export interface QuoteMachineContext {
30
+ quote: Partial<{
31
+ id: string | null;
32
+ locale: string | null;
33
+ baseCurrency: string | null;
34
+ currency: string | null;
35
+ currencyConversionRate: number | null;
36
+ dateCreated: Date | null;
37
+ dateLastUpdated: Date | null;
38
+ items: Array<Record<string, any>> | null;
39
+ promotions: Array<Record<string, any>> | null;
40
+ shippingAddresses: {
41
+ available: Array<QuoteAddress>;
42
+ applied: Array<QuoteAddress & {
43
+ availableAddressId?: string;
44
+ itemIds: Array<Record<string, any>>;
45
+ }>;
46
+ };
47
+ paymentMethods: {
48
+ available: Array<PaymentMethod>;
49
+ applied: Array<{
50
+ paymentMethod: PaymentMethod;
51
+ options: Array<Record<string, any>>;
52
+ amount: number;
53
+ }>;
54
+ };
55
+ shipments: Array<{
56
+ id: string;
57
+ shippingAddress: {
58
+ id: string;
59
+ address: QuoteAddress;
60
+ };
61
+ items: Array<Record<string, any>>;
62
+ shippingMethods: {
63
+ available: Array<{
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
+ applied: Array<{
81
+ shippingMethod: {
82
+ id: string;
83
+ code: string;
84
+ name: string;
85
+ carrier: {
86
+ id: string;
87
+ code: string;
88
+ name: string;
89
+ };
90
+ };
91
+ estimatedTotal: number;
92
+ earliestShipDate: Date;
93
+ latestShipDate: Date;
94
+ earliestArrivalDate: Date;
95
+ latestArrivalDate: Date;
96
+ }>;
97
+ };
98
+ }>;
99
+ totals: {
100
+ discount: number;
101
+ tax: number;
102
+ shipping: number;
103
+ shippingTax: number;
104
+ subtotal: number;
105
+ grandTotal: number;
106
+ } | null;
107
+ appliedPriceRules: Array<Record<string, any>> | null;
108
+ appliedPromotions: Array<Record<string, any>> | null;
109
+ shippingMethods: Array<Record<string, any>> | null;
110
+ storeCredit: Array<Record<string, any>> | null;
111
+ rewards: Array<Record<string, any>> | null;
112
+ giftCards: Array<Record<string, any>> | null;
113
+ user: {
114
+ id: string | null;
115
+ email: string | null;
116
+ firstName: string | null;
117
+ lastName: string | null;
118
+ } | null;
119
+ }>;
120
+ errors: Array<string>;
121
+ endpoints: {
122
+ client?: string;
123
+ server?: string;
124
+ };
125
+ graphql: {
126
+ refresh: {
127
+ document: RequestDocument | TypedDocumentNode<unknown, {}>;
128
+ requestHeaders?: GraphQLClientRequestHeaders | undefined;
129
+ };
130
+ addItems: {
131
+ document: RequestDocument | TypedDocumentNode<unknown, {}>;
132
+ requestHeaders?: GraphQLClientRequestHeaders | undefined;
133
+ };
134
+ removeItems: {
135
+ document: RequestDocument | TypedDocumentNode<unknown, {}>;
136
+ requestHeaders?: GraphQLClientRequestHeaders | undefined;
137
+ };
138
+ updateItems: {
139
+ document: RequestDocument | TypedDocumentNode<unknown, {}>;
140
+ requestHeaders?: GraphQLClientRequestHeaders | undefined;
141
+ };
142
+ };
143
+ }
144
+ export interface SetEmptyEvent {
145
+ type: 'SET_EMPTY';
146
+ }
147
+ export interface SetActiveEvent {
148
+ type: 'SET_ACTIVE';
149
+ }
150
+ export interface AddItemsEvent {
151
+ type: 'ADD_ITEMS';
152
+ items: Array<{
153
+ product: {
154
+ sku: string;
155
+ };
156
+ quantity: number;
157
+ }>;
158
+ }
159
+ export interface RemoveItemsEvent {
160
+ type: 'REMOVE_ITEMS';
161
+ items: Array<{
162
+ product: {
163
+ sku: string;
164
+ };
165
+ quantity: number;
166
+ }>;
167
+ }
168
+ export interface UpdateItemsEvent {
169
+ type: 'UPDATE_ITEMS';
170
+ items: Array<{
171
+ item: {
172
+ id: string;
173
+ };
174
+ quantity: number;
175
+ }>;
176
+ }
177
+ export interface ClearItemsEvent {
178
+ type: 'CLEAR_ITEMS';
179
+ }
180
+ export interface RefreshEvent {
181
+ type: 'REFRESH';
182
+ }
183
+ export interface ApplyPromotionEvent {
184
+ type: 'APPLY_PROMOTION';
185
+ }
186
+ export interface RemovePromotionEvent {
187
+ type: 'REMOVE_PROMOTION';
188
+ }
189
+ export interface AddAddressEvent {
190
+ type: 'ADD_ADDRESS';
191
+ }
192
+ export interface RemoveAddressEvent {
193
+ type: 'REMOVE_ADDRESS';
194
+ }
195
+ export interface ApplyPaymentMethodEvent {
196
+ type: 'APPLY_PAYMENT_METHOD';
197
+ }
198
+ export interface AddRewardEvent {
199
+ type: 'ADD_REWARD';
200
+ }
201
+ export interface RemoveRewardEvent {
202
+ type: 'REMOVE_REWARD';
203
+ }
204
+ export interface AddStoreCreditEvent {
205
+ type: 'ADD_STORE_CREDIT';
206
+ }
207
+ export interface RemoveStoreCreditEvent {
208
+ type: 'REMOVE_STORE_CREDIT';
209
+ }
210
+ export interface AddGiftCardEvent {
211
+ type: 'ADD_GIFT_CARD';
212
+ }
213
+ export interface RemoveGiftCardEvent {
214
+ type: 'REMOVE_GIFT_CARD';
215
+ }
216
+ export interface AddItemsSuccessEvent {
217
+ type: 'ADD_ITEMS_SUCCESS';
218
+ quote: Partial<QuoteMachineContext>;
219
+ itemsAdded: QuoteMachineContext['quote']['items'];
220
+ }
221
+ export interface RemoveItemsSuccessEvent {
222
+ type: 'REMOVE_ITEMS_SUCCESS';
223
+ quote: Partial<QuoteMachineContext>;
224
+ itemsRemoved: QuoteMachineContext['quote']['items'];
225
+ }
226
+ export interface UpdateItemsSuccessEvent {
227
+ type: 'UPDATE_ITEMS_SUCCESS';
228
+ quote: Partial<QuoteMachineContext>;
229
+ itemsUpdated: QuoteMachineContext['quote']['items'];
230
+ }
231
+ export interface ClearItemsSuccessEvent {
232
+ type: 'CLEAR_ITEMS_SUCCESS';
233
+ }
234
+ export interface RefreshSuccessEvent {
235
+ type: 'REFRESH_SUCCESS';
236
+ quote: Partial<QuoteMachineContext>;
237
+ }
238
+ export type QuoteMachineEvents = SetEmptyEvent | SetActiveEvent | AddItemsEvent | RemoveItemsEvent | UpdateItemsEvent | ClearItemsEvent | RefreshEvent | ApplyPromotionEvent | RemovePromotionEvent | AddAddressEvent | RemoveAddressEvent | ApplyPaymentMethodEvent | AddRewardEvent | RemoveRewardEvent | AddStoreCreditEvent | RemoveStoreCreditEvent | AddGiftCardEvent | RemoveGiftCardEvent | DoneActorEvent<AddItemsSuccessEvent> | DoneActorEvent<RemoveItemsSuccessEvent> | DoneActorEvent<UpdateItemsSuccessEvent> | DoneActorEvent<ClearItemsSuccessEvent> | DoneActorEvent<RefreshSuccessEvent>;
239
+ export interface AddItemsEmittedEvent {
240
+ type: 'EMIT_ADD_ITEMS';
241
+ itemsAdded: QuoteMachineContext['quote']['items'];
242
+ }
243
+ export interface RemoveItemsEmittedEvent {
244
+ type: 'EMIT_REMOVE_ITEMS';
245
+ itemsRemoved: QuoteMachineContext['quote']['items'];
246
+ }
247
+ export interface UpdateItemsEmittedEvent {
248
+ type: 'EMIT_UPDATE_ITEMS';
249
+ itemsUpdated: QuoteMachineContext['quote']['items'];
250
+ }
251
+ export type QuoteMachineEmittedEvents = AddItemsEmittedEvent | RemoveItemsEmittedEvent | UpdateItemsEmittedEvent;
252
+ export type AddItemsResponse = {
253
+ message?: string;
254
+ success: boolean;
255
+ };
256
+ export type RemoveItemsResponse = {
257
+ message?: string;
258
+ success: boolean;
259
+ };
260
+ export type RefreshResponse = {
261
+ message?: string;
262
+ success: boolean;
263
+ };