@useinsider/guido 3.2.0-beta.e01b42a → 3.2.0-beta.e69fb3b

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 (279) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/@types/config/validator.js +27 -34
  4. package/dist/components/Guido.vue.js +4 -4
  5. package/dist/components/Guido.vue2.js +87 -82
  6. package/dist/components/organisms/base/Toaster.vue2.js +10 -11
  7. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -12
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  9. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  10. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +6 -6
  11. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +9 -15
  12. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +31 -40
  13. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +19 -20
  14. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +11 -14
  15. package/dist/components/organisms/header/EditorActions.vue.js +12 -13
  16. package/dist/components/organisms/header/EditorActions.vue2.js +51 -40
  17. package/dist/components/organisms/header/HeaderWrapper.vue2.js +12 -15
  18. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -19
  19. package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -11
  20. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  21. package/dist/components/organisms/header/RightSlot.vue2.js +13 -13
  22. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +11 -12
  23. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +49 -31
  24. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +12 -13
  25. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +36 -38
  26. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +12 -13
  27. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +47 -51
  28. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +18 -21
  29. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +27 -31
  30. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +12 -13
  31. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +33 -46
  32. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +11 -12
  33. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +20 -21
  34. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -18
  35. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +9 -10
  36. package/dist/composables/useActionsApi.js +37 -38
  37. package/dist/composables/useBlocksConfig.js +26 -26
  38. package/dist/composables/useFullStoryBridge.js +13 -0
  39. package/dist/composables/useHtmlCompiler.js +34 -24
  40. package/dist/composables/useHtmlValidator.js +91 -97
  41. package/dist/composables/useHttp.js +30 -30
  42. package/dist/composables/usePartner.js +1 -1
  43. package/dist/composables/usePreviewMode.js +20 -16
  44. package/dist/composables/useRecommendation.js +14 -15
  45. package/dist/composables/useRibbonOffset.js +21 -0
  46. package/dist/composables/useSave.js +23 -16
  47. package/dist/composables/useStripo.js +55 -47
  48. package/dist/composables/useSyncModuleExtractor.js +31 -29
  49. package/dist/composables/useTimerClone.js +24 -25
  50. package/dist/composables/useTranslations.js +2 -3
  51. package/dist/composables/useValidation.js +7 -8
  52. package/dist/composables/validators/useLiquidValidator.js +42 -0
  53. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  54. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  55. package/dist/config/compiler/unsubscribeCompilerRules.js +45 -44
  56. package/dist/config/compiler/utils/recommendationCompilerUtils.js +51 -46
  57. package/dist/config/migrator/checkboxMigrator.js +23 -22
  58. package/dist/config/migrator/couponBlockMigrator.js +18 -19
  59. package/dist/config/migrator/itemsBlockMigrator.js +87 -89
  60. package/dist/config/migrator/radioButtonMigrator.js +19 -18
  61. package/dist/config/migrator/recommendationMigrator.js +107 -110
  62. package/dist/config/migrator/unsubscribeMigrator.js +10 -11
  63. package/dist/enums/extensions/recommendationBlock.js +14 -11
  64. package/dist/enums/onboarding.js +7 -2
  65. package/dist/enums/recommendation.js +2 -2
  66. package/dist/enums/unsubscribe.js +33 -27
  67. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  68. package/dist/extensions/Blocks/Items/block.js +9 -9
  69. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -14
  70. package/dist/extensions/Blocks/Items/controls/cardComposition.js +89 -97
  71. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -14
  72. package/dist/extensions/Blocks/Items/controls/name/trimming.js +23 -24
  73. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +13 -14
  74. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +44 -47
  75. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +38 -38
  76. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +11 -11
  77. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +38 -40
  78. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +35 -35
  79. package/dist/extensions/Blocks/Items/controls/settingsControl.js +155 -162
  80. package/dist/extensions/Blocks/Items/enums/productEnums.js +21 -14
  81. package/dist/extensions/Blocks/Items/template.js +210 -210
  82. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  83. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  84. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +36 -36
  85. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +208 -200
  86. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +23 -20
  87. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  88. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +9 -9
  89. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +19 -20
  90. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +4 -6
  91. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +84 -90
  92. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +18 -18
  93. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +4 -4
  94. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +35 -36
  95. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +127 -126
  96. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +24 -24
  97. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  98. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +24 -24
  99. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +24 -24
  100. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +4 -4
  101. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +4 -4
  102. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +24 -24
  103. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +4 -4
  104. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +4 -4
  105. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +24 -24
  106. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  107. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +50 -50
  108. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +18 -20
  109. package/dist/extensions/Blocks/Recommendation/extension.js +31 -32
  110. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +25 -32
  111. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +72 -69
  112. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -23
  113. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +10 -10
  114. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +28 -27
  115. package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -9
  116. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +26 -25
  117. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  118. package/dist/extensions/Blocks/Recommendation/templates/utils.js +53 -48
  119. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  120. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +13 -16
  121. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  122. package/dist/extensions/Blocks/Unsubscribe/control.js +11 -13
  123. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +16 -18
  124. package/dist/extensions/Blocks/common-control.js +25 -26
  125. package/dist/extensions/DynamicContent/dynamic-content.js +59 -59
  126. package/dist/guido.css +1 -1
  127. package/dist/library.js +11 -12
  128. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +232 -210
  129. package/dist/node_modules/lodash-es/_getValue.js +1 -1
  130. package/dist/node_modules/valibot/dist/index.js +122 -126
  131. package/dist/package.json.js +1 -1
  132. package/dist/services/recommendationApi.js +12 -15
  133. package/dist/services/stripoApi.js +9 -9
  134. package/dist/services/templateLibraryApi.js +49 -48
  135. package/dist/src/@types/config/index.d.ts +1 -1
  136. package/dist/src/@types/config/schemas.d.ts +28 -0
  137. package/dist/src/@types/config/types.d.ts +3 -1
  138. package/dist/src/@types/generic.d.ts +0 -1
  139. package/dist/src/@types/save-as-template.d.ts +1 -0
  140. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  141. package/dist/src/composables/useActionsApi.d.ts +1 -1
  142. package/dist/src/composables/useConfig.d.ts +12 -0
  143. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  144. package/dist/src/composables/useHtmlCompiler.d.ts +1 -2
  145. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  146. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  147. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  148. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  149. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  150. package/dist/src/enums/onboarding.d.ts +6 -0
  151. package/dist/src/enums/unsubscribe.d.ts +5 -0
  152. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  153. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  154. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  155. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  156. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  157. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  158. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  159. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  160. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  161. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  162. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  163. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  164. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  165. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  166. package/dist/src/stores/config.d.ts +108 -0
  167. package/dist/src/stores/dynamic-content.d.ts +3 -3
  168. package/dist/src/stores/onboarding.d.ts +4 -0
  169. package/dist/src/stores/preview.d.ts +3 -0
  170. package/dist/src/utils/genericUtil.d.ts +1 -1
  171. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  172. package/dist/static/styles/base.css.js +7 -2
  173. package/dist/static/styles/components/button.css.js +3 -2
  174. package/dist/static/styles/components/loader.css.js +4 -0
  175. package/dist/stores/config.js +25 -81
  176. package/dist/stores/dynamic-content.js +6 -11
  177. package/dist/stores/onboarding.js +5 -1
  178. package/dist/stores/preview.js +8 -10
  179. package/dist/stores/unsubscribe.js +1 -4
  180. package/dist/utils/dateUtil.js +7 -10
  181. package/dist/utils/genericUtil.js +39 -20
  182. package/dist/utils/htmlCompiler.js +48 -41
  183. package/dist/utils/pairProductVariables.js +13 -14
  184. package/dist/utils/templatePreparation.js +36 -25
  185. package/dist/utils/tooltipUtils.js +4 -5
  186. package/package.json +9 -4
  187. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  188. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  189. package/dist/node_modules/lodash-es/_Set.js +0 -6
  190. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  191. package/dist/node_modules/lodash-es/_Stack.js +0 -18
  192. package/dist/node_modules/lodash-es/_Uint8Array.js +0 -5
  193. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  194. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  195. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +0 -20
  196. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  197. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  198. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  199. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  200. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  201. package/dist/node_modules/lodash-es/_baseFor.js +0 -5
  202. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  203. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  204. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  205. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  206. package/dist/node_modules/lodash-es/_baseIsArguments.js +0 -9
  207. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  208. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  209. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  210. package/dist/node_modules/lodash-es/_baseIsTypedArray.js +0 -12
  211. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  212. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  213. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  214. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  215. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  216. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  217. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  218. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  219. package/dist/node_modules/lodash-es/_baseTimes.js +0 -8
  220. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  221. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  222. package/dist/node_modules/lodash-es/_baseUnary.js +0 -8
  223. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  224. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  225. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  226. package/dist/node_modules/lodash-es/_createBaseFor.js +0 -13
  227. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  228. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  229. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  230. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  231. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  232. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  233. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  234. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  235. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  236. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  237. package/dist/node_modules/lodash-es/_isIndex.js +0 -8
  238. package/dist/node_modules/lodash-es/_isIterateeCall.js +0 -13
  239. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  240. package/dist/node_modules/lodash-es/_isPrototype.js +0 -8
  241. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  242. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  243. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  244. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  245. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  246. package/dist/node_modules/lodash-es/_nodeUtil.js +0 -11
  247. package/dist/node_modules/lodash-es/_overArg.js +0 -8
  248. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  249. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  250. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  251. package/dist/node_modules/lodash-es/_stackClear.js +0 -7
  252. package/dist/node_modules/lodash-es/_stackDelete.js +0 -7
  253. package/dist/node_modules/lodash-es/_stackGet.js +0 -6
  254. package/dist/node_modules/lodash-es/_stackHas.js +0 -6
  255. package/dist/node_modules/lodash-es/_stackSet.js +0 -17
  256. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  257. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  258. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  259. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  260. package/dist/node_modules/lodash-es/get.js +0 -8
  261. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  262. package/dist/node_modules/lodash-es/identity.js +0 -6
  263. package/dist/node_modules/lodash-es/isArguments.js +0 -10
  264. package/dist/node_modules/lodash-es/isArray.js +0 -4
  265. package/dist/node_modules/lodash-es/isArrayLike.js +0 -8
  266. package/dist/node_modules/lodash-es/isBuffer.js +0 -6
  267. package/dist/node_modules/lodash-es/isLength.js +0 -7
  268. package/dist/node_modules/lodash-es/isObjectLike.js +0 -6
  269. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  270. package/dist/node_modules/lodash-es/isTypedArray.js +0 -7
  271. package/dist/node_modules/lodash-es/keys.js +0 -9
  272. package/dist/node_modules/lodash-es/map.js +0 -11
  273. package/dist/node_modules/lodash-es/property.js +0 -10
  274. package/dist/node_modules/lodash-es/range.js +0 -5
  275. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  276. package/dist/node_modules/lodash-es/stubFalse.js +0 -6
  277. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  278. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  279. package/dist/node_modules/lodash-es/toString.js +0 -7
