@useinsider/guido 3.2.0-beta.7e0c6bd → 3.2.0-beta.7fb9b70

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 (337) hide show
  1. package/README.md +117 -1
  2. package/dist/@types/config/schemas.js +153 -95
  3. package/dist/@types/config/validator.js +34 -27
  4. package/dist/components/Guido.vue.js +4 -4
  5. package/dist/components/Guido.vue2.js +95 -88
  6. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  7. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  8. package/dist/components/organisms/base/Toaster.vue2.js +11 -10
  9. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -12
  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 +15 -9
  12. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +40 -31
  13. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +20 -19
  14. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +14 -11
  15. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  16. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  17. package/dist/components/organisms/header/EditorActions.vue.js +12 -11
  18. package/dist/components/organisms/header/EditorActions.vue2.js +22 -18
  19. package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -12
  20. package/dist/components/organisms/header/LeftSlot.vue2.js +19 -16
  21. package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -14
  22. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  23. package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
  24. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +12 -11
  25. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +26 -24
  26. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +12 -11
  27. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +44 -41
  28. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +12 -11
  29. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +38 -36
  30. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +21 -18
  31. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +31 -27
  32. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +12 -11
  33. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +32 -30
  34. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +12 -11
  35. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +23 -21
  36. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +9 -8
  37. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -9
  38. package/dist/composables/useActionsApi.js +38 -37
  39. package/dist/composables/useAutoSave.js +71 -0
  40. package/dist/composables/useBlocksConfig.js +26 -26
  41. package/dist/composables/useFullStoryBridge.js +9 -8
  42. package/dist/composables/useHtmlCompiler.js +26 -34
  43. package/dist/composables/useHtmlValidator.js +109 -101
  44. package/dist/composables/useHttp.js +30 -30
  45. package/dist/composables/usePartner.js +1 -1
  46. package/dist/composables/useRecommendation.js +46 -25
  47. package/dist/composables/useRibbonOffset.js +15 -15
  48. package/dist/composables/useSave.js +25 -21
  49. package/dist/composables/useStripo.js +48 -53
  50. package/dist/composables/useSyncModuleExtractor.js +29 -31
  51. package/dist/composables/useTimerClone.js +25 -24
  52. package/dist/composables/useTranslations.js +16 -23
  53. package/dist/composables/useValidation.js +8 -7
  54. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  55. package/dist/composables/validators/useLiquidValidator.js +13 -13
  56. package/dist/config/compiler/recommendationCompilerRules.js +25 -25
  57. package/dist/config/compiler/unsubscribeCompilerRules.js +19 -17
  58. package/dist/config/compiler/utils/recommendationCompilerUtils.js +105 -71
  59. package/dist/config/migrator/checkboxMigrator.js +21 -20
  60. package/dist/config/migrator/couponBlockMigrator.js +19 -18
  61. package/dist/config/migrator/index.js +9 -9
  62. package/dist/config/migrator/itemsBlockMigrator.js +89 -87
  63. package/dist/config/migrator/radioButtonMigrator.js +63 -42
  64. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  65. package/dist/config/migrator/recommendation/extractors.js +27 -0
  66. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  67. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  68. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  69. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  70. package/dist/config/migrator/recommendationMigrator.js +74 -287
  71. package/dist/config/migrator/unsubscribeMigrator.js +11 -10
  72. package/dist/enums/extensions/recommendationBlock.js +2 -1
  73. package/dist/enums/unsubscribe.js +19 -18
  74. package/dist/extensions/Blocks/Items/block.js +9 -9
  75. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -14
  76. package/dist/extensions/Blocks/Items/controls/cardComposition.js +97 -89
  77. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -14
  78. package/dist/extensions/Blocks/Items/controls/name/trimming.js +24 -23
  79. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +14 -13
  80. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +47 -44
  81. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +38 -38
  82. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +11 -11
  83. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +40 -38
  84. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +35 -35
  85. package/dist/extensions/Blocks/Items/controls/settingsControl.js +162 -155
  86. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  87. package/dist/extensions/Blocks/Items/template.js +210 -210
  88. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  89. package/dist/extensions/Blocks/Recommendation/block.js +35 -32
  90. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  91. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +36 -36
  92. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +133 -128
  93. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +9 -9
  94. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +10 -10
  95. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +9 -9
  96. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +34 -32
  97. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +6 -4
  98. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +90 -82
  99. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +18 -18
  100. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +4 -4
  101. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +36 -35
  102. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +240 -192
  103. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +24 -24
  104. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +10 -10
  105. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +24 -24
  106. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +24 -24
  107. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +4 -4
  108. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +4 -4
  109. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +24 -24
  110. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +4 -4
  111. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +4 -4
  112. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +24 -24
  113. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +32 -32
  114. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +20 -18
  115. package/dist/extensions/Blocks/Recommendation/extension.js +32 -31
  116. package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
  117. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +16 -8
  118. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +150 -109
  119. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +37 -27
  120. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +10 -10
  121. package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -6
  122. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +37 -26
  123. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +1 -1
  124. package/dist/extensions/Blocks/Recommendation/templates/utils.js +47 -45
  125. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  126. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  127. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +16 -13
  128. package/dist/extensions/Blocks/Unsubscribe/control.js +13 -11
  129. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +18 -16
  130. package/dist/extensions/Blocks/common-control.js +26 -25
  131. package/dist/extensions/DynamicContent/dynamic-content.js +58 -53
  132. package/dist/guido.css +1 -1
  133. package/dist/library.js +12 -11
  134. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +234 -233
  135. package/dist/node_modules/lodash-es/_DataView.js +6 -0
  136. package/dist/node_modules/lodash-es/_Hash.js +20 -0
  137. package/dist/node_modules/lodash-es/_ListCache.js +20 -0
  138. package/dist/node_modules/lodash-es/_Map.js +6 -0
  139. package/dist/node_modules/lodash-es/_MapCache.js +20 -0
  140. package/dist/node_modules/lodash-es/_Promise.js +6 -0
  141. package/dist/node_modules/lodash-es/_Set.js +6 -0
  142. package/dist/node_modules/lodash-es/_SetCache.js +13 -0
  143. package/dist/node_modules/lodash-es/_Stack.js +18 -0
  144. package/dist/node_modules/lodash-es/_Symbol.js +5 -0
  145. package/dist/node_modules/lodash-es/_Uint8Array.js +5 -0
  146. package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
  147. package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
  148. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +20 -0
  149. package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
  150. package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
  151. package/dist/node_modules/lodash-es/_arraySome.js +9 -0
  152. package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
  153. package/dist/node_modules/lodash-es/_baseEach.js +6 -0
  154. package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
  155. package/dist/node_modules/lodash-es/_baseFor.js +5 -0
  156. package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
  157. package/dist/node_modules/lodash-es/_baseGet.js +11 -0
  158. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  159. package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
  160. package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
  161. package/dist/node_modules/lodash-es/_baseIsArguments.js +9 -0
  162. package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
  163. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
  164. package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
  165. package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
  166. package/dist/node_modules/lodash-es/_baseIsTypedArray.js +12 -0
  167. package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
  168. package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
  169. package/dist/node_modules/lodash-es/_baseMap.js +11 -0
  170. package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
  171. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  172. package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
  173. package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  174. package/dist/node_modules/lodash-es/_baseRange.js +9 -0
  175. package/dist/node_modules/lodash-es/_baseTimes.js +8 -0
  176. package/dist/node_modules/lodash-es/_baseToString.js +18 -0
  177. package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
  178. package/dist/node_modules/lodash-es/_baseUnary.js +8 -0
  179. package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
  180. package/dist/node_modules/lodash-es/_castPath.js +10 -0
  181. package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
  182. package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
  183. package/dist/node_modules/lodash-es/_createBaseFor.js +13 -0
  184. package/dist/node_modules/lodash-es/_createRange.js +11 -0
  185. package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
  186. package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
  187. package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
  188. package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
  189. package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
  190. package/dist/node_modules/lodash-es/_getMapData.js +8 -0
  191. package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
  192. package/dist/node_modules/lodash-es/_getNative.js +9 -0
  193. package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
  194. package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
  195. package/dist/node_modules/lodash-es/_getTag.js +28 -0
  196. package/dist/node_modules/lodash-es/_getValue.js +6 -0
  197. package/dist/node_modules/lodash-es/_hasPath.js +19 -0
  198. package/dist/node_modules/lodash-es/_hashClear.js +7 -0
  199. package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
  200. package/dist/node_modules/lodash-es/_hashGet.js +13 -0
  201. package/dist/node_modules/lodash-es/_hashHas.js +9 -0
  202. package/dist/node_modules/lodash-es/_hashSet.js +9 -0
  203. package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
  204. package/dist/node_modules/lodash-es/_isIndex.js +8 -0
  205. package/dist/node_modules/lodash-es/_isIterateeCall.js +13 -0
  206. package/dist/node_modules/lodash-es/_isKey.js +12 -0
  207. package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
  208. package/dist/node_modules/lodash-es/_isMasked.js +11 -0
  209. package/dist/node_modules/lodash-es/_isPrototype.js +8 -0
  210. package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
  211. package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
  212. package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
  213. package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
  214. package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
  215. package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
  216. package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
  217. package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  218. package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
  219. package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
  220. package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
  221. package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
  222. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  223. package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
  224. package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
  225. package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
  226. package/dist/node_modules/lodash-es/_nodeUtil.js +11 -0
  227. package/dist/node_modules/lodash-es/_objectToString.js +7 -0
  228. package/dist/node_modules/lodash-es/_overArg.js +8 -0
  229. package/dist/node_modules/lodash-es/_root.js +5 -0
  230. package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
  231. package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
  232. package/dist/node_modules/lodash-es/_setToArray.js +9 -0
  233. package/dist/node_modules/lodash-es/_stackClear.js +7 -0
  234. package/dist/node_modules/lodash-es/_stackDelete.js +7 -0
  235. package/dist/node_modules/lodash-es/_stackGet.js +6 -0
  236. package/dist/node_modules/lodash-es/_stackHas.js +6 -0
  237. package/dist/node_modules/lodash-es/_stackSet.js +17 -0
  238. package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
  239. package/dist/node_modules/lodash-es/_toKey.js +10 -0
  240. package/dist/node_modules/lodash-es/_toSource.js +17 -0
  241. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  242. package/dist/node_modules/lodash-es/eq.js +6 -0
  243. package/dist/node_modules/lodash-es/flatMap.js +8 -0
  244. package/dist/node_modules/lodash-es/get.js +8 -0
  245. package/dist/node_modules/lodash-es/hasIn.js +8 -0
  246. package/dist/node_modules/lodash-es/identity.js +6 -0
  247. package/dist/node_modules/lodash-es/isArguments.js +10 -0
  248. package/dist/node_modules/lodash-es/isArray.js +4 -0
  249. package/dist/node_modules/lodash-es/isArrayLike.js +8 -0
  250. package/dist/node_modules/lodash-es/isBuffer.js +6 -0
  251. package/dist/node_modules/lodash-es/isFunction.js +12 -0
  252. package/dist/node_modules/lodash-es/isLength.js +7 -0
  253. package/dist/node_modules/lodash-es/isObject.js +7 -0
  254. package/dist/node_modules/lodash-es/isObjectLike.js +6 -0
  255. package/dist/node_modules/lodash-es/isSymbol.js +9 -0
  256. package/dist/node_modules/lodash-es/isTypedArray.js +7 -0
  257. package/dist/node_modules/lodash-es/keys.js +9 -0
  258. package/dist/node_modules/lodash-es/map.js +11 -0
  259. package/dist/node_modules/lodash-es/memoize.js +18 -0
  260. package/dist/node_modules/lodash-es/property.js +10 -0
  261. package/dist/node_modules/lodash-es/range.js +5 -0
  262. package/dist/node_modules/lodash-es/stubArray.js +6 -0
  263. package/dist/node_modules/lodash-es/stubFalse.js +6 -0
  264. package/dist/node_modules/lodash-es/toFinite.js +14 -0
  265. package/dist/node_modules/lodash-es/toNumber.js +22 -0
  266. package/dist/node_modules/lodash-es/toString.js +7 -0
  267. package/dist/node_modules/valibot/dist/index.js +458 -239
  268. package/dist/services/recommendationApi.js +17 -14
  269. package/dist/services/templateLibraryApi.js +40 -38
  270. package/dist/src/@types/config/defaults.d.ts +5 -1
  271. package/dist/src/@types/config/index.d.ts +3 -3
  272. package/dist/src/@types/config/schemas.d.ts +217 -0
  273. package/dist/src/@types/config/types.d.ts +9 -1
  274. package/dist/src/components/Guido.vue.d.ts +1 -1
  275. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  276. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  277. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  278. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  279. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  280. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  281. package/dist/src/composables/useAutoSave.d.ts +3 -0
  282. package/dist/src/composables/useConfig.d.ts +58 -0
  283. package/dist/src/composables/useHtmlCompiler.d.ts +2 -1
  284. package/dist/src/composables/useRecommendation.d.ts +10 -1
  285. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  286. package/dist/src/composables/useSave.d.ts +1 -1
  287. package/dist/src/composables/useTranslations.d.ts +1 -1
  288. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  289. package/dist/src/config/migrator/index.d.ts +2 -1
  290. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  291. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  292. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  293. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  294. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  295. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  296. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  297. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  298. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  299. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  300. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  301. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  302. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  303. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  304. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  305. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  306. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
  307. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  308. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  309. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  310. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  311. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  312. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  313. package/dist/src/library.d.ts +1 -1
  314. package/dist/src/stores/autosave.d.ts +12 -0
  315. package/dist/src/stores/config.d.ts +522 -0
  316. package/dist/src/stores/dynamic-content.d.ts +3 -3
  317. package/dist/src/stores/editor.d.ts +23 -0
  318. package/dist/src/utils/htmlEscape.d.ts +5 -0
  319. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  320. package/dist/src/utils/timeUtil.d.ts +8 -0
  321. package/dist/stores/autosave.js +17 -0
  322. package/dist/stores/config.js +81 -25
  323. package/dist/stores/dynamic-content.js +11 -6
  324. package/dist/stores/editor.js +3 -1
  325. package/dist/stores/onboarding.js +1 -1
  326. package/dist/stores/preview.js +9 -6
  327. package/dist/stores/unsubscribe.js +4 -1
  328. package/dist/utils/dateUtil.js +10 -7
  329. package/dist/utils/genericUtil.js +13 -10
  330. package/dist/utils/htmlEscape.js +13 -0
  331. package/dist/utils/pairProductVariables.js +89 -87
  332. package/dist/utils/templatePreparation.js +72 -32
  333. package/dist/utils/timeUtil.js +19 -0
  334. package/package.json +7 -6
  335. package/dist/enums/displayConditions.js +0 -80
  336. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  337. package/dist/src/enums/displayConditions.d.ts +0 -2
