@salla.sa/twilight-components 2.13.28 → 2.13.30

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 (46) hide show
  1. package/dist/cjs/{app-globals-cdf64ffe.js → app-globals-84686963.js} +2 -2
  2. package/dist/cjs/app-globals-84686963.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/salla-add-product-button_47.cjs.entry.js +3 -5
  5. package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
  6. package/dist/cjs/twilight.cjs.js +1 -1
  7. package/dist/collection/components/salla-login-modal/salla-login-modal.js.map +1 -1
  8. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +3 -5
  9. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js.map +1 -1
  10. package/dist/components/index.js +1 -1
  11. package/dist/components/index.js.map +1 -1
  12. package/dist/components/salla-login-modal.js.map +1 -1
  13. package/dist/components/salla-quick-buy2.js +3 -5
  14. package/dist/components/salla-quick-buy2.js.map +1 -1
  15. package/dist/esm/{app-globals-d4f3f915.js → app-globals-2f2a1ec6.js} +2 -2
  16. package/dist/esm/app-globals-2f2a1ec6.js.map +1 -0
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/salla-add-product-button_47.entry.js +3 -5
  19. package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
  20. package/dist/esm/twilight.js +1 -1
  21. package/dist/esm-es5/{app-globals-d4f3f915.js → app-globals-2f2a1ec6.js} +2 -2
  22. package/dist/esm-es5/app-globals-2f2a1ec6.js.map +1 -0
  23. package/dist/esm-es5/loader.js +1 -1
  24. package/dist/esm-es5/salla-add-product-button_47.entry.js +1 -1
  25. package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
  26. package/dist/esm-es5/twilight.js +1 -1
  27. package/dist/twilight/{p-0ed91e2a.system.entry.js → p-5a94bb54.system.entry.js} +2 -2
  28. package/dist/twilight/p-5a94bb54.system.entry.js.map +1 -0
  29. package/dist/twilight/{p-6e94a792.system.js → p-7a7b7586.system.js} +4 -4
  30. package/dist/twilight/p-7a7b7586.system.js.map +1 -0
  31. package/dist/twilight/{p-69245750.system.js → p-94e677f8.system.js} +2 -2
  32. package/dist/twilight/{p-9c38d0c5.entry.js → p-969c63dc.entry.js} +2 -2
  33. package/dist/twilight/p-969c63dc.entry.js.map +1 -0
  34. package/dist/twilight/{p-07c67c7a.js → p-d143d160.js} +2 -2
  35. package/dist/twilight/p-d143d160.js.map +1 -0
  36. package/dist/twilight/twilight.esm.js +1 -1
  37. package/dist/twilight/twilight.js +1 -1
  38. package/package.json +5 -5
  39. package/dist/cjs/app-globals-cdf64ffe.js.map +0 -1
  40. package/dist/esm/app-globals-d4f3f915.js.map +0 -1
  41. package/dist/esm-es5/app-globals-d4f3f915.js.map +0 -1
  42. package/dist/twilight/p-07c67c7a.js.map +0 -1
  43. package/dist/twilight/p-0ed91e2a.system.entry.js.map +0 -1
  44. package/dist/twilight/p-6e94a792.system.js.map +0 -1
  45. package/dist/twilight/p-9c38d0c5.entry.js.map +0 -1
  46. /package/dist/twilight/{p-69245750.system.js.map → p-94e677f8.system.js.map} +0 -0
@@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index = require('./index-44391cfe.js');
9
- const appGlobals = require('./app-globals-cdf64ffe.js');
9
+ const appGlobals = require('./app-globals-84686963.js');
10
10
  require('./_commonjsHelpers-691dd63b.js');
11
11
 
