@salla.sa/twilight 1.6.15 → 2.0.0

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 (115) hide show
  1. package/README.md +4 -214
  2. package/components/README.md +55 -0
  3. package/components/dist/cjs/index-9441fd8e.js +1554 -0
  4. package/components/dist/cjs/index.cjs.js +2 -0
  5. package/components/dist/cjs/loader.cjs.js +21 -0
  6. package/components/dist/cjs/salla-login_2.cjs.entry.js +131 -0
  7. package/components/dist/cjs/twilight-components.cjs.js +19 -0
  8. package/components/dist/collection/collection-manifest.json +13 -0
  9. package/components/dist/collection/components/generate-summary.js +35 -0
  10. package/components/dist/collection/components/salla-login/salla-login.css +104 -0
  11. package/components/dist/collection/components/salla-login/salla-login.js +113 -0
  12. package/components/dist/collection/components/search-modal/search-modal.css +9 -0
  13. package/components/dist/collection/components/search-modal/search-modal.js +161 -0
  14. package/components/dist/collection/index.js +1 -0
  15. package/components/dist/collection/interfaces/colors.js +1 -0
  16. package/components/dist/collection/interfaces/index.js +2 -0
  17. package/components/dist/collection/interfaces/ratio.js +1 -0
  18. package/components/dist/collection/plugins/tailwind-theme/index.js +32 -0
  19. package/components/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  20. package/components/dist/collection/utils/utils.js +16 -0
  21. package/components/dist/esm/index-63e5409f.js +1527 -0
  22. package/components/dist/esm/index.js +1 -0
  23. package/components/dist/esm/loader.js +17 -0
  24. package/components/dist/esm/polyfills/core-js.js +11 -0
  25. package/components/dist/esm/polyfills/css-shim.js +1 -0
  26. package/components/dist/esm/polyfills/dom.js +79 -0
  27. package/components/dist/esm/polyfills/es5-html-element.js +1 -0
  28. package/components/dist/esm/polyfills/index.js +34 -0
  29. package/components/dist/esm/polyfills/system.js +6 -0
  30. package/components/dist/esm/salla-login_2.entry.js +126 -0
  31. package/components/dist/esm/twilight-components.js +17 -0
  32. package/components/dist/index.cjs.js +1 -0
  33. package/components/dist/index.js +1 -0
  34. package/components/dist/twilight-components/index.esm.js +0 -0
  35. package/components/dist/twilight-components/p-3d53781c.js +1 -0
  36. package/components/dist/twilight-components/p-fccb89fa.entry.js +1 -0
  37. package/components/dist/twilight-components/twilight-components.esm.js +1 -0
  38. package/components/dist/types/components/salla-login/salla-login.d.ts +14 -0
  39. package/components/dist/types/components/search-modal/search-modal.d.ts +26 -0
  40. package/components/dist/types/components.d.ts +76 -0
  41. package/components/dist/types/index.d.ts +6 -0
  42. package/components/dist/types/interfaces/colors.d.ts +1 -0
  43. package/components/dist/types/interfaces/index.d.ts +2 -0
  44. package/components/dist/types/interfaces/ratio.d.ts +1 -0
  45. package/components/dist/types/stencil-public-runtime.d.ts +1563 -0
  46. package/components/dist/types/utils/utils.d.ts +6 -0
  47. package/components/loader/cdn.js +3 -0
  48. package/components/loader/index.cjs.js +3 -0
  49. package/components/loader/index.d.ts +13 -0
  50. package/components/loader/index.es2017.js +3 -0
  51. package/components/loader/index.js +4 -0
  52. package/components/loader/package.json +10 -0
  53. package/components/package.json +70 -0
  54. package/components/src/plugins/tailwind-theme/index.js +32 -0
  55. package/components/src/plugins/tailwind-theme/package.json +27 -0
  56. package/components/src/plugins/tailwind-theme/readme.md +47 -0
  57. package/components/src/plugins/tailwind-theme/safe-list-css.txt +19 -0
  58. package/components/src/plugins/tailwind-theme/utilities.json +1 -0
  59. package/components.js +1 -0
  60. package/dist/twilight.js +2 -0
  61. package/dist/twilight.js.LICENSE.txt +27 -0
  62. package/package.json +53 -63
  63. package/postInstall.js +2 -0
  64. package/tailwind.js +1 -0
  65. package/tailwind_css_list.js +1 -0
  66. package/watcher.js +20 -62
  67. package/LICENSE.md +0 -674
  68. package/dist/@salla.sa/twilight.min.js +0 -20
  69. package/dist/@salla.sa/twilight.min.js.map +0 -1
  70. package/dist/cjs/index.js +0 -2
  71. package/dist/cjs/index.js.map +0 -1
  72. package/dist/esm/index.js +0 -2
  73. package/dist/esm/index.js.map +0 -1
  74. package/types/actions.d.ts +0 -47
  75. package/types/api/auth/index.d.ts +0 -17
  76. package/types/api/auth/request.d.ts +0 -42
  77. package/types/api/auth/response.d.ts +0 -22
  78. package/types/api/cart/index.d.ts +0 -24
  79. package/types/api/cart/request.d.ts +0 -8
  80. package/types/api/cart/response.d.ts +0 -66
  81. package/types/api/comment.d.ts +0 -18
  82. package/types/api/currency.d.ts +0 -17
  83. package/types/api/document.d.ts +0 -3
  84. package/types/api/index.d.ts +0 -110
  85. package/types/api/loyalty.d.ts +0 -226
  86. package/types/api/order.d.ts +0 -15
  87. package/types/api/product/index.d.ts +0 -17
  88. package/types/api/product/request.d.ts +0 -53
  89. package/types/api/product/response.d.ts +0 -103
  90. package/types/api/profile.d.ts +0 -60
  91. package/types/api/rating.d.ts +0 -49
  92. package/types/api/scope.d.ts +0 -42
  93. package/types/api/wishlist.d.ts +0 -7
  94. package/types/common.d.ts +0 -75
  95. package/types/event/auth.d.ts +0 -18
  96. package/types/event/cart.d.ts +0 -30
  97. package/types/event/comment.d.ts +0 -7
  98. package/types/event/currency.d.ts +0 -9
  99. package/types/event/document.d.ts +0 -29
  100. package/types/event/index.d.ts +0 -48
  101. package/types/event/infiniteScroll.d.ts +0 -12
  102. package/types/event/loyalty.d.ts +0 -14
  103. package/types/event/order.d.ts +0 -11
  104. package/types/event/product.d.ts +0 -30
  105. package/types/event/profile.d.ts +0 -19
  106. package/types/event/rating.d.ts +0 -13
  107. package/types/event/scope.d.ts +0 -15
  108. package/types/event/wishlist.d.ts +0 -8
  109. package/types/helpers/app-helpers.d.ts +0 -29
  110. package/types/index.d.ts +0 -37
  111. package/types/lib/config.ts +0 -14
  112. package/types/lib/form.d.ts +0 -8
  113. package/types/lib/lang.d.ts +0 -14
  114. package/types/lib/notify.d.ts +0 -14
  115. package/types/tiwlight-config.d.ts +0 -74
