@clicktap/state 0.13.16 → 0.13.17
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 +23 -23
- package/index.mjs +707 -600
- package/package.json +1 -1
- package/quote/QuoteProvider.d.ts +99 -12
- package/quote/actions/addItems.d.ts +4 -0
- package/quote/actions/index.d.ts +2 -0
- package/quote/actions/notifyUpdateItems.d.ts +6 -0
- package/quote/actions/refresh.d.ts +4 -0
- package/quote/actions/removeItems.d.ts +4 -0
- package/quote/actions/updateItems.d.ts +91 -0
- package/quote/actors/index.d.ts +1 -0
- package/quote/actors/updateItems.d.ts +23 -0
- package/quote/quote.d.ts +33 -4
- package/quote/types.d.ts +24 -2
package/quote/types.d.ts
CHANGED
|
@@ -56,6 +56,10 @@ export interface QuoteMachineContext {
|
|
|
56
56
|
document: RequestDocument | TypedDocumentNode<unknown, {}>;
|
|
57
57
|
requestHeaders?: GraphQLClientRequestHeaders | undefined;
|
|
58
58
|
};
|
|
59
|
+
updateItems: {
|
|
60
|
+
document: RequestDocument | TypedDocumentNode<unknown, {}>;
|
|
61
|
+
requestHeaders?: GraphQLClientRequestHeaders | undefined;
|
|
62
|
+
};
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
export interface SetEmptyEvent {
|
|
@@ -82,6 +86,15 @@ export interface RemoveItemsEvent {
|
|
|
82
86
|
quantity: number;
|
|
83
87
|
}>;
|
|
84
88
|
}
|
|
89
|
+
export interface UpdateItemsEvent {
|
|
90
|
+
type: 'UPDATE_ITEMS';
|
|
91
|
+
items: Array<{
|
|
92
|
+
product: {
|
|
93
|
+
sku: string;
|
|
94
|
+
};
|
|
95
|
+
quantity: number;
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
85
98
|
export interface ClearItemsEvent {
|
|
86
99
|
type: 'CLEAR_ITEMS';
|
|
87
100
|
}
|
|
@@ -131,6 +144,11 @@ export interface RemoveItemsSuccessEvent {
|
|
|
131
144
|
quote: Partial<QuoteMachineContext>;
|
|
132
145
|
itemsRemoved: QuoteMachineContext['quote']['items'];
|
|
133
146
|
}
|
|
147
|
+
export interface UpdateItemsSuccessEvent {
|
|
148
|
+
type: 'UPDATE_ITEMS_SUCCESS';
|
|
149
|
+
quote: Partial<QuoteMachineContext>;
|
|
150
|
+
itemsUpdated: QuoteMachineContext['quote']['items'];
|
|
151
|
+
}
|
|
134
152
|
export interface ClearItemsSuccessEvent {
|
|
135
153
|
type: 'CLEAR_ITEMS_SUCCESS';
|
|
136
154
|
}
|
|
@@ -138,7 +156,7 @@ export interface RefreshSuccessEvent {
|
|
|
138
156
|
type: 'REFRESH_SUCCESS';
|
|
139
157
|
quote: Partial<QuoteMachineContext>;
|
|
140
158
|
}
|
|
141
|
-
export type QuoteMachineEvents = SetEmptyEvent | SetActiveEvent | AddItemsEvent | RemoveItemsEvent | ClearItemsEvent | RefreshEvent | ApplyPromotionEvent | RemovePromotionEvent | AddAddressEvent | RemoveAddressEvent | ApplyPaymentMethodEvent | AddRewardEvent | RemoveRewardEvent | AddStoreCreditEvent | RemoveStoreCreditEvent | AddGiftCardEvent | RemoveGiftCardEvent | DoneActorEvent<AddItemsSuccessEvent> | DoneActorEvent<RemoveItemsSuccessEvent> | DoneActorEvent<ClearItemsSuccessEvent> | DoneActorEvent<RefreshSuccessEvent>;
|
|
159
|
+
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>;
|
|
142
160
|
export interface AddItemsEmittedEvent {
|
|
143
161
|
type: 'EMIT_ADD_ITEMS';
|
|
144
162
|
itemsAdded: QuoteMachineContext['quote']['items'];
|
|
@@ -147,7 +165,11 @@ export interface RemoveItemsEmittedEvent {
|
|
|
147
165
|
type: 'EMIT_REMOVE_ITEMS';
|
|
148
166
|
itemsRemoved: QuoteMachineContext['quote']['items'];
|
|
149
167
|
}
|
|
150
|
-
export
|
|
168
|
+
export interface UpdateItemsEmittedEvent {
|
|
169
|
+
type: 'EMIT_UPDATE_ITEMS';
|
|
170
|
+
itemsUpdated: QuoteMachineContext['quote']['items'];
|
|
171
|
+
}
|
|
172
|
+
export type QuoteMachineEmittedEvents = AddItemsEmittedEvent | RemoveItemsEmittedEvent | UpdateItemsEmittedEvent;
|
|
151
173
|
export type AddItemsResponse = {
|
|
152
174
|
message?: string;
|
|
153
175
|
success: boolean;
|