12
12
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"salla-login-modal.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/salla-login-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,qDAAqD;AACrD,o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,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,EAAC,IAAI,IACrG,IAAI,CAAC,WAAW,EAAE,CACP,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Listen, Method, Prop, State } from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\n//import PhoneIcon from \"../../assets/svg/phone.svg\";\n//import EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\n//import KeyboardArrowRightIcon from \"../../assets/svg/keyboard_arrow_right.svg\";\nimport ArrowRightIcon from \"../../assets/svg/arrow-right.svg\";\nimport Helper from '../../Helpers/Helper';\nimport { CustomField, CustomFieldType } from './intefaces';\n\n/**\n * @slot footer - The footer of modal\n * @slot before-login-type - placeholder position\n * @slot after-login-type - placeholder position\n * @slot before-login-mobile - placeholder position\n * @slot after-login-mobile - placeholder position\n * @slot before-login-email - placeholder position\n * @slot after-login-email - placeholder position\n * @slot before-registration - placeholder position\n * @slot after-registration - placeholder position\n */\n@Component({\n tag: 'salla-login-modal',\n styleUrl: 'salla-login-modal.scss'\n})\n\n\nexport class SallaLoginModal {\n constructor() {\n\n this.title = this.host.title || salla.lang.get('blocks.header.login');\n this.host.removeAttribute('title');\n\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('blocks.header.login');\n this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');\n this.browseFromFiles = salla.lang.get('common.uploader.browse');\n this.updateTranslations();\n });\n\n salla.event.on('login::open', (data) => {\n if (!this.isEmailAllowed && !this.isMobileAllowed) {\n salla.logger.warn('Please enable atleast one login type to use this component.');\n return;\n }\n this.withoutReload = data?.withoutReload ?? this.withoutReload;\n this.isModalOpen = true\n this.open(data)\n });\n salla.onReady(() => {\n this.isEmailAllowed = salla.config.get('store.settings.auth.email_allowed', this.isEmailAllowed);\n this.isMobileAllowed = salla.config.get('store.settings.auth.mobile_allowed', this.isMobileAllowed);\n this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', this.isEmailRequired);\n });\n }\n\n @Element() host: HTMLElement;\n /**\n * Does the merchant allow to login using email\n */\n @Prop({ mutable: true }) isEmailAllowed: boolean;\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop({ mutable: true }) isMobileAllowed: boolean = true;\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop({ mutable: true }) isEmailRequired: boolean = false;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop({ reflect: true }) supportWebAuth: boolean = true;\n\n /**\n * Display the login inline\n */\n @Prop({ reflect: true }) inline: boolean;\n\n\n /**\n * Reload after a successful login\n */\n @Prop() withoutReload: boolean = false;\n\n private modal: HTMLSallaModalElement;\n //private homeTab: HTMLDivElement;\n private mobileTab: HTMLDivElement;\n private emailTab: HTMLDivElement;\n private verifyTab: HTMLSallaVerifyElement;\n private registrationTab: HTMLDivElement;\n private regTelInput: HTMLSallaTelInputElement;\n private regEmail: HTMLInputElement;\n private customFieldsWrapper: HTMLDivElement;\n private loginTelInput: HTMLSallaTelInputElement;\n private loginEmail: HTMLInputElement;\n private firstName: HTMLInputElement;\n private lastName: HTMLInputElement;\n private smsBtn: HTMLSallaButtonElement;\n private emailBtn: HTMLSallaButtonElement;\n private regBtn: HTMLSallaButtonElement;\n\n @State() currentTabName = 'home'\n @State() regType: 'phone' | 'email' = 'phone';\n\n\n @State() translationLoaded: boolean = false;\n @State() isModalOpen = false\n @State() currentPhone: string = '';\n @State() currentEmail: string = '';\n @State() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: string;\n @State() hasError: boolean;\n @State() errorMessage: string;\n\n @State() dragAndDrop: string = salla.lang.get('common.uploader.drag_and_drop');\n @State() browseFromFiles: string = salla.lang.get('common.uploader.browse');\n @State() customFields: CustomField[] = [];\n\n private customFieldsValues: Object = {};\n @State() uploadedImage: string = undefined;\n\n @Listen('verified', { target: 'window' })\n /**\n * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event\n */\n onVerified(event) {\n salla.log('verified', event);\n //there is a case when force login is activated & is new user, it will return case inside error key., so cover it.\n let verifyCase = event.detail?.data.case || event.detail?.error.case;\n if (!verifyCase) {\n salla.log('verified but without case!');\n return;\n }\n\n if (verifyCase === \"new_customer\") {\n this.customFields = event.detail?.data?.custom_fields || [];\n return this.showTab(this.registrationTab);\n }\n\n if (!salla.auth.canRedirect()) {\n salla.log('Will not auto redirect or reload, due to `salla.auth.canRedirect()`');\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n \n return;\n }\n\n if (event.detail.data.redirect_url) {\n return window.location.href = event.detail.data.redirect_url;\n }\n\n /**\n * we don't want to reload the page if this is not web auth\n * because we'll need the token in the page itself and its there\n * todo :: store the user data in storage for non-web auth and set the config.user from it\n */\n if (this.supportWebAuth && !this.withoutReload) {\n window.location.reload();\n } else {\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n }\n }\n\n updateTranslations() {\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n if (this.inline) {\n return;\n }\n this.modal?.setTitle(this.title);\n }\n componentDidLoad() {\n if (this.inline) {\n this.getSelectedTab()\n }\n }\n /**\n * Open login component\n */\n @Method()\n // @ts-ignore\n async open(event = null) {\n // todo :: support change the settings from event details\n // if(event && event.hasOwnProperty('isEmailAllowed')){\n // this.isEmailAllowed = event?.isEmailAllowed;\n // }\n //\n // if(event && event.hasOwnProperty('isMobileAllowed')){\n // this.isMobileAllowed = event?.isMobileAllowed;\n // }\n\n /**\n * This is a workaround until we remove all the user objet from twig files\n * When the user is already login, let's reload the page\n */\n if (!salla.config.isGuest()) {\n if (!this.withoutReload) {\n return location.reload();\n }\n // Fire an event if withoutReload is true\n return;\n }\n\n this.getSelectedTab();\n this.isModalOpen = true\n\n return this.modal.open();\n }\n private getSelectedTab() {\n if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n }\n }\n private showTab(tab, evt?) {\n evt?.preventDefault();\n this.hasError = false;\n this.errorMessage = '';\n this.currentTabName = tab.getAttribute('data-name');\n\n // todo:: use better way for resize the modal\n // setTimeout(() => this.modal.querySelector('.s-login-modal-wrapper')?.setAttribute('style', 'height:' + tab?.scrollHeight + 'px'));\n\n if ([this.mobileTab, this.emailTab].includes(tab)) {\n this.regType = tab === this.mobileTab ? 'phone' : 'email';\n }\n\n if (this.inline) {\n return this;\n }\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && this.currentTabName !== 'registration' && setTimeout(() => {\n input.focus();\n }, 100);\n return this;\n }\n\n private typing = (e, submitMethod = null) => {\n const error = e.target.nextElementSibling;\n e.target.classList.remove('s-has-error');\n error?.classList.contains('s-login-modal-error-message') && (error.innerText = '');\n this.hasError = false;\n this.errorMessage = '';\n //it was sending two requests for send two verification requests\n submitMethod && e.key == 'Enter' && submitMethod();\n }\n\n private loginBySMS = async (event = null) => {\n event?.preventDefault();\n const { phone, countryCode, countryKey } = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n this.currentPhone = `${countryKey} ${phone}`;\n this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });\n\n return false;\n }\n\n private loginByEmail = (event = null) => {\n event?.preventDefault();\n if (!Helper.isValidEmail(this.loginEmail.value)) {\n // this.validateField(this.loginEmail, this.emailErrorMsg);\n this.hasError = true;\n this.errorMessage = '* ' + this.emailErrorMsg;\n return;\n }\n this.currentEmail = this.loginEmail.value;\n this.login(this.emailBtn, { type: 'email', email: this.loginEmail.value });\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\n this.hasError = false;\n this.errorMessage = '';\n btn.load()\n .then(() => btn.disable())\n .then(() => salla.auth.api.login(data))\n .then(() => this.showTab(this.verifyTab))\n .then(() => this.verifyTab.open(data))\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response.data?.error?.message;\n })\n .finally(() => btn.stop() && btn.enable());\n }\n\n private newUser = async () => {\n const {\n phone: regPhone,\n countryCode\n } = this.regType == \"email\" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(),\n emailValue = this.regEmail.value || this.loginEmail?.value\n await this.newUserValidation();\n await this.regBtn.load();\n await this.regBtn.disable();\n\n let data: any = {\n first_name: this.firstName.value,\n last_name: this.lastName.value,\n phone: regPhone || this.loginTelInput.phone,\n country_code: countryCode,\n verified_by: this.regType,\n custom_fields: this.customFieldsValues,\n };\n emailValue && (data = { ...data, email: emailValue });\n this.verifyTab.getCode()\n .then(code => salla.auth.api.register({ ...data, code }))\n .then(() => salla.auth.canRedirect && !this.withoutReload && window.location.reload())\n .catch((error) => {\n salla.logger.error(error);\n this.regBtn.stop() && this.regBtn.enable()\n })\n }\n\n private async newUserValidation() {\n const isLogByPhone = this.regType == \"phone\",\n isLogByEmail = this.regType == \"email\",\n emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value),\n isEmailValid = Helper.isValidEmail(emailValue),\n isFirstNameValid = this.firstName.value.length > 0,\n isLastNameValid = this.lastName.value.length > 0,\n isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(),\n emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);\n\n // Custom Fields Validation\n var isCustomFieldValid = true;\n //we should make sure that there is text nodes between children\n this.customFieldsWrapper.childNodes\n .forEach((field: HTMLSallaFileUploadElement | HTMLInputElement) => {\n this.customFieldsValues[field.id] = field['value'];\n if (!field.required || this.customFieldsValues[field.id].length) {\n return;\n }\n isCustomFieldValid = false;\n const errorMsg: string = salla.lang.get('common.errors.field_required', { attribute: field.title });\n this.validateField(field, errorMsg)\n });\n\n if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid) return;\n !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);\n !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);\n !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);\n throw 'Please insert required fields';\n }\n\n private getFilepondPlaceholder() {\n return `<div class=\"s-login-modal-filepond-placeholder\"><span class=\"s-login-modal-filepond-placeholder-icon\">${CameraIcon}</span><p class=\"s-login-modal-filepond-placeholder-text\">${this.dragAndDrop}</p> <span class=\"filepond--label-action\">${this.browseFromFiles}</span></div>`\n }\n\n // eslint-disable-next-line @stencil/own-methods-must-be-private\n validateField(field: HTMLInputElement | HTMLSallaFileUploadElement, errorMsg: string) {\n field.classList.add('s-has-error');\n field.nextElementSibling['innerText'] = '* ' + errorMsg;\n }\n\n generateTabClasses(tabName) {\n return {\n 's-login-modal-tab': tabName !== 'registration' && tabName !== 'otp',\n \"s-hidden\": this.currentTabName !== tabName,\n \"s-show\": this.currentTabName === tabName,\n 's-login-modal-unactive': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName !== tabName,\n 's-login-modal-active': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName === tabName\n }\n }\n\n generateRegClasses(regType) {\n return {\n \"mb-1.5\": true,\n \"s-hidden\": this.regType === regType\n }\n }\n private getLoginDom() {\n return [!this.inline && <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon} />,\n <div class={this.inline ? 's-login-inline' : 's-login-modal-wrapper'}>\n {/* Tab 2 (Login By Mobile)*/}\n {this.isMobileAllowed ?\n <div class={this.generateTabClasses('login-phone')} data-name=\"login-phone\"\n ref={tab => this.mobileTab = tab}>\n <slot name=\"before-login-mobile\" />\n <form onSubmit={(event) => this.loginBySMS(event)} class={this.hasError && this.errorMessage ? 'has-error' : ''} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {this.isModalOpen || this.inline ? (<salla-tel-input autofocus tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>) : null}\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n {/* @ts-ignore */}\n <salla-button class=\"s-login-modal-enter-button\" type=\"submit\" loader-position='center' width=\"wide\" ref={b => this.smsBtn = b}>\n {salla.lang.get('blocks.header.enter')}\n </salla-button>\n </form>\n {this.isEmailAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.emailTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_email')}</a> : ''}\n <slot name=\"after-login-mobile\" />\n </div> : ''}\n\n\n {/* Tab 3 (Login By Email)*/}\n {this.isEmailAllowed ?\n <div class={this.generateTabClasses('login-email')} data-name=\"login-email\"\n ref={tab => this.emailTab = tab}>\n <slot name=\"before-login-email\" />\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <form onSubmit={() => this.loginByEmail(event)} method=\"POST\">\n <input type=\"email\" ref={el => this.loginEmail = el} onKeyDown={e => this.typing(e)}\n\n placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class={{ \"s-login-modal-input s-ltr\": true, \"s-has-error\": this.hasError }} />\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n <salla-button class=\"s-login-modal-enter-button\" loader-position='center' width=\"wide\" onClick={() => this.loginByEmail()}\n ref={b => this.emailBtn = b}>{salla.lang.get('blocks.header.enter')}</salla-button>\n </form>\n {this.isMobileAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.mobileTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_sms')}</a>\n : ''\n }\n <slot name=\"after-login-email\" />\n </div> : ''}\n {/* Tab 4 (Verify OTP)*/}\n <salla-verify display=\"inline\" support-web-auth={this.supportWebAuth ? 'true' : 'false'}\n class={this.generateTabClasses('otp')} data-name=\"otp\" ref={tab => this.verifyTab = tab}\n autoReload={false}>\n <a onClick={() => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab)}\n class=\"s-verify-back\"\n innerHTML={ArrowRightIcon}\n slot=\"after-footer\"\n href=\"#\" />\n {this.isMobileAllowed && this.regType == 'phone' ? <div dir=\"ltr\" class=\"s-login-modal-currentPhone\" slot=\"mobile\">{this.currentPhone}</div> : ''}\n {this.isEmailAllowed && this.regType == 'email' ? <div dir=\"ltr\" class=\"s-login-modal-currentEmail\" slot=\"email\">{this.currentEmail}</div> : ''}\n </salla-verify>\n\n {/* Tab 5 (Register New User)*/}\n <div data-name=\"registration\" class={this.generateTabClasses('registration')}\n ref={tab => this.registrationTab = tab}>\n <slot name=\"before-registration\" />\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('blocks.header.your_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.firstName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.first_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('pages.profile.last_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.lastName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.last_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div class={this.generateRegClasses('phone')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {(this.isModalOpen || this.inline) && this.currentTabName === \"registration\" ? (<salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>) : null}\n </div>\n\n <div class={this.generateRegClasses('email')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <input type=\"email\" ref={el => this.regEmail = el} onKeyDown={e => this.typing(e, this.newUser)}\n placeholder=\"your@email.com\"\n class=\"s-login-modal-input s-ltr\" />\n <span class=\"s-login-modal-error-message\" />\n </div>\n <div class=\"s-login-modal-custom-fields\" ref={el => this.customFieldsWrapper = el}>{\n this.customFields.map((field: CustomField) => [\n <label class=\"s-login-modal-label\">{field.label}</label>,\n field.type === CustomFieldType.PHOTO\n ? <salla-file-upload\n name=\"image\"\n instant-upload={true}\n id={`${field.id}`}\n title={field.label}\n required={field.required}\n url={salla.url.get('upload-image')}\n // onUploaded={}\n labelIdle={this.getFilepondPlaceholder()} />\n : <input\n onInput={el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}}\n onKeyDown={e => this.typing(e, this.newUser)}\n class=\"s-login-modal-input s-ltr\"\n maxlength={field.length || 1000}//todo:: support it by adding the maxlength or not, not setting static limit\n placeholder={field.description}\n required={field.required}\n title={field.label}\n id={`${field.id}`}\n type=\"text\" />,\n <span class=\"s-login-modal-error-message\" />\n ])\n }</div>\n\n <salla-button loader-position='center' width=\"wide\" onClick={() => this.newUser()}\n ref={b => this.regBtn = b}>{salla.lang.get('blocks.header.register')}</salla-button>\n <slot name=\"after-registration\" />\n </div>\n </div>]\n }\n render() {\n // @ts-ignore\n // @ts-ignore\n if (this.inline) {\n return this.getLoginDom();\n }\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n {this.getLoginDom()}\n </salla-modal>\n );\n }\n}\n\n"]}
1
+ {"version":3,"file":"salla-login-modal.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/salla-login-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,qDAAqD;AACrD,oDAAoD;AACpD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,iFAAiF;AACjF,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAe,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,eAAe;EAC1B;IAoGQ,uBAAkB,GAAW,EAAE,CAAC;IAkIhC,WAAM,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE;MAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC;MAC1C,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;MACzC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,CAAC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;MACnF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;MACtB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;MACvB,gEAAgE;MAChE,YAAY,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,IAAI,YAAY,EAAE,CAAC;IACrD,CAAC,CAAA;IAEO,eAAU,GAAG,K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,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAgB;UACtF,YAAM,IAAI,EAAC,oBAAoB,GAAG,CAC9B,CACF,CAAC,CAAA;EACT,CAAC;EAED,MAAM;IACJ,aAAa;IACb,aAAa;IACb,IAAI,IAAI,CAAC,MAAM,EAAE;MACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;KAC3B;IACD,OAAO,CACL,mBAAa,KAAK,EAAC,eAAe,iBAAc,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,EAAC,IAAI,IACrG,IAAI,CAAC,WAAW,EAAE,CACP,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Listen, Method, Prop, State } from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\n//import PhoneIcon from \"../../assets/svg/phone.svg\";\n//import EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\n//import KeyboardArrowRightIcon from \"../../assets/svg/keyboard_arrow_right.svg\";\nimport ArrowRightIcon from \"../../assets/svg/arrow-right.svg\";\nimport Helper from '../../Helpers/Helper';\nimport { CustomField, CustomFieldType } from './intefaces';\n\n/**\n * @slot footer - The footer of modal\n * @slot before-login-type - placeholder position\n * @slot after-login-type - placeholder position\n * @slot before-login-mobile - placeholder position\n * @slot after-login-mobile - placeholder position\n * @slot before-login-email - placeholder position\n * @slot after-login-email - placeholder position\n * @slot before-registration - placeholder position\n * @slot after-registration - placeholder position\n */\n@Component({\n tag: 'salla-login-modal',\n styleUrl: 'salla-login-modal.scss'\n})\n\n\nexport class SallaLoginModal {\n constructor() {\n\n this.title = this.host.title || salla.lang.get('blocks.header.login');\n this.host.removeAttribute('title');\n\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('blocks.header.login');\n this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');\n this.browseFromFiles = salla.lang.get('common.uploader.browse');\n this.updateTranslations();\n });\n\n salla.event.on('login::open', (data) => {\n if (!this.isEmailAllowed && !this.isMobileAllowed) {\n salla.logger.warn('Please enable atleast one login type to use this component.');\n return;\n }\n\n this.withoutReload = data?.withoutReload ?? this.withoutReload;\n this.isModalOpen = true\n this.open(data)\n });\n salla.onReady(() => {\n this.isEmailAllowed = salla.config.get('store.settings.auth.email_allowed', this.isEmailAllowed);\n this.isMobileAllowed = salla.config.get('store.settings.auth.mobile_allowed', this.isMobileAllowed);\n this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', this.isEmailRequired);\n });\n }\n\n @Element() host: HTMLElement;\n /**\n * Does the merchant allow to login using email\n */\n @Prop({ mutable: true }) isEmailAllowed: boolean;\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop({ mutable: true }) isMobileAllowed: boolean = true;\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop({ mutable: true }) isEmailRequired: boolean = false;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop({ reflect: true }) supportWebAuth: boolean = true;\n\n /**\n * Display the login inline\n */\n @Prop({ reflect: true }) inline: boolean;\n\n\n /**\n * Reload after a successful login\n */\n @Prop() withoutReload: boolean = false;\n\n private modal: HTMLSallaModalElement;\n //private homeTab: HTMLDivElement;\n private mobileTab: HTMLDivElement;\n private emailTab: HTMLDivElement;\n private verifyTab: HTMLSallaVerifyElement;\n private registrationTab: HTMLDivElement;\n private regTelInput: HTMLSallaTelInputElement;\n private regEmail: HTMLInputElement;\n private customFieldsWrapper: HTMLDivElement;\n private loginTelInput: HTMLSallaTelInputElement;\n private loginEmail: HTMLInputElement;\n private firstName: HTMLInputElement;\n private lastName: HTMLInputElement;\n private smsBtn: HTMLSallaButtonElement;\n private emailBtn: HTMLSallaButtonElement;\n private regBtn: HTMLSallaButtonElement;\n\n @State() currentTabName = 'home'\n @State() regType: 'phone' | 'email' = 'phone';\n\n\n @State() translationLoaded: boolean = false;\n @State() isModalOpen = false\n @State() currentPhone: string = '';\n @State() currentEmail: string = '';\n @State() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: string;\n @State() hasError: boolean;\n @State() errorMessage: string;\n\n @State() dragAndDrop: string = salla.lang.get('common.uploader.drag_and_drop');\n @State() browseFromFiles: string = salla.lang.get('common.uploader.browse');\n @State() customFields: CustomField[] = [];\n\n private customFieldsValues: Object = {};\n @State() uploadedImage: string = undefined;\n\n @Listen('verified', { target: 'window' })\n /**\n * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event\n */\n onVerified(event) {\n salla.log('verified', event);\n //there is a case when force login is activated & is new user, it will return case inside error key., so cover it.\n let verifyCase = event.detail?.data.case || event.detail?.error.case;\n if (!verifyCase) {\n salla.log('verified but without case!');\n return;\n }\n\n if (verifyCase === \"new_customer\") {\n this.customFields = event.detail?.data?.custom_fields || [];\n return this.showTab(this.registrationTab);\n }\n\n if (!salla.auth.canRedirect()) {\n salla.log('Will not auto redirect or reload, due to `salla.auth.canRedirect()`');\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n \n return;\n }\n\n if (event.detail.data.redirect_url) {\n return window.location.href = event.detail.data.redirect_url;\n }\n\n /**\n * we don't want to reload the page if this is not web auth\n * because we'll need the token in the page itself and its there\n * todo :: store the user data in storage for non-web auth and set the config.user from it\n */\n if (this.supportWebAuth && !this.withoutReload) {\n window.location.reload();\n } else {\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n }\n }\n\n updateTranslations() {\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n if (this.inline) {\n return;\n }\n this.modal?.setTitle(this.title);\n }\n componentDidLoad() {\n if (this.inline) {\n this.getSelectedTab()\n }\n }\n /**\n * Open login component\n */\n @Method()\n // @ts-ignore\n async open(event = null) {\n // todo :: support change the settings from event details\n // if(event && event.hasOwnProperty('isEmailAllowed')){\n // this.isEmailAllowed = event?.isEmailAllowed;\n // }\n //\n // if(event && event.hasOwnProperty('isMobileAllowed')){\n // this.isMobileAllowed = event?.isMobileAllowed;\n // }\n\n /**\n * This is a workaround until we remove all the user objet from twig files\n * When the user is already login, let's reload the page\n */\n if (!salla.config.isGuest()) {\n if (!this.withoutReload) {\n return location.reload();\n }\n // Fire an event if withoutReload is true\n return;\n }\n\n this.getSelectedTab();\n this.isModalOpen = true\n\n return this.modal.open();\n }\n\n private getSelectedTab() {\n if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n }\n }\n private showTab(tab, evt?) {\n evt?.preventDefault();\n this.hasError = false;\n this.errorMessage = '';\n this.currentTabName = tab.getAttribute('data-name');\n\n // todo:: use better way for resize the modal\n // setTimeout(() => this.modal.querySelector('.s-login-modal-wrapper')?.setAttribute('style', 'height:' + tab?.scrollHeight + 'px'));\n\n if ([this.mobileTab, this.emailTab].includes(tab)) {\n this.regType = tab === this.mobileTab ? 'phone' : 'email';\n }\n\n if (this.inline) {\n return this;\n }\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && this.currentTabName !== 'registration' && setTimeout(() => {\n input.focus();\n }, 100);\n return this;\n }\n\n private typing = (e, submitMethod = null) => {\n const error = e.target.nextElementSibling;\n e.target.classList.remove('s-has-error');\n error?.classList.contains('s-login-modal-error-message') && (error.innerText = '');\n this.hasError = false;\n this.errorMessage = '';\n //it was sending two requests for send two verification requests\n submitMethod && e.key == 'Enter' && submitMethod();\n }\n\n private loginBySMS = async (event = null) => {\n event?.preventDefault();\n const { phone, countryCode, countryKey } = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n this.currentPhone = `${countryKey} ${phone}`;\n this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });\n\n return false;\n }\n\n private loginByEmail = (event = null) => {\n event?.preventDefault();\n if (!Helper.isValidEmail(this.loginEmail.value)) {\n // this.validateField(this.loginEmail, this.emailErrorMsg);\n this.hasError = true;\n this.errorMessage = '* ' + this.emailErrorMsg;\n return;\n }\n this.currentEmail = this.loginEmail.value;\n this.login(this.emailBtn, { type: 'email', email: this.loginEmail.value });\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\n this.hasError = false;\n this.errorMessage = '';\n btn.load()\n .then(() => btn.disable())\n .then(() => salla.auth.api.login(data))\n .then(() => this.showTab(this.verifyTab))\n .then(() => this.verifyTab.open(data))\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response.data?.error?.message;\n })\n .finally(() => btn.stop() && btn.enable());\n }\n\n private newUser = async () => {\n const {\n phone: regPhone,\n countryCode\n } = this.regType == \"email\" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(),\n emailValue = this.regEmail.value || this.loginEmail?.value\n await this.newUserValidation();\n await this.regBtn.load();\n await this.regBtn.disable();\n\n let data: any = {\n first_name: this.firstName.value,\n last_name: this.lastName.value,\n phone: regPhone || this.loginTelInput.phone,\n country_code: countryCode,\n verified_by: this.regType,\n custom_fields: this.customFieldsValues,\n };\n emailValue && (data = { ...data, email: emailValue });\n this.verifyTab.getCode()\n .then(code => salla.auth.api.register({ ...data, code }))\n .then(() => salla.auth.canRedirect && !this.withoutReload && window.location.reload())\n .catch((error) => {\n salla.logger.error(error);\n this.regBtn.stop() && this.regBtn.enable()\n })\n }\n\n private async newUserValidation() {\n const isLogByPhone = this.regType == \"phone\",\n isLogByEmail = this.regType == \"email\",\n emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value),\n isEmailValid = Helper.isValidEmail(emailValue),\n isFirstNameValid = this.firstName.value.length > 0,\n isLastNameValid = this.lastName.value.length > 0,\n isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(),\n emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);\n\n // Custom Fields Validation\n var isCustomFieldValid = true;\n //we should make sure that there is text nodes between children\n this.customFieldsWrapper.childNodes\n .forEach((field: HTMLSallaFileUploadElement | HTMLInputElement) => {\n this.customFieldsValues[field.id] = field['value'];\n if (!field.required || this.customFieldsValues[field.id].length) {\n return;\n }\n isCustomFieldValid = false;\n const errorMsg: string = salla.lang.get('common.errors.field_required', { attribute: field.title });\n this.validateField(field, errorMsg)\n });\n\n if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid) return;\n !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);\n !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);\n !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);\n throw 'Please insert required fields';\n }\n\n private getFilepondPlaceholder() {\n return `<div class=\"s-login-modal-filepond-placeholder\"><span class=\"s-login-modal-filepond-placeholder-icon\">${CameraIcon}</span><p class=\"s-login-modal-filepond-placeholder-text\">${this.dragAndDrop}</p> <span class=\"filepond--label-action\">${this.browseFromFiles}</span></div>`\n }\n\n // eslint-disable-next-line @stencil/own-methods-must-be-private\n validateField(field: HTMLInputElement | HTMLSallaFileUploadElement, errorMsg: string) {\n field.classList.add('s-has-error');\n field.nextElementSibling['innerText'] = '* ' + errorMsg;\n }\n\n generateTabClasses(tabName) {\n return {\n 's-login-modal-tab': tabName !== 'registration' && tabName !== 'otp',\n \"s-hidden\": this.currentTabName !== tabName,\n \"s-show\": this.currentTabName === tabName,\n 's-login-modal-unactive': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName !== tabName,\n 's-login-modal-active': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName === tabName\n }\n }\n\n generateRegClasses(regType) {\n return {\n \"mb-1.5\": true,\n \"s-hidden\": this.regType === regType\n }\n }\n\n private getLoginDom() {\n return [!this.inline && <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon} />,\n <div class={this.inline ? 's-login-inline' : 's-login-modal-wrapper'}>\n {/* Tab 2 (Login By Mobile)*/}\n {this.isMobileAllowed ?\n <div class={this.generateTabClasses('login-phone')} data-name=\"login-phone\"\n ref={tab => this.mobileTab = tab}>\n <slot name=\"before-login-mobile\" />\n <form onSubmit={(event) => this.loginBySMS(event)} class={this.hasError && this.errorMessage ? 'has-error' : ''} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {this.isModalOpen || this.inline ? (<salla-tel-input autofocus tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>) : null}\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n {/* @ts-ignore */}\n <salla-button class=\"s-login-modal-enter-button\" type=\"submit\" loader-position='center' width=\"wide\" ref={b => this.smsBtn = b}>\n {salla.lang.get('blocks.header.enter')}\n </salla-button>\n </form>\n {this.isEmailAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.emailTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_email')}</a> : ''}\n <slot name=\"after-login-mobile\" />\n </div> : ''}\n\n\n {/* Tab 3 (Login By Email)*/}\n {this.isEmailAllowed ?\n <div class={this.generateTabClasses('login-email')} data-name=\"login-email\"\n ref={tab => this.emailTab = tab}>\n <slot name=\"before-login-email\" />\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <form onSubmit={() => this.loginByEmail(event)} method=\"POST\">\n <input type=\"email\" ref={el => this.loginEmail = el} onKeyDown={e => this.typing(e)}\n\n placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class={{ \"s-login-modal-input s-ltr\": true, \"s-has-error\": this.hasError }} />\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n <salla-button class=\"s-login-modal-enter-button\" loader-position='center' width=\"wide\" onClick={() => this.loginByEmail()}\n ref={b => this.emailBtn = b}>{salla.lang.get('blocks.header.enter')}</salla-button>\n </form>\n {this.isMobileAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.mobileTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_sms')}</a>\n : ''\n }\n <slot name=\"after-login-email\" />\n </div> : ''}\n {/* Tab 4 (Verify OTP)*/}\n <salla-verify display=\"inline\" support-web-auth={this.supportWebAuth ? 'true' : 'false'}\n class={this.generateTabClasses('otp')} data-name=\"otp\" ref={tab => this.verifyTab = tab}\n autoReload={false}>\n <a onClick={() => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab)}\n class=\"s-verify-back\"\n innerHTML={ArrowRightIcon}\n slot=\"after-footer\"\n href=\"#\" />\n {this.isMobileAllowed && this.regType == 'phone' ? <div dir=\"ltr\" class=\"s-login-modal-currentPhone\" slot=\"mobile\">{this.currentPhone}</div> : ''}\n {this.isEmailAllowed && this.regType == 'email' ? <div dir=\"ltr\" class=\"s-login-modal-currentEmail\" slot=\"email\">{this.currentEmail}</div> : ''}\n </salla-verify>\n\n {/* Tab 5 (Register New User)*/}\n <div data-name=\"registration\" class={this.generateTabClasses('registration')}\n ref={tab => this.registrationTab = tab}>\n <slot name=\"before-registration\" />\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('blocks.header.your_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.firstName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.first_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('pages.profile.last_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.lastName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.last_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div class={this.generateRegClasses('phone')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {(this.isModalOpen || this.inline) && this.currentTabName === \"registration\" ? (<salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>) : null}\n </div>\n\n <div class={this.generateRegClasses('email')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <input type=\"email\" ref={el => this.regEmail = el} onKeyDown={e => this.typing(e, this.newUser)}\n placeholder=\"your@email.com\"\n class=\"s-login-modal-input s-ltr\" />\n <span class=\"s-login-modal-error-message\" />\n </div>\n <div class=\"s-login-modal-custom-fields\" ref={el => this.customFieldsWrapper = el}>{\n this.customFields.map((field: CustomField) => [\n <label class=\"s-login-modal-label\">{field.label}</label>,\n field.type === CustomFieldType.PHOTO\n ? <salla-file-upload\n name=\"image\"\n instant-upload={true}\n id={`${field.id}`}\n title={field.label}\n required={field.required}\n url={salla.url.get('upload-image')}\n // onUploaded={}\n labelIdle={this.getFilepondPlaceholder()} />\n : <input\n onInput={el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}}\n onKeyDown={e => this.typing(e, this.newUser)}\n class=\"s-login-modal-input s-ltr\"\n maxlength={field.length || 1000}//todo:: support it by adding the maxlength or not, not setting static limit\n placeholder={field.description}\n required={field.required}\n title={field.label}\n id={`${field.id}`}\n type=\"text\" />,\n <span class=\"s-login-modal-error-message\" />\n ])\n }</div>\n\n <salla-button loader-position='center' width=\"wide\" onClick={() => this.newUser()}\n ref={b => this.regBtn = b}>{salla.lang.get('blocks.header.register')}</salla-button>\n <slot name=\"after-registration\" />\n </div>\n </div>]\n }\n\n render() {\n // @ts-ignore\n // @ts-ignore\n if (this.inline) {\n return this.getLoginDom();\n }\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n {this.getLoginDom()}\n </salla-modal>\n );\n }\n}\n\n"]}
@@ -19,15 +19,13 @@ export class SallaQuickBuy {
19
19
  salla.lang.onLoaded(() => {
20
20
  this.quickBuy = salla.lang.get('pages.products.buy_now');
21
21
  });
22
- if (salla.config.isGuest()) {
23
- let eventName = "salla-quick-buy::user.logged-in";
24
- salla.api.auth.setAfterLoginEvent(eventName);
25
- salla.event.on(eventName, () => this.settlePayment());
26
- }
27
22
  }
