@useinsider/guido 3.20.1-beta.991508 → 3.20.1-beta.d2cba14
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 +223 -296
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +36 -51
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- 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 +3 -18
- 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 +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +0 -7
- 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
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -19
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
|
@@ -1,68 +1,53 @@
|
|
|
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
|
-
|
|
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();
|
|
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();
|
|
30
14
|
return;
|
|
31
15
|
}
|
|
32
|
-
o.setCurrentBlock(
|
|
16
|
+
o.setCurrentBlock(e);
|
|
33
17
|
try {
|
|
34
|
-
|
|
18
|
+
t();
|
|
35
19
|
} finally {
|
|
36
|
-
o.$patch({ currentRecommendationId:
|
|
20
|
+
o.$patch({ currentRecommendationId: i });
|
|
37
21
|
}
|
|
38
22
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
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));
|
|
42
26
|
}
|
|
43
|
-
function $(
|
|
44
|
-
const
|
|
45
|
-
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)
|
|
46
33
|
return !1;
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
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;
|
|
50
37
|
let u = !1;
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
currentNode:
|
|
54
|
-
documentModifier:
|
|
38
|
+
return S(e, () => {
|
|
39
|
+
p({
|
|
40
|
+
currentNode: r,
|
|
41
|
+
documentModifier: c,
|
|
55
42
|
products: o,
|
|
56
43
|
onApplied: () => {
|
|
57
44
|
u = !0;
|
|
58
45
|
}
|
|
59
|
-
}) || (u =
|
|
60
|
-
}), !u &&
|
|
46
|
+
}) || (u = y({ currentNode: r, documentModifier: c, products: o }));
|
|
47
|
+
}), !u && g && c.apply(new s(i)), !0;
|
|
61
48
|
}
|
|
62
49
|
export {
|
|
63
50
|
$ as commitBlockChangeOutsidePanel,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
M as registerNodeConfigWriter,
|
|
67
|
-
P as writeBlockConfigOutsidePanel
|
|
51
|
+
P as readBlockNodeConfigs,
|
|
52
|
+
B as registerNodeConfigWriter
|
|
68
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
|
};
|