@@ -1,18 +1,18 @@
1
- import { useRecommendation as f } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as P, REGEX as m, VerticalOrientation as g, CSS as e, ATTRIBUTES as a, CONDITIONS as A, HTML as h } from "../../enums/recommendation.js";
3
- import { prepareRecommendationBlocks as D } from "./utils/recommendationCompilerUtils.js";
4
- const G = [
1
+ import { useRecommendation as C } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as h, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as N } from "../../enums/recommendation.js";
3
+ import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
4
+ const w = [
5
5
  {
6
6
  id: "replace-images-with-variable-names",
7
7
  description: "Replacing dummy images with variable names in recommendation module",
8
8
  type: "custom",
9
- processor: (s) => {
10
- let t = s;
11
- return Object.entries(P).forEach(([, l]) => {
12
- Object.entries(l).forEach(([n, o]) => {
13
- t = t.replaceAll(o, `{{${n}}}`);
9
+ processor: (c) => {
10
+ let e = c;
11
+ return Object.entries(h).forEach(([, l]) => {
12
+ Object.entries(l).forEach(([n, s]) => {
13
+ e = e.replaceAll(s, `{{${n}}}`);
14
14
  });
15
- }), t;
15
+ }), e;
16
16
  },
17
17
  priority: 50
18
18
  },
@@ -29,18 +29,18 @@ const G = [
29
29
  id: "add-recommendation-unresponsive-css",
30
30
  description: "Adding recommendation unresponsive css",
31
31
  type: "custom",
32
- processor: (s) => {
33
- const { calculateCardWidth: t, getRecommendationCampaignData: l } = f();
34
- let n = s;
35
- const o = n.match(m.ID);
36
- if (o) {
37
- const d = [];
38
- if (o.forEach((c) => {
39
- const E = /recommendation-id="(.*?)"/i.exec(c), I = E ? E[1].trim() : "", p = l(I);
40
- p.textTrimming && p.orientation === g && d.push(t(p));
41
- }), d.length) {
42
- const c = `width:${Math.min(...d)}px!important;`;
43
- n = n.replace(e.REGULAR_NAME_HEIGHT, `${e.TRIMMED_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.REGULAR_NAME_CONTAINER_HEIGHT, e.TRIMMED_NAME_CONTAINER_CSS).replace(e.RESPONSIVE_NAME_SIZE, `${e.RESPONSIVE_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.RESPONSIVE_NAME_CONTAINER_HEIGHT, e.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
32
+ processor: (c) => {
33
+ const { calculateCardWidth: e, getRecommendationCampaignData: l } = C();
34
+ let n = c;
35
+ const s = n.match(T.ID);
36
+ if (s) {
37
+ const a = [];
38
+ if (s.forEach((i) => {
39
+ const d = /recommendation-id="(.*?)"/i.exec(i), _ = d ? d[1].trim() : "", R = l(_);
40
+ R.textTrimming && R.orientation === M && a.push(e(R));
41
+ }), a.length) {
42
+ const i = `width:${Math.min(...a)}px!important;`;
43
+ n = n.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
44
44
  }
45
45
  }
46
46
  return n;
@@ -51,39 +51,158 @@ const G = [
51
51
  id: "prepare-recommendations",
52
52
  description: "Replacing product data with template variables in recommendation blocks",
53
53
  type: "custom",
54
- processor: (s) => D(s),
54
+ processor: (c) => x(c),
55
55
  priority: 48
56
56
  },
57
57
  {
58
58
  id: "add-discount-conditions",
59
59
  description: "Adding discount conditions to the recommendation block",
60
60
  type: "custom",
61
- processor: (s) => {
62
- let t = s;
63
- const l = t.match(m.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = f();
64
- return l !== null && l.forEach((o) => {
65
- const d = o.match(m.CUSTOM_FIELD);
66
- if (!d)
61
+ processor: (c) => {
62
+ let e = c;
63
+ const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = C();
64
+ return l !== null && l.forEach((s) => {
65
+ const a = s.match(T.CUSTOM_FIELD);
66
+ if (!a)
67
67
  return;
68
- const [c] = d, E = c.match(m.CUSTOM_FIELD_INDEXES_PART), I = c.match(m.CUSTOM_FIELD_NAME_PART), p = o.match(m.ATTRIBUTE_PARAGRAPH_START_TAG);
69
- if (!E || !I || !p)
68
+ const [i] = a, d = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
+ if (!d || !_ || !R)
70
70
  return;
71
- const [u] = E, [R] = I, [_] = p, T = R.substring(1, R.length - 2), S = _.match(m.COMPOSITION) !== null;
72
- let i = c;
73
- if (S) {
74
- const $ = u.substring(2, u.length - 3), r = n($);
75
- T === a.OMNIBUS_PRICE && (r.priceBeforeTextValue && (i = `${r.priceBeforeTextValue}${i}`), r.priceAfterTextValue && (i = `${i}${r.priceAfterTextValue}`)), T === a.OMNIBUS_DISCOUNT && (r.discountBeforeTextValue && (i = `${r.discountBeforeTextValue}${i}`), r.discountAfterTextValue && (i = `${i}${r.discountAfterTextValue}`));
71
+ const [S] = d, [b] = _, [m] = R, o = b.substring(1, b.length - 2), r = m.match(T.COMPOSITION) !== null;
72
+ let t = i;
73
+ if (r) {
74
+ const I = S.substring(2, S.length - 3), p = n(I);
75
+ o === A.OMNIBUS_PRICE && (p.priceBeforeTextValue && (t = `${p.priceBeforeTextValue}${t}`), p.priceAfterTextValue && (t = `${t}${p.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (p.discountBeforeTextValue && (t = `${p.discountBeforeTextValue}${t}`), p.discountAfterTextValue && (t = `${t}${p.discountAfterTextValue}`));
76
76
  }
77
- const N = u.substring(2);
78
- let M = "";
79
- T in A.IF && (M = A.IF[T].replaceAll(`{${a.DISCOUNT}}`, `${N}${a.DISCOUNT}`).replaceAll(`{${a.OMNIBUS_DISCOUNT}}`, `${N}${a.OMNIBUS_DISCOUNT}`).replaceAll(`{${a.OMNIBUS_PRICE}}`, `${N}${a.OMNIBUS_PRICE}`));
80
- const O = `${_}${i}${h.PARAGRAPH_END_TAG}`, C = `${M}${S ? O : o}${A.ELSE}${_}${h.PARAGRAPH_END_TAG}${A.END_IF}`;
81
- t = t.replace(o, C);
82
- }), t;
77
+ const u = S.substring(2);
78
+ let f = "";
79
+ o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${u}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${u}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${u}${A.OMNIBUS_PRICE}`));
80
+ const $ = `${m}${t}${N.PARAGRAPH_END_TAG}`, y = `${f}${r ? $ : s}${g.ELSE}${m}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
81
+ e = e.replace(s, y);
82
+ }), e;
83
83
  },
84
84
  priority: 53
85
+ },
86
+ {
87
+ id: "strip-empty-omnibus-spans",
88
+ description: "Remove empty omnibus text-before and text-after span elements",
89
+ type: "regex",
90
+ pattern: '<span class="omnibus-text-(?:before|after)">\\s*</span>',
91
+ replacement: "",
92
+ flags: "g",
93
+ priority: 54
94
+ },
95
+ {
96
+ id: "strip-recommendation-editor-attributes",
97
+ description: "Strip editor-only attributes from compiled recommendation output",
98
+ type: "custom",
99
+ // Scoped to REC_START/REC_END markers so it cannot strip `product-attr`
100
+ // from Items block elements, which the items compiler rule depends on.
101
+ processor: (c) => {
102
+ const e = /\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"/g;
103
+ return c.replace(
104
+ /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
105
+ (l, n) => `<!--REC_START-->${n.replace(e, "")}<!--REC_END-->`
106
+ );
107
+ },
108
+ priority: 55
109
+ },
110
+ {
111
+ id: "strip-unused-recommendation-classes",
112
+ description: "Remove CSS classes not referenced by any style rule from recommendation elements",
113
+ type: "custom",
114
+ processor: (c) => {
115
+ let e = c.replace(
116
+ / class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
117
+ ""
118
+ );
119
+ return e = e.replaceAll("es-button buy-button", "es-button"), e = e.replaceAll("ins-recommendation-product-container ", ""), e;
120
+ },
121
+ priority: 56
122
+ },
123
+ {
124
+ id: "remove-empty-mobile-layout-artifacts",
125
+ description: "Remove empty mobile container rows and unused mobile layout CSS",
126
+ type: "custom",
127
+ processor: (c) => {
128
+ let e = c;
129
+ return e = e.replace(
130
+ /<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
131
+ ""
132
+ ), /class="[^"]*ins-recommendation-mobile-container/.test(e) || (e = e.replace(
133
+ /\.ins-recommendation-mobile-container\s*\{\s*display\s*:\s*none\s*;?\s*\}/g,
134
+ ""
135
+ ), e = e.replace(
136
+ /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
137
+ (l, n) => {
138
+ const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
139
+ return s.every((d) => a.test(d)) ? "" : l;
140
+ }
141
+ )), e;
142
+ },
143
+ priority: 57
144
+ },
145
+ {
146
+ id: "deduplicate-inline-styles",
147
+ description: "Replace repeated inline styles with CSS class references within recommendation blocks",
148
+ type: "custom",
149
+ processor: (c) => {
150
+ const e = c.replace(
151
+ /<a\b[^>]*\bes-button\b[^>]*>/g,
152
+ (o) => o.replace(
153
+ /([;"]color:)([^;"]+)/g,
154
+ (r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
155
+ )
156
+ ), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
157
+ let a = l.exec(e);
158
+ for (; a !== null; ) {
159
+ let o = n.exec(a[1]);
160
+ for (; o !== null; ) {
161
+ const [, r] = o;
162
+ s.set(r, (s.get(r) || 0) + 1), o = n.exec(a[1]);
163
+ }
164
+ n.lastIndex = 0, a = l.exec(e);
165
+ }
166
+ const i = /* @__PURE__ */ new Map(), d = [];
167
+ let _ = 0;
168
+ if (s.forEach((o, r) => {
169
+ if (o >= 6) {
170
+ const t = `rc${_++}`;
171
+ i.set(r, t), d.push(`.${t}{${r}}`);
172
+ }
173
+ }), i.size === 0) {
174
+ let o = e;
175
+ return o = o.replaceAll("<!--REC_START-->", ""), o = o.replaceAll("<!--REC_END-->", ""), o;
176
+ }
177
+ const R = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), S = (o, r) => `${o.slice(0, -1)} ${r}"`, b = /* @__PURE__ */ new Map();
178
+ i.forEach((o, r) => {
179
+ const t = R(r);
180
+ b.set(r, {
181
+ caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${t}"`, "g"),
182
+ caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
183
+ });
184
+ });
185
+ let m = e.replace("</style>", `${d.join("")}</style>`);
186
+ return m = m.replace(
187
+ /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
188
+ (o, r) => {
189
+ let t = r;
190
+ return i.forEach((u, f) => {
191
+ const $ = b.get(f);
192
+ t = t.replace(
193
+ $.caseA,
194
+ (y, I, p) => S(I, u) + p
195
+ ), t = t.replace(
196
+ $.caseB,
197
+ (y, I, p) => I + S(p, u)
198
+ ), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
199
+ }), t;
200
+ }
201
+ ), m = m.replaceAll("<!--REC_START-->", ""), m = m.replaceAll("<!--REC_END-->", ""), m;
202
+ },
203
+ priority: 58
85
204
  }
86
205
  ];
87
206
  export {
88
- G as recommendationCompilerRules
207
+ w as recommendationCompilerRules
89
208
  };
@@ -1,41 +1,42 @@
1
- import { usePartner as N } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as S, INSIDER_ID as R, URLS as _ } from "../../enums/unsubscribe.js";
1
+ import { usePartner as I } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as S, LINK_TYPES as R, INSIDER_ID as m, URLS as _ } from "../../enums/unsubscribe.js";
3
3
  import { parsePageList as U } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as B } from "../../stores/config.js";
5
- import { useDynamicContentStore as y } from "../../stores/dynamic-content.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useDynamicContentStore as C } from "../../stores/dynamic-content.js";
6
6
  import { useUnsubscribeStore as L } from "../../stores/unsubscribe.js";
7
- const D = [
7
+ import { ProductType as P } from "../../@types/config/schemas.js";
8
+ const $ = [
8
9
  {
9
10
  id: "add-unsubscribe-link-values",
10
11
  description: "Adding unsubscribe link values",
11
12
  type: "custom",
12
- processor: (t) => {
13
- const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.variationId;
14
- if (!a)
15
- return t;
16
- let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`;
18
- return new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
19
- var g;
20
- const m = p.getAttribute("data-unsubscribe-page-list");
21
- if (!m)
13
+ processor: (s) => {
14
+ const { getPartnerName: i } = I(), n = N(), t = C(), E = L(), c = n.variationId;
15
+ if (!c)
16
+ return s;
17
+ const r = S[n.productType] ?? S[P.EMAIL];
18
+ let e = s;
19
+ const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
20
+ let a = !1, l = !1;
21
+ return f.forEach((g) => {
22
+ const u = g.getAttribute("data-unsubscribe-page-list");
23
+ if (!u)
22
24
  return;
23
- const I = U(m), d = ((g = u.templates) == null ? void 0 : g.filter(
24
- (o) => I.includes(o.id)
25
- )) ?? [], E = d.some((o) => o.type === S.UNSUBSCRIBE_LINK_TYPE), b = d.some((o) => o.type === S.PREFERENCES_LINK_TYPE), f = p.outerHTML;
26
- let s = f;
27
- (E || b) && n.selectedDynamicContentList.push({
28
- text: R,
29
- value: R,
30
- fallback: ""
31
- }), E && (s = s.replace(
32
- l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
33
- _.UNSUBSCRIBE_URL + r
34
- )), b && (s = s.replace(
35
- l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
36
- _.PREFERENCES_URL + r
37
- )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), e = e.replace(f, s);
38
- }), e;
25
+ const y = U(u), b = E.templates?.filter(
26
+ (o) => y.includes(o.id)
27
+ ) ?? [];
28
+ a = a || b.some((o) => o.type === R.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === R.PREFERENCES_LINK_TYPE);
29
+ }), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
30
+ text: m,
31
+ value: m,
32
+ fallback: ""
33
+ })), a && (e = e.replace(
34
+ p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
35
+ _.UNSUBSCRIBE_URL + d
36
+ )), l && (e = e.replace(
37
+ p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
38
+ _.PREFERENCES_URL + d
39
+ )), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
39
40
  },
40
41
  priority: 60
41
42
  },
@@ -43,7 +44,7 @@ const D = [
43
44
  id: "remove-data-ogsb-button-styles",
44
45
  description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
45
46
  type: "regex",
46
- pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
47
+ pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
47
48
  replacement: "",
48
49
  flags: "g",
49
50
  priority: 61
@@ -52,25 +53,25 @@ const D = [
52
53
  id: "format-comment-braces",
53
54
  description: "Adding spaces around comment braces for proper formatting",
54
55
  type: "custom",
55
- processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
56
+ processor: (s) => s.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
56
57
  priority: 62
57
58
  },
58
59
  {
59
60
  id: "add-universal-link-flags",
60
61
  description: "Adding universal link flags",
61
62
  type: "custom",
62
- processor: (t) => {
63
- let i = t;
64
- const c = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return c && c.forEach((n) => {
66
- if (n.includes("insEmail=1"))
63
+ processor: (s) => {
64
+ let i = s;
65
+ const n = i.match(/<a[^>]+>(.*?)<\/a>/gm);
66
+ return n && n.forEach((t) => {
67
+ if (t.includes("insEmail=1"))
67
68
  return;
68
- if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
- const r = e.slice(6, e.length - 1).trim();
71
- return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
69
+ if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
70
+ const c = t.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
71
+ const e = r.slice(6, r.length - 1).trim();
72
+ return r.includes("?") || r.includes("#") ? e.slice(-1) === "&" ? r.replace(e, `${e}insEmail=1`) : r.replace(e, `${e}&insEmail=1`) : r.replace(e, `${e}?insEmail=1`);
72
73
  });
73
- i = i.replace(n, a);
74
+ i = i.replace(t, c);
74
75
  }
75
76
  }), i;
76
77
  },
@@ -78,5 +79,5 @@ const D = [
78
79
  }
79
80
  ];
80
81
  export {
81
- D as unsubscribeCompilerRules
82
+ $ as unsubscribeCompilerRules
82
83
  };
@@ -1,22 +1,24 @@
1
- import { useRecommendation as $ } from "../../../composables/useRecommendation.js";
2
- function b(e, u, r, o) {
3
- const n = `{{${e}_${u}_${r}}}`, t = `{{${e}_${u}_currency}}`;
1
+ import { useConfig as S } from "../../../composables/useConfig.js";
2
+ import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
3
+ import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ function m(e, u, r, o, s = "") {
5
+ const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
4
6
  return o === "before" ? `${t} ${n}` : `${n} ${t}`;
5
7
  }
6
- function p(e, u, r, o, n) {
8
+ function b(e, u, r, o, s, n) {
7
9
  switch (u) {
8
10
  case "productImage": {
9
11
  const t = e.querySelector("img");
10
- t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
12
+ t && (t.setAttribute("src", `{{${n}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${r}_${o}_name}}`));
11
13
  const c = e.querySelector("a");
12
- c && c.setAttribute("href", `{{${r}_${o}_url}}`);
14
+ c && c.setAttribute("href", `{{${n}${r}_${o}_url}}`);
13
15
  break;
14
16
  }
15
17
  case "productName": {
16
18
  const t = e.querySelector("p");
17
19
  if (t) {
18
20
  const c = t.querySelector("strong") || t;
19
- c.textContent = `{{${r}_${o}_name}}`;
21
+ c.textContent = `{{${n}${r}_${o}_name}}`;
20
22
  }
21
23
  break;
22
24
  }
@@ -24,7 +26,7 @@ function p(e, u, r, o, n) {
24
26
  const t = e.querySelector("p");
25
27
  if (t) {
26
28
  const c = t.querySelector("strong") || t;
27
- c.textContent = b(r, o, "price", n);
29
+ c.textContent = m(r, o, "price", s, n);
28
30
  }
29
31
  break;
30
32
  }
@@ -32,10 +34,11 @@ function p(e, u, r, o, n) {
32
34
  const t = e.querySelector("p");
33
35
  if (t) {
34
36
  const c = t.querySelector("strong") || t;
35
- c.textContent = b(
37
+ c.textContent = m(
36
38
  r,
37
39
  o,
38
40
  "original_price",
41
+ s,
39
42
  n
40
43
  ), t.setAttribute("product-attr", "discount");
41
44
  }
@@ -43,13 +46,13 @@ function p(e, u, r, o, n) {
43
46
  }
44
47
  case "productButton": {
45
48
  const t = e.querySelector("a");
46
- t && t.setAttribute("href", `{{${r}_${o}_url}}`);
49
+ t && t.setAttribute("href", `{{${n}${r}_${o}_url}}`);
47
50
  break;
48
51
  }
49
52
  case "productOmnibusPrice": {
50
53
  const t = e.querySelector(".omnibus-price-value");
51
54
  if (t) {
52
- t.textContent = `{{${r}_${o}_omnibus_price}}`;
55
+ t.textContent = `{{${n}${r}_${o}_omnibus_price}}`;
53
56
  const c = t.closest("p");
54
57
  c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
55
58
  }
@@ -58,7 +61,7 @@ function p(e, u, r, o, n) {
58
61
  case "productOmnibusDiscount": {
59
62
  const t = e.querySelector(".omnibus-discount-value");
60
63
  if (t) {
61
- t.textContent = `{{${r}_${o}_omnibus_discount}}`;
64
+ t.textContent = `{{${n}${r}_${o}_omnibus_discount}}`;
62
65
  const c = t.closest("p");
63
66
  c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
64
67
  }
@@ -67,66 +70,68 @@ function p(e, u, r, o, n) {
67
70
  default: {
68
71
  const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
69
72
  if (t) {
70
- const c = t.getAttribute("product-attr"), s = t.querySelector("p");
71
- if (s) {
72
- const i = s.querySelector("strong") || s;
73
- i.textContent = `{{${r}_${o}_${c}}}`;
73
+ const c = t.getAttribute("product-attr"), a = t.querySelector("p");
74
+ if (a) {
75
+ const i = a.querySelector("strong") || a;
76
+ i.textContent = `{{${n}${r}_${o}_${c}}}`;
74
77
  }
75
78
  }
76
79
  break;
77
80
  }
78
81
  }
79
82
  }
80
- function S(e, u, r) {
83
+ function q(e, u, r, o) {
81
84
  e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
82
- n.querySelectorAll("[data-attribute-type]").forEach((s) => {
83
- const i = s.getAttribute("data-attribute-type") || "", l = s.querySelectorAll(".attribute-cell");
84
- l.length > 0 ? l.forEach((a) => {
85
- p(a, i, u, t, r);
86
- }) : p(s, i, u, t, r);
85
+ n.querySelectorAll("[data-attribute-type]").forEach((a) => {
86
+ const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
87
+ l.length > 0 ? l.forEach((p) => {
88
+ b(p, i, u, t, r, o);
89
+ }) : b(a, i, u, t, r, o);
87
90
  });
88
91
  });
89
92
  }
90
- function _(e, u, r) {
91
- const o = e.querySelectorAll(".recommendation-product-row");
92
- if (!o.length)
93
+ function g(e, u, r, o) {
94
+ const s = e.querySelectorAll(".recommendation-product-row");
95
+ if (!s.length)
93
96
  return;
94
- const [n] = o, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
95
- o.forEach((s, i) => {
96
- s.querySelectorAll("[data-attribute-type]").forEach((a) => {
97
- const f = a.getAttribute("data-attribute-type") || "";
98
- a.querySelectorAll(".attribute-cell").forEach((y, A) => {
99
- const m = i * c + A;
100
- p(y, f, u, m, r);
97
+ const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
98
+ s.forEach((a, i) => {
99
+ a.querySelectorAll("[data-attribute-type]").forEach((p) => {
100
+ const y = p.getAttribute("data-attribute-type") || "";
101
+ p.querySelectorAll(".attribute-cell").forEach((f, $) => {
102
+ const A = i * c + $;
103
+ b(f, y, u, A, r, o);
101
104
  });
102
105
  });
103
106
  });
104
107
  }
105
- function q(e, u, r) {
108
+ function h(e, u, r, o) {
106
109
  e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
107
- _(n, u, r);
110
+ g(n, u, r, o);
108
111
  });
109
112
  }
110
- function d(e, u) {
111
- const r = e.getAttribute("data-layout") || "grid", o = e.getAttribute("currency-alignment") || "after";
112
- r === "list" ? S(e, u, o) : q(e, u, o);
113
+ function C(e, u, r) {
114
+ const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
115
+ o === "list" ? q(e, u, s, r) : h(e, u, s, r);
113
116
  }
114
- function g(e, u) {
117
+ function E(e, u) {
115
118
  const r = e.match(/<!DOCTYPE[^>]*>/i);
116
119
  return (r ? `${r[0]}
117
120
  ` : "") + u.documentElement.outerHTML;
118
121
  }
119
- function E(e) {
122
+ function T(e) {
120
123
  const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
121
124
  if (!o.length)
122
125
  return e;
123
- const { buildCampaignUrl: n } = $();
124
- return o.forEach((c) => {
125
- const s = c.getAttribute("recommendation-id");
126
- s && (n(s), d(c, s));
127
- }), g(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
126
+ const { buildCampaignUrl: s } = _(), n = d();
127
+ n.recommendationCampaignUrls = {};
128
+ const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
129
+ return o.forEach((i) => {
130
+ const l = i.getAttribute("recommendation-id");
131
+ l && (i.parentNode?.insertBefore(r.createComment("REC_START"), i), i.parentNode?.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
132
+ }), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
128
133
  }
129
134
  export {
130
- b as formatPriceVariable,
131
- E as prepareRecommendationBlocks
135
+ m as formatPriceVariable,
136
+ T as prepareRecommendationBlocks
132
137
  };
@@ -1,28 +1,29 @@
1
- var x = Object.defineProperty;
2
- var y = (s, t, e) => t in s ? x(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var m = (s, t, e) => y(s, typeof t != "symbol" ? t + "" : t, e);
4
- import b from "../../extensions/Blocks/Checkbox/template.js";
5
- class f {
1
+ var m = Object.defineProperty;
2
+ var x = (s, t, e) => t in s ? m(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var d = (s, t, e) => x(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import y from "../../extensions/Blocks/Checkbox/template.js";
5
+ class b {
6
6
  constructor() {
7
- m(this, "parser");
7
+ d(this, "parser");
8
8
  this.parser = new DOMParser();
9
9
  }
10
10
  migrate(t) {
11
11
  try {
12
12
  const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
13
13
  return i.length === 0 ? t : (i.forEach((r) => {
14
- const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
15
- `<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
14
+ if (r.classList.contains("checkbox-block-v2"))
15
+ return;
16
+ const o = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), n = this.extractTextFromElement(r, "ins-description"), c = this.buildTextBlock(l), a = this.buildTextBlock(n), p = y.replace("{-{-TITLE-}-}", c).replace("{-{-DESCRIPTION-}-}", a), g = this.parser.parseFromString(
17
+ `<table id="tempDoc"><tbody><tr>${p}</tr></tbody></table>`,
16
18
  "text/html"
17
19
  ).querySelector(".checkbox-block-v2");
18
- o && r.parentNode && (o.setAttribute("id", n || ""), r.parentNode.replaceChild(o, r));
20
+ g && r.parentNode && (g.setAttribute("id", o || ""), r.parentNode.replaceChild(g, r));
19
21
  }), e.documentElement.outerHTML);
20
22
  } catch (e) {
21
23
  return console.error("CheckboxMigrator failed:", e), t;
22
24
  }
23
25
  }
24
26
  extractTextFromElement(t, e) {
25
- var o, u;
26
27
  const i = t.querySelector(`.${e}`);
27
28
  if (!i)
28
29
  return {
@@ -35,19 +36,19 @@ class f {
35
36
  const r = i.querySelector("p");
36
37
  if (!r)
37
38
  return {
38
- text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
39
+ text: i.textContent?.trim() || (e === "ins-title" ? "Title" : "Description"),
39
40
  isBold: !1,
40
41
  isItalic: !1,
41
42
  align: i.getAttribute("align") || "left",
42
43
  styles: ""
43
44
  };
44
- const n = ((u = r.textContent) == null ? void 0 : u.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g);
45
+ const o = r.textContent?.trim() || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", n = i.getAttribute("align") || r.getAttribute("align") || "left", c = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), a = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), p = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(p);
45
46
  return {
46
- text: n,
47
- isBold: a,
48
- isItalic: p,
49
- align: c,
50
- styles: d
47
+ text: o,
48
+ isBold: c,
49
+ isItalic: a,
50
+ align: n,
51
+ styles: u
51
52
  };
52
53
  }
53
54
  buildTextBlock(t) {
@@ -63,8 +64,8 @@ class f {
63
64
  `;
64
65
  }
65
66
  removeStyleProperties(t, e) {
66
- return t ? e.reduce((r, n) => {
67
- const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
67
+ return t ? e.reduce((r, o) => {
68
+ const l = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
68
69
  return r.replace(l, "");
69
70
  }, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
70
71
  }
@@ -75,9 +76,9 @@ class f {
75
76
  return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
76
77
  }
77
78
  }
78
- function k(s) {
79
- return new f().migrate(s);
79
+ function T(s) {
80
+ return new b().migrate(s);
80
81
  }
81
82
  export {
82
- k as migrateCheckbox
83
+ T as migrateCheckbox
83
84
  };