@salla.sa/twilight 3.0.0-alpha.0 → 3.0.0-beta.1

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.
@@ -8,6 +8,213 @@ export interface Language {
8
8
  country_code: string;
9
9
  }
10
10
 
11
+ type Networks = 'mada' | 'masterCard' | 'visa';
12
+
13
+ export type Apps = {
14
+ appstore?: string;
15
+ googleplay?: string;
16
+ };
17
+
18
+ export type DevelopmentStoreTemplate = {
19
+ price: number;
20
+ price_details: {
21
+ currency: string;
22
+ items: {
23
+ product_price: number;
24
+ price: number;
25
+ quantity: number;
26
+ }[];
27
+ total: number;
28
+ };
29
+ developer?: {
30
+ name: string;
31
+ url?: string;
32
+ };
33
+ };
34
+
35
+ export type StoreSettings = {
36
+ auth: {
37
+ email_allowed: boolean;
38
+ mobile_allowed: boolean;
39
+ is_email_required: boolean;
40
+ countries?: string[];
41
+ force_login?: boolean;
42
+ };
43
+ cart?: {
44
+ apply_coupon_enabled: boolean;
45
+ };
46
+ product?: {
47
+ total_sold_enabled: boolean;
48
+ manual_quantity: boolean;
49
+ fit_type?: string;
50
+ related_products_enabled: boolean;
51
+ filters: {
52
+ category_id?: boolean;
53
+ brand_id?: boolean;
54
+ price?: boolean;
55
+ variants?: boolean;
56
+ rating?: boolean;
57
+ tag_name?: boolean;
58
+ };
59
+ show_comments?: boolean;
60
+ user_can_comment?: boolean;
61
+ show_price_as_dash?: boolean;
62
+ notify_options_availability?: boolean;
63
+ show_special_offers?: boolean;
64
+ show_more?: boolean;
65
+ availability_notify?: {
66
+ email?: boolean;
67
+ mobile?: boolean;
68
+ sms?: boolean;
69
+ whatsapp?: boolean;
70
+ };
71
+ category?: {
72
+ testimonial_enabled?: boolean;
73
+ };
74
+ };
75
+ payments: PaymentName[];
76
+ arabic_numbers_enabled: boolean;
77
+ content_copyright?: boolean;
78
+ use_sar_symbol?: boolean;
79
+ is_multilingual?: boolean;
80
+ currencies_enabled?: boolean;
81
+ rating_enabled?: boolean;
82
+ rating?: {
83
+ is_enabled?: boolean;
84
+ show_on_category?: boolean;
85
+ show_on_product?: boolean;
86
+ can_rate_store?: boolean;
87
+ can_rate_product?: boolean;
88
+ can_rate_shipping?: boolean;
89
+ show_rating_summary?: boolean;
90
+ show_recommendation?: boolean;
91
+ allow_likes?: boolean;
92
+ allow_attach_images?: boolean;
93
+ allow_contact_support?: boolean;
94
+ allow_update?: boolean;
95
+ update_period?: number;
96
+ can_customer_hide_name?: boolean;
97
+ visitor_can_comment?:boolean;
98
+ page_feedback_enabled?:boolean;
99
+ };
100
+ blog?: {
101
+ is_enabled?: boolean;
102
+ allow_likes_and_comments?: boolean;
103
+ };
104
+ is_loyalty_enabled?: boolean;
105
+ keys?: {
106
+ maps?: string;
107
+ gtm?: string[];
108
+ };
109
+ is_salla_gateway?: boolean;
110
+ upload_size?: number;
111
+ tax?: {
112
+ number?: string;
113
+ certificate?: string;
114
+ taxable_prices_enabled?: boolean;
115
+ };
116
+ certificate?: string;
117
+ made_in_ksa?: boolean;
118
+ commercial_number?: string;
119
+ freelance_number?: string;
120
+ buy_now?: {
121
+ networks?: Networks[];
122
+ countries: string[];
123
+ multi_currency: boolean;
124
+ is_digital: boolean;
125
+ };
126
+ installments: Installment[];
127
+ quick_order?: {
128
+ title?: string;
129
+ sub_title?: string;
130
+ thanks_message?: string;
131
+ order_now_button?: string;
132
+ is_email_required?: boolean;
133
+ show_agreement?: boolean;
134
+ style?: 'grey' | 'white' | 'default';
135
+ confirm_button?: string;
136
+ agreement?: string;
137
+ allowed_countries?: string[];
138
+ };
139
+ bullet_delivery?: {
140
+ enabled?: boolean;
141
+ supports_pickup?: boolean;
142
+ supports_delivery?: boolean;
143
+ customer_location?: {
144
+ country?: string;
145
+ city?: string;
146
+ };
147
+ settings?: {
148
+ type?: string;
149
+ is_required?: boolean;
150
+ remember_last_session?: boolean;
151
+ };
152
+ };
153
+ };
154
+
155
+ export type StoreContacts = {
156
+ whatsapp?: string;
157
+ mobile?: string;
158
+ phone?: string;
159
+ email?: string;
160
+ telegram?: string;
161
+ };
162
+
163
+ export type StoreSocial = {
164
+ instagram?: string;
165
+ twitter?: string;
166
+ snapchat?: string;
167
+ tiktok?: string;
168
+ youtube?: string;
169
+ facebook?: string;
170
+ pinterest?: string;
171
+ };
172
+
173
+ export type StoreScope = {
174
+ id: number;
175
+ name: string;
176
+ selected: boolean;
177
+ type: string;
178
+ is_open: boolean;
179
+ display_as?: string;
180
+ languages: string[];
181
+ currencies: string[];
182
+ countries: string[];
183
+ always_ask: boolean;
184
+ allocation?: {
185
+ type: string;
186
+ branch_id: number;
187
+ };
188
+ };
189
+
190
+ export interface StoreConfig {
191
+ id: number;
192
+ url: string;
193
+ logo?: string;
194
+ name?: string;
195
+ username?: string;
196
+ description?: string;
197
+ icon?: string;
198
+ api?: string;
199
+ settings?: StoreSettings;
200
+ meta?: {
201
+ title?: string;
202
+ description?: string;
203
+ keywords?: string;
204
+ };
205
+ contacts?: StoreContacts;
206
+ social?: StoreSocial;
207
+ scope?: StoreScope;
208
+ store_country: string; // TODO: should be replace with country but for backward compatibility, we need to keep it for now.
209
+ country?: string;
210
+ /** Numeric store ray/shard identifier from the API. */
211
+ ray?: number;
212
+ /** Feature flags enabled for this store, e.g. ["guest-checkout", "salla-account"]. */
213
+ features?: string[];
214
+ template?: DevelopmentStoreTemplate;
215
+ apps?: Apps;
216
+ }
217
+
11
218
  type Installment = 'tabby_installment' | 'tamara_installment' | 'spotii_pay';