@@ -1,27 +1,20 @@
1
- import { ref as g } from "vue";
2
- import { useConfig as h } from "./useConfig.js";
3
- const v = (r) => r.split(".").filter((t) => t !== "window").reduce(
4
- (t, l) => {
5
- if (t !== void 0)
6
- return t[l];
7
- },
8
- window
9
- ) || {}, T = () => {
10
- const { config: r } = h(), c = r.value?.editor?.translationsPath || "window.trans.en", a = g(v(c)), t = /* @__PURE__ */ new Map();
11
- return (n, e) => {
12
- const o = e && Object.keys(e).length > 0 ? JSON.stringify({ key: n, params: e }) : n, u = t.get(o);
13
- if (u !== void 0)
14
- return u;
15
- const s = a.value[n];
16
- if (!s)
17
- return console.warn(`Translation key not found: ${n}`), t.set(o, n), n;
18
- let i = s;
19
- return e && (i = Object.entries(e).reduce(
20
- (f, [d, w]) => f.replace(new RegExp(`{${d}}`, "g"), String(w)),
21
- s
22
- )), t.set(o, i), i;
1
+ import memoize from "../node_modules/lodash-es/memoize.js";
2
+ import { ref } from "vue";
3
+ import { useConfig } from "./useConfig.js";
4
+ const useTranslations = () => {
5
+ var o, e;
6
+ const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
7
+ const r = translations.value[n];
8
+ return r ? t ? Object.entries(t).reduce(
9
+ (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
10
+ r
11
+ ) : r : (console.warn(`Translation key not found: ${n}`), n);
23
12
  };
13
+ return memoize(
14
+ trans,
15
+ (n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
16
+ );
24
17
  };
25
18
  export {
26
- T as useTranslations
19
+ useTranslations
27
20
  };
@@ -1,18 +1,19 @@
1
- import { safeParseAsync as t } from "../node_modules/valibot/dist/index.js";
2
- import { unref as a } from "vue";
3
- function n(s, e) {
1
+ import { safeParseAsync as i } from "../node_modules/valibot/dist/index.js";
2
+ import { unref as n } from "vue";
3
+ function c(o, e) {
4
4
  return {
5
5
  schema: e,
6
6
  validate: async () => {
7
- const r = await t(e, a(s), { abortPipeEarly: !0 });
7
+ var s, t, a;
8
+ const r = await i(e, n(o), { abortPipeEarly: !0 });
8
9
  return {
9
10
  ...r,
10
- error: r.issues?.[0],
11
- errorMessage: r.issues?.[0]?.message || ""
11
+ error: (s = r.issues) == null ? void 0 : s[0],
12
+ errorMessage: ((a = (t = r.issues) == null ? void 0 : t[0]) == null ? void 0 : a.message) || ""
12
13
  };
13
14
  }
14
15
  };
15
16
  }
16
17
  export {
17
- n as useAsyncValidation
18
+ c as useAsyncValidation
18
19
  };
@@ -0,0 +1,24 @@
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
+ import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
+ import { useToaster as m } from "../useToaster.js";
4
+ import { useTranslations as p } from "../useTranslations.js";
5
+ const u = /* @__PURE__ */ new Set([
6
+ i,
7
+ l
8
+ ]), A = () => {
9
+ const { showToaster: t } = m(), r = p();
10
+ return { validateCouponBlockTags: (e) => {
11
+ const n = new DOMParser().parseFromString(e, "text/html");
12
+ return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
+ var o;
14
+ const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
+ return !u.has(a);
16
+ }) ? (t({
17
+ type: c.Warning,
18
+ message: r("newsletter.coupon-tag-modified")
19
+ }), !1) : !0;
20
+ } };
21
+ };
22
+ export {
23
+ A as useCouponBlockValidator
24
+ };
@@ -1,38 +1,38 @@
1
- import { ToasterTypeOptions as r } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as a } 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: n } = d(), { showToaster: e } = c(), a = p();
8
- return { validateLiquidSyntax: async (i) => {
7
+ const { post: i } = d(), { showToaster: e } = c(), s = p();
8
+ return { validateLiquidSyntax: async (o) => {
9
9
  try {
10
- const t = await n("/newsletter/contents/validate-syntax", [{
10
+ const t = await i("/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(i),
16
+ html: u(o),
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: r.Warning,
24
- message: l.message ?? a("journey-builder.liquid-validation-failed")
23
+ type: a.Warning,
24
+ message: l.message ?? s("journey-builder.liquid-validation-failed")
25
25
  }), !1;
26
26
  }
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*/, "")
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*/, "")
31
31
  }), !1) : !0;
32
32
  } catch {
33
33
  return e({
34
- type: r.Alert,
35
- message: a("journey-builder.liquid-validation-failed")
34
+ type: a.Alert,
35
+ message: s("journey-builder.liquid-validation-failed")
36
36
  }), !1;
37
37
  }
