@salla.sa/twilight-components 2.11.14 → 2.11.16

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.
@@ -2660,7 +2660,7 @@ const SallaColorPicker = class {
2660
2660
  });
2661
2661
  }
2662
2662
  render() {
2663
- return (index.h(index.Host, { class: "s-color-picker-main" }, index.h("slot", null, index.h("div", { class: "s-color-picker-widget" }, index.h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), index.h("span", { innerHTML: ArrowDown }))), index.h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
2663
+ return (index.h(index.Host, { class: "s-color-picker-main" }, index.h("slot", { name: "widget" }, index.h("div", { class: "s-color-picker-widget" }, index.h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), index.h("span", { innerHTML: ArrowDown }))), index.h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
2664
2664
  }
2665
2665
  get host() { return index.getElement(this); }
2666
2666
  };
@@ -22623,10 +22623,10 @@ const SallaMap = class {
22623
22623
  this.defaultLat = 21.419421; //Mecca 🕋
22624
22624
  this.defaultLng = 39.82553; //Mecca 🕋
22625
22625
  // state variables
22626
- this.modalActivityTitle = 'Activity Location';
22627
- this.confirmButtonTitle = 'Confirm';
22628
- this.locateButtonTitle = 'Locate';
22629
- this.locateButtonEdit = 'Edit';
22626
+ this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
22627
+ this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22628
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
22629
+ this.locateButtonEdit = salla.lang.get('common.elements.edit');
22630
22630
  this.searchInputValue = null;
22631
22631
  this.geolocationError = false;
22632
22632
  /**
@@ -22645,10 +22645,6 @@ const SallaMap = class {
22645
22645
  * Sets the search bar visibility.
22646
22646
  */
22647
22647
  this.searchable = false;
22648
- /**
22649
- * Sets google api key value
22650
- */
22651
- this.apiKey = null;
22652
22648
  /**
22653
22649
  * Modal Title
22654
22650
  */
@@ -22664,9 +22660,10 @@ const SallaMap = class {
22664
22660
  salla.lang.onLoaded(() => {
22665
22661
  this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
22666
22662
  this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22667
- this.locateButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22663
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
22668
22664
  this.locateButtonEdit = salla.lang.get('common.elements.edit');
22669
22665
  });
22666
+ this.apiKey = 'AIzaSyBPhPJ4KG13ywvmeAovLRnbi7WzlsdcWKs';
22670
22667
  }
22671
22668
  formatAddress(address) {
22672
22669
  return address.length > 25 ? address.substring(0, 25) + '...' : address;
@@ -22692,7 +22689,10 @@ const SallaMap = class {
22692
22689
  center: (this.lat || this.lng) ? {
22693
22690
  lat: this.lat,
22694
22691
  lng: this.lng,
22695
- } : null,
22692
+ } : {
22693
+ lat: this.defaultLat,
22694
+ lng: this.defaultLng,
22695
+ },
22696
22696
  zoom: this.zoom,
22697
22697
  zoomControl: true,
22698
22698
  mapTypeControl: false,
@@ -23473,7 +23473,6 @@ const SallaProductOptions = class {
23473
23473
  //@ts-ignore
23474
23474
  fileOption(option) {
23475
23475
  let types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
23476
- console.log(option.name, types);
23477
23476
  return types.length
23478
23477
  ? this.fileUploader(option, { accept: types.join(',') })
23479
23478
  : 'File types not selected.';
@@ -26806,16 +26805,21 @@ const SallaUserMenu = class {
26806
26805
  ? index.h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
26807
26806
  : ""));
26808
26807
  }
26808
+ componentShouldUpdate() {
26809
+ if (!this.opened) {
26810
+ window.removeEventListener('click', this.onClickOutside);
26811
+ }
26812
+ }
26809
26813
  render() {
26810
26814
  //todo:: reduce class names, they are too long
26811
26815
  return (index.h(index.Host, null, this.inline ?
26812
26816
  index.h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))
26813
26817
  : index.h("div", { class: { 's-user-menu-wrapper': true, 's-user-menu-relative-dropdown': this.relativeDropdown } }, this.getTheHeader(), index.h("div", { class: { 's-user-menu-toggler': true, 'opened': this.opened } }, index.h("div", { class: "s-user-menu-dropdown", onClick: (e) => e.stopPropagation() }, this.showHeader ? index.h("div", { class: "s-user-menu-dropdown-header" }, index.h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }), index.h("div", { class: "s-user-menu-dropdown-header-content" }, index.h("span", null, this.hello), index.h("p", null, this.first_name, " ", this.last_name)), index.h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => this.opened = false })) : '', index.h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
26814
26818
  }
26815
- componentShouldUpdate() {
26816
- if (!this.opened) {
26817
- window.removeEventListener('click', this.onClickOutside);
26818
- }
26819
+ componentDidLoad() {
26820
+ var _a;
26821
+ //make sure to load the avatar if it's lazy, we use it in Y
26822
+ (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update(this.host.querySelectorAll('.lazy'));
26819
26823
  }
26820
26824
  get host() { return index.getElement(this); }
26821
26825
  };
@@ -147,7 +147,7 @@ export class SallaColorPicker {
147
147
  }
148
148
  render() {
149
149
  return (h(Host, { class: "s-color-picker-main" },
150
- h("slot", null,
150
+ h("slot", { name: "widget" },
151
151
  h("div", { class: "s-color-picker-widget" },
152
152
  h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }),
153
153
  h("span", { innerHTML: ArrowDown }))),
@@ -14,10 +14,10 @@ export class SallaMap {
14
14
  this.defaultLat = 21.419421; //Mecca 🕋
15
15
  this.defaultLng = 39.82553; //Mecca 🕋
16
16
  // state variables
17
- this.modalActivityTitle = 'Activity Location';
18
- this.confirmButtonTitle = 'Confirm';
19
- this.locateButtonTitle = 'Locate';
20
- this.locateButtonEdit = 'Edit';
17
+ this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
18
+ this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
19
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
20
+ this.locateButtonEdit = salla.lang.get('common.elements.edit');
21
21
  this.searchInputValue = null;
22
22
  this.geolocationError = false;
23
23
  /**
@@ -36,10 +36,6 @@ export class SallaMap {
36
36
  * Sets the search bar visibility.
37
37
  */
38
38
  this.searchable = false;
39
- /**
40
- * Sets google api key value
41
- */
42
- this.apiKey = null;
43
39
  /**
44
40
  * Modal Title
45
41
  */
@@ -55,9 +51,10 @@ export class SallaMap {
55
51
  salla.lang.onLoaded(() => {
56
52
  this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
57
53
  this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
58
- this.locateButtonTitle = salla.lang.get('pages.checkout.confirm_address');
54
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
59
55
  this.locateButtonEdit = salla.lang.get('common.elements.edit');
60
56
  });
57
+ this.apiKey = 'AIzaSyBPhPJ4KG13ywvmeAovLRnbi7WzlsdcWKs';
61
58
  }
62
59
  formatAddress(address) {
63
60
  return address.length > 25 ? address.substring(0, 25) + '...' : address;
@@ -83,7 +80,10 @@ export class SallaMap {
83
80
  center: (this.lat || this.lng) ? {
84
81
  lat: this.lat,
85
82
  lng: this.lng,
86
- } : null,
83
+ } : {
84
+ lat: this.defaultLat,
85
+ lng: this.defaultLng,
86
+ },
87
87
  zoom: this.zoom,
88
88
  zoomControl: true,
89
89
  mapTypeControl: false,
@@ -376,11 +376,10 @@ export class SallaMap {
376
376
  "optional": false,
377
377
  "docs": {
378
378
  "tags": [],
379
- "text": "Sets google api key value"
379
+ "text": "Sets google api key value, default Merchant key"
380
380
  },
381
381
  "attribute": "api-key",
382
- "reflect": false,
383
- "defaultValue": "null"
382
+ "reflect": false
384
383
  },
385
384
  "modalTitle": {
386
385
  "type": "string",
@@ -125,7 +125,6 @@ export class SallaProductOptions {
125
125
  //@ts-ignore
126
126
  fileOption(option) {
127
127
  let types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
128
- console.log(option.name, types);
129
128
  return types.length
130
129
  ? this.fileUploader(option, { accept: types.join(',') })
131
130
  : 'File types not selected.';
@@ -144,6 +144,11 @@ export class SallaUserMenu {
144
144
  ? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
145
145
  : ""));
146
146
  }
147
+ componentShouldUpdate() {
148
+ if (!this.opened) {
149
+ window.removeEventListener('click', this.onClickOutside);
150
+ }
151
+ }
147
152
  render() {
148
153
  //todo:: reduce class names, they are too long
149
154
  return (h(Host, null, this.inline ?
@@ -163,10 +168,10 @@ export class SallaUserMenu {
163
168
  h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => this.opened = false })) : '',
164
169
  h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
165
170
  }
166
- componentShouldUpdate() {
167
- if (!this.opened) {
168
- window.removeEventListener('click', this.onClickOutside);
169
- }
171
+ componentDidLoad() {
172
+ var _a;
173
+ //make sure to load the avatar if it's lazy, we use it in Y
174
+ (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update(this.host.querySelectorAll('.lazy'));
170
175
  }
171
176
  static get is() { return "salla-user-menu"; }
172
177
  static get originalStyleUrls() { return {
@@ -1154,7 +1154,7 @@ const SallaColorPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
1154
1154
  });
1155
1155
  }
1156
1156
  render() {
1157
- return (h(Host, { class: "s-color-picker-main" }, h("slot", null, h("div", { class: "s-color-picker-widget" }, h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { innerHTML: ArrowDown }))), h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
1157
+ return (h(Host, { class: "s-color-picker-main" }, h("slot", { name: "widget" }, h("div", { class: "s-color-picker-widget" }, h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { innerHTML: ArrowDown }))), h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
1158
1158
  }
1159
1159
  get host() { return this; }
1160
1160
  static get style() { return sallaColorPickerCss; }
@@ -450,10 +450,10 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
450
450
  this.defaultLat = 21.419421; //Mecca 🕋
451
451
  this.defaultLng = 39.82553; //Mecca 🕋
452
452
  // state variables
453
- this.modalActivityTitle = 'Activity Location';
454
- this.confirmButtonTitle = 'Confirm';
455
- this.locateButtonTitle = 'Locate';
456
- this.locateButtonEdit = 'Edit';
453
+ this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
454
+ this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
455
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
456
+ this.locateButtonEdit = salla.lang.get('common.elements.edit');
457
457
  this.searchInputValue = null;
458
458
  this.geolocationError = false;
459
459
  /**
@@ -472,10 +472,6 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
472
472
  * Sets the search bar visibility.
473
473
  */
474
474
  this.searchable = false;
475
- /**
476
- * Sets google api key value
477
- */
478
- this.apiKey = null;
479
475
  /**
480
476
  * Modal Title
481
477
  */
@@ -491,9 +487,10 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
491
487
  salla.lang.onLoaded(() => {
492
488
  this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
493
489
  this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
494
- this.locateButtonTitle = salla.lang.get('pages.checkout.confirm_address');
490
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
495
491
  this.locateButtonEdit = salla.lang.get('common.elements.edit');
496
492
  });
493
+ this.apiKey = 'AIzaSyBPhPJ4KG13ywvmeAovLRnbi7WzlsdcWKs';
497
494
  }
498
495
  formatAddress(address) {
499
496
  return address.length > 25 ? address.substring(0, 25) + '...' : address;
@@ -519,7 +516,10 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
519
516
  center: (this.lat || this.lng) ? {
520
517
  lat: this.lat,
521
518
  lng: this.lng,
522
- } : null,
519
+ } : {
520
+ lat: this.defaultLat,
521
+ lng: this.defaultLng,
522
+ },
523
523
  zoom: this.zoom,
524
524
  zoomControl: true,
525
525
  mapTypeControl: false,
@@ -174,7 +174,6 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
174
174
  //@ts-ignore
175
175
  fileOption(option) {
176
176
  let types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
177
- console.log(option.name, types);
178
177
  return types.length
179
178
  ? this.fileUploader(option, { accept: types.join(',') })
180
179
  : 'File types not selected.';
@@ -159,16 +159,21 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
159
159
  ? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
160
160
  : ""));
161
161
  }
162
+ componentShouldUpdate() {
163
+ if (!this.opened) {
164
+ window.removeEventListener('click', this.onClickOutside);
165
+ }
166
+ }
162
167
  render() {
163
168
  //todo:: reduce class names, they are too long
164
169
  return (h(Host, null, this.inline ?
165
170
  h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))
166
171
  : h("div", { class: { 's-user-menu-wrapper': true, 's-user-menu-relative-dropdown': this.relativeDropdown } }, this.getTheHeader(), h("div", { class: { 's-user-menu-toggler': true, 'opened': this.opened } }, h("div", { class: "s-user-menu-dropdown", onClick: (e) => e.stopPropagation() }, this.showHeader ? h("div", { class: "s-user-menu-dropdown-header" }, h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }), h("div", { class: "s-user-menu-dropdown-header-content" }, h("span", null, this.hello), h("p", null, this.first_name, " ", this.last_name)), h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => this.opened = false })) : '', h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
167
172
  }
168
- componentShouldUpdate() {
169
- if (!this.opened) {
170
- window.removeEventListener('click', this.onClickOutside);
171
- }
173
+ componentDidLoad() {
174
+ var _a;
175
+ //make sure to load the avatar if it's lazy, we use it in Y
176
+ (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update(this.host.querySelectorAll('.lazy'));
172
177
  }
173
178
  get host() { return this; }
174
179
  static get style() { return sallaUserMenuCss; }
@@ -2656,7 +2656,7 @@ const SallaColorPicker = class {
2656
2656
  });
2657
2657
  }
2658
2658
  render() {
2659
- return (h(Host, { class: "s-color-picker-main" }, h("slot", null, h("div", { class: "s-color-picker-widget" }, h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { innerHTML: ArrowDown }))), h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
2659
+ return (h(Host, { class: "s-color-picker-main" }, h("slot", { name: "widget" }, h("div", { class: "s-color-picker-widget" }, h("div", { class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { innerHTML: ArrowDown }))), h("input", { type: "hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
2660
2660
  }
2661
2661
  get host() { return getElement(this); }
2662
2662
  };
@@ -22619,10 +22619,10 @@ const SallaMap = class {
22619
22619
  this.defaultLat = 21.419421; //Mecca 🕋
22620
22620
  this.defaultLng = 39.82553; //Mecca 🕋
22621
22621
  // state variables
22622
- this.modalActivityTitle = 'Activity Location';
22623
- this.confirmButtonTitle = 'Confirm';
22624
- this.locateButtonTitle = 'Locate';
22625
- this.locateButtonEdit = 'Edit';
22622
+ this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
22623
+ this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22624
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
22625
+ this.locateButtonEdit = salla.lang.get('common.elements.edit');
22626
22626
  this.searchInputValue = null;
22627
22627
  this.geolocationError = false;
22628
22628
  /**
@@ -22641,10 +22641,6 @@ const SallaMap = class {
22641
22641
  * Sets the search bar visibility.
22642
22642
  */
22643
22643
  this.searchable = false;
22644
- /**
22645
- * Sets google api key value
22646
- */
22647
- this.apiKey = null;
22648
22644
  /**
22649
22645
  * Modal Title
22650
22646
  */
@@ -22660,9 +22656,10 @@ const SallaMap = class {
22660
22656
  salla.lang.onLoaded(() => {
22661
22657
  this.modalActivityTitle = salla.lang.get('pages.checkout.select_your_address_from_map');
22662
22658
  this.confirmButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22663
- this.locateButtonTitle = salla.lang.get('pages.checkout.confirm_address');
22659
+ this.locateButtonTitle = salla.lang.get('pages.cart.detect_location');
22664
22660
  this.locateButtonEdit = salla.lang.get('common.elements.edit');
22665
22661
  });
22662
+ this.apiKey = 'AIzaSyBPhPJ4KG13ywvmeAovLRnbi7WzlsdcWKs';
22666
22663
  }
22667
22664
  formatAddress(address) {
22668
22665
  return address.length > 25 ? address.substring(0, 25) + '...' : address;
@@ -22688,7 +22685,10 @@ const SallaMap = class {
22688
22685
  center: (this.lat || this.lng) ? {
22689
22686
  lat: this.lat,
22690
22687
  lng: this.lng,
22691
- } : null,
22688
+ } : {
22689
+ lat: this.defaultLat,
22690
+ lng: this.defaultLng,
22691
+ },
22692
22692
  zoom: this.zoom,
22693
22693
  zoomControl: true,
22694
22694
  mapTypeControl: false,
@@ -23469,7 +23469,6 @@ const SallaProductOptions = class {
23469
23469
  //@ts-ignore
23470
23470
  fileOption(option) {
23471
23471
  let types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
23472
- console.log(option.name, types);
23473
23472
  return types.length
23474
23473
  ? this.fileUploader(option, { accept: types.join(',') })
23475
23474
  : 'File types not selected.';
@@ -26802,16 +26801,21 @@ const SallaUserMenu = class {
26802
26801
  ? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
26803
26802
  : ""));
26804
26803
  }
26804
+ componentShouldUpdate() {
26805
+ if (!this.opened) {
26806
+ window.removeEventListener('click', this.onClickOutside);
26807
+ }
26808
+ }
26805
26809
  render() {
26806
26810
  //todo:: reduce class names, they are too long
26807
26811
  return (h(Host, null, this.inline ?
26808
26812
  h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))
26809
26813
  : h("div", { class: { 's-user-menu-wrapper': true, 's-user-menu-relative-dropdown': this.relativeDropdown } }, this.getTheHeader(), h("div", { class: { 's-user-menu-toggler': true, 'opened': this.opened } }, h("div", { class: "s-user-menu-dropdown", onClick: (e) => e.stopPropagation() }, this.showHeader ? h("div", { class: "s-user-menu-dropdown-header" }, h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }), h("div", { class: "s-user-menu-dropdown-header-content" }, h("span", null, this.hello), h("p", null, this.first_name, " ", this.last_name)), h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => this.opened = false })) : '', h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
26810
26814
  }
26811
- componentShouldUpdate() {
26812
- if (!this.opened) {
26813
- window.removeEventListener('click', this.onClickOutside);
26814
- }
26815
+ componentDidLoad() {
26816
+ var _a;
26817
+ //make sure to load the avatar if it's lazy, we use it in Y
26818
+ (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update(this.host.querySelectorAll('.lazy'));
26815
26819
  }
26816
26820
  get host() { return getElement(this); }
26817
26821
  };