@salla.sa/twilight-components 1.6.2 → 1.6.3

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 (67) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-button_24.cjs.entry.js +10087 -0
  3. package/dist/cjs/twilight-components.cjs.js +1 -1
  4. package/dist/collection/components/salla-login-modal/salla-login-modal.js +3 -4
  5. package/dist/collection/components/salla-verify/salla-verify.js +1 -1
  6. package/dist/components/salla-login-modal.js +3 -4
  7. package/dist/components/salla-verify2.js +1 -1
  8. package/dist/esm/loader.js +1 -1
  9. package/dist/esm/salla-button_24.entry.js +10060 -0
  10. package/dist/esm/twilight-components.js +1 -1
  11. package/dist/twilight-components/p-30b2c5b0.entry.js +4 -0
  12. package/dist/twilight-components/twilight-components.esm.js +1 -1
  13. package/package.json +9 -3
  14. package/dist/cjs/Helper-8ae6a805.js +0 -28
  15. package/dist/cjs/arrow-right-3d137e4c.js +0 -13
  16. package/dist/cjs/cancel-ae668d91.js +0 -13
  17. package/dist/cjs/check-circle2-1aac98d1.js +0 -13
  18. package/dist/cjs/mail-2db058ee.js +0 -13
  19. package/dist/cjs/salla-button_10.cjs.entry.js +0 -2584
  20. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +0 -93
  21. package/dist/cjs/salla-list-tile_2.cjs.entry.js +0 -80
  22. package/dist/cjs/salla-loyalty.cjs.entry.js +0 -229
  23. package/dist/cjs/salla-product-availability.cjs.entry.js +0 -128
  24. package/dist/cjs/salla-product-size-guide.cjs.entry.js +0 -52
  25. package/dist/cjs/salla-quantity-input.cjs.entry.js +0 -101
  26. package/dist/cjs/salla-rating-modal.cjs.entry.js +0 -169
  27. package/dist/cjs/salla-rating-stars.cjs.entry.js +0 -83
  28. package/dist/cjs/salla-social-share.cjs.entry.js +0 -1447
  29. package/dist/cjs/salla-swiper.cjs.entry.js +0 -5023
  30. package/dist/cjs/salla-tab-content_3.cjs.entry.js +0 -159
  31. package/dist/cjs/star2-8288e6e1.js +0 -13
  32. package/dist/esm/Helper-e1d414a5.js +0 -26
  33. package/dist/esm/arrow-right-1c3e04f2.js +0 -11
  34. package/dist/esm/cancel-41a92070.js +0 -11
  35. package/dist/esm/check-circle2-f6e5f685.js +0 -11
  36. package/dist/esm/mail-9d5204c6.js +0 -11
  37. package/dist/esm/salla-button_10.entry.js +0 -2571
  38. package/dist/esm/salla-infinite-scroll.entry.js +0 -89
  39. package/dist/esm/salla-list-tile_2.entry.js +0 -75
  40. package/dist/esm/salla-loyalty.entry.js +0 -225
  41. package/dist/esm/salla-product-availability.entry.js +0 -124
  42. package/dist/esm/salla-product-size-guide.entry.js +0 -48
  43. package/dist/esm/salla-quantity-input.entry.js +0 -97
  44. package/dist/esm/salla-rating-modal.entry.js +0 -165
  45. package/dist/esm/salla-rating-stars.entry.js +0 -79
  46. package/dist/esm/salla-social-share.entry.js +0 -1443
  47. package/dist/esm/salla-swiper.entry.js +0 -5019
  48. package/dist/esm/salla-tab-content_3.entry.js +0 -153
  49. package/dist/esm/star2-b134fc74.js +0 -11
  50. package/dist/twilight-components/p-0d498694.entry.js +0 -4
  51. package/dist/twilight-components/p-14f0ff17.entry.js +0 -4
  52. package/dist/twilight-components/p-335abbbb.entry.js +0 -4
  53. package/dist/twilight-components/p-4cafb11b.entry.js +0 -4
  54. package/dist/twilight-components/p-5e63e308.entry.js +0 -4
  55. package/dist/twilight-components/p-648e74e5.entry.js +0 -4
  56. package/dist/twilight-components/p-6a3adf55.entry.js +0 -4
  57. package/dist/twilight-components/p-6da4bb74.entry.js +0 -4
  58. package/dist/twilight-components/p-897b2018.js +0 -4
  59. package/dist/twilight-components/p-93708e1e.js +0 -4
  60. package/dist/twilight-components/p-9d236cf4.entry.js +0 -4
  61. package/dist/twilight-components/p-9d2ca9c8.js +0 -4
  62. package/dist/twilight-components/p-af7d5660.js +0 -4
  63. package/dist/twilight-components/p-bdbd2386.entry.js +0 -4
  64. package/dist/twilight-components/p-cac3db69.entry.js +0 -4
  65. package/dist/twilight-components/p-d914a212.js +0 -4
  66. package/dist/twilight-components/p-dace8e6d.js +0 -4
  67. package/dist/twilight-components/p-f9253fda.entry.js +0 -4
