@useinsider/guido 1.0.3-beta.dfb1fcf → 1.0.3-beta.e1adf59

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 (130) hide show
  1. package/README.md +3 -144
  2. package/dist/components/Guido.vue.js +10 -12
  3. package/dist/components/Guido.vue2.js +101 -84
  4. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
  6. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  7. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  8. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +9 -9
  9. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +17 -30
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +10 -12
  11. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -19
  12. package/dist/composables/useApiErrorTracking.js +120 -0
  13. package/dist/composables/useErrorTracking.js +98 -0
  14. package/dist/composables/useGuidoActions.js +9 -19
  15. package/dist/composables/useHttp.js +89 -52
  16. package/dist/composables/useStripo.js +163 -66
  17. package/dist/composables/useStripoErrorCategory.js +86 -0
  18. package/dist/composables/useStripoSlackNotifier.js +47 -0
  19. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  20. package/dist/config/migrator/index.js +6 -7
  21. package/dist/enums/defaults.js +8 -16
  22. package/dist/enums/onboarding.js +1 -2
  23. package/dist/enums/unsubscribe.js +25 -27
  24. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  25. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  26. package/dist/extensions/Blocks/Recommendation/block.js +3 -6
  27. package/dist/extensions/Blocks/Recommendation/control.js +65 -109
  28. package/dist/extensions/Blocks/Recommendation/extension.js +7 -18
  29. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -159
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/template.js +200 -0
  32. package/dist/extensions/Blocks/common-control.js +43 -125
  33. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  34. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  35. package/dist/guido.css +1 -1
  36. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +100 -312
  37. package/dist/package.json.js +1 -1
  38. package/dist/services/slackNotificationService.js +167 -0
  39. package/dist/services/stripoApi.js +49 -19
  40. package/dist/services/stripoErrorDeduplicationService.js +91 -0
  41. package/dist/src/@types/generic.d.ts +6 -42
  42. package/dist/src/components/Guido.vue.d.ts +3 -4
  43. package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +1 -3
  44. package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +1 -3
  45. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  46. package/dist/src/composables/useApiErrorTracking.d.ts +26 -0
  47. package/dist/src/composables/useErrorTracking.d.ts +30 -0
  48. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  49. package/dist/src/composables/useStripoErrorCategory.d.ts +26 -0
  50. package/dist/src/composables/useStripoSlackNotifier.d.ts +8 -0
  51. package/dist/src/enums/onboarding.d.ts +0 -1
  52. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  53. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -11
  54. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Recommendation/template.d.ts +6 -0
  56. package/dist/src/extensions/Blocks/common-control.d.ts +0 -21
  57. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  58. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  59. package/dist/src/services/slackNotificationService.d.ts +110 -0
  60. package/dist/src/services/stripoErrorDeduplicationService.d.ts +75 -0
  61. package/dist/src/stores/config.d.ts +2 -10
  62. package/dist/src/stores/dynamic-content.d.ts +3 -3
  63. package/dist/src/stores/editor.d.ts +1 -1
  64. package/dist/src/stores/onboarding.d.ts +1 -1
  65. package/dist/src/stores/preview.d.ts +1 -1
  66. package/dist/src/stores/recommendation.d.ts +1 -1
  67. package/dist/src/stores/save-as-template.d.ts +1 -1
  68. package/dist/src/stores/toaster.d.ts +1 -1
  69. package/dist/src/stores/unsubscribe.d.ts +1 -1
  70. package/dist/src/stores/version-history.d.ts +1 -1
  71. package/dist/src/utils/dateUtil.d.ts +0 -21
  72. package/dist/src/utils/genericUtil.d.ts +0 -1
  73. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  74. package/dist/static/styles/components/wide-panel.css.js +4 -0
  75. package/dist/static/styles/customEditorStyle.css.js +0 -19
  76. package/dist/stores/config.js +5 -5
  77. package/dist/stores/dynamic-content.js +2 -2
  78. package/dist/stores/editor.js +1 -1
  79. package/dist/stores/onboarding.js +27 -27
  80. package/dist/stores/preview.js +1 -1
  81. package/dist/stores/recommendation.js +3 -3
  82. package/dist/stores/save-as-template.js +2 -2
  83. package/dist/stores/toaster.js +1 -1
  84. package/dist/stores/unsubscribe.js +1 -1
  85. package/dist/stores/version-history.js +4 -4
  86. package/dist/utils/dateUtil.js +3 -24
  87. package/dist/utils/genericUtil.js +9 -20
  88. package/package.json +3 -3
  89. package/dist/composables/useBlocksConfig.js +0 -49
  90. package/dist/config/migrator/recommendationMigrator.js +0 -293
  91. package/dist/enums/date.js +0 -6
  92. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
  93. package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
  94. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  95. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
  96. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  97. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
  98. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
  99. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
  100. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
  101. package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
  102. package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
  103. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  104. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
  105. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  106. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  107. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
  108. package/dist/extensions/Blocks/controlFactories.js +0 -234
  109. package/dist/src/composables/useBlocksConfig.d.ts +0 -11
  110. package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
  111. package/dist/src/enums/date.d.ts +0 -4
  112. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -79
  113. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -91
  114. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  115. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -71
  116. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  117. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  118. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  119. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  120. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  121. package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
  122. package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
  123. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
  124. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  125. package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
  126. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
  127. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
  128. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -95
  129. package/dist/src/utils/environmentUtil.d.ts +0 -5
  130. package/dist/utils/environmentUtil.js +0 -4
