@useinsider/guido 1.0.3-beta.c8da346 → 1.0.3-beta.cc03cd5

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 (160) hide show
  1. package/README.md +3 -141
  2. package/dist/components/Guido.vue.js +10 -12
  3. package/dist/components/Guido.vue2.js +77 -82
  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/onboarding/NewVersionPopup.vue.js +9 -9
  8. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +17 -30
  9. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +10 -12
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -19
  11. package/dist/composables/useStripo.js +48 -39
  12. package/dist/config/migrator/index.js +6 -7
  13. package/dist/enums/defaults.js +8 -15
  14. package/dist/enums/onboarding.js +1 -2
  15. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  16. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  17. package/dist/extensions/Blocks/RadioButton/template.js +6 -6
  18. package/dist/extensions/DynamicContent/dynamic-content-modal.js +13 -20
  19. package/dist/extensions/DynamicContent/dynamic-content.js +33 -145
  20. package/dist/guido.css +1 -1
  21. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -311
  22. package/dist/package.json.js +1 -1
  23. package/dist/services/stripoApi.js +1 -1
  24. package/dist/src/@types/generic.d.ts +4 -43
  25. package/dist/src/components/Guido.vue.d.ts +2 -3
  26. package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +1 -3
  27. package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +1 -3
  28. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  29. package/dist/src/enums/onboarding.d.ts +0 -1
  30. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -8
  31. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -50
  32. package/dist/src/stores/config.d.ts +1 -8
  33. package/dist/src/stores/dynamic-content.d.ts +2 -2
  34. package/dist/src/stores/editor.d.ts +0 -21
  35. package/dist/src/utils/dateUtil.d.ts +0 -21
  36. package/dist/src/utils/genericUtil.d.ts +0 -1
  37. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  38. package/dist/static/styles/customEditorStyle.css.js +0 -5
  39. package/dist/stores/editor.js +1 -2
  40. package/dist/utils/dateUtil.js +3 -24
  41. package/dist/utils/genericUtil.js +7 -8
  42. package/package.json +4 -4
  43. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +0 -28
  44. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +0 -38
  45. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +0 -17
  46. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +0 -37
  47. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +0 -20
  48. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +0 -44
  49. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.js +0 -17
  50. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +0 -27
  51. package/dist/composables/useBlocksConfig.js +0 -49
  52. package/dist/config/migrator/recommendationMigrator.js +0 -293
  53. package/dist/enums/date.js +0 -6
  54. package/dist/enums/extensions/recommendationBlock.js +0 -80
  55. package/dist/extensions/Blocks/Recommendation/block.js +0 -30
  56. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -103
  57. package/dist/extensions/Blocks/Recommendation/constants.js +0 -5
  58. package/dist/extensions/Blocks/Recommendation/control.js +0 -306
  59. package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -13
  60. package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -13
  61. package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -13
  62. package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -13
  63. package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -13
  64. package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -13
  65. package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -13
  66. package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -13
  67. package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -13
  68. package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -13
  69. package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -13
  70. package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +0 -13
  71. package/dist/extensions/Blocks/Recommendation/controls/image/size.js +0 -13
  72. package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -13
  73. package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -13
  74. package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -13
  75. package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -13
  76. package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -13
  77. package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -13
  78. package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -13
  79. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +0 -13
  80. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +0 -13
  81. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +0 -13
  82. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +0 -13
  83. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +0 -13
  84. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +0 -13
  85. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +0 -13
  86. package/dist/extensions/Blocks/Recommendation/controls/price/align.js +0 -13
  87. package/dist/extensions/Blocks/Recommendation/controls/price/background.js +0 -13
  88. package/dist/extensions/Blocks/Recommendation/controls/price/color.js +0 -13
  89. package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +0 -13
  90. package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +0 -13
  91. package/dist/extensions/Blocks/Recommendation/controls/price/size.js +0 -13
  92. package/dist/extensions/Blocks/Recommendation/controls/price/style.js +0 -13
  93. package/dist/extensions/Blocks/Recommendation/extension.js +0 -45
  94. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +0 -51
  95. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +0 -19
  96. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +0 -117
  97. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +0 -266
  98. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -160
  99. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -152
  100. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -180
  101. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +0 -28
  102. package/dist/extensions/Blocks/common-control.js +0 -184
  103. package/dist/services/recommendationApi.js +0 -43
  104. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +0 -19
  105. package/dist/src/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts +0 -2
  106. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +0 -2
  107. package/dist/src/components/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +0 -16
  108. package/dist/src/composables/useBlocksConfig.d.ts +0 -11
  109. package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
  110. package/dist/src/enums/date.d.ts +0 -4
  111. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -16
  112. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -11
  113. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -28
  114. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -51
  115. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -35
  116. package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
  117. package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
  118. package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
  119. package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
  120. package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
  121. package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
  122. package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
  123. package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
  124. package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
  125. package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
  126. package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
  127. package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +0 -5
  128. package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +0 -5
  129. package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
  130. package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
  131. package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
  132. package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
  133. package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
  134. package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
  135. package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
  136. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +0 -5
  137. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +0 -5
  138. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +0 -5
  139. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +0 -5
  140. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +0 -5
  141. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +0 -5
  142. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +0 -5
  143. package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +0 -5
  144. package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +0 -5
  145. package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +0 -5
  146. package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +0 -5
  147. package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +0 -5
  148. package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +0 -5
  149. package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +0 -5
  150. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -2
  151. package/dist/src/extensions/Blocks/Recommendation/iconsRegistry.d.ts +0 -4
  152. package/dist/src/extensions/Blocks/Recommendation/settingsPanel.d.ts +0 -4
  153. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -555
  154. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  155. package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
  156. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -44
  157. package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +0 -7
  158. package/dist/src/extensions/Blocks/common-control.d.ts +0 -87
  159. package/dist/src/mock/api/recommendation.d.ts +0 -2
  160. package/dist/src/services/recommendationApi.d.ts +0 -6
