@ziila/sdk 0.1.281 → 0.1.289
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/dist/src/types.d.ts +50 -2
- package/package.json +1 -1
package/dist/src/types.d.ts
CHANGED
|
@@ -95,6 +95,31 @@ export interface ZiilaConfig {
|
|
|
95
95
|
theme?: Partial<ThemeStyles>;
|
|
96
96
|
widgetUrl?: string;
|
|
97
97
|
}
|
|
98
|
+
export interface CartItemData {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
price: number;
|
|
102
|
+
originalPrice?: number;
|
|
103
|
+
currency?: string;
|
|
104
|
+
qty: number;
|
|
105
|
+
imageUrl?: string;
|
|
106
|
+
attributes?: string[];
|
|
107
|
+
}
|
|
108
|
+
export interface ProductCardData {
|
|
109
|
+
id: string;
|
|
110
|
+
uid: number;
|
|
111
|
+
name: string;
|
|
112
|
+
price: number;
|
|
113
|
+
currency?: string;
|
|
114
|
+
imageUrl?: string;
|
|
115
|
+
discountPercent?: number;
|
|
116
|
+
originalPrice?: number;
|
|
117
|
+
availableQty?: number | null;
|
|
118
|
+
manageStock?: boolean;
|
|
119
|
+
rating?: number;
|
|
120
|
+
reviewCount?: number;
|
|
121
|
+
hasVariants?: boolean;
|
|
122
|
+
}
|
|
98
123
|
export interface AddToCartPayload {
|
|
99
124
|
sku: string;
|
|
100
125
|
/** The sku's new total quantity in the cart — never a delta. */
|
|
@@ -115,8 +140,21 @@ export interface CartUpdatedPayload {
|
|
|
115
140
|
totalItems: number;
|
|
116
141
|
grandTotal: number;
|
|
117
142
|
}
|
|
143
|
+
export interface ViewCartPayload {
|
|
144
|
+
items: CartItemData[];
|
|
145
|
+
}
|
|
146
|
+
export interface ViewItemsListPayload {
|
|
147
|
+
items: ProductCardData[];
|
|
148
|
+
listId: string;
|
|
149
|
+
listName: string;
|
|
150
|
+
}
|
|
118
151
|
export interface ProductViewedPayload {
|
|
119
|
-
|
|
152
|
+
item: ProductCardData;
|
|
153
|
+
}
|
|
154
|
+
export interface SelectItemPayload {
|
|
155
|
+
item: ProductCardData;
|
|
156
|
+
listId: string;
|
|
157
|
+
listName: string;
|
|
120
158
|
}
|
|
121
159
|
export interface SearchPayload {
|
|
122
160
|
query: string;
|
|
@@ -125,13 +163,23 @@ export interface ErrorPayload {
|
|
|
125
163
|
code: string;
|
|
126
164
|
message: string;
|
|
127
165
|
}
|
|
128
|
-
|
|
166
|
+
/** The backend's own values, uppercased; `dialect` is null for English. */
|
|
167
|
+
export interface LanguagePayload {
|
|
168
|
+
language: string;
|
|
169
|
+
dialect: string | null;
|
|
170
|
+
}
|
|
171
|
+
export type ZiilaEvent = 'ready' | 'conversationStarted' | 'languageChanged' | 'addToCart' | 'removeFromCart' | 'cartUpdated' | 'viewCart' | 'viewItemsList' | 'selectItem' | 'productViewed' | 'search' | 'error';
|
|
129
172
|
export type ZiilaCommand = 'clear';
|
|
130
173
|
export interface EventPayloadMap {
|
|
131
174
|
ready: undefined;
|
|
175
|
+
conversationStarted: LanguagePayload;
|
|
176
|
+
languageChanged: LanguagePayload;
|
|
132
177
|
addToCart: AddToCartPayload;
|
|
133
178
|
removeFromCart: RemoveFromCartPayload;
|
|
134
179
|
cartUpdated: CartUpdatedPayload;
|
|
180
|
+
viewCart: ViewCartPayload;
|
|
181
|
+
viewItemsList: ViewItemsListPayload;
|
|
182
|
+
selectItem: SelectItemPayload;
|
|
135
183
|
productViewed: ProductViewedPayload;
|
|
136
184
|
search: SearchPayload;
|
|
137
185
|
error: ErrorPayload;
|