@salla.sa/twilight-components 2.11.110 → 2.11.111

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 (150) hide show
  1. package/README.md +48 -42
  2. package/dist/cjs/{app-globals-c392da62.js → app-globals-38ac4fe8.js} +2 -2
  3. package/dist/cjs/{app-globals-c392da62.js.map → app-globals-38ac4fe8.js.map} +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/salla-add-product-button_40.cjs.entry.js +73 -23
  6. package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
  7. package/dist/cjs/salla-filters-widget.cjs.entry.js +5 -27
  8. package/dist/cjs/salla-filters-widget.cjs.entry.js.map +1 -1
  9. package/dist/cjs/salla-filters.cjs.entry.js +8 -4
  10. package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
  11. package/dist/cjs/salla-price-range.cjs.entry.js +109 -37
  12. package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
  13. package/dist/cjs/salla-products-list.cjs.entry.js +85 -59
  14. package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
  15. package/dist/cjs/salla-products-slider.cjs.entry.js +12 -4
  16. package/dist/cjs/salla-products-slider.cjs.entry.js.map +1 -1
  17. package/dist/cjs/twilight.cjs.js +2 -2
  18. package/dist/collection/components/salla-filters/salla-filters.js +8 -4
  19. package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
  20. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +5 -27
  21. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js.map +1 -1
  22. package/dist/collection/components/salla-login-modal/intefaces.js.map +1 -1
  23. package/dist/collection/components/salla-login-modal/salla-login-modal.js +1 -1
  24. package/dist/collection/components/salla-login-modal/salla-login-modal.js.map +1 -1
  25. package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +14 -1
  26. package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js.map +1 -1
  27. package/dist/collection/components/salla-price-range/salla-price-range.js +152 -148
  28. package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
  29. package/dist/collection/components/salla-products-list/salla-products-list.js +85 -59
  30. package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
  31. package/dist/collection/components/salla-products-slider/salla-products-slider.js +29 -5
  32. package/dist/collection/components/salla-products-slider/salla-products-slider.js.map +1 -1
  33. package/dist/collection/components/salla-verify/salla-verify.css +12 -0
  34. package/dist/collection/components/salla-verify/salla-verify.js +58 -20
  35. package/dist/collection/components/salla-verify/salla-verify.js.map +1 -1
  36. package/dist/components/index.js +1 -1
  37. package/dist/components/index.js.map +1 -1
  38. package/dist/components/salla-filters-widget2.js +5 -27
  39. package/dist/components/salla-filters-widget2.js.map +1 -1
  40. package/dist/components/salla-filters.js +8 -4
  41. package/dist/components/salla-filters.js.map +1 -1
  42. package/dist/components/salla-login-modal.js +1 -1
  43. package/dist/components/salla-login-modal.js.map +1 -1
  44. package/dist/components/salla-maintenance-alert.js +14 -1
  45. package/dist/components/salla-maintenance-alert.js.map +1 -1
  46. package/dist/components/salla-price-range2.js +113 -43
  47. package/dist/components/salla-price-range2.js.map +1 -1
  48. package/dist/components/salla-products-list.js +85 -59
  49. package/dist/components/salla-products-list.js.map +1 -1
  50. package/dist/components/salla-products-slider.js +13 -5
  51. package/dist/components/salla-products-slider.js.map +1 -1
  52. package/dist/components/salla-verify2.js +59 -21
  53. package/dist/components/salla-verify2.js.map +1 -1
  54. package/dist/esm/{app-globals-663240cc.js → app-globals-3a81b4f2.js} +2 -2
  55. package/dist/esm/{app-globals-663240cc.js.map → app-globals-3a81b4f2.js.map} +1 -1
  56. package/dist/esm/loader.js +2 -2
  57. package/dist/esm/salla-add-product-button_40.entry.js +73 -23
  58. package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
  59. package/dist/esm/salla-filters-widget.entry.js +5 -27
  60. package/dist/esm/salla-filters-widget.entry.js.map +1 -1
  61. package/dist/esm/salla-filters.entry.js +8 -4
  62. package/dist/esm/salla-filters.entry.js.map +1 -1
  63. package/dist/esm/salla-price-range.entry.js +109 -37
  64. package/dist/esm/salla-price-range.entry.js.map +1 -1
  65. package/dist/esm/salla-products-list.entry.js +85 -59
  66. package/dist/esm/salla-products-list.entry.js.map +1 -1
  67. package/dist/esm/salla-products-slider.entry.js +12 -4
  68. package/dist/esm/salla-products-slider.entry.js.map +1 -1
  69. package/dist/esm/twilight.js +2 -2
  70. package/dist/esm-es5/{app-globals-663240cc.js → app-globals-3a81b4f2.js} +2 -2
  71. package/dist/{twilight/p-dcfa0f39.system.js.map → esm-es5/app-globals-3a81b4f2.js.map} +1 -1
  72. package/dist/esm-es5/loader.js +1 -1
  73. package/dist/esm-es5/loader.js.map +1 -1
  74. package/dist/esm-es5/salla-add-product-button_40.entry.js +4 -4
  75. package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
  76. package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
  77. package/dist/esm-es5/salla-filters-widget.entry.js.map +1 -1
  78. package/dist/esm-es5/salla-filters.entry.js +1 -1
  79. package/dist/esm-es5/salla-filters.entry.js.map +1 -1
  80. package/dist/esm-es5/salla-price-range.entry.js +2 -2
  81. package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
  82. package/dist/esm-es5/salla-products-list.entry.js +2 -2
  83. package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
  84. package/dist/esm-es5/salla-products-slider.entry.js +1 -1
  85. package/dist/esm-es5/salla-products-slider.entry.js.map +1 -1
  86. package/dist/esm-es5/twilight.js +1 -1
  87. package/dist/esm-es5/twilight.js.map +1 -1
  88. package/dist/twilight/{p-6948b825.js → p-1edec127.js} +2 -2
  89. package/dist/twilight/{p-6948b825.js.map → p-1edec127.js.map} +1 -1
  90. package/dist/twilight/{p-7c6638f5.system.entry.js → p-2739ddc5.system.entry.js} +2 -2
  91. package/dist/twilight/p-2739ddc5.system.entry.js.map +1 -0
  92. package/dist/twilight/p-3212e42c.entry.js +5 -0
  93. package/dist/twilight/p-3212e42c.entry.js.map +1 -0
  94. package/dist/twilight/{p-6404a9a5.system.js → p-37389934.system.js} +2 -2
  95. package/dist/twilight/{p-6404a9a5.system.js.map → p-37389934.system.js.map} +1 -1
  96. package/dist/twilight/{p-dcfa0f39.system.js → p-38496eab.system.js} +2 -2
  97. package/dist/{esm-es5/app-globals-663240cc.js.map → twilight/p-38496eab.system.js.map} +1 -1
  98. package/dist/twilight/p-3f03d17c.system.entry.js +5 -0
  99. package/dist/twilight/p-3f03d17c.system.entry.js.map +1 -0
  100. package/dist/twilight/p-46b7f931.system.entry.js +5 -0
  101. package/dist/twilight/p-46b7f931.system.entry.js.map +1 -0
  102. package/dist/twilight/p-54783694.system.entry.js +5 -0
  103. package/dist/twilight/p-54783694.system.entry.js.map +1 -0
  104. package/dist/twilight/{p-9713044b.entry.js → p-5b15c1a6.entry.js} +2 -2
  105. package/dist/twilight/p-5b15c1a6.entry.js.map +1 -0
  106. package/dist/twilight/p-cd5cb2f7.entry.js +5 -0
  107. package/dist/twilight/p-cd5cb2f7.entry.js.map +1 -0
  108. package/dist/twilight/p-d7a62fb3.system.entry.js +5 -0
  109. package/dist/twilight/p-d7a62fb3.system.entry.js.map +1 -0
  110. package/dist/twilight/p-def222e1.entry.js +5 -0
  111. package/dist/twilight/p-def222e1.entry.js.map +1 -0
  112. package/dist/twilight/p-e393f123.entry.js +5 -0
  113. package/dist/twilight/p-e393f123.entry.js.map +1 -0
  114. package/dist/twilight/p-e3dc0687.entry.js +5 -0
  115. package/dist/twilight/p-e3dc0687.entry.js.map +1 -0
  116. package/dist/twilight/{p-1e4abb42.system.entry.js → p-fcc169b5.system.entry.js} +2 -2
  117. package/dist/twilight/p-fcc169b5.system.entry.js.map +1 -0
  118. package/dist/twilight/twilight.esm.js +1 -1
  119. package/dist/twilight/twilight.esm.js.map +1 -1
  120. package/dist/twilight/twilight.js +1 -1
  121. package/dist/types/components/salla-filters-widget/salla-filters-widget.d.ts +0 -7
  122. package/dist/types/components/salla-login-modal/intefaces.d.ts +1 -0
  123. package/dist/types/components/salla-maintenance-alert/salla-maintenance-alert.d.ts +3 -0
  124. package/dist/types/components/salla-price-range/salla-price-range.d.ts +16 -10
  125. package/dist/types/components/salla-products-list/salla-products-list.d.ts +2 -2
  126. package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +5 -1
  127. package/dist/types/components/salla-verify/salla-verify.d.ts +6 -1
  128. package/dist/types/components.d.ts +14 -8
  129. package/package.json +4 -4
  130. package/dist/twilight/p-1e4abb42.system.entry.js.map +0 -1
  131. package/dist/twilight/p-3b1a0059.entry.js +0 -5
  132. package/dist/twilight/p-3b1a0059.entry.js.map +0 -1
  133. package/dist/twilight/p-41b3e09d.entry.js +0 -5
  134. package/dist/twilight/p-41b3e09d.entry.js.map +0 -1
  135. package/dist/twilight/p-4a743b5e.system.entry.js +0 -5
  136. package/dist/twilight/p-4a743b5e.system.entry.js.map +0 -1
  137. package/dist/twilight/p-62c1b309.entry.js +0 -5
  138. package/dist/twilight/p-62c1b309.entry.js.map +0 -1
  139. package/dist/twilight/p-6349125a.entry.js +0 -5
  140. package/dist/twilight/p-6349125a.entry.js.map +0 -1
  141. package/dist/twilight/p-7c6638f5.system.entry.js.map +0 -1
  142. package/dist/twilight/p-8ee37cc6.entry.js +0 -5
  143. package/dist/twilight/p-8ee37cc6.entry.js.map +0 -1
  144. package/dist/twilight/p-9713044b.entry.js.map +0 -1
  145. package/dist/twilight/p-9e27da8e.system.entry.js +0 -5
  146. package/dist/twilight/p-9e27da8e.system.entry.js.map +0 -1
  147. package/dist/twilight/p-b1f8b436.system.entry.js +0 -5
  148. package/dist/twilight/p-b1f8b436.system.entry.js.map +0 -1
  149. package/dist/twilight/p-c9cdaea6.system.entry.js +0 -5
  150. package/dist/twilight/p-c9cdaea6.system.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"salla-filters.js","sourceRoot":"","sources":["../../../src/components/salla-filters/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AAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB;QAC7F,oBAAc,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB,CACrG,CACD,CAAC;EACV,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Event, EventEmitter, Host, Method, Prop, State} from '@stencil/core';\nimport {Filter, FilterOptionInputType, FilterOptionTypes} from \"./interfaces\";\n\n//todo::\n\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({filters}) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price_range: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.CHECKBOX;\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let {max, min} = filter.values;\n //@ts-ignore\n filter.values = [1, 2, 3, 4, 5].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n });\n }\n\n connectedCallback() {\n try {\n let filters = (new URLSearchParams(window.location.search)).get('filters')\n this.filtersData = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n }\n\n @Element() host: HTMLElement;\n @Prop({reflect: true, mutable: true}) filters?: Filter[];\n private isReady = false;//to avoid triggering the changed event\n @State() isSidebarOpen: boolean;\n @State() filtersData: object = {}\n @State() apply: string;\n @State() reset: string;\n @Event() changed: EventEmitter;\n\n //TODO:: move all @methods into one section\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n window.history.pushState({}, '', salla.url.addParamToUrl('filters', encodeURIComponent(JSON.stringify(this.filtersData))));\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }\n\n @Method()\n async resetFilters() {\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n return;\n }\n let isChecked = event.target.checked;\n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n return;\n }\n\n //it's checkbox\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n return;\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({detail: {event, option, value}}) => this.handleOptionChange(event, option, value)}/>)}\n\n {this.filters?.length && <div class=\"s-filters-footer\">\n <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button>\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div>}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"]}
