@useinsider/guido 3.18.2-beta.eedafd2 → 3.18.2-beta.f42547e

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 (80) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +26 -28
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +70 -72
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  7. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -51
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
  9. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  10. package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
  11. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  12. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  13. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  15. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  16. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  17. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  18. package/dist/composables/useCustomInterfaceAppearance.js +56 -46
  19. package/dist/composables/useHtmlCompiler.js +26 -37
  20. package/dist/composables/useHtmlValidator.js +84 -81
  21. package/dist/composables/useRecommendation.js +40 -35
  22. package/dist/composables/useSave.js +45 -90
  23. package/dist/composables/useStripo.js +30 -30
  24. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  25. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  26. package/dist/enums/extensions/recommendationBlock.js +38 -31
  27. package/dist/extensions/Blocks/Recommendation/block.js +43 -39
  28. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
  30. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
  31. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  32. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +181 -89
  33. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  34. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  35. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  36. package/dist/guido.css +1 -1
  37. package/dist/src/@types/config/schemas.d.ts +0 -4
  38. package/dist/src/components/Guido.vue.d.ts +1 -17
  39. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  40. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  41. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  42. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  43. package/dist/src/composables/useConfig.d.ts +0 -2
  44. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  45. package/dist/src/composables/useSave.d.ts +1 -6
  46. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  47. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  48. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  49. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  50. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  52. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  53. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  54. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +73 -3
  55. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  56. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  57. package/dist/src/stores/config.d.ts +0 -30
  58. package/dist/src/stores/onboarding.d.ts +377 -0
  59. package/dist/src/utils/templatePreparation.d.ts +0 -30
  60. package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
  61. package/dist/static/styles/components/skeleton.css.js +23 -0
  62. package/dist/stores/config.js +22 -39
  63. package/dist/stores/onboarding.js +41 -36
  64. package/dist/utils/genericUtil.js +61 -64
  65. package/dist/utils/templatePreparation.js +49 -52
  66. package/package.json +1 -1
  67. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  68. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  69. package/dist/composables/useSaveValidation.js +0 -279
  70. package/dist/composables/useSaveValidationRollout.js +0 -9
  71. package/dist/enums/save-validation.js +0 -4
  72. package/dist/src/@types/save-validation.d.ts +0 -19
  73. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  74. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  75. package/dist/src/enums/save-validation.d.ts +0 -27
  76. package/dist/src/stores/save-validation.d.ts +0 -22
  77. package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
  78. package/dist/stores/save-validation.js +0 -30
  79. package/dist/utils/liquidDynamicContent.js +0 -15
  80. /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
@@ -1,23 +1,23 @@
1
1
  import { getRecommendationFeedSourceMaps as y, URLS as I } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommendation.js";
3
- import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
3
+ import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
5
  import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
6
  import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
7
  import { useConfigStore as P } from "../stores/config.js";
