@useinsider/guido 2.0.0-beta.087a24f → 2.0.0-beta.13a02f6
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/organisms/header/LeftSlot.vue.js +12 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
- package/dist/composables/useStripo.js +37 -35
- package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +53 -49
- package/dist/extensions/Blocks/Items/settingsPanel.js +4 -4
- package/dist/extensions/Blocks/Items/template.js +154 -140
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +18 -36
- package/dist/extensions/Blocks/controlFactories.js +91 -81
- package/dist/guido.css +1 -1
- package/dist/package.json.js +7 -0
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./LeftSlot.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var e = this,
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var r = function() {
|
|
5
|
+
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
6
|
+
return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "left-icon": "line-arrow-left", styling: "text", type: "secondary", "label-text": t.backButtonLabel, "skeleton-sizing": { width: 150, height: 26 }, "skeleton-status": t.editorStore.loadingStatus }, on: { click: t.handleBackClick } }), t.editorStore.isVersionHistoryOpen ? s(t.RestoreButton, { staticClass: "ml-3" }) : e._e()], 1);
|
|
7
|
+
}, i = [], a = /* @__PURE__ */ n(
|
|
8
|
+
o,
|
|
9
|
+
r,
|
|
10
|
+
i,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"3bf5c743"
|
|
14
14
|
);
|
|
15
|
-
const
|
|
15
|
+
const d = a.exports;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
d as default
|
|
18
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as c, computed as m } from "vue";
|
|
2
2
|
import { useConfig as f } from "../../../composables/useConfig.js";
|
|
3
3
|
import { useBack as p } from "../../../composables/useGuidoActions.js";
|
|
4
4
|
import { usePreviewMode as l } from "../../../composables/usePreviewMode.js";
|
|
@@ -7,14 +7,14 @@ import { useVersionHistoryApi as k } from "../../../composables/useVersionHistor
|
|
|
7
7
|
import { useEditorStore as B } from "../../../stores/editor.js";
|
|
8
8
|
import { InButtonV2 as b } from "@useinsider/design-system-vue";
|
|
9
9
|
import _ from "./version-history/RestoreButton.vue.js";
|
|
10
|
-
const
|
|
10
|
+
const S = /* @__PURE__ */ c({
|
|
11
11
|
__name: "LeftSlot",
|
|
12
12
|
setup(v) {
|
|
13
|
-
const o = B(), r = p(), { closeVersionHistory: i } = k(), { closePreviewMode: n } = l(), e = d(), { config: t } = f(),
|
|
13
|
+
const o = B(), r = p(), { closeVersionHistory: i } = k(), { closePreviewMode: n } = l(), e = d(), { config: t } = f(), u = m(() => {
|
|
14
14
|
var s, a;
|
|
15
15
|
return o.isVersionHistoryOpen || o.isPreviewModeOpen ? e("email-editor.back-to-editor") : (a = (s = t.value) == null ? void 0 : s.ui) != null && a.backButtonLabel ? t.value.ui.backButtonLabel : e("email-editor.back-to-design");
|
|
16
16
|
});
|
|
17
|
-
return { __sfc: !0, editorStore: o, handleBack: r, closeVersionHistory: i, closePreviewMode: n, trans: e, config: t, backButtonLabel:
|
|
17
|
+
return { __sfc: !0, editorStore: o, handleBack: r, closeVersionHistory: i, closePreviewMode: n, trans: e, config: t, backButtonLabel: u, handleBackClick: () => {
|
|
18
18
|
if (o.isVersionHistoryOpen) {
|
|
19
19
|
i();
|
|
20
20
|
return;
|
|
@@ -23,10 +23,10 @@ const h = /* @__PURE__ */ u({
|
|
|
23
23
|
n();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
r();
|
|
26
|
+
o.loadingStatus = !0, r();
|
|
27
27
|
}, InButtonV2: b, RestoreButton: _ };
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
S as default
|
|
32
32
|
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as V } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as _ } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as A } from "./useToaster.js";
|
|
7
7
|
import { displayConditions as F } from "../enums/displayConditions.js";
|
|
8
8
|
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
9
9
|
import I from "../static/styles/customEditorStyle.css.js";
|
|
10
10
|
import { useEditorStore as M } from "../stores/editor.js";
|
|
11
11
|
import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import P from "../package.json.js";
|
|
13
|
+
const K = (c) => {
|
|
14
|
+
const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
|
|
15
|
+
var g, f;
|
|
16
|
+
const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
|
|
16
17
|
window.UIEditor.initEditor(
|
|
17
18
|
document.querySelector("#guido-editor"),
|
|
18
19
|
{
|
|
19
|
-
metadata:
|
|
20
|
-
html:
|
|
21
|
-
css:
|
|
22
|
-
forceRecreate:
|
|
20
|
+
metadata: c,
|
|
21
|
+
html: r,
|
|
22
|
+
css: p,
|
|
23
|
+
forceRecreate: a,
|
|
23
24
|
locale: "en",
|
|
24
25
|
undoButtonSelector: "#guido__undo-button",
|
|
25
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,8 +31,8 @@ const $ = (a) => {
|
|
|
30
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
31
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
32
33
|
customViewStyles: I,
|
|
33
|
-
conditionsEnabled:
|
|
34
|
-
customConditionsEnabled:
|
|
34
|
+
conditionsEnabled: m,
|
|
35
|
+
customConditionsEnabled: m,
|
|
35
36
|
conditionCategories: F,
|
|
36
37
|
enableXSSSecurity: !0,
|
|
37
38
|
modulesDisabled: b,
|
|
@@ -41,7 +42,7 @@ const $ = (a) => {
|
|
|
41
42
|
displayTitle: !1,
|
|
42
43
|
displayUTM: !1,
|
|
43
44
|
selectElementAfterDrop: !0,
|
|
44
|
-
...
|
|
45
|
+
...t ? { baseBlocks: t } : {},
|
|
45
46
|
editorFonts: {
|
|
46
47
|
showDefaultStandardFonts: !0,
|
|
47
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -49,25 +50,25 @@ const $ = (a) => {
|
|
|
49
50
|
},
|
|
50
51
|
mergeTags: [
|
|
51
52
|
{
|
|
52
|
-
entries: U(
|
|
53
|
+
entries: U(c.preselectedDynamicContentList)
|
|
53
54
|
}
|
|
54
55
|
],
|
|
55
56
|
async onTokenRefreshRequest(e) {
|
|
56
57
|
try {
|
|
57
|
-
const
|
|
58
|
-
e(
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
58
|
+
const s = await y();
|
|
59
|
+
e(s);
|
|
60
|
+
} catch (s) {
|
|
61
|
+
u(s, "Failed to refresh token");
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
onTemplateLoaded() {
|
|
64
65
|
try {
|
|
65
|
-
const { importCss: e } =
|
|
66
|
-
e(),
|
|
66
|
+
const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
|
|
67
|
+
e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
67
68
|
o.hasChanges = !1;
|
|
68
69
|
}, 1e3);
|
|
69
70
|
} catch (e) {
|
|
70
|
-
|
|
71
|
+
u(e, "Failed to load custom interface appearance");
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
74
|
onCodeEditorVisibilityChanged(e) {
|
|
@@ -82,34 +83,35 @@ const $ = (a) => {
|
|
|
82
83
|
onDataChanged() {
|
|
83
84
|
o.hasChanges = !0;
|
|
84
85
|
},
|
|
85
|
-
onEvent:
|
|
86
|
+
onEvent: C,
|
|
86
87
|
ignoreClickOutsideSelectors: [
|
|
87
88
|
"#guido-dynamic-content-modal",
|
|
88
89
|
".in-on-board-wrapper",
|
|
89
90
|
".in-drawer__container"
|
|
90
91
|
],
|
|
91
|
-
extensions:
|
|
92
|
+
extensions: d
|
|
92
93
|
}
|
|
93
94
|
);
|
|
94
|
-
},
|
|
95
|
+
}, w = (i) => new Promise((n, o) => {
|
|
96
|
+
var d;
|
|
95
97
|
if (document.getElementById("UiEditorScript")) {
|
|
96
98
|
i(), n();
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
|
-
const
|
|
100
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
101
|
+
const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
|
+
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
101
103
|
i(), n();
|
|
102
104
|
}, t.onerror = () => {
|
|
103
|
-
o(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
104
106
|
}, document.body.appendChild(t);
|
|
105
107
|
});
|
|
106
108
|
return { initPlugin: async (i) => {
|
|
107
|
-
await
|
|
108
|
-
const n = await
|
|
109
|
-
await
|
|
109
|
+
await w(async () => {
|
|
110
|
+
const n = await S();
|
|
111
|
+
await h(i, n);
|
|
110
112
|
});
|
|
111
113
|
} };
|
|
112
114
|
};
|
|
113
115
|
export {
|
|
114
|
-
|
|
116
|
+
K as useStripo
|
|
115
117
|
};
|
|
@@ -1,59 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var l = (e, t, n) => t in e ? a(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var i = (e, t, n) => l(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { CommonControl as u } from "../../../common-control.js";
|
|
5
5
|
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
-
import { useItemsBlockStore as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const i = d.BUTTON_LINK, n = {
|
|
6
|
+
import { useItemsBlockStore as m } from "../../store/items-block.js";
|
|
7
|
+
import { getItemsBlockConfig as L } from "../../utils/nodeConfigUtils.js";
|
|
8
|
+
const r = d.BUTTON_LINK, s = {
|
|
10
9
|
LINK: "link"
|
|
11
10
|
};
|
|
12
|
-
class
|
|
11
|
+
class N extends u {
|
|
13
12
|
constructor() {
|
|
14
13
|
super(...arguments);
|
|
15
|
-
|
|
14
|
+
i(this, "store", m());
|
|
16
15
|
}
|
|
17
16
|
getId() {
|
|
18
|
-
return
|
|
17
|
+
return r;
|
|
19
18
|
}
|
|
20
19
|
getTemplate() {
|
|
21
20
|
return `
|
|
22
|
-
<div class="${
|
|
21
|
+
<div class="container ${r}">
|
|
23
22
|
${this._getLink()}
|
|
24
23
|
</div>
|
|
25
24
|
`;
|
|
26
25
|
}
|
|
27
26
|
onRender() {
|
|
28
27
|
this.api.updateValues({
|
|
29
|
-
[
|
|
30
|
-
})
|
|
28
|
+
[s.LINK]: this.store.buttonLink
|
|
29
|
+
});
|
|
31
30
|
}
|
|
32
|
-
onTemplateNodeUpdated(
|
|
33
|
-
super.onTemplateNodeUpdated(
|
|
34
|
-
() =>
|
|
31
|
+
onTemplateNodeUpdated(n) {
|
|
32
|
+
super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
|
|
33
|
+
() => {
|
|
34
|
+
const o = L(this.currentNode);
|
|
35
|
+
o != null && o.buttonLink && this.store.setButtonLink(o.buttonLink);
|
|
36
|
+
},
|
|
35
37
|
() => {
|
|
36
38
|
this.api.updateValues({
|
|
37
|
-
[
|
|
39
|
+
[s.LINK]: this.store.buttonLink
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
|
-
_listenToFormUpdates() {
|
|
43
|
-
this.api.onValueChanged(
|
|
44
|
-
n.LINK,
|
|
45
|
-
(t) => this._onLinkChange(t)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
_onLinkChange(t) {
|
|
49
|
-
console.debug("Button link changed to: ", t), this.store.setButtonLink(t), m(this.currentNode, this.api);
|
|
50
|
-
}
|
|
51
44
|
_getLink() {
|
|
52
45
|
return `
|
|
53
46
|
${this._GuOneColumn([
|
|
54
47
|
this._GuLabel({ text: "Link" }),
|
|
55
48
|
this._GuTextInput({
|
|
56
|
-
name:
|
|
49
|
+
name: s.LINK,
|
|
57
50
|
placeholder: "Enter Link",
|
|
58
51
|
className: "es-100",
|
|
59
52
|
disabled: !0
|
|
@@ -63,6 +56,6 @@ class C extends u {
|
|
|
63
56
|
}
|
|
64
57
|
}
|
|
65
58
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
N as ButtonLinkControl,
|
|
60
|
+
r as CONTROL_BLOCK_ID
|
|
68
61
|
};
|
|
@@ -1,59 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommonControl as
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var m = (t, e, n) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var s = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
5
5
|
import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
|
|
6
|
-
import { useItemsBlockStore as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const s = d.IMAGE_LINK, n = {
|
|
6
|
+
import { useItemsBlockStore as L } from "../../store/items-block.js";
|
|
7
|
+
import { getItemsBlockConfig as p } from "../../utils/nodeConfigUtils.js";
|
|
8
|
+
const r = d.IMAGE_LINK, i = {
|
|
10
9
|
LINK: "link"
|
|
11
10
|
};
|
|
12
|
-
class
|
|
11
|
+
class g extends l {
|
|
13
12
|
constructor() {
|
|
14
13
|
super(...arguments);
|
|
15
|
-
|
|
14
|
+
s(this, "store", L());
|
|
16
15
|
}
|
|
17
16
|
getId() {
|
|
18
|
-
return
|
|
17
|
+
return r;
|
|
19
18
|
}
|
|
20
19
|
getTemplate() {
|
|
21
20
|
return `
|
|
22
|
-
<div class="${
|
|
21
|
+
<div class="container ${r}">
|
|
23
22
|
${this._getLink()}
|
|
24
23
|
</div>
|
|
25
24
|
`;
|
|
26
25
|
}
|
|
27
26
|
onRender() {
|
|
28
27
|
this.api.updateValues({
|
|
29
|
-
[
|
|
30
|
-
})
|
|
28
|
+
[i.LINK]: this.store.imageLink
|
|
29
|
+
});
|
|
31
30
|
}
|
|
32
|
-
onTemplateNodeUpdated(
|
|
33
|
-
super.onTemplateNodeUpdated(
|
|
34
|
-
() =>
|
|
31
|
+
onTemplateNodeUpdated(n) {
|
|
32
|
+
super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
|
|
33
|
+
() => {
|
|
34
|
+
const o = p(this.currentNode);
|
|
35
|
+
o != null && o.imageLink && this.store.setImageLink(o.imageLink);
|
|
36
|
+
},
|
|
35
37
|
() => {
|
|
36
38
|
this.api.updateValues({
|
|
37
|
-
[
|
|
39
|
+
[i.LINK]: this.store.imageLink
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
|
-
_listenToFormUpdates() {
|
|
43
|
-
this.api.onValueChanged(
|
|
44
|
-
n.LINK,
|
|
45
|
-
(e) => this._onLinkChange(e)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
_onLinkChange(e) {
|
|
49
|
-
console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
|
|
50
|
-
}
|
|
51
44
|
_getLink() {
|
|
52
45
|
return `
|
|
53
46
|
${this._GuOneColumn([
|
|
54
47
|
this._GuLabel({ text: "Link" }),
|
|
55
48
|
this._GuTextInput({
|
|
56
|
-
name:
|
|
49
|
+
name: i.LINK,
|
|
57
50
|
placeholder: "Enter Link",
|
|
58
51
|
className: "es-100",
|
|
59
52
|
disabled: !0
|
|
@@ -63,6 +56,6 @@ class N extends m {
|
|
|
63
56
|
}
|
|
64
57
|
}
|
|
65
58
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
r as CONTROL_BLOCK_ID,
|
|
60
|
+
g as ImageLinkControl
|
|
68
61
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var
|
|
3
|
+
var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
|
|
@@ -11,17 +11,17 @@ import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.j
|
|
|
11
11
|
const y = p.NAME_TRIMMING, o = {
|
|
12
12
|
TRIMMING: "trimming"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class v extends c {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
|
|
17
|
+
s(this, "store", N());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
20
|
return y;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
24
|
-
<div class="${p.NAME_TRIMMING}">
|
|
24
|
+
<div class="container ${p.NAME_TRIMMING}">
|
|
25
25
|
${this._getTextTrimming()}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
@@ -43,8 +43,8 @@ class _ extends c {
|
|
|
43
43
|
this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
44
44
|
}
|
|
45
45
|
_applyTrimmingStyles(e) {
|
|
46
|
-
var
|
|
47
|
-
const r = (
|
|
46
|
+
var n;
|
|
47
|
+
const r = (n = this.currentNode) == null ? void 0 : n.querySelector("p > a");
|
|
48
48
|
if (!r)
|
|
49
49
|
return;
|
|
50
50
|
const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
|
|
@@ -52,19 +52,17 @@ class _ extends c {
|
|
|
52
52
|
}
|
|
53
53
|
_getTextTrimming() {
|
|
54
54
|
return `
|
|
55
|
-
<div class="
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
${this._GuToggle(o.TRIMMING)}
|
|
62
|
-
</div>
|
|
55
|
+
<div class="display-flex align-items-center justify-content-between">
|
|
56
|
+
<${l.LABEL}
|
|
57
|
+
${g.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
58
|
+
>
|
|
59
|
+
</${l.LABEL}>
|
|
60
|
+
${this._GuToggle(o.TRIMMING)}
|
|
63
61
|
</div>
|
|
64
62
|
`;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
export {
|
|
68
66
|
y as CONTROL_BLOCK_ID,
|
|
69
|
-
|
|
67
|
+
v as NameTrimmingControl
|
|
70
68
|
};
|
|
@@ -3,12 +3,12 @@ var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var P = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { ModificationDescription as F, UIElementType as m, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as h } from "../../../common-control.js";
|
|
6
|
-
import { ItemsBlockControlId as
|
|
6
|
+
import { ItemsBlockControlId as p, ItemsBlockId as A } from "../../enums/controlEnums.js";
|
|
7
7
|
import { productPairs as T } from "../../enums/productEnums.js";
|
|
8
8
|
import { useItemsBlockStore as u } from "../../store/items-block.js";
|
|
9
9
|
import { syncFormattedPriceFromAttributes as g } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
10
10
|
import { updateConfigBlockAttributes as D } from "../../utils/updateAttributes.js";
|
|
11
|
-
const f =
|
|
11
|
+
const f = p.PRICE_FORMATTED_PRICE, s = {
|
|
12
12
|
FORMATTED_PRICE: "formattedPrice"
|
|
13
13
|
};
|
|
14
14
|
class y extends h {
|
|
@@ -21,13 +21,13 @@ class y extends h {
|
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
24
|
-
<div class="${
|
|
24
|
+
<div class="container ${p.PRICE_FORMATTED_PRICE}">
|
|
25
25
|
${this._getFormattedPrice()}
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
onRender() {
|
|
30
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
|
|
31
31
|
this._onFormattedPriceChange(t);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -35,14 +35,14 @@ class y extends h {
|
|
|
35
35
|
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
36
36
|
() => g(this.currentNode),
|
|
37
37
|
() => {
|
|
38
|
-
this.api.updateValues({ [
|
|
38
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice });
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
_onFormattedPriceChange(t) {
|
|
43
43
|
if (console.debug("Formatted price changed to: ", t), this.store.setFormattedPrice(t), D(this.currentNode, this.api), !this.currentNode)
|
|
44
44
|
return;
|
|
45
|
-
const { itemsType:
|
|
45
|
+
const { itemsType: n } = this.store, i = T.PAIRS_FOR_EXTENSION.price[n], o = T.PAIRS_FOR_EXTENSION.originalPrice[n], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [l, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
|
|
46
46
|
this._updatePriceBlock(
|
|
47
47
|
this.currentNode,
|
|
48
48
|
c,
|
|
@@ -50,22 +50,20 @@ class y extends h {
|
|
|
50
50
|
"price"
|
|
51
51
|
);
|
|
52
52
|
const d = this.currentNode.closest(".items-block"), E = d == null ? void 0 : d.querySelector(`[esd-extension-block-id="${A.ORIGINAL_PRICE}"]`);
|
|
53
|
-
E && this._updatePriceBlock(E,
|
|
53
|
+
E && this._updatePriceBlock(E, l, R, "original price");
|
|
54
54
|
}
|
|
55
|
-
_updatePriceBlock(t,
|
|
56
|
-
const c = t.getInnerHTML().replace(
|
|
55
|
+
_updatePriceBlock(t, n, i, o) {
|
|
56
|
+
const c = t.getInnerHTML().replace(n, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
|
|
57
57
|
this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(c).apply(new F(a));
|
|
58
58
|
}
|
|
59
59
|
_getFormattedPrice() {
|
|
60
60
|
return `
|
|
61
|
-
<div class="
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
${this._GuToggle(n.FORMATTED_PRICE)}
|
|
68
|
-
</div>
|
|
61
|
+
<div class="display-flex align-items-center justify-content-between">
|
|
62
|
+
<${m.LABEL}
|
|
63
|
+
${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
|
|
64
|
+
>
|
|
65
|
+
</${m.LABEL}>
|
|
66
|
+
${this._GuToggle(s.FORMATTED_PRICE)}
|
|
69
67
|
</div>
|
|
70
68
|
`;
|
|
71
69
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var a = (i, e, t) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { UIElementType as n, UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
3
|
+
var s = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UIElementType as n, UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as c } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
|
|
7
7
|
import { useItemsBlockStore as D } from "../../store/items-block.js";
|
|
8
8
|
import { syncHideDiscountFromAttributes as p } from "../../utils/syncAttributesFromConfigBlock.js";
|
|
9
9
|
import { updateConfigBlockAttributes as I } from "../../utils/updateAttributes.js";
|
|
10
|
-
const
|
|
10
|
+
const h = r.PRICE_HIDE_DISCOUNT, o = {
|
|
11
11
|
HIDE_DISCOUNT: "hideDiscount"
|
|
12
12
|
};
|
|
13
|
-
class N extends
|
|
13
|
+
class N extends c {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
-
|
|
16
|
+
s(this, "store", D());
|
|
17
17
|
}
|
|
18
18
|
getId() {
|
|
19
|
-
return
|
|
19
|
+
return h;
|
|
20
20
|
}
|
|
21
21
|
getTemplate() {
|
|
22
22
|
return `
|
|
23
|
-
<div class="${r.PRICE_HIDE_DISCOUNT}">
|
|
23
|
+
<div class="container ${r.PRICE_HIDE_DISCOUNT}">
|
|
24
24
|
${this._getHideDiscount()}
|
|
25
25
|
</div>
|
|
26
26
|
`;
|
|
27
27
|
}
|
|
28
28
|
onRender() {
|
|
29
|
-
this.api.updateValues({ [
|
|
29
|
+
this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(o.HIDE_DISCOUNT, (t) => {
|
|
30
30
|
this._onHideDiscountChange(t);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -34,28 +34,28 @@ class N extends u {
|
|
|
34
34
|
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
|
|
35
35
|
() => p(this.currentNode),
|
|
36
36
|
() => {
|
|
37
|
-
this.api.updateValues({ [
|
|
37
|
+
this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount });
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
_onHideDiscountChange(t) {
|
|
42
|
-
this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [
|
|
42
|
+
this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [o.HIDE_DISCOUNT]: t });
|
|
43
43
|
}
|
|
44
44
|
_getHideDiscount() {
|
|
45
45
|
return `
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
<div class="display-flex align-items-center justify-content-between">
|
|
48
48
|
<${n.LABEL}
|
|
49
|
-
${
|
|
49
|
+
${u.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
|
|
50
50
|
>
|
|
51
51
|
</${n.LABEL}>
|
|
52
|
-
${this._GuToggle(
|
|
52
|
+
${this._GuToggle(o.HIDE_DISCOUNT)}
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
`;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
export {
|
|
59
|
-
|
|
59
|
+
h as CONTROL_BLOCK_ID,
|
|
60
60
|
N as PriceHideDiscountControl
|
|
61
61
|
};
|