@useinsider/guido 3.2.0-beta.565bfaf → 3.2.0-beta.570fb6d

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