@useinsider/guido 3.20.1-beta.19f951a → 3.20.1-beta.20dcf3d
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/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +4 -3
- package/dist/extensions/Blocks/Items/block.js +43 -42
- 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/legacyStrategyMigration.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +51 -36
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +5 -3
- 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/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/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/nodeConfigWriter.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +2 -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/static/styles/components/button.css.js +5 -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,21 +1,21 @@
|
|
|
1
1
|
import "../constants/selectors.js";
|
|
2
2
|
import { RRS_CONFIG_VERSION as m } from "../constants/defaultConfig.js";
|
|
3
|
-
import { sanitizeProductIds as p } from "./productIds.js";
|
|
4
|
-
const
|
|
5
|
-
function
|
|
3
|
+
import { sanitizeProductIds as p, PRODUCT_ID_SEPARATOR as d } from "./productIds.js";
|
|
4
|
+
const u = "manualMerchandising";
|
|
5
|
+
function f({ strategyId: e, nodeConfigVersion: t }) {
|
|
6
6
|
return !e && t < m;
|
|
7
7
|
}
|
|
8
8
|
const o = (e) => {
|
|
9
9
|
const t = String(e ?? "").trim();
|
|
10
10
|
return /^[1-9]\d*$/.test(t) ? t : null;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function R({ campaignId: e, templateLibraryId: t }) {
|
|
13
13
|
if (o(e))
|
|
14
14
|
return { scope: "campaign" };
|
|
15
15
|
const n = o(t);
|
|
16
16
|
return n ? { scope: "template", templateId: n } : { scope: "campaign" };
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function S({
|
|
19
19
|
blockId: e,
|
|
20
20
|
url: t,
|
|
21
21
|
campaignId: n,
|
|
@@ -24,7 +24,7 @@ function y({
|
|
|
24
24
|
productIds: s,
|
|
25
25
|
target: r
|
|
26
26
|
}) {
|
|
27
|
-
const i = c ===
|
|
27
|
+
const i = c === u ? p(s).split(d).filter(Boolean) : [];
|
|
28
28
|
return {
|
|
29
29
|
...r.scope === "template" ? { templateId: Number.parseInt(r.templateId) } : {
|
|
30
30
|
campaignId: Number.parseInt(n) || 0,
|
|
@@ -36,7 +36,7 @@ function y({
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
S as buildLegacyMigrationPayload,
|
|
40
|
+
f as isLegacyStrategyConfig,
|
|
41
|
+
R as resolveMigrationTarget
|
|
42
42
|
};
|
|
@@ -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,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const i = ",";
|
|
2
|
+
function o(t) {
|
|
3
|
+
return t.map((n) => String(n ?? "").trim()).filter(Boolean).join(",");
|
|
3
4
|
}
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
i as PRODUCT_ID_SEPARATOR,
|
|
7
|
+
o as sanitizeProductIds
|
|
6
8
|
};
|
|
@@ -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
|
};
|