@useinsider/guido 3.30.0-beta.232ea3c → 3.30.0-beta.25ed52c
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/README.md +52 -0
- package/dist/@types/config/schemas.js +40 -33
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +128 -113
- package/dist/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue.js +34 -0
- package/dist/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue2.js +76 -0
- package/dist/components/organisms/dynamic-content/DynamicContentCustomFormat.vue.js +21 -0
- package/dist/components/organisms/dynamic-content/DynamicContentCustomFormat.vue2.js +33 -0
- package/dist/components/organisms/dynamic-content/DynamicContentPicker.vue.js +42 -0
- package/dist/components/organisms/dynamic-content/DynamicContentPicker.vue2.js +216 -0
- package/dist/composables/useDynamicContentFormat.js +10 -0
- package/dist/composables/useDynamicContentPicker.js +36 -0
- package/dist/composables/useHtmlCompiler.js +15 -13
- package/dist/composables/useInfoBoxPosition.js +16 -0
- package/dist/composables/useStripo.js +59 -57
- package/dist/config/compiler/liquidCompilerRules.js +13 -5
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/enums/dynamic-content.js +180 -2
- package/dist/extensions/DynamicContent/dynamic-content.js +56 -33
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/@types/generic.d.ts +11 -0
- package/dist/src/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue.d.ts +48 -0
- package/dist/src/components/organisms/dynamic-content/DynamicContentCustomFormat.vue.d.ts +44 -0
- package/dist/src/components/organisms/dynamic-content/DynamicContentPicker.vue.d.ts +67 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/composables/useDynamicContentFormat.d.ts +5 -0
- package/dist/src/composables/useDynamicContentPicker.d.ts +35 -0
- package/dist/src/composables/useInfoBoxPosition.d.ts +24 -0
- package/dist/src/enums/dynamic-content.d.ts +21 -0
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +11 -0
- package/dist/src/stores/config.d.ts +63 -0
- package/dist/src/utils/clipboardText.d.ts +1 -0
- package/dist/src/utils/dynamicContentPicker.d.ts +43 -0
- package/dist/src/utils/genericUtil.d.ts +7 -2
- package/dist/src/utils/linkTokenPaste.d.ts +3 -0
- package/dist/src/utils/liquidLinkQuotes.d.ts +4 -0
- package/dist/utils/clipboardText.js +31 -0
- package/dist/utils/dynamicContentPicker.js +88 -0
- package/dist/utils/genericUtil.js +53 -43
- package/dist/utils/linkTokenPaste.js +28 -0
- package/dist/utils/liquidLinkQuotes.js +10 -0
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { defineComponent as Tt, ref as d, computed as o, toRef as _t, reactive as Dt, watch as at, onBeforeUnmount as Bt, nextTick as lt } from "vue";
|
|
2
|
+
import { useDynamicContentFormat as wt } from "../../../composables/useDynamicContentFormat.js";
|
|
3
|
+
import { useInfoBoxPosition as Rt } from "../../../composables/useInfoBoxPosition.js";
|
|
4
|
+
import { useTranslations as Ht } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { ARRAY_OF_OBJECTS_CATEGORY_VALUE as it, ARRAY_OF_OBJECTS_LABEL_BASE as ut, DynamicContentAttributeType as st, DynamicContentCustomFormat as ct } from "../../../enums/dynamic-content.js";
|
|
6
|
+
import Pt from "./DynamicContentAooRuleConfig.vue.js";
|
|
7
|
+
import Nt from "./DynamicContentCustomFormat.vue.js";
|
|
8
|
+
import { isLookupBinding as $t, isAooTokenForArrays as rt, removeAooTokenOnce as Vt, extractUsedAooPatterns as zt, buildLookupColumnOptions as Ut, getIndefiniteArticle as Yt, findDynamicContentSelection as Mt } from "../../../utils/dynamicContentPicker.js";
|
|
9
|
+
import { escapeHtml as z } from "../../../utils/htmlEscape.js";
|
|
10
|
+
import { InSelect as jt, InInfoBox as Jt, InBasicTextInput as Kt } from "@useinsider/design-system-vue";
|
|
11
|
+
const ae = /* @__PURE__ */ Tt({
|
|
12
|
+
__name: "DynamicContentPicker",
|
|
13
|
+
props: {
|
|
14
|
+
visible: { type: Boolean },
|
|
15
|
+
dynamicContentOptions: { default: () => [] },
|
|
16
|
+
aooOptions: { default: () => [] },
|
|
17
|
+
aooScanContent: { default: "" },
|
|
18
|
+
initialData: { default: null },
|
|
19
|
+
position: { default: () => ({}) }
|
|
20
|
+
},
|
|
21
|
+
emits: ["close", "addDynamicContent"],
|
|
22
|
+
setup(mt, { emit: _ }) {
|
|
23
|
+
const a = mt, p = Object.freeze({ attribute: "attribute", settings: "settings" }), D = "dynamic-content-modal__save-button", U = "dynamic-content-modal__cancel-button", l = Ht(), { getFormatOptions: B, isNumberFormatSupported: Y } = wt(), M = d(), I = d(), c = d(), k = d(p.attribute), w = d({ width: 0, height: 0 }), F = d(!1), h = o(() => {
|
|
24
|
+
var t;
|
|
25
|
+
return !!((t = a.initialData) != null && t.value);
|
|
26
|
+
}), { positionStyle: dt } = Rt({
|
|
27
|
+
anchor: _t(a, "position"),
|
|
28
|
+
size: w,
|
|
29
|
+
isAbove: o(() => !h.value)
|
|
30
|
+
});
|
|
31
|
+
let r = null, u = null;
|
|
32
|
+
const f = /* @__PURE__ */ new Set();
|
|
33
|
+
let g = !1, R = !1;
|
|
34
|
+
const e = Dt({
|
|
35
|
+
dynamicContentInput: [],
|
|
36
|
+
lookupColumnInput: [],
|
|
37
|
+
aooLeafInput: [],
|
|
38
|
+
dynamicContentFallbackInput: "",
|
|
39
|
+
isCustomFormatEnabled: !1,
|
|
40
|
+
customFormat: {}
|
|
41
|
+
}), L = o(() => a.aooOptions.map((t) => t.value).filter(Boolean)), v = o(() => a.aooOptions.length ? { text: l(`${ut}-text`), value: it, description: "" } : null), j = o(() => v.value ? [...a.dynamicContentOptions, v.value] : a.dynamicContentOptions), C = o(() => $t(e.dynamicContentInput[0])), y = o(() => {
|
|
42
|
+
var t;
|
|
43
|
+
return ((t = e.dynamicContentInput[0]) == null ? void 0 : t.value) === it;
|
|
44
|
+
}), pt = o(() => {
|
|
45
|
+
var n, i;
|
|
46
|
+
const t = rt((n = a.initialData) == null ? void 0 : n.value, L.value) ? Vt(a.aooScanContent, (i = a.initialData) == null ? void 0 : i.value) : a.aooScanContent;
|
|
47
|
+
return zt(t).filter(
|
|
48
|
+
(s) => L.value.includes(s.slice(s.indexOf(".") + 1))
|
|
49
|
+
);
|
|
50
|
+
}), J = o(() => Ut(e.dynamicContentInput[0])), S = o(
|
|
51
|
+
() => {
|
|
52
|
+
var t, n;
|
|
53
|
+
return String(((t = e.dynamicContentInput[0]) == null ? void 0 : t.bindingLabel) || ((n = e.dynamicContentInput[0]) == null ? void 0 : n.text) || "");
|
|
54
|
+
}
|
|
55
|
+
), ft = o(() => z(S.value)), vt = o(
|
|
56
|
+
() => l("products.dropdown-placeholder", { label: S.value })
|
|
57
|
+
), H = o(
|
|
58
|
+
() => {
|
|
59
|
+
var t;
|
|
60
|
+
return ((t = e.dynamicContentInput[0]) == null ? void 0 : t.type) === st.Datetime;
|
|
61
|
+
}
|
|
62
|
+
), K = o(
|
|
63
|
+
() => {
|
|
64
|
+
var t;
|
|
65
|
+
return ((t = e.dynamicContentInput[0]) == null ? void 0 : t.type) === st.Number && Y.value;
|
|
66
|
+
}
|
|
67
|
+
), P = o(() => H.value || K.value), m = o(() => H.value ? ct.Time : ct.Number), Ct = o(() => ({
|
|
68
|
+
type: m.value,
|
|
69
|
+
options: B(m.value),
|
|
70
|
+
checkboxLabel: l(`dynamic-content.custom-${m.value}-checkbox-text`),
|
|
71
|
+
selectLabel: l(`dynamic-content.custom-${m.value}-label-text`),
|
|
72
|
+
selectPlaceholder: l(`dynamic-content.custom-${m.value}-placeholder-text`)
|
|
73
|
+
})), q = (t) => l("validations.select-a-field-to-continue", {
|
|
74
|
+
article: Yt(t),
|
|
75
|
+
field: t
|
|
76
|
+
}), G = o(() => {
|
|
77
|
+
const t = (n, i, s) => F.value && n && !i.length ? q(s) : "";
|
|
78
|
+
return {
|
|
79
|
+
dynamicContentInput: t(
|
|
80
|
+
!0,
|
|
81
|
+
e.dynamicContentInput,
|
|
82
|
+
l("dynamic-content.dynamic-contents-label")
|
|
83
|
+
),
|
|
84
|
+
lookupColumnInput: t(C.value, e.lookupColumnInput, S.value),
|
|
85
|
+
aooLeafInput: t(
|
|
86
|
+
y.value,
|
|
87
|
+
e.aooLeafInput,
|
|
88
|
+
l(`${ut}-text`)
|
|
89
|
+
)
|
|
90
|
+
};
|
|
91
|
+
}), yt = o(() => e.dynamicContentInput.length ? y.value ? !!e.aooLeafInput.length : C.value ? !!e.lookupColumnInput.length : !0 : !1), x = o(() => k.value === p.settings), A = o(() => y.value ? e.aooLeafInput[0] : C.value ? e.lookupColumnInput[0] : e.dynamicContentInput[0]), N = o(() => !y.value && !C.value && e.isCustomFormatEnabled && P.value), bt = o(() => {
|
|
92
|
+
var t;
|
|
93
|
+
return x.value ? z(String(((t = A.value) == null ? void 0 : t.text) ?? "")) : l(h.value ? "integration-hub.webhook.replace-dynamic-content" : "dynamic-content.modal-title");
|
|
94
|
+
}), It = o(() => {
|
|
95
|
+
var t;
|
|
96
|
+
return z(`{{${((t = A.value) == null ? void 0 : t.value) ?? ""}}}`);
|
|
97
|
+
}), kt = o(() => [
|
|
98
|
+
{
|
|
99
|
+
id: D,
|
|
100
|
+
text: l("products.save"),
|
|
101
|
+
type: "text",
|
|
102
|
+
icon: "line-check-netural",
|
|
103
|
+
status: "default"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: U,
|
|
107
|
+
text: l("products.cancel"),
|
|
108
|
+
type: "text",
|
|
109
|
+
icon: "line-error-netural",
|
|
110
|
+
status: "secondary"
|
|
111
|
+
}
|
|
112
|
+
]), Ft = (t) => {
|
|
113
|
+
var n;
|
|
114
|
+
(n = c.value) == null || n.resetState(), e.dynamicContentInput = [t], e.lookupColumnInput = [], e.aooLeafInput = [], e.dynamicContentFallbackInput = "", e.isCustomFormatEnabled = !1, e.customFormat = {};
|
|
115
|
+
}, ht = (t) => {
|
|
116
|
+
e.lookupColumnInput = [t], e.dynamicContentFallbackInput = "";
|
|
117
|
+
}, gt = ({ leaf: t }) => {
|
|
118
|
+
e.aooLeafInput = [t];
|
|
119
|
+
}, Lt = () => {
|
|
120
|
+
e.aooLeafInput = [];
|
|
121
|
+
}, O = () => {
|
|
122
|
+
_("close");
|
|
123
|
+
}, W = () => {
|
|
124
|
+
var i;
|
|
125
|
+
const t = (i = a.initialData) == null ? void 0 : i.format;
|
|
126
|
+
if (!t || !P.value || !c.value)
|
|
127
|
+
return;
|
|
128
|
+
const n = B(m.value).find((s) => s.value === t.value);
|
|
129
|
+
n ? (e.customFormat = t, c.value.setFormat(n)) : (e.customFormat = {}, e.isCustomFormatEnabled = !1, c.value.resetState());
|
|
130
|
+
}, Q = () => {
|
|
131
|
+
_("addDynamicContent", {
|
|
132
|
+
...A.value,
|
|
133
|
+
...N.value ? { format: e.customFormat } : { fallback: e.dynamicContentFallbackInput }
|
|
134
|
+
});
|
|
135
|
+
}, X = () => {
|
|
136
|
+
var n;
|
|
137
|
+
return F.value = !0, (((n = c.value) == null ? void 0 : n.validate()) ?? !0) && !Object.values(G.value).some(Boolean);
|
|
138
|
+
}, Z = () => {
|
|
139
|
+
if (X()) {
|
|
140
|
+
if (x.value || N.value) {
|
|
141
|
+
Q();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
k.value = p.settings;
|
|
145
|
+
}
|
|
146
|
+
}, St = ({ id: t }) => {
|
|
147
|
+
if (t !== D) {
|
|
148
|
+
O();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
R || Z();
|
|
152
|
+
}, xt = ({ detail: t }) => {
|
|
153
|
+
R = t > 1;
|
|
154
|
+
}, At = (t, n) => {
|
|
155
|
+
n ? f.add(t) : f.delete(t);
|
|
156
|
+
}, Ot = ({ target: t, currentTarget: n }) => {
|
|
157
|
+
g = t === n;
|
|
158
|
+
}, Et = () => {
|
|
159
|
+
g && O();
|
|
160
|
+
}, b = ({ key: t, isComposing: n }) => {
|
|
161
|
+
t === "Escape" && !n && !f.size && O();
|
|
162
|
+
}, $ = () => {
|
|
163
|
+
const { offsetWidth: t = 0, offsetHeight: n = 0 } = I.value || {};
|
|
164
|
+
w.value = { width: t, height: n };
|
|
165
|
+
}, tt = () => {
|
|
166
|
+
var n;
|
|
167
|
+
let t = document.activeElement;
|
|
168
|
+
for (; (n = t == null ? void 0 : t.shadowRoot) != null && n.activeElement; )
|
|
169
|
+
t = t.shadowRoot.activeElement;
|
|
170
|
+
return (t == null ? void 0 : t.contentDocument) || null;
|
|
171
|
+
}, E = () => {
|
|
172
|
+
document.removeEventListener("keydown", b, !0), u == null || u.removeEventListener("keydown", b, !0), u = null, r == null || r.disconnect(), r = null;
|
|
173
|
+
}, et = async () => {
|
|
174
|
+
var t;
|
|
175
|
+
E(), document.addEventListener("keydown", b, !0), await lt(), !(!a.visible || !I.value) && (u = h.value ? tt() : null, u ? u.addEventListener("keydown", b, !0) : (t = M.value) == null || t.focus({ preventScroll: !0 }), $(), typeof ResizeObserver < "u" && (r = new ResizeObserver($), r.observe(I.value)));
|
|
176
|
+
}, V = async () => {
|
|
177
|
+
const { initialData: t } = a;
|
|
178
|
+
if (rt(t == null ? void 0 : t.value, L.value) && v.value) {
|
|
179
|
+
e.dynamicContentInput = [v.value], t != null && t.fallback && (e.dynamicContentFallbackInput = t.fallback);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const n = Mt(t, j.value);
|
|
183
|
+
if (n && (e.dynamicContentInput = [n.binding]), await lt(), n != null && n.column) {
|
|
184
|
+
const i = J.value.find((s) => {
|
|
185
|
+
var ot;
|
|
186
|
+
return s.value === ((ot = n.column) == null ? void 0 : ot.value);
|
|
187
|
+
});
|
|
188
|
+
i && (e.lookupColumnInput = [i]);
|
|
189
|
+
}
|
|
190
|
+
t != null && t.fallback && (e.dynamicContentFallbackInput = t.fallback), n && W();
|
|
191
|
+
}, nt = () => {
|
|
192
|
+
var t;
|
|
193
|
+
E(), f.clear(), g = !1, k.value = p.attribute, F.value = !1, e.dynamicContentInput = [], e.lookupColumnInput = [], e.aooLeafInput = [], e.dynamicContentFallbackInput = "", e.isCustomFormatEnabled = !1, e.customFormat = {}, (t = c.value) == null || t.resetState();
|
|
194
|
+
}, T = (t) => console.error("[DYNAMIC_CONTENT_PICKER] open failed", t);
|
|
195
|
+
return at(
|
|
196
|
+
() => a.visible,
|
|
197
|
+
(t) => {
|
|
198
|
+
if (!t) {
|
|
199
|
+
nt();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
V().catch(T), et().catch(T);
|
|
203
|
+
},
|
|
204
|
+
{ immediate: !0 }
|
|
205
|
+
), at(
|
|
206
|
+
[() => a.initialData, () => a.dynamicContentOptions],
|
|
207
|
+
() => {
|
|
208
|
+
a.visible && !x.value && a.initialData && a.dynamicContentOptions.length && V().catch(T);
|
|
209
|
+
},
|
|
210
|
+
{ deep: !0 }
|
|
211
|
+
), Bt(E), { __sfc: !0, STEPS: p, SAVE_BUTTON_ID: D, CANCEL_BUTTON_ID: U, props: a, emit: _, trans: l, getFormatOptions: B, isNumberFormatSupported: Y, layerRef: M, boxRef: I, customFormatRef: c, currentStep: k, boxSize: w, isSubmitted: F, isEditing: h, positionStyle: dt, resizeObserver: r, frameDocument: u, openLists: f, isPressedOnLayer: g, isRepeatedClick: R, state: e, aooArrayKeys: L, aooEntry: v, formattedDynamicContentOptions: j, isLookupSelected: C, isAooSelected: y, usedAooPatterns: pt, lookupColumnOptions: J, lookupBindingText: S, lookupBindingLabel: ft, lookupColumnPlaceholder: vt, isCustomDateTimeFormatVisible: H, isCustomNumberFormatVisible: K, hasCustomFormat: P, customFormatType: m, customFormatConfig: Ct, requiredMessage: q, errors: G, hasSelectedDynamicContent: yt, isSettingsStep: x, selectedContent: A, hasAppliedFormat: N, titleText: bt, descriptionText: It, buttonOptions: kt, selectDynamicContentHandler: Ft, selectLookupColumnHandler: ht, selectAooLeafHandler: gt, clearAooLeafHandler: Lt, closeHandler: O, restoreInitialFormat: W, insertDynamicContent: Q, validate: X, primaryButtonClickHandler: Z, buttonClickHandler: St, clickCaptureHandler: xt, openListHandler: At, layerMousedownHandler: Ot, layerClickHandler: Et, keydownHandler: b, measureBox: $, getFocusedFrameDocument: tt, stopTracking: E, startTracking: et, populateInitialData: V, resetPicker: nt, reportFailure: T, DynamicContentAooRuleConfig: Pt, DynamicContentCustomFormat: Nt, InBasicTextInput: Kt, InInfoBox: Jt, InSelect: jt };
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
export {
|
|
215
|
+
ae as default
|
|
216
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useConfig as e } from "./useConfig.js";
|
|
2
|
+
import { DynamicContentCustomFormat as i, NumberFormats as n, LiquidTimeFormats as u, PongoTimeFormats as a } from "../enums/dynamic-content.js";
|
|
3
|
+
import { computed as o } from "vue";
|
|
4
|
+
const f = () => {
|
|
5
|
+
const { isFeatureEnabled: r } = e(), t = o(() => r("liquidSyntax"));
|
|
6
|
+
return { isNumberFormatSupported: o(() => !t.value), getFormatOptions: (m) => m !== i.Time ? n : t.value ? u : a };
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
f as useDynamicContentFormat
|
|
10
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useConfigStore as f } from "../stores/config.js";
|
|
2
|
+
import { useGuidoEmailEditorStore as b } from "../stores/guido-email-editor.js";
|
|
3
|
+
import { buildPickerOptions as v, buildAooScanContent as S } from "../utils/dynamicContentPicker.js";
|
|
4
|
+
import { computed as o, ref as C } from "vue";
|
|
5
|
+
const A = ({ onInsert: c, onClose: s }) => {
|
|
6
|
+
const t = f(), p = o(() => t.isFeatureEnabled("dynamicContentPicker")), i = C({ visible: !1, initialData: null }), m = o(() => {
|
|
7
|
+
var e;
|
|
8
|
+
return v((e = t.template) == null ? void 0 : e.dynamicContentList);
|
|
9
|
+
}), u = o(() => {
|
|
10
|
+
var a, l;
|
|
11
|
+
if (!i.value.visible)
|
|
12
|
+
return "";
|
|
13
|
+
const e = b(), n = e.hasSnapshot ? e.html : (a = t.template) == null ? void 0 : a.html, { subject: d = "", preheader: k = "" } = ((l = t.editor) == null ? void 0 : l.emailHeader) ?? {};
|
|
14
|
+
return S([d, k, n ?? ""]);
|
|
15
|
+
}), r = () => {
|
|
16
|
+
i.value = { visible: !1, initialData: null };
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
isPickerEnabled: p,
|
|
20
|
+
picker: i,
|
|
21
|
+
pickerOptions: m,
|
|
22
|
+
pickerAooScanContent: u,
|
|
23
|
+
openPicker: (e, n) => {
|
|
24
|
+
i.value = { visible: !0, initialData: e ?? null, position: n };
|
|
25
|
+
},
|
|
26
|
+
pickerSaveHandler: (e) => {
|
|
27
|
+
r(), c(e);
|
|
28
|
+
},
|
|
29
|
+
pickerCloseHandler: () => {
|
|
30
|
+
r(), s();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
A as useDynamicContentPicker
|
|
36
|
+
};
|
|
@@ -8,8 +8,8 @@ import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules
|
|
|
8
8
|
import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
9
9
|
import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
|
|
10
10
|
import { computed as p } from "vue";
|
|
11
|
-
import { useConfig as
|
|
12
|
-
const
|
|
11
|
+
import { useConfig as k } from "./useConfig.js";
|
|
12
|
+
const x = /* @__PURE__ */ new Set([
|
|
13
13
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
14
14
|
"fix-url-encoding-start",
|
|
15
15
|
"fix-url-encoding-end",
|
|
@@ -31,6 +31,8 @@ const A = /* @__PURE__ */ new Set([
|
|
|
31
31
|
"add-universal-link-flags",
|
|
32
32
|
// Coupon placeholder replacement (only present when liquidSyntax is enabled).
|
|
33
33
|
"liquid-coupon-code",
|
|
34
|
+
// Liquid only: swaps the quotes inside {{ }} of href/src values, attribute-value edit only.
|
|
35
|
+
"liquid-single-quote-links",
|
|
34
36
|
// Pongo only: collapses line breaks inside {% %} tags, which pongo2 cannot parse in AMP either.
|
|
35
37
|
"pongo-single-line-tags",
|
|
36
38
|
// Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
|
|
@@ -38,29 +40,29 @@ const A = /* @__PURE__ */ new Set([
|
|
|
38
40
|
"remove-contenteditable",
|
|
39
41
|
"remove-dc-pending-marker"
|
|
40
42
|
]), M = () => {
|
|
41
|
-
const { compiler:
|
|
42
|
-
var
|
|
43
|
-
const e = ((
|
|
43
|
+
const { compiler: m, isFeatureEnabled: u, partner: a } = k(), c = p(() => {
|
|
44
|
+
var i, l;
|
|
45
|
+
const e = ((i = m.value) == null ? void 0 : i.customRules) || [];
|
|
44
46
|
return [
|
|
45
|
-
...!!((l =
|
|
47
|
+
...!!((l = m.value) != null && l.ignoreDefaultRules) ? [] : d,
|
|
46
48
|
...C,
|
|
47
49
|
...b,
|
|
48
50
|
...f,
|
|
49
51
|
...R,
|
|
50
52
|
...H,
|
|
51
|
-
...
|
|
52
|
-
...e.map((
|
|
53
|
-
...
|
|
54
|
-
priority:
|
|
53
|
+
...u("liquidSyntax") ? g : v,
|
|
54
|
+
...e.map((t, o) => ({
|
|
55
|
+
...t,
|
|
56
|
+
priority: t.priority + 1e3 + o
|
|
55
57
|
// Ensure additional rules run after default rules
|
|
56
58
|
}))
|
|
57
59
|
];
|
|
58
60
|
}), r = p(() => {
|
|
59
|
-
var
|
|
60
|
-
const e = c.value, s = n(e),
|
|
61
|
+
var t;
|
|
62
|
+
const e = c.value, s = n(e), i = n(e.filter((o) => x.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
|
|
61
63
|
return {
|
|
62
64
|
compileHtml: (o) => s.compile(o, void 0, l),
|
|
63
|
-
compileAmpHtml: (o) =>
|
|
65
|
+
compileAmpHtml: (o) => i.compile(o, void 0, l)
|
|
64
66
|
};
|
|
65
67
|
});
|
|
66
68
|
return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref as g, computed as x, onMounted as a, onBeforeUnmount as f } from "vue";
|
|
2
|
+
const u = 8, h = (t, e) => Math.max(u, Math.min(t, e)), b = (t) => ["x", "y", "width", "height"].every((e) => Number.isFinite(t == null ? void 0 : t[e])) && Number(t == null ? void 0 : t.width) > 0 && Number(t == null ? void 0 : t.height) > 0, c = ({ anchor: t, size: e, isAbove: l }) => {
|
|
3
|
+
const i = g({ width: window.innerWidth, height: window.innerHeight }), d = () => {
|
|
4
|
+
i.value = { width: window.innerWidth, height: window.innerHeight };
|
|
5
|
+
}, v = x(() => {
|
|
6
|
+
const w = i.value.height - e.value.height - u, r = i.value.width - e.value.width - u, n = t.value, o = b(n), m = o ? n.x : (i.value.width - e.value.width) / 2, s = { left: `${h(m, r)}px` };
|
|
7
|
+
if (o && l.value)
|
|
8
|
+
return { bottom: `${h(i.value.height - n.y, w)}px`, ...s };
|
|
9
|
+
const p = o ? n.y + n.height : (i.value.height - e.value.height) / 2;
|
|
10
|
+
return { top: `${h(p, w)}px`, ...s };
|
|
11
|
+
});
|
|
12
|
+
return a(() => window.addEventListener("resize", d)), f(() => window.removeEventListener("resize", d)), { positionStyle: v };
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
c as useInfoBoxPosition
|
|
16
|
+
};
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useAmbiguousDynamicContent as
|
|
3
|
-
import { useBlocksConfig as
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { useCustomInterfaceAppearance as
|
|
6
|
-
import { useFullStoryBridge as
|
|
7
|
-
import { useModuleRepair as
|
|
8
|
-
import { useStripoEventHandler as
|
|
9
|
-
import { useStripoNotifications as
|
|
10
|
-
import { useToaster as
|
|
11
|
-
import { localePatch as
|
|
12
|
-
import { en as
|
|
13
|
-
import { ToasterTypeOptions as
|
|
14
|
-
import { useStripoApi as
|
|
15
|
-
import
|
|
16
|
-
import { useEditorStore as
|
|
17
|
-
import { buildMergeTagEntries as
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { useActionsApi as G } from "./useActionsApi.js";
|
|
2
|
+
import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
|
|
3
|
+
import { useBlocksConfig as X } from "./useBlocksConfig.js";
|
|
4
|
+
import { useConfig as J } from "./useConfig.js";
|
|
5
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
6
|
+
import { useFullStoryBridge as K } from "./useFullStoryBridge.js";
|
|
7
|
+
import { useModuleRepair as Q } from "./useModuleRepair.js";
|
|
8
|
+
import { useStripoEventHandler as W } from "./useStripoEventHandler.js";
|
|
9
|
+
import { useStripoNotifications as Y } from "./useStripoNotifications.js";
|
|
10
|
+
import { useToaster as Z } from "./useToaster.js";
|
|
11
|
+
import { localePatch as ee } from "../config/i18n/index.js";
|
|
12
|
+
import { en as F } from "../config/i18n/en/index.js";
|
|
13
|
+
import { ToasterTypeOptions as te } from "../enums/toaster.js";
|
|
14
|
+
import { useStripoApi as oe } from "../services/stripoApi.js";
|
|
15
|
+
import re from "../static/styles/customEditorStyle.css.js";
|
|
16
|
+
import { useEditorStore as A } from "../stores/editor.js";
|
|
17
|
+
import { buildSpecialLinkGroups as ie, buildMergeTagEntries as ne, flattenDynamicContentList as se } from "../utils/genericUtil.js";
|
|
18
|
+
import { listenForLinkTokenPaste as ae } from "../utils/linkTokenPaste.js";
|
|
19
|
+
import { getStripoRuntimeBaseUrl as de } from "../utils/stripoRuntime.js";
|
|
20
|
+
let d = null, P = !1;
|
|
21
|
+
const Pe = (t) => {
|
|
22
|
+
const { features: p, template: u, isFeatureEnabled: c } = J(), { handleError: f, showToaster: L } = Z(), { getToken: R, getCustomFonts: D, getSyncModulesStatus: U } = oe(), { handleEvent: V } = W(), { handleModuleAdd: I } = Q(), { restorePending: q } = $(), { getStripoBlocksConfig: x } = X(), { getStripoNotifications: O } = Y(), g = () => d || (d = new Promise((n, s) => {
|
|
22
23
|
if (document.getElementById("UiEditorScript")) {
|
|
23
24
|
n();
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
const i =
|
|
27
|
+
const i = de();
|
|
27
28
|
if (!i) {
|
|
28
29
|
s(
|
|
29
30
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
@@ -32,38 +33,39 @@ const ve = (t) => {
|
|
|
32
33
|
}
|
|
33
34
|
const a = `${i}UIEditor.js`, e = document.createElement("script");
|
|
34
35
|
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
35
|
-
|
|
36
|
+
P = !0, n();
|
|
36
37
|
}, e.onerror = () => {
|
|
37
38
|
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
38
39
|
}, document.body.appendChild(e);
|
|
39
40
|
}), d.catch(() => {
|
|
40
41
|
d = null;
|
|
41
|
-
}), d),
|
|
42
|
-
var w,
|
|
43
|
-
const o =
|
|
42
|
+
}), d), H = async (n, s, i, a = [], e = !1, m = !1) => {
|
|
43
|
+
var w, b, _, v, T;
|
|
44
|
+
const o = A(), { html: S, css: y } = n, { baseBlocks: E, extensions: M } = await x();
|
|
44
45
|
t.mark("blocks_config_ready");
|
|
45
|
-
const
|
|
46
|
-
t.setTemplate({ html: S, css: y, forceRecreate:
|
|
46
|
+
const C = ((w = p.value) == null ? void 0 : w.displayConditions) ?? !0, N = ((b = p.value) == null ? void 0 : b.modulesDisabled) ?? !1, h = c("dynamicContentSpecialLinks") ? ie((_ = u.value) == null ? void 0 : _.dynamicContentList, c("liquidSyntax")) : [], k = m || (((v = u.value) == null ? void 0 : v.forceRecreate) ?? !1), j = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
47
|
+
t.setTemplate({ html: S, css: y, forceRecreate: k }), B().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
|
|
47
48
|
document.querySelector("#guido-editor"),
|
|
48
49
|
{
|
|
49
50
|
metadata: s,
|
|
50
51
|
html: S,
|
|
51
52
|
css: y,
|
|
52
|
-
forceRecreate:
|
|
53
|
+
forceRecreate: k,
|
|
53
54
|
locale: "en",
|
|
54
55
|
undoButtonSelector: "#guido__undo-button",
|
|
55
56
|
redoButtonSelector: "#guido__redo-button",
|
|
56
57
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
57
58
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
58
59
|
codeEditorButtonSelector: "#guido__code-button",
|
|
59
|
-
customAppearanceMergetags: !
|
|
60
|
+
customAppearanceMergetags: !c("liquidSyntax"),
|
|
60
61
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
61
62
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
...h.length > 0 ? { specialLinks: h } : {},
|
|
64
|
+
customViewStyles: re,
|
|
65
|
+
conditionsEnabled: C,
|
|
66
|
+
customConditionsEnabled: C,
|
|
65
67
|
enableXSSSecurity: !0,
|
|
66
|
-
modulesDisabled:
|
|
68
|
+
modulesDisabled: N,
|
|
67
69
|
syncModulesEnabled: e,
|
|
68
70
|
messageSettingsEnabled: !0,
|
|
69
71
|
displayGmailAnnotations: !0,
|
|
@@ -74,7 +76,7 @@ const ve = (t) => {
|
|
|
74
76
|
copyPasteEnabled: !1,
|
|
75
77
|
selectElementAfterDrop: !0,
|
|
76
78
|
sameFontSizeForOutlook: !0,
|
|
77
|
-
allowedScriptSourceDomains:
|
|
79
|
+
allowedScriptSourceDomains: j,
|
|
78
80
|
...E ? { baseBlocks: E } : {},
|
|
79
81
|
editorFonts: {
|
|
80
82
|
showDefaultStandardFonts: !0,
|
|
@@ -83,17 +85,17 @@ const ve = (t) => {
|
|
|
83
85
|
},
|
|
84
86
|
mergeTags: [
|
|
85
87
|
{
|
|
86
|
-
entries:
|
|
88
|
+
entries: ne(
|
|
87
89
|
i.preselectedDynamicContentList,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
se((T = u.value) == null ? void 0 : T.dynamicContentList),
|
|
91
|
+
c("liquidSyntax")
|
|
90
92
|
)
|
|
91
93
|
}
|
|
92
94
|
],
|
|
93
95
|
async onTokenRefreshRequest(r) {
|
|
94
96
|
try {
|
|
95
97
|
t.mark("token_start");
|
|
96
|
-
const l = await
|
|
98
|
+
const l = await R();
|
|
97
99
|
t.mark("token_end"), r(l);
|
|
98
100
|
} catch (l) {
|
|
99
101
|
f(l, "Failed to refresh token");
|
|
@@ -101,8 +103,8 @@ const ve = (t) => {
|
|
|
101
103
|
},
|
|
102
104
|
onTemplateLoaded() {
|
|
103
105
|
try {
|
|
104
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } =
|
|
105
|
-
|
|
106
|
+
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = G(), { injectFullStory: z } = K();
|
|
107
|
+
B().importCss(), r(), z(), ae(), q(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
106
108
|
o.hasChanges = !1;
|
|
107
109
|
}, 1e3), t.markReady();
|
|
108
110
|
} catch (r) {
|
|
@@ -121,9 +123,9 @@ const ve = (t) => {
|
|
|
121
123
|
onDataChanged() {
|
|
122
124
|
o.hasChanges = !0, o.changeSeq += 1;
|
|
123
125
|
},
|
|
124
|
-
onEvent:
|
|
125
|
-
onModuleAdd:
|
|
126
|
-
notifications:
|
|
126
|
+
onEvent: V,
|
|
127
|
+
onModuleAdd: I,
|
|
128
|
+
notifications: O(),
|
|
127
129
|
// Stripo deselects the block on any click outside the canvas, so every surface
|
|
128
130
|
// that belongs to the block's own flow has to be listed here (SD-153273).
|
|
129
131
|
ignoreClickOutsideSelectors: [
|
|
@@ -133,26 +135,26 @@ const ve = (t) => {
|
|
|
133
135
|
".in-modal-v2-wrapper",
|
|
134
136
|
".in-toasts-wrapper"
|
|
135
137
|
],
|
|
136
|
-
extensions:
|
|
137
|
-
localePatch:
|
|
138
|
+
extensions: M,
|
|
139
|
+
localePatch: ee
|
|
138
140
|
}
|
|
139
141
|
);
|
|
140
142
|
};
|
|
141
143
|
return { initPlugin: async (n, s, i, a = !1) => {
|
|
142
|
-
const e =
|
|
144
|
+
const e = A();
|
|
143
145
|
try {
|
|
144
|
-
t.mark("plugin_start"), t.setScriptPreloaded(
|
|
145
|
-
const [
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
t.mark("plugin_start"), t.setScriptPreloaded(P), await g(), t.mark("script_ready");
|
|
147
|
+
const [m, o] = await Promise.all([
|
|
148
|
+
D(),
|
|
149
|
+
U()
|
|
148
150
|
]);
|
|
149
|
-
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await
|
|
151
|
+
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await H(n, s, i, m, o, a);
|
|
150
152
|
} catch {
|
|
151
|
-
e.loadingStatus = !1,
|
|
152
|
-
type:
|
|
153
|
-
message:
|
|
153
|
+
e.loadingStatus = !1, L({
|
|
154
|
+
type: te.Error,
|
|
155
|
+
message: F["An error has occurred. Please report the error code to support."],
|
|
154
156
|
actionButton: {
|
|
155
|
-
text:
|
|
157
|
+
text: F["Reload page"],
|
|
156
158
|
onClick: () => window.location.reload()
|
|
157
159
|
}
|
|
158
160
|
}), t.markFailed();
|
|
@@ -163,5 +165,5 @@ const ve = (t) => {
|
|
|
163
165
|
} };
|
|
164
166
|
};
|
|
165
167
|
export {
|
|
166
|
-
|
|
168
|
+
Pe as useStripo
|
|
167
169
|
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { COUPON_PLACEHOLDER_LIQUID as
|
|
2
|
-
|
|
1
|
+
import { COUPON_PLACEHOLDER_LIQUID as i, COUPON_PLACEHOLDER_DEFAULT as o } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
2
|
+
import { singleQuoteLiquidLinks as r } from "../../utils/liquidLinkQuotes.js";
|
|
3
|
+
const s = [
|
|
3
4
|
{
|
|
4
5
|
id: "liquid-coupon-code",
|
|
5
6
|
description: "Replace legacy coupon placeholder with liquid syntax",
|
|
6
7
|
type: "replace",
|
|
7
|
-
search:
|
|
8
|
-
replacement:
|
|
8
|
+
search: o,
|
|
9
|
+
replacement: i,
|
|
9
10
|
replaceAll: !0,
|
|
10
11
|
priority: 50
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "liquid-single-quote-links",
|
|
15
|
+
description: "Replace " string literals with single quotes inside {{ }} tags of href and src values",
|
|
16
|
+
type: "custom",
|
|
17
|
+
processor: (e) => r(e),
|
|
18
|
+
priority: 60
|
|
11
19
|
}
|
|
12
20
|
];
|
|
13
21
|
export {
|
|
14
|
-
|
|
22
|
+
s as liquidCompilerRules
|
|
15
23
|
};
|