28
23
  async quickBuyHandler() {
29
24
  if (salla.config.isGuest()) {
30
25
  // todo (low) :: find a way to re-fire the method after success
26
+ let afterLoginEvent = "salla-quick-buy::user.logged-in";
27
+ salla.event.on(afterLoginEvent, () => this.settlePayment());
28
+ salla.api.auth.setAfterLoginEvent(afterLoginEvent);
31
29
  return salla.auth.event.dispatch('login::open', { withoutReload: true });
32
30
  }
33
31
  await this.settlePayment();
@@ -1 +1 @@
1
- {"version":3,"file":"salla-quick-buy.js","sourceRoot":"","sources":["../../../src/components/salla-quick-buy/salla-quick-buy.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eA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AG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,yBACjB,UAAU,EAC9B,KAAK,EAAC,uBAAuB,sBACZ,GAAG,EACpB,WAAW,EAAC,OAAO,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;MACrB,CAAC;QACD,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA,oBAAc,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,EACzD,KAAK,EAAC,oBAAoB,EAC1B,KAAK,EAAC,SAAS,EACf,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,KAAK,EAAC,KAAK;UACvB,YAAM,SAAS,EAAE,UAAU,GAAG;UAC7B,IAAI,CAAC,QAAQ,CACD;UACf,CAAC,CAAC,EAAE,CAAC;EACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport FullWallet from '../../assets/svg/full-wallet.svg';\nimport \"@salla.sa/applepay/src/index\";\n\n@Component({\n tag: 'salla-quick-buy',\n styleUrl: 'salla-quick-buy.scss',\n})\nexport class SallaQuickBuy {\n constructor() {\n salla.lang.onLoaded(() => {\n this.quickBuy = salla.lang.get('pages.products.buy_now');\n });\n\n if (salla.config.isGuest()) {\n let eventName = \"salla-quick-buy::user.logged-in\"\n salla.api.auth.setAfterLoginEvent(eventName)\n salla.event.on(eventName, () => this.settlePayment())\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Button type.\n *\n * @type {string}\n * @default buy\n **/\n @Prop({ mutable: true }) type: 'plain' | 'buy' | 'donate' | 'book' | 'pay' | 'order' = 'buy';\n\n /**\n * Product ID.\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) productId: string;\n\n /**\n * Cart ID, when you need to applePay for existed cart\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) cartId: string;\n\n /**\n * Product amount in base currency (SAR).\n *\n * @type {number}\n * @default 0\n **/\n @Prop({ reflect: true, mutable: true }) amount: number;\n\n /**\n * base currency\n *\n * @type {string}\n * @default SAR\n */\n @Prop({ mutable: true }) currency: string;\n\n /**\n * Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id=\"X\"]')\n *\n * @type {object}\n * @default {}\n */\n @Prop() options = {};\n\n /**\n * To be passed to purchaseNow request\n * @type {boolean}\n **/\n @Prop({mutable: true}) isRequireShipping: boolean;\n \n /**\n * Show Apple Pay only\n * @type {boolean}\n **/\n @Prop({mutable: true}) applePayOnly: boolean;\n\n @State() isApplePayActive: boolean;\n\n @State() quickBuy: string = salla.lang.get('pages.products.buy_now');\n\n private async quickBuyHandler() {\n if (salla.config.isGuest()) {\n // todo (low) :: find a way to re-fire the method after success\n return salla.auth.event.dispatch('login::open', { withoutReload: true });\n }\n await this.settlePayment()\n }\n\n private async settlePayment() {\n\n let optionsElement = document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as HTMLSallaProductOptionsElement;\n //make sure all the required options are selected\n if (optionsElement && !await optionsElement.reportValidity()) {\n return salla.error(salla.lang.get('common.messages.required_fields'));\n }\n\n //use this way to get quantity too\n let data = (this.host as any).getElementSallaData();\n\n // if the store doesn't have Apple Pay , just create a cart and then redirect to check out page\n if (!this.isApplePayActive) {\n // return salla.product.buyNow(this.productId, data);\n return salla.api.request('checkout/quick-purchase/' + this.productId, data, 'post')\n .then(resp => {\n if (resp.data.redirect) {\n window.location.href = resp.data.redirect;\n }\n return resp;\n });\n }\n data.is_applepay = true;\n\n if ('append' in data) {\n data.append('is_applepay', true);\n }\n\n // noinspection TypeScriptValidateJSTypes\n salla.event.dispatch('payments::apple-pay.start-transaction', {\n amount: this.amount, // 1000\n currency: this.currency || 'SAR', // SAR\n requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,\n shippingMethods: this.isRequireShipping ? [] : null,\n supportedNetworks: salla.config.get('store.settings.buy_now.networks'),\n supportedCountries: salla.config.get('store.settings.buy_now.countries'),\n validateMerchant: {\n url: salla.url.get('checkout/applepay/validate'),\n onSuccess: (response) => {\n if (this.applePayOnly && !this.productId) { // the cart is not passes\n if (!this.cartId) {\n salla.logger.warn('🍏 Pay: trying to create applePay transaction without cartId/ProductId !');\n return Promise.resolve(response);\n }\n window.SallaApplePay.id = this.cartId;\n salla.log('🍏 Pay: create checkout success: with id #' + this.cartId);\n return Promise.resolve(response);\n\n }\n\n return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {\n\n // if is redirect url returned for any reason, lets redirect the user to check out\n if (response?.data?.redirect) {\n salla.log('🍏 Pay: create checkout success: redirect exits, go to checkout page');\n window.location.href = response.data.redirect.url;\n return response;\n }\n\n // the cart is not ready to complete apply pay session\n if (!response?.data?.id) {\n salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');\n return response;\n }\n\n window.SallaApplePay.id = response.data.id;\n\n salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);\n });\n }\n },\n authorized: {\n // submit checkout route\n url: salla.url.get('checkout/{id}/payments/submit'),\n onFailed: (response) => {\n window.SallaApplePay.onCancel({}, response?.data?.error?.message || response?.data?.error?.code || salla.lang.get('pages.checkout.payment_failed'));\n },\n onSuccess: (response) => {\n window.location.href = response.redirect.url;\n salla.log('🍏 Pay: authorized Success:: redirect to thank you page, order placed');\n }\n },\n shippingMethodSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/shipping/details'),\n } : null,\n shippingContactSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/address/add'),\n } : null,\n oncouponcodechanged: {\n url: salla.url.get('checkout/{id}/coupons')\n },\n recalculateTotal: {\n url: salla.url.get('checkout/{id}/payments/recalculate?payment_method=apple_pay')\n },\n onError: function (message) {\n salla.log(message);\n salla.notify.error(message);\n }\n });\n }\n\n componentWillLoad() {\n return new Promise((resolve, reject) => {\n salla.onReady(async () => {\n\n // if (!this.currency) {\n // this.currency = salla.config.get('user.currency_code');\n // }\n\n if (!this.productId && salla.config.get('page.id')) {\n this.productId = salla.config.get('page.id');\n }\n\n if (!this.applePayOnly && !this.productId) {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, the product id is missing')\n return reject()\n }\n\n /**\n * We should check the product if it's required shipping\n * in order for apple pay sdk to show the required Shipping Contact Fields\n * components..\n */\n if ((!this.amount || !this.isRequireShipping) && this.productId) {\n await salla.product.getDetails(this.productId, []).then((response) => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n this.isRequireShipping = response?.data?.is_require_shipping || false;\n }).catch((error) => {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error)\n return reject()\n })\n }\n\n\n\n if (this.type == 'donate') {\n salla.event.on('product-options::donation-changed', (data) => {\n if (String(data.id) !== String(this.productId)) {\n return;\n }\n\n this.amount = data.price;\n });\n if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.currency = response.data.base_currency_price.currency;\n });\n }\n } else if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n });\n }\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n let applePaySdk = document.getElementById('apple-pay-sdk');\n if (applePaySdk || !this.isApplePayActive) {\n salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'))\n resolve(true);\n return;\n }\n\n const script = document.createElement('script');\n script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';\n script.setAttribute('id', 'apple-pay-sdk');\n script.async = true;\n\n document.body.appendChild(script);\n\n resolve(true);\n })\n })\n }\n\n render() {\n return <Host>{this.quickBuyButton()}</Host>\n }\n\n private quickBuyButton() {\n return this.isApplePayActive\n ? <apple-pay-button locale={salla.config.get('user.language_code')}\n onClick={() => this.quickBuyHandler()}\n data-quick-purchase=\"applepay\"\n class=\"s-quick-buy-apple-pay\"\n data-is-applepay=\"1\"\n buttonstyle=\"black\"\n type={this.type} />\n :\n !this.applePayOnly ?<salla-button onClick={() => this.quickBuyHandler()}\n class=\"s-quick-buy-button\"\n color=\"primary\"\n fill=\"outline\"\n size=\"medium\"\n width=\"wide\"\n shape=\"btn\">\n <span innerHTML={FullWallet}/>\n {this.quickBuy}\n </salla-button>\n : '';\n }\n}\n"]}
1
+ {"version":3,"file":"salla-quick-buy.js","sourceRoot":"","sources":["../../../src/components/salla-quick-buy/salla-quick-buy.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,8BAA8B,CAAC;AAMtC,MAAM,OAAO,aAAa;EACxB;gBAcuF,KAAK;;;;;mBAsC1E,EAAE;;;;oBAgBQ,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;IAnElE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;MACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;GACJ;EAkEO,KAAK,CAAC,eAAe;IAC3B,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;MAE1B,+DAA+D;MAC/D,IAAI,eAAe,GAAG,iCAAi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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport FullWallet from '../../assets/svg/full-wallet.svg';\nimport \"@salla.sa/applepay/src/index\";\n\n@Component({\n tag: 'salla-quick-buy',\n styleUrl: 'salla-quick-buy.scss',\n})\nexport class SallaQuickBuy {\n constructor() {\n salla.lang.onLoaded(() => {\n this.quickBuy = salla.lang.get('pages.products.buy_now');\n });\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Button type.\n *\n * @type {string}\n * @default buy\n **/\n @Prop({ mutable: true }) type: 'plain' | 'buy' | 'donate' | 'book' | 'pay' | 'order' = 'buy';\n\n /**\n * Product ID.\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) productId: string;\n\n /**\n * Cart ID, when you need to applePay for existed cart\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) cartId: string;\n\n /**\n * Product amount in base currency (SAR).\n *\n * @type {number}\n * @default 0\n **/\n @Prop({ reflect: true, mutable: true }) amount: number;\n\n /**\n * base currency\n *\n * @type {string}\n * @default SAR\n */\n @Prop({ mutable: true }) currency: string;\n\n /**\n * Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id=\"X\"]')\n *\n * @type {object}\n * @default {}\n */\n @Prop() options = {};\n\n /**\n * To be passed to purchaseNow request\n * @type {boolean}\n **/\n @Prop({mutable: true}) isRequireShipping: boolean;\n \n /**\n * Show Apple Pay only\n * @type {boolean}\n **/\n @Prop({mutable: true}) applePayOnly: boolean;\n\n @State() isApplePayActive: boolean;\n\n @State() quickBuy: string = salla.lang.get('pages.products.buy_now');\n\n private async quickBuyHandler() {\n if (salla.config.isGuest()) {\n \n // todo (low) :: find a way to re-fire the method after success\n let afterLoginEvent = \"salla-quick-buy::user.logged-in\"\n salla.event.on(afterLoginEvent, () => this.settlePayment())\n salla.api.auth.setAfterLoginEvent(afterLoginEvent)\n return salla.auth.event.dispatch('login::open', { withoutReload: true });\n }\n await this.settlePayment()\n }\n\n private async settlePayment() {\n\n let optionsElement = document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as HTMLSallaProductOptionsElement;\n //make sure all the required options are selected\n if (optionsElement && !await optionsElement.reportValidity()) {\n return salla.error(salla.lang.get('common.messages.required_fields'));\n }\n\n //use this way to get quantity too\n let data = (this.host as any).getElementSallaData();\n\n // if the store doesn't have Apple Pay , just create a cart and then redirect to check out page\n if (!this.isApplePayActive) {\n // return salla.product.buyNow(this.productId, data);\n return salla.api.request('checkout/quick-purchase/' + this.productId, data, 'post')\n .then(resp => {\n if (resp.data.redirect) {\n window.location.href = resp.data.redirect;\n }\n return resp;\n });\n }\n data.is_applepay = true;\n\n if ('append' in data) {\n data.append('is_applepay', true);\n }\n\n // noinspection TypeScriptValidateJSTypes\n salla.event.dispatch('payments::apple-pay.start-transaction', {\n amount: this.amount, // 1000\n currency: this.currency || 'SAR', // SAR\n requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,\n shippingMethods: this.isRequireShipping ? [] : null,\n supportedNetworks: salla.config.get('store.settings.buy_now.networks'),\n supportedCountries: salla.config.get('store.settings.buy_now.countries'),\n validateMerchant: {\n url: salla.url.get('checkout/applepay/validate'),\n onSuccess: (response) => {\n if (this.applePayOnly && !this.productId) { // the cart is not passes\n if (!this.cartId) {\n salla.logger.warn('🍏 Pay: trying to create applePay transaction without cartId/ProductId !');\n return Promise.resolve(response);\n }\n window.SallaApplePay.id = this.cartId;\n salla.log('🍏 Pay: create checkout success: with id #' + this.cartId);\n return Promise.resolve(response);\n\n }\n\n return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {\n\n // if is redirect url returned for any reason, lets redirect the user to check out\n if (response?.data?.redirect) {\n salla.log('🍏 Pay: create checkout success: redirect exits, go to checkout page');\n window.location.href = response.data.redirect.url;\n return response;\n }\n\n // the cart is not ready to complete apply pay session\n if (!response?.data?.id) {\n salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');\n return response;\n }\n\n window.SallaApplePay.id = response.data.id;\n\n salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);\n });\n }\n },\n authorized: {\n // submit checkout route\n url: salla.url.get('checkout/{id}/payments/submit'),\n onFailed: (response) => {\n window.SallaApplePay.onCancel({}, response?.data?.error?.message || response?.data?.error?.code || salla.lang.get('pages.checkout.payment_failed'));\n },\n onSuccess: (response) => {\n window.location.href = response.redirect.url;\n salla.log('🍏 Pay: authorized Success:: redirect to thank you page, order placed');\n }\n },\n shippingMethodSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/shipping/details'),\n } : null,\n shippingContactSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/address/add'),\n } : null,\n oncouponcodechanged: {\n url: salla.url.get('checkout/{id}/coupons')\n },\n recalculateTotal: {\n url: salla.url.get('checkout/{id}/payments/recalculate?payment_method=apple_pay')\n },\n onError: function (message) {\n salla.log(message);\n salla.notify.error(message);\n }\n });\n }\n\n componentWillLoad() {\n return new Promise((resolve, reject) => {\n salla.onReady(async () => {\n\n // if (!this.currency) {\n // this.currency = salla.config.get('user.currency_code');\n // }\n\n if (!this.productId && salla.config.get('page.id')) {\n this.productId = salla.config.get('page.id');\n }\n\n if (!this.applePayOnly && !this.productId) {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, the product id is missing')\n return reject()\n }\n\n /**\n * We should check the product if it's required shipping\n * in order for apple pay sdk to show the required Shipping Contact Fields\n * components..\n */\n if ((!this.amount || !this.isRequireShipping) && this.productId) {\n await salla.product.getDetails(this.productId, []).then((response) => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n this.isRequireShipping = response?.data?.is_require_shipping || false;\n }).catch((error) => {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error)\n return reject()\n })\n }\n\n\n\n if (this.type == 'donate') {\n salla.event.on('product-options::donation-changed', (data) => {\n if (String(data.id) !== String(this.productId)) {\n return;\n }\n\n this.amount = data.price;\n });\n if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.currency = response.data.base_currency_price.currency;\n });\n }\n } else if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n });\n }\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n let applePaySdk = document.getElementById('apple-pay-sdk');\n if (applePaySdk || !this.isApplePayActive) {\n salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'))\n resolve(true);\n return;\n }\n\n const script = document.createElement('script');\n script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';\n script.setAttribute('id', 'apple-pay-sdk');\n script.async = true;\n\n document.body.appendChild(script);\n\n resolve(true);\n })\n })\n }\n\n render() {\n return <Host>{this.quickBuyButton()}</Host>\n }\n\n private quickBuyButton() {\n return this.isApplePayActive\n ? <apple-pay-button locale={salla.config.get('user.language_code')}\n onClick={() => this.quickBuyHandler()}\n data-quick-purchase=\"applepay\"\n class=\"s-quick-buy-apple-pay\"\n data-is-applepay=\"1\"\n buttonstyle=\"black\"\n type={this.type} />\n :\n !this.applePayOnly ?<salla-button onClick={() => this.quickBuyHandler()}\n class=\"s-quick-buy-button\"\n color=\"primary\"\n fill=\"outline\"\n size=\"medium\"\n width=\"wide\"\n shape=\"btn\">\n <span innerHTML={FullWallet}/>\n {this.quickBuy}\n </salla-button>\n : '';\n }\n}\n"]}