@useinsider/guido 3.20.1-beta.24b6c72 → 3.20.1-beta.2c8da49
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 +80 -63
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/block.js +33 -29
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +348 -263
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +219 -205
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +28 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +111 -40
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +5 -1
- 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/block.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 -6
- 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/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +21 -12
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
- 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/shared/textTrimCssRules.d.ts +10 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
- 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/currencySettings.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +18 -11
- 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/stores/editor.d.ts +3 -1
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/package.json +4 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useRecommendationExtensionStore as l } from "../store/recommendation.js";
|
|
2
|
+
import { registerPendingConfigFlush as d, commitBlockChangeOutsidePanel as g, writeBlockConfigOutsidePanel as h } from "./nodeConfigWriter.js";
|
|
3
|
+
async function S(e, { pickUpdates: s, description: r, fetch: f = !0 }) {
|
|
4
|
+
const t = l(), i = t.blockStates[e];
|
|
5
|
+
if (!i)
|
|
6
|
+
return !1;
|
|
7
|
+
const { configVersion: a, adoptedSizeVersion: u } = i, c = s(i.recommendationConfigs);
|
|
8
|
+
if (f) {
|
|
9
|
+
const m = d(
|
|
10
|
+
() => {
|
|
11
|
+
var n;
|
|
12
|
+
return ((n = t.blockStates[e]) == null ? void 0 : n.configVersion) === a && h(e, c, r) === "applied";
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
try {
|
|
16
|
+
await t.fetchRecommendationProductsForBlock(e);
|
|
17
|
+
} catch (n) {
|
|
18
|
+
console.error("[recommendation] product refetch outside the panel failed", n);
|
|
19
|
+
} finally {
|
|
20
|
+
m();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const o = t.blockStates[e];
|
|
24
|
+
return o ? o.configVersion !== a || o.adoptedSizeVersion !== u ? S(e, { pickUpdates: s, description: r }) : g(e, c, o.recommendationProducts, r) : !1;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
S as refreshBlockOutsidePanel
|
|
28
|
+
};
|
|
@@ -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 {
|
|
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, DESKTOP_CONTAINER_SELECTOR as b, 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";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function o(a) {
|
|
2
|
+
return {
|
|
3
|
+
name: a.code,
|
|
4
|
+
value: a.code,
|
|
5
|
+
symbol: a.symbol,
|
|
6
|
+
alignment: a.alignment === "before" ? "0" : "1",
|
|
7
|
+
decimalCount: a.decimalCount.toString(),
|
|
8
|
+
decimalSeparator: a.decimalSeparator,
|
|
9
|
+
thousandSeparator: a.thousandSeparator
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function e(a) {
|
|
13
|
+
return {
|
|
14
|
+
code: a.value,
|
|
15
|
+
symbol: a.symbol,
|
|
16
|
+
alignment: a.alignment === "0" ? "before" : "after",
|
|
17
|
+
decimalCount: Number(a.decimalCount),
|
|
18
|
+
decimalSeparator: a.decimalSeparator,
|
|
19
|
+
thousandSeparator: a.thousandSeparator
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
e as toCurrencyConfig,
|
|
24
|
+
o as toCurrencySettings
|
|
25
|
+
};
|
|
@@ -1,53 +1,124 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
3
|
-
import { isPartnerManagedBlock as
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { ModificationDescription as g } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
|
|
3
|
+
import { setCurrencyAttributes as h, isPartnerManagedBlock as p, updateProductContentInPlace as O, regenerateProductRowsWithStyles as N } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as u } from "../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as S } from "../store/recommendation.js";
|
|
6
|
+
const D = "Update recommendation filters", E = [
|
|
7
|
+
["strategyId", () => "Updated recommendation strategy"],
|
|
8
|
+
["strategy", (e) => `Changed algorithm to ${e.strategy}`],
|
|
9
|
+
["productIds", () => "Updated product IDs"],
|
|
10
|
+
["size", (e) => `Changed product count to ${e.size}`],
|
|
11
|
+
["language", (e) => `Changed language to ${e.language}`],
|
|
12
|
+
["shuffleProducts", (e) => `${e.shuffleProducts ? "Enabled" : "Disabled"} product shuffle`],
|
|
13
|
+
["currency", (e) => {
|
|
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();
|
|
14
74
|
return;
|
|
15
75
|
}
|
|
16
|
-
|
|
76
|
+
t.setCurrentBlock(e);
|
|
17
77
|
try {
|
|
18
|
-
|
|
78
|
+
n();
|
|
19
79
|
} finally {
|
|
20
|
-
|
|
80
|
+
t.$patch({ currentRecommendationId: r });
|
|
21
81
|
}
|
|
22
82
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return !
|
|
83
|
+
function F(e) {
|
|
84
|
+
const n = i == null ? void 0 : i.getDocumentRootHtmlNode();
|
|
85
|
+
return !n || !("querySelectorAll" in n) ? [] : n.querySelectorAll(`[${m}="${e}"]`).map((t) => u.getConfig(t));
|
|
26
86
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
return !1;
|
|
31
|
-
const r = f.querySelector(`[${a}="${e}"]`);
|
|
32
|
-
if (!r)
|
|
87
|
+
function j(e, n, t, r) {
|
|
88
|
+
const o = C(e);
|
|
89
|
+
if (!i || !o)
|
|
33
90
|
return !1;
|
|
34
|
-
const c =
|
|
35
|
-
if (
|
|
36
|
-
return c.apply(new
|
|
37
|
-
let
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
currentNode:
|
|
91
|
+
const c = i.getDocumentModifier(), s = I(o, n);
|
|
92
|
+
if (y(c, o, n), p(o))
|
|
93
|
+
return s && c.apply(new g(r)), !0;
|
|
94
|
+
let f = !1;
|
|
95
|
+
return R(e, () => {
|
|
96
|
+
O({
|
|
97
|
+
currentNode: o,
|
|
41
98
|
documentModifier: c,
|
|
42
|
-
products:
|
|
43
|
-
|
|
44
|
-
|
|
99
|
+
products: t,
|
|
100
|
+
stageOnly: !0,
|
|
101
|
+
configOverrides: n,
|
|
102
|
+
onChanged: () => {
|
|
103
|
+
f = !0;
|
|
45
104
|
}
|
|
46
|
-
}) || (
|
|
47
|
-
|
|
105
|
+
}) || (f = N({
|
|
106
|
+
currentNode: o,
|
|
107
|
+
documentModifier: c,
|
|
108
|
+
products: t,
|
|
109
|
+
stageOnly: !0,
|
|
110
|
+
configOverrides: n
|
|
111
|
+
}));
|
|
112
|
+
}), (s || f) && c.apply(new g(r)), !0;
|
|
48
113
|
}
|
|
49
114
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
115
|
+
D as UPDATE_FILTERS_DESCRIPTION,
|
|
116
|
+
j as commitBlockChangeOutsidePanel,
|
|
117
|
+
P as describeConfigChange,
|
|
118
|
+
A as flushPendingNodeConfigWrites,
|
|
119
|
+
F as readBlockNodeConfigs,
|
|
120
|
+
_ as registerNodeConfigWriter,
|
|
121
|
+
w as registerPendingConfigFlush,
|
|
122
|
+
y as stageConfigChange,
|
|
123
|
+
k as writeBlockConfigOutsidePanel
|
|
53
124
|
};
|
|
@@ -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
|
};
|