@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29
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/dist/composables/useActionsApi.js +64 -80
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +10 -11
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +42 -43
- package/dist/extensions/Blocks/Recommendation/block.js +29 -33
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -5
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
- package/dist/src/stores/editor.d.ts +1 -3
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/static/styles/components/button.css.js +0 -5
- package/dist/stores/editor.js +0 -5
- package/dist/utils/fullStoryScripts.js +8 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractWrapperTags as A } from "../../../../utils/preserveTextStyles.js";
|
|
2
2
|
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
3
|
-
import { 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,
|
|
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
4
|
import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
|
|
5
5
|
import { toCustomCompositionKey as U } from "../templates/utils.js";
|
|
6
6
|
import { resolveRowVisibilityKeys as N, isMergedInlinePriceRow as C } from "./compositionKeys.js";
|
|
@@ -1,124 +1,53 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
3
|
-
import {
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var n;
|
|
15
|
-
return `Changed currency to ${(n = e.currency) == null ? void 0 : n.code}`;
|
|
16
|
-
}],
|
|
17
|
-
["filters", () => D]
|
|
18
|
-
];
|
|
19
|
-
let i = null;
|
|
20
|
-
const a = /* @__PURE__ */ new Set();
|
|
21
|
-
function _(e) {
|
|
22
|
-
i = e;
|
|
23
|
-
}
|
|
24
|
-
function w(e) {
|
|
25
|
-
return a.add(e), () => {
|
|
26
|
-
a.delete(e);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function A() {
|
|
30
|
-
let e = 0;
|
|
31
|
-
return [...a].forEach((n) => {
|
|
32
|
-
try {
|
|
33
|
-
n() && (e += 1);
|
|
34
|
-
} catch (t) {
|
|
35
|
-
console.error("[recommendation] pending config flush failed", t);
|
|
36
|
-
}
|
|
37
|
-
}), e;
|
|
38
|
-
}
|
|
39
|
-
function C(e) {
|
|
40
|
-
const n = i == null ? void 0 : i.getDocumentRootHtmlNode();
|
|
41
|
-
return !n || !("querySelector" in n) ? null : n.querySelector(`[${m}="${e}"]`) ?? null;
|
|
42
|
-
}
|
|
43
|
-
function d(e) {
|
|
44
|
-
return JSON.stringify(e, (n, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([r], [o]) => r.localeCompare(o))) : t);
|
|
45
|
-
}
|
|
46
|
-
function l(e, n, t) {
|
|
47
|
-
return t in n && d(e[t]) !== d(n[t]);
|
|
48
|
-
}
|
|
49
|
-
function I(e, n) {
|
|
50
|
-
const t = u.getConfig(e);
|
|
51
|
-
return Object.keys(n).some((r) => l(t, n, r));
|
|
52
|
-
}
|
|
53
|
-
function P(e, n) {
|
|
54
|
-
const t = E.find(([r]) => l(e, n, r));
|
|
55
|
-
return t ? t[1](n) : null;
|
|
56
|
-
}
|
|
57
|
-
function y(e, n, t) {
|
|
58
|
-
u.stageConfig(e, n, t), t.currency && l(u.getConfig(n), t, "currency") && h({ currentNode: n, documentModifier: e, currency: t.currency, stageOnly: !0 });
|
|
59
|
-
}
|
|
60
|
-
function k(e, n, t) {
|
|
61
|
-
const r = C(e);
|
|
62
|
-
if (!i || !r)
|
|
63
|
-
return "missing";
|
|
64
|
-
const o = P(u.getConfig(r), n);
|
|
65
|
-
if (o === null)
|
|
66
|
-
return "unchanged";
|
|
67
|
-
const c = i.getDocumentModifier();
|
|
68
|
-
return y(c, r, n), c.apply(new g(t ?? o)), "applied";
|
|
69
|
-
}
|
|
70
|
-
function R(e, n) {
|
|
71
|
-
const t = S(), r = t.currentRecommendationId;
|
|
72
|
-
if (r === e || !t.blockStates[e]) {
|
|
73
|
-
n();
|
|
1
|
+
import { ModificationDescription as s } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RECOMMENDATION_ID_ATTR as a } from "../constants/selectors.js";
|
|
3
|
+
import { isPartnerManagedBlock as C, updateProductContentInPlace as p, regenerateProductRowsWithStyles as y } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as m } from "../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as N } from "../store/recommendation.js";
|
|
6
|
+
let n = null;
|
|
7
|
+
function B(e) {
|
|
8
|
+
n = e;
|
|
9
|
+
}
|
|
10
|
+
function S(e, t) {
|
|
11
|
+
const o = N(), i = o.currentRecommendationId;
|
|
12
|
+
if (i === e || !o.blockStates[e]) {
|
|
13
|
+
t();
|
|
74
14
|
return;
|
|
75
15
|
}
|
|
76
|
-
|
|
16
|
+
o.setCurrentBlock(e);
|
|
77
17
|
try {
|
|
78
|
-
|
|
18
|
+
t();
|
|
79
19
|
} finally {
|
|
80
|
-
|
|
20
|
+
o.$patch({ currentRecommendationId: i });
|
|
81
21
|
}
|
|
82
22
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
return !
|
|
23
|
+
function P(e) {
|
|
24
|
+
const t = n == null ? void 0 : n.getDocumentRootHtmlNode();
|
|
25
|
+
return !t || !("querySelectorAll" in t) ? [] : t.querySelectorAll(`[${a}="${e}"]`).map((o) => m.getConfig(o));
|
|
86
26
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
27
|
+
function $(e, t, o, i) {
|
|
28
|
+
const f = n == null ? void 0 : n.getDocumentRootHtmlNode();
|
|
29
|
+
if (!n || !f || !("querySelector" in f))
|
|
30
|
+
return !1;
|
|
31
|
+
const r = f.querySelector(`[${a}="${e}"]`);
|
|
32
|
+
if (!r)
|
|
90
33
|
return !1;
|
|
91
|
-
const c =
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
94
|
-
let
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
currentNode:
|
|
34
|
+
const c = n.getDocumentModifier(), d = m.getConfig(r), g = Object.keys(t).some((l) => JSON.stringify(d[l]) !== JSON.stringify(t[l]));
|
|
35
|
+
if (m.stageConfig(c, r, t), C(r))
|
|
36
|
+
return c.apply(new s(i)), !0;
|
|
37
|
+
let u = !1;
|
|
38
|
+
return S(e, () => {
|
|
39
|
+
p({
|
|
40
|
+
currentNode: r,
|
|
98
41
|
documentModifier: c,
|
|
99
|
-
products:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
onChanged: () => {
|
|
103
|
-
f = !0;
|
|
42
|
+
products: o,
|
|
43
|
+
onApplied: () => {
|
|
44
|
+
u = !0;
|
|
104
45
|
}
|
|
105
|
-
}) || (
|
|
106
|
-
|
|
107
|
-
documentModifier: c,
|
|
108
|
-
products: t,
|
|
109
|
-
stageOnly: !0,
|
|
110
|
-
configOverrides: n
|
|
111
|
-
}));
|
|
112
|
-
}), (s || f) && c.apply(new g(r)), !0;
|
|
46
|
+
}) || (u = y({ currentNode: r, documentModifier: c, products: o }));
|
|
47
|
+
}), !u && g && c.apply(new s(i)), !0;
|
|
113
48
|
}
|
|
114
49
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
A as flushPendingNodeConfigWrites,
|
|
119
|
-
F as readBlockNodeConfigs,
|
|
120
|
-
_ as registerNodeConfigWriter,
|
|
121
|
-
w as registerPendingConfigFlush,
|
|
122
|
-
y as stageConfigChange,
|
|
123
|
-
k as writeBlockConfigOutsidePanel
|
|
50
|
+
$ as commitBlockChangeOutsidePanel,
|
|
51
|
+
P as readBlockNodeConfigs,
|
|
52
|
+
B as registerNodeConfigWriter
|
|
124
53
|
};
|
|
@@ -1,43 +1,47 @@
|
|
|
1
1
|
import { useRecommendationExtensionStore as g } from "../store/recommendation.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return S(e).find((o) => JSON.stringify(a(o)) !== r) ?? t;
|
|
2
|
+
import { toBlockUrlConfig as m } from "./blockUrlConfig.js";
|
|
3
|
+
import { commitBlockChangeOutsidePanel as d, readBlockNodeConfigs as y } from "./nodeConfigWriter.js";
|
|
4
|
+
function l(t, o) {
|
|
5
|
+
const r = JSON.stringify(m(o));
|
|
6
|
+
return y(t).find((e) => JSON.stringify(m(e)) !== r) ?? o;
|
|
8
7
|
}
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
(/* @__PURE__ */ new Map([[
|
|
12
|
-
var
|
|
13
|
-
(!!n.strategyId ||
|
|
14
|
-
}),
|
|
15
|
-
if (!await
|
|
8
|
+
async function C(t, o, r) {
|
|
9
|
+
const e = g(), c = [t, o];
|
|
10
|
+
(/* @__PURE__ */ new Map([[t, l(t, r)], [o, r]])).forEach((n, s) => {
|
|
11
|
+
var a;
|
|
12
|
+
(!!n.strategyId || s === o) && ((a = e.blockStates[s]) == null ? void 0 : a.recommendationConfigs.strategyId) !== n.strategyId && e.seedBlockUrlConfig(s, m(n));
|
|
13
|
+
}), e.resetArrivedBlock(o), await Promise.all(c.map(async (n) => {
|
|
14
|
+
if (!await e.refreshStrategyBlock(n))
|
|
16
15
|
return;
|
|
17
|
-
const { recommendationConfigs:
|
|
18
|
-
|
|
16
|
+
const { recommendationConfigs: s, recommendationProducts: i } = e.blockStates[n];
|
|
17
|
+
d(
|
|
19
18
|
n,
|
|
20
|
-
{ size:
|
|
21
|
-
|
|
19
|
+
{ size: s.size },
|
|
20
|
+
i,
|
|
22
21
|
"Refresh duplicated recommendation strategy"
|
|
23
22
|
);
|
|
24
23
|
}));
|
|
25
24
|
}
|
|
26
|
-
async function
|
|
27
|
-
|
|
25
|
+
async function B(t, o) {
|
|
26
|
+
const r = g(), e = r.blockStates[t];
|
|
27
|
+
if (!e)
|
|
28
28
|
return !1;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const { strategyId: c, strategy: f, size: n, nodeConfigVersion: s } = e.recommendationConfigs;
|
|
30
|
+
if (r.currentRecommendationId === t)
|
|
31
|
+
try {
|
|
32
|
+
await r.fetchRecommendationProducts();
|
|
33
|
+
} catch (a) {
|
|
34
|
+
console.error("[recommendation] product refetch after a strategy change failed", a);
|
|
35
|
+
}
|
|
36
|
+
const i = d(
|
|
37
|
+
t,
|
|
38
|
+
{ strategyId: c, strategy: f, size: n, configVersion: s },
|
|
39
|
+
e.recommendationProducts,
|
|
40
|
+
o
|
|
41
|
+
);
|
|
42
|
+
return i || console.error("[recommendation] strategy change did not reach a node", { blockId: t }), i;
|
|
39
43
|
}
|
|
40
44
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
B as commitStrategyChange,
|
|
46
|
+
C as refreshDuplicatedStrategyBlocks
|
|
43
47
|
};
|