@useinsider/guido 3.17.0 → 3.18.0
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.
- package/README.md +6 -5
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +82 -76
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useModuleRepair.js +33 -0
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useSave.js +30 -29
- package/dist/composables/useStripo.js +15 -15
- package/dist/composables/useSyncModuleExtractor.js +15 -13
- package/dist/composables/validators/useSyncModuleBlockValidator.js +24 -0
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +31 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Items/block.js +118 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +25 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Items/utils/constants.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +35 -29
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +10 -6
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +18 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/composables/useSyncModuleExtractor.d.ts +2 -0
- package/dist/src/composables/validators/useSyncModuleBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +35 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +43 -0
- package/dist/src/extensions/Blocks/Items/utils/constants.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +6 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/src/utils/itemsCurrencyRepair.d.ts +17 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/itemsCurrencyRepair.js +39 -0
- package/dist/utils/pairProductVariables.js +58 -58
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +3 -2
- package/dist/composables/useModuleDynamicContentRepair.js +0 -37
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -13
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heals stale price currency attributes on every v2 Items block inside a dropped
|
|
3
|
+
* saved module, driving `data-curency` / `data-currency_symbol` from each block's
|
|
4
|
+
* `esd-ext-config`. A saved module can serialize attrs that no longer match its
|
|
5
|
+
* config; the server-side export reads those exact attrs, so left stale they ship
|
|
6
|
+
* the wrong currency position/symbol.
|
|
7
|
+
*
|
|
8
|
+
* Pure `string → string`. Returns the original string untouched when nothing needs
|
|
9
|
+
* healing (0 blocks, all in sync) so the caller's `html !== currentHtml` guard stays
|
|
10
|
+
* meaningful. Fail-open: any parse fault returns the input unchanged.
|
|
11
|
+
*
|
|
12
|
+
* The module `<td>` stripe has no table context, so it is wrapped before parsing —
|
|
13
|
+
* a bare `<td>` root is otherwise dropped by the HTML parser (same reason
|
|
14
|
+
* recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
|
|
15
|
+
* root foster-parented out), it bails to the original string.
|
|
16
|
+
*/
|
|
17
|
+
export declare function repairItemsCurrencyAttributes(html: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const l = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17.768 11.694a1.03 1.03 0 0 1-1.465 0 1.051 1.051 0 0 1 0-1.478L17.51 9H9a1 1 0 1 1 0-2h8.509l-1.206-1.216a1.051 1.051 0 0 1 0-1.478 1.03 1.03 0 0 1 1.465 0l2.929 2.955c.404.408.404 1.07 0 1.478l-2.93 2.955zM3.303 15.261a1.051 1.051 0 0 0 0 1.478l2.93 2.955a1.03 1.03 0 0 0 1.464 0 1.051 1.051 0 0 0 0-1.478L6.49 17H15a1 1 0 1 0 0-2H6.491l1.206-1.216a1.051 1.051 0 0 0 0-1.478 1.03 1.03 0 0 0-1.465 0l-2.929 2.955z"/></svg>
|
|
2
|
+
`;
|
|
3
|
+
export {
|
|
4
|
+
l as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const a = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 3a2 2 0 0 0-2 2v2H5a1 1 0 0 0 0 2h1v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9h1a1 1 0 1 0 0-2h-3V5a2 2 0 0 0-2-2h-4zm4 4h-4V5h4v2zm-4 2h6v10H8V9h2zm2 2a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1z"></path></svg>
|
|
2
|
+
`;
|
|
3
|
+
export {
|
|
4
|
+
a as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const n = `.strategy-control-header {
|
|
2
|
+
padding: 16px 16px 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.strategy-control-title {
|
|
6
|
+
margin: 0;
|
|
7
|
+
color: var(--guido-color-gray-800);
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
line-height: 24px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.strategy-control-description-row {
|
|
14
|
+
padding: 8px 16px 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.strategy-control-description {
|
|
18
|
+
margin: 0;
|
|
19
|
+
color: var(--guido-color-gray-600);
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
line-height: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.strategy-control-description a {
|
|
25
|
+
color: var(--guido-color-primary-500);
|
|
26
|
+
text-decoration: underline;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.recommendation-controls-container .container.strategy-control-cta-row {
|
|
30
|
+
grid-template-columns: repeat(2, minmax(0, 180px));
|
|
31
|
+
justify-content: start;
|
|
32
|
+
gap: 16px;
|
|
33
|
+
padding: 0 16px 16px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.strategy-control-cta {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.strategy-control-cta > .button {
|
|
41
|
+
display: flex;
|
|
42
|
+
gap: 8px;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
border: none;
|
|
46
|
+
font-size: 15px;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
line-height: 24px;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.strategy-control-cta.primary > .button:disabled,
|
|
53
|
+
.strategy-control-cta.primary > .button.disabled {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
color: var(--guido-color-gray-800);
|
|
56
|
+
cursor: default;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.strategy-control-name-band {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
min-height: 48px;
|
|
63
|
+
padding: 0 16px;
|
|
64
|
+
background-color: var(--guido-color-gray-0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.strategy-control-name {
|
|
68
|
+
color: var(--guido-color-gray-800);
|
|
69
|
+
font-size: 15px;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
line-height: 24px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.strategy-control-actions {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
padding: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.strategy-control-action {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
padding: 0;
|
|
84
|
+
border: none;
|
|
85
|
+
background: none;
|
|
86
|
+
font-size: 15px;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
line-height: 24px;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.strategy-control-action > span {
|
|
93
|
+
padding: 0 8px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.strategy-control-action::before,
|
|
97
|
+
.strategy-control-cta.on > .button::before {
|
|
98
|
+
content: '';
|
|
99
|
+
flex: none;
|
|
100
|
+
width: 24px;
|
|
101
|
+
height: 24px;
|
|
102
|
+
background-color: currentcolor;
|
|
103
|
+
mask-repeat: no-repeat;
|
|
104
|
+
mask-position: center;
|
|
105
|
+
mask-size: 24px 24px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.strategy-control-action--change::before {
|
|
109
|
+
mask-image: var(--guido-icon-line-change);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.strategy-control-action--remove::before {
|
|
113
|
+
mask-image: var(--guido-icon-line-delete);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.strategy-control-cta.on > .button::before {
|
|
117
|
+
mask-image: var(--guido-icon-line-plus);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.strategy-control-action--change {
|
|
121
|
+
color: var(--guido-color-primary-500);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.strategy-control-action--remove {
|
|
125
|
+
color: var(--guido-color-danger-500);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.strategy-control-action:hover {
|
|
129
|
+
text-decoration: underline;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.recommendation-controls-container:not(.strategy-block) .strategy-control-container,
|
|
133
|
+
.recommendation-controls-container.strategy-block .product-count-control-container,
|
|
134
|
+
.recommendation-controls-container.strategy-block .algorithm-control-container,
|
|
135
|
+
.recommendation-controls-container.strategy-block .filters-control-container,
|
|
136
|
+
.recommendation-controls-container.strategy-block .shuffle-control-container {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.recommendation-controls-container.strategy-block {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.recommendation-controls-container.strategy-block .price-placement-control-container {
|
|
146
|
+
order: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.recommendation-controls-container.strategy-block .product-layout-control-container {
|
|
150
|
+
order: 2;
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
export {
|
|
154
|
+
n as default
|
|
155
|
+
};
|
|
@@ -43,7 +43,9 @@ const n = `.esd-x,
|
|
|
43
43
|
.recommendation-block-v2 .product-omnibus-discount ue-node-actions,
|
|
44
44
|
.recommendation-block-v2 .product-omnibus-discount ue-node-panel,
|
|
45
45
|
.recommendation-block-v2 .product-button ue-node-actions,
|
|
46
|
-
.recommendation-block-v2 .product-button ue-node-panel
|
|
46
|
+
.recommendation-block-v2 .product-button ue-node-panel,
|
|
47
|
+
.recommendation-block-v2 .ins-recommendation-title ue-node-actions,
|
|
48
|
+
.recommendation-block-v2 .ins-recommendation-title ue-node-panel {
|
|
47
49
|
display: none !important;
|
|
48
50
|
}
|
|
49
51
|
|
package/dist/utils/dateUtil.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE as
|
|
2
|
-
const
|
|
1
|
+
import { DEFAULT_LOCALE as n, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
|
|
2
|
+
const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 && !Number.isNaN(Number(t)) ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
|
|
3
3
|
const t = window.l10n;
|
|
4
|
-
return (t == null ? void 0 : t.locale) ===
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
return (t == null ? void 0 : t.locale) === a ? n : (t == null ? void 0 : t.locale) || n;
|
|
5
|
+
}, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
|
|
6
|
+
const t = window.l10n;
|
|
7
|
+
return (t == null ? void 0 : t.timezone) || u || c;
|
|
8
|
+
}, D = (t, e = s(), r = f()) => {
|
|
9
|
+
const o = {
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "2-digit",
|
|
12
|
+
day: "2-digit",
|
|
13
|
+
timeZone: r
|
|
14
|
+
}, i = m(t);
|
|
15
|
+
return new Intl.DateTimeFormat(e, o).format(i);
|
|
16
|
+
}, T = (t) => {
|
|
8
17
|
if (!t)
|
|
9
18
|
return "";
|
|
10
19
|
const e = new Date(t);
|
|
@@ -16,9 +25,13 @@ const i = (t) => {
|
|
|
16
25
|
second: "2-digit",
|
|
17
26
|
hour12: !1
|
|
18
27
|
}).format(e);
|
|
19
|
-
},
|
|
28
|
+
}, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
|
|
20
29
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
m as convertToDateObject,
|
|
31
|
+
T as formatPatchDate,
|
|
32
|
+
D as formatShortDate,
|
|
33
|
+
h as isAfterDate,
|
|
34
|
+
u as localTz,
|
|
35
|
+
s as locale,
|
|
36
|
+
f as timezone
|
|
24
37
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const o = (
|
|
2
|
-
const a =
|
|
3
|
-
text:
|
|
4
|
-
value:
|
|
1
|
+
const o = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
|
|
3
|
+
text: t.label,
|
|
4
|
+
value: s || ""
|
|
5
5
|
};
|
|
6
6
|
if (a.length >= 2) {
|
|
7
|
-
const [,
|
|
8
|
-
if (
|
|
9
|
-
let n =
|
|
7
|
+
const [, l, e] = a;
|
|
8
|
+
if (l.startsWith("default:")) {
|
|
9
|
+
let n = l.slice(8).trim();
|
|
10
10
|
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
11
|
} else {
|
|
12
|
-
const n =
|
|
13
|
-
n ? r.format = n : e || (r.fallback =
|
|
12
|
+
const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return r;
|
|
17
|
-
}, f = (
|
|
17
|
+
}, f = (t, c = !1) => t.map((a) => {
|
|
18
18
|
if (a.format)
|
|
19
19
|
return {
|
|
20
20
|
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
21
|
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
22
|
};
|
|
23
|
-
if (
|
|
23
|
+
if (c) {
|
|
24
24
|
if (!a.fallback)
|
|
25
25
|
return {
|
|
26
26
|
label: a.text,
|
|
@@ -36,33 +36,34 @@ const o = (l) => {
|
|
|
36
36
|
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
37
|
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
38
38
|
};
|
|
39
|
-
}), b = (
|
|
40
|
-
const
|
|
41
|
-
Array.isArray(
|
|
39
|
+
}), b = (t) => {
|
|
40
|
+
const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
|
|
41
|
+
Array.isArray(l) && l.forEach((e) => {
|
|
42
42
|
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
43
|
if (n.length > 0) {
|
|
44
|
-
|
|
44
|
+
s(n);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const u = e.text || e.tag_text;
|
|
48
|
-
u && e.value && !a.has(e.value) && (a.add(e.value),
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
|
|
49
49
|
});
|
|
50
|
-
}, [r] = Object.values(
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
const
|
|
50
|
+
}, [r] = Object.values(t ?? {});
|
|
51
|
+
return s(r), c;
|
|
52
|
+
}, i = (t, c, a = !1) => {
|
|
53
|
+
const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
|
|
54
54
|
return [
|
|
55
|
-
...f(
|
|
55
|
+
...f(t, a),
|
|
56
56
|
...f(r, a)
|
|
57
57
|
];
|
|
58
|
-
},
|
|
59
|
-
var
|
|
60
|
-
return ((
|
|
61
|
-
};
|
|
58
|
+
}, v = () => {
|
|
59
|
+
var t;
|
|
60
|
+
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
61
|
+
}, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
k as asText,
|
|
64
|
+
i as buildMergeTagEntries,
|
|
64
65
|
f as dynamicContentToMergeTags,
|
|
65
66
|
b as flattenDynamicContentList,
|
|
66
|
-
|
|
67
|
+
v as getCsrfToken,
|
|
67
68
|
o as mergeTagToDynamicContent
|
|
68
69
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { currencyAttrTargets as u, ITEMS_CURRENCY_ATTR as c } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { ItemsBlockId as l } from "../extensions/Blocks/Items/enums/controlEnums.js";
|
|
3
|
+
const s = "items-block-v2";
|
|
4
|
+
function f(e) {
|
|
5
|
+
const i = e.getAttribute("esd-ext-config");
|
|
6
|
+
if (!i)
|
|
7
|
+
return !1;
|
|
8
|
+
let t, r;
|
|
9
|
+
try {
|
|
10
|
+
({ position: t, symbol: r } = u(JSON.parse(i)));
|
|
11
|
+
} catch {
|
|
12
|
+
return !1;
|
|
13
|
+
}
|
|
14
|
+
let o = !1;
|
|
15
|
+
return e.querySelectorAll(`.${l.PRICE} p`).forEach((n) => {
|
|
16
|
+
t !== void 0 && n.getAttribute(c.POSITION) !== t && (n.setAttribute(c.POSITION, t), o = !0), r !== void 0 && n.getAttribute(c.SYMBOL) !== r && (n.setAttribute(c.SYMBOL, r), o = !0);
|
|
17
|
+
}), o;
|
|
18
|
+
}
|
|
19
|
+
function S(e) {
|
|
20
|
+
if (typeof e != "string" || !e.includes(s))
|
|
21
|
+
return e;
|
|
22
|
+
try {
|
|
23
|
+
const t = new DOMParser().parseFromString(
|
|
24
|
+
`<table><tbody><tr>${e}</tr></tbody></table>`,
|
|
25
|
+
"text/html"
|
|
26
|
+
).querySelector("tr"), r = t.querySelectorAll(`.${s}`);
|
|
27
|
+
if (r.length === 0)
|
|
28
|
+
return e;
|
|
29
|
+
let o = !1;
|
|
30
|
+
return r.forEach((n) => {
|
|
31
|
+
f(n) && (o = !0);
|
|
32
|
+
}), o ? t.innerHTML : e;
|
|
33
|
+
} catch (i) {
|
|
34
|
+
return console.error("Failed to repair items currency on module add:", i), e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
S as repairItemsCurrencyAttributes
|
|
39
|
+
};
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as D, isCustomCurrencySymbol as G } from "../extensions/Blocks/Items/constants/currency.js";
|
|
1
2
|
import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
-
import {
|
|
3
|
-
import { escapeReplacement as G } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
3
|
+
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
4
|
import { preserveTextStyles as F } from "./preserveTextStyles.js";
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
5
|
+
import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
|
|
6
6
|
const x = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function v(S,
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
}, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function v(S, y, b) {
|
|
12
|
+
let h = y;
|
|
13
|
+
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
|
+
h -= 1;
|
|
15
|
+
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
Object.entries(
|
|
22
|
-
|
|
17
|
+
function K(S) {
|
|
18
|
+
const y = O(S), b = new DOMParser().parseFromString(y, "text/html");
|
|
19
|
+
Y(b);
|
|
20
|
+
const h = L.PAIRS_FOR_EXTENSION;
|
|
21
|
+
Object.entries(h).forEach(([n, d]) => {
|
|
22
|
+
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
23
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
24
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
25
|
+
var $, H, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
|
|
27
|
+
if (u)
|
|
28
28
|
switch (n) {
|
|
29
29
|
case "imageSrc": {
|
|
30
30
|
let e = null, s = null;
|
|
31
31
|
if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
|
|
32
32
|
break;
|
|
33
|
-
const a =
|
|
33
|
+
const a = u.DEFAULT, l = u.ATTR;
|
|
34
34
|
if (a && e.src) {
|
|
35
35
|
const i = e.src;
|
|
36
|
-
a.some((
|
|
37
|
-
const
|
|
38
|
-
return i.includes(
|
|
36
|
+
a.some((_) => {
|
|
37
|
+
const f = _.split("/").pop() || "", P = i.split("/").pop() || "";
|
|
38
|
+
return i.includes(_) || i.includes(f) || P === f;
|
|
39
39
|
}) && (e.src = `{{${l}_${o}}}`);
|
|
40
40
|
}
|
|
41
|
-
const c = (
|
|
41
|
+
const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
|
|
42
42
|
if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
|
|
43
|
-
const i = (
|
|
43
|
+
const i = (N = h.itemLink) == null ? void 0 : N[g];
|
|
44
44
|
if (i) {
|
|
45
|
-
const
|
|
46
|
-
(
|
|
45
|
+
const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
|
|
46
|
+
(f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case "name": {
|
|
52
|
-
const e =
|
|
52
|
+
const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
|
|
53
53
|
t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
54
54
|
const c = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
55
|
if (c && l) {
|
|
56
|
-
const i = c.href,
|
|
57
|
-
(i ===
|
|
56
|
+
const i = c.href, R = `${window.location.href}${a}`;
|
|
57
|
+
(i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "price":
|
|
62
62
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
c ?
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
63
|
+
const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(D.POSITION) || "before";
|
|
64
|
+
let R;
|
|
65
|
+
c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const _ = e.CURRENCY;
|
|
67
|
+
let f = `{{${R}_${o}}}`;
|
|
68
|
+
const P = (t.getAttribute(D.SYMBOL) || "").trim(), V = G(P);
|
|
69
69
|
let C = "";
|
|
70
|
-
|
|
70
|
+
V ? C = P : _ && (C = `{{${_}_${o}}}`), C && (f = i === "after" ? `${f} ${C}` : `${C} ${f}`), t.innerHTML = F(t, f);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "quantity": {
|
|
74
|
-
const e =
|
|
74
|
+
const e = u, s = e.ATTR, a = e.DEFAULT;
|
|
75
75
|
t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "button": {
|
|
79
|
-
const e =
|
|
79
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
80
|
if (l) {
|
|
81
81
|
const c = l.href || "", i = `${window.location.href}${a}`;
|
|
82
82
|
(c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -84,7 +84,7 @@ function J(S) {
|
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
87
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
|
|
88
88
|
if (l.href) {
|
|
89
89
|
const c = l.href, i = `${window.location.href}${a}`;
|
|
90
90
|
(c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -92,8 +92,8 @@ function J(S) {
|
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
95
|
+
if ("ATTR" in u) {
|
|
96
|
+
const e = u.ATTR;
|
|
97
97
|
t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
@@ -102,9 +102,9 @@ function J(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const I =
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
105
|
+
const I = y.match(/<!DOCTYPE[^>]*>/i), q = I ? `${I[0]}
|
|
106
|
+
` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
|
|
107
|
+
U.forEach((n) => {
|
|
108
108
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
109
|
M.push({
|
|
110
110
|
element: n,
|
|
@@ -113,16 +113,16 @@ function J(S) {
|
|
|
113
113
|
number: p
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
let A =
|
|
116
|
+
let A = q + b.documentElement.outerHTML;
|
|
117
117
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
118
|
const r = x[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
119
|
if (E) {
|
|
120
|
-
const
|
|
121
|
-
A = A.replace(n,
|
|
120
|
+
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
121
|
+
A = A.replace(n, X(o));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
124
|
+
const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
125
|
+
return W.forEach((n) => {
|
|
126
126
|
var t;
|
|
127
127
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
128
|
if (!d || !x[p])
|
|
@@ -131,20 +131,20 @@ function J(S) {
|
|
|
131
131
|
if (!r || k.has(r))
|
|
132
132
|
return;
|
|
133
133
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"),
|
|
135
|
-
|
|
134
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
|
|
135
|
+
T.wrap.push(m !== "false"), w.set(E, T);
|
|
136
136
|
}), w.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
137
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
138
|
return;
|
|
139
|
-
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE,
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
139
|
+
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
|
|
140
|
+
let g = "", o = 0, u = 0, $ = A.indexOf(r);
|
|
141
|
+
for (; $ !== -1; ) {
|
|
142
|
+
const H = p[u] === !0 && !v(A, $, t);
|
|
143
|
+
g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
|
|
144
144
|
}
|
|
145
|
-
A =
|
|
145
|
+
A = g + A.slice(o);
|
|
146
146
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
K as pairProductVariables
|
|
150
150
|
};
|