@salla.sa/twilight-components 1.0.24 → 1.0.26

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 (34) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-button_5.cjs.entry.js +67 -61
  4. package/dist/cjs/{salla-login-c74587ef.js → salla-login-bf0972bf.js} +29 -19
  5. package/dist/cjs/salla-product-availability.cjs.entry.js +61 -34
  6. package/dist/cjs/salla-rating.cjs.entry.js +3 -3
  7. package/dist/cjs/twilight-components.cjs.js +1 -1
  8. package/dist/collection/components/salla-login/salla-login.js +35 -25
  9. package/dist/collection/components/salla-product-availability/salla-product-availability.js +78 -234
  10. package/dist/collection/components/salla-rating/salla-rating.js +3 -3
  11. package/dist/collection/components/salla-tel-input/salla-tel-input.js +39 -39
  12. package/dist/collection/components/salla-verify/salla-verify.js +38 -27
  13. package/dist/esm/index.js +1 -1
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/salla-button_5.entry.js +67 -61
  16. package/dist/esm/{salla-login-d08f0d7e.js → salla-login-fcb7ad15.js} +29 -19
  17. package/dist/esm/salla-product-availability.entry.js +61 -34
  18. package/dist/esm/salla-rating.entry.js +3 -3
  19. package/dist/esm/twilight-components.js +1 -1
  20. package/dist/twilight-components/index.esm.js +1 -1
  21. package/dist/twilight-components/p-13855688.js +1 -0
  22. package/dist/twilight-components/{p-e6a3a0dc.entry.js → p-6d5f0951.entry.js} +1 -1
  23. package/dist/twilight-components/p-8cce4c31.entry.js +1 -0
  24. package/dist/twilight-components/p-b4e1d032.entry.js +1 -0
  25. package/dist/twilight-components/twilight-components.esm.js +1 -1
  26. package/dist/types/components/salla-login/salla-login.d.ts +3 -3
  27. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +10 -8
  28. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +4 -2
  29. package/dist/types/components/salla-verify/salla-verify.d.ts +2 -1
  30. package/dist/types/components.d.ts +3 -24
  31. package/package.json +1 -1
  32. package/dist/twilight-components/p-1918a33c.js +0 -1
  33. package/dist/twilight-components/p-22f06d26.entry.js +0 -1
  34. package/dist/twilight-components/p-7fe5d346.entry.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const sallaLogin = require('./salla-login-c74587ef.js');
5
+ const sallaLogin = require('./salla-login-bf0972bf.js');
6
6
  const sallaSearch = require('./salla-search-eb0112c0.js');
7
7
  require('./index-714023c8.js');
8
8
  require('./Helper-fcea994c.js');
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"isEmailValid":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameRequired":[32],"lastNameRequired":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"phone":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"mobileRequired":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
17
+ return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"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],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"countryCodeLabel":[32],"mobileRequired":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subscribeText":[32],"cancelText":[32],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"buttonText":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-714023c8.js');
6
6
  const Helper = require('./Helper-fcea994c.js');
7
- const sallaLogin = require('./salla-login-c74587ef.js');
7
+ const sallaLogin = require('./salla-login-bf0972bf.js');
8
8
 
9
9
  const sallaButtonCss = ":host{display:block}";
10
10
 
@@ -1574,21 +1574,22 @@ const SallaTelInput = class {
1574
1574
  Helper.Helper.setHost(this.host);
1575
1575
  salla.event.on('languages::translations.loaded', () => {
1576
1576
  this.mobileLabel = salla.lang.get('common.elements.mobile');
1577
+ this.countryCodeLabel = salla.lang.get('common.country_code');
1577
1578
  this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
1578
- this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
1579
+ this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
1579
1580
  this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
1580
1581
  this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });
1581
1582
  this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });
1583
+ this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
1582
1584
  });
1583
1585
  }