1
+ {"version":3,"file":"salla-filters.js","sourceRoot":"","sources":["../../../src/components/salla-filters/salla-filters.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAU,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhF,QAAQ;AAOR,MAAM,OAAO,YAAY;EAEvB;IAkDQ,YAAO,GAAG,KAAK,CAAC,CAAA,uCAAuC;;;uBAEhC,EAAE;;;IAnD/B,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAE1E,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;MACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;MACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;MACjD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;MAC7B,IAAI,eAAe,GAAG,EAAE,CAAC;MACzB,IAAI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,CAAC;EAED,MAAM;;IACJ,OAAO,EAAC,IAAI,QACT,MAAA,IAAI,CAAC,OAAO;SAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,4BAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAI,CAAC;MAExG,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,KAAI,WAAK,KAAK,EAAC,kBAAkB;QACpD,oBAAc,KAAK,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB;QAC7F,oBAAc,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB,CACrG,CACD,CAAC;EACV,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"./interfaces\";\n\n//todo::\n\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price_range: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.CHECKBOX;\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n });\n }\n\n connectedCallback() {\n try {\n let filters = (new URLSearchParams(window.location.search)).get('filters')\n this.filtersData = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n }\n\n @Element() host: HTMLElement;\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n private isReady = false;//to avoid triggering the changed event\n @State() isSidebarOpen: boolean;\n @State() filtersData: object = {}\n @State() apply: string;\n @State() reset: string;\n @Event() changed: EventEmitter;\n\n //TODO:: move all @methods into one section\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n //todo:: why we need this🤔\n window.scrollTo({top: 0,behavior: 'smooth'});\n setTimeout(() => {\n window.history.pushState({}, '', salla.url.addParamToUrl('filters', encodeURIComponent(JSON.stringify(this.filtersData))));\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n @Method()\n async resetFilters() {\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n return;\n }\n let isChecked = event.target.checked;\n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n return;\n }\n\n //it's checkbox\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n return;\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => this.handleOptionChange(event, option, value)} />)}\n\n {this.filters?.length && <div class=\"s-filters-footer\">\n <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button>\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div>}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"]}
@@ -25,12 +25,8 @@ export class SallaFiltersWidget {
25
25
  this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;
26
26
  }