38
38
  } };
@@ -1,5 +1,5 @@
1
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";
2
+ import { DUMMY_IMAGE_MAPPINGS as y, 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
  {
@@ -8,7 +8,7 @@ const w = [
8
8
  type: "custom",
9
9
  processor: (c) => {
10
10
  let e = c;
11
- return Object.entries(h).forEach(([, l]) => {
11
+ return Object.entries(y).forEach(([, l]) => {
12
12
  Object.entries(l).forEach(([n, s]) => {
13
13
  e = e.replaceAll(s, `{{${n}}}`);
14
14
  });
@@ -36,7 +36,7 @@ const w = [
36
36
  if (s) {
37
37
  const a = [];
38
38
  if (s.forEach((i) => {
39
- const d = /recommendation-id="(.*?)"/i.exec(i), _ = d ? d[1].trim() : "", R = l(_);
39
+ const u = /recommendation-id="(.*?)"/i.exec(i), _ = u ? u[1].trim() : "", R = l(_);
40
40
  R.textTrimming && R.orientation === M && a.push(e(R));
41
41
  }), a.length) {
42
42
  const i = `width:${Math.min(...a)}px!important;`;
@@ -65,20 +65,20 @@ const w = [
65
65
  const a = s.match(T.CUSTOM_FIELD);
66
66
  if (!a)
67
67
  return;
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)
68
+ const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
+ if (!u || !_ || !R)
70
70
  return;
71
- const [S] = d, [b] = _, [m] = R, o = b.substring(1, b.length - 2), r = m.match(T.COMPOSITION) !== null;
71
+ const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
72
72
  let t = i;
73
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}`));
74
+ const I = S.substring(2, S.length - 3), m = n(I);
75
+ o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
76
76
  }
77
- const u = S.substring(2);
77
+ const p = S.substring(2);
78
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);
79
+ o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
80
+ const $ = `${d}${t}${N.PARAGRAPH_END_TAG}`, h = `${f}${r ? $ : s}${g.ELSE}${d}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
81
+ e = e.replace(s, h);
82
82
  }), e;
83
83
  },
84
84
  priority: 53
@@ -136,7 +136,7 @@ const w = [
136
136
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
137
137
  (l, n) => {
138
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;
139
+ return s.every((u) => a.test(u)) ? "" : l;
140
140
  }
141
141
  )), e;
142
142
  },
@@ -151,7 +151,7 @@ const w = [
151
151
  /<a\b[^>]*\bes-button\b[^>]*>/g,
152
152
  (o) => o.replace(
153
153
  /([;"]color:)([^;"]+)/g,
154
- (r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
154
+ (r, t, p) => p.includes("!important") ? r : `${t}${p} !important`
155
155
  )
156
156
  ), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
157
157
  let a = l.exec(e);
@@ -163,12 +163,12 @@ const w = [
163
163
  }
164
164
  n.lastIndex = 0, a = l.exec(e);
165
165
  }
166
- const i = /* @__PURE__ */ new Map(), d = [];
166
+ const i = /* @__PURE__ */ new Map(), u = [];
167
167
  let _ = 0;
168
168
  if (s.forEach((o, r) => {
169
- if (o >= 6) {
170
- const t = `rc${_++}`;
171
- i.set(r, t), d.push(`.${t}{${r}}`);
169
+ if (!r.includes("v-text-anchor") && o >= 6) {
170
+ const t = `rc${_++}`, p = r.endsWith(";") ? r : `${r};`;
171
+ i.set(r, t), u.push(`.${t}{${p}}`);
172
172
  }
173
173
  }), i.size === 0) {
174
174
  let o = e;
@@ -182,23 +182,23 @@ const w = [
182
182
  caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
183
183
  });
184
184
  });
185
- let m = e.replace("</style>", `${d.join("")}</style>`);
186
- return m = m.replace(
185
+ let d = e.replace("</style>", `${u.join("")}</style>`);
186
+ return d = d.replace(
187
187
  /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
188
188
  (o, r) => {
189
189
  let t = r;
190
- return i.forEach((u, f) => {
190
+ return i.forEach((p, f) => {
191
191
  const $ = b.get(f);
192
192
  t = t.replace(
193
193
  $.caseA,
194
- (y, I, p) => S(I, u) + p
194
+ (h, I, m) => S(I, p) + m
195
195
  ), t = t.replace(
196
196
  $.caseB,
197
- (y, I, p) => I + S(p, u)
198
- ), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
197
+ (h, I, m) => I + S(m, p)
198
+ ), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
199
199
  }), t;
200
200
  }
201
- ), m = m.replaceAll("<!--REC_START-->", ""), m = m.replaceAll("<!--REC_END-->", ""), m;
201
+ ), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
202
202
  },
203
203
  priority: 58
204
204
  }
@@ -1,41 +1,43 @@
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
- import { useConfigStore as N } from "../../stores/config.js";
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 $ = [
1
+ import { usePartner as U } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as R, LINK_TYPES as _, INSIDER_ID as m, URLS as y } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as N } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as C } from "../../stores/config.js";
5
+ import { useDynamicContentStore as L } from "../../stores/dynamic-content.js";
6
+ import { useUnsubscribeStore as P } from "../../stores/unsubscribe.js";
7
+ import { ProductType as B } from "../../@types/config/schemas.js";
8
+ import "../../@types/config/defaults.js";
9
+ const F = [
9
10
  {
10
11
  id: "add-unsubscribe-link-values",
11
12
  description: "Adding unsubscribe link values",
12
13
  type: "custom",
13
14
  processor: (s) => {
14
- const { getPartnerName: i } = I(), n = N(), t = C(), E = L(), c = n.variationId;
15
+ const { getPartnerName: i } = U(), n = C(), t = L(), E = P(), c = n.variationId;
15
16
  if (!c)
16
17
  return s;
17
- const r = S[n.productType] ?? S[P.EMAIL];
18
+ const r = R[n.productType] ?? R[B.EMAIL];
18
19
  let e = s;
19
20
  const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
20
21
  let a = !1, l = !1;
21
22
  return f.forEach((g) => {
23
+ var S;
22
24
  const u = g.getAttribute("data-unsubscribe-page-list");
23
25
  if (!u)
24
26
  return;
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);
27
+ const I = N(u), b = ((S = E.templates) == null ? void 0 : S.filter(
28
+ (o) => I.includes(o.id)
29
+ )) ?? [];
30
+ a = a || b.some((o) => o.type === _.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === _.PREFERENCES_LINK_TYPE);
29
31
  }), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
30
32
  text: m,
31
33
  value: m,
32
34
  fallback: ""
33
35
  })), a && (e = e.replace(
34
36
  p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
35
- _.UNSUBSCRIBE_URL + d
37
+ y.UNSUBSCRIBE_URL + d
36
38
  )), l && (e = e.replace(
37
39
  p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
38
- _.PREFERENCES_URL + d
40
+ y.PREFERENCES_URL + d
39
41
  )), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
