@salla.sa/twilight 2.10.1 → 2.10.4
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/@salla.sa/twilight.min.js +3 -3
- package/dist/@salla.sa/twilight.min.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/types/api/cart/index.d.ts +2 -2
- package/types/api/cart/response.d.ts +8 -0
- package/types/api/index.d.ts +12 -5
- package/types/api/product/response.d.ts +178 -3
- package/types/event/cart.d.ts +7 -4
- package/types/event/loyalty.d.ts +2 -2
- package/types/event/product.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.4",
|
|
4
4
|
"description": "Salla Theme Toolkit, Webcomponents, Events, Requests, Utils",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
],
|
|
32
32
|
"homepage": "https://salla.dev",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@salla.sa/base": "^2.10.
|
|
35
|
-
"@salla.sa/twilight-tailwind-theme": "^2.10.
|
|
34
|
+
"@salla.sa/base": "^2.10.4",
|
|
35
|
+
"@salla.sa/twilight-tailwind-theme": "^2.10.4",
|
|
36
36
|
"axios": "^0.27.2",
|
|
37
37
|
"infinite-scroll": "^4.0.1",
|
|
38
38
|
"jwt-decode": "^3.1.2",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"webpack": "^4 || ^5"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "89b91e1098184edc112bbb3f9a68be0124f1ffee"
|
|
65
65
|
}
|
|
@@ -18,8 +18,8 @@ export default interface CartApi {
|
|
|
18
18
|
|
|
19
19
|
getUploadImageEndpoint: (cartId?: number) => string;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
getQuickOrderSettings: () => Promise<CartResponse.checkoutSetting>;
|
|
22
|
+
createQuickOrder: (payload: CartRequest.quickCheckoutPayload) => Promise<SuccessResponse>;
|
|
23
23
|
|
|
24
24
|
//coupons
|
|
25
25
|
addCoupon: (coupon: string) => Promise<CartResponse.update>;
|
|
@@ -17,6 +17,10 @@ export namespace CartResponse {
|
|
|
17
17
|
export interface checkoutSetting extends SuccessResponse {
|
|
18
18
|
data: CheckoutSetting
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
export interface PriceQuote extends SuccessResponse {
|
|
22
|
+
data: PriceQuoteResponse
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
|
|
@@ -80,4 +84,8 @@ export interface CheckoutSetting {
|
|
|
80
84
|
style: 'default'|'white'|'gray';
|
|
81
85
|
confirm_button: string;
|
|
82
86
|
agreement: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface PriceQuoteResponse {
|
|
90
|
+
case: 'success' | 'login';
|
|
83
91
|
}
|
package/types/api/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export type ApiActionName =
|
|
|
47
47
|
| 'cart.addCoupon'
|
|
48
48
|
| 'cart.deleteCoupon'
|
|
49
49
|
| 'cart.quickCheckout'
|
|
50
|
-
| 'cart.
|
|
50
|
+
| 'cart.createQuickOrder'
|
|
51
51
|
| 'loyalty.exchange'
|
|
52
52
|
| 'loyalty.getProgram'
|
|
53
53
|
| 'loyalty.reset'
|
|
@@ -60,11 +60,18 @@ export type ApiActionName =
|
|
|
60
60
|
| 'product.search'
|
|
61
61
|
| 'product.categories'
|
|
62
62
|
| 'product.offers'
|
|
63
|
+
| 'product.getDetails'
|
|
64
|
+
| 'product.getSizeGuides'
|
|
65
|
+
| 'product.getGiftDetails'
|
|
66
|
+
| 'product.addGiftToCart'
|
|
67
|
+
| 'product.uploadGiftImage'
|
|
63
68
|
| 'profile.update'
|
|
64
|
-
| 'profile.
|
|
65
|
-
| 'profile.
|
|
66
|
-
| 'profile.
|
|
67
|
-
| 'profile.
|
|
69
|
+
| 'profile.info'
|
|
70
|
+
| 'profile.update'
|
|
71
|
+
| 'profile.updateContacts'
|
|
72
|
+
| 'profile.verify'
|
|
73
|
+
| 'profile.updateSettings'
|
|
74
|
+
| 'profile.delete'
|
|
68
75
|
| 'comment.add'
|
|
69
76
|
| 'currency.change'
|
|
70
77
|
| 'currency.list'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Category as ShortCategory, Product, SuccessResponse} from "../../common";
|
|
2
|
-
import {Category} from "./request";
|
|
1
|
+
import { Category as ShortCategory, Product, SuccessResponse } from "../../common";
|
|
2
|
+
import { Category } from "./request";
|
|
3
3
|
type offerType = 'buy_x_get_y' | 'percentage' | 'fixed_amount';
|
|
4
4
|
type paymentMethod = {
|
|
5
5
|
id: number;
|
|
@@ -40,7 +40,7 @@ export interface Offer {
|
|
|
40
40
|
/**
|
|
41
41
|
* Gifting System
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
export interface Gift {
|
|
44
44
|
quantity: number;
|
|
45
45
|
product: Product;
|
|
46
46
|
sender_name: string;
|
|
@@ -58,6 +58,177 @@ export interface GiftText {
|
|
|
58
58
|
text: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
export interface ProductDetail {
|
|
62
|
+
id: number;
|
|
63
|
+
promotion: Promotion;
|
|
64
|
+
sku: string;
|
|
65
|
+
mpn: null;
|
|
66
|
+
gtin: null;
|
|
67
|
+
type: string;
|
|
68
|
+
name: string;
|
|
69
|
+
short_link_code: string;
|
|
70
|
+
urls: Urls;
|
|
71
|
+
price: PreTaxPrice;
|
|
72
|
+
taxed_price: PreTaxPrice;
|
|
73
|
+
pre_tax_price: PreTaxPrice;
|
|
74
|
+
tax: PreTaxPrice;
|
|
75
|
+
description: string;
|
|
76
|
+
quantity: null;
|
|
77
|
+
status: string;
|
|
78
|
+
is_available: boolean;
|
|
79
|
+
views: null;
|
|
80
|
+
sale_price: PreTaxPrice;
|
|
81
|
+
sale_end: null;
|
|
82
|
+
require_shipping: boolean;
|
|
83
|
+
cost_price: string;
|
|
84
|
+
weight: number;
|
|
85
|
+
weight_type: string;
|
|
86
|
+
weight_label: null;
|
|
87
|
+
with_tax: boolean;
|
|
88
|
+
included_tax: boolean;
|
|
89
|
+
url: string;
|
|
90
|
+
main_image: string;
|
|
91
|
+
images: Image[];
|
|
92
|
+
show_purchase_count: boolean;
|
|
93
|
+
sold_quantity: number;
|
|
94
|
+
sold_quantity_desc: string;
|
|
95
|
+
rating: Rating;
|
|
96
|
+
favorite: null;
|
|
97
|
+
has_special_price: boolean;
|
|
98
|
+
regular_price: PreTaxPrice;
|
|
99
|
+
features: Features;
|
|
100
|
+
max_items_per_user: number;
|
|
101
|
+
maximum_quantity_per_order: null;
|
|
102
|
+
show_in_app: boolean;
|
|
103
|
+
has_size_guide: boolean;
|
|
104
|
+
notify_quantity: null;
|
|
105
|
+
hide_quantity: boolean;
|
|
106
|
+
unlimited_quantity: boolean;
|
|
107
|
+
managed_by_branches: boolean;
|
|
108
|
+
services_blocks: ServicesBlocks;
|
|
109
|
+
calories: null;
|
|
110
|
+
customized_sku_quantity: boolean;
|
|
111
|
+
options: Option[];
|
|
112
|
+
skus: Skus[];
|
|
113
|
+
tags: any[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface Features {
|
|
117
|
+
show_you_may_like: boolean;
|
|
118
|
+
show_rating: boolean;
|
|
119
|
+
availability_notify: null;
|
|
120
|
+
show_remaining_quantity: boolean;
|
|
121
|
+
"quick-buy": boolean;
|
|
122
|
+
buy_as_gift: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface Image {
|
|
126
|
+
id: number;
|
|
127
|
+
url: string;
|
|
128
|
+
main: boolean;
|
|
129
|
+
three_d_image_url: string;
|
|
130
|
+
alt: string;
|
|
131
|
+
video_url: string;
|
|
132
|
+
type: string;
|
|
133
|
+
sort: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface Option {
|
|
137
|
+
id: number;
|
|
138
|
+
name: string;
|
|
139
|
+
description: null;
|
|
140
|
+
type: string;
|
|
141
|
+
required: boolean;
|
|
142
|
+
associated_with_order_time: number;
|
|
143
|
+
availability_range: boolean;
|
|
144
|
+
not_same_day_order: boolean;
|
|
145
|
+
choose_date_time: null;
|
|
146
|
+
from_date_time: null;
|
|
147
|
+
to_date_time: null;
|
|
148
|
+
sort: null;
|
|
149
|
+
advance: boolean;
|
|
150
|
+
display_type: string;
|
|
151
|
+
visibility: string;
|
|
152
|
+
translations: OptionTranslations;
|
|
153
|
+
values: Value[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface OptionTranslations {
|
|
157
|
+
ar: PurpleAr;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface PurpleAr {
|
|
161
|
+
option_name: string;
|
|
162
|
+
description: null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface Value {
|
|
166
|
+
id: number;
|
|
167
|
+
name: string;
|
|
168
|
+
price: PreTaxPrice;
|
|
169
|
+
display_value: null;
|
|
170
|
+
advance: boolean;
|
|
171
|
+
option_id: number;
|
|
172
|
+
image_url: null;
|
|
173
|
+
hashed_display_value: null;
|
|
174
|
+
translations: ValueTranslations;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface PreTaxPrice {
|
|
178
|
+
amount: number;
|
|
179
|
+
currency: Currency;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export enum Currency {
|
|
183
|
+
Sar = "SAR",
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface ValueTranslations {
|
|
187
|
+
ar: FluffyAr;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface FluffyAr {
|
|
191
|
+
option_details_name: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface Promotion {
|
|
195
|
+
title: null;
|
|
196
|
+
sub_title: null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface Rating {
|
|
200
|
+
total: number;
|
|
201
|
+
count: number;
|
|
202
|
+
rate: number;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface ServicesBlocks {
|
|
206
|
+
installments: any[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface Skus {
|
|
210
|
+
id: number;
|
|
211
|
+
price: PreTaxPrice;
|
|
212
|
+
regular_price: PreTaxPrice;
|
|
213
|
+
sale_price: PreTaxPrice;
|
|
214
|
+
stock_quantity: null;
|
|
215
|
+
barcode: null;
|
|
216
|
+
sku: string;
|
|
217
|
+
mpn: null;
|
|
218
|
+
gtin: null;
|
|
219
|
+
related_options: number[];
|
|
220
|
+
related_option_values: number[];
|
|
221
|
+
weight: null;
|
|
222
|
+
weight_type: null;
|
|
223
|
+
weight_label: null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface Urls {
|
|
227
|
+
customer: string;
|
|
228
|
+
admin: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
61
232
|
export namespace ProductResponse {
|
|
62
233
|
export interface search extends SuccessResponse {
|
|
63
234
|
data: Product[];
|
|
@@ -100,4 +271,8 @@ export namespace ProductResponse {
|
|
|
100
271
|
export interface giftImageUpload extends SuccessResponse {
|
|
101
272
|
data: Object | String
|
|
102
273
|
}
|
|
274
|
+
|
|
275
|
+
export interface detail extends SuccessResponse {
|
|
276
|
+
data: ProductDetail
|
|
277
|
+
}
|
|
103
278
|
}
|
package/types/event/cart.d.ts
CHANGED
|
@@ -29,9 +29,12 @@ export default interface CartEvent {
|
|
|
29
29
|
onCouponDeletionFailed: (callback: (error: RequestError, cart_id?: number) => void) => void;
|
|
30
30
|
|
|
31
31
|
// Checkout
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
onQuickOrderSettingFetched: (callback: (response: CartResponse.checkoutSetting) => void) => void;
|
|
33
|
+
onQuickOrderSettingFailed: (callback: (error: ErrorResponse) => void) => void;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
onQuickOrderSucceeded: (callback: () => void) => void;
|
|
36
|
+
onQuickOrderFailed: (callback: (error: RequestError) => void) => void;
|
|
37
|
+
// Price Quote
|
|
38
|
+
onPriceQuoteSucceeded: (callback: (response: CartResponse.PriceQuote) => {}) => void;
|
|
39
|
+
onPriceQuoteFailed: (callback: (error: RequestError) => void) => void;
|
|
37
40
|
}
|
package/types/event/loyalty.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export default interface LoyaltyEvent {
|
|
|
6
6
|
onProgramFetched: (callback: (response: LoyaltyApiResponse.program, prod_id: number) => void) => void;
|
|
7
7
|
onProgramNotFetched: RequestErrorEvent;
|
|
8
8
|
// Point
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
onExchangeSucceeded: (callback: (response: LoyaltyApiResponse.point, prod_id: number) => void) => void;
|
|
10
|
+
onExchangeFailed: RequestErrorEvent;
|
|
11
11
|
// Reset Exchange
|
|
12
12
|
onResetSucceeded: (callback: (response: SuccessResponse) => void) => void;
|
|
13
13
|
onResetFailed: RequestErrorEvent
|
package/types/event/product.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export default interface ProductEvent {
|
|
|
22
22
|
onGiftFetched: (callback: (response: ProductResponse.giftResponse, product_id: number) => void) => void;
|
|
23
23
|
onGiftFetchFailed: RequestErrorEvent;
|
|
24
24
|
|
|
25
|
+
onDetailFetched: (callback: (response: ProductResponse.detail, product_id: number) => void) => void;
|
|
26
|
+
onDetailFetchFailed: RequestErrorEvent;
|
|
27
|
+
|
|
25
28
|
onAddGiftToCartSucceeded: (callback: (response: ProductResponse.giftToCart, product_id: number) => void) => void;
|
|
26
29
|
onAddGiftToCartFailed: RequestErrorEvent;
|
|
27
30
|
|