@@ -1,20 +0,0 @@
1
- import s from "./Filters.vue2.js";
2
- /* empty css */
3
- import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
5
- var i = this, e = i._self._c, t = i._self._setupProxy;
6
- return e("div", { staticClass: "d-f f-d-c gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e(t.InSegments, { staticClass: "f-g-1 w-1", attrs: { id: "guido__filter-group-segments", "segment-list": t.filterGroupList, selected: t.selectedFilterGroup, "with-icon": !1 }, on: { click: t.changeFilterGroup } }), e(t.InButtonV2, { staticClass: "w-20-s f-g-1", attrs: { id: "guido__add-filter-group-button", "left-icon": "line-plus-netural", type: "secondary", "disabled-status": t.isMaxFilterGroupCount, "label-text": t.trans("smart-recommender.add-filter-group"), "tooltip-text": t.isMaxFilterGroupCount ? t.trans("email-editor.add-filter-tooltip") : "" }, on: { click: t.handleAddFilterGroup } })], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e("div", { staticClass: "d-f a-i-c" }, [t.selectedFilterGroup > 1 ? e(t.LogicAdapter, { staticClass: "mr-2" }) : i._e(), e("p", [i._v(" " + i._s(t.trans("email-editor.filter-group")) + " " + i._s(t.selectedFilterGroup) + " ")])], 1), t.hasRemoveFilterButton ? e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: t.handleDeleteFilterGroup } }) : i._e()], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b f-d-c" }, i._l(t.selectedFilterGroupFilters, function(l, r) {
7
- return e(t.FilterItem, { key: r, attrs: { filter: l, "has-logic-adapter": t.hasLogicAdapter && r !== t.selectedFilterGroupFilters.length - 1, index: r }, on: { "delete-filter": t.handleDeleteFilter } });
8
- }), 1), e("div", { staticClass: "d-f a-i-c j-c-c mt-3" }, [e(t.InButtonV2, { staticClass: "w-11-s", attrs: { id: "filter-group--add-filter-button", "left-icon": "line-plus-netural", type: "subtle-primary", "label-text": t.trans("smart-recommender.add-filter-condition") }, on: { click: t.handleAddFilter } })], 1)]);
9
- }, d = [], n = /* @__PURE__ */ a(
10
- s,
11
- o,
12
- d,
13
- !1,
14
- null,
15
- "1ccb6d4a"
16
- );
17
- const _ = n.exports;
18
- export {
19
- _ as default
20
- };
@@ -1,44 +0,0 @@
1
- import { defineComponent as m, computed as o, ref as h } from "vue";
2
- import { useTranslations as G } from "../../../../composables/useTranslations.js";
3
- import { useRecommendationExtensionStore as g } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { InButtonV2 as v, InSegments as f } from "@useinsider/design-system-vue";
5
- import _ from "./FilterItem.vue.js";
6
- import A from "./LogicAdapter.vue.js";
7
- const E = /* @__PURE__ */ m({
8
- __name: "Filters",
9
- setup(R) {
10
- const i = G(), l = g(), u = o(() => l.getFilterGroupCount), t = o(() => Array.from({ length: u.value }, (e, a) => ({
11
- text: (a + 1).toString(),
12
- value: a + 1
13
- }))), r = h(1), s = (e) => {
14
- r.value = e;
15
- }, d = () => {
16
- const e = t.value.length + 1;
17
- console.debug("handleAddFilterGroup", e), t.value.push({
18
- text: e.toString(),
19
- value: e
20
- }), l.addFilterGroup(e);
21
- }, p = o(() => t.value.length >= 3), n = o(() => l.getSelectedFilterGroup(r.value)), c = o(() => n.value.length > 1), F = o(() => t.value.length > 1);
22
- return { __sfc: !0, MAX_FILTER_GROUP_COUNT: 3, trans: i, store: l, filterGroupCount: u, filterGroupList: t, selectedFilterGroup: r, changeFilterGroup: s, handleAddFilterGroup: d, isMaxFilterGroupCount: p, selectedFilterGroupFilters: n, hasLogicAdapter: c, hasRemoveFilterButton: F, handleAddFilter: () => {
23
- l.addFilter({
24
- type: "standardFilter",
25
- attribute: "",
26
- operatorReplace: "",
27
- operator: "",
28
- innerGroupOperator: "*",
29
- outerGroupOperator: "*",
30
- filterNumber: n.value.length + 1,
31
- filterGroup: r.value,
32
- isValid: !1,
33
- value: ""
34
- }), console.debug("handleAddFilter");
35
- }, handleDeleteFilter: (e) => {
36
- console.debug("handleDeleteFilter: ", e), l.deleteFilter(e);
37
- }, handleDeleteFilterGroup: () => {
38
- t.value.length !== 1 && (console.debug("handleDeleteFilterGroup"), t.value.splice(r.value - 1, 1), r.value > 1 && r.value--);
39
- }, InSegments: f, InButtonV2: v, FilterItem: _, LogicAdapter: A };
40
- }
41
- });
42
- export {
43
- E as default
44
- };
@@ -1,17 +0,0 @@
1
- import s from "./LogicAdapter.vue2.js";
2
- import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
- var o = function() {
4
- var t = this, r = t._self._c, e = t._self._setupProxy;
5
- return r(e.InSegments, { staticClass: "guido__logic-adapter f-g-1", attrs: { "segment-list": e.logicAdapterList, selected: e.selectedLogicAdapter, "with-icon": !1 }, on: { click: e.changeLogicAdapter } });
6
- }, a = [], c = /* @__PURE__ */ n(
7
- s,
8
- o,
9
- a,
10
- !1,
11
- null,
12
- null
13
- );
14
- const p = c.exports;
15
- export {
16
- p as default
17
- };
@@ -1,27 +0,0 @@
1
- import { defineComponent as s, ref as n } from "vue";
2
- import { InSegments as p } from "@useinsider/design-system-vue";
3
- const l = /* @__PURE__ */ s({
4
- __name: "LogicAdapter",
5
- props: {
6
- logic: null
7
- },
8
- emits: ["change"],
9
- setup(r, { emit: e }) {
10
- const t = r, a = n([
11
- {
12
- text: "and",
13
- value: "*"
14
- },
15
- {
16
- text: "or",
17
- value: "|"
18
- }
19
- ]), o = n(t.logic || "*");
20
- return { __sfc: !0, logicAdapterList: a, emit: e, props: t, selectedLogicAdapter: o, changeLogicAdapter: (c) => {
21
- o.value = c, e("change", c);
22
- }, InSegments: p };
23
- }
24
- });
25
- export {
26
- l as default
27
- };
@@ -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
- };
@@ -1,80 +0,0 @@
1
- const s = {
2
- RECOMMENDATION_API_URL: "http://recommendationv2.api.useinsider.com"
3
- }, i = [
4
- { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
5
- { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
6
- { id: 13, key: "userBased", name: "User Based", path: "user-based" },
7
- { id: 36, key: "highestDiscounted", name: "Highest Discounted Items", path: "highest-discounted" },
8
- { id: 38, key: "manualMerchandising", name: "Manual Merchandising", path: "manual-merchandising" },
9
- { id: 39, key: "newArrivals", name: "New Arrivals", path: "new-arrivals" },
10
- { id: 40, key: "trendingProducts", name: "Trending Products", path: "trending" },
11
- { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
12
- { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
13
- { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
14
- ], u = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], l = [
15
- { text: "after the amount", value: "1" },
16
- { text: "before the amount", value: "0" }
17
- ], c = [
18
- { text: "dot(.)", value: "." },
19
- { text: "comma(,)", value: "," }
20
- ], d = [
21
- { text: "0", value: "0" },
22
- { text: "1", value: "1" },
23
- { text: "2", value: "2" },
24
- { text: "3", value: "3" },
25
- { text: "4", value: "4" },
26
- { text: "5", value: "5" }
27
- ], e = [
28
- { text: "is exactly", value: "=" },
29
- { text: "contains", value: "~" },
30
- { text: "does not contain", value: "!~" },
31
- { text: "any of", value: "||" }
32
- ], a = [
33
- { text: "is exactly", value: "=" },
34
- { text: "is not exactly", value: "!==" },
35
- { text: "contains", value: "~" },
36
- { text: "does not contain", value: "!~" },
37
- { text: "any of", value: "||" }
38
- ], r = [
39
- { text: "is equal to", value: "=" },
40
- { text: "is greater than", value: ">" },
41
- { text: "is less than", value: "<" }
42
- ], o = [
43
- { text: "is equal to", value: "=" },
44
- { text: "after", value: ">" },
45
- { text: "before", value: "<" }
46
- ], n = [
47
- { text: "true", value: "==" },
48
- { text: "false", value: "!=" }
49
- ], p = (t) => {
50
- if (!t)
51
- return e;
52
- switch (t) {
53
- case "Boolean":
54
- return n;
55
- case "Date":
56
- return o;
57
- case "Number":
58
- return r;
59
- case "String":
60
- return e;
61
- case "Strings":
62
- return a;
63
- default:
64
- return e;
65
- }
66
- };
67
- export {
68
- u as PriceAttributes,
69
- i as RecommendationFeedSourceMaps,
70
- s as URLS,
71
- d as currencyDecimalCounts,
72
- l as currencyLocationMaps,
73
- c as currencyOperators,
74
- p as getOperatorOptions,
75
- a as operatorOptionsForArrayOfStrings,
76
- n as operatorOptionsForBooleans,
77
- o as operatorOptionsForDates,
78
- r as operatorOptionsForNumbers,
79
- e as operatorOptionsForStrings
80
- };
@@ -1,30 +0,0 @@
1
- import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { getDefaultTemplate as o } from "./templates/blockTemplate.js";
3
- const n = "recommendation-block";
4
- class m extends e {
5
- constructor() {
6
- super();
7
- }
8
- getId() {
9
- return n;
10
- }
11
- getIcon() {
12
- return "recommendation-icon";
13
- }
14
- getBlockCompositionType() {
15
- return t.CONTAINER;
16
- }
17
- getName() {
18
- return this.api.translate("Recommendation Block");
19
- }
20
- getDescription() {
21
- return this.api.translate("Recommendation Block Title Description");
22
- }
23
- getTemplate() {
24
- return o();
25
- }
26
- }
27
- export {
28
- n as BLOCK_ID,
29
- m as RecommendationBlock
30
- };