27
27
  async reset() {
28
- var _a, _b;
29
28
  if (this.option.type === FilterOptionTypes.RANGE) {
30
- this.priceRange.minPrice = (_a = this.option.values) === null || _a === void 0 ? void 0 : _a.min;
31
- this.priceRange.maxPrice = (_b = this.option.values) === null || _b === void 0 ? void 0 : _b.max;
32
- await this.priceRange.maxTrigger();
33
- await this.priceRange.minTrigger();
29
+ this.priceRange.reset();
34
30
  }
35
31
  Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);
36
32
  }
@@ -46,27 +42,6 @@ export class SallaFiltersWidget {
46
42
  this.isOpen = !this.isOpen;
47
43
  Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);
48
44
  }
49
- /**
50
- * @param {currentTarget: HTMLSallaPriceRangeElement} event
51
- * @param option
52
- * @private
53
- */
54
- handlePriceSelection(event, option) {
55
- this.changed.emit({
56
- event: event,
57
- option: option,
58
- value: {
59
- max: event.currentTarget.maxPrice,
60
- min: event.currentTarget.minPrice,
61
- }
62
- });
63
- }
64
- renderSliderOption(option) {
65
- if (option.type !== FilterOptionTypes.RANGE) {
66
- return '';
67
- }
68
- return h("salla-price-range", { onMinPriceSelected: (event) => this.handlePriceSelection(event, option), onMaxPriceSelected: (event) => this.handlePriceSelection(event, option), ref: el => this.priceRange = el, "min-price": option.values.min, "max-price": option.values.max });
69
- }
70
45
  renderFilterOption(option) {
71
46
  if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {
72
47
  return '';
@@ -89,6 +64,7 @@ export class SallaFiltersWidget {
89
64
  }
90
65
  getOptionLabel(option, filterOption) {
91
66
  if (option.key == 'rating') {
67
+ //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products
92
68
  return h("salla-rating-stars", { size: "small", value: filterOption });
93
69
  }
94
70
  let label = filterOption.value || 'null';
@@ -96,7 +72,9 @@ export class SallaFiltersWidget {
96
72
  return h("span", { class: "s-filters-option-name" }, label);
97
73
  }
98
74
  render() {
99
- return (h(Host, { class: "s-filters-widget-container" }, h("h3", { class: "s-filters-widget-title", onClick: () => this.toggleWidget() }, h("span", null, this.widgetTitle), h("span", { class: `s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}` })), h("div", { class: "s-filters-widget-content", ref: (el) => this.widgetContent = el }, h("div", { class: "s-filters-widget-values", ref: (el) => this.widgetValues = el }, h("slot", null), this.renderFilterOption(this.option), this.renderSliderOption(this.option)), this.withLoadMore &&
75
+ return (h(Host, { class: "s-filters-widget-container" }, h("h3", { class: "s-filters-widget-title", onClick: () => this.toggleWidget() }, h("span", null, this.widgetTitle), h("span", { class: `s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}` })), h("div", { class: "s-filters-widget-content", ref: (el) => this.widgetContent = el }, h("div", { class: "s-filters-widget-values", ref: (el) => this.widgetValues = el }, h("slot", null), this.option.type !== FilterOptionTypes.RANGE
76
+ ? this.renderFilterOption(this.option)
77
+ : h("salla-price-range", { onChanged: (event) => this.changed.emit(event.detail), ref: price => this.priceRange = price, filtersData: this.filtersData, option: this.option })), this.withLoadMore &&
100
78
  h("a", { class: "s-filters-widget-more", onClick: () => this.showMore() }, !this.isShowMore ? 'عرض المزيد' : 'عرض أقل'))));
101
79
  }
102
80
  static get is() { return "salla-filters-widget"; }
@@ -1 +1 @@
1
- {"version":3,"file":"salla-filters-widget.js","sourceRoot":"","sources":["../../../src/components/salla-filters-widget/salla-filters-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAS,qBAAqB,EAAE,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAM7F,MAAM,OAAO,kBAAkB;;IAWrB,eAAU,GAAW,GAAG,CAAC;;;;;kBACN,IAAI;sBACA,KAAK;;EAIpC,iBAAiB;IACf,4DAA4D;IAC5D,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACvF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;EACvC,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,YAAY,C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kB,CAAC,IAAI,CAAC,MAAM,CAAC;UACpC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CACjC;QACL,IAAI,CAAC,YAAY;UAClB,SAAG,KAAK,EAAC,uBAAuB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAK,CAEhF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {Component, Host, h, Method, State, Prop, Event, Element} from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport {Filter, FilterOptionInputType, FilterOptionTypes} from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n @Prop({mutable: true}) widgetTitle: string;\n @Prop({mutable: true}) withLoadMore: boolean;\n @Prop({reflect: true}) filtersData: object;\n @Prop({reflect: true}) option: Filter;\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = Array.isArray(this.option.values) && this.option.values.length > 8;\n this.widgetTitle = this.option.label;\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.minPrice = (this.option.values as any)?.min;\n this.priceRange.maxPrice = (this.option.values as any)?.max;\n await this.priceRange.maxTrigger();\n await this.priceRange.minTrigger();\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n /**\n * @param {currentTarget: HTMLSallaPriceRangeElement} event\n * @param option\n * @private\n */\n private handlePriceSelection(event, option: Filter) {\n this.changed.emit({\n event: event,\n option: option,\n value: {\n max: event.currentTarget.maxPrice,\n min: event.currentTarget.minPrice,\n }\n })\n }\n\n renderSliderOption(option) {\n if (option.type !== FilterOptionTypes.RANGE) {\n return '';\n }\n return <salla-price-range\n onMinPriceSelected={(event) => this.handlePriceSelection(event, option)}\n onMaxPriceSelected={(event) => this.handlePriceSelection(event, option)}\n ref={el => this.priceRange = el}\n min-price={option.values.min}\n max-price={option.values.max}/>;\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n //@ts-ignore\n return option.values.map((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n\n return <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`}>\n <input\n id={`${option.key}-option-${index}`}\n name={option.key}\n type={option.inputType}\n //TODO:: debug more why sometimes it's not rendered as selected🤨\n checked={this.isSelectedOption(option, value)}\n class={`s-filters-${option.inputType}`}\n onChange={e => this.changed.emit({event: e, option: option, value: value})}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n }\n )\n }\n\n private isSelectedOption(option: Filter, value) {\n if (!this.filtersData || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n return <salla-rating-stars size=\"small\" value={filterOption}/>;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.widgetTitle}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`}/>\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot/>\n {this.renderFilterOption(this.option)}\n {this.renderSliderOption(this.option)}\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? 'عرض المزيد' : 'عرض أقل'}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"salla-filters-widget.js","sourceRoot":"","sources":["../../../src/components/salla-filters-widget/salla-filters-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,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AAC,SAAS,CAAK,CAEhF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {Component, Host, h, Method, State, Prop, Event, Element} from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport {Filter, FilterOptionInputType, FilterOptionTypes} from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n @Prop({mutable: true}) widgetTitle: string;\n @Prop({mutable: true}) withLoadMore: boolean;\n @Prop({reflect: true}) filtersData: object;\n @Prop({reflect: true}) option: Filter;\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = Array.isArray(this.option.values) && this.option.values.length > 8;\n this.widgetTitle = this.option.label;\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n //@ts-ignore\n return option.values.map((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n\n return <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`}>\n <input\n id={`${option.key}-option-${index}`}\n name={option.key}\n type={option.inputType}\n //TODO:: debug more why sometimes it's not rendered as selected🤨\n checked={this.isSelectedOption(option, value)}\n class={`s-filters-${option.inputType}`}\n onChange={e => this.changed.emit({event: e, option: option, value: value})}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n }\n )\n }\n\n private isSelectedOption(option: Filter, value) {\n if (!this.filtersData || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption}/>;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.widgetTitle}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`}/>\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot/>\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => this.changed.emit(event.detail)}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option}/>\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? 'عرض المزيد' : 'عرض أقل'}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"intefaces.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/intefaces.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;EACvB,gCAAa,CAAA;EACb,oCAAiB,CAAA;EACjB,kCAAe,CAAA;AACnB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B","sourcesContent":["export interface CustomField {\n id: number;\n label: string;\n description: string;\n type: string;\n required: boolean;\n}\n\nexport enum CustomFieldType {\n TEXT = 'text',\n NUMBER = 'number',\n PHOTO = 'photo'\n}"]}
1
+ {"version":3,"file":"intefaces.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/intefaces.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;EACvB,gCAAa,CAAA;EACb,oCAAiB,CAAA;EACjB,kCAAe,CAAA;AACnB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B","sourcesContent":["export interface CustomField {\n id: number;\n label: string;\n description: string;\n type: string;\n required: boolean;\n length: number;\n}\n\nexport enum CustomFieldType {\n TEXT = 'text',\n NUMBER = 'number',\n PHOTO = 'photo'\n}\n"]}
@@ -258,7 +258,7 @@ export class SallaLoginModal {
258
258
  ? h("salla-file-upload", { name: "image", "instant-upload": true, id: `${field.id}`, title: field.label, required: field.required, url: salla.url.get('upload-image'),
259
259
  // onUploaded={}
260
260
  labelIdle: this.getFilepondPlaceholder() })
261
- : h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
261
+ : h("input", { onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, onKeyDown: e => this.typing(e, this.newUser), class: "s-login-modal-input s-ltr", maxlength: field.length || 1000, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, type: "text" }),
262
262
  h("span", { class: "s-login-modal-error-message" })
263
263
  ])), h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), h("slot", { name: "after-registration" })))));
264
264
  }
