@useinsider/guido 3.30.1 → 3.30.2-beta.08f1c78

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.
Files changed (31) hide show
  1. package/README.md +12 -1
  2. package/dist/components/Guido.vue.js +5 -5
  3. package/dist/components/Guido.vue2.js +115 -109
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +54 -48
  6. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
  7. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
  8. package/dist/composables/useModuleRepair.js +56 -50
  9. package/dist/composables/useStripo.js +87 -79
  10. package/dist/config/migrator/index.js +14 -13
  11. package/dist/config/migrator/recommendation/cssCascade.js +84 -0
  12. package/dist/config/migrator/recommendation/extractors.js +195 -89
  13. package/dist/config/migrator/recommendation/themeMapper.js +33 -21
  14. package/dist/config/migrator/recommendationMigrator.js +70 -63
  15. package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
  16. package/dist/enums/academy.js +2 -1
  17. package/dist/guido.css +1 -1
  18. package/dist/package.json.js +2 -2
  19. package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
  20. package/dist/src/composables/useModuleRepair.d.ts +1 -1
  21. package/dist/src/config/migrator/index.d.ts +1 -1
  22. package/dist/src/config/migrator/recommendation/cssCascade.d.ts +24 -0
  23. package/dist/src/config/migrator/recommendation/extractors.d.ts +18 -1
  24. package/dist/src/config/migrator/recommendationMigrator.d.ts +2 -1
  25. package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
  26. package/dist/src/enums/academy.d.ts +1 -0
  27. package/dist/src/stores/editor.d.ts +54 -0
  28. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
  29. package/dist/stores/editor.js +2 -0
  30. package/dist/utils/legacyUnsubscribeConversion.js +69 -28
  31. package/package.json +1 -1
@@ -0,0 +1,30 @@
1
+ import { defineComponent as n, computed as t } from "vue";
2
+ import i from "../../wrappers/WpModal.vue.js";
3
+ import { useTranslations as a } from "../../../composables/useTranslations.js";
4
+ import { ACADEMY_LINKS as c } from "../../../enums/academy.js";
5
+ import { useEditorStore as m } from "../../../stores/editor.js";
6
+ const S = /* @__PURE__ */ n({
7
+ __name: "SfmcUnsubscribeConvertedModal",
8
+ setup(p) {
9
+ const o = a(), e = m(), r = t(
10
+ () => e.isSfmcUnsubscribeModalRequested && e.isStripoInitialized
11
+ ), s = t(() => ({
12
+ secondaryButton: {
13
+ type: "subtle-primary",
14
+ labelText: o("email-editor.legacy-unsubscribe-converted-modal-visit-academy")
15
+ },
16
+ primaryButton: {
17
+ type: "primary",
18
+ labelText: o("action-builder.ok")
19
+ }
20
+ }));
21
+ return { __sfc: !0, trans: o, editorStore: e, isVisible: r, footerButtonOptions: s, close: () => {
22
+ e.isSfmcUnsubscribeModalRequested = !1;
23
+ }, openAcademy: () => {
24
+ window.open(c.SFMC_RELAY, "_blank", "noopener,noreferrer");
25
+ }, WpModal: i };
26
+ }
27
+ });
28
+ export {
29
+ S as default
30
+ };
@@ -1,75 +1,81 @@
1
- import { useConfig as h } from "./useConfig.js";
2
- import { useToaster as v } from "./useToaster.js";
3
- import { useTranslations as M } from "./useTranslations.js";
4
- import { ModuleDynamicContentAttribute as T } from "../enums/dynamic-content.js";
5
- import { ToasterTypeOptions as A } from "../enums/toaster.js";
6
- import { itemsBlockDynamicVariables as O } from "../extensions/Blocks/Items/enums/productEnums.js";
1
+ import { useConfig as M } from "./useConfig.js";
2
+ import { useToaster as A } from "./useToaster.js";
3
+ import { useTranslations as T } from "./useTranslations.js";
4
+ import { ModuleDynamicContentAttribute as U } from "../enums/dynamic-content.js";
5
+ import { ToasterTypeOptions as O } from "../enums/toaster.js";
6
+ import { itemsBlockDynamicVariables as S } from "../extensions/Blocks/Items/enums/productEnums.js";
7
7
  import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