12
219
  type PaymentName = Installment | 'mada' | 'credit_card' | 'paypal' | 'bank' | 'stc_pay' | 'apple_pay' | 'knet';
13
220
  export type TwilightConfigName = 'maintenance'
@@ -20,6 +227,18 @@ export type TwilightConfigName = 'maintenance'
20
227
  | 'store.id'
21
228
  | 'store.logo'
22
229
  | 'store.name'
230
+ | 'store.username'
231
+ | 'store.description'
232
+ | 'store.icon'
233
+ | 'store.contacts'
234
+ | 'store.social'
235
+ | 'store.scope'
236
+ | 'store.store_country'
237
+ | 'store.country'
238
+ | 'store.ray'
239
+ | 'store.features'
240
+ | 'store.template'
241
+ | 'store.apps'
23
242
  | 'store.api'
24
243
  | 'store.settings'
25
244
  | 'store.settings.auth'
@@ -74,23 +293,7 @@ export interface TwilightConfig {
74
293
  sdk?: {
75
294
  notifier_handler_disabled: boolean
76
295
  },
77
- store: {
78
- url: string;
79
- id: number;
80
- logo?: string;
81
- name?: string;
82
- api?: string;
83
- settings?: {
84
- auth: {
85
- email_allowed: boolean;
86
- mobile_allowed: boolean;
87
- is_email_required: boolean;
88
- };
89
- arabic_numbers_enabled: boolean;
90
- payments: PaymentName[];
91
- installments: Installment[];
92
- };
93
- };
296
+ store: StoreConfig;
94
297
  user?: {
95
298
  type?: 'user' | 'guest';
96
299
  id?: string | number;
@@ -122,4 +325,4 @@ export interface TwilightConfig {
122
325
  slug?: string;
123
326
  id?: number;//available in product.single, customer.orders.single, cart, thank-you, page-single
124
327
  };
125
- }
328
+ }
package/watcher.js CHANGED
@@ -155,7 +155,7 @@ class WatcherPlugin {
155
155
  if (this.files[file]) clearTimeout(this.files[file]);
156
156
  this.files[file] = setTimeout(() => {
157
157
  execSync(
158
- `${this.sallaCli} theme sync -f "${file}" -id ${this.theme_id} -store_id ${this.store_id} -draft_id ${this.draft_id} -upload_url ${this.upload_url}`,
158
+ `"${this.sallaCli}" theme sync -f "${file}" -i "${this.theme_id}" --store_id "${this.store_id}" --draft_id "${this.draft_id}" --upload_url "${this.upload_url}"`,
159
159
  { stdio: "inherit" }
160
160
  );
161
161
  delete this.files[file];