@salla.sa/twilight-components 1.5.11 → 1.5.13

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 (69) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-add-product-button.cjs.entry.js +7 -1
  3. package/dist/cjs/salla-button_24.cjs.entry.js +81 -134
  4. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  5. package/dist/cjs/salla-scopes.cjs.entry.js +12 -17
  6. package/dist/cjs/twilight-components.cjs.js +1 -1
  7. package/dist/collection/assets/svg/star3.svg +1 -1
  8. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +7 -1
  9. package/dist/collection/components/salla-installment/salla-installment.js +1 -1
  10. package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +4 -0
  11. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -8
  12. package/dist/collection/components/salla-login-modal/salla-login-modal.js +25 -41
  13. package/dist/collection/components/salla-loyalty/salla-loyalty.js +12 -31
  14. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +6 -15
  15. package/dist/collection/components/salla-placeholder/salla-placeholder.js +5 -6
  16. package/dist/collection/components/salla-product-availability/salla-product-availability.js +12 -26
  17. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +13 -28
  18. package/dist/collection/components/salla-scopes/salla-scopes.js +14 -25
  19. package/dist/collection/components/salla-search/salla-search.js +5 -6
  20. package/dist/collection/components/salla-social-share/salla-social-share.js +12 -14
  21. package/dist/collection/components/salla-tabs/salla-tab-content.js +4 -4
  22. package/dist/collection/components/salla-tabs/salla-tab-header.js +3 -3
  23. package/dist/collection/components/salla-tabs/salla-tabs.js +3 -3
  24. package/dist/collection/components/salla-verify/salla-verify.js +4 -3
  25. package/dist/components/salla-add-product-button.js +7 -1
  26. package/dist/components/salla-installment.js +1 -1
  27. package/dist/components/salla-localization-modal.js +6 -9
  28. package/dist/components/salla-login-modal.js +20 -36
  29. package/dist/components/salla-loyalty.js +9 -28
  30. package/dist/components/salla-offer-modal.js +6 -15
  31. package/dist/components/salla-placeholder2.js +4 -5
  32. package/dist/components/salla-product-availability2.js +12 -26
  33. package/dist/components/salla-rating-modal.js +7 -22
  34. package/dist/components/salla-scopes.js +13 -24
  35. package/dist/components/salla-search.js +5 -6
  36. package/dist/components/salla-social-share.js +12 -14
  37. package/dist/components/salla-tab-content2.js +2 -2
  38. package/dist/components/salla-tab-header2.js +1 -1
  39. package/dist/components/salla-tabs2.js +3 -3
  40. package/dist/components/salla-verify2.js +4 -3
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/salla-add-product-button.entry.js +7 -1
  43. package/dist/esm/salla-button_24.entry.js +81 -134
  44. package/dist/esm/salla-installment.entry.js +1 -1
  45. package/dist/esm/salla-scopes.entry.js +12 -17
  46. package/dist/esm/twilight-components.js +1 -1
  47. package/dist/twilight-components/p-5fb32395.entry.js +4 -0
  48. package/dist/twilight-components/p-639d5426.entry.js +4 -0
  49. package/dist/twilight-components/{p-b9fe5498.entry.js → p-76cb2574.entry.js} +1 -1
  50. package/dist/twilight-components/p-9e48ca27.entry.js +4 -0
  51. package/dist/twilight-components/twilight-components.esm.js +1 -1
  52. package/dist/types/components/salla-localization-modal/salla-localization-modal.d.ts +1 -2
  53. package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +2 -10
  54. package/dist/types/components/salla-loyalty/salla-loyalty.d.ts +1 -9
  55. package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +1 -4
  56. package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +1 -2
  57. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +1 -8
  58. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +1 -9
  59. package/dist/types/components/salla-scopes/salla-scopes.d.ts +1 -7
  60. package/dist/types/components/salla-search/salla-search.d.ts +1 -2
  61. package/dist/types/components/salla-tabs/interfaces.d.ts +1 -1
  62. package/dist/types/components/salla-tabs/salla-tab-content.d.ts +2 -2
  63. package/dist/types/components/salla-tabs/salla-tab-header.d.ts +1 -1
  64. package/dist/types/components/salla-verify/salla-verify.d.ts +1 -0
  65. package/dist/types/components.d.ts +2 -2
  66. package/package.json +5 -5
  67. package/dist/twilight-components/p-808466f3.entry.js +0 -4
  68. package/dist/twilight-components/p-88f8666d.entry.js +0 -4
  69. package/dist/twilight-components/p-952f6c78.entry.js +0 -4
