@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
@@ -0,0 +1,93 @@
1
+ function r(n, t, o) {
2
+ o != null && o !== "" && n.push(`${t}: ${o}`);
3
+ }
4
+ function $(n) {
5
+ if (!n)
6
+ return null;
7
+ const t = n.top ?? n.all ?? 0, o = n.right ?? n.all ?? 0, i = n.bottom ?? n.all ?? 0, l = n.left ?? n.all ?? 0;
8
+ return t === 0 && o === 0 && i === 0 && l === 0 ? null : `${t}px ${o}px ${i}px ${l}px`;
9
+ }
10
+ function j(n) {
11
+ if (!n)
12
+ return null;
13
+ const { top: t, right: o, bottom: i, left: l } = n;
14
+ return t === void 0 ? null : t === o && t === i && t === l ? t : null;
15
+ }
16
+ function S(n, t, o, i) {
17
+ const l = j(o);
18
+ if (l !== null) {
19
+ r(n, `border-${t}`, i(l));
20
+ return;
21
+ }
22
+ o && (r(n, `border-top-${t}`, o.top !== void 0 ? i(o.top) : null), r(n, `border-right-${t}`, o.right !== void 0 ? i(o.right) : null), r(n, `border-bottom-${t}`, o.bottom !== void 0 ? i(o.bottom) : null), r(n, `border-left-${t}`, o.left !== void 0 ? i(o.left) : null));
23
+ }
24
+ function C(n) {
25
+ if (!n)
26
+ return null;
27
+ if (typeof n.radius == "number")
28
+ return `${n.radius}px`;
29
+ if (typeof n.lt == "number" || typeof n.rt == "number" || typeof n.rb == "number" || typeof n.lb == "number") {
30
+ const t = n.lt ?? 0, o = n.rt ?? 0, i = n.rb ?? 0, l = n.lb ?? 0;
31
+ return `${t}px ${o}px ${i}px ${l}px`;
32
+ }
33
+ return null;
34
+ }
35
+ function I(n) {
36
+ var t, o;
37
+ return ((t = n.textLineSpacing) == null ? void 0 : t.lineSpacing) ?? ((o = n.textLineSpacing) == null ? void 0 : o["font-lineSpacing"]);
38
+ }
39
+ function L(n) {
40
+ var f, u, a, g, d, b, p, s;
41
+ const t = [], o = [], i = (f = n == null ? void 0 : n.textAlign) == null ? void 0 : f.align, l = $((u = n == null ? void 0 : n.textPadding) == null ? void 0 : u.desktop), x = (a = n == null ? void 0 : n.textStyle) == null ? void 0 : a["font-weight"], c = (g = n == null ? void 0 : n.textStyle) == null ? void 0 : g["font-style"];
42
+ return r(t, "background-color", (d = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : d.color), r(t, "padding", l), r(o, "font-family", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-family"]), r(o, "font-size", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-size"]), r(o, "font-weight", x), r(o, "font-style", c), r(o, "color", (s = n == null ? void 0 : n.textColor) == null ? void 0 : s.color), r(o, "line-height", I(n ?? {})), r(o, "text-align", i), {
43
+ tdStyle: t.join("; "),
44
+ pStyle: o.join("; "),
45
+ align: i || void 0,
46
+ wrapBold: x === "bold",
47
+ wrapItalic: c === "italic",
48
+ textTrimming: (n == null ? void 0 : n.textTrimming) === !0
49
+ };
50
+ }
51
+ function N(n) {
52
+ var u, a, g, d, b, p, s, k, w, P, B, z;
53
+ const t = [], o = [], i = [];
54
+ r(t, "padding", $((u = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : u.desktop)), r(i, "padding", $((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-family"]), r(i, "font-size", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-size"]), r(i, "font-weight", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-weight"]), r(i, "font-style", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-style"]);
55
+ const l = (s = n == null ? void 0 : n.buttonColor) == null ? void 0 : s.color, x = (k = n == null ? void 0 : n.textButtonColor) == null ? void 0 : k.color;
56
+ r(o, "background", l), r(i, "background", l), r(i, "color", x);
57
+ const c = n == null ? void 0 : n.buttonBorder;
58
+ S(o, "width", c == null ? void 0 : c.width, (y) => `${y}px`), S(o, "style", c == null ? void 0 : c.style, (y) => y), S(o, "color", c == null ? void 0 : c.color, (y) => y);
59
+ const f = C(n == null ? void 0 : n.buttonBorderRadius);
60
+ return f && (r(o, "border-radius", f), r(i, "border-radius", f)), ((w = n == null ? void 0 : n.buttonStretch) == null ? void 0 : w.stretched) === !1 ? (r(o, "display", "inline-block"), r(i, "display", "inline-block")) : ((P = n == null ? void 0 : n.buttonStretch) == null ? void 0 : P.stretched) === !0 && (r(o, "display", "block"), r(i, "display", "block")), {
61
+ tdStyle: t.join("; "),
62
+ align: ((B = n == null ? void 0 : n.buttonAlign) == null ? void 0 : B.align) || void 0,
63
+ spanStyle: o.join("; "),
64
+ aStyle: i.join("; "),
65
+ text: (z = n == null ? void 0 : n.buttonText) == null ? void 0 : z.text
66
+ };
67
+ }
68
+ function T(n) {
69
+ if (typeof n == "number" && Number.isFinite(n) && n >= 0)
70
+ return Math.trunc(n);
71
+ if (typeof n == "string" && /^\d+$/.test(n.trim())) {
72
+ const t = Number(n.trim());
73
+ if (Number.isFinite(t) && t >= 0)
74
+ return t;
75
+ }
76
+ }
77
+ function A(n) {
78
+ var t, o;
79
+ return {
80
+ width: T((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
81
+ height: T((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
82
+ };
83
+ }
84
+ function F(n, t) {
85
+ const o = (n ?? "").trim().replace(/;$/, "").trim(), i = (t ?? "").trim().replace(/;$/, "").trim();
86
+ return o ? i ? `${o}; ${i}` : o : i;
87
+ }
88
+ export {
89
+ F as appendStyle,
90
+ N as mapButtonTheme,
91
+ A as mapImageTheme,
92
+ L as mapTextTheme
93
+ };
@@ -1,294 +1,81 @@
1
- var h = Object.defineProperty;
2
- var T = (d, e, t) => e in d ? h(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
3
- var A = (d, e, t) => T(d, typeof e != "symbol" ? e + "" : e, t);
4
- import { BLOCK_ID as S } from "../../extensions/Blocks/Recommendation/block.js";
5
- import P, { prepareProductRows as q } from "../../extensions/Blocks/Recommendation/templates/grid/migration.js";
6
- import { useTemplateStore as w } from "../../stores/template.js";
7
- import { getDefaultProducts as B } from "../../extensions/Blocks/Recommendation/templates/utils.js";
8
- class $ {
9
- constructor() {
10
- A(this, "parser");
11
- this.parser = new DOMParser();
12
- }
13
- migrate(e) {
14
- try {
15
- const t = this.parser.parseFromString(e, "text/html"), o = t.querySelectorAll(
16
- 'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
17
- );
18
- return w().$patch((s) => {
19
- s.migrations = { ...s.migrations, [S]: o.length };
20
- }), o.length === 0 ? e : (o.forEach((s) => {
21
- const r = s.getAttribute("id"), i = this.extractBgColor(s), c = this.extractTitle(s), l = this.extractProductRows(s), g = P.replace("{-{-TITLE-}-}", c).replace("{-{-PRODUCT_ROWS-}-}", l), u = this.parser.parseFromString(
22
- `<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
23
- "text/html"
24
- ).querySelector(".recommendation-block-v2");
25
- u && s.parentNode && (r && u.setAttribute("id", r), i && u.setAttribute("bgcolor", i), s.parentNode.replaceChild(u, s));
26
- }), t.documentElement.outerHTML);
27
- } catch (t) {
28
- return console.error("RecommendationMigrator failed:", t), e;
29
- }
30
- }
31
- /**
32
- * Extracts background color from old block
33
- * @param block - The old recommendation block element
34
- * @returns The background color value or empty string
35
- */
36
- extractBgColor(e) {
37
- const t = e.getAttribute("bgcolor");
38
- if (t)
39
- return t.trim();
40
- const o = e.getAttribute("style");
41
- if (o) {
42
- const n = o.match(/background-color\s*:\s*([^;]+)/i);
43
- if (n && n[1])
44
- return n[1].trim();
45
- }
46
- return "";
47
- }
48
- /**
49
- * Extracts background color from product card wrapper element
50
- * @param cardElement - The product card TD element
51
- * @returns The background color value or empty string
52
- */
53
- extractCardBgColor(e) {
54
- const t = e.getAttribute("bgcolor");
55
- if (t)
56
- return t.trim();
57
- const o = e.getAttribute("style");
58
- if (o) {
59
- const n = o.match(/background-color\s*:\s*([^;]+)/i);
60
- if (n && n[1])
61
- return n[1].trim();
62
- }
63
- return "";
64
- }
65
- /**
66
- * Extracts title from old block and converts to new structure
67
- * @param block - The old recommendation block element
68
- * @returns HTML string for the title block
69
- */
70
- extractTitle(e) {
71
- const t = e.querySelector(".ext-recommendation-title");
72
- if (!t)
73
- return this.buildTitleBlock({
74
- text: "You May Also Like!",
75
- isBold: !0,
76
- isItalic: !1,
77
- align: "center",
78
- styles: "font-size: 28px; color: #333333;"
79
- });
80
- const o = t.querySelector("p");
81
- if (!o) {
82
- const a = t.textContent?.trim() || "You May Also Like!", u = t.getAttribute("align") || "center";
83
- return this.buildTitleBlock({
84
- text: a,
85
- isBold: !0,
86
- isItalic: !1,
87
- align: u,
88
- styles: "font-size: 28px; color: #333333;"
89
- });
90
- }
91
- const n = o.textContent?.trim() || "You May Also Like!", s = t.getAttribute("align") || o.getAttribute("align") || "center", r = o.getAttribute("style") || "", i = /font-weight\s*:\s*bold/i.test(r) || !!o.querySelector("b, strong"), c = /font-style\s*:\s*italic/i.test(r) || !!o.querySelector("i, em"), l = this.removeStyleProperties(r, ["font-weight", "font-style"]), g = this.convertInlineToBlock(l);
92
- return this.buildTitleBlock({
93
- text: n,
94
- isBold: i,
95
- isItalic: c,
96
- align: s,
97
- styles: g
1
+ import { BlockId as f } from "../../enums/block.js";
2
+ import { useTemplateStore as u } from "../../stores/template.js";
3
+ import { mapComposition as b } from "./recommendation/compositionMapper.js";
4
+ import { extractTitleText as y, extractCardBgColor as C } from "./recommendation/extractors.js";
5
+ import { buildBlockHtml as v } from "./recommendation/htmlBuilder.js";
6
+ import { parseRecommendationId as w, parseLegacyConfig as R } from "./recommendation/parseLegacyConfig.js";
7
+ import { mapSettings as S } from "./recommendation/settingsMapper.js";
8
+ const h = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
9
+ function x(i, t, c) {
10
+ var s;
11
+ const o = w(t);
12
+ if (o === null)
13
+ return console.warn(
14
+ "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
15
+ ), !1;
16
+ const r = R(t);
17
+ if (!r)
18
+ return console.warn(
19
+ `[RecommendationMigrator] Aborting block id=${o} \`esd-dev-product-config\` missing or unable to be parsed`
20
+ ), !1;
21
+ const n = c[String(o)];
22
+ if (!n)
23
+ return console.warn(
24
+ `[RecommendationMigrator] Aborting block id=${o} — recommendationConfigs entry missing in Guido Config`
25
+ ), !1;
26
+ const a = S(n, r, o), e = b((s = r.composition) == null ? void 0 : s.variables), d = y(t), l = C(t), g = {
27
+ ...a,
28
+ composition: e.composition,
29
+ visibility: e.visibility,
30
+ textTrimming: e.anyTextTrimming
31
+ }, p = `
32
+ <table>
33
+ <tbody>
34
+ <tr>
35
+ <td class="esd-structure" align="left">
36
+ <table width="100%" cellpadding="0" cellspacing="0">
37
+ <tbody>
38
+ <tr>${v({
39
+ nodeConfig: g,
40
+ composition: e,
41
+ cardBg: l,
42
+ titleText: d,
43
+ legacyId: t.getAttribute("id") ?? void 0,
44
+ legacyBgColor: t.getAttribute("bgcolor") ?? void 0
45
+ })}</tr>
46
+ </tbody>
47
+ </table>
48
+ </td>
49
+ </tr>
50
+ </tbody>
51
+ </table>
52
+ `, m = i.parseFromString(p, "text/html").querySelector("td.esd-structure");
53
+ return !m || !t.parentNode ? (console.warn(
54
+ `[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
55
+ ), !1) : (t.parentNode.replaceChild(m, t), !0);
56
+ }
57
+ function I(i, t = {}) {
58
+ const c = new DOMParser(), o = c.parseFromString(i, "text/html"), r = Array.from(o.querySelectorAll(h));
59
+ try {
60
+ u().$patch((e) => {
61
+ e.migrations = {
62
+ ...e.migrations,
63
+ [f.Recommendation]: r.length
64
+ };
98
65
  });
66
+ } catch {
99
67
  }
100
- /**
101
- * Extracts product configuration from old block and generates new product rows
102
- * @param block - The old recommendation block element
103
- * @returns HTML string for product rows
104
- */
105
- extractProductRows(e) {
106
- const t = this.extractProductConfig(e);
107
- if (!t)
108
- return console.warn("[RecommendationMigrator] No product config found, using defaults"), this.generateProductRows(6, 3, {});
109
- const { totalCount: o, productsPerRow: n } = t, s = this.extractProductStyles(e);
110
- return this.generateProductRows(o, n, s);
111
- }
112
- /**
113
- * Extracts Stripo padding/margin utility classes from a class string
114
- * @param classString - Space-separated class string from element
115
- * @returns Filtered Stripo utility classes as a space-separated string
116
- */
117
- extractStripoClasses(e) {
118
- return e ? e.split(/\s+/).filter((n) => /^es-(p\d+|m[-\d])/.test(n)).join(" ") : "";
119
- }
120
- /**
121
- * Extracts product configuration from old block
122
- * @param block - The old recommendation block element
123
- * @returns Object with totalCount and productsPerRow, or null if parsing fails
124
- */
125
- extractProductConfig(e) {
126
- const t = e.getAttribute("esd-dev-product-config");
127
- if (!t)
128
- return null;
68
+ if (r.length === 0)
69
+ return i;
70
+ let n = 0;
71
+ return r.forEach((a) => {
129
72
  try {
130
- const o = this.unescapeJsonString(t), n = JSON.parse(o);
131
- return {
132
- totalCount: n.totalCount ?? 6,
133
- productsPerRow: n.rowCount ?? 3
134
- };
135
- } catch (o) {
136
- return console.error("[RecommendationMigrator] Failed to parse product config:", o), console.error(
137
- "[RecommendationMigrator] Error details:",
138
- o instanceof Error ? o.message : String(o)
139
- ), null;
73
+ x(c, a, t) && (n += 1);
74
+ } catch (e) {
75
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
140
76
  }
141
- }
142
- /**
143
- * Decodes HTML entities from JSON string
144
- * @param text - The encoded string
145
- * @returns Decoded string
146
- */
147
- unescapeJsonString(e) {
148
- return e.replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/\\\\"/g, "'");
149
- }
150
- /**
151
- * Generates product rows using prepareProductRows with default product data
152
- * @param totalCount - Total number of products to display
153
- * @param productsPerRow - Number of products in each row
154
- * @param extractedStyles - Styles extracted from old product elements
155
- * @returns HTML string for product rows with applied styles
156
- */
157
- generateProductRows(e, t, o) {
158
- const n = B(), s = [];
159
- for (let i = 0; i < e; i++) {
160
- const c = n[i % n.length];
161
- s.push({ ...c });
162
- }
163
- let r = q(s, t);
164
- return r = this.applyExtractedStyles(r, o), r;
165
- }
166
- /**
167
- * Extracts styles from old product elements
168
- * @param block - The old recommendation block element
169
- * @returns Object with extracted styles for each element type
170
- */
171
- extractProductStyles(e) {
172
- const t = {}, o = e.querySelector(".product-card");
173
- if (!o)
174
- return console.warn("[RecommendationMigrator] No product card found, using default styles"), t;
175
- const n = this.extractCardBgColor(o);
176
- n && (t.cardBgColor = n);
177
- const s = o.querySelector(".ext-product-image");
178
- if (s) {
179
- const a = s.querySelector("img")?.getAttribute("width"), u = s.getAttribute("style") || "", p = s.getAttribute("align") || "center", b = s.getAttribute("class") || "", m = this.extractStripoClasses(b);
180
- t.imageWidth = a || "120", t.imageAlign = p, t.imageTdStyle = u, t.imageClasses = m;
181
- }
182
- const r = o.querySelector(".ext-product-name");
183
- if (r) {
184
- const a = r.querySelector("p")?.getAttribute("style") || "", u = r.getAttribute("align") || "center", p = r.getAttribute("style") || "", b = r.getAttribute("class") || "", m = this.extractStripoClasses(b);
185
- t.nameStyle = a, t.nameAlign = u, t.nameTdStyle = p, t.nameClasses = m;
186
- }
187
- const i = o.querySelector(".ext-product-price");
188
- if (i) {
189
- const a = i.querySelector("p")?.getAttribute("style") || "", u = i.getAttribute("align") || "center", p = i.getAttribute("style") || "", b = i.getAttribute("class") || "", m = this.extractStripoClasses(b);
190
- t.priceStyle = a, t.priceAlign = u, t.priceTdStyle = p, t.priceClasses = m;
191
- }
192
- const c = o.querySelector(".ext-product-original-price");
193
- if (c) {
194
- const a = c.querySelector("p")?.getAttribute("style") || "", u = c.getAttribute("align") || "center", p = c.getAttribute("style") || "", b = c.getAttribute("class") || "", m = this.extractStripoClasses(b);
195
- t.oldPriceStyle = a, t.oldPriceAlign = u, t.oldPriceTdStyle = p, t.oldPriceClasses = m;
196
- }
197
- const l = o.querySelector(".ext-product-button");
198
- if (l) {
199
- const g = l.querySelector(".es-button-border"), a = l.querySelector("a.es-button"), u = g?.getAttribute("style") || "", p = a?.getAttribute("style") || "", b = l.getAttribute("align") || "center", m = l.getAttribute("style") || "", f = l.getAttribute("class") || "", C = this.extractStripoClasses(f), y = (l?.textContent || "").trim();
200
- t.buttonBorderStyle = u, t.buttonLinkStyle = p, t.buttonAlign = b, t.buttonTdStyle = m, t.buttonClasses = C, t.buttonText = y;
201
- }
202
- return t;
203
- }
204
- /**
205
- * Applies extracted styles to the generated HTML
206
- * @param html - The generated HTML from prepareProductRows
207
- * @param extractedStyles - Styles extracted from old product elements
208
- * @returns HTML with applied styles
209
- */
210
- applyExtractedStyles(e, t) {
211
- if (!t || Object.keys(t).length === 0)
212
- return e;
213
- const o = this.parser.parseFromString(`<table>${e}</table>`, "text/html");
214
- return t.cardBgColor && o.querySelectorAll(".product-attribute-cell").forEach((r) => {
215
- r.setAttribute("bgcolor", t.cardBgColor);
216
- }), (t.imageWidth || t.imageAlign || t.imageTdStyle || t.imageClasses) && o.querySelectorAll(".product-image").forEach((r) => {
217
- if (t.imageAlign && r.setAttribute("align", t.imageAlign), t.imageTdStyle && r.setAttribute("style", t.imageTdStyle), t.imageClasses) {
218
- const l = `${r.getAttribute("class") || ""} ${t.imageClasses}`.trim();
219
- r.setAttribute("class", l);
220
- }
221
- const i = r.querySelector("img");
222
- i && t.imageWidth && i.setAttribute("width", t.imageWidth);
223
- }), (t.nameStyle || t.nameAlign || t.nameTdStyle || t.nameClasses) && o.querySelectorAll(".product-name").forEach((r) => {
224
- if (t.nameAlign && r.setAttribute("align", t.nameAlign), t.nameTdStyle && r.setAttribute("style", t.nameTdStyle), t.nameClasses) {
225
- const l = `${r.getAttribute("class") || ""} ${t.nameClasses}`.trim();
226
- r.setAttribute("class", l);
227
- }
228
- const i = r.querySelector("p");
229
- i && t.nameStyle && i.setAttribute("style", t.nameStyle);
230
- }), (t.priceStyle || t.priceAlign || t.priceTdStyle || t.priceClasses) && o.querySelectorAll(".product-price").forEach((r) => {
231
- if (t.priceAlign && r.setAttribute("align", t.priceAlign), t.priceTdStyle && r.setAttribute("style", t.priceTdStyle), t.priceClasses) {
232
- const l = `${r.getAttribute("class") || ""} ${t.priceClasses}`.trim();
233
- r.setAttribute("class", l);
234
- }
235
- const i = r.querySelector("p");
236
- i && t.priceStyle && i.setAttribute("style", t.priceStyle);
237
- }), (t.oldPriceStyle || t.oldPriceAlign || t.oldPriceTdStyle || t.oldPriceClasses) && o.querySelectorAll(".product-old-price").forEach((r) => {
238
- if (t.oldPriceAlign && r.setAttribute("align", t.oldPriceAlign), t.oldPriceTdStyle && r.setAttribute("style", t.oldPriceTdStyle), t.oldPriceClasses) {
239
- const l = `${r.getAttribute("class") || ""} ${t.oldPriceClasses}`.trim();
240
- r.setAttribute("class", l);
241
- }
242
- const i = r.querySelector("p");
243
- i && t.oldPriceStyle && i.setAttribute("style", t.oldPriceStyle);
244
- }), (t.buttonBorderStyle || t.buttonLinkStyle || t.buttonAlign || t.buttonTdStyle || t.buttonClasses) && o.querySelectorAll(".product-button").forEach((r) => {
245
- if (t.buttonAlign && r.setAttribute("align", t.buttonAlign), t.buttonTdStyle && r.setAttribute("style", t.buttonTdStyle), t.buttonClasses) {
246
- const g = `${r.getAttribute("class") || ""} ${t.buttonClasses}`.trim();
247
- r.setAttribute("class", g);
248
- }
249
- const i = r.querySelector(".es-button-border");
250
- i && t.buttonBorderStyle && i.setAttribute("style", t.buttonBorderStyle);
251
- const c = r.querySelector("a.es-button");
252
- c && (t.buttonLinkStyle && c.setAttribute("style", t.buttonLinkStyle), t.buttonText && (c.textContent = t.buttonText));
253
- }), o.querySelector("table")?.innerHTML || e;
254
- }
255
- /**
256
- * Builds title block with proper structure
257
- */
258
- buildTitleBlock(e) {
259
- let t = e.text;
260
- e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
261
- const o = e.align ? ` align="${e.align}"` : "", n = e.styles ? ` style="${e.styles}"` : "";
262
- return `
263
- <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r"${o}>
264
- <p path="1"${n}>
265
- ${t}
266
- </p>
267
- </td>
268
- `;
269
- }
270
- /**
271
- * Removes specified style properties from a style string
272
- */
273
- removeStyleProperties(e, t) {
274
- return e ? t.reduce((n, s) => {
275
- const r = new RegExp(`${s}\\s*:\\s*[^;]*;?`, "gi");
276
- return n.replace(r, "");
277
- }, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
278
- }
279
- /**
280
- * Converts inline display to block display
281
- */
282
- convertInlineToBlock(e) {
283
- if (!e)
284
- return "";
285
- let t = e.replace(/display\s*:\s*inline/gi, "display: block");
286
- return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").replace(/"/g, "'").trim();
287
- }
288
- }
289
- function v(d) {
290
- return new $().migrate(d);
77
+ }), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), o.documentElement.outerHTML;
291
78
  }
292
79
  export {
293
- v as migrateRecommendation
80
+ I as migrateRecommendation
294
81
  };
@@ -1,12 +1,12 @@
1
1
  var h = Object.defineProperty;
2
2
  var x = (l, e, t) => e in l ? h(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var y = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
4
- import { MERGE_TAGS as m, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
5
- import { DATA_ATTRIBUTES as S } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
3
+ var S = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
4
+ import { MERGE_TAGS as k, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
5
+ import { DATA_ATTRIBUTES as A } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
6
6
  import { useUnsubscribeStore as T } from "../../stores/unsubscribe.js";
7
7
  class C {
8
8
  constructor() {
9
- y(this, "parser");
9
+ S(this, "parser");
10
10
  this.parser = new DOMParser();
11
11
  }
12
12
  async migrate(e) {
@@ -45,6 +45,7 @@ class C {
45
45
  return i ? i[0] : "";
46
46
  }
47
47
  extractUnsubscribeContent(e) {
48
+ var m;
48
49
  const t = e.querySelector("p");
49
50
  if (!t)
50
51
  return {
@@ -71,7 +72,7 @@ class C {
71
72
  align: i,
72
73
  paragraphStyle: o
73
74
  };
74
- const c = r.textContent?.trim() || "unsubscribe", g = r.getAttribute("href") || "{{ins-unsubscribe-link}}", u = r.getAttribute("style") || "", n = t.textContent || "", s = n.indexOf(c), b = s >= 0 ? n.substring(0, s).trim() : "You can ", f = s >= 0 ? n.substring(s + c.length).trim() : " from our emails, if you need to.", d = !!t.querySelector("b, strong"), a = !!t.querySelector("i, em");
75
+ const c = ((m = r.textContent) == null ? void 0 : m.trim()) || "unsubscribe", g = r.getAttribute("href") || "{{ins-unsubscribe-link}}", u = r.getAttribute("style") || "", n = t.textContent || "", s = n.indexOf(c), b = s >= 0 ? n.substring(0, s).trim() : "You can ", f = s >= 0 ? n.substring(s + c.length).trim() : " from our emails, if you need to.", d = !!t.querySelector("b, strong"), a = !!t.querySelector("i, em");
75
76
  return {
76
77
  textBefore: b,
77
78
  linkText: c,
@@ -89,13 +90,13 @@ class C {
89
90
  e.textBefore && n.push(e.textBefore), n.push(u), e.textAfter && n.push(e.textAfter);
90
91
  let s = n.join(" ");
91
92
  e.isBold && e.isItalic ? s = `<strong path="1,0"><em path="1,0,0">${s}</em></strong>` : e.isBold ? s = `<strong path="1,0">${s}</strong>` : e.isItalic && (s = `<em path="1,0">${s}</em>`);
92
- const b = e.align ? ` align="${e.align}"` : "", f = r ? ` bgcolor="${r}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", a = i.length > 0 ? ` ${S.PAGE_LIST}="${i.join(",")}"` : "", A = ` ${S.PAGE_TYPE}="${t}"`, k = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
93
+ const b = e.align ? ` align="${e.align}"` : "", f = r ? ` bgcolor="${r}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", a = i.length > 0 ? ` ${A.PAGE_LIST}="${i.join(",")}"` : "", m = ` ${A.PAGE_TYPE}="${t}"`, y = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
93
94
  return `
94
95
  <td
95
96
  data-migration="true"
96
97
  esd-extension-block-id="unsubscribe-block"
97
- class="${o ? `${k} ${o}` : k}"
98
- ${b}${f}${A}${a}
98
+ class="${o ? `${y} ${o}` : y}"
99
+ ${b}${f}${m}${a}
99
100
  >
100
101
  <p path="1"${d}>
101
102
  ${s}
@@ -104,10 +105,10 @@ class C {
104
105
  `;
105
106
  }
106
107
  getCollectionTypeFromMergeTag(e) {
107
- return e === m[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === m[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
108
+ return e === k[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === k[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
108
109
  }
109
110
  normalizeUnsubscribeHref(e) {
110
- if (Object.values(m).includes(e))
111
+ if (Object.values(k).includes(e))
111
112
  return e;
112
113
  const i = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
113
114
  return i ? i[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
@@ -18,7 +18,8 @@ const s = {
18
18
  { text: "after the amount", value: "1" }
19
19
  ], d = [
20
20
  { text: "dot(.)", value: "." },
21
- { text: "comma(,)", value: "," }
21
+ { text: "comma(,)", value: "," },
22
+ { text: "space( )", value: " " }
22
23
  ], p = [
23
24
  { text: "0", value: "0" },
24
25
  { text: "1", value: "1" },
@@ -1,10 +1,11 @@
1
1
  import { useTranslations as R } from "../composables/useTranslations.js";
2
- import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
3
2
  import { ProductType as s } from "../@types/config/schemas.js";
4
- const r = {
3
+ import "../@types/config/defaults.js";
4
+ import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
5
+ const B = {
5
6
  UNSUBSCRIBE_LINK_TYPE: 1,
6
7
  PREFERENCES_LINK_TYPE: 3
7
- }, B = {
8
+ }, i = {
8
9
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
9
10
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
10
11
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
@@ -12,11 +13,11 @@ const r = {
12
13
  }, n = S(), C = {
13
14
  UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
14
15
  PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
15
- }, i = {
16
+ }, U = {
16
17
  [s.EMAIL]: "email",
17
18
  [s.ARCHITECT]: "journey",
18
19
  [s.UNSUBSCRIBE_PAGES]: "email"
19
- }, U = "iid", t = {
20
+ }, t = "iid", o = {
20
21
  name: "Global Unsubscribe",
21
22
  sendGridId: "G"
22
23
  }, c = "/email/unsubscribe-pages", E = {
@@ -25,10 +26,10 @@ const r = {
25
26
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
26
27
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
27
28
  RESUBSCRIBE: 5
28
- }, o = {
29
+ }, u = {
29
30
  [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
30
31
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
31
- }, u = {
32
+ }, T = {
32
33
  [E.GLOBAL_UNSUBSCRIBE]: [
33
34
  E.GLOBAL_UNSUBSCRIBE,
34
35
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -38,7 +39,7 @@ const r = {
38
39
  E.SUBSCRIPTION_PREFERENCE_CENTER,
39
40
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
40
41
  ]
41
- }, T = () => {
42
+ }, b = () => {
42
43
  const e = R();
43
44
  return {
44
45
  [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
@@ -47,22 +48,22 @@ const r = {
47
48
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
48
49
  [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
49
50
  };
50
- }, b = {
51
+ }, P = {
51
52
  default: "{{ins-unsubscribe-link}}",
52
53
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
53
54
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
54
55
  };
55
56
  export {
56
- t as DEFAULT_UNSUBSCRIBE_GROUP,
57
- U as INSIDER_ID,
58
- B as LINK_REGEXES,
59
- r as LINK_TYPES,
60
- b as MERGE_TAGS,
57
+ o as DEFAULT_UNSUBSCRIBE_GROUP,
58
+ t as INSIDER_ID,
59
+ i as LINK_REGEXES,
60
+ B as LINK_TYPES,
61
+ P as MERGE_TAGS,
61
62
  E as PAGE_TYPES,
62
- i as PRODUCT_TYPE_URL_SEGMENTS,
63
- u as TYPE_COLLECTIONS,
63
+ U as PRODUCT_TYPE_URL_SEGMENTS,
64
+ T as TYPE_COLLECTIONS,
64
65
  c as UNSUBSCRIBE_PAGES_LINK,
65
- o as UNSUBSCRIBE_SYNC_MODULE_TYPES,
66
+ u as UNSUBSCRIBE_SYNC_MODULE_TYPES,
66
67
  C as URLS,
67
- T as getTypeTranslations
68
+ b as getTypeTranslations
68
69
  };