@useinsider/guido 3.24.0-beta.2a3ba08 → 3.24.0-beta.2ad6e30
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 +7 -2
- package/dist/@types/config/schemas.js +16 -16
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +77 -79
- package/dist/composables/useHtmlCompiler.js +2 -0
- package/dist/composables/useModuleRepair.js +12 -14
- package/dist/composables/useSave.js +57 -52
- package/dist/composables/useSaveValidation.js +118 -110
- package/dist/composables/useStripo.js +70 -70
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +48 -33
- package/dist/config/compiler/htmlCompilerRules.js +14 -6
- package/dist/config/migrator/index.js +15 -16
- package/dist/enums/save-validation.js +1 -1
- package/dist/extensions/Blocks/Items/block.js +77 -115
- package/dist/extensions/Blocks/Items/constants/currency.js +14 -59
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +22 -33
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +51 -62
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +17 -18
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +31 -42
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +120 -141
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +1 -1
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/items.css.js +0 -19
- package/dist/extensions/Blocks/Items/settingsPanel.js +25 -34
- package/dist/extensions/Blocks/Items/template.js +212 -250
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -1
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useSaveValidation.d.ts +1 -1
- package/dist/src/composables/useStripo.d.ts +1 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +4 -0
- package/dist/src/config/migrator/index.d.ts +1 -4
- package/dist/src/enums/save-validation.d.ts +2 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -6
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +0 -32
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/template.d.ts +1 -4
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -12
- package/dist/src/stores/config.d.ts +20 -20
- package/dist/src/utils/itemsCurrencyRepair.d.ts +1 -5
- package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
- package/dist/utils/itemsCurrencyRepair.js +24 -29
- package/dist/utils/pairProductVariables.js +99 -119
- package/dist/utils/trimHrefWhitespace.js +10 -0
- package/package.json +1 -1
- package/dist/config/migrator/itemsPriceFormatMigrator.js +0 -20
- package/dist/extensions/Blocks/Items/controls/priceFormat.js +0 -145
- package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +0 -185
- package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +0 -23
- package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +0 -61
package/README.md
CHANGED
|
@@ -124,7 +124,12 @@ const config: GuidoConfigInput = {
|
|
|
124
124
|
// host-side). Omit it and the repair is a silent no-op. Default: {}.
|
|
125
125
|
dynamicContentList?: DynamicContentList,
|
|
126
126
|
selectedUnsubscribePages?: number[],
|
|
127
|
-
|
|
127
|
+
// Default: false. Stripo opens its stored copy for the templateId unless this is true;
|
|
128
|
+
// Guido sets it itself when a load-time migration rewrote the html. Set it to true
|
|
129
|
+
// whenever the host changed html under an existing templateId outside the editor.
|
|
130
|
+
// Behaviour change: releases up to v3.23.0 forced a recreate for any non-empty html and
|
|
131
|
+
// ignored this option, so a host that sends `false` now gets Stripo's stored copy.
|
|
132
|
+
forceRecreate?: boolean,
|
|
128
133
|
migration?: {
|
|
129
134
|
// Legacy block configs keyed by block ID. Consumed once by the migrator
|
|
130
135
|
// when upgrading templates authored with v1 block formats. See the
|
|
@@ -167,7 +172,7 @@ const config: GuidoConfigInput = {
|
|
|
167
172
|
allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
|
|
168
173
|
reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
|
|
169
174
|
accessibilityTesting?: boolean, // Default: false - Show the Accessibility Test entry in the header kebab menu (Stripo's checker: contrast, image alternatives, colour-vision simulation) and the tab-bar onboarding tour that points at it.
|
|
170
|
-
|
|
175
|
+
blockUnsubscribeLinks?: boolean, // Default: false - Warn on save when the design carries an Insider unsubscribe link or code ({{ins-*-unsubscribe-link}}, <%asm_*_raw_url%>, <%unsub%>): the legacy save is rejected with a warning toaster; with the validation drawer on it is a warning row that "Save and Continue" can skip. Launch blocking is up to the host. Set true for accounts whose unsubscribes are managed outside Insider (SFMC).
|
|
171
176
|
},
|
|
172
177
|
|
|
173
178
|
// Optional: Callbacks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
|
|
2
|
-
import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as
|
|
3
|
-
const
|
|
2
|
+
import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as p, custom as k, boolean as o, array as c, transform as y, unknown as r, record as g, fallback as R, literal as u, looseObject as C, variant as T, union as h, lazy as I } from "../../node_modules/valibot/dist/index.js";
|
|
3
|
+
const b = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
6
6
|
/** Transactional/system emails */
|
|
@@ -16,12 +16,12 @@ const p = {
|
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
17
|
templateId: i(
|
|
18
18
|
t(),
|
|
19
|
-
|
|
19
|
+
p(1, "templateId is required")
|
|
20
20
|
),
|
|
21
21
|
/** Unique identifier for the user editing the template */
|
|
22
22
|
userId: i(
|
|
23
23
|
t(),
|
|
24
|
-
|
|
24
|
+
p(1, "userId is required")
|
|
25
25
|
),
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t()),
|
|
@@ -42,7 +42,7 @@ const p = {
|
|
|
42
42
|
/** Partner/organization name (required) */
|
|
43
43
|
name: i(
|
|
44
44
|
t(),
|
|
45
|
-
|
|
45
|
+
p(1, "partner.name is required")
|
|
46
46
|
),
|
|
47
47
|
/** Product type identifier */
|
|
48
48
|
productType: e(
|
|
@@ -55,8 +55,8 @@ const p = {
|
|
|
55
55
|
),
|
|
56
56
|
/** Message type (promotional or transactional) */
|
|
57
57
|
messageType: e(
|
|
58
|
-
m([
|
|
59
|
-
|
|
58
|
+
m([b.PROMOTIONAL, b.TRANSACTIONAL]),
|
|
59
|
+
b.PROMOTIONAL
|
|
60
60
|
),
|
|
61
61
|
/** Display name for the current user */
|
|
62
62
|
username: e(t(), "Guido User"),
|
|
@@ -84,10 +84,10 @@ const p = {
|
|
|
84
84
|
children: e(c(f)),
|
|
85
85
|
// eslint-disable-next-line camelcase -- backend field name
|
|
86
86
|
select_items: e(c(f))
|
|
87
|
-
})),
|
|
87
|
+
})), N = g(
|
|
88
88
|
t(),
|
|
89
89
|
R(c(f), [])
|
|
90
|
-
),
|
|
90
|
+
), P = C({
|
|
91
91
|
/** Block ID (matches the dictionary key and the legacy HTML element id) */
|
|
92
92
|
id: e(s()),
|
|
93
93
|
/** Decimal places for price display (legacy data may use string or number) */
|
|
@@ -140,7 +140,7 @@ const p = {
|
|
|
140
140
|
* strategy, currency, locale, and layout data.
|
|
141
141
|
*/
|
|
142
142
|
recommendationConfigs: e(
|
|
143
|
-
g(t(),
|
|
143
|
+
g(t(), P),
|
|
144
144
|
{}
|
|
145
145
|
)
|
|
146
146
|
}), x = a({
|
|
@@ -159,7 +159,7 @@ const p = {
|
|
|
159
159
|
* (first) partner's leaf attributes into the label→token map that repairs
|
|
160
160
|
* label-form placeholders (`{{ Phone Number }}`) in dropped saved modules.
|
|
161
161
|
*/
|
|
162
|
-
dynamicContentList: e(
|
|
162
|
+
dynamicContentList: e(N, {}),
|
|
163
163
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
164
164
|
customFieldAttributes: e(c(t()), []),
|
|
165
165
|
/** Selected unsubscribe page IDs */
|
|
@@ -245,8 +245,8 @@ const p = {
|
|
|
245
245
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
246
246
|
allowSaveWithErrors: e(o(), !0),
|
|
247
247
|
reusableRecommendationStrategy: e(o(), !1),
|
|
248
|
-
/**
|
|
249
|
-
|
|
248
|
+
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
249
|
+
blockUnsubscribeLinks: e(o(), !1)
|
|
250
250
|
}), w = m([
|
|
251
251
|
"amp-accordion",
|
|
252
252
|
"amp-carousel",
|
|
@@ -369,7 +369,7 @@ export {
|
|
|
369
369
|
B as CustomBlockTypeSchema,
|
|
370
370
|
G as CustomRuleSchema,
|
|
371
371
|
w as DefaultBlockTypeSchema,
|
|
372
|
-
|
|
372
|
+
N as DynamicContentListSchema,
|
|
373
373
|
f as DynamicContentNodeSchema,
|
|
374
374
|
M as DynamicContentSchema,
|
|
375
375
|
O as EditorSchema,
|
|
@@ -378,8 +378,8 @@ export {
|
|
|
378
378
|
U as FeaturesSchema,
|
|
379
379
|
K as GuidoConfigSchema,
|
|
380
380
|
A as IdentitySchema,
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
P as LegacyRecommendationConfigSchema,
|
|
382
|
+
b as MessageType,
|
|
383
383
|
E as PartnerSchema,
|
|
384
384
|
l as ProductType,
|
|
385
385
|
_ as RegexRuleSchema,
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
1
|
+
import { defineComponent as le, defineAsyncComponent as l, ref as W, computed as f, watch as G, onMounted as ue, onUnmounted as pe } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as fe } from "../composables/useCortexBlueprintBridge.js";
|
|
3
3
|
import { useEditorLock as ye } from "../composables/useEditorLock.js";
|
|
4
|
-
import { startEditorOpenMetrics as
|
|
5
|
-
import { provideGuidoActions as
|
|
4
|
+
import { startEditorOpenMetrics as ge } from "../composables/useEditorOpenMetrics.js";
|
|
5
|
+
import { provideGuidoActions as ve } from "../composables/useGuidoActions.js";
|
|
6
6
|
import { useGuidoStateBridge as Se } from "../composables/useGuidoStateBridge.js";
|
|
7
|
-
import { usePartner as
|
|
8
|
-
import { useSaveValidationRollout as
|
|
9
|
-
import { useStripo as
|
|
10
|
-
import { useTimerClone as
|
|
11
|
-
import { useToaster as
|
|
12
|
-
import { useTranslations as
|
|
13
|
-
import { migrate as
|
|
7
|
+
import { usePartner as be } from "../composables/usePartner.js";
|
|
8
|
+
import { useSaveValidationRollout as he } from "../composables/useSaveValidationRollout.js";
|
|
9
|
+
import { useStripo as Ee } from "../composables/useStripo.js";
|
|
10
|
+
import { useTimerClone as we } from "../composables/useTimerClone.js";
|
|
11
|
+
import { useToaster as Te } from "../composables/useToaster.js";
|
|
12
|
+
import { useTranslations as ke } from "../composables/useTranslations.js";
|
|
13
|
+
import { migrate as Ce } from "../config/migrator/index.js";
|
|
14
14
|
import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
|
|
15
|
-
import { RIBBON_SELECTOR as
|
|
15
|
+
import { RIBBON_SELECTOR as De } from "../enums/onboarding.js";
|
|
16
16
|
import { ToasterTypeOptions as Ie } from "../enums/toaster.js";
|
|
17
|
-
import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as
|
|
18
|
-
import { disposeUnsubscribeListeners as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
17
|
+
import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as Fe } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
18
|
+
import { disposeUnsubscribeListeners as Me } from "../extensions/Blocks/Unsubscribe/block.js";
|
|
19
|
+
import Re from "./organisms/AutoSaveController.vue.js";
|
|
20
|
+
import Le from "./organisms/base/AuthErrorModal.vue.js";
|
|
21
|
+
import Oe from "./organisms/base/Toaster.vue.js";
|
|
22
|
+
import Ue from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
23
|
+
import Ne from "./organisms/header/HeaderWrapper.vue.js";
|
|
24
|
+
import _e from "./organisms/LoadingWrapper.vue.js";
|
|
25
|
+
import Ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
26
26
|
import Be from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
27
|
-
import
|
|
28
|
-
import { useStripoApi as
|
|
29
|
-
import { useConfigStore as
|
|
30
|
-
import { useDynamicContentStore as
|
|
27
|
+
import Pe from "./organisms/validation/ValidationErrorDrawer.vue.js";
|
|
28
|
+
import { useStripoApi as xe } from "../services/stripoApi.js";
|
|
29
|
+
import { useConfigStore as He } from "../stores/config.js";
|
|
30
|
+
import { useDynamicContentStore as Ve } from "../stores/dynamic-content.js";
|
|
31
31
|
import { useEditorStore as w } from "../stores/editor.js";
|
|
32
|
-
import { usePreviewStore as
|
|
33
|
-
import { useSaveValidationStore as
|
|
34
|
-
import { useTemplateStore as
|
|
35
|
-
import { useUnsubscribeStore as
|
|
32
|
+
import { usePreviewStore as We } from "../stores/preview.js";
|
|
33
|
+
import { useSaveValidationStore as Ge } from "../stores/save-validation.js";
|
|
34
|
+
import { useTemplateStore as $e } from "../stores/template.js";
|
|
35
|
+
import { useUnsubscribeStore as ze } from "../stores/unsubscribe.js";
|
|
36
36
|
import { readTrackFloor as q } from "../utils/linkTrackingIds.js";
|
|
37
|
-
const
|
|
37
|
+
const Ft = /* @__PURE__ */ le({
|
|
38
38
|
__name: "Guido",
|
|
39
39
|
props: {
|
|
40
40
|
config: null,
|
|
41
41
|
ready: { type: Boolean, default: !0 }
|
|
42
42
|
},
|
|
43
43
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
44
|
-
setup(K, { expose: j, emit:
|
|
45
|
-
const a = K, n =
|
|
44
|
+
setup(K, { expose: j, emit: s }) {
|
|
45
|
+
const a = K, n = ge(), J = l(
|
|
46
46
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
47
47
|
), Q = l(
|
|
48
48
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
@@ -52,14 +52,14 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
52
52
|
() => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
|
|
53
53
|
), T = W(), Z = l(
|
|
54
54
|
() => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
|
|
55
|
-
),
|
|
55
|
+
), y = W(), g = Ve(), k = ze(), o = He();
|
|
56
56
|
a.ready && o.init(a.config);
|
|
57
|
-
const c = w(), ee =
|
|
57
|
+
const c = w(), ee = We(), u = f(() => c.hasChanges), { isTestPartner: te } = be(), { isEnabled: oe, loadRollout: C } = he(), { showToaster: D } = Te(), I = ke(), F = () => {
|
|
58
58
|
var t;
|
|
59
59
|
if (c.isVersionHistoryOpen) {
|
|
60
60
|
console.debug("guido:save:silent:blocked", { isVersionHistoryOpen: !0 }), D({
|
|
61
61
|
type: Ie.Warning,
|
|
62
|
-
message:
|
|
62
|
+
message: I("email-editor.save-blocked-outside-editor")
|
|
63
63
|
});
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
67
67
|
}, M = (t) => {
|
|
68
68
|
c.loadingStatus = t;
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
fe(), Se();
|
|
71
71
|
const v = () => {
|
|
72
72
|
var t, e;
|
|
73
73
|
return {
|
|
@@ -78,46 +78,46 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
78
78
|
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || $.SAVED_MODULES,
|
|
79
79
|
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || $.DEFAULT_MODULES
|
|
80
80
|
};
|
|
81
|
-
}, { initPlugin: R, preloadRuntime: L } =
|
|
81
|
+
}, { initPlugin: R, preloadRuntime: L } = Ee(n), { runExclusive: O, beginMount: U, isCurrentMount: S } = ye();
|
|
82
82
|
let p = 0;
|
|
83
|
-
const { getDefaultTemplate: N } =
|
|
83
|
+
const { getDefaultTemplate: N } = xe(), { cloneTimersOnSave: _, hasTimerBlocks: A } = we(), re = f(() => {
|
|
84
84
|
var t;
|
|
85
85
|
return !((t = o.ui) != null && t.showHeader);
|
|
86
|
-
}), ne = f(() => o.isFeatureEnabled("reusableRecommendationStrategy")),
|
|
86
|
+
}), ne = f(() => o.isFeatureEnabled("reusableRecommendationStrategy")), se = f(
|
|
87
87
|
() => !!z().recommendationConfigs.strategyId
|
|
88
88
|
);
|
|
89
|
-
|
|
89
|
+
ve({
|
|
90
90
|
onBack: () => {
|
|
91
|
-
console.debug("guido:back"),
|
|
91
|
+
console.debug("guido:back"), s("back");
|
|
92
92
|
},
|
|
93
93
|
onSaveStart: () => {
|
|
94
|
-
console.debug("guido:save:start"),
|
|
94
|
+
console.debug("guido:save:start"), s("save:start");
|
|
95
95
|
},
|
|
96
96
|
onSaveComplete: (t) => {
|
|
97
97
|
const e = { ...t, metadata: v() };
|
|
98
|
-
console.debug("guido:save:complete", e),
|
|
98
|
+
console.debug("guido:save:complete", e), s("save:complete", e);
|
|
99
99
|
},
|
|
100
100
|
onTestEmailClick: () => {
|
|
101
|
-
console.debug("guido:test-email:click"),
|
|
101
|
+
console.debug("guido:test-email:click"), s("test-email:click");
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
|
-
const
|
|
105
|
-
console.debug("dynamic-content:close", t),
|
|
106
|
-
},
|
|
104
|
+
const B = (t) => {
|
|
105
|
+
console.debug("dynamic-content:close", t), g.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
106
|
+
}, P = () => {
|
|
107
107
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
108
108
|
};
|
|
109
109
|
G(() => u.value, () => {
|
|
110
|
-
|
|
110
|
+
s("on-change", u.value);
|
|
111
111
|
});
|
|
112
|
-
const
|
|
113
|
-
const e = t, { attribute:
|
|
114
|
-
console.debug("dynamic-content:open", e.detail),
|
|
112
|
+
const b = (t) => {
|
|
113
|
+
const e = t, { attribute: i, position: m } = e.detail;
|
|
114
|
+
console.debug("dynamic-content:open", e.detail), s("dynamic-content:open", i, m);
|
|
115
115
|
};
|
|
116
116
|
let d = null;
|
|
117
117
|
const h = () => {
|
|
118
118
|
var e;
|
|
119
|
-
const t = document.querySelector(
|
|
120
|
-
(e =
|
|
119
|
+
const t = document.querySelector(De);
|
|
120
|
+
(e = y.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
121
121
|
}, E = async () => {
|
|
122
122
|
var t;
|
|
123
123
|
n.mark("host_ready");
|
|
@@ -128,50 +128,48 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
128
128
|
templateId: o.templateId,
|
|
129
129
|
variationId: o.variationId
|
|
130
130
|
});
|
|
131
|
-
const e = o.template,
|
|
131
|
+
const e = o.template, i = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", x = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
132
132
|
k.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
133
|
-
const
|
|
133
|
+
const ie = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, H = o.isFeatureEnabled("linkTrackingIds"), ae = {
|
|
134
134
|
partnerName: o.partnerName,
|
|
135
135
|
campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
|
|
136
136
|
rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
|
|
137
|
-
},
|
|
138
|
-
itemsPriceFormatting: o.isFeatureEnabled("itemsPriceFormatting")
|
|
139
|
-
}, V = (le) => n.timed(
|
|
137
|
+
}, V = (me) => n.timed(
|
|
140
138
|
"migration",
|
|
141
|
-
() =>
|
|
139
|
+
() => Ce(me, ie, ae)
|
|
142
140
|
);
|
|
143
141
|
let r = {
|
|
144
|
-
html:
|
|
142
|
+
html: i && await V(i),
|
|
145
143
|
css: m
|
|
146
144
|
};
|
|
147
145
|
r.html || (r = await n.timed("default_template", () => N()), r.html = await V(r.html));
|
|
148
|
-
const
|
|
149
|
-
A(r.html) && (r.html = await n.timed("timer_clone", () => _(r.html))), H && (c.trackIdSessionFloor = Math.max(
|
|
150
|
-
const
|
|
146
|
+
const ce = H ? q(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
147
|
+
A(r.html) && (r.html = await n.timed("timer_clone", () => _(r.html))), H && (c.trackIdSessionFloor = Math.max(ce, q(r.html)));
|
|
148
|
+
const de = {
|
|
151
149
|
preselectedDynamicContentList: x,
|
|
152
150
|
onReady: () => {
|
|
153
|
-
console.debug("guido:ready"),
|
|
151
|
+
console.debug("guido:ready"), s("ready");
|
|
154
152
|
}
|
|
155
153
|
};
|
|
156
|
-
p = U(), await R(r, v(),
|
|
154
|
+
p = U(), await R(r, v(), de, r.html !== i), g.selectedDynamicContentList = x;
|
|
157
155
|
} catch (e) {
|
|
158
156
|
console.error("Failed to initialize Stripo editor:", e), n.markFailed();
|
|
159
157
|
}
|
|
160
158
|
};
|
|
161
|
-
return
|
|
159
|
+
return ue(async () => {
|
|
162
160
|
var e;
|
|
163
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), w().$reset(),
|
|
164
|
-
const t = (e =
|
|
161
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), w().$reset(), $e().$reset(), Ge().$reset(), C(), h();
|
|
162
|
+
const t = (e = y.value) == null ? void 0 : e.parentElement;
|
|
165
163
|
if (t && (d = new ResizeObserver(h), d.observe(t)), L(), a.ready)
|
|
166
164
|
await E();
|
|
167
165
|
else {
|
|
168
|
-
const
|
|
169
|
-
m && (
|
|
166
|
+
const i = G(() => a.ready, (m) => {
|
|
167
|
+
m && (i(), E());
|
|
170
168
|
});
|
|
171
169
|
}
|
|
172
|
-
document.addEventListener("dynamic-content:open",
|
|
173
|
-
}),
|
|
174
|
-
if (
|
|
170
|
+
document.addEventListener("dynamic-content:open", b);
|
|
171
|
+
}), pe(() => {
|
|
172
|
+
if (Me(), Fe(), n.dispose(), d == null || d.disconnect(), document.removeEventListener("dynamic-content:open", b), S(p))
|
|
175
173
|
try {
|
|
176
174
|
const t = w();
|
|
177
175
|
t.isStripoInitialized = !1, t.isAccessibilityTestingOpen = !1, t.imagesHidden = !1, t.colorVisionDeficiency = "";
|
|
@@ -179,7 +177,7 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
179
177
|
console.debug("Failed to close the editor readiness gate on unmount", t);
|
|
180
178
|
}
|
|
181
179
|
O(async () => {
|
|
182
|
-
if (
|
|
180
|
+
if (S(p))
|
|
183
181
|
try {
|
|
184
182
|
window.UIEditor.removeEditor();
|
|
185
183
|
} catch {
|
|
@@ -188,15 +186,15 @@ const Mt = /* @__PURE__ */ ue({
|
|
|
188
186
|
}), o.reset();
|
|
189
187
|
}), j({
|
|
190
188
|
dynamicContent: {
|
|
191
|
-
insert:
|
|
192
|
-
close:
|
|
189
|
+
insert: B,
|
|
190
|
+
close: P
|
|
193
191
|
},
|
|
194
192
|
hasChanges: u,
|
|
195
|
-
saveSilent:
|
|
193
|
+
saveSilent: F,
|
|
196
194
|
setLoading: M
|
|
197
|
-
}), { __sfc: !0, openMetrics: n, PreviewContainer: J, OnboardingWrapper: Q, AssignStrategyDrawer: X, RemoveStrategyModal: Y, autoSaveControllerRef: T, LegacyStrategyUpdatedModal: Z, wrapperRef:
|
|
195
|
+
}), { __sfc: !0, openMetrics: n, PreviewContainer: J, OnboardingWrapper: Q, AssignStrategyDrawer: X, RemoveStrategyModal: Y, autoSaveControllerRef: T, LegacyStrategyUpdatedModal: Z, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: k, props: a, configStore: o, editorStore: c, previewStore: ee, hasChanges: u, isTestPartner: te, isSaveValidationEnabled: oe, loadRollout: C, showToaster: D, trans: I, saveSilent: F, setLoading: M, emit: s, buildMetadata: v, initPlugin: R, preloadRuntime: L, runExclusive: O, beginMount: U, isCurrentMount: S, mountGeneration: p, getDefaultTemplate: N, cloneTimersOnSave: _, hasTimerBlocks: A, noHeader: re, isRrsEnabled: ne, hasAssignedStrategy: se, insertDynamicContent: B, closeDynamicContent: P, handleDynamicContentOpen: b, ribbonObserver: d, updateRibbonOffset: h, startEditor: E, AutoSaveController: Re, AuthErrorModal: Le, Toaster: Oe, FilterSelectionDrawer: Ue, HeaderWrapper: Ne, LoadingWrapper: _e, SaveAsTemplateDrawer: Ae, UnsubscribeWrapper: Be, ValidationErrorDrawer: Pe };
|
|
198
196
|
}
|
|
199
197
|
});
|
|
200
198
|
export {
|
|
201
|
-
|
|
199
|
+
Ft as default
|
|
202
200
|
};
|
|
@@ -16,6 +16,8 @@ const x = /* @__PURE__ */ new Set([
|
|
|
16
16
|
"fix-tags-end",
|
|
17
17
|
// Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
|
|
18
18
|
"strip-font-tags",
|
|
19
|
+
// Trim whitespace inside href values — attribute-value edit only, emits nothing new.
|
|
20
|
+
"trim-href-whitespace",
|
|
19
21
|
// Image domain corrections — plain string replacement.
|
|
20
22
|
"replace-old-image-domain",
|
|
21
23
|
"replace-old-v2-image-domain",
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
1
|
+
import { useConfig as C } from "./useConfig.js";
|
|
2
|
+
import { useToaster as T } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as g } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as D } from "../enums/toaster.js";
|
|
5
5
|
import { buildDynamicContentLookup as f, convertModuleDynamicContent as h } from "../utils/dynamicContentConverter.js";
|
|
6
6
|
import { flattenDynamicContentList as O } from "../utils/genericUtil.js";
|
|
7
7
|
import { repairItemsCurrencyAttributes as M } from "../utils/itemsCurrencyRepair.js";
|
|
8
|
-
const N = "dynamic-content.unresolved-attributes-on-drop",
|
|
9
|
-
const { template: p, isFeatureEnabled:
|
|
8
|
+
const N = "dynamic-content.unresolved-attributes-on-drop", R = () => {
|
|
9
|
+
const { template: p, isFeatureEnabled: m } = C(), { showToaster: a } = T(), y = g();
|
|
10
10
|
return { handleModuleAdd: (e, o) => {
|
|
11
|
-
var
|
|
11
|
+
var s, l, u;
|
|
12
12
|
try {
|
|
13
13
|
if ((e == null ? void 0 : e.action) !== "ADD" && (e == null ? void 0 : e.action) !== "COPY")
|
|
14
14
|
return;
|
|
15
|
-
const t = (
|
|
15
|
+
const t = (s = o == null ? void 0 : o.getTargetNode) == null ? void 0 : s.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
|
|
16
16
|
if (!t || typeof r != "string")
|
|
17
17
|
return;
|
|
18
|
-
let n = M(r
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
let m = [];
|
|
23
|
-
u.size > 0 && ({ html: n, unresolved: m } = h(n, u, s("liquidSyntax"))), n !== r && o.modifyHtml(t).replaceWith(n), m.length > 0 && a({
|
|
18
|
+
let n = M(r);
|
|
19
|
+
const c = f(O((u = p.value) == null ? void 0 : u.dynamicContentList));
|
|
20
|
+
let i = [];
|
|
21
|
+
c.size > 0 && ({ html: n, unresolved: i } = h(n, c, m("liquidSyntax"))), n !== r && o.modifyHtml(t).replaceWith(n), i.length > 0 && a({
|
|
24
22
|
type: D.Warning,
|
|
25
23
|
message: y(N)
|
|
26
24
|
});
|
|
@@ -31,5 +29,5 @@ const N = "dynamic-content.unresolved-attributes-on-drop", d = () => {
|
|
|
31
29
|
};
|
|
32
30
|
export {
|
|
33
31
|
N as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
34
|
-
|
|
32
|
+
R as useModuleRepair
|
|
35
33
|
};
|
|
@@ -1,91 +1,96 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
1
|
+
import { useActionsApi as O } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as F } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as I, useSaveComplete as N } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as j } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
|
|
8
8
|
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
9
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import { useHtmlDocumentCountValidator as
|
|
19
|
-
import { useLiquidValidator as
|
|
20
|
-
import { useSyncModuleBlockValidator as
|
|
10
|
+
import { useConfigStore as Q } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as X } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as Y } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Z, getHtmlReferencedUnsubscribePages as _ } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as $ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as tt } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as et } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as st } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as rt } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
21
|
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
22
|
const Pt = () => {
|
|
23
|
-
const n =
|
|
24
|
-
|
|
23
|
+
const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = st(), { validateCouponBlockTags: H } = ot(), {
|
|
24
|
+
validateUnsubscribeBlockUniqueness: E,
|
|
25
|
+
validateUnsubscribeBlockHasTemplate: g,
|
|
26
|
+
validateNoInsiderUnsubscribeCode: V
|
|
27
|
+
} = at(), { validateSyncModuleBlocks: l } = rt(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
|
|
28
|
+
if (!u("allowlistEnabled"))
|
|
25
29
|
return !1;
|
|
26
|
-
const o = await
|
|
30
|
+
const o = await B(t, e);
|
|
27
31
|
if (!o.length)
|
|
28
32
|
return !1;
|
|
29
33
|
if (!i) {
|
|
30
|
-
const s = await
|
|
31
|
-
s != null && s.message &&
|
|
34
|
+
const s = await T(o);
|
|
35
|
+
s != null && s.message && h({
|
|
32
36
|
type: J.Warning,
|
|
33
37
|
message: s.message,
|
|
34
38
|
actionButton: s.actionButton
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
return !0;
|
|
38
|
-
},
|
|
42
|
+
}, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
|
|
39
43
|
if (!await C())
|
|
40
44
|
return;
|
|
41
|
-
const { unsubscribePayload: o, stripoModules: s } =
|
|
42
|
-
if (await
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
+
const { unsubscribePayload: o, stripoModules: s } = x(t.rawHtml);
|
|
46
|
+
if (await k(o), t.modules = s, !e.suppress) {
|
|
47
|
+
const r = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
48
|
+
S({ ...t, ...r, silent: e.silent });
|
|
45
49
|
}
|
|
46
50
|
return t;
|
|
47
|
-
},
|
|
51
|
+
}, W = async (t, e) => {
|
|
48
52
|
var s;
|
|
49
53
|
n();
|
|
50
|
-
const i = await
|
|
54
|
+
const i = await m();
|
|
51
55
|
if (!c(i.html, e))
|
|
52
56
|
return;
|
|
53
57
|
const o = await p(i);
|
|
54
58
|
if (l(o.rawHtml, e)) {
|
|
55
59
|
if (P.value && !e) {
|
|
56
|
-
const
|
|
60
|
+
const r = await L(
|
|
57
61
|
o.compiledHtml,
|
|
58
|
-
o.dynamicContentList
|
|
62
|
+
o.dynamicContentList,
|
|
63
|
+
o.rawHtml
|
|
59
64
|
);
|
|
60
|
-
if (
|
|
61
|
-
|
|
65
|
+
if (r.length) {
|
|
66
|
+
U.open(r, "save");
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
|
-
} else if (!await
|
|
69
|
+
} else if (!await M(o, e))
|
|
65
70
|
return;
|
|
66
|
-
if (!((s =
|
|
67
|
-
return
|
|
71
|
+
if (!((s = a.value) != null && s.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
|
|
72
|
+
return v(o, { silent: e, suppress: t });
|
|
68
73
|
}
|
|
69
|
-
},
|
|
74
|
+
}, R = async () => {
|
|
70
75
|
var i;
|
|
71
|
-
if (!
|
|
76
|
+
if (!w.allowSaveWithErrors)
|
|
72
77
|
return;
|
|
73
78
|
n();
|
|
74
|
-
const t = await
|
|
79
|
+
const t = await m();
|
|
75
80
|
if (!c(t.html, !1))
|
|
76
81
|
return;
|
|
77
82
|
const e = await p(t);
|
|
78
|
-
if (l(e.rawHtml, !1) && !((i =
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
if (!
|
|
83
|
+
if (l(e.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(e)) && !await f(e.compiledHtml, e.css, !1))
|
|
84
|
+
return v(e, { silent: !1, blankCompiled: !0 });
|
|
85
|
+
}, q = async () => {
|
|
86
|
+
if (!w.allowSaveWithErrors)
|
|
82
87
|
return;
|
|
83
88
|
n();
|
|
84
|
-
const { html: t, css: e } = await
|
|
85
|
-
if (!c(t, !0) || !l(t, !0) || await
|
|
89
|
+
const { html: t, css: e } = await m();
|
|
90
|
+
if (!c(t, !0) || !l(t, !0) || await f(t, e, !0))
|
|
86
91
|
return;
|
|
87
|
-
const i =
|
|
88
|
-
dynamicContentList:
|
|
92
|
+
const i = _(t), o = {
|
|
93
|
+
dynamicContentList: A.getSelectedDynamicContentList,
|
|
89
94
|
compiledHtml: "",
|
|
90
95
|
rawHtml: t,
|
|
91
96
|
css: e,
|
|
@@ -99,11 +104,11 @@ const Pt = () => {
|
|
|
99
104
|
config: i
|
|
100
105
|
}
|
|
101
106
|
};
|
|
102
|
-
return
|
|
107
|
+
return v(o, { silent: !0 });
|
|
103
108
|
};
|
|
104
|
-
return { save: (t = !1, e = !1) =>
|
|
105
|
-
() =>
|
|
106
|
-
), saveWithErrors: () =>
|
|
109
|
+
return { save: (t = !1, e = !1) => d(
|
|
110
|
+
() => W(t, e)
|
|
111
|
+
), saveWithErrors: () => d(R), saveRawOnly: () => d(q) };
|
|
107
112
|
};
|
|
108
113
|
export {
|
|
109
114
|
Pt as useSave
|