8
- import { useEditorStore as L } from "../stores/editor.js";
9
- import { useModuleDynamicContentStore as U } from "../stores/module-dynamic-content.js";
10
- import { buildDynamicContentLookup as _, convertModuleDynamicContent as F } from "../utils/dynamicContentConverter.js";
11
- import { stripPendingMarker as P } from "../utils/dynamicContentPendingMarker.js";
12
- import { flattenDynamicContentCandidates as S } from "../utils/genericUtil.js";
13
- import { repairItemsCurrencyAttributes as N } from "../utils/itemsCurrencyRepair.js";
14
- import { convertLegacyUnsubscribeInModuleHtml as R } from "../utils/legacyUnsubscribeConversion.js";
15
- import { extractUsedDynamicContent as k } from "../utils/registerUsedDynamicContent.js";
16
- const q = "dynamic-content.unresolved-attributes-on-drop", H = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
- let y = 0;
18
- const $ = (s) => {
19
- y += 1;
20
- const o = `${Date.now().toString(36)}-${y}`;
21
- return { html: s.replace(H, `$1 ${T.Pending}="${o}"`), id: o };
22
- }, I = (s, o) => {
8
+ import { useEditorStore as f } from "../stores/editor.js";
9
+ import { useModuleDynamicContentStore as F } from "../stores/module-dynamic-content.js";
10
+ import { buildDynamicContentLookup as L, convertModuleDynamicContent as _ } from "../utils/dynamicContentConverter.js";
11
+ import { stripPendingMarker as k } from "../utils/dynamicContentPendingMarker.js";
12
+ import { flattenDynamicContentCandidates as q } from "../utils/genericUtil.js";
13
+ import { repairItemsCurrencyAttributes as P } from "../utils/itemsCurrencyRepair.js";
14
+ import { convertAllUnsubscribeInModuleHtml as R, convertLegacyUnsubscribeInModuleHtml as H } from "../utils/legacyUnsubscribeConversion.js";
15
+ import { extractUsedDynamicContent as N } from "../utils/registerUsedDynamicContent.js";
16
+ const I = "dynamic-content.unresolved-attributes-on-drop", $ = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
+ let C = 0;
18
+ const x = (s) => {
19
+ C += 1;
20
+ const n = `${Date.now().toString(36)}-${C}`;
21
+ return { html: s.replace($, `$1 ${U.Pending}="${n}"`), id: n };
22
+ }, z = (s, n) => {
23
23
  try {
24
- const i = k(s, o.map(({ text: a, value: m }) => ({ text: a, value: m })));
24
+ const i = N(s, n.map(({ text: m, value: l }) => ({ text: m, value: l })));
25
25
  i.length > 0 && E().registerDynamicContent(i);
26
26
  } catch (i) {
27
27
  console.error("Failed to register module dynamic content:", i);
28
28
  }
29
- }, re = () => {
30
- const { template: s, isFeatureEnabled: o } = h(), { showToaster: i } = v(), a = M(), m = (r) => {
29
+ }, oe = () => {
30
+ const { template: s, isFeatureEnabled: n } = M(), { showToaster: i } = A(), m = T(), l = (o) => {
31
31
  var u, e;
32
- const t = o("liquidSyntax") ? [] : S((u = s.value) == null ? void 0 : u.dynamicContentList), c = _(t);
33
- return c.size === 0 ? { html: r, unresolved: [], ambiguous: [], candidates: t } : {
34
- ...F(
35
- r,
32
+ const r = n("liquidSyntax") ? [] : q((u = s.value) == null ? void 0 : u.dynamicContentList), c = L(r);
33
+ return c.size === 0 ? { html: o, unresolved: [], ambiguous: [], candidates: r } : {
34
+ ..._(
35
+ o,
36
36
  c,
37
- [...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...O]
37
+ [...((e = s.value) == null ? void 0 : e.customFieldAttributes) ?? [], ...S]
38
38
  ),
39
- candidates: t
39
+ candidates: r
40
40
  };
41
41
  };
42
- return { handleModuleAdd: (r, t) => {
42
+ return { handleModuleAdd: (o, r) => {
43
43
  var c, u;
44
44
  try {
45
- if ((r == null ? void 0 : r.action) !== "ADD" && (r == null ? void 0 : r.action) !== "COPY")
45
+ if ((o == null ? void 0 : o.action) !== "ADD" && (o == null ? void 0 : o.action) !== "COPY")
46
46
  return;
47
- const e = (c = t == null ? void 0 : t.getTargetNode) == null ? void 0 : c.call(t), l = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
48
- if (!e || typeof l != "string")
47
+ const e = (c = r == null ? void 0 : r.getTargetNode) == null ? void 0 : c.call(r), a = (u = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : u.call(e);
48
+ if (!e || typeof a != "string")
49
49
  return;
50
- let n = P(N(l, {
51
- convertToPriceFormat: o("itemsPriceFormatting")
52
- })), p = !1;
53
- o("legacyUnsubscribeConversion") && ({ html: n, converted: p } = R(n));
54
- const { html: f, unresolved: b, ambiguous: g, candidates: C } = m(n);
50
+ let t = k(P(a, {
51
+ convertToPriceFormat: n("itemsPriceFormatting")
52
+ })), b = !1, y = !1;
53
+ n("blockUnsubscribeLinks") ? { html: t, converted: y } = R(t) : n("legacyUnsubscribeConversion") && ({ html: t, converted: b } = H(t));
54
+ const { html: D, unresolved: v, ambiguous: g, candidates: h } = l(t);
55
55
  let d = null;
56
- if (n = f, g.length > 0 && ({ html: n, id: d } = $(n)), n !== l && t.modifyHtml(e).replaceWith(n), I(n, C), p)
56
+ if (t = D, g.length > 0 && ({ html: t, id: d } = x(t)), t !== a && r.modifyHtml(e).replaceWith(t), z(t, h), b)
57
57
  try {
58
- L().isLegacyUnsubscribeModalRequested = !0;
59
- } catch (D) {
60
- console.error("Failed to request the legacy unsubscribe modal:", D);
58
+ f().isLegacyUnsubscribeModalRequested = !0;
59
+ } catch (p) {
60
+ console.error("Failed to request the legacy unsubscribe modal:", p);
61
61
  }
62
- d && U().enqueue({ id: d, items: g }), b.length > 0 && i({
63
- type: A.Warning,
64
- message: a(q)
62
+ if (y)
63
+ try {
64
+ f().isSfmcUnsubscribeModalRequested = !0;
65
+ } catch (p) {
66
+ console.error("Failed to request the SFMC unsubscribe modal:", p);
67
+ }
68
+ d && F().enqueue({ id: d, items: g }), v.length > 0 && i({
69
+ type: O.Warning,
70
+ message: m(I)
65
71
  });
66
72
  } catch (e) {
67
73
  console.error("Failed to repair module on add:", e);
68
74
  }
69
- }, convertDynamicContent: m };
75
+ }, convertDynamicContent: l };
70
76
  };
71
77
  export {
72
- q as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
73
- I as registerUsedAttributes,
74
- re as useModuleRepair
78
+ I as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
79
+ z as registerUsedAttributes,
80
+ oe as useModuleRepair
75
81
  };
@@ -1,70 +1,70 @@
1
- import { useActionsApi as j } from "./useActionsApi.js";
2
- import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
3
- import { useBlocksConfig as $ } from "./useBlocksConfig.js";
4
- import { useConfig as G } from "./useConfig.js";
5
- import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
6
- import { useFullStoryBridge as X } from "./useFullStoryBridge.js";
7
- import { useModuleRepair as J } from "./useModuleRepair.js";
8
- import { useStripoEventHandler as K } from "./useStripoEventHandler.js";
9
- import { useStripoNotifications as Q } from "./useStripoNotifications.js";
10
- import { useToaster as W } from "./useToaster.js";
11
- import { localePatch as Y } from "../config/i18n/index.js";
12
- import { en as B } from "../config/i18n/en/index.js";
13
- import { ToasterTypeOptions as Z } from "../enums/toaster.js";
14
- import { useStripoApi as ee } from "../services/stripoApi.js";
15
- import te from "../static/styles/customEditorStyle.css.js";
1
+ import { useActionsApi as z } from "./useActionsApi.js";
2
+ import { useAmbiguousDynamicContent as $ } from "./useAmbiguousDynamicContent.js";
3
+ import { useBlocksConfig as G } from "./useBlocksConfig.js";
4
+ import { useConfig as X } from "./useConfig.js";
5
+ import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
6
+ import { useFullStoryBridge as J } from "./useFullStoryBridge.js";
7
+ import { useModuleRepair as K } from "./useModuleRepair.js";
8
+ import { useStripoEventHandler as Q } from "./useStripoEventHandler.js";
9
+ import { useStripoNotifications as W } from "./useStripoNotifications.js";
10
+ import { useToaster as Y } from "./useToaster.js";
11
+ import { localePatch as Z } from "../config/i18n/index.js";
12
+ import { en as F } from "../config/i18n/en/index.js";
13
+ import { ToasterTypeOptions as ee } from "../enums/toaster.js";
14
+ import { useStripoApi as te } from "../services/stripoApi.js";
15
+ import oe from "../static/styles/customEditorStyle.css.js";
16
16
  import { useEditorStore as T } from "../stores/editor.js";
17
- import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
18
- import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
19
- let d = null, F = !1;
20
- const ve = (t) => {
21
- const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, s) => {
17
+ import { buildMergeTagEntries as re, flattenDynamicContentList as ie } from "../utils/genericUtil.js";
18
+ import { getStripoRuntimeBaseUrl as ne } from "../utils/stripoRuntime.js";
19
+ let d = null, A = !1;
20
+ const Be = (o) => {
21
+ const { features: m, template: p, isFeatureEnabled: f } = X(), { handleError: g, showToaster: P } = Y(), { getToken: U, getCustomFonts: R, getSyncModulesStatus: D } = te(), { handleEvent: V } = Q(), { handleModuleAdd: L } = K(), { restorePending: I } = $(), { getStripoBlocksConfig: O } = G(), { getStripoNotifications: q } = W(), S = () => d || (d = new Promise((n, a) => {
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  n();
24
24
  return;
25
25
  }
26
- const i = ie();
26
+ const i = ne();
27
27
  if (!i) {
28
- s(
28
+ a(
29
29
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
30
30
  );
31
31
  return;
32
32
  }
33
- const a = `${i}UIEditor.js`, e = document.createElement("script");
34
- e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
35
- F = !0, n();
36
- }, e.onerror = () => {
37
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
38
- }, document.body.appendChild(e);
33
+ const s = `${i}UIEditor.js`, t = document.createElement("script");
34
+ t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
35
+ A = !0, n();
36
+ }, t.onerror = () => {
37
+ t.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
38
+ }, document.body.appendChild(t);
39
39
  }), d.catch(() => {
40
40
  d = null;
41
- }), d), x = async (n, s, i, a = [], e = !1, c = !1) => {
42
- var w, k, b, _;
43
- const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
44
- t.mark("blocks_config_ready");
45
- const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
- t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
41
+ }), d), x = async (n, a, i, s = [], t = !1, c = !1) => {
42
+ var w, k, _, v;
43
+ const e = T(), { html: y, css: h } = n, { baseBlocks: C, extensions: H } = await O();
44
+ o.mark("blocks_config_ready");
45
+ const E = ((w = m.value) == null ? void 0 : w.displayConditions) ?? !0, M = ((k = m.value) == null ? void 0 : k.modulesDisabled) ?? !1, b = c || (((_ = p.value) == null ? void 0 : _.forceRecreate) ?? !1), N = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
+ o.setTemplate({ html: y, css: h, forceRecreate: b }), B().importCss(), o.mark("init_editor"), await window.UIEditor.initEditor(
47
47
  document.querySelector("#guido-editor"),
48
48
  {
49
- metadata: s,
50
- html: S,
51
- css: y,
52
- forceRecreate: C,
49
+ metadata: a,
50
+ html: y,
51
+ css: h,
52
+ forceRecreate: b,
53
53
  locale: "en",
54
54
  undoButtonSelector: "#guido__undo-button",
55
55
  redoButtonSelector: "#guido__redo-button",
56
56
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
57
57
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
58
58
  codeEditorButtonSelector: "#guido__code-button",
59
- customAppearanceMergetags: !p("liquidSyntax"),
59
+ customAppearanceMergetags: !f("liquidSyntax"),
60
60
  customAppearanceMergetagsBorderColor: "#f1f3fe",
61
61
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
62
- customViewStyles: te,
63
- conditionsEnabled: h,
64
- customConditionsEnabled: h,
62
+ customViewStyles: oe,
63
+ conditionsEnabled: E,
64
+ customConditionsEnabled: E,
65
65
  enableXSSSecurity: !0,
66
- modulesDisabled: H,
67
- syncModulesEnabled: e,
66
+ modulesDisabled: M,
67
+ syncModulesEnabled: t,
68
68
  messageSettingsEnabled: !0,
69
69
  displayGmailAnnotations: !0,
70
70
  displayHiddenPreheader: !1,
@@ -74,55 +74,63 @@ const ve = (t) => {
74
74
  copyPasteEnabled: !1,
75
75
  selectElementAfterDrop: !0,
76
76
  sameFontSizeForOutlook: !0,
77
- allowedScriptSourceDomains: M,
78
- ...E ? { baseBlocks: E } : {},
77
+ allowedScriptSourceDomains: N,
78
+ ...C ? { baseBlocks: C } : {},
79
79
  editorFonts: {
80
80
  showDefaultStandardFonts: !0,
81
81
  showDefaultNotStandardFonts: !0,
82
- customFonts: a
82
+ customFonts: s
83
83
  },
84
84
  mergeTags: [
85
85
  {
86
- entries: oe(
86
+ entries: re(
87
87
  i.preselectedDynamicContentList,
88
- re((_ = m.value) == null ? void 0 : _.dynamicContentList),
89
- p("liquidSyntax")
88
+ ie((v = p.value) == null ? void 0 : v.dynamicContentList),
89
+ f("liquidSyntax")
90
90
  )
91
91
  }
92
92
  ],
93
93
  async onTokenRefreshRequest(r) {
94
94
  try {
95
- t.mark("token_start");
96
- const l = await P();
97
- t.mark("token_end"), r(l);
95
+ o.mark("token_start");
96
+ const l = await U();
97
+ o.mark("token_end"), r(l);
98
98
  } catch (l) {
99
- f(l, "Failed to refresh token");
99
+ g(l, "Failed to refresh token");
100
100
  }
101
101
  },
102
102
  onTemplateLoaded() {
103
103
  try {
104
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
105
- v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
106
- o.hasChanges = !1;
107
- }, 1e3), t.markReady();
104
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = z(), { injectFullStory: j } = J();
105
+ B().importCss(), r(), j(), I(), l(), i.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
106
+ try {
107
+ if (e.isUnsubscribeConvertedOnLoad) {
108
+ const u = e.hasChanges;
109
+ e.hasChanges = !0, e.changeSeq += 1, e.isUnsubscribeConvertedOnLoad = !1, u && i.onLoadConversionSettled();
110
+ } else
111
+ e.hasChanges = !1;
112
+ } catch (u) {
113
+ console.error("Failed to settle the change state after template load:", u);
114
+ }
115
+ }, 1e3), o.markReady();
108
116
  } catch (r) {
109
- f(r, "Failed to load custom interface appearance");
117
+ g(r, "Failed to load custom interface appearance");
110
118
  }
111
119
  },
112
120
  onCodeEditorVisibilityChanged(r) {
113
- o.isCodeEditorOpen = r;
121
+ e.isCodeEditorOpen = r;
114
122
  },
115
123
  onEditorVisualModeChanged(r) {
116
- o.editorVisualMode = r.toLowerCase();
124
+ e.editorVisualMode = r.toLowerCase();
117
125
  },
118
126
  onVersionHistoryVisibilityChanged(r) {
119
- o.isVersionHistoryOpen = r;
127
+ e.isVersionHistoryOpen = r;
120
128
  },
121
129
  onDataChanged() {
122
- o.hasChanges = !0, o.changeSeq += 1;
130
+ e.hasChanges = !0, e.changeSeq += 1;
123
131
  },
124
- onEvent: U,
125
- onModuleAdd: V,
132
+ onEvent: V,
133
+ onModuleAdd: L,
126
134
  notifications: q(),
127
135
  // Stripo deselects the block on any click outside the canvas, so every surface
128
136
  // that belongs to the block's own flow has to be listed here (SD-153273).
@@ -133,35 +141,35 @@ const ve = (t) => {
133
141
  ".in-modal-v2-wrapper",
134
142
  ".in-toasts-wrapper"
135
143
  ],
136
- extensions: O,
137
- localePatch: Y
144
+ extensions: H,
145
+ localePatch: Z
138
146
  }
139
147
  );
140
148
  };
141
- return { initPlugin: async (n, s, i, a = !1) => {
142
- const e = T();
149
+ return { initPlugin: async (n, a, i, s = !1) => {
150
+ const t = T();
143
151
  try {
144
- t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
145
- const [c, o] = await Promise.all([
152
+ o.mark("plugin_start"), o.setScriptPreloaded(A), await S(), o.mark("script_ready");
153
+ const [c, e] = await Promise.all([
146
154
  R(),
147
155
  D()
148
156
  ]);
149
- t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, s, i, c, o, a);
157
+ o.mark("fonts_sync_ready"), t.syncModulesEnabled = e, await x(n, a, i, c, e, s);
150
158
  } catch {
151
- e.loadingStatus = !1, A({
152
- type: Z.Error,
153
- message: B["An error has occurred. Please report the error code to support."],
159
+ t.loadingStatus = !1, P({
160
+ type: ee.Error,
161
+ message: F["An error has occurred. Please report the error code to support."],
154
162
  actionButton: {
155
- text: B["Reload page"],
163
+ text: F["Reload page"],
156
164
  onClick: () => window.location.reload()
157
165
  }
158
- }), t.markFailed();
166
+ }), o.markFailed();
159
167
  }
160
168
  }, preloadRuntime: () => {
161
- g().catch(() => {
169
+ S().catch(() => {
162
170
  });
163
171
  } };
164
172
  };
165
173
  export {
166
- ve as useStripo
174
+ Be as useStripo
167
175
  };
@@ -1,20 +1,21 @@
1
- import { migrateCheckbox as e } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
3
- import { migrateFullStoryScripts as c } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
5
- import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
6
- import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
7
- import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
1
+ import { migrateCheckbox as a } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as c } from "./couponBlockMigrator.js";
3
+ import { migrateFullStoryScripts as g } from "./fullStoryScriptMigrator.js";
4
+ import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
+ import { migrateItemsPriceFormat as p } from "./itemsPriceFormatMigrator.js";
6
+ import { migrateLegacyUnsubscribeText as f } from "./legacyUnsubscribeTextMigrator.js";
7
+ import { migrateProductNameLink as s } from "./productNameLinkMigrator.js";
8
8
  import { migrateRadioButton as l } from "./radioButtonMigrator.js";
9
- import { migrateRecommendation as s } from "./recommendationMigrator.js";
9
+ import { migrateRecommendation as b } from "./recommendationMigrator.js";
10
10
  import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
11
- import { migrateRecommendationTitle as b } from "./recommendationTitleMigrator.js";
12
- import { migrateSocialIcons as k } from "./socialIconMigrator.js";
11
+ import { migrateRecommendationTitle as k } from "./recommendationTitleMigrator.js";
12
+ import { migrateSfmcUnsubscribeText as u } from "./sfmcUnsubscribeTextMigrator.js";
13
+ import { migrateSocialIcons as x } from "./socialIconMigrator.js";
13
14
  import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
14
- const w = async (t, i = {}, o, r) => {
15
+ const j = async (t, i = {}, o, r, e = "") => {
15
16
  let m = t;
16
- return m = e(m), m = l(m), m = p(m), m = await P(m), m = a(m), m = s(m, i), o && (m = d(m, o)), m = b(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = k(m), m = c(m), m;
17
+ return m = a(m), m = l(m), m = u(m), m = f(m), m = await P(m), m = c(m), m = b(m, i, e), o && (m = d(m, o)), m = k(m), m = n(m), r != null && r.itemsPriceFormatting && (m = p(m)), m = s(m), m = x(m), m = g(m), m;
17
18
  };
18
19
  export {
19
- w as migrate
20
+ j as migrate
20
21
  };
@@ -0,0 +1,84 @@
1
+ const f = /\s*!important\s*$/i, g = /\/\*[\s\S]*?\*\//g, a = /#[\w-]+/g, p = /\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+(?:\([^)]*\))?/g, d = /::[\w-]+/g, E = /(?:^|[\s>+~])([a-z][\w-]*)/gi;
2
+ function h(o) {
3
+ return o.split(";").flatMap((r) => {
4
+ const s = r.indexOf(":");
5
+ if (s < 0)
6
+ return [];
7
+ const e = r.slice(0, s).trim().toLowerCase(), t = r.slice(s + 1), n = t.replace(f, "").trim();
8
+ return e && n ? [{ prop: e, value: n, important: f.test(t) }] : [];
9
+ });
10
+ }
11
+ function w(o, r) {
12
+ let s = 0;
13
+ for (let e = r; e < o.length; e += 1)
14
+ if (o[e] === "{")
15
+ s += 1;
16
+ else if (o[e] === "}" && (s -= 1, s === 0))
17
+ return e;
18
+ return o.length;
19
+ }
20
+ function m(o) {
21
+ let r = 0;
22
+ return Array.from(o).reduce((e, t) => (t === "(" || t === "[" ? r += 1 : (t === ")" || t === "]") && r > 0 && (r -= 1), t === "," && r === 0 ? e.push("") : e[e.length - 1] += t, e), [""]).map((e) => e.trim()).filter(Boolean);
23
+ }
24
+ function v(o) {
25
+ const r = o.replace(g, ""), s = [];
26
+ let e = 0;
27
+ for (; e < r.length; ) {
28
+ const t = r.indexOf("{", e);
29
+ if (t < 0)
30
+ break;
31
+ const n = r.slice(e, t), i = n.slice(n.lastIndexOf(";") + 1).trim(), c = w(r, t);
32
+ if (i && !i.startsWith("@")) {
33
+ const l = m(i), u = h(r.slice(t + 1, c));
34
+ l.length > 0 && u.length > 0 && s.push({ selectors: l, declarations: u });
35
+ }
36
+ e = c + 1;
37
+ }
38
+ return s;
39
+ }
40
+ function S(o) {
41
+ var i, c;
42
+ const r = o.replace(d, " "), s = ((i = r.match(a)) == null ? void 0 : i.length) ?? 0, e = r.replace(a, " "), t = ((c = e.match(p)) == null ? void 0 : c.length) ?? 0, n = Array.from(e.replace(p, " ").matchAll(E)).length;
43
+ return s * 1e6 + t * 1e3 + n;
44
+ }
45
+ function O(o, r) {
46
+ return r.reduce((s, e) => {
47
+ let t = !1;
48
+ try {
49
+ t = o.matches(e);
50
+ } catch {
51
+ t = !1;
52
+ }
53
+ if (!t)
54
+ return s;
55
+ const n = S(e);
56
+ return s === void 0 || n > s ? n : s;
57
+ }, void 0);
58
+ }
59
+ function y(o, r) {
60
+ const s = /* @__PURE__ */ new Map();
61
+ if (!o)
62
+ return s;
63
+ const e = [];
64
+ return r.forEach((t, n) => {
65
+ const i = O(o, t.selectors);
66
+ i !== void 0 && t.declarations.forEach((c, l) => {
67
+ e.push({
68
+ ...c,
69
+ tier: c.important ? 2 : 0,
70
+ weight: i,
71
+ order: n * 1e3 + l
72
+ });
73
+ });
74
+ }), h(o.getAttribute("style") ?? "").forEach((t, n) => {
75
+ e.push({ ...t, tier: t.important ? 3 : 1, weight: 0, order: n });
76
+ }), e.sort((t, n) => t.tier - n.tier || t.weight - n.weight || t.order - n.order).forEach((t, n) => {
77
+ s.set(t.prop, { value: t.value, position: n });
78
+ }), s;
79
+ }
80
+ export {
81
+ v as parseCssRules,
82
+ h as parseDeclarations,
83
+ y as resolveDeclaredStyle
84
+ };