@useinsider/guido 3.20.1-beta.8a05319 → 3.20.1-beta.92564e2
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 +1 -0
- package/dist/@types/config/schemas.js +41 -39
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +78 -76
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
- package/dist/composables/useBlocksConfig.js +32 -24
- package/dist/composables/useDisplayConditions.js +102 -0
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +4 -3
- package/dist/config/compiler/itemsCompilerRules.js +12 -5
- package/dist/config/compiler/utils/itemsCompilerUtils.js +65 -45
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +296 -223
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +219 -205
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +51 -36
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/extensions/DisplayConditions/bridge.js +17 -0
- package/dist/extensions/DisplayConditions/constants.js +17 -0
- package/dist/extensions/DisplayConditions/control.js +178 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +27 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +272 -192
- package/dist/node_modules/valibot/dist/index.js +297 -261
- package/dist/package.json.js +1 -1
- package/dist/services/displayConditionApi.js +39 -0
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/display-condition.d.ts +59 -0
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useDisplayConditions.d.ts +16 -0
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +18 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +23 -0
- package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +8 -0
- package/dist/src/stores/config.d.ts +166 -0
- package/dist/src/stores/display-condition.d.ts +81 -0
- package/dist/src/utils/displayCondition.d.ts +10 -0
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/config.js +7 -0
- package/dist/stores/display-condition.js +28 -0
- package/dist/utils/displayCondition.js +26 -0
- package/dist/utils/pairProductVariables.js +15 -14
- package/dist/utils/protectTableText.js +22 -0
- package/package.json +3 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useRecommendationExtensionStore as u } from "../store/recommendation.js";
|
|
2
|
+
import { commitBlockChangeOutsidePanel as d } from "./nodeConfigWriter.js";
|
|
3
|
+
async function l(e, { pickUpdates: n, description: i, fetch: s = !0 }) {
|
|
4
|
+
const t = u(), r = t.blockStates[e];
|
|
5
|
+
if (!r)
|
|
6
|
+
return !1;
|
|
7
|
+
const { configVersion: c, adoptedSizeVersion: a } = r, f = n(r.recommendationConfigs);
|
|
8
|
+
if (s)
|
|
9
|
+
try {
|
|
10
|
+
await t.fetchRecommendationProductsForBlock(e);
|
|
11
|
+
} catch (m) {
|
|
12
|
+
console.error("[recommendation] product refetch outside the panel failed", m);
|
|
13
|
+
}
|
|
14
|
+
const o = t.blockStates[e];
|
|
15
|
+
return o ? o.configVersion !== c || o.adoptedSizeVersion !== a ? l(e, { pickUpdates: n, description: i }) : d(e, f, o.recommendationProducts, i) : !1;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
l as refreshBlockOutsidePanel
|
|
19
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { extractWrapperTags as
|
|
1
|
+
import { extractWrapperTags as A } from "../../../../utils/preserveTextStyles.js";
|
|
2
2
|
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
3
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
4
|
-
import { CSS_CLASS_TEXT_TRIM as
|
|
5
|
-
import { toCustomCompositionKey as
|
|
6
|
-
import {
|
|
7
|
-
import { hasQuerySelectorAll as
|
|
3
|
+
import { DESKTOP_CONTAINER_SELECTOR as b, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as y, ATTR_PRODUCT_OLD_PRICE as p, ATTR_PRODUCT_OMNIBUS_PRICE as R, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as x, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
|
|
4
|
+
import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
|
|
5
|
+
import { toCustomCompositionKey as U } from "../templates/utils.js";
|
|
6
|
+
import { resolveRowVisibilityKeys as N, isMergedInlinePriceRow as C } from "./compositionKeys.js";
|
|
7
|
+
import { hasQuerySelectorAll as I, hasGetAttribute as l, hasGetStyle as O, hasGetComputedStyle as M } from "./tagName.js";
|
|
8
8
|
const s = [
|
|
9
9
|
"font-size",
|
|
10
10
|
"font-family",
|
|
@@ -14,14 +14,14 @@ const s = [
|
|
|
14
14
|
"text-align",
|
|
15
15
|
"line-height",
|
|
16
16
|
"text-decoration"
|
|
17
|
-
],
|
|
17
|
+
], D = [
|
|
18
18
|
"background",
|
|
19
19
|
"background-color",
|
|
20
20
|
"border-width",
|
|
21
21
|
"border-color",
|
|
22
22
|
"border-style",
|
|
23
23
|
"border-radius"
|
|
24
|
-
],
|
|
24
|
+
], w = [
|
|
25
25
|
...s,
|
|
26
26
|
"background",
|
|
27
27
|
"background-color",
|
|
@@ -40,47 +40,47 @@ const s = [
|
|
|
40
40
|
"border-radius",
|
|
41
41
|
"margin"
|
|
42
42
|
], g = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), L = [
|
|
43
|
-
{ attrKey:
|
|
44
|
-
{ attrKey:
|
|
45
|
-
{ attrKey:
|
|
46
|
-
{ attrKey:
|
|
47
|
-
{ attrKey:
|
|
48
|
-
{ attrKey:
|
|
43
|
+
{ attrKey: k, blockId: c.NAME, kind: "text" },
|
|
44
|
+
{ attrKey: y, blockId: c.PRICE, kind: "text" },
|
|
45
|
+
{ attrKey: p, blockId: c.OLD_PRICE, kind: "text" },
|
|
46
|
+
{ attrKey: R, blockId: c.OMNIBUS_PRICE, kind: "text" },
|
|
47
|
+
{ attrKey: _, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
|
|
48
|
+
{ attrKey: x, blockId: c.BUTTON, kind: "button" },
|
|
49
49
|
{ attrKey: q, blockId: c.IMAGE, kind: "image" }
|
|
50
50
|
];
|
|
51
|
-
function
|
|
51
|
+
function h(t) {
|
|
52
52
|
return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function K(t) {
|
|
55
55
|
return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
|
|
56
56
|
}
|
|
57
57
|
function a(t, e, r) {
|
|
58
|
-
!e || !
|
|
58
|
+
!e || !O(e) || r.forEach((n) => {
|
|
59
59
|
const o = e.getStyle(n);
|
|
60
60
|
o && o !== "inherit" && o !== "initial" && (t[n] = o);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function E(t) {
|
|
64
64
|
return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
if (!t || !
|
|
66
|
+
function P(t) {
|
|
67
|
+
if (!t || !O(t))
|
|
68
68
|
return;
|
|
69
69
|
const e = t.getStyle("background-color") || t.getStyle("background");
|
|
70
70
|
return e && !g.has(e) ? e : void 0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function S(t, e) {
|
|
73
73
|
const r = {};
|
|
74
|
-
return a(r, t, e),
|
|
74
|
+
return a(r, t, e), E(r);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function $(t) {
|
|
77
77
|
const e = t.querySelector("p"), r = {};
|
|
78
78
|
a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
|
|
79
|
-
const n =
|
|
79
|
+
const n = E(r), { openTags: o, closeTags: i } = A(h(e));
|
|
80
80
|
return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n =
|
|
82
|
+
function H(t) {
|
|
83
|
+
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = S(e, D), o = S(r, w), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = A(h(r)), m = K(r);
|
|
84
84
|
return !n && !o && !u && !T && !m ? null : {
|
|
85
85
|
buttonBorderStyle: n || void 0,
|
|
86
86
|
buttonAnchorStyle: o || void 0,
|
|
@@ -90,44 +90,44 @@ function $(t) {
|
|
|
90
90
|
closeTags: d
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
93
|
+
function F(t) {
|
|
94
|
+
const e = S(t.querySelector("img"), G);
|
|
95
95
|
return e ? { imgStyle: e } : null;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return e === "button" ?
|
|
97
|
+
function j(t, e) {
|
|
98
|
+
return e === "button" ? H(t) : e === "image" ? F(t) : $(t);
|
|
99
99
|
}
|
|
100
100
|
function f(t, e) {
|
|
101
101
|
if (!t || !("querySelector" in t))
|
|
102
102
|
return;
|
|
103
|
-
const r = t.querySelector(
|
|
103
|
+
const r = t.querySelector(b) ?? t;
|
|
104
104
|
if (L.forEach(({ attrKey: i, blockId: u, kind: T }) => {
|
|
105
105
|
const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
|
|
106
106
|
d && e(d, i, T);
|
|
107
|
-
}), !
|
|
107
|
+
}), !I(r))
|
|
108
108
|
return;
|
|
109
109
|
const n = /* @__PURE__ */ new Set();
|
|
110
110
|
r.querySelectorAll(
|
|
111
111
|
`[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
|
|
112
112
|
).forEach((i) => {
|
|
113
|
-
const u = l(i) ? i.getAttribute(
|
|
114
|
-
!u || n.has(u) || (n.add(u), e(i,
|
|
113
|
+
const u = l(i) ? i.getAttribute(v) : null;
|
|
114
|
+
!u || n.has(u) || (n.add(u), e(i, U(u), "text"));
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function V(t) {
|
|
118
118
|
const e = {};
|
|
119
119
|
return f(t, (r, n, o) => {
|
|
120
120
|
if (!("querySelector" in r))
|
|
121
121
|
return;
|
|
122
|
-
const i =
|
|
122
|
+
const i = j(r, o);
|
|
123
123
|
i && (e[n] = i);
|
|
124
124
|
}), e;
|
|
125
125
|
}
|
|
126
126
|
function X(t) {
|
|
127
127
|
if (!t || !("querySelector" in t))
|
|
128
128
|
return;
|
|
129
|
-
const e = t.querySelector(
|
|
130
|
-
return
|
|
129
|
+
const e = t.querySelector(b) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
|
|
130
|
+
return P(r);
|
|
131
131
|
}
|
|
132
132
|
function z(t) {
|
|
133
133
|
if (!t)
|
|
@@ -135,10 +135,10 @@ function z(t) {
|
|
|
135
135
|
const e = l(t) ? t.getAttribute("bgcolor") : null;
|
|
136
136
|
if (e && !g.has(e))
|
|
137
137
|
return e;
|
|
138
|
-
const r =
|
|
138
|
+
const r = P(t);
|
|
139
139
|
if (r)
|
|
140
140
|
return r;
|
|
141
|
-
const n =
|
|
141
|
+
const n = M(t) ? t.getComputedStyle("background-color") : void 0;
|
|
142
142
|
return n && !g.has(n) ? n : void 0;
|
|
143
143
|
}
|
|
144
144
|
function Q(t) {
|
|
@@ -150,7 +150,7 @@ function Q(t) {
|
|
|
150
150
|
i && (e[n] = i);
|
|
151
151
|
}), e;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function W(t) {
|
|
154
154
|
const e = {};
|
|
155
155
|
return f(t, (r, n, o) => {
|
|
156
156
|
if (o === "image")
|
|
@@ -159,68 +159,70 @@ function V(t) {
|
|
|
159
159
|
i && (e[n] = i);
|
|
160
160
|
}), e;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
function
|
|
162
|
+
const Y = /^es-[pm]\d+[trbl]?$/;
|
|
163
|
+
function J(t) {
|
|
164
164
|
const e = l(t) ? t.getAttribute("class") : null;
|
|
165
165
|
if (!e)
|
|
166
166
|
return;
|
|
167
|
-
const r = e.split(/\s+/).filter((n) =>
|
|
167
|
+
const r = e.split(/\s+/).filter((n) => Y.test(n) || n === B);
|
|
168
168
|
return r.length ? r.join(" ") : void 0;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Z(t) {
|
|
171
171
|
if (!t || !("querySelector" in t))
|
|
172
172
|
return !1;
|
|
173
|
-
const e = t.querySelector(
|
|
174
|
-
return
|
|
173
|
+
const e = t.querySelector(b) ?? t;
|
|
174
|
+
return C(e.querySelector(`[data-attribute-type="${y}"]`)) || C(e.querySelector(`[data-attribute-type="${p}"]`));
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
const e = {}, r =
|
|
176
|
+
function tt(t) {
|
|
177
|
+
const e = {}, r = Z(t);
|
|
178
178
|
return f(t, (n, o, i) => {
|
|
179
|
-
if (i === "image" || r && (o ===
|
|
179
|
+
if (i === "image" || r && (o === y || o === p))
|
|
180
180
|
return;
|
|
181
|
-
const u =
|
|
181
|
+
const u = J(n);
|
|
182
182
|
u && (e[o] = u);
|
|
183
183
|
}), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function et(t) {
|
|
186
186
|
const e = {};
|
|
187
187
|
return f(t, (r, n) => {
|
|
188
|
-
if (n !==
|
|
188
|
+
if (n !== R && n !== _ || !l(r))
|
|
189
189
|
return;
|
|
190
190
|
const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
|
|
191
191
|
(o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
|
|
192
192
|
}), e;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function rt(t) {
|
|
195
195
|
const e = {};
|
|
196
196
|
if (!t || !("querySelector" in t))
|
|
197
197
|
return e;
|
|
198
|
-
const r = t.querySelector(
|
|
199
|
-
return
|
|
198
|
+
const r = t.querySelector(b) ?? t;
|
|
199
|
+
return I(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
|
|
200
200
|
if (!l(n))
|
|
201
201
|
return;
|
|
202
|
-
const o =
|
|
203
|
-
o
|
|
202
|
+
const o = n.getAttribute("data-visibility");
|
|
203
|
+
o != null && N(n).forEach((i) => {
|
|
204
|
+
e[i] = o !== "0";
|
|
205
|
+
});
|
|
204
206
|
}), e;
|
|
205
207
|
}
|
|
206
|
-
function
|
|
208
|
+
function lt(t) {
|
|
207
209
|
return {
|
|
208
|
-
styleTemplates:
|
|
210
|
+
styleTemplates: V(t),
|
|
209
211
|
cardBackgroundColor: X(t),
|
|
210
212
|
cellBackgroundColors: Q(t),
|
|
211
|
-
cellAlignments:
|
|
212
|
-
cellClasses:
|
|
213
|
-
omnibusTexts:
|
|
214
|
-
visibility:
|
|
213
|
+
cellAlignments: W(t),
|
|
214
|
+
cellClasses: tt(t),
|
|
215
|
+
omnibusTexts: et(t),
|
|
216
|
+
visibility: rt(t)
|
|
215
217
|
};
|
|
216
218
|
}
|
|
217
219
|
export {
|
|
218
|
-
|
|
220
|
+
V as captureAttributeStyleTemplates,
|
|
219
221
|
X as captureCardBackgroundColor,
|
|
220
|
-
|
|
222
|
+
W as captureCellAlignments,
|
|
221
223
|
Q as captureCellBackgroundColors,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
tt as captureCellClasses,
|
|
225
|
+
et as captureOmnibusTexts,
|
|
226
|
+
lt as captureStyles,
|
|
227
|
+
rt as captureVisibility
|
|
226
228
|
};
|
|
@@ -1,89 +1,98 @@
|
|
|
1
|
-
import { ATTR_CUSTOM_PREFIX as
|
|
2
|
-
function
|
|
3
|
-
return !t.startsWith(
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as o, ATTR_PRODUCT_PRICE as g, ATTR_PRODUCT_OLD_PRICE as d, PRODUCT_ATTRIBUTE_PREFIX as a, ATTR_DATA_ATTRIBUTE_TYPE as f, ATTR_PRODUCT_ATTR as c, SELECTOR_ATTRIBUTE_ROW as y } from "../constants/selectors.js";
|
|
2
|
+
function q(t) {
|
|
3
|
+
return !t.startsWith(a);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return t.startsWith(
|
|
7
|
-
}
|
|
8
|
-
function T(t) {
|
|
9
|
-
return t.startsWith(s) ? t.substring(s.length) : t;
|
|
5
|
+
function $(t) {
|
|
6
|
+
return t.startsWith(a) ? t.substring(a.length) : t;
|
|
10
7
|
}
|
|
11
8
|
function A(t) {
|
|
12
|
-
return
|
|
9
|
+
return t.startsWith(o) ? t.substring(o.length) : t;
|
|
10
|
+
}
|
|
11
|
+
function T(t) {
|
|
12
|
+
return `${o}${t}`;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return t.type === "defaultAttribute" ? t.attributeName : `${
|
|
14
|
+
function C(t) {
|
|
15
|
+
return t.type === "defaultAttribute" ? t.attributeName : `${a}${t.attributeName}`;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function h(t, r) {
|
|
18
18
|
const n = Object.values(r).filter((e) => e.attributeName === t);
|
|
19
19
|
return n.find((e) => e.type === "defaultAttribute") ?? n[0];
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function l(t, r) {
|
|
22
22
|
return t && "getAttribute" in t ? t.getAttribute(r) : null;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const e = `${
|
|
26
|
-
`${
|
|
27
|
-
),
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
30
|
-
const
|
|
31
|
-
return
|
|
24
|
+
function S(t, r, n = {}) {
|
|
25
|
+
const e = `${o}${t}`, u = r == null ? void 0 : r.querySelector(
|
|
26
|
+
`${y}[${f}="${e}"]`
|
|
27
|
+
), i = l(u, c) ?? l(u == null ? void 0 : u.querySelector(`[${c}]`), c);
|
|
28
|
+
if (i)
|
|
29
|
+
return i;
|
|
30
|
+
const s = h(t, n);
|
|
31
|
+
return s ? C(s) : t;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return t.startsWith(
|
|
33
|
+
function P(t, r, n = {}) {
|
|
34
|
+
return t.startsWith(a) ? t : S(t, r, n);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function O(t, r, n = {}) {
|
|
37
37
|
return t.map((e) => {
|
|
38
|
-
if (!e.startsWith(
|
|
38
|
+
if (!e.startsWith(o))
|
|
39
39
|
return e;
|
|
40
|
-
const u =
|
|
41
|
-
return
|
|
40
|
+
const u = A(e);
|
|
41
|
+
return T(P(u, r, n));
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return t.map((e) =>
|
|
44
|
+
function p(t, r, n = {}) {
|
|
45
|
+
return t.map((e) => P(e, r, n));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const r =
|
|
49
|
-
if (!(r != null && r.startsWith(
|
|
47
|
+
function b(t) {
|
|
48
|
+
const r = l(t, f);
|
|
49
|
+
if (!(r != null && r.startsWith(o)))
|
|
50
50
|
return r;
|
|
51
|
-
const n = "querySelector" in t ? t.querySelector(`[${
|
|
52
|
-
return e ?
|
|
51
|
+
const n = "querySelector" in t ? t.querySelector(`[${c}]`) : void 0, e = l(n, c);
|
|
52
|
+
return e ? T(e) : r;
|
|
53
|
+
}
|
|
54
|
+
function m(t) {
|
|
55
|
+
return !!(t && "querySelector" in t && t.querySelector(".product-price") && t.querySelector(".product-old-price"));
|
|
56
|
+
}
|
|
57
|
+
function D(t) {
|
|
58
|
+
const r = b(t);
|
|
59
|
+
return r ? m(t) ? [g, d] : [r] : [];
|
|
53
60
|
}
|
|
54
|
-
function
|
|
55
|
-
const e =
|
|
56
|
-
return
|
|
61
|
+
function R(t, r, n) {
|
|
62
|
+
const e = l(t, c), u = l(t.querySelector(`[${c}]`), c), i = e ?? u;
|
|
63
|
+
return i === null ? n : i === r;
|
|
57
64
|
}
|
|
58
|
-
function
|
|
59
|
-
const n = (
|
|
60
|
-
`${
|
|
65
|
+
function I(t, r) {
|
|
66
|
+
const n = (_) => t.querySelector(
|
|
67
|
+
`${y}[${f}="${_}"]`
|
|
61
68
|
);
|
|
62
|
-
if (!r.startsWith(
|
|
69
|
+
if (!r.startsWith(o))
|
|
63
70
|
return n(r) ?? null;
|
|
64
|
-
const e =
|
|
65
|
-
if (u &&
|
|
71
|
+
const e = A(r), u = n(r);
|
|
72
|
+
if (u && R(u, e, !0))
|
|
66
73
|
return u;
|
|
67
|
-
const
|
|
68
|
-
return
|
|
74
|
+
const i = T($(e)), s = i === r ? void 0 : n(i);
|
|
75
|
+
return s && R(s, e, !1) ? s : null;
|
|
69
76
|
}
|
|
70
|
-
function
|
|
71
|
-
const n =
|
|
77
|
+
function U(t, r) {
|
|
78
|
+
const n = A(r), e = T($(n));
|
|
72
79
|
return e === r ? t : t.replace(
|
|
73
|
-
`${
|
|
74
|
-
`${
|
|
80
|
+
`${f}="${e}"`,
|
|
81
|
+
`${f}="${r}"`
|
|
75
82
|
);
|
|
76
83
|
}
|
|
77
84
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
$ as bareAttributeName,
|
|
86
|
+
A as compositionKeyToProductAttr,
|
|
87
|
+
C as filterToProductAttrValue,
|
|
88
|
+
I as findAttributeRow,
|
|
89
|
+
h as findFilterByBareName,
|
|
90
|
+
q as isDefaultProductAttr,
|
|
91
|
+
m as isMergedInlinePriceRow,
|
|
92
|
+
O as normalizeCompositionKeys,
|
|
93
|
+
p as normalizeCustomAttrValues,
|
|
94
|
+
T as productAttrToCompositionKey,
|
|
95
|
+
b as resolveRowCompositionKey,
|
|
96
|
+
D as resolveRowVisibilityKeys,
|
|
97
|
+
U as rewriteLegacyRowKeyHtml
|
|
89
98
|
};
|
|
@@ -1,53 +1,68 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
3
|
-
import { isPartnerManagedBlock as
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { ModificationDescription as g } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RECOMMENDATION_ID_ATTR as l } from "../constants/selectors.js";
|
|
3
|
+
import { isPartnerManagedBlock as m, updateProductContentInPlace as d, regenerateProductRowsWithStyles as C } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as c } from "../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as y } from "../store/recommendation.js";
|
|
6
|
+
let r = null;
|
|
7
|
+
function M(n) {
|
|
8
|
+
r = n;
|
|
9
|
+
}
|
|
10
|
+
function a(n) {
|
|
11
|
+
const e = r == null ? void 0 : r.getDocumentRootHtmlNode();
|
|
12
|
+
return !e || !("querySelector" in e) ? null : e.querySelector(`[${l}="${n}"]`) ?? null;
|
|
13
|
+
}
|
|
14
|
+
function N(n, e) {
|
|
15
|
+
const o = c.getConfig(n);
|
|
16
|
+
return Object.keys(e).some((t) => JSON.stringify(o[t]) !== JSON.stringify(e[t]));
|
|
17
|
+
}
|
|
18
|
+
function S(n, e) {
|
|
19
|
+
const o = c.getConfig(n);
|
|
20
|
+
return ["filters", "strategy", "strategyId", "size"].some((t) => t in e && JSON.stringify(o[t]) !== JSON.stringify(e[t]));
|
|
21
|
+
}
|
|
22
|
+
function P(n, e, o) {
|
|
23
|
+
const t = a(n);
|
|
24
|
+
return !r || !t ? !1 : (S(t, e) && c.updateConfig(r, t, e, o), !0);
|
|
25
|
+
}
|
|
26
|
+
function p(n, e) {
|
|
27
|
+
const o = y(), t = o.currentRecommendationId;
|
|
28
|
+
if (t === n || !o.blockStates[n]) {
|
|
29
|
+
e();
|
|
14
30
|
return;
|
|
15
31
|
}
|
|
16
|
-
o.setCurrentBlock(
|
|
32
|
+
o.setCurrentBlock(n);
|
|
17
33
|
try {
|
|
18
|
-
|
|
34
|
+
e();
|
|
19
35
|
} finally {
|
|
20
|
-
o.$patch({ currentRecommendationId:
|
|
36
|
+
o.$patch({ currentRecommendationId: t });
|
|
21
37
|
}
|
|
22
38
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return !
|
|
39
|
+
function I(n) {
|
|
40
|
+
const e = r == null ? void 0 : r.getDocumentRootHtmlNode();
|
|
41
|
+
return !e || !("querySelectorAll" in e) ? [] : e.querySelectorAll(`[${l}="${n}"]`).map((o) => c.getConfig(o));
|
|
26
42
|
}
|
|
27
|
-
function $(
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
return !1;
|
|
31
|
-
const r = f.querySelector(`[${a}="${e}"]`);
|
|
32
|
-
if (!r)
|
|
43
|
+
function $(n, e, o, t) {
|
|
44
|
+
const i = a(n);
|
|
45
|
+
if (!r || !i)
|
|
33
46
|
return !1;
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
47
|
+
const f = r.getDocumentModifier(), s = N(i, e);
|
|
48
|
+
if (c.stageConfig(f, i, e), m(i))
|
|
49
|
+
return s && f.apply(new g(t)), !0;
|
|
37
50
|
let u = !1;
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
currentNode:
|
|
41
|
-
documentModifier:
|
|
51
|
+
return p(n, () => {
|
|
52
|
+
d({
|
|
53
|
+
currentNode: i,
|
|
54
|
+
documentModifier: f,
|
|
42
55
|
products: o,
|
|
43
56
|
onApplied: () => {
|
|
44
57
|
u = !0;
|
|
45
58
|
}
|
|
46
|
-
}) || (u =
|
|
47
|
-
}), !u &&
|
|
59
|
+
}) || (u = C({ currentNode: i, documentModifier: f, products: o }));
|
|
60
|
+
}), !u && s && f.apply(new g(t)), !0;
|
|
48
61
|
}
|
|
49
62
|
export {
|
|
50
63
|
$ as commitBlockChangeOutsidePanel,
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
S as hasEditedConfigChange,
|
|
65
|
+
I as readBlockNodeConfigs,
|
|
66
|
+
M as registerNodeConfigWriter,
|
|
67
|
+
P as writeBlockConfigOutsidePanel
|
|
53
68
|
};
|
|
@@ -1,47 +1,43 @@
|
|
|
1
1
|
import { useRecommendationExtensionStore as g } from "../store/recommendation.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { refreshBlockOutsidePanel as y } from "./blockRefresh.js";
|
|
3
|
+
import { toBlockUrlConfig as a } from "./blockUrlConfig.js";
|
|
4
|
+
import { commitBlockChangeOutsidePanel as l, readBlockNodeConfigs as S } from "./nodeConfigWriter.js";
|
|
5
|
+
function d(e, t) {
|
|
6
|
+
const r = JSON.stringify(a(t));
|
|
7
|
+
return S(e).find((o) => JSON.stringify(a(o)) !== r) ?? t;
|
|
7
8
|
}
|
|
8
|
-
async function
|
|
9
|
-
const
|
|
10
|
-
(/* @__PURE__ */ new Map([[
|
|
11
|
-
var
|
|
12
|
-
(!!n.strategyId ||
|
|
13
|
-
}),
|
|
14
|
-
if (!await
|
|
9
|
+
async function p(e, t, r) {
|
|
10
|
+
const o = g(), s = [e, t];
|
|
11
|
+
(/* @__PURE__ */ new Map([[e, d(e, r)], [t, r]])).forEach((n, i) => {
|
|
12
|
+
var m;
|
|
13
|
+
(!!n.strategyId || i === t) && ((m = o.blockStates[i]) == null ? void 0 : m.recommendationConfigs.strategyId) !== n.strategyId && o.seedBlockUrlConfig(i, a(n));
|
|
14
|
+
}), o.resetArrivedBlock(t), await Promise.all(s.map(async (n) => {
|
|
15
|
+
if (!await o.refreshStrategyBlock(n))
|
|
15
16
|
return;
|
|
16
|
-
const { recommendationConfigs:
|
|
17
|
-
|
|
17
|
+
const { recommendationConfigs: i, recommendationProducts: f } = o.blockStates[n];
|
|
18
|
+
l(
|
|
18
19
|
n,
|
|
19
|
-
{ size:
|
|
20
|
-
|
|
20
|
+
{ size: i.size },
|
|
21
|
+
f,
|
|
21
22
|
"Refresh duplicated recommendation strategy"
|
|
22
23
|
);
|
|
23
24
|
}));
|
|
24
25
|
}
|
|
25
|
-
async function
|
|
26
|
-
|
|
27
|
-
if (!e)
|
|
26
|
+
async function k(e, t) {
|
|
27
|
+
if (!g().blockStates[e])
|
|
28
28
|
return !1;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
e.recommendationProducts,
|
|
40
|
-
o
|
|
41
|
-
);
|
|
42
|
-
return i || console.error("[recommendation] strategy change did not reach a node", { blockId: t }), i;
|
|
29
|
+
const r = await y(e, {
|
|
30
|
+
pickUpdates: ({ strategyId: o, strategy: s, size: c, nodeConfigVersion: n }) => ({
|
|
31
|
+
strategyId: o,
|
|
32
|
+
strategy: s,
|
|
33
|
+
size: c,
|
|
34
|
+
configVersion: n
|
|
35
|
+
}),
|
|
36
|
+
description: t
|
|
37
|
+
});
|
|
38
|
+
return r || console.error("[recommendation] strategy change did not reach a node", { blockId: e }), r;
|
|
43
39
|
}
|
|
44
40
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
k as commitStrategyChange,
|
|
42
|
+
p as refreshDuplicatedStrategyBlocks
|
|
47
43
|
};
|