@@ -1,93 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const index = require('./index-0d0167d5.js');
9
- const Helper = require('./Helper-8ae6a805.js');
10
-
11
- const sallaInfiniteScrollCss = "";
12
-
13
- const SallaInfiniteScroll = class {
14
- constructor(hostRef) {
15
- index.registerInstance(this, hostRef);
16
- /**
17
- * Next Page element
18
- */
19
- this.nextPage = '';
20
- /**
21
- * Is there is need to autoload next page when scroll `next-page-autoload|next-page.autoload`
22
- */
23
- this.autoload = false;
24
- /**
25
- * Class selector to know the container if it's not the host `<salla-infinite-scroll>`
26
- */
27
- this.container = 'salla-infinite-scroll';
28
- /**
29
- * Class selector to know list items
30
- */
31
- this.item = 'salla-infinite-scroll > *';
32
- Helper.Helper.setHost(this.host);
33
- this.status = document.createElement('div');
34
- this.status.className = 's-infinite-scroll-wrapper';
35
- this.status.innerHTML = `<div class="s-infinite-scroll-status" style="display:none">
36
- <p class="s-infinite-scroll-last infinite-scroll-last"></p>
37
- <p class="s-infinite-scroll-error infinite-scroll-error"></p>
38
- </div>
39
- <a href="${this.nextPage}" class="s-infinite-scroll-btn s-button-btn s-button-primary">
40
- <span class="s-button-text s-infinite-scroll-btn-text">${salla.lang.get('common.elements.load_more')}</span>
41
- <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>
42
- </a>`;
43
- this.btnLoader = this.status.querySelector('.s-button-loader');
44
- salla.lang.onLoaded(() => {
45
- this.status.querySelector('.s-button-text').innerHTML = salla.lang.get('common.elements.load_more');
46
- this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');
47
- this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');
48
- });
49
- }
50
- loading(isLoading = true) {
51
- let btnText = this.status.querySelector('.s-button-text');
52
- Helper.Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);
53
- this.btnLoader.style.display = isLoading ? 'inherit' : 'none';
54
- }
55
- render() {
56
- return this.nextPage.length > 1 ?
57
- index.h(index.Host, { class: "s-infinite-scroll-container" }, index.h("slot", null)) : '';
58
- }
59
- componentDidLoad() {
60
- if (this.nextPage.length === 0) {
61
- return;
62
- }
63
- this.host.insertAdjacentElement('afterend', this.status);
64
- let that = this;
65
- let infScroll = salla.infiniteScroll.initiate(this.container, {
66
- history: this.autoload ? 'push' : false,
67
- scrollThreshold: this.autoload ? 400 : false,
68
- nextPage: this.nextPage,
69
- checkLastPage: 'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',
70
- status: '.s-infinite-scroll-status',
71
- button: this.status.querySelector('.s-button-btn'),
72
- append: this.item,
73
- path: function () {
74
- return that.nextPage.replace(/page\=(\d)/g, 'page=' + (this.loadCount + 2));
75
- },
76
- })
77
- .on('request', () => this.loading())
78
- .on('load', () => {
79
- this.loading(false);
80
- if (infScroll.pageIndex == 2) {
81
- infScroll.option({ loadOnScroll: false });
82
- }
83
- if (infScroll.pageIndex == 3) {
84
- infScroll.option({ loadOnScroll: true });
85
- }
86
- })
87
- .on('error', () => this.loading(false));
88
- }
89
- get host() { return index.getElement(this); }
90
- };
91
- SallaInfiniteScroll.style = sallaInfiniteScrollCss;
92
-
93
- exports.salla_infinite_scroll = SallaInfiniteScroll;
@@ -1,80 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const index = require('./index-0d0167d5.js');
9
-
10
- const sallaListTileCss = "";
11
-
12
- const SallaListTile = class {
13
- constructor(hostRef) {
14
- index.registerInstance(this, hostRef);
15
- /**
16
- * Designates the component as anchor and applies the `href` attribute.
17
- */
18
- this.href = undefined;
19
- /**
20
- * Designates the target attribute. This should only be applied when using the `href` prop.
21
- */
22
- this.target = "_self";
23
- }
24
- generateClass() {
25
- return {
26
- "s-list-tile-item": true,
27
- "s-list-tile-item-href": !!this.href
28
- };
29
- }
30
- render() {
31
- return (index.h(index.Host, null, index.h("a", { class: this.generateClass(), href: this.href, target: this.target }, index.h("div", { class: "s-list-tile-item-icon" }, index.h("slot", { name: 'icon' })), index.h("div", { class: "s-list-tile-item-content" }, index.h("div", { class: "s-list-tile-item-title" }, index.h("slot", { name: 'title' })), index.h("div", { class: "s-list-tile-item-subtitle" }, index.h("slot", { name: "subtitle" }))), index.h("div", { class: "s-list-tile-item-action" }, index.h("slot", { name: 'action' })))));
32
- }
33
- };
34
- SallaListTile.style = sallaListTileCss;
35
-
36
- const Inbox = `<!-- Generated by IcoMoon.io -->
37
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
38
- <title>inbox</title>
39
- <path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>
40
- </svg>
41
- `;
42
-
43
- const sallaPlaceholderCss = "";
44
-
45
- const SallaPlaceholder = class {
46
- constructor(hostRef) {
47
- index.registerInstance(this, hostRef);
48
- this.translationLoaded = false;
49
- /**
50
- * Custom icon to display, defaults to [`sicon-inbox`]
51
- */
52
- this.icon = Inbox;
53
- /**
54
- * Defines the alignment of contents. Defaults to [`left`]
55
- */
56
- this.alignment = 'left';
57
- /**
58
- * The size of the icon. Defaults to [`md`]
59
- */
60
- this.iconSize = 'md';
61
- salla.lang.onLoaded(() => {
62
- this.translationLoaded = true;
63
- });
64
- }
65
- alignmentClass() {
66
- return {
67
- 's-placeholder-wrapper': true,
68
- 's-placeholder-align-left': this.alignment == 'left',
69
- 's-placeholder-align-center': this.alignment == 'center',
70
- 's-placeholder-align-right': this.alignment == 'right',
71
- };
72
- }
73
- render() {
74
- return (index.h(index.Host, { class: this.alignmentClass() }, index.h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), index.h("div", { class: "s-placeholder-title" }, index.h("slot", { name: 'title' }, index.h("span", null, salla.lang.get('common.elements.no_options')))), index.h("div", { class: "s-placeholder-description" }, index.h("slot", { name: 'description' }, index.h("span", null, salla.lang.get('common.errors.empty_results'))))));
75
- }
76
- };
77
- SallaPlaceholder.style = sallaPlaceholderCss;
78
-
79
- exports.salla_list_tile = SallaListTile;
80
- exports.salla_placeholder = SallaPlaceholder;
@@ -1,229 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const index = require('./index-0d0167d5.js');
9
- const star2 = require('./star2-8288e6e1.js');
10
- const cancel = require('./cancel-ae668d91.js');
11
-
12
- const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80">
13
- <title>star3</title>
14
- <defs>
15
- <style>
16
- .a {
17
- fill: none !important;
18
- }
19
-
20
- .b {
21
- fill: #ff9e01;
22
- }
23
-
24
- .c {
25
- fill: #fff;
26
- opacity: 0.1;
27
- }
28
-
29
- </style>
30
- </defs>
31
- <g transform="translate(-683 -269)">
32
- <rect class="a" width="80" height="80" transform="translate(683 269)" />
33
- <g transform="translate(684.539 261.216)">
34
- <path class="b"
35
- d="M110.117,37.062,90.024,35.2,82.043,16.665a1.61,1.61,0,0,0-2.958,0L71.1,35.2,51.011,37.062a1.61,1.61,0,0,0-.914,2.813l15.16,13.318L60.821,72.878a1.61,1.61,0,0,0,2.393,1.739l17.351-10.3,17.351,10.3a1.61,1.61,0,0,0,2.393-1.739L95.871,53.192l15.16-13.318A1.61,1.61,0,0,0,110.117,37.062Z"
36
- transform="translate(-42.104 -4.011)" />
37
- <g transform="translate(0 10.971)">
38
- <path class="b"
39
- d="M93.54,12.016c1.024,1.423,3.915,7.533,5.568,11.094a.559.559,0,0,1-.891.641c-2.853-2.7-7.73-7.377-8.754-8.8a2.512,2.512,0,0,1,4.077-2.935Z"
40
- transform="translate(-75.621 -10.971)" />
41
- <path class="b"
42
- d="M360.909,12.016c-1.024,1.423-3.915,7.533-5.568,11.094a.559.559,0,0,0,.891.641c2.853-2.7,7.73-7.377,8.754-8.8a2.512,2.512,0,0,0-4.077-2.935Z"
43
- transform="translate(-301.908 -10.971)" />
44
- <path class="b"
45
- d="M427.538,284.659c-1.667-.543-8.366-1.441-12.261-1.934a.559.559,0,0,0-.34,1.044c3.436,1.9,9.377,5.123,11.044,5.666a2.512,2.512,0,0,0,1.558-4.776Z"
46
- transform="translate(-352.351 -241.894)" />
47
- <path class="b"
48
- d="M1.734,284.659c1.667-.543,8.366-1.441,12.261-1.934a.559.559,0,0,1,.34,1.044c-3.436,1.9-9.377,5.123-11.044,5.666a2.512,2.512,0,0,1-1.558-4.776Z"
49
- transform="translate(0 -241.894)" />
50
- <path class="b"
51
- d="M239.794,412.414c0-1.753,1.224-8.4,1.963-12.257a.559.559,0,0,1,1.1,0c.739,3.855,1.963,10.5,1.963,12.257a2.512,2.512,0,0,1-5.023,0Z"
52
- transform="translate(-203.768 -341.301)" />
53
- </g>
54
- <path class="c"
55
- d="M84.945,23.4l-2.9-6.74a1.61,1.61,0,0,0-2.958,0L71.1,35.2,51.011,37.062a1.61,1.61,0,0,0-.914,2.813l15.16,13.318L60.821,72.878a1.61,1.61,0,0,0,2.393,1.739l2.309-1.371A125,125,0,0,1,84.945,23.4Z"
56
- transform="translate(-42.104 -4.011)" />
57
- </g>
58
- </g>
59
- </svg>
60
- `;
61
-
62
- const GiftImg = `<svg xmlns="http://www.w3.org/2000/svg" width="54.079" height="53.191" viewBox="0 0 54.079 53.191"><defs><style>.a{fill:#ee9d0d;}.b{fill:#c7830b;}.c{fill:#ea2b2d;}.d{fill:#cb2527;}.e{fill:#6699ce;}.f{fill:#faa6b2;}.g{fill:#a6deff;}.h{fill:#eeb436;}.i{fill:#f72d2f;}</style></defs><path class="a" d="M40,248H77.3v25.88a2.1,2.1,0,0,1-2.1,2.1H42.1a2.1,2.1,0,0,1-2.1-2.1Z" transform="translate(-38.135 -222.787)"/><path class="b" d="M250.632,248.711v12.755L236.2,248h13.67Z" transform="translate(-211.463 -222.787)"/><path class="b" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="c" d="M226.194,32.048l-.5.185a5.035,5.035,0,0,0-3.072,3.292l-.468,1.585-.759.414a5.035,5.035,0,0,0-2.422,3l8.865,8.271,5.09-5.456.262-6.205a5.191,5.191,0,0,0-7-5.083Z" transform="translate(-196.246 -31.722)"/><path class="c" d="M358.628,175.48l-.15.509a5.034,5.034,0,0,1-3.072,3.292l-1.55.577-.359.785a5.034,5.034,0,0,1-2.822,2.624L341.81,175l5.09-5.455,6.172-.69a5.191,5.191,0,0,1,5.555,6.629Z" transform="translate(-304.761 -152.837)"/><path class="d" d="M168,248h7.461v27.978H168Z" transform="translate(-151.213 -222.787)"/><path class="c" d="M40,336H77.3v7.461H40Z" transform="translate(-38.135 -300.528)"/><path class="d" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="a" d="M2.1,0H40.8a2.1,2.1,0,0,1,2.1,2.1V9.326H0V2.1A2.1,2.1,0,0,1,2.1,0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 18.641, 4.976)"/><path class="d" d="M0,0H9.326V9.326H0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 30.912, 16.424)"/><path class="d" d="M286.857,79.389a.931.931,0,0,1-.74-.365l-.615-.8a12.516,12.516,0,0,1-2.528-9,.933.933,0,0,1,1.855.2,10.66,10.66,0,0,0,2.153,7.667l.615.8a.933.933,0,0,1-.739,1.5Z" transform="translate(-252.718 -64.113)"/><path class="c" d="M185.485,178.151l-.039.014a30.78,30.78,0,0,1-12.034,1.906l-2.381-.1,4.092,3.817-1.181,4,3.728-1.206a30.775,30.775,0,0,0,9.833-5.315l.71-.572Z" transform="translate(-153.891 -161.081)"/><path class="d" d="M363.834,194.779a12.51,12.51,0,0,1-6.93-2.1l-.843-.559a.933.933,0,1,1,1.031-1.554l.842.558a10.659,10.659,0,0,0,7.8,1.618.933.933,0,1,1,.328,1.836A12.663,12.663,0,0,1,363.834,194.779Z" transform="translate(-316.982 -171.914)"/><path class="c" d="M275,202.524l-.012.04a30.776,30.776,0,0,0-1.069,12.137l.265,2.369-4.092-3.817-3.909,1.455.945-3.8a30.776,30.776,0,0,1,4.622-10.177l.521-.748Z" transform="translate(-237.949 -180.364)"/><circle class="e" cx="1.865" cy="1.865" r="1.865" transform="translate(10.259 0.032)"/><circle class="f" cx="1.865" cy="1.865" r="1.865" transform="translate(0 21.482)"/><path class="g" d="M36.663,36.663a.933.933,0,0,1-.885-.638l-.048-.143a2.946,2.946,0,0,0-2.8-2.017.933.933,0,1,1,0-1.865A4.808,4.808,0,0,1,37.5,35.292l.048.143a.933.933,0,0,1-.885,1.228Z" transform="translate(-31.067 -31.968)"/><path class="g" d="M79.493,194.438a.929.929,0,0,1-.506-.15l-.185-.12a2.074,2.074,0,0,0-2.192-.047.933.933,0,0,1-.947-1.607,3.929,3.929,0,0,1,4.153.088l.185.12a.933.933,0,0,1-.508,1.716Z" transform="translate(-69.235 -173.283)"/><path class="h" d="M27.751,85.141l2.88,2.644,3.811-.874-1.624,3.556,2.008,3.354-3.884-.446-2.569,2.946L27.6,92.49,24,90.957l3.4-1.922Z" transform="translate(-24 -78.914)"/><path class="h" d="M82.174,227.375l-.959,3.772,2.564,2.928-3.884.254L77.9,237.673l-1.442-3.615-3.8-.862,2.993-2.488-.353-3.876,3.291,2.078Z" transform="translate(-66.992 -204.086)"/><path class="i" d="M300.471,141.9l-5.455-5.09,5.09-5.456a8.342,8.342,0,0,1,5.455,5.09Z" transform="translate(-263.422 -119.737)"/></svg>`;
63
-
64
- const sallaLoyaltyCss = "#salla-loyalty-modal .s-swiper-button-prev button,#salla-loyalty-modal .s-swiper-button-next button{box-shadow:#32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px}";
65
-
66
- const SallaLoyalty = class {
67
- constructor(hostRef) {
68
- index.registerInstance(this, hostRef);
69
- this.loyaltyProgram = undefined;
70
- this.buttonLoading = false;
71
- this.selectedItem = undefined;
72
- this.askConfirmation = false;
73
- this.is_loggedin = false;
74
- /**
75
- * The exchanged prize point
76
- */
77
- this.prizePoints = undefined;
78
- /**
79
- * Available customer points with which they can exchange.
80
- */
81
- this.customerPoints = undefined;
82
- /**
83
- * The exchangable prize title
84
- */
85
- this.prizeTitle = undefined;
86
- /**
87
- * Does the merchant allow to login using email
88
- */
89
- this.allowEmail = true;
90
- /**
91
- * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`
92
- */
93
- this.allowMobile = true;
94
- /**
95
- * Does the merchant require registration with email & mobile
96
- */
97
- this.requireEmail = false;
98
- salla.event.on('loyalty::open', () => this.open());
99
- salla.auth.event.onLoggedIn(() => {
100
- this.is_loggedin = true;
101
- });
102
- salla.lang.onLoaded(() => {
103
- this.translationLoaded = true;
104
- });
105
- }
106
- setSelectedPrizeItem(item) {
107
- if (!this.selectedItem || this.selectedItem.id != item.id) {
108
- this.selectedItem = item;
109
- }
110
- else {
111
- this.selectedItem = undefined;
112
- }
113
- }
114
- handleLongText(text) {
115
- if (text.length > 150) {
116
- return text.substring(0, 150) + '...';
117
- }
118
- return text;
119
- }
120
- prizeItem(item) {
121
- let klass = {
122
- 's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem.id == item.id,
123
- "s-loyalty-prize-item": true
124
- };
125
- return index.h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, index.h("img", { class: "s-loyalty-prize-item-image", src: item.image, alt: item.name }), index.h("div", { class: "s-loyalty-prize-item-title" }, item.name), index.h("div", { class: "s-loyalty-prize-item-subtitle" }, this.handleLongText(item.description)), index.h("div", { class: "s-loyalty-prize-item-points" }, item.cost_points, " ", salla.lang.get('pages.loyalty_program.point'), index.h("div", { class: "s-loyalty-prize-item-check" }, index.h("div", null))));
126
- }
127
- getConfirmationModal() {
128
- var _a, _b;
129
- return [
130
- index.h("salla-placeholder", { alignment: "center", icon: Star3, class: "s-loyalty-confirmation-modal-content" }, index.h("div", { slot: "title", class: "s-loyalty-confirmation-title" }, salla.lang.get('pages.loyalty_program.exchange_points')), index.h("div", { slot: "description" }, salla.lang.get('pages.loyalty_program.are_you_sure_to_exchange'), " ( ", index.h("strong", null, (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.cost_points), " ) ", salla.lang.get('pages.loyalty_program.for'), " ( ", index.h("strong", null, (_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.name), " )")),
131
- index.h("div", { class: "s-loyalty-confirmation-actions" }, index.h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.cancelProcess() }, salla.lang.get('pages.loyalty_program.cancellation')), index.h("salla-button", { loading: this.buttonLoading, width: "wide", onClick: () => this.exchangeLoyaltyPoint() }, salla.lang.get('pages.loyalty_program.confirm')))
132
- ];
133
- }
134
- getAfterExchangeUI() {
135
- return index.h("slot", { name: 'points-applied-widget' }, index.h("salla-list-tile", { class: "s-loyalty-after-exchange" }, index.h("div", { slot: "title", class: "s-loyalty-after-exchange-title" }, this.prizeTitle, " \u00A0 - \u00A0 ", this.prizePoints), index.h("div", { slot: 'action', class: "s-loyalty-after-exchange-action" }, index.h("salla-button", { class: "s-loyalty-after-exchange-reset", shape: "icon", fill: 'outline', color: "danger", size: "small", onClick: () => this.resetExchange() }, index.h("span", { innerHTML: cancel.Cancel })))));
136
- }
137
- /**
138
- * Show loyalty modal
139
- */
140
- async open() {
141
- if (!this.is_loggedin)
142
- return salla.event.dispatch('login::open');
143
- this.modal.open();
144
- return await salla.loyalty.getProgram()
145
- .then((response) => {
146
- this.loyaltyProgram = response.data;
147
- })
148
- .catch(e => console.log(e))
149
- .finally(() => {
150
- this.modal.stopLoading();
151
- });
152
- }
153
- /**
154
- *
155
- * Hide loyalty modal
156
- */
157
- async close() {
158
- return this.modal.close();
159
- }
160
- /**
161
- *
162
- * Cancel Exchanged prizes
163
- */
164
- async resetExchange() {
165
- return await salla.loyalty.reset()
166
- .then(() => {
167
- this.prizePoints = undefined;
168
- this.prizeTitle = undefined;
169
- }).catch(e => console.log(e));
170
- }
171
- /**
172
- * Open Confirmation modal
173
- */
174
- async openConfirmation() {
175
- return await this.modal.close()
176
- .then(() => this.confirmationModal.open())
177
- .catch(e => console.log(e));
178
- }
179
- /**
180
- * Cancel process
181
- */
182
- async cancelProcess() {
183
- return await this.confirmationModal.close()
184
- .then(() => this.selectedItem = null)
185
- .catch(e => console.log(e));
186
- }
187
- /**
188
- * Exchange loyalty points with the selected prize item
189
- * @param {number} loyalty_prize_id
190
- *
191
- */
192
- async exchangeLoyaltyPoint() {
193
- this.buttonLoading = true;
194
- return await salla.loyalty.exchange(this.selectedItem.id)
195
- .then((response) => {
196
- this.loyaltyProgram = response.data;
197
- })
198
- .catch(e => console.log(e))
199
- .finally(() => {
200
- this.buttonLoading = false;
201
- this.cancelProcess();
202
- });
203
- }
204
- render() {
205
- // A. when the exchange is done, and we have the final prize points to show it in cart page
206
- if (this.prizePoints) {
207
- return this.getAfterExchangeUI();
208
- }
209
- return [
210
- index.h("slot", { name: 'widget' }, this.customerPoints ?
211
- index.h("salla-list-tile", { class: 's-loyalty-widget' }, index.h("div", { slot: "icon", class: "s-loyalty-widget-icon", innerHTML: star2.Star2 }), index.h("div", { slot: "subtitle" }, this.is_loggedin ? salla.lang.get('pages.loyalty_program.cart_total_point_summary', { "balance": this.customerPoints }) : (this.guestMessage || salla.lang.get('pages.loyalty_program.guest_message')), index.h("salla-button", { shape: "link", color: "primary", onClick: () => salla.event.dispatch("loyalty::open") }, this.is_loggedin ? salla.lang.get('pages.loyalty_program.cart_point_exchange_now') : salla.lang.get('blocks.header.login')))) :
212
- ''),
213
- index.h("salla-modal", { noPadding: true, width: "sm", ref: modal => this.confirmationModal = modal }, this.getConfirmationModal()),
214
- index.h("salla-modal", { isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index.h("div", { slot: "loading" }, index.h("div", { class: "s-loyalty-skeleton" }, index.h("salla-list-tile", { class: "s-loyalty-header" }, index.h("div", { slot: "icon", class: "s-loyalty-header-icon" }, index.h("salla-skeleton", { type: "circle", height: '6rem', width: '6rem' })), index.h("div", { slot: "title", class: "s-loyalty-header-title mb-5" }, index.h("salla-skeleton", { height: '15px', width: '50%' })), index.h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, index.h("salla-skeleton", { height: '10px' }), index.h("salla-skeleton", { height: '10px', width: '75%' }))), index.h("div", { class: "s-loyalty-skeleton-cards" }, [...Array(3)].map(() => index.h("div", { class: "s-loyalty-prize-item" }, index.h("salla-skeleton", { height: '9rem' }), index.h("div", { class: "s-loyalty-prize-item-title" }, index.h("salla-skeleton", { height: '15px', width: '75%' })), index.h("div", { class: "s-loyalty-prize-item-subtitle" }, index.h("salla-skeleton", { height: '10px', width: '50%' }), index.h("salla-skeleton", { height: '10px', width: '25%' })), index.h("div", { class: "s-loyalty-prize-item-points" }, index.h("salla-skeleton", { height: '15px', width: '100px' }), index.h("div", { class: "s-loyalty-prize-item-check" }, index.h("salla-skeleton", { height: '1rem', width: '1rem', type: 'circle' })))))))), !!this.loyaltyProgram ?
215
- [
216
- index.h("salla-list-tile", { id: 's-loyalty-header', class: "s-loyalty-header" }, index.h("div", { slot: "icon", class: "s-loyalty-header-icon", innerHTML: GiftImg }), index.h("div", { slot: "title", class: "s-loyalty-header-title" }, this.loyaltyProgram.prize_promotion_title), index.h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, this.loyaltyProgram.prize_promotion_description)),
217
- index.h("salla-tabs", null, this.loyaltyProgram.prizes.map((prize) => index.h("salla-tab-header", { slot: "header", name: prize.title }, index.h("span", null, prize.title))), this.loyaltyProgram.prizes.map((prize) => index.h("salla-tab-content", { slot: "content", name: prize.title }, index.h("salla-swiper", { "space-between-items": "20" }, prize.items.map((item) => this.prizeItem(item)))))),
218
- index.h("salla-button", { disabled: !this.selectedItem, width: "wide", class: "s-loyalty-program-redeem-btn", onClick: () => this.openConfirmation() }, salla.lang.get('pages.loyalty_program.exchange_points')),
219
- ]
220
- : index.h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" })),
221
- ];
222
- }
223
- componentDidLoad() {
224
- this.is_loggedin = salla.config.isUser();
225
- }
226
- };
227
- SallaLoyalty.style = sallaLoyaltyCss;
228
-
229
- exports.salla_loyalty = SallaLoyalty;
@@ -1,128 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const index = require('./index-0d0167d5.js');
9
- const Helper = require('./Helper-8ae6a805.js');
10
-
11
- const BellRingIcon = `<!-- Generated by IcoMoon.io -->
12
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
13
- <title>bell-ring</title>
14
- <path d="M2.667 13.333v-4c0-2.592 0.748-5.107 2.161-7.271 0.404-0.616 0.231-1.443-0.387-1.845-0.616-0.401-1.443-0.228-1.845 0.388-1.699 2.599-2.596 5.617-2.596 8.728v4c0 0.736 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333zM25.333 15.647v-6.313c0-5.147-4.188-9.333-9.333-9.333s-9.333 4.187-9.333 9.333v6.312l-5.157 9.027c-0.236 0.413-0.235 0.92 0.004 1.331 0.239 0.412 0.679 0.664 1.153 0.664h8c0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333h8c0.475 0 0.915-0.252 1.153-0.664 0.239-0.411 0.24-0.917 0.004-1.331zM16 29.333c-1.471 0-2.667-1.196-2.667-2.667h5.333c0 1.472-1.196 2.667-2.667 2.667zM4.965 24l4.193-7.339c0.113-0.2 0.175-0.429 0.175-0.661v-6.667c0-3.676 2.991-6.667 6.667-6.667s6.667 2.991 6.667 6.667v6.667c0 0.232 0.061 0.46 0.176 0.661l4.192 7.339zM29.403 0.603c-0.403-0.616-1.232-0.789-1.845-0.387-0.617 0.403-0.791 1.229-0.387 1.845 1.415 2.165 2.163 4.68 2.163 7.272v4c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-3.112-0.899-6.132-2.597-8.731z"></path>
15
- </svg>
16
- `;
17
-
18
- const sallaProductAvailabilityCss = "";
19
-
20
- const SallaProductAvailability = class {
21
- constructor(hostRef) {
22
- index.registerInstance(this, hostRef);
23
- this.isUser = Helper.Helper.isUser();
24
- this.translationLoaded = false;
25
- /**
26
- * product id that can visitor subscribe to its availability notification
27
- */
28
- this.productId = salla.config.get('page.id');
29
- /**
30
- * is current user already subscribed
31
- */
32
- this.isSubscribed = false;
33
- // @Method()
34
- this.submit = async () => {
35
- if (this.isUser) {
36
- return salla.api.product.availabilitySubscribe(this.productId)
37
- .then(() => this.isSubscribed = true);
38
- }
39
- let data = { id: this.productId };
40
- if (this.channels_.includes('sms')) {
41
- let { phone, countryCode } = await this.mobileInput.getValues();
42
- data['country_code'] = countryCode;
43
- data['phone'] = phone;
44
- }
45
- if (this.channels_.includes('email')) {
46
- this.email.value !== '' && (data['email'] = this.email.value);
47
- }
48
- await this.validateform();
49
- return this.btn.load()
50
- .then(() => this.btn.disable())
51
- .then(() => salla.api.product.availabilitySubscribe(data))
52
- .then(() => {
53
- this.isSubscribed = true;
54
- salla.storage.set(`product-${this.productId}-subscribed`, true);
55
- }) //no need to wait until finishing alert animation
56
- .then(() => this.btn.stop())
57
- .then(() => this.modal.close())
58
- .catch(() => this.btn.stop() && this.btn.enable());
59
- };
60
- // helpers
61
- this.typing = (e, submitMethod) => {
62
- const error = e.target.nextElementSibling;
63
- e.target.classList.remove('s-has-error');
64
- (error === null || error === void 0 ? void 0 : error.classList.contains('s-product-availability-error-msg')) && (error.innerText = '');
65
- e.key == 'Enter' && submitMethod();
66
- };
67
- salla.lang.onLoaded(() => {
68
- var _a;
69
- this.translationLoaded = true;
70
- this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
71
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
72
- });
73
- if (this.isUser)
74
- return;
75
- this.channelsWatcher(this.channels);
76
- this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
77
- this.host.removeAttribute('title');
78
- this.isVisitorSubscribed = salla.storage.get(`product-${this.productId}-subscribed`);
79
- }
80
- channelsWatcher(newValue) {
81
- this.channels_ = !!newValue ? newValue.split(',') : [];
82
- }
83
- async validateform() {
84
- try {
85
- if (this.channels_.includes('email')) {
86
- const isEmailValid = Helper.Helper.isValidEmail(this.email.value);
87
- if (isEmailValid)
88
- return;
89
- !isEmailValid && this.validateField(this.email, salla.lang.get('common.elements.email_is_valid'));
90
- }
91
- if (this.channels_.includes('sms')) {
92
- const isPhoneValid = await this.mobileInput.isValid();
93
- if (isPhoneValid)
94
- return;
95
- }
96
- }
97
- catch (error) {
98
- throw ('Please insert required fields');
99
- }
100
- }
101
- validateField(field, errorMsg) {
102
- field.classList.add('s-has-error');
103
- field.nextElementSibling['innerText'] = '* ' + errorMsg;
104
- }
105
- render() {
106
- return (index.h(index.Host, { class: "s-product-availability-wrap" }, this.isSubscribed || this.isVisitorSubscribed
107
- ? index.h("div", { class: "s-product-availability-subscribed" }, index.h("span", { innerHTML: BellRingIcon, class: "s-product-availability-subs-icon" }), " ", salla.lang.get('pages.products.notify_availability_success'))
108
- :
109
- index.h("salla-button", { width: "wide", onClick: () => this.isUser ? this.submit() : this.modal.open() }, salla.lang.get('pages.products.notify_availability')), this.isUser || this.isSubscribed || this.isVisitorSubscribed ? '' : this.renderModal()));
110
- }
111
- renderModal() {
112
- return (index.h("salla-modal", { ref: modal => this.modal = modal, "modal-title": this.title_, subTitle: salla.lang.get('pages.products.notify_availability_subtitle'), width: "sm" }, index.h("span", { slot: 'icon', innerHTML: BellRingIcon }), index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
113
- index.h("label", { class: "s-product-availability-label" }, salla.lang.get('common.elements.email')),
114
- index.h("input", { class: "s-product-availability-input", onKeyDown: e => this.typing(e, this.submit), placeholder: salla.lang.get('common.elements.email_placeholder') || 'your@email.com', ref: el => this.email = el, type: "email" }),
115
- index.h("span", { class: "s-product-availability-error-msg" })
116
- ] : '', this.channels_.includes('sms') ? [
117
- index.h("label", { class: "s-product-availability-label" }, salla.lang.get('common.elements.mobile')),
118
- index.h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
119
- ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { class: "modal-cancel-btn", width: "wide", color: "light", fill: "outline", onClick: () => this.modal.close() }, salla.lang.get('common.elements.cancel')), index.h("salla-button", { class: "submit-btn", "loader-position": 'center', width: "wide", ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
120
- }
121
- get host() { return index.getElement(this); }
122
- static get watchers() { return {
123
- "channels": ["channelsWatcher"]
124
- }; }
125
- };
126
- SallaProductAvailability.style = sallaProductAvailabilityCss;
127
-
128
- exports.salla_product_availability = SallaProductAvailability;
@@ -1,52 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const index = require('./index-0d0167d5.js');
9
- const Helper = require('./Helper-8ae6a805.js');
10
-
11
- const sallaProductSizeGuideCss = "";
12
-
13
- const SallaProductSizeGuide = class {
14
- constructor(hostRef) {
15
- index.registerInstance(this, hostRef);
16
- Helper.Helper.setHost(document);
17
- salla.event.on('size-guide::open', (product_id) => this.open(product_id));
18
- }
19
- /**
20
- * Show the size-guide modal window
21
- */
22
- async open(product_id) {
23
- this.modal.setTitle(salla.lang.get('pages.products.size_guides'));
24
- this.modal.open();
25
- return await salla.product.getSizeGuides(product_id)
26
- .then((response) => {
27
- this.guides = response.data;
28
- })
29
- .catch(e => console.log(e))
30
- .finally(() => this.modal.stopLoading());
31
- }
32
- /**
33
- *
34
- * Hide the size-guide modal window
35
- */
36
- async close() {
37
- return this.modal.close();
38
- }
39
- // !Todo - Enhance placeholder text
40
- showPlaceholder() {
41
- return index.h("salla-placeholder", { alignment: "center", iconSize: "xl" }, index.h("div", { slot: "title" }, salla.lang.get('pages.products.size_guide_placeholder')), index.h("div", { slot: "description" }, salla.lang.get('pages.products.size_guide_placeholder_info')));
42
- }
43
- render() {
44
- return (index.h(index.Host, { class: "s-product-size-guide-block" }, index.h("salla-modal", { id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index.h("div", { slot: "loading" }, index.h("div", { class: "s-product-size-guide-skeleton" }, index.h("salla-skeleton", { height: '15px', width: '25%' }), index.h("div", { class: "s-product-size-guide-skeleton-header" }, index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' })), index.h("div", { class: "s-product-size-guide-skeleton-content" }, index.h("salla-skeleton", { height: '15px', width: '25%' }), index.h("salla-skeleton", { height: '10px', width: '75%' }), index.h("salla-skeleton", { height: '10px', width: '50%' }), index.h("salla-skeleton", { height: '10px', width: '75%' }), index.h("salla-skeleton", { height: '10px', width: '100%' }), index.h("salla-skeleton", { height: '10px', width: '25%' }), index.h("salla-skeleton", { height: '10px', width: '60%' }), index.h("salla-skeleton", { height: '10px', width: '45%' }), index.h("salla-skeleton", { height: '10px', width: '30%' })))), index.h("slot", { name: "header" }), !!this.guides ?
45
- [index.h("div", { class: "container px-8" }, index.h("salla-tabs", null, this.guides.map((guide) => index.h("salla-tab-header", { slot: "header", name: guide.name }, index.h("span", null, guide.name))), this.guides.map((guide) => index.h("salla-tab-content", { slot: "content", name: guide.name }, index.h("div", { innerHTML: guide.description })))))]
46
- : this.showPlaceholder(), index.h("slot", { name: "footer" }))));
47
- }
48
- get host() { return index.getElement(this); }
49
- };
50
- SallaProductSizeGuide.style = sallaProductSizeGuideCss;
51
-
52
- exports.salla_product_size_guide = SallaProductSizeGuide;