1584
1586
  async getValues() {
1585
- this.phone = this.phoneInput.value;
1587
+ this.mobile = this.phoneInput.value;
1586
1588
  this.countryCode = this.countryCodeInput.value;
1587
1589
  this.countryKey = this.countryKeyInput.value;
1588
- return { phone: this.phoneInput.value, countryCode: this.countryCodeInput.value, countryKey: this.countryKeyInput.value };
1590
+ return { mobile: this.phoneInput.value, countryCode: this.countryCodeInput.value, countryKey: this.countryKeyInput.value };
1589
1591
  }
1590
1592
  async isValid() {
1591
- const errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
1592
1593
  this.reset();
1593
1594
  if (this.iti.isValidNumber())
1594
1595
  return true;
@@ -1599,40 +1600,37 @@ const SallaTelInput = class {
1599
1600
  }
1600
1601
  this.phoneInput.classList.add("s-has-error");
1601
1602
  let errorCode = this.iti.getValidationError();
1602
- this.errorMsg.innerText = errorMap[errorCode] || '';
1603
+ this.errorMsg.innerText = this.errorMap[errorCode] || '';
1603
1604
  return false;
1604
1605
  }
1605
1606
  initTelInput() {
1606
- this.host.querySelectorAll('.tel-input').forEach((intlInput) => {
1607
- salla.helpers.digitsOnly(intlInput);
1608
- this.iti = intlTelInput(intlInput, {
1609
- initialCountry: intlInput.dataset.code || 'sa',
1610
- preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'sy', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],
1611
- formatOnDisplay: false,
1612
- separateDialCode: true,
1613
- autoPlaceholder: 'aggressive',
1614
- utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
1615
- });
1616
- intlInput.addEventListener("countrychange", () => {
1617
- let data = this.iti.getSelectedCountryData();
1618
- this.host.querySelectorAll('.country_code').forEach((input) => input.value = data.iso2.toUpperCase());
1619
- this.host.querySelectorAll('.country_key').forEach((input) => {
1620
- input.value = ('+' + data.dialCode).replace('++', '+');
1621
- });
1622
- });
1623
- // on blur: validate
1624
- intlInput.addEventListener('blur', () => {
1625
- this.isValid();
1626
- });
1627
- // on keyup / change flag: reset
1628
- // this.phoneInput.addEventListener('change', () => this.reset());
1629
- salla.document.event.onKeyup('.tel-input', e => {
1630
- if (e.key == 'Enter')
1631
- return;
1632
- salla.helpers.digitsOnly(e.target);
1633
- this.reset();
1607
+ salla.helpers.digitsOnly(this.phoneInput);
1608
+ this.iti = intlTelInput(this.phoneInput, {
1609
+ initialCountry: this.countryCode || 'sa',
1610
+ preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'sy', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],
1611
+ formatOnDisplay: false,
1612
+ separateDialCode: true,
1613
+ autoPlaceholder: 'aggressive',
1614
+ utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
1615
+ });
1616
+ this.phoneInput.addEventListener("countrychange", () => {
1617
+ let data = this.iti.getSelectedCountryData();
1618
+ this.host.querySelectorAll('.country_code').forEach((input) => input.value = data.iso2.toUpperCase());
1619
+ this.host.querySelectorAll('.country_key').forEach((input) => {
1620
+ input.value = ('+' + data.dialCode).replace('++', '+');
1634
1621
  });
1635
1622
  });
1623
+ // on blur: validate
1624
+ this.phoneInput.addEventListener('blur', () => {
1625
+ this.isValid();
1626
+ });
1627
+ // on keyup / change flag: reset
1628
+ this.phoneInput.addEventListener('keyup', e => {
1629
+ if (e.key == 'Enter')
1630
+ return;
1631
+ salla.helpers.digitsOnly(e.target);
1632
+ this.reset();
1633
+ });
1636
1634
  }
1637
1635
  reset() {
1638
1636
  this.phoneInput.classList.remove("s-has-error");
@@ -1640,7 +1638,7 @@ const SallaTelInput = class {
1640
1638
  }
1641
1639
  ;
1642
1640
  render() {
1643
- return (index.h(index.Host, null, index.h("input", { type: "tel", name: "mobile", "data-code": this.countryCode, value: this.phone, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" }), index.h("input", { type: "hidden", name: "country_key", value: this.countryKey, ref: el => this.countryKeyInput = el, class: "country_key" })));
1641
+ return (index.h(index.Host, null, index.h("input", { type: "tel", name: "mobile", value: this.mobile, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" }), index.h("input", { type: "hidden", name: "country_key", value: this.countryKey, ref: el => this.countryKeyInput = el, class: "country_key" })));
1644
1642
  }
1645
1643
  componentDidLoad() {
1646
1644
  this.initTelInput();
@@ -1655,6 +1653,7 @@ const SallaVerify = class {
1655
1653
  this.backClicked = index.createEvent(this, "backClicked", 7);
1656
1654
  this.by = 'sms';
1657
1655
  this.autoReload = true;
1656
+ this.initiated = false;
1658
1657
  Helper.Helper.setHost(this.host);
1659
1658
  if (this.withoutModal) {
1660
1659
  this.modal = { show: () => '', hide: () => '' };
@@ -1665,38 +1664,45 @@ const SallaVerify = class {
1665
1664
  this.show(data);
1666
1665
  });
1667
1666
  }
1667
+ salla.event.on('languages::translations.loaded', () => {
1668
+ this.title = salla.lang.get('pages.profile.verify_title');
1669
+ });
1668
1670
  }
1669
1671
  async getCode() {
1670
1672
  return this.code.value;
1671
1673
  }
1672
- componentDidLoad() {
1673
- Helper.Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
1674
- Helper.Helper.onKeyUp('.s-verify-input', event => {
1675
- var _a, _b, _c, _d;
1676
- let key = event.keyCode || event.charCode;
1677
- if (event.target.value) {
1678
- (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
1679
- (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
1680
- }
1681
- else if ([8, 46].includes(key)) {
1682
- (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
1683
- (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
1684
- }
1685
- this.toggleOTPSubmit();
1686
- });
1687
- Helper.Helper.on('paste', '.s-verify-input', event => {
1688
- let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
1689
- this.otpInputs.forEach((input, i) => input.value = text[i] || '');
1690
- this.toggleOTPSubmit();
1691
- setTimeout(() => this.otpInputs[3].focus(), 100);
1692
- });
1693
- return this.modal.show();
1694
- }
1695
1674
  async show(data) {
1675
+ var _a;
1696
1676
  this.data = data;
1697
1677
  this.resendTimer();
1698
- this.otpInputs = document.querySelectorAll('.s-verify-input');
1678
+ this.otpInputs = this.host.querySelectorAll('.s-verify-input');
1679
+ if (!this.initiated) {
1680
+ Helper.Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
1681
+ Helper.Helper.onKeyUp('.s-verify-input', event => {
1682
+ var _a, _b, _c, _d;
1683
+ let key = event.keyCode || event.charCode;
1684
+ if (event.target.value) {
1685
+ (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
1686
+ (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
1687
+ }
1688
+ else if ([8, 46].includes(key)) {
1689
+ (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
1690
+ (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
1691
+ }
1692
+ this.toggleOTPSubmit();
1693
+ });
1694
+ Helper.Helper.on('paste', '.s-verify-input', event => {
1695
+ let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
1696
+ this.otpInputs.forEach((input, i) => input.value = text[i] || '');
1697
+ this.toggleOTPSubmit();
1698
+ setTimeout(() => this.otpInputs[3].focus(), 100);
1699
+ });
1700
+ // return this.modal.show();
1701
+ this.initiated = true;
1702
+ }
1699
1703
  this.reset();
1704
+ !this.withoutModal && ((_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title));
1705
+ this.modal.show();
1700
1706
  }
1701
1707
  toggleOTPSubmit() {
1702
1708
  let otp = [];
@@ -1754,7 +1760,7 @@ const SallaVerify = class {
1754
1760
  }
1755
1761
  render() {
1756
1762
  return this.withoutModal ? this.myBody() :
1757
- index.h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, this.myBody());
1763
+ index.h("salla-modal", { icon: "sicon-android-phone", width: "xs", id: "s-verify", ref: modal => this.modal = modal, title: this.title }, this.myBody());
1758
1764
  }
1759
1765
  myBody() {
1760
1766
  return [
@@ -1762,7 +1768,7 @@ const SallaVerify = class {
1762
1768
  // <label class="s-verify-label">{salla.lang.get('pages.profile.verify_placeholder')}</label>,
1763
1769
  index.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
1764
1770
  index.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
1765
- index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')), this.isShowBack ?
1771
+ index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')), this.isShowBack ?
1766
1772
  index.h("a", { href: "#", class: "s-verify-back", onClick: () => this.backClicked.emit() }, index.h("i", { class: "sicon-arrow-right" }))
1767
1773
  : '')
1768
1774
  ];
@@ -17,21 +17,21 @@ const SallaLogin = class {
17
17
  e.key == 'Enter' && submitMethod();
18
18
  };
19
19
  this.loginBySMS = async () => {
20
- const { phone, countryCode } = await this.loginTelInput.getValues();
20
+ const { mobile, countryCode } = await this.loginTelInput.getValues();
21
21
  const isPhoneValid = await this.loginTelInput.isValid();
22
22
  if (!isPhoneValid)
23
23
  return;
24
24
  this.smsBtn.load()
25
25
  .then(() => this.smsBtn.disable())
26
- .then(() => salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode }))
26
+ .then(() => salla.auth.api.login({ type: 'mobile', phone: mobile, country_code: countryCode }))
27
27
  .then(() => this.smsBtn.stop() && this.smsBtn.enable())
28
28
  .then(() => this.showTab(this.verifyTab))
29
- .then(() => this.verifyTab.by = 'sms')
30
- .then(() => this.verifyTab.show({ phone: phone, country_code: countryCode }));
29
+ .then(() => (this.verifyTab.by = 'sms') && (this.verifyTab.url = 'auth/mobile/verify'))
30
+ .then(() => this.verifyTab.show({ phone: mobile, country_code: countryCode }));
31
31
  };
32
32
  this.loginByEmail = () => {
33
33
  if (!Helper.Helper.isValidEmail(this.loginEmail.value)) {
34
- this.validateField(this.loginEmail, this.isEmailValid);
34
+ this.validateField(this.loginEmail, this.emailErrorMsg);
35
35
  return;
36
36
  }
37
37
  this.emailBtn.load()
@@ -43,7 +43,7 @@ const SallaLogin = class {
43
43
  .then(() => this.verifyTab.show({ email: this.loginEmail.value }));
44
44
  };
45
45
  this.newUser = async () => {
46
- const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
46
+ const { mobile: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
47
47
  await this.newUserValidation();
48
48
  await this.regBtn.load();
49
49
  await this.regBtn.disable();
@@ -51,7 +51,7 @@ const SallaLogin = class {
51
51
  .then(code => salla.auth.api.register({
52
52
  first_name: this.firstName.value,
53
53
  last_name: this.lastName.value,
54
- phone: regPhone || this.loginTelInput.phone,
54
+ phone: regPhone || this.loginTelInput.mobile,
55
55
  email: this.regEmail.value || this.loginEmail.value,
56
56
  country_code: countryCode,
57
57
  country_key: countryKey,
@@ -64,6 +64,7 @@ const SallaLogin = class {
64
64
  this.title = this.host.title || salla.lang.get('blocks.header.login');
65
65
  this.host.removeAttribute('title');
66
66
  salla.event.on('languages::translations.loaded', () => {
67
+ var _a;
67
68
  this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
68
69
  this.loginText = salla.lang.get('blocks.header.login');
69
70
  this.smsLabel = salla.lang.get('blocks.header.sms');
@@ -73,15 +74,18 @@ const SallaLogin = class {
73
74
  this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
74
75
  this.byEmailText = salla.lang.get('blocks.header.login_by_email');
75
76
  this.title = salla.lang.get('blocks.header.login');
76
- this.isEmailValid = salla.lang.get('common.elements.email_is_valid');
77
+ this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
77
78
  this.firstNameLabel = salla.lang.get('blocks.header.your_name');
78
79
  this.lastNameLabel = salla.lang.get('pages.profile.last_name');
79
- this.firstNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
80
- this.lastNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
80
+ this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
81
+ this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
82
+ (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
83
+ this.showTab(this.isEmailAllowed ? this.homeTab : this.mobileTab);
81
84
  });
82
85
  salla.auth.event.onVerificationFailed(() => {
83
86
  //
84
87
  });
88
+ salla.event.on('login::show', () => this.show());
85
89
  }
86
90
  /**
87
91
  * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
@@ -112,16 +116,21 @@ const SallaLogin = class {
112
116
  return this.modal.show();
113
117
  }
114
118
  showTab(tab, evt) {
119
+ var _a, _b;
115
120
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
116
121
  [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
117
- setTimeout(() => { [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
118
- setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
122
+ setTimeout(() => {
123
+ [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab));
124
+ }, 200);
125
+ setTimeout(() => {
126
+ this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px');
127
+ });
119
128
  if ([this.mobileTab, this.emailTab].includes(tab)) {
120
129
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
121
130
  }
122
131
  let isRegistrationTab = tab == this.registrationTab;
123
- isRegistrationTab && this.firstName.focus();
124
- this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
132
+ isRegistrationTab && ((_a = this.firstName) === null || _a === void 0 ? void 0 : _a.focus());
133
+ (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
125
134
  if (!isRegistrationTab) {
126
135
  Helper.Helper.toggleElement(this.regMobileBlock, 's-hidden', 's-block', () => this.regType === 'phone')
127
136
  .toggleElement(this.regEmailBlock, 's-hidden', 's-block', () => this.regType === 'email');
@@ -132,9 +141,9 @@ const SallaLogin = class {
132
141
  const isPhoneReg = this.regType == "phone", isEmailReg = this.regType == "email", isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isEmailValid = Helper.Helper.isValidEmail(this.regEmail.value || isEmailReg && this.loginEmail.value), isPhoneValid = await this.regTelInput.isValid() || isPhoneReg && await this.loginTelInput.isValid();
133
142
  if (isEmailValid && isPhoneValid && isFirstNameValid && isLastNameValid)
134
143
  return;
135
- !isEmailValid && this.validateField(this.regEmail, this.isEmailValid);
136
- !isFirstNameValid && this.validateField(this.firstName, this.firstNameRequired);
137
- !isLastNameValid && this.validateField(this.lastName, this.lastNameRequired);
144
+ !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
145
+ !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);
146
+ !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);
138
147
  throw ('Please insert required fields');
139
148
  }
140
149
  validateField(field, errorMsg) {
@@ -144,8 +153,9 @@ const SallaLogin = class {
144
153
  render() {
145
154
  return (index.h("salla-modal", { id: "salla-login", icon: "sicon-user", title: this.title, ref: modal => this.modal = modal, width: "xs" }, index.h("div", { class: "s-login-wrapper" }, this.isEmailAllowed ?
146
155
  index.h("div", { class: "s-login-tab", ref: tab => this.homeTab = tab }, index.h("p", { class: "s-login-sub-title" }, this.loginTypeTitle), index.h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, index.h("i", { class: "s-login-main-btn-icon sicon-phone" }), index.h("span", { class: "s-login-main-btn-text" }, this.smsLabel), index.h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), index.h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, index.h("i", { class: "s-login-main-btn-icon sicon-mail" }), index.h("span", { class: "s-login-main-btn-text" }, this.emailLabel), index.h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })))
147
- : '', index.h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), index.h("salla-button", { wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, this.enterText), this.isEmailAllowed ? index.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : ''), this.isEmailAllowed ?
148
- index.h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e, this.loginByEmail), placeholder: "your@email.com", class: "s-login-input s-ltr" }), index.h("span", { class: "s-login-error-message" }), index.h("salla-button", { wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText), index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText)) : '', index.h("salla-verify", { "without-modal": true, ref: tab => this.verifyTab = tab, autoReload: false, "is-show-back": true }), index.h("div", { ref: tab => this.registrationTab = tab }, index.h("label", { class: "s-login-label" }, this.firstNameLabel), index.h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), index.h("span", { class: "s-login-error-message" }), index.h("label", { class: "s-login-label" }, this.lastNameLabel), index.h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), index.h("span", { class: "s-login-error-message" }), index.h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { phone: '', ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), index.h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-input s-ltr" }), index.h("span", { class: "s-login-error-message" })), index.h("salla-button", { wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
156
+ : '', index.h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), index.h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, this.enterText), this.isEmailAllowed ?
157
+ index.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : ''), this.isEmailAllowed ?
158
+ index.h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e, this.loginByEmail), placeholder: "your@email.com", class: "s-login-input s-ltr" }), index.h("span", { class: "s-login-error-message" }), index.h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText), index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText)) : '', index.h("salla-verify", { "without-modal": true, ref: tab => this.verifyTab = tab, autoReload: false, "is-show-back": true }), index.h("div", { ref: tab => this.registrationTab = tab }, index.h("label", { class: "s-login-label" }, this.firstNameLabel), index.h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), index.h("span", { class: "s-login-error-message" }), index.h("label", { class: "s-login-label" }, this.lastNameLabel), index.h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), index.h("span", { class: "s-login-error-message" }), index.h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), index.h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-input s-ltr" }), index.h("span", { class: "s-login-error-message" })), index.h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
149
159
  }
150
160
  get host() { return index.getElement(this); }
151
161
  };
@@ -9,62 +9,89 @@ const SallaProductAvailability = class {
9
9
  constructor(hostRef) {
10
10
  index.registerInstance(this, hostRef);
11
11
  this.isUser = Helper.Helper.isUser();
12
- this.buttonText = salla.lang.get('pages.products.notify_availability');
13
- this.countryCode = salla.config.country_code || 'SA';
14
- this.subscribeText = salla.lang.get('common.elements.submit');
15
- this.cancelText = salla.lang.get('common.elements.cancel');
16
- this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
17
- this.mobileLabel = salla.lang.get('common.elements.mobile');
18
- this.emailLabel = salla.lang.get('common.elements.email');
19
- this.mobilePlaceholder = salla.lang.get('common.elements.mobile_placeholder');
20
- this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
21
- this.productId = salla.config.page.id;
22
- this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
12
+ this.productId = salla.get('page.id');
23
13
  this.isSubscribed = false;
14
+ // @Method()
15
+ this.submit = async () => {
16
+ if (this.isUser) {
17
+ return salla.api.product.availabilitySubscribe(this.productId)
18
+ .then(() => this.isSubscribed = true);
19
+ }
20
+ let { mobile, countryCode } = await this.mobileInput.getValues(), data = { id: this.productId, country_code: countryCode };
21
+ mobile !== '' && (data['mobile'] = mobile);
22
+ this.email.value !== '' && (data['email'] = this.email.value);
23
+ await this.validateform({ mobile: mobile, email: this.email.value });
24
+ return this.btn.load()
25
+ .then(() => this.btn.disable())
26
+ .then(() => salla.api.product.availabilitySubscribe(data))
27
+ .then(() => this.isSubscribed = true) //no need to wait until finishing alert animation
28
+ .then(() => this.btn.stop())
29
+ .then(() => this.modal.hide())
30
+ .catch(() => this.btn.stop() && this.btn.enable());
31
+ };
32
+ // helpers
33
+ this.typing = (e, submitMethod) => {
34
+ const error = e.target.nextElementSibling;
35
+ e.target.classList.remove('s-has-error');
36
+ (error === null || error === void 0 ? void 0 : error.classList.contains('s-product-availability-error-msg')) && (error.innerText = '');
37
+ e.key == 'Enter' && submitMethod();
38
+ };
24
39
  if (this.isUser) {
25
40
  return;
26
41
  }
27
42
  this.channelsWatcher(this.channels);
28
43
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
29
44
  this.host.removeAttribute('title');
45
+ salla.event.on('languages::translations.loaded', () => {
46
+ var _a;
47
+ this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
48
+ this.subscribeText = salla.lang.get('common.elements.submit');
49
+ this.cancelText = salla.lang.get('common.elements.cancel');
50
+ this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
51
+ this.mobileLabel = salla.lang.get('common.elements.mobile');
52
+ this.emailLabel = salla.lang.get('common.elements.email');
53
+ this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
54
+ this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
55
+ this.buttonText = salla.lang.get('pages.products.notify_availability');
56
+ this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
57
+ (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
58
+ });
30
59
  }
31
60
  channelsWatcher(newValue) {
32
61
  this.channels_ = newValue.split(',');
33
62
  }
34
- async submit() {
35
- if (this.isUser) {
36
- return salla.api.product.availabilitySubscribe(this.productId)
37
- .then(() => this.isSubscribed = true);
38
- }
39
- let data = { id: this.productId, country_code: this.countryCode };
40
- if (this.mobile.value !== '') {
41
- data['mobile'] = this.mobile.value;
63
+ async validateform(data) {
64
+ if (this.channels_.includes('email') && !data.mobile) {
65
+ const isEmailValid = Helper.Helper.isValidEmail(this.email.value);
66
+ if (isEmailValid)
67
+ return;
68
+ !isEmailValid && this.validateField(this.email, this.emailErrorMsg);
42
69
  }
43
- if (this.email.value !== '') {
44
- data['email'] = this.email.value;
70
+ if (this.channels_.includes('sms') && !data.email) {
71
+ const isPhoneValid = await this.mobileInput.isValid();
72
+ if (isPhoneValid)
73
+ return;
45
74
  }
46
- return this.btn.load()
47
- .then(() => this.btn.disable())
48
- .then(() => salla.api.product.availabilitySubscribe(data))
49
- .then(() => this.isSubscribed = true) //no need to wait until finishing alert animation
50
- .then(() => this.btn.stop())
51
- .then(() => this.modal.hide())
52
- .catch(() => this.btn.stop() && this.btn.enable());
75
+ throw ('Please insert required fields');
76
+ }
77
+ validateField(field, errorMsg) {
78
+ field.classList.add('s-has-error');
79
+ field.nextElementSibling['innerText'] = '* ' + errorMsg;
53
80
  }
54
81
  render() {
55
82
  return (index.h(index.Host, null, this.isSubscribed
56
- ? index.h("div", { class: "s-product-availability-subscribed" }, this.subscribedMessage)
83
+ ? index.h("div", { class: "s-product-availability-subscribed" }, index.h("i", { class: "sicon-bell-ring s-product-availability-subs-icon" }), " ", this.subscribedMessage)
57
84
  : index.h("slot", null, index.h("salla-button", { wide: true, onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)), this.isUser || this.isSubscribed ? '' : this.renderModal()));
58
85
  }
59
86
  renderModal() {
60
- return (index.h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "md" }, index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
87
+ return (index.h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "sm" }, index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
61
88
  index.h("label", { class: "s-product-availability-label" }, this.emailLabel),
62
- index.h("input", { class: "s-product-availability-input", placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" })
89
+ index.h("input", { class: "s-product-availability-input", onKeyDown: e => this.typing(e, this.submit), placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" }),
90
+ index.h("span", { class: "s-product-availability-error-msg" })
63
91
  ] : '', this.channels_.includes('sms') ? [
64
92
  index.h("label", { class: "s-product-availability-label" }, this.mobileLabel),
65
- index.h("input", { class: "s-product-availability-input", placeholder: this.mobilePlaceholder, ref: el => this.mobile = el, type: "text" }),
66
- index.h("input", { type: "hidden", value: this.countryCode }),
67
- ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText), index.h("salla-button", { wide: true, "btn-style": "outline" }, this.cancelText))));
93
+ index.h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
94
+ ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide() }, this.cancelText), index.h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText))));
68
95
  }
69
96
  get host() { return index.getElement(this); }
70
97
  static get watchers() { return {
@@ -18,7 +18,7 @@ const SallaRating = class {
18
18
  }
19
19
  async show() {
20
20
  return this.modal.show()
21
- .then(() => salla.feedback.api.order(salla.get('page.id')))
21
+ .then(() => salla.feedback.api.order(salla.config.get('page.id')))
22
22
  .then(res => this.order = res.data)
23
23
  .then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
24
24
  .then(() => this.modal.stopLoading())
@@ -150,7 +150,7 @@ const SallaRating = class {
150
150
  if (Object.keys(data).length == 0) {
151
151
  return;
152
152
  }
153
- data['order_id'] = salla.get('page.id');
153
+ data['order_id'] = salla.config.get('page.id');
154
154
  data['type'] = this.currentTab.dataset.type;
155
155
  this.submitted.push(this.currentIndex);
156
156
  return salla.feedback.api[this.currentTab.dataset.type](data);
@@ -176,7 +176,7 @@ const SallaRating = class {
176
176
  render() {
177
177
  return (index.h(index.Host, null, index.h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal }, this.order
178
178
  ? [index.h("div", { class: "s-rating-wrapper", ref: el => this.body = el }, this.order.testimonials_enabled ?
179
- index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" }, index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: salla.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })), index.h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')), index.h("div", { class: "s-rating-stars-company" }, " ", this.renderRatingStars('large')), index.h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), index.h("small", { class: "s-rating-validation-msg" }))
179
+ index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" }, index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: salla.config.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })), index.h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')), index.h("div", { class: "s-rating-stars-company" }, " ", this.renderRatingStars('large')), index.h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), index.h("small", { class: "s-rating-validation-msg" }))
180
180
  : '', this.order.products_enabled
181
181
  ? index.h("section", { class: "s-rating-step s-rating-hidden", "data-type": "products" }, this.order.products.map((item, index$1) => index.h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, index.h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-product-img" }), index.h("div", { class: "s-rating-product-details" }, index.h("h3", { class: "s-rating-product-title" }, " ", item.product.name), index.h("div", { class: "s-rating-stars-product" }, " ", this.renderRatingStars('small', `products[${index$1}][rating]`)), index.h("input", { type: "hidden", name: `products[${index$1}][product_id]`, value: item.product.id }), index.h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index$1}][comment]`, class: "s-rating-comment" }), index.h("small", { class: "s-rating-validation-msg" })))))
182
182
  : '', this.order.shipping_enabled
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"isEmailValid":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameRequired":[32],"lastNameRequired":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"phone":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"mobileRequired":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
18
+ return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"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],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"countryCodeLabel":[32],"mobileRequired":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subscribeText":[32],"cancelText":[32],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"buttonText":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
19
19
  });