@@ -14,41 +14,41 @@ const e = () => ({
14
14
  },
15
15
  userModalState: {},
16
16
  isFetched: !1
17
- }), c = s("guidoOnboarding", {
17
+ }), g = s("onboarding", {
18
18
  state: () => a(),
19
19
  getters: {
20
- getOnboarding: (n) => (i) => n.onboardings[i],
21
- isActive: (n) => (i) => n.onboardings[i].isActive,
22
- getCurrentCard: (n) => (i) => {
23
- const o = n.onboardings[i];
24
- return o.config[o.cardIndex];
20
+ getOnboarding: (n) => (o) => n.onboardings[o],
21
+ isActive: (n) => (o) => n.onboardings[o].isActive,
22
+ getCurrentCard: (n) => (o) => {
23
+ const i = n.onboardings[o];
24
+ return i.config[i.cardIndex];
25
25
  },
26
26
  getGenericCurrentCard: (n) => {
27
- const { genericOnboarding: i } = n.onboardings;
28
- return i.config[i.cardIndex];
27
+ const { genericOnboarding: o } = n.onboardings;
28
+ return o.config[o.cardIndex];
29
29
  },
30
30
  getTextBlockCurrentCard: (n) => {
31
- const { textBlockOnboarding: i } = n.onboardings;
32
- return i.config[i.cardIndex];
31
+ const { textBlockOnboarding: o } = n.onboardings;
32
+ return o.config[o.cardIndex];
33
33
  },
34
34
  getVersionHistoryCurrentCard: (n) => {
35
- const { versionHistoryOnboarding: i } = n.onboardings;
36
- return i.config[i.cardIndex];
35
+ const { versionHistoryOnboarding: o } = n.onboardings;
36
+ return o.config[o.cardIndex];
37
37
  },
38
38
  getAmpCurrentCard: (n) => {
39
- const { ampOnboarding: i } = n.onboardings;
40
- return i.config[i.cardIndex];
39
+ const { ampOnboarding: o } = n.onboardings;
40
+ return o.config[o.cardIndex];
41
41
  },
42
- shouldShowOnboarding: (n) => (i) => {
43
- const o = n.userModalState.Guido;
44
- return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
42
+ shouldShowOnboarding: (n) => (o) => {
43
+ const i = n.userModalState.Guido;
44
+ return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
45
45
  }
46
46
  },
47
47
  actions: {
48
48
  closeOtherOnboardings(n) {
49
- Object.keys(this.onboardings).forEach((i) => {
50
- const o = i;
51
- o !== n && this.onboardings[o].isActive && (this.onboardings[o].isActive = !1, this.onboardings[o].cardIndex = 0, this.onboardings[o].config = []);
49
+ Object.keys(this.onboardings).forEach((o) => {
50
+ const i = o;
51
+ i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
52
52
  });
53
53
  },
54
54
  start(n) {
@@ -63,8 +63,8 @@ const e = () => ({
63
63
  previous(n) {
64
64
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
65
65
  },
66
- setConfig(n, i) {
67
- this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
66
+ setConfig(n, o) {
67
+ this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
68
68
  },
69
69
  async onDiscoverNowClicked() {
70
70
  await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
@@ -81,15 +81,15 @@ const e = () => ({
81
81
  async fetchUserModalState() {
82
82
  if (this.isFetched)
83
83
  return;
84
- const { fetchUserModalState: n } = t(), i = await n();
85
- this.userModalState = i, this.isFetched = !0;
84
+ const { fetchUserModalState: n } = t(), o = await n();
85
+ this.userModalState = o, this.isFetched = !0;
86
86
  },
87
- async setUserModalState(n, i, o) {
87
+ async setUserModalState(n, o, i) {
88
88
  const { setUserModalState: r } = t();
89
- await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
89
+ await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
90
90
  }
91
91
  }
92
92
  });
93
93
  export {
94
- c as useOnboardingStore
94
+ g as useOnboardingStore
95
95
  };
@@ -6,7 +6,7 @@ const s = () => ({
6
6
  templateHtml: "",
7
7
  isLoaded: !1,
8
8
  isAMPErrorModalVisible: !1
9
- }), a = e("guidoPreview", {
9
+ }), a = e("preview", {
10
10
  state: () => s(),
11
11
  getters: {
12
12
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
@@ -1,8 +1,8 @@
1
1
  import { defineStore as e } from "pinia";
2
- const o = () => ({
2
+ const t = () => ({
3
3
  recommendationConfigs: []
4
- }), n = e("guidoRecommendation", {
5
- state: () => o()
4
+ }), n = e("recommendation", {
5
+ state: () => t()
6
6
  });
7
7
  export {
8
8
  n as useRecommendationStore
@@ -17,7 +17,7 @@ const r = () => ({
17
17
  editor: 2,
18
18
  message: 1
19
19
  }
20
- }), g = i("guidoSaveAsTemplate", {
20
+ }), n = i("saveAsTemplate", {
21
21
  state: () => r(),
22
22
  getters: {
23
23
  getTemplateName: (e) => e.templateName.trim(),
@@ -44,5 +44,5 @@ const r = () => ({
44
44
  }
45
45
  });
46
46
  export {
47
- g as useSaveAsTemplateStore
47
+ n as useSaveAsTemplateStore
48
48
  };
@@ -8,7 +8,7 @@ const a = () => ({
8
8
  withIcon: !0,
9
9
  withoutLeftMargin: !1,
10
10
  actionButton: void 0
11
- }), u = i("guidoToaster", {
11
+ }), u = i("toaster", {
12
12
  state: () => a(),
13
13
  getters: {
14
14
  shouldAutoHide: (t) => t.status && !!t.text
@@ -12,7 +12,7 @@ const p = () => ({
12
12
  typeSelectionDrawerStatus: !1,
13
13
  isGlobalUnsubscribeDisabled: !1,
14
14
  isSubscriptionPreferencesCenterDisabled: !1
15
- }), g = d("guidoUnsubscribe", {
15
+ }), g = d("unsubscribe", {
16
16
  state: () => p(),
17
17
  getters: {
18
18
  getSelectedCollection: (e) => i[e.selectedCollectionType],
@@ -5,13 +5,13 @@ const e = () => ({
5
5
  description: "",
6
6
  authorId: "",
7
7
  authorName: ""
8
- }), i = () => ({
8
+ }), r = () => ({
9
9
  previousPatch: e(),
10
10
  currentPatch: e(),
11
11
  nextPatch: e(),
12
12
  editorVisualMode: "desktop"
13
- }), r = a("guidoVersionHistory", {
14
- state: () => i(),
13
+ }), o = a("versionHistory", {
14
+ state: () => r(),
15
15
  getters: {
16
16
  hasPreviousPatch: (t) => !!t.previousPatch.id,
17
17
  hasCurrentPatch: (t) => !!t.currentPatch.id,
@@ -24,5 +24,5 @@ const e = () => ({
24
24
  }
25
25
  });
26
26
  export {
27
- r as useVersionHistoryStore
27
+ o as useVersionHistoryStore
28
28
  };
@@ -1,19 +1,4 @@
1
- import { DEFAULT_LOCALE as r, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
2
- const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
3
- const t = window.l10n;
4
- return (t == null ? void 0 : t.locale) === a ? r : (t == null ? void 0 : t.locale) || r;
5
- }, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
6
- const t = window.l10n;
7
- return (t == null ? void 0 : t.timezone) || u || c;
8
- }, D = (t, e = s(), n = f()) => {
9
- const o = {
10
- year: "numeric",
11
- month: "2-digit",
12
- day: "2-digit",
13
- timeZone: n
14
- }, i = m(t);
15
- return new Intl.DateTimeFormat(e, o).format(i);
16
- }, T = (t) => {
1
+ const o = (t) => {
17
2
  if (!t)
18
3
  return "";
19
4
  const e = new Date(t);
@@ -25,13 +10,7 @@ const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length ===
25
10
  second: "2-digit",
26
11
  hour12: !1
27
12
  }).format(e);
28
- }, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
13
+ };
29
14
  export {
30
- m as convertToDateObject,
31
- T as formatPatchDate,
32
- D as formatShortDate,
33
- h as isAfterDate,
34
- u as localTz,
35
- s as locale,
36
- f as timezone
15
+ o as formatPatchDate
37
16
  };
@@ -1,26 +1,15 @@
1
- const s = (e) => {
2
- const n = e.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [r] = n, l = {
3
- text: e.label,
4
- value: r || ""
5
- };
6
- if (n.length >= 2) {
7
- const [, a, c] = n, o = a.includes("=") ? { key: a.split("=")[0].trim(), value: a.split("=")[1].trim() } : null;
8
- o ? l.format = o : c || (l.fallback = a), c && (l.fallback = c);
9
- }
10
- return l;
11
- }, f = (e) => e.map((t) => t.format ? {
12
- label: `${t.text} | ${t.format.key}=${t.format.value}`,
13
- value: `{{${t.value}|${t.format.key}=${t.format.value}}}`
1
+ const o = (e) => e.map((a) => a.format ? {
2
+ label: `${a.text} | ${a.format.key}=${a.format.value}`,
3
+ value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
14
4
  } : {
15
- label: t.fallback ? `${t.text} | ${t.fallback}` : t.text,
16
- value: t.fallback ? `{{${t.value}|${t.fallback}}}` : `{{${t.value}}}`
17
- }), u = () => {
5
+ label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
6
+ value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
7
+ }), f = () => {
18
8
  var e;
19
9
  return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
20
- }, $ = (e = "", t = {}, n = !1) => Object.entries(t).reduce((r, [l, a]) => n && (a === "" || a === null || a === void 0) ? r.replace(`&${l}={${l}}`, "") : r.replace(`{${l}}`, String(a)), e);
10
+ }, $ = (e = "", a = {}, n = !1) => Object.entries(a).reduce((l, [t, r]) => n && (r === "" || r === null || r === void 0) ? l.replace(`&${t}={${t}}`, "") : l.replace(`{${t}}`, String(r)), e);
21
11
  export {
22
- f as dynamicContentToMergeTags,
23
- u as getCsrfToken,
24
- s as mergeTagToDynamicContent,
12
+ o as dynamicContentToMergeTags,
13
+ f as getCsrfToken,
25
14
  $ as replaceString
26
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.3-beta.dfb1fcf",
3
+ "version": "1.0.3-beta.e1adf59",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -31,7 +31,7 @@
31
31
  "author": "",
32
32
  "license": "ISC",
33
33
  "dependencies": {
34
- "@stripoinc/ui-editor-extensions": "3.1.0",
34
+ "@stripoinc/ui-editor-extensions": "3.0.0",
35
35
  "@useinsider/design-system-vue": "0.14.20",
36
36
  "@vueuse/core": "11.3.0",
37
37
  "lodash-es": "4.17.21",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "guido": {
85
85
  "stripo": {
86
- "version": "2.46.0"
86
+ "version": "2.42.0"
87
87
  }
88
88
  }
89
89
  }
@@ -1,49 +0,0 @@
1
- const l = {
2
- "amp-accordion": "ampAccordionEnabled",
3
- "amp-carousel": "ampCarouselEnabled",
4
- "amp-form-controls": "ampFormControlsEnabled",
5
- "banner-block": "bannerEnabled",
6
- "button-block": "buttonEnabled",
7
- "html-block": "htmlEnabled",
8
- "image-block": "imageEnabled",
9
- "menu-block": "menuEnabled",
10
- "social-block": "socialNetEnabled",
11
- "spacer-block": "spacerEnabled",
12
- "text-block": "textEnabled",
13
- "timer-block": "timerEnabled",
14
- "video-block": "videoEnabled"
15
- }, c = {
16
- "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
17
- "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
18
- "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
19
- "recommendation-block": () => import("../extensions/Blocks/Recommendation/extension.js"),
20
- "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
21
- "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
22
- "items-block": null
23
- // TODO: Add ItemsBlock extension when available
24
- }, a = (n) => {
25
- if (!n || !n.length)
26
- return {};
27
- const o = {};
28
- return n.forEach((e) => {
29
- const t = l[e];
30
- t && (o[t] = !1);
31
- }), o;
32
- }, r = async (n) => !n || !n.length ? [] : (await Promise.all(
33
- n.map(async (e) => {
34
- const t = c[e];
35
- return t ? (await t()).default : null;
36
- })
37
- )).filter((e) => e !== null), s = () => ({
38
- getStripoBlocksConfig: async () => {
39
- var e;
40
- const o = (e = window.GuidoConfig) == null ? void 0 : e.blocks;
41
- return {
42
- baseBlocks: a(o == null ? void 0 : o.excludeDefaults),
43
- extensions: await r(o == null ? void 0 : o.includeCustoms)
44
- };
45
- }
46
- });
47
- export {
48
- s as useBlocksConfig
49
- };
@@ -1,293 +0,0 @@
1
- var h = Object.defineProperty;
2
- var T = (A, e, t) => e in A ? h(A, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : A[e] = t;
3
- var m = (A, e, t) => T(A, typeof e != "symbol" ? e + "" : e, t);
4
- import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/migrationTemplate.js";
5
- import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/templateUtils.js";
6
- class w {
7
- constructor() {
8
- m(this, "parser");
9
- this.parser = new DOMParser();
10
- }
11
- migrate(e) {
12
- try {
13
- const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
14
- 'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
15
- );
16
- return s.length === 0 ? e : (s.forEach((o) => {
17
- const l = o.getAttribute("id"), r = this.extractBgColor(o), i = this.extractTitle(o), u = this.extractProductRows(o), c = P.replace("{-{-TITLE-}-}", i).replace("{-{-PRODUCT_ROWS-}-}", u), a = this.parser.parseFromString(
18
- `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
19
- "text/html"
20
- ).querySelector(".ins-recommendation-v3-block-v2");
21
- a && o.parentNode && (l && a.setAttribute("id", l), r && a.setAttribute("bgcolor", r), o.parentNode.replaceChild(a, o));
22
- }), t.documentElement.outerHTML);
23
- } catch (t) {
24
- return console.error("RecommendationMigrator failed:", t), e;
25
- }
26
- }
27
- /**
28
- * Extracts background color from old block
29
- * @param block - The old recommendation block element
30
- * @returns The background color value or empty string
31
- */
32
- extractBgColor(e) {
33
- const t = e.getAttribute("bgcolor");
34
- if (t)
35
- return t.trim();
36
- const s = e.getAttribute("style");
37
- if (s) {
38
- const o = s.match(/background-color\s*:\s*([^;]+)/i);
39
- if (o && o[1])
40
- return o[1].trim();
41
- }
42
- return "";
43
- }
44
- /**
45
- * Extracts background color from product card wrapper element
46
- * @param cardElement - The product card TD element
47
- * @returns The background color value or empty string
48
- */
49
- extractCardBgColor(e) {
50
- const t = e.getAttribute("bgcolor");
51
- if (t)
52
- return t.trim();
53
- const s = e.getAttribute("style");
54
- if (s) {
55
- const o = s.match(/background-color\s*:\s*([^;]+)/i);
56
- if (o && o[1])
57
- return o[1].trim();
58
- }
59
- return "";
60
- }
61
- /**
62
- * Extracts title from old block and converts to new structure
63
- * @param block - The old recommendation block element
64
- * @returns HTML string for the title block
65
- */
66
- extractTitle(e) {
67
- var a, g;
68
- const t = e.querySelector(".ext-recommendation-title");
69
- if (!t)
70
- return this.buildTitleBlock({
71
- text: "You May Also Like!",
72
- isBold: !0,
73
- isItalic: !1,
74
- align: "center",
75
- styles: "font-size: 28px; color: #333333;"
76
- });
77
- const s = t.querySelector("p");
78
- if (!s) {
79
- const p = ((a = t.textContent) == null ? void 0 : a.trim()) || "You May Also Like!", b = t.getAttribute("align") || "center";
80
- return this.buildTitleBlock({
81
- text: p,
82
- isBold: !0,
83
- isItalic: !1,
84
- align: b,
85
- styles: "font-size: 28px; color: #333333;"
86
- });
87
- }
88
- const o = ((g = s.textContent) == null ? void 0 : g.trim()) || "You May Also Like!", l = t.getAttribute("align") || s.getAttribute("align") || "center", r = s.getAttribute("style") || "", i = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), n = this.convertInlineToBlock(c);
89
- return this.buildTitleBlock({
90
- text: o,
91
- isBold: i,
92
- isItalic: u,
93
- align: l,
94
- styles: n
95
- });
96
- }
97
- /**
98
- * Extracts product configuration from old block and generates new product rows
99
- * @param block - The old recommendation block element
100
- * @returns HTML string for product rows
101
- */
102
- extractProductRows(e) {
103
- const t = this.extractProductConfig(e);
104
- if (!t)
105
- return console.warn("[RecommendationMigrator] No product config found, using defaults"), this.generateProductRows(6, 3, {});
106
- const { totalCount: s, productsPerRow: o } = t, l = this.extractProductStyles(e);
107
- return this.generateProductRows(s, o, l);
108
- }
109
- /**
110
- * Extracts Stripo padding/margin utility classes from a class string
111
- * @param classString - Space-separated class string from element
112
- * @returns Filtered Stripo utility classes as a space-separated string
113
- */
114
- extractStripoClasses(e) {
115
- return e ? e.split(/\s+/).filter((o) => /^es-(p\d+|m[-\d])/.test(o)).join(" ") : "";
116
- }
117
- /**
118
- * Extracts product configuration from old block
119
- * @param block - The old recommendation block element
120
- * @returns Object with totalCount and productsPerRow, or null if parsing fails
121
- */
122
- extractProductConfig(e) {
123
- const t = e.getAttribute("esd-dev-product-config");
124
- if (!t)
125
- return null;
126
- try {
127
- const s = this.unescapeJsonString(t), o = JSON.parse(s);
128
- return {
129
- totalCount: o.totalCount ?? 6,
130
- productsPerRow: o.rowCount ?? 3
131
- };
132
- } catch (s) {
133
- return console.error("[RecommendationMigrator] Failed to parse product config:", s), console.error(
134
- "[RecommendationMigrator] Error details:",
135
- s instanceof Error ? s.message : String(s)
136
- ), null;
137
- }
138
- }
139
- /**
140
- * Decodes HTML entities from JSON string
141
- * @param text - The encoded string
142
- * @returns Decoded string
143
- */
144
- unescapeJsonString(e) {
145
- return e.replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/\\\\"/g, "'");
146
- }
147
- /**
148
- * Generates product rows using prepareProductRows with default product data
149
- * @param totalCount - Total number of products to display
150
- * @param productsPerRow - Number of products in each row
151
- * @param extractedStyles - Styles extracted from old product elements
152
- * @returns HTML string for product rows with applied styles
153
- */
154
- generateProductRows(e, t, s) {
155
- const o = q(), l = [];
156
- for (let i = 0; i < e; i++) {
157
- const u = o[i % o.length];
158
- l.push({ ...u });
159
- }
160
- let r = S(l, t);
161
- return r = this.applyExtractedStyles(r, s), r;
162
- }
163
- /**
164
- * Extracts styles from old product elements
165
- * @param block - The old recommendation block element
166
- * @returns Object with extracted styles for each element type
167
- */
168
- extractProductStyles(e) {
169
- const t = {}, s = e.querySelector(".product-card");
170
- if (!s)
171
- return console.warn("[RecommendationMigrator] No product card found, using default styles"), t;
172
- const o = this.extractCardBgColor(s);
173
- o && (t.cardBgColor = o);
174
- const l = s.querySelector(".ext-product-image");
175
- if (l) {
176
- const n = l.querySelector("img"), a = n == null ? void 0 : n.getAttribute("width"), g = l.getAttribute("style") || "", p = l.getAttribute("align") || "center", b = l.getAttribute("class") || "", d = this.extractStripoClasses(b);
177
- t.imageWidth = a || "120", t.imageAlign = p, t.imageTdStyle = g, t.imageClasses = d;
178
- }
179
- const r = s.querySelector(".ext-product-name");
180
- if (r) {
181
- const n = r.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = r.getAttribute("align") || "center", p = r.getAttribute("style") || "", b = r.getAttribute("class") || "", d = this.extractStripoClasses(b);
182
- t.nameStyle = a, t.nameAlign = g, t.nameTdStyle = p, t.nameClasses = d;
183
- }
184
- const i = s.querySelector(".ext-product-price");
185
- if (i) {
186
- const n = i.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = i.getAttribute("align") || "center", p = i.getAttribute("style") || "", b = i.getAttribute("class") || "", d = this.extractStripoClasses(b);
187
- t.priceStyle = a, t.priceAlign = g, t.priceTdStyle = p, t.priceClasses = d;
188
- }
189
- const u = s.querySelector(".ext-product-original-price");
190
- if (u) {
191
- const n = u.querySelector("p"), a = (n == null ? void 0 : n.getAttribute("style")) || "", g = u.getAttribute("align") || "center", p = u.getAttribute("style") || "", b = u.getAttribute("class") || "", d = this.extractStripoClasses(b);
192
- t.oldPriceStyle = a, t.oldPriceAlign = g, t.oldPriceTdStyle = p, t.oldPriceClasses = d;
193
- }
194
- const c = s.querySelector(".ext-product-button");
195
- if (c) {
196
- const n = c.querySelector(".es-button-border"), a = c.querySelector("a.es-button"), g = (n == null ? void 0 : n.getAttribute("style")) || "", p = (a == null ? void 0 : a.getAttribute("style")) || "", b = c.getAttribute("align") || "center", d = c.getAttribute("style") || "", f = c.getAttribute("class") || "", C = this.extractStripoClasses(f), y = ((c == null ? void 0 : c.textContent) || "").trim();
197
- t.buttonBorderStyle = g, t.buttonLinkStyle = p, t.buttonAlign = b, t.buttonTdStyle = d, t.buttonClasses = C, t.buttonText = y;
198
- }
199
- return t;
200
- }
201
- /**
202
- * Applies extracted styles to the generated HTML
203
- * @param html - The generated HTML from prepareProductRows
204
- * @param extractedStyles - Styles extracted from old product elements
205
- * @returns HTML with applied styles
206
- */
207
- applyExtractedStyles(e, t) {
208
- if (!t || Object.keys(t).length === 0)
209
- return e;
210
- const s = this.parser.parseFromString(`<table>${e}</table>`, "text/html");
211
- t.cardBgColor && s.querySelectorAll(".product-attribute-cell").forEach((r) => {
212
- r.setAttribute("bgcolor", t.cardBgColor);
213
- }), (t.imageWidth || t.imageAlign || t.imageTdStyle || t.imageClasses) && s.querySelectorAll(".product-image").forEach((r) => {
214
- if (t.imageAlign && r.setAttribute("align", t.imageAlign), t.imageTdStyle && r.setAttribute("style", t.imageTdStyle), t.imageClasses) {
215
- const c = `${r.getAttribute("class") || ""} ${t.imageClasses}`.trim();
216
- r.setAttribute("class", c);
217
- }
218
- const i = r.querySelector("img");
219
- i && t.imageWidth && i.setAttribute("width", t.imageWidth);
220
- }), (t.nameStyle || t.nameAlign || t.nameTdStyle || t.nameClasses) && s.querySelectorAll(".product-name").forEach((r) => {
221
- if (t.nameAlign && r.setAttribute("align", t.nameAlign), t.nameTdStyle && r.setAttribute("style", t.nameTdStyle), t.nameClasses) {
222
- const c = `${r.getAttribute("class") || ""} ${t.nameClasses}`.trim();
223
- r.setAttribute("class", c);
224
- }
225
- const i = r.querySelector("p");
226
- i && t.nameStyle && i.setAttribute("style", t.nameStyle);
227
- }), (t.priceStyle || t.priceAlign || t.priceTdStyle || t.priceClasses) && s.querySelectorAll(".product-price").forEach((r) => {
228
- if (t.priceAlign && r.setAttribute("align", t.priceAlign), t.priceTdStyle && r.setAttribute("style", t.priceTdStyle), t.priceClasses) {
229
- const c = `${r.getAttribute("class") || ""} ${t.priceClasses}`.trim();
230
- r.setAttribute("class", c);
231
- }
232
- const i = r.querySelector("p");
233
- i && t.priceStyle && i.setAttribute("style", t.priceStyle);
234
- }), (t.oldPriceStyle || t.oldPriceAlign || t.oldPriceTdStyle || t.oldPriceClasses) && s.querySelectorAll(".product-old-price").forEach((r) => {
235
- if (t.oldPriceAlign && r.setAttribute("align", t.oldPriceAlign), t.oldPriceTdStyle && r.setAttribute("style", t.oldPriceTdStyle), t.oldPriceClasses) {
236
- const c = `${r.getAttribute("class") || ""} ${t.oldPriceClasses}`.trim();
237
- r.setAttribute("class", c);
238
- }
239
- const i = r.querySelector("p");
240
- i && t.oldPriceStyle && i.setAttribute("style", t.oldPriceStyle);
241
- }), (t.buttonBorderStyle || t.buttonLinkStyle || t.buttonAlign || t.buttonTdStyle || t.buttonClasses) && s.querySelectorAll(".product-button").forEach((r) => {
242
- if (t.buttonAlign && r.setAttribute("align", t.buttonAlign), t.buttonTdStyle && r.setAttribute("style", t.buttonTdStyle), t.buttonClasses) {
243
- const n = `${r.getAttribute("class") || ""} ${t.buttonClasses}`.trim();
244
- r.setAttribute("class", n);
245
- }
246
- const i = r.querySelector(".es-button-border");
247
- i && t.buttonBorderStyle && i.setAttribute("style", t.buttonBorderStyle);
248
- const u = r.querySelector("a.es-button");
249
- u && (t.buttonLinkStyle && u.setAttribute("style", t.buttonLinkStyle), t.buttonText && (u.textContent = t.buttonText));
250
- });
251
- const o = s.querySelector("table");
252
- return (o == null ? void 0 : o.innerHTML) || e;
253
- }
254
- /**
255
- * Builds title block with proper structure
256
- */
257
- buildTitleBlock(e) {
258
- let t = e.text;
259
- e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
260
- const s = e.align ? ` align="${e.align}"` : "", o = e.styles ? ` style="${e.styles}"` : "";
261
- return `
262
- <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r"${s}>
263
- <p path="1"${o}>
264
- ${t}
265
- </p>
266
- </td>
267
- `;
268
- }
269
- /**
270
- * Removes specified style properties from a style string
271
- */
272
- removeStyleProperties(e, t) {
273
- return e ? t.reduce((o, l) => {
274
- const r = new RegExp(`${l}\\s*:\\s*[^;]*;?`, "gi");
275
- return o.replace(r, "");
276
- }, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
277
- }
278
- /**
279
- * Converts inline display to block display
280
- */
281
- convertInlineToBlock(e) {
282
- if (!e)
283
- return "";
284
- let t = e.replace(/display\s*:\s*inline/gi, "display: block");
285
- return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").replace(/"/g, "'").trim();
286
- }
287
- }
288
- function k(A) {
289
- return new w().migrate(A);
290
- }
291
- export {
292
- k as migrateRecommendation
293
- };
@@ -1,6 +0,0 @@
1
- const t = "tr-TR", T = "default", L = "UTC";
2
- export {
3
- T as DEFAULT,
4
- t as DEFAULT_LOCALE,
5
- L as DEFAULT_TZ
6
- };