@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
@@ -29,6 +29,7 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
29
29
  constructor() {
30
30
  super();
31
31
  this.__registerHost();
32
+ this.translationLoaded = false;
32
33
  this.mode = ModeType.DEFAULT;
33
34
  this.scopes = [];
34
35
  this.originalScopesList = [];
@@ -46,20 +47,14 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
46
47
  if (((_a = this.originalScopesList) === null || _a === void 0 ? void 0 : _a.length) < 2)
47
48
  return "";
48
49
  return this.mode === ModeType.DEFAULT ?
49
- this.shoppingFromAnotherBranch :
50
- this.searchForAvailabilityInOtherBranch;
50
+ salla.lang.get("blocks.scope.shopping_from_another_branch") :
51
+ salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
51
52
  };
52
53
  salla.event.on('scopes::open', ({ mode = null, product_id = null }) => {
53
54
  this.open(mode, product_id);
54
55
  });
55
56
  salla.lang.onLoaded(() => {
56
- this.branchNotFound = salla.lang.get("blocks.scope.branch_looking_for_not_found");
57
- this.ourServiceIsNotFound = salla.lang.get("blocks.scope.our_services_not_available_in_this_branch");
58
- this.searchForAvailabilityInOtherBranch = salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
59
- this.shoppingFromAnotherBranch = salla.lang.get("blocks.scope.shopping_from_another_branch");
60
- this.nowBrowsingFrom = salla.lang.get('blocks.scope.you_are_browse_store_from');
61
- this.confirmButton = salla.lang.get('common.elements.confirm');
62
- this.scopeSearchPlaceholder = salla.lang.get('blocks.scope.searching_for_a_branch');
57
+ this.translationLoaded = true;
63
58
  });
64
59
  }
