@useinsider/guido 3.18.0-beta.3ffa144 → 3.18.0-beta.599df29
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/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +85 -81
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
- package/dist/composables/useActionsApi.js +82 -67
- package/dist/composables/useAutoSave.js +31 -26
- package/dist/composables/useEditorLock.js +20 -0
- package/dist/composables/useGuidoStateBridge.js +37 -31
- package/dist/composables/useSave.js +42 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +12 -18
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +17 -18
- package/dist/guido.css +1 -1
- package/dist/src/composables/useEditorLock.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -5
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -12
- package/dist/utils/templatePreparation.js +36 -37
- package/package.json +1 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as E } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as p } from "./useEditorLock.js";
|
|
2
3
|
import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
import { computed as
|
|
5
|
-
const
|
|
6
|
-
const { isFeatureEnabled: S } =
|
|
4
|
+
import { useEditorStore as f } from "../stores/editor.js";
|
|
5
|
+
import { computed as y, watch as I, onUnmounted as L } from "vue";
|
|
6
|
+
const w = 18e4, v = 6e4, R = (b) => {
|
|
7
|
+
const { isFeatureEnabled: S } = E(), o = f(), t = A(), { isEditorBusy: g } = p();
|
|
7
8
|
let i = null, c = 0;
|
|
8
|
-
const u =
|
|
9
|
+
const u = y(
|
|
9
10
|
() => S("autosave") && t.isOn
|
|
10
|
-
),
|
|
11
|
-
hasChanges:
|
|
12
|
-
isInSaveableState:
|
|
13
|
-
}),
|
|
11
|
+
), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
|
|
12
|
+
hasChanges: o.hasChanges,
|
|
13
|
+
isInSaveableState: o.isInSaveableState
|
|
14
|
+
}), r = async (e) => {
|
|
14
15
|
if (!u.value) {
|
|
15
16
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
if (!
|
|
19
|
+
if (!m()) {
|
|
19
20
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
@@ -23,15 +24,19 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
23
24
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
27
|
+
if (g()) {
|
|
28
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
26
31
|
console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
|
|
27
32
|
try {
|
|
28
33
|
if (await b() === void 0) {
|
|
29
34
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
|
|
30
35
|
return;
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
37
|
+
o.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
38
|
+
} catch (a) {
|
|
39
|
+
console.debug("guido:autosave:error", { trigger: e, error: a }), t.status = s.ERROR;
|
|
35
40
|
}
|
|
36
41
|
}, n = () => {
|
|
37
42
|
const { visibilityState: e } = document;
|
|
@@ -40,32 +45,32 @@ const I = 18e4, r = 6e4, T = (b) => {
|
|
|
40
45
|
isActive: u.value
|
|
41
46
|
}), e !== "hidden")
|
|
42
47
|
return;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
48
|
+
const a = Date.now() - c;
|
|
49
|
+
if (a < v) {
|
|
45
50
|
console.debug("guido:autosave:visibility-debounced", {
|
|
46
|
-
sinceLastMs:
|
|
47
|
-
debounceMs:
|
|
51
|
+
sinceLastMs: a,
|
|
52
|
+
debounceMs: v
|
|
48
53
|
});
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
c = Date.now(),
|
|
56
|
+
c = Date.now(), r("visibility");
|
|
52
57
|
}, d = () => {
|
|
53
58
|
i && (clearInterval(i), i = null);
|
|
54
|
-
},
|
|
59
|
+
}, l = () => {
|
|
55
60
|
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
56
61
|
};
|
|
57
|
-
|
|
62
|
+
I(
|
|
58
63
|
u,
|
|
59
64
|
(e) => {
|
|
60
65
|
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
|
|
61
|
-
console.debug("guido:autosave:interval-tick"),
|
|
62
|
-
},
|
|
66
|
+
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
67
|
+
}, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
|
|
63
68
|
},
|
|
64
69
|
{ immediate: !0 }
|
|
65
|
-
),
|
|
66
|
-
d(),
|
|
70
|
+
), L(() => {
|
|
71
|
+
d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
67
72
|
});
|
|
68
73
|
};
|
|
69
74
|
export {
|
|
70
|
-
|
|
75
|
+
R as useAutoSave
|
|
71
76
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let o = Promise.resolve(), n = 0, e = 0;
|
|
2
|
+
const s = () => n > 0, c = () => (e += 1, e), u = (t) => t > 0 && t === e, i = (t) => {
|
|
3
|
+
const r = o.then(async () => {
|
|
4
|
+
n += 1;
|
|
5
|
+
try {
|
|
6
|
+
return await t();
|
|
7
|
+
} finally {
|
|
8
|
+
n -= 1;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return o = r.catch(() => {
|
|
12
|
+
}), r;
|
|
13
|
+
}, a = () => ({ runExclusive: i, isEditorBusy: s, beginMount: c, isCurrentMount: u });
|
|
14
|
+
export {
|
|
15
|
+
c as beginMount,
|
|
16
|
+
u as isCurrentMount,
|
|
17
|
+
s as isEditorBusy,
|
|
18
|
+
i as runExclusive,
|
|
19
|
+
a as useEditorLock
|
|
20
|
+
};
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useActionsApi as b } from "./useActionsApi.js";
|
|
2
|
+
import { useEditorLock as v } from "./useEditorLock.js";
|
|
3
|
+
import { useConfigStore as T } from "../stores/config.js";
|
|
4
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
5
|
+
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
|
+
import { watch as a, onUnmounted as B } from "vue";
|
|
7
|
+
const C = 500, L = () => {
|
|
8
|
+
const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
|
|
9
|
+
let o = null, s = !1;
|
|
10
|
+
const n = () => {
|
|
11
|
+
o && (clearTimeout(o), o = null);
|
|
12
|
+
}, c = (t) => {
|
|
13
|
+
n(), o = setTimeout(() => {
|
|
14
|
+
o = null, t();
|
|
15
|
+
}, C);
|
|
16
|
+
}, e = async () => {
|
|
17
|
+
var t, r;
|
|
18
|
+
if (!(s || !i.isStripoInitialized)) {
|
|
19
|
+
if (p()) {
|
|
20
|
+
c(() => void e());
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
14
23
|
try {
|
|
15
|
-
const { html:
|
|
16
|
-
if (
|
|
24
|
+
const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
|
|
25
|
+
if (s)
|
|
17
26
|
return;
|
|
18
|
-
|
|
19
|
-
html:
|
|
20
|
-
css:
|
|
21
|
-
templateId:
|
|
27
|
+
u.$patch({
|
|
28
|
+
html: E ?? "",
|
|
29
|
+
css: g ?? "",
|
|
30
|
+
templateId: I,
|
|
22
31
|
lastUpdatedAt: Date.now()
|
|
23
32
|
});
|
|
24
33
|
} catch {
|
|
25
34
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e = null, s();
|
|
29
|
-
}, w);
|
|
30
|
-
}, d = c(
|
|
35
|
+
}
|
|
36
|
+
}, f = () => c(() => void e()), h = a(
|
|
31
37
|
() => i.isStripoInitialized,
|
|
32
38
|
(t) => {
|
|
33
|
-
t &&
|
|
39
|
+
t && e();
|
|
34
40
|
},
|
|
35
41
|
{ immediate: !0 }
|
|
36
|
-
),
|
|
42
|
+
), S = a(
|
|
37
43
|
() => i.hasChanges,
|
|
38
|
-
(t,
|
|
39
|
-
i.isStripoInitialized && (t ?
|
|
44
|
+
(t, r) => {
|
|
45
|
+
i.isStripoInitialized && (t ? f() : r && (n(), e()));
|
|
40
46
|
}
|
|
41
47
|
);
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
B(() => {
|
|
49
|
+
s = !0, n(), h(), S();
|
|
44
50
|
});
|
|
45
51
|
};
|
|
46
52
|
export {
|
|
47
|
-
|
|
53
|
+
L as useGuidoStateBridge
|
|
48
54
|
};
|
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
const { prepareTemplateDetails:
|
|
21
|
-
if (!
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as q } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as C } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
|
|
5
|
+
import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
|
|
6
|
+
import { ToasterTypeOptions as P } from "../enums/toaster.js";
|
|
7
|
+
import { useStripoApi as U } from "../services/stripoApi.js";
|
|
8
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
9
|
+
import { useAllowlist as h } from "./useAllowlist.js";
|
|
10
|
+
import { useHtmlValidator as F } from "./useHtmlValidator.js";
|
|
11
|
+
import { useToaster as O } from "./useToaster.js";
|
|
12
|
+
import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
|
|
13
|
+
import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
|
|
14
|
+
import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
|
|
15
|
+
import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
|
|
16
|
+
const rt = () => {
|
|
17
|
+
const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
|
|
18
|
+
var l;
|
|
19
|
+
n();
|
|
20
|
+
const { prepareTemplateDetails: B } = A(), t = await B();
|
|
21
|
+
if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
|
|
22
22
|
return;
|
|
23
|
-
if (
|
|
24
|
-
if (!await
|
|
23
|
+
if (r("liquidSyntax")) {
|
|
24
|
+
if (!await m(t.compiledHtml))
|
|
25
25
|
return;
|
|
26
|
-
} else if (!await
|
|
26
|
+
} else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
|
|
27
27
|
return;
|
|
28
|
-
if ((
|
|
28
|
+
if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
|
|
29
29
|
return;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
38
|
-
actionButton:
|
|
30
|
+
if (r("allowlistEnabled")) {
|
|
31
|
+
const i = await y(t.compiledHtml, t.css);
|
|
32
|
+
if (i.length) {
|
|
33
|
+
if (!o) {
|
|
34
|
+
const e = await k(i);
|
|
35
|
+
e != null && e.message && V({
|
|
36
|
+
type: P.Warning,
|
|
37
|
+
message: e.message,
|
|
38
|
+
actionButton: e.actionButton
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!await
|
|
44
|
+
if (!await w())
|
|
45
45
|
return;
|
|
46
|
-
const { unsubscribePayload:
|
|
47
|
-
return await
|
|
48
|
-
}
|
|
46
|
+
const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
|
|
47
|
+
return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
|
|
48
|
+
};
|
|
49
|
+
return { save: (a = !1, o = !1) => x(
|
|
50
|
+
() => H(a, o)
|
|
51
|
+
) };
|
|
49
52
|
};
|
|
50
53
|
export {
|
|
51
|
-
|
|
54
|
+
rt as useSave
|
|
52
55
|
};
|
|
@@ -23,14 +23,14 @@ import { PricePlacementControl as E } from "./pricePlacement.js";
|
|
|
23
23
|
import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
|
|
24
24
|
import { ProductCountControl as k } from "./productCount.js";
|
|
25
25
|
import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
|
|
26
|
-
import { ProductLayoutControl as
|
|
26
|
+
import { ProductLayoutControl as D } from "./productLayout.js";
|
|
27
27
|
import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
|
|
28
|
-
import { ShuffleControl as
|
|
28
|
+
import { ShuffleControl as F } from "./shuffle.js";
|
|
29
29
|
import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
|
|
30
30
|
import { StrategyControl as w } from "./strategy.js";
|
|
31
31
|
import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
|
|
32
32
|
import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
|
|
33
|
-
import { adjustProductsToSize as kt, formatProductPrice as
|
|
33
|
+
import { adjustProductsToSize as kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
|
|
34
34
|
import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
35
35
|
const $ = "ui-elements-recommendation-block";
|
|
36
36
|
class at extends N {
|
|
@@ -39,6 +39,8 @@ class at extends N {
|
|
|
39
39
|
n(this, "store", R());
|
|
40
40
|
n(this, "storeUnsubscription", () => {
|
|
41
41
|
});
|
|
42
|
+
// blockId -> fingerprint of the node config as it looked at the last sync.
|
|
43
|
+
n(this, "syncedConfigs", /* @__PURE__ */ new Map());
|
|
42
44
|
// A config change waiting to reach the node config. Deferred so it can ride the
|
|
43
45
|
// re-render's single apply() — one user action must cost one undo press.
|
|
44
46
|
n(this, "pendingNodeConfigWrite", null);
|
|
@@ -118,7 +120,7 @@ class at extends N {
|
|
|
118
120
|
return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
|
|
119
121
|
var o;
|
|
120
122
|
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
121
|
-
}), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new k(), this.productLayoutControl = new
|
|
123
|
+
}), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new k(), this.productLayoutControl = new D(), this.filtersControl = new S(), this.shuffleControl = new F(), this.pricePlacementControl = new E(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
|
|
122
124
|
e && (e.api = this.api);
|
|
123
125
|
}), `
|
|
124
126
|
<div class="recommendation-controls-container">
|
|
@@ -198,19 +200,11 @@ class at extends N {
|
|
|
198
200
|
* fingerprint diff on this hook is the only way to notice (SD-149105).
|
|
199
201
|
* An unchanged fingerprint means the move came from us, so runtime store
|
|
200
202
|
* edits are never clobbered (SD-141049).
|
|
201
|
-
*
|
|
202
|
-
* The fingerprint is kept on the block's own store state so deleting the
|
|
203
|
-
* block drops it with the state it describes. A control-owned memo outlived
|
|
204
|
-
* that state and made a re-dropped saved module keep the defaults its wiped
|
|
205
|
-
* state was rebuilt with (SD-150347).
|
|
206
203
|
*/
|
|
207
204
|
_syncNodeConfigIfChanged(t) {
|
|
208
205
|
this.pendingNodeConfigWrite && this.pendingNodeConfigWrite.blockId !== t && this._flushPendingNodeConfig();
|
|
209
|
-
const e = this.
|
|
210
|
-
|
|
211
|
-
return;
|
|
212
|
-
const o = JSON.stringify(c.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
|
|
213
|
-
e.syncedConfigFingerprint = o, r !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
|
|
206
|
+
const e = JSON.stringify(c.getConfig(this.currentNode)), o = this.syncedConfigs.get(t);
|
|
207
|
+
this.syncedConfigs.set(t, e), o !== e && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
|
|
214
208
|
}
|
|
215
209
|
_capturePendingNodeConfigWrite() {
|
|
216
210
|
const t = this.store.currentRecommendationId;
|
|
@@ -436,16 +430,16 @@ export {
|
|
|
436
430
|
Tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
437
431
|
E as PricePlacementControl,
|
|
438
432
|
k as ProductCountControl,
|
|
439
|
-
|
|
433
|
+
D as ProductLayoutControl,
|
|
440
434
|
at as RecommendationBlockControl,
|
|
441
435
|
St as SHUFFLE_CONTROL_ID,
|
|
442
436
|
Lt as STRATEGY_CONTROL_ID,
|
|
443
|
-
|
|
437
|
+
F as ShuffleControl,
|
|
444
438
|
w as StrategyControl,
|
|
445
439
|
kt as adjustProductsToSize,
|
|
446
|
-
|
|
440
|
+
Dt as formatProductPrice,
|
|
447
441
|
v as getBlockElement,
|
|
448
|
-
|
|
442
|
+
Ft as getCardComposition,
|
|
449
443
|
wt as getCurrentLayout,
|
|
450
444
|
At as getMainContainerTbody,
|
|
451
445
|
x as isPartnerManagedBlock,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRecommendationFeedSourceMaps as b, getOperatorOptions as G, PriceAttributes as v } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { useRecommendationApi as D } from "../../../../services/recommendationApi.js";
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
3
|
+
import { useConfigStore as P } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as F } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
6
|
import { DEFAULT_MOBILE_CARDS_IN_ROW as _, DEFAULT_CARDS_IN_ROW as U } from "../constants/layout.js";
|
|
7
7
|
import { DEFAULT_NODE_CONFIG as N, EXCLUDED_ALGORITHM_IDS as L } from "../constants/defaultConfig.js";
|
|
@@ -12,7 +12,7 @@ import { sanitizeProductIds as A } from "../utils/productIds.js";
|
|
|
12
12
|
import { isFilterValid as B } from "../validation/filterSchema.js";
|
|
13
13
|
import { isConfigValid as M } from "../validation/requiredFields.js";
|
|
14
14
|
const u = D();
|
|
15
|
-
let f = null,
|
|
15
|
+
let f = null, h = null, g = null, S = null;
|
|
16
16
|
const p = /* @__PURE__ */ new Map();
|
|
17
17
|
function w() {
|
|
18
18
|
return {
|
|
@@ -56,8 +56,7 @@ function C() {
|
|
|
56
56
|
removeStrategyModalStatus: !1,
|
|
57
57
|
filterGroup: 1,
|
|
58
58
|
isInitialized: !1,
|
|
59
|
-
filterSnapshot: null
|
|
60
|
-
syncedConfigFingerprint: null
|
|
59
|
+
filterSnapshot: null
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
const z = () => ({
|
|
@@ -72,7 +71,7 @@ const z = () => ({
|
|
|
72
71
|
blockStates: {},
|
|
73
72
|
currentRecommendationId: null,
|
|
74
73
|
configVersion: 0
|
|
75
|
-
}), Y =
|
|
74
|
+
}), Y = F("guidoRecommendationExtension", {
|
|
76
75
|
state: () => z(),
|
|
77
76
|
getters: {
|
|
78
77
|
// ====================================================================
|
|
@@ -242,7 +241,7 @@ const z = () => ({
|
|
|
242
241
|
const r = (o, c) => o === "." || o === "," || o === " " ? o : c, n = {
|
|
243
242
|
name: e.currencyCode,
|
|
244
243
|
value: e.currencyCode,
|
|
245
|
-
symbol: e.
|
|
244
|
+
symbol: e.currencyCode,
|
|
246
245
|
alignment: e.currencyAlignment === "before" ? "0" : "1",
|
|
247
246
|
decimalCount: String(e.currencyDecimalCount),
|
|
248
247
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
@@ -413,18 +412,18 @@ const z = () => ({
|
|
|
413
412
|
},
|
|
414
413
|
async fetchRecommendationFilters() {
|
|
415
414
|
if (!Object.keys(this.filterList).length) {
|
|
416
|
-
if (
|
|
417
|
-
await
|
|
415
|
+
if (h) {
|
|
416
|
+
await h;
|
|
418
417
|
return;
|
|
419
418
|
}
|
|
420
|
-
|
|
419
|
+
h = (async () => {
|
|
421
420
|
const t = await u.fetchRecommendationFilters();
|
|
422
421
|
this.filterList = t;
|
|
423
422
|
})();
|
|
424
423
|
try {
|
|
425
|
-
await
|
|
424
|
+
await h;
|
|
426
425
|
} finally {
|
|
427
|
-
|
|
426
|
+
h = null;
|
|
428
427
|
}
|
|
429
428
|
}
|
|
430
429
|
},
|
|
@@ -506,21 +505,21 @@ const z = () => ({
|
|
|
506
505
|
// ====================================================================
|
|
507
506
|
async fetchRecommendationProducts() {
|
|
508
507
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
509
|
-
if (
|
|
510
|
-
await
|
|
508
|
+
if (g) {
|
|
509
|
+
await g;
|
|
511
510
|
return;
|
|
512
511
|
}
|
|
513
|
-
|
|
512
|
+
g = this._doFetchProducts();
|
|
514
513
|
try {
|
|
515
|
-
await
|
|
514
|
+
await g;
|
|
516
515
|
} finally {
|
|
517
|
-
|
|
516
|
+
g = null;
|
|
518
517
|
}
|
|
519
518
|
}
|
|
520
519
|
},
|
|
521
520
|
async _doFetchProducts() {
|
|
522
521
|
var d;
|
|
523
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
522
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P();
|
|
524
523
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
525
524
|
await this._doFetchStrategyProducts(t);
|
|
526
525
|
return;
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-
|
|
1
|
+
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-1ca6baf0]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-050dfa52]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-050dfa52]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-050dfa52]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const isEditorBusy: () => boolean;
|
|
2
|
+
export declare const beginMount: () => number;
|
|
3
|
+
export declare const isCurrentMount: (generation: number) => boolean;
|
|
4
|
+
export declare const runExclusive: <T>(task: () => Promise<T>) => Promise<T>;
|
|
5
|
+
export declare const useEditorLock: () => {
|
|
6
|
+
runExclusive: <T>(task: () => Promise<T>) => Promise<T>;
|
|
7
|
+
isEditorBusy: () => boolean;
|
|
8
|
+
beginMount: () => number;
|
|
9
|
+
isCurrentMount: (generation: number) => boolean;
|
|
10
|
+
};
|
|
@@ -20,6 +20,7 @@ export * from './utils';
|
|
|
20
20
|
export declare class RecommendationBlockControl extends CommonControl {
|
|
21
21
|
private store;
|
|
22
22
|
private storeUnsubscription;
|
|
23
|
+
private syncedConfigs;
|
|
23
24
|
private pendingNodeConfigWrite;
|
|
24
25
|
private pendingConfigFlushTimer;
|
|
25
26
|
private algorithmControl;
|
|
@@ -63,11 +64,6 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
63
64
|
* fingerprint diff on this hook is the only way to notice (SD-149105).
|
|
64
65
|
* An unchanged fingerprint means the move came from us, so runtime store
|
|
65
66
|
* edits are never clobbered (SD-141049).
|
|
66
|
-
*
|
|
67
|
-
* The fingerprint is kept on the block's own store state so deleting the
|
|
68
|
-
* block drops it with the state it describes. A control-owned memo outlived
|
|
69
|
-
* that state and made a re-dropped saved module keep the defaults its wiped
|
|
70
|
-
* state was rebuilt with (SD-150347).
|
|
71
67
|
*/
|
|
72
68
|
private _syncNodeConfigIfChanged;
|
|
73
69
|
private _capturePendingNodeConfigWrite;
|
|
@@ -41,16 +41,6 @@ interface PerBlockState {
|
|
|
41
41
|
isInitialized: boolean;
|
|
42
42
|
/** Snapshot of filters taken when the drawer opens, used to revert on cancel */
|
|
43
43
|
filterSnapshot: Filter[] | null;
|
|
44
|
-
/**
|
|
45
|
-
* Fingerprint of the node config as this block's state last adopted it.
|
|
46
|
-
*
|
|
47
|
-
* Lives here, not on the control, because it is a claim ABOUT this state —
|
|
48
|
-
* "the store already holds that node config". Held on the control it
|
|
49
|
-
* outlived the state it described: `removeBlockState` tore the state down
|
|
50
|
-
* while the fingerprint survived, so re-dropping a saved module under the
|
|
51
|
-
* same id skipped the re-sync and kept the defaults (SD-150347).
|
|
52
|
-
*/
|
|
53
|
-
syncedConfigFingerprint: string | null;
|
|
54
44
|
}
|
|
55
45
|
/**
|
|
56
46
|
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
@@ -67,8 +57,6 @@ export interface PerBlockUrlConfig {
|
|
|
67
57
|
filters: Filter[];
|
|
68
58
|
shuffleProducts: boolean;
|
|
69
59
|
currencyCode: string;
|
|
70
|
-
/** The displayed symbol, which is not the code — a TRY block shows `₺`. */
|
|
71
|
-
currencySymbol: string;
|
|
72
60
|
currencyAlignment: 'before' | 'after';
|
|
73
61
|
currencyDecimalCount: number;
|
|
74
62
|
currencyDecimalSeparator: string;
|