@salla.sa/twilight 2.0.213 → 2.0.214
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 +12 -9
- package/dist/@salla.sa/twilight.min.js.map +1 -1
- package/dist/cjs/main.js +12 -9
- package/dist/cjs/main.js.map +1 -1
- package/dist/esm/main.js +12 -9
- package/dist/esm/main.js.map +1 -1
- package/package.json +1 -1
- package/types/api/cart.d.ts +27 -8
package/package.json
CHANGED
package/types/api/cart.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// import {CartDetailsResponse} from "./cart/cart-details-response";
|
|
2
2
|
import {Nullable, TwilightResponse} from "../common";
|
|
3
|
+
import {AddCouponResponse} from "./coupon";
|
|
3
4
|
|
|
4
5
|
export interface itemOffer {
|
|
5
6
|
discount: number,
|
|
@@ -21,19 +22,20 @@ export interface CartItem {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface CartSummary {
|
|
25
|
+
id: number,
|
|
26
|
+
user_id: number | string,
|
|
24
27
|
real_shipping_cost: number,
|
|
25
|
-
free_shipping_bar: {
|
|
28
|
+
free_shipping_bar: Nullable<{
|
|
26
29
|
minimum_amount: number,
|
|
27
30
|
has_free_shipping: boolean,
|
|
28
31
|
percent: number | 0 | 100,
|
|
29
32
|
remaining: number
|
|
30
|
-
}
|
|
33
|
+
}>,
|
|
31
34
|
sub_total: number,
|
|
32
35
|
discount: number,
|
|
33
36
|
total: number,
|
|
34
37
|
count: number,
|
|
35
38
|
items: Nullable<CartItem[]>,
|
|
36
|
-
user_id: number | string,
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export interface OfferSummary {
|
|
@@ -42,16 +44,26 @@ export interface OfferSummary {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export interface CartUpdatedData {
|
|
45
|
-
product_id: Nullable<number
|
|
46
|
-
offer: Nullable<OfferSummary
|
|
47
|
-
googleTags: string
|
|
47
|
+
product_id: Nullable<number>;
|
|
48
|
+
offer: Nullable<OfferSummary>;
|
|
49
|
+
googleTags: string;//json string
|
|
48
50
|
cart: CartSummary
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
export interface CartLatestResponse extends TwilightResponse {
|
|
54
|
+
data: {
|
|
55
|
+
cart: {
|
|
56
|
+
id: number;
|
|
57
|
+
user_id: number | string;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
export interface CartUpdateResponse extends TwilightResponse {
|
|
52
63
|
data: CartUpdatedData,
|
|
53
64
|
}
|
|
54
65
|
|
|
66
|
+
|
|
55
67
|
export interface AddToCartResponse extends CartUpdateResponse {
|
|
56
68
|
}
|
|
57
69
|
|
|
@@ -62,7 +74,14 @@ export interface DeleteCartItemResponse extends CartUpdateResponse {
|
|
|
62
74
|
}
|
|
63
75
|
|
|
64
76
|
export default interface CartApi {
|
|
65
|
-
latest: () => Promise<
|
|
66
|
-
|
|
77
|
+
latest: () => Promise<CartLatestResponse>;
|
|
78
|
+
details: () => Promise<CartUpdateResponse>;
|
|
79
|
+
summary: () => Promise<CartUpdateResponse>;
|
|
80
|
+
quickAdd: (product_id: number) => Promise<CartUpdateResponse>;
|
|
81
|
+
addItem: 'cart/{cart}/item/{product}/add',
|
|
82
|
+
deleteItem: 'cart/{cart}/item/{item}',
|
|
83
|
+
updateItem: 'cart/{cart}/item/{item}',
|
|
84
|
+
deleteImage: 'cart/{cart}/image/{image}',
|
|
85
|
+
status: 'cart/{cart}/status',
|
|
67
86
|
// details: () => Promise<CartDetailsResponse>;
|
|
68
87
|
}
|