8
8
  const B = () => ({
9
9
  calculateCardWidth: ({
10
- mobileLeftPadding: i,
10
+ mobileLeftPadding: s,
11
11
  mobileRightPadding: c,
12
- cardsInRow: s,
13
- unresponsive: n
12
+ cardsInRow: o,
13
+ unresponsive: a
14
14
  }) => {
15
- const o = n ? s : 1, e = i + c + (o - 1) * R;
16
- return (C - e) / o;
15
+ const i = a ? o : 1, e = s + c + (i - 1) * R;
16
+ return (C - e) / i;
17
17
  },
18
- getRecommendationCampaignData: (i) => {
19
- const c = l(), s = Number(i), n = c.blockStates[s];
20
- if (!n)
18
+ getRecommendationCampaignData: (s) => {
19
+ const c = g(), o = Number(s), a = c.blockStates[o];
20
+ if (!a)
21
21
  return {
22
22
  textTrimming: !1,
23
23
  orientation: "vertical",
@@ -30,54 +30,59 @@ const B = () => ({
30
30
  discountBeforeTextValue: "",
31
31
  discountAfterTextValue: ""
32
32
  };
33
- const { recommendationConfigs: o } = n, e = o.orientation === "grid" ? "vertical" : "horizontal";
33
+ const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
34
34
  return {
35
- textTrimming: o.textTrimming,
35
+ textTrimming: i.textTrimming,
36
36
  orientation: e,
37
37
  mobileLeftPadding: 0,
38
38
  mobileRightPadding: 0,
39
- cardsInRow: o.cardsInRow,
40
- unresponsive: o.unresponsive,
39
+ cardsInRow: i.cardsInRow,
40
+ unresponsive: i.unresponsive,
41
41
  priceBeforeTextValue: "",
42
42
  priceAfterTextValue: "",
43
43
  discountBeforeTextValue: "",
44
44
  discountAfterTextValue: ""
45
45
  };
46
46
  },
47
- buildCampaignUrl: (i, c) => {
48
- var m;
49
- const s = l(), n = P(), o = Number(i);
47
+ buildCampaignUrl: (s, c) => {
48
+ var l;
49
+ const o = g(), a = P(), i = Number(s);
50
50
  let e;
51
51
  if (c)
52
52
  e = c;
53
53
  else {
54
- const a = s.blockStates[o];
55
- if (!a)
54
+ const r = o.blockStates[i];
55
+ if (!r)
56
56
  return "";
57
- const { recommendationConfigs: r } = a;
57
+ const { recommendationConfigs: n } = r;
58
58
  e = {
59
- strategy: r.strategy,
60
- strategyId: r.strategyId,
61
- language: r.language,
62
- currencyCode: r.currencySettings.value,
63
- size: r.size,
64
- productIds: r.productIds,
65
- filters: r.filters,
66
- shuffleProducts: r.shuffleProducts
59
+ strategy: n.strategy,
60
+ strategyId: n.strategyId,
61
+ language: n.language,
62
+ currencyCode: n.currencySettings.value,
63
+ size: n.size,
64
+ productIds: n.productIds,
65
+ filters: n.filters,
66
+ shuffleProducts: n.shuffleProducts
67
67
  };
68
68
  }
69
- if (e.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy"))
70
- return s.recommendationCampaignUrls[i] = {
69
+ if (e.strategyId && a.isFeatureEnabled("reusableRecommendationStrategy"))
70
+ return o.recommendationCampaignUrls[s] = {
71
71
  strategyId: e.strategyId,
72
72
  locale: e.language,
73
73
  currency: e.currencyCode
74
74
  }, "";
75
- const g = ((m = y().find((a) => a.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
76
- t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
77
- const f = e.filters.filter((a) => a.isValid), d = b(f);
78
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(n.partnerName, e.strategy)).forEach(([a, r]) => t.set(a, r));
79
- const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${g}?${p}`;
80
- return s.recommendationCampaignUrls[i] = u, u;
75
+ const d = ((l = y().find((r) => r.key === e.strategy)) == null ? void 0 : l.path) || "";
76
+ if (!d) {
77
+ const r = { ...o.recommendationCampaignUrls };
78
+ return delete r[s], o.recommendationCampaignUrls = r, "";
79
+ }
80
+ const t = new URLSearchParams();
81
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
82
+ const f = e.filters.filter((r) => r.isValid), m = b(f);
83
+ m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
84
+ const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
85
+ return o.recommendationCampaignUrls[s] = u, u;
81
86
  }
82
87
  });
83
88
  export {
@@ -1,100 +1,55 @@
1
- import { useActionsApi as W } from "./useActionsApi.js";
1
+ import { useActionsApi as T } from "./useActionsApi.js";
2
2
  import { useConfig as q } from "./useConfig.js";
3
- import { useEditorLock as O } from "./useEditorLock.js";
4
- import { useSaveStart as D, useSaveComplete as F } 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
- import { ToasterTypeOptions as I } from "../enums/toaster.js";
9
- import { useStripoApi as J } from "../services/stripoApi.js";
10
- import { useConfigStore as K } from "../stores/config.js";
11
- import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as Q } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
14
- import { useAllowlist as Z } from "./useAllowlist.js";
15
- import { useHtmlValidator as _ } from "./useHtmlValidator.js";
16
- import { useToaster as $ } from "./useToaster.js";
17
- import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
18
- import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
19
- import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
20
- import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
21
- const Bt = () => {
22
- const r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: u } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: n } = O(), l = async (t, e, o) => {
23
- if (!m("allowlistEnabled"))
24
- return !1;
25
- const i = await x(t, e);
26
- if (!i.length)
27
- return !1;
28
- if (!o) {
29
- const s = await k(i);
30
- s != null && s.message && V({
31
- type: I.Warning,
32
- message: s.message,
33
- actionButton: s.actionButton
34
- });
35
- }
36
- return !0;
37
- }, L = async (t) => !y(t.compiledHtml) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), c = async (t, e) => {
38
- if (!await E())
3
+ import { useEditorLock as C } from "./useEditorLock.js";
4
+ import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
5
+ import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
6
+ import { ToasterTypeOptions as P } from "../enums/toaster.js";
7
+ import { useStripoApi as U } from "../services/stripoApi.js";
8
+ import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
9
+ import { useAllowlist as h } from "./useAllowlist.js";
10
+ import { useHtmlValidator as F } from "./useHtmlValidator.js";
11
+ import { useToaster as O } from "./useToaster.js";
12
+ import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
13
+ import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
14
+ import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
15
+ import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
16
+ const rt = () => {
17
+ const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
18
+ var l;
19
+ n();
20
+ const { prepareTemplateDetails: B } = A(), t = await B();
21
+ if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
39
22
  return;
40
- const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
41
- if (await g(i), t.modules = s, !e.suppress) {
42
- const R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
43
- f({ ...t, ...R, silent: e.silent });
44
- }
45
- return t;
46
- }, U = async (t, e) => {
47
- var i;
48
- r();
49
- const o = await d();
50
- if (u(o.rawHtml, e)) {
51
- if (B.value && !e) {
52
- const s = await C(
53
- o.compiledHtml,
54
- o.dynamicContentList
55
- );
56
- if (s.length) {
57
- T.open(s, "save");
58
- return;
59
- }
60
- } else if (!await L(o))
23
+ if (r("liquidSyntax")) {
24
+ if (!await m(t.compiledHtml))
61
25
  return;
62
- if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await l(o.compiledHtml, o.css, e))
63
- return c(o, { silent: e, suppress: t });
64
- }
65
- }, A = async () => {
66
- var e;
67
- if (!P.allowSaveWithErrors)
26
+ } else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
68
27
  return;
69
- r();
70
- const t = await d();
71
- if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await l(t.compiledHtml, t.css, !1))
72
- return c(t, { silent: !1, blankCompiled: !0 });
73
- }, M = async () => {
74
- r();
75
- const { html: t, css: e } = await H();
76
- if (!u(t, !0) || await l(t, e, !0))
28
+ if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
77
29
  return;
78
- const o = Y(t), i = {
79
- dynamicContentList: h.getSelectedDynamicContentList,
80
- compiledHtml: "",
81
- rawHtml: t,
82
- css: e,
83
- ampHtml: "",
84
- ampErrors: [],
85
- modules: [],
86
- recommendation: { campaignUrls: {}, configs: {} },
87
- unsubscribe: {
88
- status: o.length > 0,
89
- config: o
30
+ if (r("allowlistEnabled")) {
31
+ const i = await y(t.compiledHtml, t.css);
32
+ if (i.length) {
33
+ if (!o) {
34
+ const e = await k(i);
35
+ e != null && e.message && V({
36
+ type: P.Warning,
37
+ message: e.message,
38
+ actionButton: e.actionButton
39
+ });
40
+ }
41
+ return;
90
42
  }
91
- };
92
- return c(i, { silent: !0 });
43
+ }
44
+ if (!await w())
45
+ return;
46
+ const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
47
+ return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
93
48
  };
94
- return { save: (t = !1, e = !1) => n(
95
- () => U(t, e)
96
- ), saveWithErrors: () => n(A), saveRawOnly: () => n(M) };
49
+ return { save: (a = !1, o = !1) => x(
50
+ () => H(a, o)
51
+ ) };
97
52
  };
98
53
  export {
99
- Bt as useSave
54
+ rt as useSave
100
55
  };
@@ -1,23 +1,23 @@
1
- import { useActionsApi as L } from "./useActionsApi.js";
2
- import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
- import { useConfig as q } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
1
+ import { useActionsApi as O } from "./useActionsApi.js";
2
+ import { useBlocksConfig as q } from "./useBlocksConfig.js";
3
+ import { useConfig as H } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
5
5
  import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
6
  import { useModuleRepair as j } from "./useModuleRepair.js";
7
7
  import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
8
  import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
9
  import { useToaster as G } from "./useToaster.js";
10
10
  import { localePatch as J } from "../config/i18n/index.js";
11
- import { en as w } from "../config/i18n/en/index.js";
11
+ import { en as b } from "../config/i18n/en/index.js";
12
12
  import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
13
  import { useStripoApi as K } from "../services/stripoApi.js";
14
14
  import Q from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as b } from "../stores/editor.js";
15
+ import { useEditorStore as k } from "../stores/editor.js";
16
16
  import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
- const Ce = () => {
20
- const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
19
+ const he = () => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = q(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  i();
@@ -29,16 +29,16 @@ const Ce = () => {
29
29
  }, document.body.appendChild(e);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
- }), n), _ = async (i, s, o, a = [], r = !1) => {
32
+ }), n), D = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1);
35
- await window.UIEditor.initEditor(
34
+ const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), x = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
+ w().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
38
38
  metadata: s,
39
39
  html: d,
40
- css: D,
41
- forceRecreate: U,
40
+ css: R,
41
+ forceRecreate: I,
42
42
  locale: "en",
43
43
  undoButtonSelector: "#guido__undo-button",
44
44
  redoButtonSelector: "#guido__redo-button",
@@ -52,7 +52,7 @@ const Ce = () => {
52
52
  conditionsEnabled: S,
53
53
  customConditionsEnabled: S,
54
54
  enableXSSSecurity: !0,
55
- modulesDisabled: P,
55
+ modulesDisabled: U,
56
56
  syncModulesEnabled: r,
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
@@ -62,7 +62,7 @@ const Ce = () => {
62
62
  displayUTM: !1,
63
63
  selectElementAfterDrop: !0,
64
64
  sameFontSizeForOutlook: !0,
65
- allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
65
+ allowedScriptSourceDomains: x,
66
66
  ...g ? { baseBlocks: g } : {},
67
67
  editorFonts: {
68
68
  showDefaultStandardFonts: !0,
@@ -80,7 +80,7 @@ const Ce = () => {
80
80
  ],
81
81
  async onTokenRefreshRequest(t) {
82
82
  try {
83
- const l = await B();
83
+ const l = await M();
84
84
  t(l);
85
85
  } catch (l) {
86
86
  p(l, "Failed to refresh token");
@@ -88,8 +88,8 @@ const Ce = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
92
- t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = O(), { injectFullStory: L } = N();
92
+ w().importCss(), t(), L(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -108,34 +108,34 @@ const Ce = () => {
108
108
  onDataChanged() {
109
109
  e.hasChanges = !0;
110
110
  },
111
- onEvent: v,
112
- onModuleAdd: F,
113
- notifications: V(),
111
+ onEvent: F,
112
+ onModuleAdd: A,
113
+ notifications: _(),
114
114
  ignoreClickOutsideSelectors: [
115
115
  "#guido-dynamic-content-modal",
116
116
  ".in-on-board-wrapper",
117
117
  ".in-drawer__container"
118
118
  ],
119
- extensions: R,
119
+ extensions: P,
120
120
  localePatch: J
121
121
  }
122
122
  );
123
123
  };
124
124
  return { initPlugin: async (i, s, o) => {
125
- const a = b();
125
+ const a = k();
126
126
  try {
127
127
  await f();
128
128
  const [r, e] = await Promise.all([
129
- M(),
130
- T()
129
+ T(),
130
+ v()
131
131
  ]);
132
- a.syncModulesEnabled = e, await _(i, s, o, r, e);
132
+ a.syncModulesEnabled = e, await D(i, s, o, r, e);
133
133
  } catch {
134
- a.loadingStatus = !1, k({
134
+ a.loadingStatus = !1, B({
135
135
  type: X.Error,
136
- message: w["An error has occurred. Please report the error code to support."],
136
+ message: b["An error has occurred. Please report the error code to support."],
137
137
  actionButton: {
138
- text: w["Reload page"],
138
+ text: b["Reload page"],
139
139
  onClick: () => window.location.reload()
140
140
  }
141
141
  });
@@ -146,5 +146,5 @@ const Ce = () => {
146
146
  } };
147
147
  };
148
148
  export {
149
- Ce as useStripo
149
+ he as useStripo
150
150
  };
@@ -1,27 +1,24 @@
1
- import { ToasterTypeOptions as n } from "../../enums/toaster.js";
2
- import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
3
- import { useToaster as i } from "../useToaster.js";
4
- import { useTranslations as l } from "../useTranslations.js";
5
- const c = /* @__PURE__ */ new Set([
6
- s,
7
- a
8
- ]), p = "newsletter.coupon-tag-modified";
9
- function u(r) {
10
- const e = new DOMParser().parseFromString(r, "text/html");
11
- return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
12
- var t;
13
- return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
14
- }).filter((o) => !c.has(o));
15
- }
16
- const T = () => {
17
- const { showToaster: r } = i(), e = l();
18
- return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
19
- type: n.Warning,
20
- message: e(p)
21
- }), !1) : !0 };
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
+ import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
+ import { useToaster as m } from "../useToaster.js";
4
+ import { useTranslations as p } from "../useTranslations.js";
5
+ const u = /* @__PURE__ */ new Set([
6
+ i,
7
+ l
8
+ ]), A = () => {
9
+ const { showToaster: t } = m(), r = p();
10
+ return { validateCouponBlockTags: (e) => {
11
+ const n = new DOMParser().parseFromString(e, "text/html");
12
+ return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
+ var o;
14
+ const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
+ return !u.has(a);
16
+ }) ? (t({
17
+ type: c.Warning,
18
+ message: r("newsletter.coupon-tag-modified")
19
+ }), !1) : !0;
20
+ } };
22
21
  };
23
22
  export {
24
- p as COUPON_TAG_MODIFIED_KEY,
25
- u as findInvalidCouponBlocks,
26
- T as useCouponBlockValidator
23
+ A as useCouponBlockValidator
27
24
  };
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
- import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as p } from "../useToaster.js";
5
- import { useTranslations as l } from "../useTranslations.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as E } from "../useToaster.js";
5
+ import { useTranslations as m } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,37 +12,30 @@ const T = [
12
12
  pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
- ], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
16
- function m(r) {
17
- const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
18
- return s.querySelectorAll(i).forEach((n) => {
19
- const e = Number(n.getAttribute(a.PAGE_TYPE));
20
- t.set(e, (t.get(e) ?? 0) + 1);
21
- }), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
22
- }
23
- function b(r) {
24
- const s = new DOMParser().parseFromString(r, "text/html");
25
- return Array.from(s.querySelectorAll(i)).filter((t) => {
26
- const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
27
- return !n || !e;
28
- }).length;
29
- }
30
- const y = () => {
31
- const { showToaster: r } = p(), s = l();
32
- return { validateUnsubscribeBlockUniqueness: (e) => {
33
- const o = m(e);
34
- return o.length ? (r({
35
- type: c.Error,
36
- message: s(o.length > 1 ? g : o[0].messageKey)
15
+ ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
+ const { showToaster: c } = E(), p = m();
17
+ return { validateUnsubscribeBlockUniqueness: (n) => {
18
+ const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
+ o.querySelectorAll(l).forEach((e) => {
20
+ const s = Number(e.getAttribute(a.PAGE_TYPE));
21
+ r.set(s, (r.get(s) ?? 0) + 1);
22
+ });
23
+ const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
+ return t.length ? (c({
25
+ type: i.Error,
26
+ message: p(t.length > 1 ? g : t[0])
37
27
  }), !1) : !0;
38
- }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
- type: c.Warning,
40
- message: s(E)
41
- }), !1) };
28
+ }, validateUnsubscribeBlockHasTemplate: (n) => {
29
+ const o = new DOMParser().parseFromString(n, "text/html");
30
+ return Array.from(o.querySelectorAll(l)).some((t) => {
31
+ const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
32
+ return !e || !s;
33
+ }) ? (c({
34
+ type: i.Warning,
35
+ message: p(b)
36
+ }), !1) : !0;
37
+ } };
42
38
  };
43
39
  export {
44
- E as EMPTY_BLOCK_KEY,
45
- b as countUnsubBlocksWithoutPage,
46
- m as findDuplicateUnsubPageTypes,
47
- y as useUnsubscribeBlockValidator
40
+ P as useUnsubscribeBlockValidator
48
41
  };