65
60
  /**
@@ -108,10 +103,10 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
108
103
  'type': this.current_scope.type,
109
104
  'id': this.current_scope.id
110
105
  });
111
- if (window.location.search.includes("?")) {
112
- window.location.search += "&";
113
- }
114
- window.location.search += "scope=" + this.current_scope.id;
106
+ var url = new URL(window.location.href);
107
+ url.searchParams.set('scope', this.current_scope.id);
108
+ window.location.href = url.toString();
109
+ window.location.replace(url.toString());
115
110
  }).catch(e => console.log(e))
116
111
  .finally(() => {
117
112
  this.changeBtn.stop();
@@ -142,7 +137,7 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
142
137
  this.current_scope = this.scopes.find(scope => scope.id == event.target.value);
143
138
  }
144
139
  placeholderContent() {
145
- return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" }, this.branchNotFound), h("span", { slot: "description" }, this.ourServiceIsNotFound));
140
+ return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" }, salla.lang.get("blocks.scope.branch_looking_for_not_found")), h("span", { slot: "description" }, salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")));
146
141
  }
147
142
  defaultContent() {
148
143
  return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-selection": this.selection }, h("input", { id: `${this.selection} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: `${this.selection} + '_scope_' + ${scope.id}`, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
@@ -154,11 +149,11 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
154
149
  }));
155
150
  }
156
151
  footerContent() {
157
- return h("div", { class: "s-scopes-footer" }, h("slot", { name: "footer" }, 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)));
152
+ return h("div", { class: "s-scopes-footer" }, h("slot", { name: "footer" }, 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'))));
158
153
  }
159
154
  render() {
160
- return (h(Host, null, h("salla-modal", { ref: modal => this.modal = modal, isClosable: !!(this.isOpenedBefore || (this.selection == 'optional')), class: "s-scopes-modal", isLoading: true, "has-skeleton": true }, h("div", { slot: "loading" }, h("div", { class: "s-scopes-skeleton" }, h("salla-list-tile", { class: "s-scopes-header" }, h("div", { slot: "icon", class: "s-scopes-header-icon" }, h("salla-skeleton", { type: "circle" })), h("div", { slot: "title", class: "s-scopes-header-title mb-5" }, h("salla-skeleton", { height: '15px', width: '50%' })), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, h("salla-skeleton", { height: '10px' }), h("salla-skeleton", { height: '10px', width: '75%' }))), h("div", { class: "s-scopes-skeleton-search" }, h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '30px', width: '100%' })), h("div", { class: "s-scopes-skeleton-scopes" }, h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' })), h("div", { class: "s-scopes-skeleton-btn" }, h("salla-skeleton", { height: '40px', width: '100%' })))), h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" }, h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }), h("div", { slot: "title", class: "s-scopes-header-title" }, this.nowBrowsingFrom), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, !!this.selected_scope ? this.selected_scope.name : "")), h("div", { class: "s-scopes-wrap" }, !!this.originalScopesList.length && h("h4", { class: "s-scopes-title" }, this.getFormTitle()), this.originalScopesList.length > this.searchDisplayLimit ?
161
- h("div", { class: "s-scopes-search-wrapper" }, h("div", { class: "s-scopes-search-icon", innerHTML: Search }), h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: this.scopeSearchPlaceholder }))
155
+ return (h(Host, null, h("salla-modal", { ref: modal => this.modal = modal, isClosable: !!(this.isOpenedBefore || (this.selection == 'optional')), class: "s-scopes-modal", isLoading: true, "has-skeleton": true }, h("div", { slot: "loading" }, h("div", { class: "s-scopes-skeleton" }, h("salla-list-tile", { class: "s-scopes-header" }, h("div", { slot: "icon", class: "s-scopes-header-icon" }, h("salla-skeleton", { type: "circle" })), h("div", { slot: "title", class: "s-scopes-header-title mb-5" }, h("salla-skeleton", { height: '15px', width: '50%' })), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, h("salla-skeleton", { height: '10px' }), h("salla-skeleton", { height: '10px', width: '75%' }))), h("div", { class: "s-scopes-skeleton-search" }, h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '30px', width: '100%' })), h("div", { class: "s-scopes-skeleton-scopes" }, h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' })), h("div", { class: "s-scopes-skeleton-btn" }, h("salla-skeleton", { height: '40px', width: '100%' })))), h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" }, h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }), h("div", { slot: "title", class: "s-scopes-header-title" }, salla.lang.get('blocks.scope.you_are_browse_store_from')), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, !!this.selected_scope ? this.selected_scope.name : "")), h("div", { class: "s-scopes-wrap" }, !!this.originalScopesList.length && h("h4", { class: "s-scopes-title" }, this.getFormTitle()), this.originalScopesList.length > this.searchDisplayLimit ?
156
+ h("div", { class: "s-scopes-search-wrapper" }, h("div", { class: "s-scopes-search-icon", innerHTML: Search }), h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: salla.lang.get('blocks.scope.searching_for_a_branch') }))
162
157
  : "", this.scopes.length < 2 ?
163
158
  this.placeholderContent()
164
159
  : this.mode === ModeType.DEFAULT ? this.defaultContent() : this.availabilityContent()))));
@@ -172,17 +167,11 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
172
167
  }, [4, "salla-scopes", {
173
168
  "selection": [1],
174
169
  "searchDisplayLimit": [2, "search-display-limit"],
170
+ "translationLoaded": [32],
175
171
  "mode": [32],
176
172
  "current_scope": [32],
177
173
  "scopes": [32],
178
174
  "originalScopesList": [32],
179
- "branchNotFound": [32],
180
- "ourServiceIsNotFound": [32],
181
- "searchForAvailabilityInOtherBranch": [32],
182
- "shoppingFromAnotherBranch": [32],
183
- "nowBrowsingFrom": [32],
184
- "confirmButton": [32],
185
- "scopeSearchPlaceholder": [32],
186
175
  "selected_scope": [32],
187
176
  "isOpenedBefore": [32],
188
177
  "close": [64],
@@ -15,6 +15,7 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
15
15
  this.__registerHost();
16
16
  var _a;
17
17
  this.inputValue = '';
18
+ this.translationLoaded = false;
18
19
  this.loading = false;
19
20
  this.typing = false;
20
21
  this.debounce = setTimeout(() => '', 1000);
@@ -34,8 +35,7 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
34
35
  this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
35
36
  salla.event.on('search::open', () => this.open());
36
37
  salla.lang.onLoaded(() => {
37
- this.placeholder = salla.lang.get('blocks.header.search_placeholder');
38
- this.noResultsText = salla.lang.get('common.elements.no_options');
38
+ this.translationLoaded = true;
39
39
  });
40
40
  salla.event.on('modalClosed', () => this.onModalClose());
41
41
  }
@@ -95,12 +95,12 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
95
95
  }
96
96
  render() {
97
97
  var _a;
98
- const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container }, 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' : '' } }), h("span", { class: "s-search-icon-wrap" }, h("span", { class: "s-search-icon", innerHTML: this.loading ? '<i class="s-search-spinner-loader"></i>' : Search })), h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
98
+ const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container }, 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' : '' } }), h("span", { class: "s-search-icon-wrap" }, h("span", { class: "s-search-icon", innerHTML: this.loading ? '<i class="s-search-spinner-loader"></i>' : Search })), h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
99
99
  _a.data.map(item => h("a", { href: item.url, class: { "s-search-product": true, 's-search-product-not-available': !item.is_available }, innerHTML: this.productSlot
100
100
  .replace(/\{name\}/g, item.name)
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
- .replace(/\{image\}/g, item.thumbnail) })), h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, this.noResultsText)));
103
+ .replace(/\{image\}/g, item.thumbnail) })), h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, salla.lang.get('common.elements.no_options'))));
104
104
  return (this.inline ?
105
105
  h("div", { class: "s-search-modal" }, searchContent)
106
106
  :
@@ -121,9 +121,8 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
121
121
  "inline": [4],
122
122
  "oval": [4],
123
123
  "height": [2],
124
+ "translationLoaded": [32],
124
125
  "results": [32],
125
- "placeholder": [32],
126
- "noResultsText": [32],
127
126
  "loading": [32],
128
127
  "typing": [32],
129
128
  "debounce": [32],
@@ -1382,22 +1382,20 @@ const SallaSocialShare$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
1382
1382
  }
1383
1383
  componentWillLoad() {
1384
1384
  let that = this;
1385
- if (!document.getElementById('a2a-script')) {
1386
- const script = document.createElement('script');
1387
- script.src = 'https://static.addtoany.com/menu/page.js';
1388
- script.setAttribute('id', 'a2a-script');
1389
- script.async = true;
1390
- script.onload = function () {
1391
- // ? this will not work if there is one share component in the page
1392
- window.a2a_config = window.a2a_config || {};
1393
- window.a2a_config.linkurl = that.url ? that.url : window.location.href;
1394
- window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
1395
- };
1396
- document.body.appendChild(script);
1397
- }
1398
- else {
1385
+ if (document.getElementById('a2a-script')) {
1399
1386
  return;
1400
1387
  }
1388
+ const script = document.createElement('script');
1389
+ script.src = 'https://static.addtoany.com/menu/page.js';
1390
+ script.setAttribute('id', 'a2a-script');
1391
+ script.async = true;
1392
+ script.onload = function () {
1393
+ // ? this will not work if there is one share component in the page
1394
+ window.a2a_config = window.a2a_config || {};
1395
+ window.a2a_config.linkurl = that.url ? that.url : window.location.href;
1396
+ window.a2a_config.linkname = that.urlName ? that.urlName : document.title;
1397
+ };
1398
+ document.body.appendChild(script);
1401
1399
  salla.lang.onLoaded(() => {
1402
1400
  window.a2a_config.locale = salla.lang.locale;
1403
1401
  });
@@ -16,7 +16,7 @@ const SallaTabContent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
16
16
  */