@@ -1,42 +0,0 @@
1
- export namespace AuthRequest {
2
- export interface loginByMobile {
3
- phone: string;
4
- type: 'mobile';
5
- country_code: string | 'SA';
6
- }
7
-
8
- export interface loginByEmail {
9
- email: string;
10
- type: 'email';
11
- }
12
-
13
- export interface verifyByEmail {
14
- type: 'email';
15
- code: string;
16
- email: string;
17
- }
18
-
19
- export interface verifyByMobile {
20
- type: 'mobile';
21
- code: string;
22
- phone: string;
23
- country_code: string | "SA";
24
- }
25
-
26
- export interface register {
27
- first_name: string;
28
- last_name: string;
29
- phone: string;
30
- country_code: string | 'SA';
31
- verified_by: 'email' | 'phone';
32
- email?: string;
33
- code: number;
34
- }
35
-
36
- export interface resend {
37
- type: 'mobile' | 'email';
38
- phone?: string;
39
- country_code?: string | "SA";
40
- email?: string;
41
- }
42
- }
@@ -1,22 +0,0 @@
1
- import {SuccessResponse} from "../../common";
2
-
3
- export type VerificationStatus = {
4
- type: 'mobile' | 'email';
5
- status: 'success' | 'pending' | 'failed';
6
- }
7
- export namespace AuthResponse {
8
- export interface verify extends SuccessResponse {
9
- data: {
10
- case: 'authenticated' | 'new_customer';
11
- redirect_url?: string;
12
- token?: string;
13
- verification?: VerificationStatus;
14
- }
15
- }
16
-
17
- export interface loginOrResendCode extends SuccessResponse {
18
- data: {
19
- resend_counter?: 2 | 3 | 4;//when resend code
20
- }
21
- }
22
- }
@@ -1,24 +0,0 @@
1
- export * from "./request";
2
- export * from "./response";
3
- import {SuccessResponse} from "../../common";
4
- import {CartResponse} from "./response";
5
- import {CartRequest} from "./request";
6
-
7
- export default interface CartApi {
8
- latest: () => Promise<CartResponse.update>;
9
- details: () => Promise<CartResponse.update>;
10
- quickAdd: (/*product_id*/id: number) => Promise<CartResponse.update>;
11
- addItem: (data: CartRequest.addItem) => Promise<CartResponse.update>;
12
- deleteItem: (item_id: number) => Promise<CartResponse.update>;
13
- updateItem: (data: CartRequest.addItem) => Promise<CartResponse.update>;
14
- deleteImage: (file_id: number) => Promise<SuccessResponse>;
15
- status: () => Promise<CartResponse.status>;
16
- reset: () => void;
17
- submit: () => void;
18
-
19
- getUploadImageEndpoint: (cartId?: number) => string;
20
-
21
- //coupons
22
- addCoupon: (coupon: string) => Promise<CartResponse.update>;
23
- deleteCoupon: () => Promise<CartResponse.update>;
24
- }
@@ -1,8 +0,0 @@
1
- import ProductPayload from "../product";
2
-
3
- export namespace CartRequest {
4
- export interface addItem extends ProductPayload {
5
- notes?: string;
6
- file?: BinaryType | string;
7
- }
8
- }
@@ -1,66 +0,0 @@
1
- import { SuccessResponse } from "../../common";
2
- export namespace CartResponse {
3
- export interface update extends SuccessResponse {
4
- data: CartUpdatedData;
5
- }
6
-
7
- export interface status extends SuccessResponse {
8
- data: {
9
- active: boolean;
10
- next_step: {
11
- to: 'refresh' | 'login' | 'checkout';
12
- url?: string;
13
- };
14
- }
15
- }
16
- }
17
-
18
-
19
- export interface CartUpdatedData extends Object {
20
- product_id?: number;
21
- offer?: OfferSummary;
22
- googleTags: string;//json string
23
- cart: CartSummary;
24
- }
25
-
26
- export interface itemOffer {
27
- discount: number;
28
- is_free: boolean;
29
- names: string;
30
- }
31
-
32
- export interface CartItem {
33
- id: number;
34
- product_id: number;
35
- product_price: number;
36
- price: number;
37
- total: number;
38
- is_available: true;
39
- offer?: itemOffer;
40
- quantity: number;
41
- total_special_price: number;
42
- special_price: number;
43
- }
44
-
45
- export interface CartSummary {
46
- id: number;
47
- user_id: number | string;
48
- store_id: number;
49
- real_shipping_cost?: number;
50
- free_shipping_bar?: {
51
- minimum_amount: number;
52
- has_free_shipping: boolean;
53
- percent: number | 0 | 100;
54
- remaining: number;
55
- };
56
- sub_total: number;
57
- discount: number;
58
- total: number;
59
- count: number;
60
- items?: CartItem[];
61
- }
62
-
63
- export interface OfferSummary {
64
- id: number;
65
- product_id: number;
66
- }
@@ -1,18 +0,0 @@
1
- import {SuccessResponse} from "../common";
2
-
3
- export interface AddCommentResponse extends SuccessResponse {
4
- data: {
5
- case: 'success' | 'error';
6
- message: string;
7
- }
8
- }
9
-
10
- export interface AddCommentPayload {
11
- id: number;
12
- comment: string;
13
- type: 'product' | 'page';
14
- }
15
-
16
- export default interface CommentApi {
17
- add: (data: AddCommentPayload) => Promise<AddCommentResponse>;
18
- }
@@ -1,17 +0,0 @@
1
- import {Currency, SuccessResponse} from "../common";
2
-
3
- export interface ChangeCurrencyResponse extends SuccessResponse {
4
- data: {
5
- code: 'SAR' | string;
6
- symbol: string;
7
- }
8
- }
9
-
10
- export interface ListCurrenciesResponse extends SuccessResponse {
11
- data: Array<Currency>
12
- }
13
-
14
- export default interface CurrencyApi {
15
- change: (currency_code: 'SAR' | 'USD' | string) => Promise<ChangeCurrencyResponse>;
16
- list: () => Promise<ListCurrenciesResponse>;
17
- }
@@ -1,3 +0,0 @@
1
-
2
- export default interface DocumentApi {
3
- }
@@ -1,110 +0,0 @@
1
- import CartApi from "./cart";
2
- import AuthApi from "./auth";
3
- import OrderApi from "./order";
4
- import RatingApi from "./rating";
5
- import CommentApi from "./comment";
6
- import LoyaltyApi from "./loyalty";
7
- import ProductApi from "./product";
8
- import ProfileApi from "./profile";
9
- import CurrencyApi from "./currency";
10
- import DocumentApi from "./document";
11
- import WishlistApi from "./wishlist";
12
- import ScopeApi from "./scope";
13
- import {ErrorResponse, SuccessResponse} from "@salla.sa/base/types/common";
14
-
15
- export {
16
- CartApi,
17
- AuthApi,
18
- OrderApi,
19
- RatingApi,
20
- CommentApi,
21
- LoyaltyApi,
22
- ProductApi,
23
- ProfileApi,
24
- CurrencyApi,
25
- DocumentApi,
26
- WishlistApi,
27
- ScopeApi,
28
- };
29
- export type ApiActionName =
30
- 'auth.login'
31
- | 'auth.resend'
32
- | 'auth.verify'
33
- | 'auth.register'
34
- | 'auth.logout'
35
- | 'auth.refresh'
36
- | 'cart.latest'
37
- | 'cart.details'
38
- | 'cart.summary'
39
- | 'cart.quickAdd'
40
- | 'cart.addItem'
41
- | 'cart.deleteItem'
42
- | 'cart.updateItem'
43
- | 'cart.deleteImage'
44
- | 'cart.status'
45
- | 'cart.addCoupon'
46
- | 'cart.deleteCoupon'
47
- | 'loyalty.exchange'
48
- | 'loyalty.getProgram'
49
- | 'loyalty.reset'
50
- | 'order.cancel'
51
- | 'order.reOrder'
52
- | 'order.send'
53
- | 'product.getPrice'
54
- | 'product.availabilitySubscribe'
55
- | 'product.purchaseNow'
56
- | 'product.search'
57
- | 'product.categories'
58
- | 'product.offers'
59
- | 'profile.update'
60
- | 'profile.getSizeGuides'
61
- | 'profile.getGiftDetails'
62
- | 'profile.addGiftToCart'
63
- | 'profile.uploadGiftImage'
64
- | 'comment.add'
65
- | 'currency.change'
66
- | 'currency.list'
67
- | 'rating.store'
68
- | 'rating.products'
69
- | 'rating.shipping'
70
- | 'rating.order'
71
- | 'wishlist.add'
72
- | 'wishlist.remove'
73
- | 'scope.get'
74
- | 'scope.change'
75
- | 'scope.getProductAvailability'
76
- | 'withoutNotifier';
77
-
78
- export default interface Api {
79
- cart: CartApi;
80
- auth: AuthApi;
81
- order: OrderApi;
82
- rating: RatingApi;
83
- comment: CommentApi;
84
- loyalty: LoyaltyApi;
85
- product: ProductApi;
86
- profile: ProfileApi;
87
- currency: CurrencyApi;
88
- document: DocumentApi;
89
- wishlist: WishlistApi;
90
- scope: ScopeApi;
91
- withoutNotifier: (callback: Function) => Promise<void>;
92
- getHeaders: () => {
93
- Accept: string | 'application/json, text/plain, */*',
94
- "X-Requested-With": 'XMLHttpRequest',
95
- "S-SOURCE": 'twilight',
96
- "Store-Identifier"?: number,
97
- currency?: string | 'SAR',
98
- "accept-language"?: string | 'ar',
99
- Authorization?: string
100
- }
101
- request(endPoint: string, formData: undefined | object, method: string, options: object): Promise<any>
102
- handleAfterResponseActions(response: SuccessResponse|ErrorResponse|any): void;
103
- fireEventsForResponse(response: SuccessResponse|ErrorResponse|any): void;
104
- showAlert(response: SuccessResponse|ErrorResponse|any): void;
105
- handleErrorResponse(error: object): void;
106
- handleInvalidFields(error: object): void;
107
- errorPromise(data: any): Promise<any>;
108
- successPromise(data: any): Promise<any>;
109
- isFastRequestsAllowed(): boolean;
110
- }
@@ -1,226 +0,0 @@
1
- import { SuccessResponse } from '../common'
2
-
3
-
4
- export interface Loyalty {
5
- id: number;
6
- name: string;
7
- description: string;
8
- image: string;
9
- points_validity_by: null;
10
- points_validity_value: null;
11
- prize_promotion_title: string;
12
- prize_promotion_description: string;
13
- prize_promotion_logo: string;
14
- customer: Customer;
15
- points: Point[];
16
- prizes: Prize[];
17
- }
18
-
19
- export interface Customer {
20
- id: number;
21
- currency: string;
22
- language: string;
23
- first_name: string;
24
- last_name: string;
25
- phone: Phone;
26
- email: string;
27
- avatar: string;
28
- gender: string;
29
- birthday: Date;
30
- loyalty_program_points: number;
31
- }
32
-
33
- export interface Phone {
34
- code: string;
35
- number: number;
36
- country: string;
37
- }
38
-
39
- export interface Point {
40
- id: number;
41
- key: string;
42
- name: string;
43
- description: string;
44
- points: number;
45
- icon: number;
46
- color: number;
47
- is_completed: boolean;
48
- target_url: string;
49
- share_store_url: string;
50
- conditions: Condition[];
51
- }
52
-
53
- export interface Condition {
54
- key: string;
55
- points: number;
56
- condition: null | string;
57
- value?: 'fixed_amount' | 'total_order';
58
- op: string;
59
- }
60
-
61
- export interface Prize {
62
- type: string | 'free_shipping' | 'free_product' | 'coupon';
63
- title: string;
64
- items: Item[];
65
- }
66
-
67
- export interface Item {
68
- id: number;
69
- key: string;
70
- name: string;
71
- description: string;
72
- image: string;
73
- cost_points: number;
74
- coupon_type: null | string;
75
- coupon_amount: string;
76
- coupon_maximum_amount: string;
77
- included_category_ids: number[];
78
- order_minimum_amount: string;
79
- product_id: number | null;
80
- use_product_image: number;
81
- free_shipping_maximum_amount: string;
82
- free_shipping_terms_apply: boolean;
83
- prize_url: string;
84
- }
85
-
86
- /**
87
- * Loyalty exchange Points
88
- */
89
- export interface ExchangePoint {
90
- message: string;
91
- cart: Cart;
92
- }
93
-
94
- export interface Cart {
95
- items: ExchangeItem[];
96
- require_shipping: boolean;
97
- cart_total: CartTotal;
98
- total_before_discount: CartTotal;
99
- coupon: null;
100
- free_shipping: FreeShipping;
101
- loyalty_program: LoyaltyProgram;
102
- }
103
-
104
- export interface CartTotal {
105
- amount: number;
106
- currency: Currency;
107
- }
108
-
109
- export enum Currency {
110
- Sar = "SAR",
111
- }
112
-
113
- export interface FreeShipping {
114
- remaining_to_free_shipping: null;
115
- has_free_shipping: boolean;
116
- }
117
-
118
- export interface ExchangeItem {
119
- id: number;
120
- url: string;
121
- quantity: number;
122
- product_id: number;
123
- notes: null | string;
124
- name: string;
125
- price: CartTotal;
126
- sale_price: CartTotal;
127
- has_special_price: boolean;
128
- regular_price: CartTotal;
129
- image: string;
130
- type: string;
131
- hide_quantity: boolean;
132
- features: Features;
133
- discount_details: DiscountDetails | null;
134
- max_items_per_user: number;
135
- active_advance: boolean;
136
- weight_label: string;
137
- uploaded_files: any[];
138
- options: Option[];
139
- selected_options: SelectedOption[];
140
- skus: any[];
141
- }
142
-
143
- export interface DiscountDetails {
144
- discount: number;
145
- item_total_price: CartTotal;
146
- offer_type: null;
147
- has_free_items: boolean;
148
- offer_items_count: number;
149
- special_price: CartTotal;
150
- is_free: boolean;
151
- name: string;
152
- }
153
-
154
- export interface Features {
155
- upload_file: boolean;
156
- note: boolean;
157
- }
158
-
159
- export interface Option {
160
- id: number;
161
- name: string;
162
- description: string;
163
- type: string;
164
- required: boolean;
165
- associated_with_order_time: number;
166
- availability_range: boolean;
167
- not_same_day_order: boolean;
168
- choose_date_time: null;
169
- from_date_time: null;
170
- to_date_time: null;
171
- sort: number;
172
- advance: boolean;
173
- display_type: null;
174
- visibility: string;
175
- translations: Object;
176
- values: ValueElement[];
177
- }
178
-
179
- export interface ValueElement {
180
- id: number;
181
- name: string;
182
- price: CartTotal;
183
- display_value: null;
184
- advance: boolean;
185
- option_id: number;
186
- image_url: null;
187
- hashed_display_value: null;
188
- translations: Object;
189
- }
190
-
191
- export interface SelectedOption {
192
- id: number;
193
- value: string[] | number;
194
- }
195
-
196
- export interface LoyaltyProgram {
197
- points: number;
198
- prize: ExchangePrize;
199
- }
200
-
201
- export interface ExchangePrize {
202
- id: number;
203
- name: string;
204
- discount_amount: number;
205
- points: number;
206
- }
207
-
208
-
209
- export namespace LoyaltyApiResponse {
210
-
211
- export interface program extends SuccessResponse {
212
- data: Loyalty
213
- }
214
-
215
-
216
- export interface point extends SuccessResponse {
217
- data: ExchangePoint
218
- }
219
- }
220
-
221
-
222
- export default interface LoyaltyApi {
223
- getProgram: () => Promise<LoyaltyApiResponse.program>
224
- exchange: (prize_id: number, cart_id?: number) => Promise<LoyaltyApiResponse.point>
225
- reset: () => Promise<SuccessResponse>
226
- }
@@ -1,15 +0,0 @@
1
- import {SuccessResponse} from "../common";
2
-
3
- export interface CreateCartFromOrderResponse extends SuccessResponse {
4
- data: {
5
- cart_id: number;
6
- url: string;
7
- };
8
- }
9
-
10
- export default interface OrderApi {
11
- createCartFromOrder: (order_id?: number) => Promise<CreateCartFromOrderResponse>;
12
- cancel: (order_id?: number) => Promise<SuccessResponse>;
13
- sendInvoice: (order_id?: number) => Promise<SuccessResponse>;
14
- show: (payload: { order_id: number, url: string }) => Promise<void>; //should be called from thank you page to trigger native order details page in apps
15
- }
@@ -1,17 +0,0 @@
1
- import { SuccessResponse } from "../../common";
2
- import { ProductResponse } from "./response";
3
- import { ProductRequest } from "./request";
4
-
5
- export * from "./request";
6
- export * from "./response";
7
-
8
- export default interface ProductApi {
9
- getPrice: (data: /*product_id*/number | ProductRequest.addItem) => Promise<ProductResponse.getPrice>;
10
- availabilitySubscribe: (product_id: number | ProductRequest.availability) => Promise<SuccessResponse>;
11
- search: (keyword: string | ProductRequest.search) => Promise<ProductResponse.search>;
12
- categories: (categoryId?: number) => Promise<ProductResponse.categories>; //get all categories or sub_categories
13
- offers: (product_id: number) => Promise<ProductResponse.offers>; //get all categories or sub_categories
14
- getGiftDetails: (product_id: number) => Promise<ProductResponse.giftResponse>;
15
- addGiftToCart: (product_id: number, payload: Object, withRedirect: boolean) => Promise<ProductResponse.giftToCart>;
16
- uploadGiftImage: (multiPartData: FormData) => Promise<ProductResponse.giftImageUpload>;
17
- }
@@ -1,53 +0,0 @@
1
- export interface Category {
2
- id: string;
3
- id_: number;
4
- name: string;
5
- url: string;
6
- sub_categories: Category[];
7
- }
8
-
9
- export type ProductOption = { [key: number]: number | string | number[] };
10
-
11
-
12
- export interface Receiver {
13
- name: string;
14
- country_code: string;
15
- mobile: string;
16
- }
17
-
18
-
19
- export namespace ProductRequest {
20
- export interface addItem {
21
- id: number;
22
- quantity: 1 | number;
23
- options?: ProductOption;
24
- }
25
-
26
- export interface search {
27
- query: string;
28
- type?: 'keyword' | 'tag';//default => 'keyword'
29
- sort_by?: 'ourSuggest' | 'default' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop'; //default => 'ourSuggest'
30
- per_page?: 32 | number;//max 50
31
- brands?: number[];
32
- categories?: number[];// max 5 ids
33
- branches?: number[];// max 5 ids
34
- }
35
-
36
- export interface availability {
37
- id: number;
38
- //💡 Following properties required for guests
39
- email?: string;//required when request without mobile
40
- country_code?: string | 'SA';//required when request without email
41
- phone?: string | '555555555';//required when request without email
42
- }
43
-
44
- export interface giftToCart {
45
- text: string;
46
- sender_name: string;
47
- receiver: Receiver;
48
- quantity: number;
49
- deliver_at: string;
50
- image_url: string;
51
- time_zone: string;
52
- }
53
- }