40
42
  },
41
43
  priority: 60
@@ -79,5 +81,5 @@ const $ = [
79
81
  }
80
82
  ];
81
83
  export {
82
- $ as unsubscribeCompilerRules
84
+ F as unsubscribeCompilerRules
83
85
  };
@@ -1,41 +1,41 @@
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}}`;
1
+ import { useConfig as g } from "../../../composables/useConfig.js";
2
+ import { useRecommendation as S } from "../../../composables/useRecommendation.js";
3
+ import { useRecommendationExtensionStore as _ } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ function y(r, c, e, o, s = "") {
5
+ const n = `{{${s}${r}_${c}_${e}}}`, t = `{{${s}${r}_${c}_currency}}`;
6
6
  return o === "before" ? `${t} ${n}` : `${n} ${t}`;
7
7
  }
8
- function b(e, u, r, o, s, n) {
9
- switch (u) {
8
+ function f(r, c, e, o, s, n) {
9
+ switch (c) {
10
10
  case "productImage": {
11
- const t = e.querySelector("img");
12
- t && (t.setAttribute("src", `{{${n}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${r}_${o}_name}}`));
13
- const c = e.querySelector("a");
14
- c && c.setAttribute("href", `{{${n}${r}_${o}_url}}`);
11
+ const t = r.querySelector("img");
12
+ t && (t.setAttribute("src", `{{${n}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${e}_${o}_name}}`));
13
+ const i = r.querySelector("a");
14
+ i && i.setAttribute("href", `{{${n}${e}_${o}_url}}`);
15
15
  break;
16
16
  }
17
17
  case "productName": {
18
- const t = e.querySelector("p");
18
+ const t = r.querySelector("p");
19
19
  if (t) {
20
- const c = t.querySelector("strong") || t;
21
- c.textContent = `{{${n}${r}_${o}_name}}`;
20
+ const i = t.querySelector("strong") || t;
21
+ i.textContent = `{{${n}${e}_${o}_name}}`;
22
22
  }
23
23
  break;
24
24
  }
25
25
  case "productPrice": {
26
- const t = e.querySelector("p");
26
+ const t = r.querySelector("p");
27
27
  if (t) {
28
- const c = t.querySelector("strong") || t;
29
- c.textContent = m(r, o, "price", s, n);
28
+ const i = t.querySelector("strong") || t;
29
+ i.textContent = y(e, o, "price", s, n);
30
30
  }
31
31
  break;
32
32
  }
33
33
  case "productOldPrice": {
34
- const t = e.querySelector("p");
34
+ const t = r.querySelector("p");
35
35
  if (t) {
36
- const c = t.querySelector("strong") || t;
37
- c.textContent = m(
38
- r,
36
+ const i = t.querySelector("strong") || t;
37
+ i.textContent = y(
38
+ e,
39
39
  o,
40
40
  "original_price",
41
41
  s,
@@ -45,93 +45,127 @@ function b(e, u, r, o, s, n) {
45
45
  break;
46
46
  }
47
47
  case "productButton": {
48
- const t = e.querySelector("a");
49
- t && t.setAttribute("href", `{{${n}${r}_${o}_url}}`);
48
+ const t = r.querySelector("a");
49
+ t && t.setAttribute("href", `{{${n}${e}_${o}_url}}`);
50
50
  break;
51
51
  }
52
52
  case "productOmnibusPrice": {
53
- const t = e.querySelector(".omnibus-price-value");
53
+ const t = r.querySelector(".omnibus-price-value");
54
54
  if (t) {
55
- t.textContent = `{{${n}${r}_${o}_omnibus_price}}`;
56
- const c = t.closest("p");
57
- c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
55
+ t.textContent = `{{${n}${e}_${o}_omnibus_price}}`;
56
+ const i = t.closest("p");
57
+ i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
58
58
  }
59
59
  break;
60
60
  }
61
61
  case "productOmnibusDiscount": {
62
- const t = e.querySelector(".omnibus-discount-value");
62
+ const t = r.querySelector(".omnibus-discount-value");
63
63
  if (t) {
64
- t.textContent = `{{${n}${r}_${o}_omnibus_discount}}`;
65
- const c = t.closest("p");
66
- c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
64
+ t.textContent = `{{${n}${e}_${o}_omnibus_discount}}`;
65
+ const i = t.closest("p");
66
+ i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
67
67
  }
68
68
  break;
69
69
  }
70
70
  default: {
71
- const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
71
+ const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
72
72
  if (t) {
73
- const c = t.getAttribute("product-attr"), a = t.querySelector("p");
73
+ const i = t.getAttribute("product-attr"), a = t.querySelector("p");
74
74
  if (a) {
75
- const i = a.querySelector("strong") || a;
76
- i.textContent = `{{${n}${r}_${o}_${c}}}`;
75
+ const u = a.querySelector("strong") || a;
76
+ u.textContent = `{{${n}${e}_${o}_${i}}}`;
77
77
  }
78
78
  }
79
79
  break;
80
80
  }
81
81
  }
82
82
  }
83
- function q(e, u, r, o) {
84
- e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
83
+ function q(r, c, e, o) {
84
+ r.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
85
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);
86
+ const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
87
+ p.length > 0 ? p.forEach((l) => {
88
+ f(l, u, c, t, e, o);
89
+ }) : f(a, u, c, t, e, o);
90
90
  });
91
91
  });
92
92
  }
93
- function g(e, u, r, o) {
94
- const s = e.querySelectorAll(".recommendation-product-row");
93
+ function w(r, c, e, o) {
94
+ const s = r.querySelectorAll(".recommendation-product-row");
95
95
  if (!s.length)
96
96
  return;
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);
97
+ const [n] = s, t = n.querySelector("[data-attribute-type]"), i = t ? t.querySelectorAll(".attribute-cell").length : 1;
98
+ s.forEach((a, u) => {
99
+ a.querySelectorAll("[data-attribute-type]").forEach((l) => {
100
+ const d = l.getAttribute("data-attribute-type") || "";
101
+ l.querySelectorAll(".attribute-cell").forEach((A, h) => {
102
+ const $ = u * i + h;
103
+ f(A, d, c, $, e, o);
104
104
  });
105
105
  });
106
106
  });
107
107
  }
108
- function h(e, u, r, o) {
109
- e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
110
- g(n, u, r, o);
108
+ function E(r, c, e, o) {
109
+ r.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
110
+ w(n, c, e, o);
111
111
  });
112
112
  }
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
+ function C(r, c, e) {
114
+ const o = r.getAttribute("data-layout") || "grid", s = r.getAttribute("currency-alignment") || "after";
115
+ o === "list" ? q(r, c, s, e) : E(r, c, s, e);
116
116
  }
117
- function E(e, u) {
118
- const r = e.match(/<!DOCTYPE[^>]*>/i);
119
- return (r ? `${r[0]}
120
- ` : "") + u.documentElement.outerHTML;
117
+ function b(r, c, e) {
118
+ const o = new RegExp(`${c}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
119
+ return s ? parseInt(s[1]) : e;
121
120
  }