@@ -7,7 +7,7 @@ import BellRingIcon from '../../assets/svg/bell-ring.svg';
7
7
  export class SallaProductAvailability {
8
8
  constructor() {
9
9
  this.isUser = Helper.isUser();
10
- this.emailPlaceholder = 'your@email.com';
10
+ this.translationLoaded = false;
11
11
  /**
12
12
  * product id that can visitor subscribe to its availability notification
13
13
  */
@@ -51,19 +51,10 @@ export class SallaProductAvailability {
51
51
  e.key == 'Enter' && submitMethod();
52
52
  };
53
53
  salla.lang.onLoaded(() => {
54
- var _a, _b, _c, _d;
55
- // console.log('translations:', salla.lang);
56
- this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
54
+ var _a;
55
+ this.translationLoaded = true;
57
56
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
58
- this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
59
- this.mobileLabel = salla.lang.get('common.elements.mobile');
60
- this.emailLabel = salla.lang.get('common.elements.email');
61
- this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder') || 'your@email.com';
62
- this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
63
57
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
64
- (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('common.elements.submit'));
65
- (_c = this.cancelBtn) === null || _c === void 0 ? void 0 : _c.setText(salla.lang.get('common.elements.cancel'));
66
- (_d = this.inlineBtn) === null || _d === void 0 ? void 0 : _d.setText(salla.lang.get('pages.products.notify_availability'));
67
58
  });
68
59
  if (this.isUser)
69
60
  return;
@@ -81,7 +72,7 @@ export class SallaProductAvailability {
81
72
  const isEmailValid = Helper.isValidEmail(this.email.value);
82
73
  if (isEmailValid)
83
74
  return;
84
- !isEmailValid && this.validateField(this.email, this.emailErrorMsg);
75
+ !isEmailValid && this.validateField(this.email, salla.lang.get('common.elements.email_is_valid'));
85
76
  }
86
77
  if (this.channels_.includes('sms')) {
87
78
  const isPhoneValid = await this.mobileInput.isValid();
@@ -103,26 +94,26 @@ export class SallaProductAvailability {
103
94
  ? h("div", { class: "s-product-availability-subscribed" },
104
95
  h("span", { innerHTML: BellRingIcon, class: "s-product-availability-subs-icon" }),
105
96
  " ",
106
- this.subscribedMessage)
97
+ salla.lang.get('pages.products.notify_availability_success'))
107
98
  :
108
- h("salla-button", { width: "wide", onClick: () => this.isUser ? this.submit() : this.modal.open(), ref: btn => this.inlineBtn = btn }, salla.lang.get('pages.products.notify_availability')),
99
+ h("salla-button", { width: "wide", onClick: () => this.isUser ? this.submit() : this.modal.open() }, salla.lang.get('pages.products.notify_availability')),
109
100
  this.isUser || this.isSubscribed || this.isVisitorSubscribed ? '' : this.renderModal()));
110
101
  }