17
17
  async getChild() {
18
18
  return {
19
- select: this.select.bind(this),
19
+ selected: this.selected.bind(this),
20
20
  unselect: this.unselect.bind(this),
21
21
  name: this.name
22
22
  };
@@ -24,7 +24,7 @@ const SallaTabContent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
24
24
  unselect() {
25
25
  this.isSelected = false;
26
26
  }
27
- select() {
27
+ selected() {
28
28
  this.isSelected = true;
29
29
  }
30
30
  render() {
@@ -34,7 +34,7 @@ const SallaTabHeader = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
34
34
  */
35
35
  async getChild() {
36
36
  return {
37
- select: this.selected.bind(this),
37
+ selected: this.selected.bind(this),
38
38
  unselect: this.unselect.bind(this),
39
39
  name: this.name,
40
40
  id: this.id
@@ -46,8 +46,8 @@ const SallaTabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
46
46
  g.header.unselect();
47
47
  g.content.unselect();
48
48
  });
49
- group.header.select();
50
- group.content.select();
49
+ group.header.selected();
50
+ group.content.selected();
51
51
  }
52
52
  render() {
53
53
  return [
@@ -59,7 +59,7 @@ const SallaTabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
59
59
  }, [4, "salla-tabs", {
60
60
  "backgroundColor": [1, "background-color"],
61
61
  "vertical": [4]
62
- }, [[0, "onTabSelected", "onSelectedTab"]]]);
62
+ }, [[0, "tabSelected", "onSelectedTab"]]]);
63
63
  function defineCustomElement() {
64
64
  if (typeof customElements === "undefined") {
65
65
  return;
@@ -22,6 +22,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
22
22
  this.__registerHost();
23
23
  this.verified = createEvent(this, "verified", 7);
24
24
  this.initiated = false;
25
+ this.translationLoaded = false;
25
26
  /**
26
27
  * Should render component without modal
27
28
  */
@@ -41,16 +42,15 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
41
42
  this.isProfileVerify = false;
42
43
  // Helper.setHost(this.host);
43
44
  salla.lang.onLoaded(() => {
44
- var _a, _b;
45
+ var _a;
46
+ this.translationLoaded = true;
45
47
  this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + this.type);
46
48
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
47
- (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('pages.profile.verify'));
48
49
  });
49
50
  if (this.display == 'inline') {
50
51
  this.modal = { open: () => '', close: () => '', setTitle: () => '' };
51
52
  return;
52
53
  }
53
- //salla.profile.event.verificationCodeSent({});
54
54
  salla.event.on('profile::verification', data => {
55
55
  var _a;
56
56
  this.isProfileVerify = true;
@@ -178,6 +178,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
178
178
  "display": [1],
179
179
  "type": [1025],
180
180
  "autoReload": [4, "auto-reload"],
181
+ "translationLoaded": [32],
181
182
  "title": [32],
182
183
  "resendAfter": [32],
183
184
  "isProfileVerify": [32],
@@ -13,7 +13,7 @@ const patchEsm = () => {
13
13
  const defineCustomElements = (win, options) => {
14
14
  if (typeof window === 'undefined') return Promise.resolve();
15
15
  return patchEsm().then(() => {
16
- return bootstrapLazy([["salla-button_24",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"points":[32],"exchange_points":[32],"are_you_sure_to_exchange":[32],"for":[32],"cancel":[32],"confirm":[32],"cart_total_point_summary":[32],"cart_point_exchange_now":[32],"login_button":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"onTabSelected","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"default_title":[32],"default_description":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-scopes",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"branchNotFound":[32],"ourServiceIsNotFound":[32],"searchForAvailabilityInOtherBranch":[32],"shoppingFromAnotherBranch":[32],"nowBrowsingFrom":[32],"confirmButton":[32],"scopeSearchPlaceholder":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-add-product-button",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]]], options);
16
+ return bootstrapLazy([["salla-button_24",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-scopes",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-add-product-button",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]]], options);
17
17
  });
18
18
  };
19
19
 
@@ -85,7 +85,13 @@ const SallaAddProductButton = class {
85
85
  }
86
86
  componentDidRender() {
87
87
  //if label not passed, get label
88
- this.hasLabel || salla.event.on('languages::translations.loaded', () => this.btn.setText(this.getLabel() || 'اضافة للسلة'));
88
+ if (this.hasLabel) {
89
+ return;
90
+ }
91
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
92
+ salla.lang.onLoaded(() => {
93
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
94
+ });
89
95
  }
90
96
  get host() { return getElement(this); }
91
97
  };