122
- function T(e) {
123
- const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
121
+ function P(r, c) {
122
+ let e = r.parentElement;
123
+ for (; e && e !== c; ) {
124
+ if (e.tagName === "TD") {
125
+ const o = e.getAttribute("width");
126
+ if (o && o.endsWith("%") && parseFloat(o) < 100)
127
+ return e;
128
+ }
129
+ e = e.parentElement;
130
+ }
131
+ return null;
132
+ }
133
+ function R(r) {
134
+ const c = r.getAttribute("style") || "", e = b(c, "width", 600), o = b(c, "padding", 0) * 2, s = Math.max(0, e - o);
135
+ s !== 0 && r.querySelectorAll("img.adapt-img").forEach((n) => {
136
+ if (n.hasAttribute("width"))
137
+ return;
138
+ const t = P(n, r);
139
+ if (!t)
140
+ return;
141
+ const i = t.getAttribute("width"), a = parseFloat(i), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
142
+ n.setAttribute("width", String(l));
143
+ const d = n.getAttribute("style") || "";
144
+ if (!/\bwidth\s*:\s*\d/i.test(d)) {
145
+ const m = d && !d.trim().endsWith(";") ? "; " : "";
146
+ n.setAttribute("style", `${d}${m}width: ${l}px`);
147
+ }
148
+ });
149
+ }
150
+ function v(r, c) {
151
+ const e = r.match(/<!DOCTYPE[^>]*>/i);
152
+ return (e ? `${e[0]}
153
+ ` : "") + c.documentElement.outerHTML;
154
+ }
155
+ function O(r) {
156
+ const c = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(c, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
124
157
  if (!o.length)
125
- return e;
126
- const { buildCampaignUrl: s } = _(), n = d();
158
+ return r;
159
+ const { buildCampaignUrl: s } = S(), n = _();
127
160
  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;", "%}");
161
+ const { isFeatureEnabled: t } = g(), i = t("liquidSyntax") ? "reco_" : "";
162
+ return o.forEach((u) => {
163
+ var l, d;
164
+ const p = u.getAttribute("recommendation-id");
165
+ p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), C(u, p, i), R(u));
166
+ }), v(c, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
133
167
  }
134
168
  export {
135
- m as formatPriceVariable,
136
- T as prepareRecommendationBlocks
169
+ y as formatPriceVariable,
170
+ O as prepareRecommendationBlocks
137
171
  };