111
102
  renderModal() {
112
- return (h("salla-modal", { ref: modal => this.modal = modal, "modal-title": this.title_, subTitle: this.subTitle, width: "sm" },
103
+ return (h("salla-modal", { ref: modal => this.modal = modal, "modal-title": this.title_, subTitle: salla.lang.get('pages.products.notify_availability_subtitle'), width: "sm" },
113
104
  h("span", { slot: 'icon', innerHTML: BellRingIcon }),
114
105
  h("div", { class: "s-product-availability-body" },
115
106
  this.channels_.includes('email') ? [
116
- h("label", { class: "s-product-availability-label" }, this.emailLabel),
117
- h("input", { class: "s-product-availability-input", onKeyDown: e => this.typing(e, this.submit), placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" }),
107
+ h("label", { class: "s-product-availability-label" }, salla.lang.get('common.elements.email')),
108
+ h("input", { class: "s-product-availability-input", onKeyDown: e => this.typing(e, this.submit), placeholder: salla.lang.get('common.elements.email_placeholder') || 'your@email.com', ref: el => this.email = el, type: "email" }),
118
109
  h("span", { class: "s-product-availability-error-msg" })
119
110
  ] : '',
120
111
  this.channels_.includes('sms') ? [
121
- h("label", { class: "s-product-availability-label" }, this.mobileLabel),
112
+ h("label", { class: "s-product-availability-label" }, salla.lang.get('common.elements.mobile')),
122
113
  h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
123
114
  ] : ''),
124
115
  h("div", { slot: "footer", class: "s-product-availability-footer" },
125
- h("salla-button", { class: "modal-cancel-btn", width: "wide", color: "light", fill: "outline", onClick: () => this.modal.close(), ref: btn => this.cancelBtn = btn }, salla.lang.get('common.elements.cancel')),
116
+ h("salla-button", { class: "modal-cancel-btn", width: "wide", color: "light", fill: "outline", onClick: () => this.modal.close() }, salla.lang.get('common.elements.cancel')),
126
117
  h("salla-button", { class: "submit-btn", "loader-position": 'center', width: "wide", ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
127
118
  }
128
119
  static get is() { return "salla-product-availability"; }
@@ -188,13 +179,8 @@ export class SallaProductAvailability {
188
179
  }
189
180
  }; }
190
181
  static get states() { return {
191
- "subTitle": {},
192
- "mobileLabel": {},
193
- "emailLabel": {},
194
- "emailPlaceholder": {},
195
- "subscribedMessage": {},
182
+ "translationLoaded": {},
196
183
  "title_": {},
197
- "emailErrorMsg": {},
198
184
  "isVisitorSubscribed": {}
199
185
  }; }
200
186
  static get elementRef() { return "host"; }
@@ -14,27 +14,11 @@ export class SallaRatingModal {
14
14
  * The order id, to rate on its products & shipping
15
15
  */
16
16
  this.orderId = salla.config.get('page.id');
17
- this.rate_the_store = salla.lang.get('pages.rating.rate_the_store');
18
- this.write_store_rate = salla.lang.get('pages.rating.write_store_rate');
19
- this.rate_product_stars = salla.lang.get('pages.rating.rate_product_stars');
20
- this.write_product_rate = salla.lang.get('pages.rating.write_product_rate');
21
- this.rate_shipping = salla.lang.get('pages.rating.rate_shipping');
22
- this.write_shipping_rate = salla.lang.get('pages.rating.write_shipping_rate');
23
- this.thanks = salla.lang.get('pages.rating.thanks');
24
- this.back = salla.lang.get('common.elements.back');
25
- this.next = salla.lang.get('common.elements.next');
17
+ this.translationLoaded = false;
26
18
  Helper.setHost(document);
27
19
  salla.event.on('rating::open', () => this.open());
28
20
  salla.lang.onLoaded(() => {
29
- this.rate_the_store = salla.lang.get('pages.rating.rate_the_store');
30
- this.write_store_rate = salla.lang.get('pages.rating.write_store_rate');
31
- this.rate_product_stars = salla.lang.get('pages.rating.rate_product_stars');
32
- this.write_product_rate = salla.lang.get('pages.rating.write_product_rate');
33
- this.rate_shipping = salla.lang.get('pages.rating.rate_shipping');
34
- this.write_shipping_rate = salla.lang.get('pages.rating.write_shipping_rate');
35
- this.thanks = salla.lang.get('pages.rating.thanks');
36
- this.back = salla.lang.get('common.elements.back');
37
- this.next = salla.lang.get('common.elements.next');
21
+ this.translationLoaded = true;
38
22
  });
39
23
  }
40
24
  /**
@@ -156,14 +140,14 @@ export class SallaRatingModal {
156
140
  h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "store" },
157
141
  h("div", { class: "s-rating-modal-rounded-icon" },
158
142
  h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-modal-store-logo" })),
159
- h("h2", { class: "s-rating-modal-title" }, this.rate_the_store),
143
+ h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')),
160
144
  h("div", { class: "s-rating-modal-stars-company" },
161
145
  h("salla-rating-stars", { size: "large" })),
162
- h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: this.write_store_rate }),
146
+ h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }),
163
147
  h("small", { class: "s-rating-modal-validation-msg" }))
164
148
  : '',
165
149
  this.order.products_enabled
166
- ? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-modal-product", "data-stars-error": this.rate_product_stars },
150
+ ? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-modal-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') },
167
151
  h("div", { class: "s-rating-modal-product-img-wrap" },
168
152
  h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" })),
169
153
  h("div", { class: "s-rating-modal-product-details" },
@@ -173,7 +157,7 @@ export class SallaRatingModal {
173
157
  h("div", { class: "s-rating-modal-stars-product" },
174
158
  h("salla-rating-stars", { size: "small", name: `products[${index}][rating]` })),
175
159
  h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.product.id }),
176
- h("textarea", { placeholder: this.write_product_rate, name: `products[${index}][comment]`, class: "s-rating-modal-comment" }),
160
+ h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index}][comment]`, class: "s-rating-modal-comment" }),
177
161
  h("small", { class: "s-rating-modal-validation-msg" })))))
178
162
  : '',
179
163
  this.order.shipping_enabled
@@ -185,20 +169,20 @@ export class SallaRatingModal {
185
169
  : h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }),
186
170
  h("div", { class: "s-rating-modal-title" },
187
171
  " ",
188
- this.rate_shipping + ' ' + this.order.shipping.company.name),
172
+ salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name),
189
173
  h("div", { class: "s-rating-modal-stars-company" },
190
174
  h("salla-rating-stars", { size: "large" })),
191
- h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: this.write_shipping_rate }),
175
+ h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }),
192
176
  h("small", { class: "s-rating-modal-validation-msg" }))
193
177
  : '',
194
178
  h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el },
195
179
  h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }),
196
- h("h3", { class: "s-rating-modal-thanks-title" }, this.thanks),
180
+ h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')),
197
181
  h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }),
198
182
  h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), h("div", { class: "s-rating-modal-footer" },
199
- h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, this.back),
183
+ h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')),
200
184
  this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '',
201
- h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, this.next)),]
185
+ h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
202
186
  : '')));
203
187
  }
204
188
  componentDidLoad() {
@@ -232,7 +216,8 @@ export class SallaRatingModal {
232
216
  }
233
217
  }; }
234
218
  static get states() { return {
235
- "order": {}
219
+ "order": {},
220
+ "translationLoaded": {}
236
221
  }; }
237
222
  static get methods() { return {
238
223
  "open": {
@@ -7,6 +7,7 @@ import Search from '../../assets/svg/search.svg';
7
7
  import { ModeType } from './interfaces';
8
8
  export class SallaScopees {
9
9
  constructor() {
10
+ this.translationLoaded = false;
10
11
  this.mode = ModeType.DEFAULT;
11
12
  this.scopes = [];
12
13
  this.originalScopesList = [];
@@ -24,20 +25,14 @@ export class SallaScopees {
24
25
  if (((_a = this.originalScopesList) === null || _a === void 0 ? void 0 : _a.length) < 2)
25
26
  return "";
26
27
  return this.mode === ModeType.DEFAULT ?
27
- this.shoppingFromAnotherBranch :
28
- this.searchForAvailabilityInOtherBranch;
28
+ salla.lang.get("blocks.scope.shopping_from_another_branch") :
29
+ salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
29
30
  };
30
31
  salla.event.on('scopes::open', ({ mode = null, product_id = null }) => {
31
32
  this.open(mode, product_id);
32
33
  });
33
34
  salla.lang.onLoaded(() => {
34
- this.branchNotFound = salla.lang.get("blocks.scope.branch_looking_for_not_found");
35
- this.ourServiceIsNotFound = salla.lang.get("blocks.scope.our_services_not_available_in_this_branch");
36
- this.searchForAvailabilityInOtherBranch = salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
37
- this.shoppingFromAnotherBranch = salla.lang.get("blocks.scope.shopping_from_another_branch");
38
- this.nowBrowsingFrom = salla.lang.get('blocks.scope.you_are_browse_store_from');
39
- this.confirmButton = salla.lang.get('common.elements.confirm');
40
- this.scopeSearchPlaceholder = salla.lang.get('blocks.scope.searching_for_a_branch');
35
+ this.translationLoaded = true;
41
36
  });
42
37
  }
43
38
  /**
@@ -86,10 +81,10 @@ export class SallaScopees {
86
81
  'type': this.current_scope.type,
87
82
  'id': this.current_scope.id
88
83
  });
89
- if (window.location.search.includes("?")) {
90
- window.location.search += "&";
91
- }
92
- window.location.search += "scope=" + this.current_scope.id;
84
+ var url = new URL(window.location.href);
85
+ url.searchParams.set('scope', this.current_scope.id);
86
+ window.location.href = url.toString();
87
+ window.location.replace(url.toString());
93
88
  }).catch(e => console.log(e))
94
89
  .finally(() => {
95
90
  this.changeBtn.stop();
@@ -121,8 +116,8 @@ export class SallaScopees {
121
116
  }
122
117
  placeholderContent() {
123
118
  return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" },
124
- h("span", { slot: "title" }, this.branchNotFound),
125
- h("span", { slot: "description" }, this.ourServiceIsNotFound));
119
+ h("span", { slot: "title" }, salla.lang.get("blocks.scope.branch_looking_for_not_found")),
120
+ h("span", { slot: "description" }, salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")));
126
121
  }
127
122
  defaultContent() {
128
123
  return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-selection": this.selection },
@@ -142,7 +137,7 @@ export class SallaScopees {
142
137
  footerContent() {
143
138
  return h("div", { class: "s-scopes-footer" },
144
139
  h("slot", { name: "footer" },
145
- h("salla-button", { ref: btn => this.changeBtn = btn, disabled: !this.current_scope, onClick: () => this.handleSubmit(), class: "s-scopes-submit", "loader-position": "center", width: "wide" }, this.confirmButton)));
140
+ h("salla-button", { ref: btn => this.changeBtn = btn, disabled: !this.current_scope, onClick: () => this.handleSubmit(), class: "s-scopes-submit", "loader-position": "center", width: "wide" }, salla.lang.get('common.elements.confirm'))));
146
141
  }
147
142
  render() {
148
143
  return (h(Host, null,
@@ -173,14 +168,14 @@ export class SallaScopees {
173
168
  h("salla-skeleton", { height: '40px', width: '100%' })))),
174
169
  h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" },
175
170
  h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }),
176
- h("div", { slot: "title", class: "s-scopes-header-title" }, this.nowBrowsingFrom),
171
+ h("div", { slot: "title", class: "s-scopes-header-title" }, salla.lang.get('blocks.scope.you_are_browse_store_from')),
177
172
  h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, !!this.selected_scope ? this.selected_scope.name : "")),
178
173
  h("div", { class: "s-scopes-wrap" },
179
174
  !!this.originalScopesList.length && h("h4", { class: "s-scopes-title" }, this.getFormTitle()),
180
175
  this.originalScopesList.length > this.searchDisplayLimit ?
181
176
  h("div", { class: "s-scopes-search-wrapper" },
182
177
  h("div", { class: "s-scopes-search-icon", innerHTML: Search }),
183
- h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: this.scopeSearchPlaceholder }))
178
+ h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: salla.lang.get('blocks.scope.searching_for_a_branch') }))
184
179
  : "",
185
180
  this.scopes.length < 2 ?
186
181
  this.placeholderContent()
@@ -237,17 +232,11 @@ export class SallaScopees {
237
232
  }
238
233
  }; }
239
234
  static get states() { return {
235
+ "translationLoaded": {},
240
236
  "mode": {},
241
237
  "current_scope": {},
242
238
  "scopes": {},
243
239
  "originalScopesList": {},
244
- "branchNotFound": {},
245
- "ourServiceIsNotFound": {},
246
- "searchForAvailabilityInOtherBranch": {},
247
- "shoppingFromAnotherBranch": {},
248
- "nowBrowsingFrom": {},
249
- "confirmButton": {},
250
- "scopeSearchPlaceholder": {},
251
240
  "selected_scope": {},
252
241
  "isOpenedBefore": {}
253
242
  }; }
@@ -11,6 +11,7 @@ export class SallaSearch {
11
11
  constructor() {
12
12
  var _a;
13
13
  this.inputValue = '';
14
+ this.translationLoaded = false;
14
15
  this.loading = false;
15
16
  this.typing = false;
16
17
  this.debounce = setTimeout(() => '', 1000);
@@ -30,8 +31,7 @@ export class SallaSearch {
30
31
  this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
31
32
  salla.event.on('search::open', () => this.open());
32
33
  salla.lang.onLoaded(() => {
33
- this.placeholder = salla.lang.get('blocks.header.search_placeholder');
34
- this.noResultsText = salla.lang.get('common.elements.no_options');
34
+ this.translationLoaded = true;
35
35
  });
36
36
  salla.event.on('modalClosed', () => this.onModalClose());
37
37
  }
@@ -92,7 +92,7 @@ export class SallaSearch {
92
92
  render() {
93
93
  var _a;
94
94
  const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container },
95
- h("input", { type: "text", autocomplete: "off", class: "s-search-input", placeholder: this.placeholder, onInput: e => this.debounceSearch(e), ref: input => this.searchInput = input, style: { height: this.height + 'px', borderRadius: this.oval ? this.height / 2 + 'px' : '' } }),
95
+ h("input", { type: "text", autocomplete: "off", class: "s-search-input", placeholder: salla.lang.get('blocks.header.search_placeholder'), onInput: e => this.debounceSearch(e), ref: input => this.searchInput = input, style: { height: this.height + 'px', borderRadius: this.oval ? this.height / 2 + 'px' : '' } }),
96
96
  h("span", { class: "s-search-icon-wrap" },
97
97
  h("span", { class: "s-search-icon", innerHTML: this.loading ? '<i class="s-search-spinner-loader"></i>' : Search })),
98
98
  h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
@@ -101,7 +101,7 @@ export class SallaSearch {
101
101
  .replace(/\{price\}/g, salla.money(item.price))
102
102
  .replace(/\{regular_price\}/g, item.has_special_price ? salla.money(item.regular_price) : '')
103
103
  .replace(/\{image\}/g, item.thumbnail) })),
104
- h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, this.noResultsText)));
104
+ h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, salla.lang.get('common.elements.no_options'))));
105
105
  return (this.inline ?
106
106
  h("div", { class: "s-search-modal" }, searchContent)
107
107
  :
@@ -177,9 +177,8 @@ export class SallaSearch {
177
177
  }
178
178
  }; }
179
179
  static get states() { return {
180
+ "translationLoaded": {},
180
181
  "results": {},
181
- "placeholder": {},
182
- "noResultsText": {},
183
182
  "loading": {},
184
183
  "typing": {},
185
184
  "debounce": {},
@@ -31,22 +31,20 @@ export class SallaSocialShare {
31
31
  }
32
32
  componentWillLoad() {
33
33
  let that = this;
34
- if (!document.getElementById('a2a-script')) {
35
- const script = document.createElement('script');
36
- script.src = 'https://static.addtoany.com/menu/page.js';
37
- script.setAttribute('id', 'a2a-script');
38
- script.async = true;
39
- script.onload = function () {
40
- // ? this will not work if there is one share component in the page
41
- window.a2a_config = window.a2a_config || {};
42
- window.a2a_config.linkurl = that.url ? that.url : window.location.href;
43
- window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
44
- };
45
- document.body.appendChild(script);
46
- }
47
- else {
34
+ if (document.getElementById('a2a-script')) {
48
35
  return;
49
36
  }
37
+ const script = document.createElement('script');
38
+ script.src = 'https://static.addtoany.com/menu/page.js';
39
+ script.setAttribute('id', 'a2a-script');
40
+ script.async = true;
41
+ script.onload = function () {
42
+ // ? this will not work if there is one share component in the page
43
+ window.a2a_config = window.a2a_config || {};
44
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
45
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
46
+ };
47
+ document.body.appendChild(script);
50
48
  salla.lang.onLoaded(() => {
51
49
  window.a2a_config.locale = salla.lang.locale;
52
50
  });
@@ -11,7 +11,7 @@ export class SallaTabContent {
11
11
  */
12
12
  async getChild() {
13
13
  return {
14
- select: this.select.bind(this),
14
+ selected: this.selected.bind(this),
15
15
  unselect: this.unselect.bind(this),
16
16
  name: this.name
17
17
  };
@@ -19,7 +19,7 @@ export class SallaTabContent {
19
19
  unselect() {
20
20
  this.isSelected = false;
21
21
  }
22
- select() {
22
+ selected() {
23
23
  this.isSelected = true;
24
24
  }
25
25
  render() {
@@ -62,14 +62,14 @@ export class SallaTabContent {
62
62
  static get methods() { return {
63
63
  "getChild": {
64
64
  "complexType": {
65
- "signature": "() => Promise<{ select: any; unselect: any; name: string; }>",
65
+ "signature": "() => Promise<{ selected: any; unselect: any; name: string; }>",
66
66
  "parameters": [],
67
67
  "references": {
68
68
  "Promise": {
69
69
  "location": "global"
70
70
  }
71
71
  },
72
- "return": "Promise<{ select: any; unselect: any; name: string; }>"
72
+ "return": "Promise<{ selected: any; unselect: any; name: string; }>"
73
73
  },
74
74
  "docs": {
75
75
  "text": "Expose self for the parent.",
@@ -25,7 +25,7 @@ export class SallaTabHeader {
25
25
  */
26
26
  async getChild() {
27
27
  return {
28
- select: this.selected.bind(this),
28
+ selected: this.selected.bind(this),
29
29
  unselect: this.unselect.bind(this),
30
30
  name: this.name,
31
31
  id: this.id
@@ -155,14 +155,14 @@ export class SallaTabHeader {
155
155
  static get methods() { return {
156
156
  "getChild": {
157
157
  "complexType": {
158
- "signature": "() => Promise<{ select: any; unselect: any; name: string; id: string; }>",
158
+ "signature": "() => Promise<{ selected: any; unselect: any; name: string; id: string; }>",
159
159
  "parameters": [],
160
160
  "references": {
161
161
  "Promise": {
162
162
  "location": "global"
163
163
  }
164
164
  },
165
- "return": "Promise<{ select: any; unselect: any; name: string; id: string; }>"
165
+ "return": "Promise<{ selected: any; unselect: any; name: string; id: string; }>"
166
166
  },
167
167
  "docs": {
168
168
  "text": "Expose self for the parent.",
@@ -41,8 +41,8 @@ export class SallaTabs {
41
41
  g.header.unselect();
42
42
  g.content.unselect();
43
43
  });
44
- group.header.select();
45
- group.content.select();
44
+ group.header.selected();
45
+ group.content.selected();
46
46
  }
47
47
  render() {
48
48
  return [
@@ -100,7 +100,7 @@ export class SallaTabs {
100
100
  }; }
101
101
  static get elementRef() { return "host"; }
102
102
  static get listeners() { return [{
103
- "name": "onTabSelected",
103
+ "name": "tabSelected",
104
104
  "method": "onSelectedTab",
105
105
  "target": undefined,
106
106
  "capture": false,
@@ -11,6 +11,7 @@ import AndroidPhoneIcon from '../../assets/svg/android-phone.svg';
11
11
  export class SallaVerify {
12
12
  constructor() {
13
13
  this.initiated = false;
14
+ this.translationLoaded = false;
14
15
  /**
15
16
  * Should render component without modal
16
17
  */
@@ -30,16 +31,15 @@ export class SallaVerify {
30
31
  this.isProfileVerify = false;
31
32
  // Helper.setHost(this.host);
32
33
  salla.lang.onLoaded(() => {
33
- var _a, _b;
34
+ var _a;
35
+ this.translationLoaded = true;
34
36
  this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + this.type);
35
37
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
36
- (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
37
38
  });
38
39
  if (this.display == 'inline') {
39
40
  this.modal = { open: () => '', close: () => '', setTitle: () => '' };
40
41
  return;
41
42
  }
42
- //salla.profile.event.verificationCodeSent({});
43
43
  salla.event.on('profile::verification', data => {
44
44
  var _a;
45
45
  this.isProfileVerify = true;
@@ -238,6 +238,7 @@ export class SallaVerify {
238
238
  }
239
239
  }; }
240
240
  static get states() { return {
241
+ "translationLoaded": {},
241
242
  "title": {},
242
243
  "resendAfter": {},
243
244
  "isProfileVerify": {}
@@ -91,7 +91,13 @@ const SallaAddProductButton$1 = /*@__PURE__*/ proxyCustomElement(class extends H
91
91
  }
92
92
  componentDidRender() {
93
93
  //if label not passed, get label
94
- this.hasLabel || salla.event.on('languages::translations.loaded', () => this.btn.setText(this.getLabel() || 'اضافة للسلة'));
94
+ if (this.hasLabel) {
95
+ return;
96
+ }
97
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
98
+ salla.lang.onLoaded(() => {
99
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
100
+ });
95
101
  }
96
102
  get host() { return this; }
97
103
  static get style() { return sallaAddProductButtonCss; }
@@ -19,7 +19,7 @@ const SallaInstallment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
19
19
  * Currency code
20
20
  */
21
21
  this.currency = salla.config.get('user.currency_code');
22
- document.addEventListener('twilight::ready', () => {
22
+ document.addEventListener('twilight::initiated', () => {
23
23
  const installment = salla.config.get('store.settings.installments');
24
24
  if (installment) {
25
25
  this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;