@@ -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,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACjF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAc,eAAe,EAAC,MAAM,aAAa,CAAC;AAEzD;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,eAAe;EAC1B;IA2EQ,uBAAkB,GAAW,EAAE,CAAC;IAgGhC,WAAM,GAAG,CAAC,CAAC,EAA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BAA6B,GAAE;WAC5C,CAAC,CACG;UAEP,uCAA8B,QAAQ,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EACnE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAgB;UAClG,YAAM,IAAI,EAAC,oBAAoB,GAAE,CAC7B,CACF,CACM,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Listen, Method, Prop, State} from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\nimport PhoneIcon from \"../../assets/svg/phone.svg\";\nimport EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\nimport 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', (event) => this.open(event));\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 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() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: 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 this.modal.close();\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) {\n window.location.reload();\n } else {\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 this.modal?.setTitle(this.title);\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 if (this.isEmailAllowed && this.isMobileAllowed) {\n this.showTab(this.homeTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n } else if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n }\n return this.modal.open();\n }\n\n private showTab(tab, evt?) {\n evt?.preventDefault();\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 const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && setTimeout(() => {\n input.focus();\n }, 100); \n\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n\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 //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} = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n\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 return;\n }\n\n this.login(this.emailBtn, {type: 'email', email: this.loginEmail.value});\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\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 .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 && 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 render() {\n // @ts-ignore\n // @ts-ignore\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon}/>\n <div class=\"s-login-modal-wrapper\">\n\n {/* Tab 1 (Select Login Type)*/}\n {this.isEmailAllowed && this.isMobileAllowed ?\n <div class={this.generateTabClasses('home')} data-name=\"home\" ref={tab => this.homeTab = tab}>\n <p class=\"s-login-modal-sub-title\">{salla.lang.get('blocks.header.select_login_way')}</p>\n <slot name=\"before-login-type\"/>\n <a href=\"#\" class=\"s-login-modal-main-btn\" onClick={(evt) => this.showTab(this.mobileTab, evt)}>\n <span class=\"s-login-modal-main-btn-icon\" innerHTML={PhoneIcon}/>\n <span class=\"s-login-modal-main-btn-text\">{salla.lang.get('blocks.header.sms')}</span>\n <span class=\"s-login-modal-main-btn-arrow\" innerHTML={KeyboardArrowRightIcon}/>\n </a>\n <a href=\"#\" class=\"s-login-modal-main-btn\" onClick={(evt) => this.showTab(this.emailTab, evt)}>\n <span class=\"s-login-modal-main-btn-icon\" innerHTML={EmailIcon}/>\n <span class=\"s-login-modal-main-btn-text\">{salla.lang.get('common.elements.email')}</span>\n <span class=\"s-login-modal-main-btn-arrow\" innerHTML={KeyboardArrowRightIcon}/>\n </a>\n <slot name=\"after-login-type\"/>\n </div>\n : ''}\n\n\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)} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n <salla-tel-input tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>\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 placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class=\"s-login-modal-input s-ltr\"/>\n <span class=\"s-login-modal-error-message\"/>\n <salla-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\n\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 </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 <salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>\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\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 type=\"text\"\n onKeyDown={e => this.typing(e, this.newUser)}\n onInput={el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}}\n placeholder={field.description}\n required={field.required}\n title={field.label}\n id={`${field.id}`}\n class=\"s-login-modal-input s-ltr\"/>,\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 </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,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACjF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAA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SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,EAC/B,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,EAAE,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,EACjB,IAAI,EAAC,MAAM,GAAE;YACjB,YAAM,KAAK,EAAC,6BAA6B,GAAE;WAC5C,CAAC,CACG;UAEP,uCAA8B,QAAQ,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EACnE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAgB;UAClG,YAAM,IAAI,EAAC,oBAAoB,GAAE,CAC7B,CACF,CACM,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Listen, Method, Prop, State} from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\nimport PhoneIcon from \"../../assets/svg/phone.svg\";\nimport EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\nimport 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', (event) => this.open(event));\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 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() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: 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 this.modal.close();\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) {\n window.location.reload();\n } else {\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 this.modal?.setTitle(this.title);\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 if (this.isEmailAllowed && this.isMobileAllowed) {\n this.showTab(this.homeTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n } else if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n }\n return this.modal.open();\n }\n\n private showTab(tab, evt?) {\n evt?.preventDefault();\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 const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && setTimeout(() => {\n input.focus();\n }, 100);\n\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n\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 //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} = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n\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 return;\n }\n\n this.login(this.emailBtn, {type: 'email', email: this.loginEmail.value});\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\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 .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 && 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 render() {\n // @ts-ignore\n // @ts-ignore\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon}/>\n <div class=\"s-login-modal-wrapper\">\n\n {/* Tab 1 (Select Login Type)*/}\n {this.isEmailAllowed && this.isMobileAllowed ?\n <div class={this.generateTabClasses('home')} data-name=\"home\" ref={tab => this.homeTab = tab}>\n <p class=\"s-login-modal-sub-title\">{salla.lang.get('blocks.header.select_login_way')}</p>\n <slot name=\"before-login-type\"/>\n <a href=\"#\" class=\"s-login-modal-main-btn\" onClick={(evt) => this.showTab(this.mobileTab, evt)}>\n <span class=\"s-login-modal-main-btn-icon\" innerHTML={PhoneIcon}/>\n <span class=\"s-login-modal-main-btn-text\">{salla.lang.get('blocks.header.sms')}</span>\n <span class=\"s-login-modal-main-btn-arrow\" innerHTML={KeyboardArrowRightIcon}/>\n </a>\n <a href=\"#\" class=\"s-login-modal-main-btn\" onClick={(evt) => this.showTab(this.emailTab, evt)}>\n <span class=\"s-login-modal-main-btn-icon\" innerHTML={EmailIcon}/>\n <span class=\"s-login-modal-main-btn-text\">{salla.lang.get('common.elements.email')}</span>\n <span class=\"s-login-modal-main-btn-arrow\" innerHTML={KeyboardArrowRightIcon}/>\n </a>\n <slot name=\"after-login-type\"/>\n </div>\n : ''}\n\n\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)} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n <salla-tel-input tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>\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 placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class=\"s-login-modal-input s-ltr\"/>\n <span class=\"s-login-modal-error-message\"/>\n <salla-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\n\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 </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 <salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>\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 </salla-modal>\n );\n }\n}\n\n"]}
@@ -2,6 +2,7 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { Host, h } from '@stencil/core';
5
+ import Cancel from '../../assets/svg/cancel.svg';
5
6
  export class SallaMaintenanceAlert {
6
7
  constructor() {
7
8
  this.title = undefined;
@@ -13,8 +14,19 @@ export class SallaMaintenanceAlert {
13
14
  this.message = salla.config.get('maintenance_details.message');
14
15
  this.buttonTitle = window.innerWidth <= 768 ? salla.config.get('maintenance_details.button_title') : salla.config.get('maintenance_details.button_full_title');
15
16
  }
17
+ closeAlert() {
18
+ salla.storage.set('hide_salla-maintenance-alert_at', Date.now());
19
+ this.host.style.display = 'none';
20
+ }
16
21
  render() {
17
- return (h(Host, { class: "s-maintenance-alert-wrapper" }, h("div", { class: "s-maintenance-alert-content" }, h("div", { class: "s-maintenance-alert-container" }, h("div", { class: "s-maintenance-alert-icon" }, h("img", { src: salla.url.cdn('images/alert.png'), alt: "Alert" })), h("div", { class: "s-maintenance-alert-text" }, h("h2", null, this.title), h("p", null, this.message))), h("div", null, h("a", { class: "s-maintenance-alert-btn", href: salla.config.get('maintenance_details.button_url') }, this.buttonTitle)))));
22
+ return (h(Host, { class: "s-maintenance-alert-wrapper" }, h("button", { class: "s-maintenance-alert-close", innerHTML: Cancel, onClick: () => this.closeAlert() }), h("div", { class: "s-maintenance-alert-content" }, h("div", { class: "s-maintenance-alert-container" }, h("div", { class: "s-maintenance-alert-icon" }, h("img", { src: salla.url.cdn('images/alert.png'), alt: "Alert" })), h("div", { class: "s-maintenance-alert-text" }, h("h2", null, this.title), h("p", null, this.message))), h("div", null, h("a", { class: "s-maintenance-alert-btn", href: salla.config.get('maintenance_details.button_url') }, this.buttonTitle)))));
23
+ }
24
+ componentDidLoad() {
25
+ //auto-hide the alert if close button is clicked before one hour
26
+ let hidden_at = salla.storage.get('hide_salla-maintenance-alert_at');
27
+ if (hidden_at && ((Date.now() - hidden_at) / 1000 / 60) < 60) {
28
+ this.closeAlert();
29
+ }
18
30
  }
19
31
  static get is() { return "salla-maintenance-alert"; }
20
32
  static get originalStyleUrls() {
@@ -34,5 +46,6 @@ export class SallaMaintenanceAlert {
34
46
  "buttonTitle": {}
35
47
  };
36
48
  }
49
+ static get elementRef() { return "host"; }
37
50
  }
38
51
  //# sourceMappingURL=salla-maintenance-alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"salla-maintenance-alert.js","sourceRoot":"","sources":["../../../src/components/salla-maintenance-alert/salla-maintenance-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAM1D,MAAM,OAAO,qBAAqB;;;;;;EAOhC,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;EACjK,CAAC;EACD,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAC,6BAA6B;MACvC,WAAK,KAAK,EAAC,6BAA6B;QACtC,WAAK,KAAK,EAAC,+BAA+B;UACxC,WAAK,KAAK,EAAC,0BAA0B;YACnC,WAAK,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAC,OAAO,GAAG,CACvD;UACN,WAAK,KAAK,EAAC,0BAA0B;YACnC,cAAK,IAAI,CAAC,KAAK,CAAM;YACrB,aAAI,IAAI,CAAC,OAAO,CAAK,CACjB,CACF;QACN;UACE,SAAG,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,IACxF,IAAI,CAAC,WAAW,CACf,CACA,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, State } from '@stencil/core';\n\n@Component({\n tag: 'salla-maintenance-alert',\n styleUrl: 'salla-maintenance-alert.scss',\n})\nexport class SallaMaintenanceAlert {\n\n\n @State() title: string;\n @State() message: string;\n @State() buttonTitle: string;\n\n componentWillLoad() {\n this.title = salla.config.get('maintenance_details.title');\n this.message = salla.config.get('maintenance_details.message');\n this.buttonTitle = window.innerWidth <= 768 ? salla.config.get('maintenance_details.button_title') : salla.config.get('maintenance_details.button_full_title');\n }\n render() {\n return (\n <Host class=\"s-maintenance-alert-wrapper\">\n <div class=\"s-maintenance-alert-content\">\n <div class=\"s-maintenance-alert-container\">\n <div class=\"s-maintenance-alert-icon\">\n <img src={salla.url.cdn('images/alert.png')} alt=\"Alert\" />\n </div>\n <div class=\"s-maintenance-alert-text\">\n <h2>{this.title}</h2>\n <p>{this.message}</p>\n </div>\n </div>\n <div>\n <a class=\"s-maintenance-alert-btn\" href={salla.config.get('maintenance_details.button_url')}>\n {this.buttonTitle}\n </a>\n </div>\n </div>\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"salla-maintenance-alert.js","sourceRoot":"","sources":["../../../src/components/salla-maintenance-alert/salla-maintenance-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,MAAM,MAAM,6BAA6B,CAAC;AAMjD,MAAM,OAAO,qBAAqB;;;;;;EAOhC,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC,KAA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;MAC5D,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;EACH,CAAC;;;;;;;;;;;;;;CAEF","sourcesContent":["import {Component, Host, h, State, Element} from '@stencil/core';\nimport Cancel from '../../assets/svg/cancel.svg';\n\n@Component({\n tag: 'salla-maintenance-alert',\n styleUrl: 'salla-maintenance-alert.scss',\n})\nexport class SallaMaintenanceAlert {\n\n @Element() host: HTMLElement;\n @State() title: string;\n @State() message: string;\n @State() buttonTitle: string;\n\n componentWillLoad() {\n this.title = salla.config.get('maintenance_details.title');\n this.message = salla.config.get('maintenance_details.message');\n this.buttonTitle = window.innerWidth <= 768 ? salla.config.get('maintenance_details.button_title') : salla.config.get('maintenance_details.button_full_title');\n }\n\n private closeAlert() {\n salla.storage.set('hide_salla-maintenance-alert_at', Date.now());\n this.host.style.display = 'none';\n }\n\n render() {\n return (\n <Host class=\"s-maintenance-alert-wrapper\">\n <button class=\"s-maintenance-alert-close\" innerHTML={Cancel} onClick={() => this.closeAlert()}/>\n <div class=\"s-maintenance-alert-content\">\n <div class=\"s-maintenance-alert-container\">\n <div class=\"s-maintenance-alert-icon\">\n <img src={salla.url.cdn('images/alert.png')} alt=\"Alert\"/>\n </div>\n <div class=\"s-maintenance-alert-text\">\n <h2>{this.title}</h2>\n <p>{this.message}</p>\n </div>\n </div>\n <div>\n <a class=\"s-maintenance-alert-btn\" href={salla.config.get('maintenance_details.button_url')}>\n {this.buttonTitle}\n </a>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n //auto-hide the alert if close button is clicked before one hour\n let hidden_at = salla.storage.get('hide_salla-maintenance-alert_at');\n if (hidden_at && ((Date.now() - hidden_at) / 1000 / 60) < 60) {\n this.closeAlert();\n }\n }\n\n}\n"]}