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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/@types/config/validator.js +27 -34
  4. package/dist/components/Guido.vue.js +4 -4
  5. package/dist/components/Guido.vue2.js +87 -82
  6. package/dist/components/organisms/base/Toaster.vue2.js +10 -11
  7. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -12
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  9. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  10. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +6 -6
  11. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +9 -15
  12. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +31 -40
  13. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +19 -20
  14. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +11 -14
  15. package/dist/components/organisms/header/EditorActions.vue.js +12 -13
  16. package/dist/components/organisms/header/EditorActions.vue2.js +51 -40
  17. package/dist/components/organisms/header/HeaderWrapper.vue2.js +12 -15
  18. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -19
  19. package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -11
  20. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  21. package/dist/components/organisms/header/RightSlot.vue2.js +13 -13
  22. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +11 -12
  23. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +49 -31
  24. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +12 -13
  25. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +36 -38
  26. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +12 -13
  27. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +47 -51
  28. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +18 -21
  29. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +27 -31
  30. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +12 -13
  31. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +33 -46
  32. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +11 -12
  33. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +20 -21
  34. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -18
  35. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +9 -10
  36. package/dist/composables/useActionsApi.js +37 -38
  37. package/dist/composables/useBlocksConfig.js +26 -26
  38. package/dist/composables/useFullStoryBridge.js +13 -0
  39. package/dist/composables/useHtmlCompiler.js +34 -24
  40. package/dist/composables/useHtmlValidator.js +91 -97
  41. package/dist/composables/useHttp.js +30 -30
  42. package/dist/composables/usePartner.js +1 -1
  43. package/dist/composables/usePreviewMode.js +20 -16
  44. package/dist/composables/useRecommendation.js +14 -15
  45. package/dist/composables/useRibbonOffset.js +21 -0
  46. package/dist/composables/useSave.js +23 -16
  47. package/dist/composables/useStripo.js +55 -47
  48. package/dist/composables/useSyncModuleExtractor.js +31 -29
  49. package/dist/composables/useTimerClone.js +24 -25
  50. package/dist/composables/useTranslations.js +2 -3
  51. package/dist/composables/useValidation.js +7 -8
  52. package/dist/composables/validators/useLiquidValidator.js +42 -0
  53. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  54. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  55. package/dist/config/compiler/unsubscribeCompilerRules.js +45 -44
  56. package/dist/config/compiler/utils/recommendationCompilerUtils.js +51 -46
  57. package/dist/config/migrator/checkboxMigrator.js +23 -22
  58. package/dist/config/migrator/couponBlockMigrator.js +18 -19
  59. package/dist/config/migrator/itemsBlockMigrator.js +87 -89
  60. package/dist/config/migrator/radioButtonMigrator.js +19 -18
  61. package/dist/config/migrator/recommendationMigrator.js +107 -110
  62. package/dist/config/migrator/unsubscribeMigrator.js +10 -11
  63. package/dist/enums/extensions/recommendationBlock.js +14 -11
  64. package/dist/enums/onboarding.js +7 -2
  65. package/dist/enums/recommendation.js +2 -2
  66. package/dist/enums/unsubscribe.js +33 -27
  67. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  68. package/dist/extensions/Blocks/Items/block.js +9 -9
  69. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -14
  70. package/dist/extensions/Blocks/Items/controls/cardComposition.js +89 -97
  71. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -14
  72. package/dist/extensions/Blocks/Items/controls/name/trimming.js +23 -24
  73. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +13 -14
  74. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +44 -47
  75. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +38 -38
  76. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +11 -11
  77. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +38 -40
  78. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +35 -35
  79. package/dist/extensions/Blocks/Items/controls/settingsControl.js +155 -162
  80. package/dist/extensions/Blocks/Items/enums/productEnums.js +21 -14
  81. package/dist/extensions/Blocks/Items/template.js +210 -210
  82. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  83. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  84. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +36 -36
  85. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +208 -200
  86. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +23 -20
  87. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  88. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +9 -9
  89. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +19 -20
  90. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +4 -6
  91. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +84 -90
  92. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +18 -18
  93. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +4 -4
  94. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +35 -36
  95. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +127 -126
  96. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +24 -24
  97. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  98. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +24 -24
  99. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +24 -24
  100. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +4 -4
  101. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +4 -4
  102. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +24 -24
  103. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +4 -4
  104. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +4 -4
  105. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +24 -24
  106. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  107. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +50 -50
  108. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +18 -20
  109. package/dist/extensions/Blocks/Recommendation/extension.js +31 -32
  110. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +25 -32
  111. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +72 -69
  112. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -23
  113. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +10 -10
  114. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +28 -27
  115. package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -9
  116. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +26 -25
  117. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  118. package/dist/extensions/Blocks/Recommendation/templates/utils.js +53 -48
  119. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  120. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +13 -16
  121. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  122. package/dist/extensions/Blocks/Unsubscribe/control.js +11 -13
  123. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +16 -18
  124. package/dist/extensions/Blocks/common-control.js +25 -26
  125. package/dist/extensions/DynamicContent/dynamic-content.js +59 -59
  126. package/dist/guido.css +1 -1
  127. package/dist/library.js +11 -12
  128. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +232 -210
  129. package/dist/node_modules/lodash-es/_getValue.js +1 -1
  130. package/dist/node_modules/valibot/dist/index.js +122 -126
  131. package/dist/package.json.js +1 -1
  132. package/dist/services/recommendationApi.js +12 -15
  133. package/dist/services/stripoApi.js +9 -9
  134. package/dist/services/templateLibraryApi.js +49 -48
  135. package/dist/src/@types/config/index.d.ts +1 -1
  136. package/dist/src/@types/config/schemas.d.ts +28 -0
  137. package/dist/src/@types/config/types.d.ts +3 -1
  138. package/dist/src/@types/generic.d.ts +0 -1
  139. package/dist/src/@types/save-as-template.d.ts +1 -0
  140. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  141. package/dist/src/composables/useActionsApi.d.ts +1 -1
  142. package/dist/src/composables/useConfig.d.ts +12 -0
  143. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  144. package/dist/src/composables/useHtmlCompiler.d.ts +1 -2
  145. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  146. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  147. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  148. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  149. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  150. package/dist/src/enums/onboarding.d.ts +6 -0
  151. package/dist/src/enums/unsubscribe.d.ts +5 -0
  152. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  153. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  154. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  155. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  156. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  157. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  158. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  159. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  160. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  161. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  162. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  163. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  164. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  165. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  166. package/dist/src/stores/config.d.ts +108 -0
  167. package/dist/src/stores/dynamic-content.d.ts +3 -3
  168. package/dist/src/stores/onboarding.d.ts +4 -0
  169. package/dist/src/stores/preview.d.ts +3 -0
  170. package/dist/src/utils/genericUtil.d.ts +1 -1
  171. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  172. package/dist/static/styles/base.css.js +7 -2
  173. package/dist/static/styles/components/button.css.js +3 -2
  174. package/dist/static/styles/components/loader.css.js +4 -0
  175. package/dist/stores/config.js +25 -81
  176. package/dist/stores/dynamic-content.js +6 -11
  177. package/dist/stores/onboarding.js +5 -1
  178. package/dist/stores/preview.js +8 -10
  179. package/dist/stores/unsubscribe.js +1 -4
  180. package/dist/utils/dateUtil.js +7 -10
  181. package/dist/utils/genericUtil.js +39 -20
  182. package/dist/utils/htmlCompiler.js +48 -41
  183. package/dist/utils/pairProductVariables.js +13 -14
  184. package/dist/utils/templatePreparation.js +36 -25
  185. package/dist/utils/tooltipUtils.js +4 -5
  186. package/package.json +9 -4
  187. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  188. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  189. package/dist/node_modules/lodash-es/_Set.js +0 -6
  190. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  191. package/dist/node_modules/lodash-es/_Stack.js +0 -18
  192. package/dist/node_modules/lodash-es/_Uint8Array.js +0 -5
  193. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  194. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  195. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +0 -20
  196. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  197. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  198. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  199. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  200. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  201. package/dist/node_modules/lodash-es/_baseFor.js +0 -5
  202. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  203. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  204. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  205. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  206. package/dist/node_modules/lodash-es/_baseIsArguments.js +0 -9
  207. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  208. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  209. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  210. package/dist/node_modules/lodash-es/_baseIsTypedArray.js +0 -12
  211. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  212. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  213. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  214. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  215. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  216. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  217. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  218. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  219. package/dist/node_modules/lodash-es/_baseTimes.js +0 -8
  220. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  221. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  222. package/dist/node_modules/lodash-es/_baseUnary.js +0 -8
  223. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  224. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  225. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  226. package/dist/node_modules/lodash-es/_createBaseFor.js +0 -13
  227. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  228. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  229. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  230. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  231. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  232. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  233. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  234. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  235. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  236. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  237. package/dist/node_modules/lodash-es/_isIndex.js +0 -8
  238. package/dist/node_modules/lodash-es/_isIterateeCall.js +0 -13
  239. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  240. package/dist/node_modules/lodash-es/_isPrototype.js +0 -8
  241. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  242. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  243. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  244. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  245. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  246. package/dist/node_modules/lodash-es/_nodeUtil.js +0 -11
  247. package/dist/node_modules/lodash-es/_overArg.js +0 -8
  248. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  249. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  250. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  251. package/dist/node_modules/lodash-es/_stackClear.js +0 -7
  252. package/dist/node_modules/lodash-es/_stackDelete.js +0 -7
  253. package/dist/node_modules/lodash-es/_stackGet.js +0 -6
  254. package/dist/node_modules/lodash-es/_stackHas.js +0 -6
  255. package/dist/node_modules/lodash-es/_stackSet.js +0 -17
  256. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  257. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  258. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  259. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  260. package/dist/node_modules/lodash-es/get.js +0 -8
  261. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  262. package/dist/node_modules/lodash-es/identity.js +0 -6
  263. package/dist/node_modules/lodash-es/isArguments.js +0 -10
  264. package/dist/node_modules/lodash-es/isArray.js +0 -4
  265. package/dist/node_modules/lodash-es/isArrayLike.js +0 -8
  266. package/dist/node_modules/lodash-es/isBuffer.js +0 -6
  267. package/dist/node_modules/lodash-es/isLength.js +0 -7
  268. package/dist/node_modules/lodash-es/isObjectLike.js +0 -6
  269. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  270. package/dist/node_modules/lodash-es/isTypedArray.js +0 -7
  271. package/dist/node_modules/lodash-es/keys.js +0 -9
  272. package/dist/node_modules/lodash-es/map.js +0 -11
  273. package/dist/node_modules/lodash-es/property.js +0 -10
  274. package/dist/node_modules/lodash-es/range.js +0 -5
  275. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  276. package/dist/node_modules/lodash-es/stubFalse.js +0 -6
  277. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  278. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  279. package/dist/node_modules/lodash-es/toString.js +0 -7
@@ -1,42 +1,42 @@
1
- var X = Object.defineProperty;
2
- var J = (p, f, t) => f in p ? X(p, f, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[f] = t;
3
- var T = (p, f, t) => J(p, typeof f != "symbol" ? f + "" : f, t);
4
- import { UIElementType as _, UEAttr as $, ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as Q } from "../../../common-control.js";
6
- import { ATTR_PRODUCT_IMAGE as L, ATTR_PRODUCT_NAME as Z, ATTR_PRODUCT_PRICE as tt, ATTR_PRODUCT_OLD_PRICE as et, ATTR_PRODUCT_OMNIBUS_PRICE as rt, ATTR_PRODUCT_OMNIBUS_DISCOUNT as ot, ATTR_PRODUCT_BUTTON as D, ATTR_DATA_CUSTOM_ATTRIBUTES as B, ATTR_CUSTOM_PREFIX as m } from "../../constants/selectors.js";
7
- import { DEFAULT_COMPOSITION as U, DEFAULT_VISIBILITY as P } from "../../constants/defaultConfig.js";
8
- import { RecommendationConfigService as st } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as it } from "../../store/recommendation.js";
10
- import { ATTRIBUTE_CELL_CLASS as nt, DEFAULT_CELL_PADDING as lt, gridElementRenderer as at } from "../../templates/grid/elementRenderer.js";
11
- import { listElementRenderer as ct } from "../../templates/list/elementRenderer.js";
12
- import { toDisplayName as ut, buildElementRenderer as w } from "../../templates/utils.js";
13
- import { getTableDisplayValue as dt } from "../../utils/tagName.js";
14
- import { getCurrentLayout as mt } from "../main/utils.js";
15
- const ht = "ui-elements-recommendation-card-composition", A = ".recommendation-attribute-row", N = ".product-card-wrapper > tbody", F = ".product-info-cell > table > tbody", M = "data-card-composition", y = "data-attribute-type", I = "data-visibility", j = {
1
+ var Y = Object.defineProperty;
2
+ var X = (p, f, t) => f in p ? Y(p, f, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[f] = t;
3
+ var C = (p, f, t) => X(p, typeof f != "symbol" ? f + "" : f, t);
4
+ import { UIElementType as _, UEAttr as $, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as J } from "../../../common-control.js";
6
+ import { DEFAULT_COMPOSITION as H, DEFAULT_VISIBILITY as k } from "../../constants/defaultConfig.js";
7
+ import { RecommendationConfigService as Q } from "../../services/configService.js";
8
+ import { useRecommendationExtensionStore as Z } from "../../store/recommendation.js";
9
+ import { ATTRIBUTE_CELL_CLASS as tt, gridElementRenderer as et, DEFAULT_CELL_PADDING as rt } from "../../templates/grid/elementRenderer.js";
10
+ import { listElementRenderer as ot } from "../../templates/list/elementRenderer.js";
11
+ import { toDisplayName as st, isDefaultAttribute as it, buildElementRenderer as q } from "../../templates/utils.js";
12
+ import { getTableDisplayValue as nt } from "../../utils/tagName.js";
13
+ import { getCurrentLayout as lt } from "../main/utils.js";
14
+ import { ATTR_PRODUCT_IMAGE as L, ATTR_PRODUCT_NAME as at, ATTR_PRODUCT_PRICE as ct, ATTR_PRODUCT_OLD_PRICE as dt, ATTR_PRODUCT_OMNIBUS_PRICE as ut, ATTR_PRODUCT_OMNIBUS_DISCOUNT as mt, ATTR_PRODUCT_BUTTON as D, ATTR_DATA_CUSTOM_ATTRIBUTES as w, ATTR_CUSTOM_PREFIX as m, BUILT_IN_DEFAULT_ATTRIBUTES as ht } from "../../constants/selectors.js";
15
+ const pt = "ui-elements-recommendation-card-composition", T = ".recommendation-attribute-row", N = ".product-card-wrapper > tbody", P = ".product-info-cell > table > tbody", F = "data-card-composition", b = "data-attribute-type", I = "data-visibility", M = {
16
16
  ADD_ATTRIBUTE: "addAttribute"
17
17
  }, g = 5, v = "reorderIcon_", h = [
18
18
  { key: L, label: "Product Image" },
19
- { key: Z, label: "Product Name" },
20
- { key: tt, label: "Product Price" },
21
- { key: et, label: "Product Original Price" },
22
- { key: rt, label: "Omnibus Price" },
23
- { key: ot, label: "Omnibus Discount" },
19
+ { key: at, label: "Product Name" },
20
+ { key: ct, label: "Product Price" },
21
+ { key: dt, label: "Product Original Price" },
22
+ { key: ut, label: "Omnibus Price" },
23
+ { key: mt, label: "Omnibus Discount" },
24
24
  { key: D, label: "Product Button" }
25
- ], pt = new Set(h.map((p) => p.key)), C = "customAttr_", O = "deleteAttr_";
26
- class Rt extends Q {
25
+ ], ft = new Set(h.map((p) => p.key)), A = "customAttr_", O = "deleteAttr_";
26
+ class Et extends J {
27
27
  constructor() {
28
28
  super(...arguments);
29
- T(this, "store", it());
30
- T(this, "unsubscribeStore", null);
31
- T(this, "eventController", null);
29
+ C(this, "store", Z());
30
+ C(this, "unsubscribeStore", null);
31
+ C(this, "eventController", null);
32
32
  /**
33
33
  * Guard flag: when true, onTemplateNodeUpdated skips _initializeComposition.
34
34
  * Used during _onReorder to prevent multiple intermediate rebuilds.
35
35
  */
36
- T(this, "reorderInProgress", !1);
36
+ C(this, "reorderInProgress", !1);
37
37
  }
38
38
  getId() {
39
- return ht;
39
+ return pt;
40
40
  }
41
41
  // ========================================================================
42
42
  // Lifecycle
@@ -48,10 +48,10 @@ class Rt extends Q {
48
48
  </div>
49
49
  `).join(""), r = Array.from(
50
50
  { length: g },
51
- (l, u) => `
52
- <div data-custom-select-key="${C}${u}" style="display: none;">
51
+ (l, d) => `
52
+ <div data-custom-select-key="${A}${d}" style="display: none;">
53
53
  ${this._GuSelect({
54
- name: `${C}${u}`,
54
+ name: `${A}${d}`,
55
55
  placeholder: this.api.translate("Select Attribute"),
56
56
  options: []
57
57
  })}
@@ -59,11 +59,11 @@ class Rt extends Q {
59
59
  `
60
60
  ).join(""), e = h.length + g, o = Array.from(
61
61
  { length: e },
62
- (l, u) => `
63
- <div data-reorder-icon-key="${v}${u}" style="display: none;">
62
+ (l, d) => `
63
+ <div data-reorder-icon-key="${v}${d}" style="display: none;">
64
64
  <${_.BUTTON}
65
65
  class="drag-handle-btn flat-inline flat-white"
66
- ${$.BUTTON.name}="${v}${u}"
66
+ ${$.BUTTON.name}="${v}${d}"
67
67
  >
68
68
  <${_.ICON}
69
69
  src="reorder"
@@ -74,11 +74,11 @@ class Rt extends Q {
74
74
  `
75
75
  ).join(""), s = Array.from(
76
76
  { length: g },
77
- (l, u) => `
78
- <div data-custom-delete-key="${O}${u}" style="display: none;">
77
+ (l, d) => `
78
+ <div data-custom-delete-key="${O}${d}" style="display: none;">
79
79
  <${_.BUTTON}
80
80
  class="custom-attr-delete flat-inline flat-white"
81
- ${$.BUTTON.name}="${O}${u}"
81
+ ${$.BUTTON.name}="${O}${d}"
82
82
  >
83
83
  <${_.ICON}
84
84
  src="delete"
@@ -87,17 +87,17 @@ class Rt extends Q {
87
87
  </${_.BUTTON}>
88
88
  </div>
89
89
  `
90
- ).join(""), n = "https://academy.insiderone.com/docs/new-editor-email-recommendation-block", i = this.api.translate(
90
+ ).join(""), i = "https://academy.insiderone.com/docs/new-editor-email-recommendation-block", n = this.api.translate(
91
91
  "Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
92
- ), a = this.api.translate("For more information, you can"), c = this.api.translate("visit Academy");
92
+ ), c = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
93
93
  return `
94
94
  <div class="recommendation-controls-container" data-card-composition-control>
95
95
  <div class="container">
96
96
  <p class="card-composition-description">
97
- ${i}
98
- ${a}
97
+ ${n}
98
+ ${c}
99
99
  <!-- cspell:disable-next-line -->
100
- <a href="${n}" target="_blank" rel="noopener noreferrer">${c}</a>.
100
+ <a href="${i}" target="_blank" rel="noopener noreferrer">${a}</a>.
101
101
  </p>
102
102
  </div>
103
103
 
@@ -120,7 +120,7 @@ class Rt extends Q {
120
120
  <div class="orderable-list" data-composition-list></div>
121
121
 
122
122
  ${this._GuButton({
123
- name: j.ADD_ATTRIBUTE,
123
+ name: M.ADD_ATTRIBUTE,
124
124
  label: this.api.translate("Add Attribute"),
125
125
  id: "guido__btn-add-attribute"
126
126
  })}
@@ -150,7 +150,7 @@ class Rt extends Q {
150
150
  });
151
151
  });
152
152
  for (let t = 0; t < g; t++) {
153
- const r = `${C}${t}`, e = t;
153
+ const r = `${A}${t}`, e = t;
154
154
  this.api.onValueChanged(r, (o) => {
155
155
  this._onCustomAttributeChanged(e, o);
156
156
  });
@@ -161,14 +161,14 @@ class Rt extends Q {
161
161
  // ========================================================================
162
162
  _readCompositionFromNode() {
163
163
  if (!this.currentNode || !("getAttribute" in this.currentNode))
164
- return [...U];
165
- const t = this.currentNode.getAttribute(M);
166
- return t ? t.split(",").filter(Boolean) : [...U];
164
+ return [...H];
165
+ const t = this.currentNode.getAttribute(F);
166
+ return t ? t.split(",").filter(Boolean) : [...H];
167
167
  }
168
168
  _readCustomAttributesFromNode() {
169
169
  if (!this.currentNode || !("getAttribute" in this.currentNode))
170
170
  return [];
171
- const t = this.currentNode.getAttribute(B);
171
+ const t = this.currentNode.getAttribute(w);
172
172
  if (!t)
173
173
  return [];
174
174
  try {
@@ -180,18 +180,18 @@ class Rt extends Q {
180
180
  _readVisibilityFromRows() {
181
181
  if (!this.currentNode)
182
182
  return this._getDefaultVisibilities();
183
- const t = Array.from(this.currentNode.querySelectorAll(A)), r = this._extractVisibilityFromRows(t);
183
+ const t = Array.from(this.currentNode.querySelectorAll(T)), r = this._extractVisibilityFromRows(t);
184
184
  return this._mergeWithDefaults(r);
185
185
  }
186
186
  _getDefaultVisibilities() {
187
- return { ...P };
187
+ return { ...k };
188
188
  }
189
189
  _extractVisibilityFromRows(t) {
190
190
  const r = {};
191
191
  return t.forEach((e) => {
192
192
  if (!("getAttribute" in e))
193
193
  return;
194
- const o = e.getAttribute(y), s = e.getAttribute(I);
194
+ const o = e.getAttribute(b), s = e.getAttribute(I);
195
195
  o && s !== null && (r[o] = this._parseVisibilityValue(s));
196
196
  }), r;
197
197
  }
@@ -199,7 +199,7 @@ class Rt extends Q {
199
199
  return t === "1" || t === "true";
200
200
  }
201
201
  _mergeWithDefaults(t) {
202
- return Object.entries(P).forEach(([r, e]) => {
202
+ return Object.entries(k).forEach(([r, e]) => {
203
203
  r in t || (t[r] = e);
204
204
  }), t;
205
205
  }
@@ -222,20 +222,20 @@ class Rt extends Q {
222
222
  if (!o || this._tryReorderInPlace(o, t))
223
223
  return !1;
224
224
  const s = new Set(r);
225
- let n = 0, i = 0;
226
- const a = t.map((c) => {
227
- if (pt.has(c)) {
228
- const l = h.find((u) => u.key === c);
229
- return this._createBuiltInItemHtml(l, i++);
225
+ let i = 0, n = 0;
226
+ const c = t.map((a) => {
227
+ if (ft.has(a)) {
228
+ const l = h.find((d) => d.key === a);
229
+ return this._createBuiltInItemHtml(l, n++);
230
230
  }
231
- if (c.startsWith(m)) {
232
- const l = c.substring(m.length);
231
+ if (a.startsWith(m)) {
232
+ const l = a.substring(m.length);
233
233
  if (s.has(l))
234
- return this._createCustomItemHtml(c, n++, i++);
234
+ return this._createCustomItemHtml(a, i++, n++);
235
235
  }
236
236
  return "";
237
237
  }).join("");
238
- return this._rescueTogglesToStore(e), this._rescueSelectsToStore(e), this._rescueDeleteButtonsToStore(e), this._rescueReorderIconsToStore(e), o.innerHTML = a, this._moveTogglesIntoItems(e), this._moveSelectsIntoItems(e, r.length), this._moveDeleteButtonsIntoItems(e, r.length), this._moveReorderIconsIntoItems(e, i), !0;
238
+ return this._rescueTogglesToStore(e), this._rescueSelectsToStore(e), this._rescueDeleteButtonsToStore(e), this._rescueReorderIconsToStore(e), o.innerHTML = c, this._moveTogglesIntoItems(e), this._moveSelectsIntoItems(e, r.length), this._moveDeleteButtonsIntoItems(e, r.length), this._moveReorderIconsIntoItems(e, n), !0;
239
239
  }
240
240
  /**
241
241
  * Attempts to reorder existing orderable-item elements to match the composition order.
@@ -247,27 +247,27 @@ class Rt extends Q {
247
247
  const e = Array.from(t.querySelectorAll(".orderable-item"));
248
248
  if (e.length !== r.length)
249
249
  return !1;
250
- const o = e.map((c) => c.dataset.key).filter(Boolean);
250
+ const o = e.map((a) => a.dataset.key).filter(Boolean);
251
251
  if (o.length !== r.length)
252
252
  return !1;
253
- const s = [...o].sort().join(","), n = [...r].sort().join(",");
254
- if (s !== n || r.some((c) => c.startsWith(m)))
253
+ const s = [...o].sort().join(","), i = [...r].sort().join(",");
254
+ if (s !== i || r.some((a) => a.startsWith(m)))
255
255
  return !1;
256
- const i = /* @__PURE__ */ new Map();
257
- e.forEach((c) => {
258
- const { key: l } = c.dataset;
256
+ const n = /* @__PURE__ */ new Map();
257
+ e.forEach((a) => {
258
+ const { key: l } = a.dataset;
259
259
  if (l) {
260
- const u = i.get(l) || [];
261
- u.push(c), i.set(l, u);
260
+ const d = n.get(l) || [];
261
+ d.push(a), n.set(l, d);
262
262
  }
263
263
  });
264
- const a = /* @__PURE__ */ new Map();
265
- return r.forEach((c) => {
266
- const l = i.get(c);
264
+ const c = /* @__PURE__ */ new Map();
265
+ return r.forEach((a) => {
266
+ const l = n.get(a);
267
267
  if (!l)
268
268
  return;
269
- const u = a.get(c) || 0;
270
- a.set(c, u + 1), l[u] && t.appendChild(l[u]);
269
+ const d = c.get(a) || 0;
270
+ c.set(a, d + 1), l[d] && t.appendChild(l[d]);
271
271
  }), !0;
272
272
  }
273
273
  _createBuiltInItemHtml(t, r) {
@@ -297,10 +297,10 @@ class Rt extends Q {
297
297
  * Falls back to a single option for the currently selected attribute.
298
298
  */
299
299
  _getSelectOptions(t, r = []) {
300
- const { filterList: e } = this.store, o = Object.values(e);
301
- if (o.length > 0) {
302
- const n = new Set(r);
303
- return n.delete(t), o.filter((i) => !n.has(i.attributeName)).map((i) => ({
300
+ const e = this._getAddableFilters();
301
+ if (e.length > 0) {
302
+ const s = new Set(r);
303
+ return s.delete(t), e.filter((i) => !s.has(i.attributeName)).map((i) => ({
304
304
  text: i.displayName,
305
305
  value: i.attributeName
306
306
  }));
@@ -315,7 +315,7 @@ class Rt extends Q {
315
315
  _initializeCustomSelects(t) {
316
316
  t.length !== 0 && setTimeout(() => {
317
317
  t.forEach((r, e) => {
318
- const o = `${C}${e}`, s = this._getSelectOptions(r, t);
318
+ const o = `${A}${e}`, s = this._getSelectOptions(r, t);
319
319
  this.api.setUIEAttribute(o, $.SELECTPICKER.items, s), this.api.updateValues({ [o]: r });
320
320
  });
321
321
  }, 0);
@@ -339,10 +339,10 @@ class Rt extends Q {
339
339
  */
340
340
  _moveSelectsIntoItems(t, r) {
341
341
  for (let e = 0; e < r; e++) {
342
- const o = `${C}${e}`, s = t.querySelector(`[data-custom-select-key="${o}"]`), n = t.querySelector(`[data-custom-select-slot="${e}"]`);
343
- if (s && n) {
344
- const i = s.querySelector("ue-select");
345
- i && n.appendChild(i);
342
+ const o = `${A}${e}`, s = t.querySelector(`[data-custom-select-key="${o}"]`), i = t.querySelector(`[data-custom-select-slot="${e}"]`);
343
+ if (s && i) {
344
+ const n = s.querySelector("ue-select");
345
+ n && i.appendChild(n);
346
346
  }
347
347
  }
348
348
  }
@@ -367,10 +367,10 @@ class Rt extends Q {
367
367
  */
368
368
  _rescueSelectsToStore(t) {
369
369
  for (let r = 0; r < g; r++) {
370
- const e = `${C}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
370
+ const e = `${A}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
371
371
  if (s) {
372
- const n = s.querySelector("ue-select");
373
- n && o && o.appendChild(n);
372
+ const i = s.querySelector("ue-select");
373
+ i && o && o.appendChild(i);
374
374
  }
375
375
  }
376
376
  }
@@ -380,10 +380,10 @@ class Rt extends Q {
380
380
  */
381
381
  _moveDeleteButtonsIntoItems(t, r) {
382
382
  for (let e = 0; e < r; e++) {
383
- const o = `${O}${e}`, s = t.querySelector(`[data-custom-delete-key="${o}"]`), n = t.querySelector(`[data-custom-delete-slot="${e}"]`);
384
- if (s && n) {
385
- const i = s.querySelector("ue-button");
386
- i && n.appendChild(i);
383
+ const o = `${O}${e}`, s = t.querySelector(`[data-custom-delete-key="${o}"]`), i = t.querySelector(`[data-custom-delete-slot="${e}"]`);
384
+ if (s && i) {
385
+ const n = s.querySelector("ue-button");
386
+ n && i.appendChild(n);
387
387
  }
388
388
  }
389
389
  }
@@ -395,8 +395,8 @@ class Rt extends Q {
395
395
  for (let r = 0; r < g; r++) {
396
396
  const e = `${O}${r}`, o = t.querySelector(`[data-custom-delete-key="${e}"]`), s = t.querySelector(`[data-custom-delete-slot="${r}"]`);
397
397
  if (s) {
398
- const n = s.querySelector("ue-button");
399
- n && o && o.appendChild(n);
398
+ const i = s.querySelector("ue-button");
399
+ i && o && o.appendChild(i);
400
400
  }
401
401
  }
402
402
  }
@@ -406,10 +406,10 @@ class Rt extends Q {
406
406
  */
407
407
  _moveReorderIconsIntoItems(t, r) {
408
408
  for (let e = 0; e < r; e++) {
409
- const o = `${v}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), n = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
410
- if (s && n) {
411
- const i = s.querySelector("ue-button");
412
- i && n.appendChild(i);
409
+ const o = `${v}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), i = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
410
+ if (s && i) {
411
+ const n = s.querySelector("ue-button");
412
+ n && i.appendChild(n);
413
413
  }
414
414
  }
415
415
  }
@@ -420,10 +420,10 @@ class Rt extends Q {
420
420
  _rescueReorderIconsToStore(t) {
421
421
  const r = h.length + g;
422
422
  for (let e = 0; e < r; e++) {
423
- const o = `${v}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), n = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
424
- if (n) {
425
- const i = n.querySelector("ue-button");
426
- i && s && s.appendChild(i);
423
+ const o = `${v}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), i = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
424
+ if (i) {
425
+ const n = i.querySelector("ue-button");
426
+ n && s && s.appendChild(n);
427
427
  }
428
428
  }
429
429
  }
@@ -437,31 +437,30 @@ class Rt extends Q {
437
437
  return;
438
438
  const e = r.querySelector("[data-composition-list]"), o = r.querySelector("#guido__btn-add-attribute");
439
439
  e && (this._setupDragAndDrop(e, t), this._setupDeleteHandler(e, t)), o && o.addEventListener("click", () => {
440
- const s = new Set(this._readCustomAttributesFromNode()), i = Object.values(this.store.filterList).find((a) => !s.has(a.attributeName));
440
+ const s = new Set(this._readCustomAttributesFromNode()), i = this._getAddableFilters().find((n) => !s.has(n.attributeName));
441
441
  i && this._onAddAttribute(i.attributeName, i.displayName);
442
442
  }, { signal: t });
443
443
  }
444
444
  _setupDragAndDrop(t, r) {
445
445
  let e = null, o = null;
446
446
  t.addEventListener("dragstart", (s) => {
447
- var a;
448
- const i = s.target.closest(".orderable-item");
449
- i && (e = i, i.classList.add("dragging"), (a = s.dataTransfer) == null || a.setData("text/plain", i.dataset.key || ""));
447
+ const n = s.target.closest(".orderable-item");
448
+ n && (e = n, n.classList.add("dragging"), s.dataTransfer?.setData("text/plain", n.dataset.key || ""));
450
449
  }, { signal: r }), t.addEventListener("dragend", () => {
451
- e && e.classList.remove("dragging"), e = null, o == null || o.classList.remove("drag-over"), o = null;
450
+ e && e.classList.remove("dragging"), e = null, o?.classList.remove("drag-over"), o = null;
452
451
  }, { signal: r }), t.addEventListener("dragover", (s) => {
453
452
  s.preventDefault();
454
- const i = s.target.closest(".orderable-item"), a = i && i !== e ? i : null;
455
- a !== o && (o == null || o.classList.remove("drag-over"), o = a, o == null || o.classList.add("drag-over"));
453
+ const n = s.target.closest(".orderable-item"), c = n && n !== e ? n : null;
454
+ c !== o && (o?.classList.remove("drag-over"), o = c, o?.classList.add("drag-over"));
456
455
  }, { signal: r }), t.addEventListener("drop", (s) => {
457
456
  s.preventDefault();
458
- const i = s.target.closest(".orderable-item");
459
- if (!i || !e || i === e)
457
+ const n = s.target.closest(".orderable-item");
458
+ if (!n || !e || n === e)
460
459
  return;
461
- const a = i.getBoundingClientRect(), c = a.top + a.height / 2;
462
- s.clientY < c ? t.insertBefore(e, i) : t.insertBefore(e, i.nextSibling), o == null || o.classList.remove("drag-over"), o = null, e.classList.remove("dragging");
463
- const u = t.querySelectorAll(".orderable-item"), d = Array.from(u).map((b) => b.dataset.key).filter(Boolean);
464
- this._onReorder(d), e = null;
460
+ const c = n.getBoundingClientRect(), a = c.top + c.height / 2;
461
+ s.clientY < a ? t.insertBefore(e, n) : t.insertBefore(e, n.nextSibling), o?.classList.remove("drag-over"), o = null, e.classList.remove("dragging");
462
+ const d = t.querySelectorAll(".orderable-item"), u = Array.from(d).map((S) => S.dataset.key).filter(Boolean);
463
+ this._onReorder(u), e = null;
465
464
  }, { signal: r });
466
465
  }
467
466
  _setupDeleteHandler(t, r) {
@@ -469,8 +468,8 @@ class Rt extends Q {
469
468
  const s = e.target.closest(".custom-attr-delete");
470
469
  if (!s)
471
470
  return;
472
- const n = s.closest("[data-custom-index]"), i = n == null ? void 0 : n.dataset.customIndex;
473
- i !== void 0 && this._onDeleteCustomAttribute(Number(i));
471
+ const n = s.closest("[data-custom-index]")?.dataset.customIndex;
472
+ n !== void 0 && this._onDeleteCustomAttribute(Number(n));
474
473
  }, { signal: r });
475
474
  }
476
475
  // ========================================================================
@@ -490,8 +489,8 @@ class Rt extends Q {
490
489
  const r = this._readCustomAttributesFromNode();
491
490
  if (r[t] === void 0)
492
491
  return;
493
- const o = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(o, t), n = o.filter((a, c) => c !== s), i = r.filter((a, c) => c !== t);
494
- this._updateBothAttributes(n, i), this._removeCustomAttributeHtml(n), this._renderOrderableItems(n, i), this._initializeCustomSelects(i), this._updateAddButtonState();
492
+ const o = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(o, t), i = o.filter((c, a) => a !== s), n = r.filter((c, a) => a !== t);
493
+ this._updateBothAttributes(i, n), this._removeCustomAttributeHtml(i), this._renderOrderableItems(i, n), this._initializeCustomSelects(n), this._updateAddButtonState();
495
494
  }
496
495
  /**
497
496
  * Handles changing a custom attribute's selection via its inline _GuSelect.
@@ -501,10 +500,10 @@ class Rt extends Q {
501
500
  const e = this._readCustomAttributesFromNode(), o = e[t];
502
501
  if (o === void 0 || o === r)
503
502
  return;
504
- const s = `${m}${r}`, n = this._readCompositionFromNode(), i = this._findNthCustomKeyIndex(n, t);
505
- i !== -1 && (n[i] = s), e[t] = r;
506
- const a = this._getDisplayNameForAttribute(r);
507
- this._updateBothAttributes(n, e), this._injectCustomAttributeHtml(r, a, s, n), this._renderOrderableItems(n, e), this._initializeCustomSelects(e);
503
+ const s = `${m}${r}`, i = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(i, t);
504
+ n !== -1 && (i[n] = s), e[t] = r;
505
+ const c = this._getDisplayNameForAttribute(r);
506
+ this._updateBothAttributes(i, e), this._injectCustomAttributeHtml(r, c, s, i), this._renderOrderableItems(i, e), this._initializeCustomSelects(e);
508
507
  }
509
508
  _onReorder(t) {
510
509
  const r = t.filter((e) => e.startsWith(m)).map((e) => e.substring(m.length));
@@ -526,56 +525,55 @@ class Rt extends Q {
526
525
  }
527
526
  _injectGridAttributeRow(t, r, e, o) {
528
527
  const s = this.currentNode.querySelectorAll(N);
529
- if (!(s != null && s.length))
528
+ if (!s?.length)
530
529
  return;
531
- const n = st.getConfig(this.currentNode), a = `0 ${Math.floor(n.columnSpacing / 2)}px`, c = this.api.getDocumentModifier(), l = this.store.recommendationProducts.length;
532
- let u = 0;
533
- s.forEach((d) => {
534
- var H;
535
- const b = d.querySelector(A), R = ((H = b == null ? void 0 : b.querySelectorAll(`.${nt}`)) == null ? void 0 : H.length) || 1, x = (100 / R).toFixed(2), { bgStyle: V, bgAttr: W } = this._extractSegmentBgFromCard(d), K = o.map((k) => {
536
- if (k === e) {
537
- const z = Array.from(
530
+ const i = Q.getConfig(this.currentNode), c = `0 ${Math.floor(i.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), l = this.store.recommendationProducts.length;
531
+ let d = 0;
532
+ s.forEach((u) => {
533
+ const R = u.querySelector(T)?.querySelectorAll(`.${tt}`)?.length || 1, x = (100 / R).toFixed(2), { bgStyle: V, bgAttr: j } = this._extractSegmentBgFromCard(u), W = o.map((B) => {
534
+ if (B === e) {
535
+ const K = Array.from(
538
536
  { length: R },
539
- (ft, q) => {
540
- const G = l > 0 ? (u + q) % l : q, Y = this._resolveAttributeContent(t, r, G);
537
+ (_t, U) => {
538
+ const z = l > 0 ? (d + U) % l : U, G = this._resolveAttributeContent(t, r, z);
541
539
  return this._getGridCellHtml(
542
540
  t,
543
- Y,
541
+ G,
544
542
  x,
545
543
  V,
546
- W,
547
- a
544
+ j,
545
+ c
548
546
  );
549
547
  }
550
548
  ).join("");
551
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${I}="1">${z}</tr>`;
549
+ return `<tr class="recommendation-attribute-row" ${b}="${e}" ${I}="1">${K}</tr>`;
552
550
  }
553
- const E = d.querySelector(
554
- `${A}[${y}="${k}"]`
551
+ const E = u.querySelector(
552
+ `${T}[${b}="${B}"]`
555
553
  );
556
554
  return E && "getOuterHTML" in E ? E.getOuterHTML() : "";
557
555
  }).join("");
558
- u += R, l > 0 && u >= l && (u = 0), c.modifyHtml(d).setInnerHtml(K);
559
- }), c.apply(new S(`${this.api.translate("Add custom attribute")}: ${r}`));
556
+ d += R, l > 0 && d >= l && (d = 0), a.modifyHtml(u).setInnerHtml(W);
557
+ }), a.apply(new y(`${this.api.translate("Add custom attribute")}: ${r}`));
560
558
  }
561
559
  _injectListAttributeRow(t, r, e, o) {
562
- const s = this.currentNode.querySelectorAll(F);
563
- if (!(s != null && s.length))
560
+ const s = this.currentNode.querySelectorAll(P);
561
+ if (!s?.length)
564
562
  return;
565
- const n = o.filter((a) => a !== L && a !== D), i = this.api.getDocumentModifier();
566
- s.forEach((a, c) => {
567
- const l = n.map((u) => {
568
- if (u === e) {
569
- const b = this._resolveAttributeContent(t, r, c);
570
- return this._getListRowHtml(t, b, e);
563
+ const i = o.filter((c) => c !== L && c !== D), n = this.api.getDocumentModifier();
564
+ s.forEach((c, a) => {
565
+ const l = i.map((d) => {
566
+ if (d === e) {
567
+ const S = this._resolveAttributeContent(t, r, a);
568
+ return this._getListRowHtml(t, S, e);
571
569
  }
572
- const d = a.querySelector(
573
- `${A}[${y}="${u}"]`
570
+ const u = c.querySelector(
571
+ `${T}[${b}="${d}"]`
574
572
  );
575
- return d && "getOuterHTML" in d ? d.getOuterHTML() : "";
573
+ return u && "getOuterHTML" in u ? u.getOuterHTML() : "";
576
574
  }).join("");
577
- i.modifyHtml(a).setInnerHtml(l);
578
- }), i.apply(new S(`${this.api.translate("Add custom attribute")}: ${r}`));
575
+ n.modifyHtml(c).setInnerHtml(l);
576
+ }), n.apply(new y(`${this.api.translate("Add custom attribute")}: ${r}`));
579
577
  }
580
578
  /**
581
579
  * Removes a custom attribute by rebuilding product card content without it.
@@ -585,20 +583,19 @@ class Rt extends Q {
585
583
  if (!this.currentNode)
586
584
  return;
587
585
  const r = this._getCurrentLayout(), e = this.api.getDocumentModifier();
588
- if (r === "grid") {
589
- const o = this.currentNode.querySelectorAll(N);
590
- o == null || o.forEach((s) => {
591
- const n = this._buildCompositionHtml(s, t);
592
- e.modifyHtml(s).setInnerHtml(n);
586
+ if (r === "grid")
587
+ this.currentNode.querySelectorAll(N)?.forEach((s) => {
588
+ const i = this._buildCompositionHtml(s, t);
589
+ e.modifyHtml(s).setInnerHtml(i);
593
590
  });
594
- } else {
595
- const o = t.filter((n) => n !== L && n !== D), s = this.currentNode.querySelectorAll(F);
596
- s == null || s.forEach((n) => {
597
- const i = this._buildCompositionHtml(n, o);
598
- e.modifyHtml(n).setInnerHtml(i);
591
+ else {
592
+ const o = t.filter((i) => i !== L && i !== D);
593
+ this.currentNode.querySelectorAll(P)?.forEach((i) => {
594
+ const n = this._buildCompositionHtml(i, o);
595
+ e.modifyHtml(i).setInnerHtml(n);
599
596
  });
600
597
  }
601
- e.apply(new S(this.api.translate("Remove custom attribute")));
598
+ e.apply(new y(this.api.translate("Remove custom attribute")));
602
599
  }
603
600
  // ========================================================================
604
601
  // DOM Mutation (Block Root Attributes, Reorder)
@@ -611,7 +608,7 @@ class Rt extends Q {
611
608
  * producing a flicker on the custom attribute dropdowns.
612
609
  */
613
610
  _updateBothAttributes(t, r) {
614
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(M, t.join(",")).setAttribute(B, JSON.stringify(r)).apply(new S(this.api.translate("Update card composition")));
611
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(F, t.join(",")).setAttribute(w, JSON.stringify(r)).apply(new y(this.api.translate("Update card composition")));
615
612
  }
616
613
  /**
617
614
  * Reorders attribute rows within each product card based on composition order.
@@ -621,13 +618,13 @@ class Rt extends Q {
621
618
  if (!this.currentNode)
622
619
  return;
623
620
  const r = this.currentNode.querySelectorAll(N);
624
- if (!(r != null && r.length))
621
+ if (!r?.length)
625
622
  return;
626
623
  const e = this.api.getDocumentModifier();
627
624
  r.forEach((o) => {
628
625
  const s = this._buildCompositionHtml(o, t);
629
626
  e.modifyHtml(o).setInnerHtml(s);
630
- }), e.apply(new S(this.api.translate("Reorder product attributes")));
627
+ }), e.apply(new y(this.api.translate("Reorder product attributes")));
631
628
  }
632
629
  /**
633
630
  * Builds HTML string with attributes ordered according to composition.
@@ -635,7 +632,7 @@ class Rt extends Q {
635
632
  */
636
633
  _buildCompositionHtml(t, r) {
637
634
  return r.reduce((e, o) => {
638
- const s = t.querySelector(`${A}[${y}="${o}"]`);
635
+ const s = t.querySelector(`${T}[${b}="${o}"]`);
639
636
  return s && "getOuterHTML" in s ? e + s.getOuterHTML() : e;
640
637
  }, "");
641
638
  }
@@ -645,14 +642,14 @@ class Rt extends Q {
645
642
  _applyVisibilityToBlock(t, r) {
646
643
  if (!this.currentNode)
647
644
  return;
648
- const e = this.currentNode.querySelectorAll(`${A}[${y}="${t}"]`);
649
- if (!(e != null && e.length))
645
+ const e = this.currentNode.querySelectorAll(`${T}[${b}="${t}"]`);
646
+ if (!e?.length)
650
647
  return;
651
- const o = r ? "1" : "0", s = r ? this.api.translate("visible") : this.api.translate("hidden"), n = `${this.api.translate("Set visibility")}: ${t} → ${s}`, i = this.api.getDocumentModifier();
652
- e.forEach((a) => {
653
- const c = dt(a), l = r ? c : "none";
654
- i.modifyHtml(a).setStyle("display", l).setAttribute(I, o);
655
- }), i.apply(new S(n));
648
+ const o = r ? "1" : "0", s = r ? this.api.translate("visible") : this.api.translate("hidden"), i = `${this.api.translate("Set visibility")}: ${t} → ${s}`, n = this.api.getDocumentModifier();
649
+ e.forEach((c) => {
650
+ const a = nt(c), l = r ? a : "none";
651
+ n.modifyHtml(c).setStyle("display", l).setAttribute(I, o);
652
+ }), n.apply(new y(i));
656
653
  }
657
654
  // ========================================================================
658
655
  // Utilities
@@ -673,7 +670,7 @@ class Rt extends Q {
673
670
  return -1;
674
671
  }
675
672
  _getCurrentLayout() {
676
- return this.store.recommendationConfigs.orientation || mt(this.currentNode);
673
+ return this.store.recommendationConfigs.orientation || lt(this.currentNode);
677
674
  }
678
675
  /**
679
676
  * Extracts background color properties from existing card elements.
@@ -682,21 +679,20 @@ class Rt extends Q {
682
679
  * Used when injecting new attribute cells to match the card's current background.
683
680
  */
684
681
  _extractSegmentBgFromCard(t) {
685
- var o;
686
682
  const r = t.querySelector(".product-card-segment");
687
683
  if (r && "getAttribute" in r) {
688
- const n = (r.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
689
- if (n) {
684
+ const s = (r.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
685
+ if (s) {
690
686
  const i = r.getAttribute("bgcolor") || "";
691
- return { bgStyle: `background-color: ${n[1].trim()};`, bgAttr: i };
687
+ return { bgStyle: `background-color: ${s[1].trim()};`, bgAttr: i };
692
688
  }
693
689
  }
694
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(".product-card-wrapper");
690
+ const e = this.currentNode?.querySelector(".product-card-wrapper");
695
691
  if (e && "getStyle" in e) {
696
- const s = e.getStyle("background-color");
697
- if (s && s !== "transparent") {
698
- const n = "getAttribute" in e && e.getAttribute("bgcolor") || "";
699
- return { bgStyle: `background-color: ${s};`, bgAttr: n };
692
+ const o = e.getStyle("background-color");
693
+ if (o && o !== "transparent") {
694
+ const s = "getAttribute" in e && e.getAttribute("bgcolor") || "";
695
+ return { bgStyle: `background-color: ${o};`, bgAttr: s };
700
696
  }
701
697
  }
702
698
  return { bgStyle: "", bgAttr: "" };
@@ -724,9 +720,9 @@ class Rt extends Q {
724
720
  * or when all available filters have already been added (no unused attributes left).
725
721
  */
726
722
  _updateAddButtonState() {
727
- const t = this._readCustomAttributesFromNode(), r = t.length >= g, e = new Set(t), o = Object.values(this.store.filterList), s = o.length > 0 && o.every((n) => e.has(n.attributeName));
723
+ const t = this._readCustomAttributesFromNode(), r = t.length >= g, e = new Set(t), o = this._getAddableFilters(), s = o.length > 0 && o.every((i) => e.has(i.attributeName));
728
724
  this.api.setUIEAttribute(
729
- j.ADD_ATTRIBUTE,
725
+ M.ADD_ATTRIBUTE,
730
726
  $.BUTTON.disabled,
731
727
  r || s ? "true" : "false"
732
728
  );
@@ -745,37 +741,49 @@ class Rt extends Q {
745
741
  o !== r && (r = o, this._initializeComposition());
746
742
  });
747
743
  }
744
+ /**
745
+ * Returns filters eligible for the custom attribute dropdown,
746
+ * excluding default attributes already covered by built-in toggle items.
747
+ */
748
+ _getAddableFilters() {
749
+ return Object.values(this.store.filterList).filter((t) => !(t.type === "defaultAttribute" && ht.has(t.attributeName)));
750
+ }
748
751
  /**
749
752
  * Looks up the display name for an attribute from the store's filterList.
750
753
  * Falls back to Title Case conversion of the snake_case attribute name.
751
754
  */
752
755
  _getDisplayNameForAttribute(t) {
753
756
  const r = Object.values(this.store.filterList).find((e) => e.attributeName === t);
754
- return r ? r.displayName : ut(t);
757
+ return r ? r.displayName : st(t);
755
758
  }
756
759
  /**
757
760
  * Resolves the display content for a custom attribute cell.
758
761
  * Uses the real product value from the store when available, falls back to displayName.
759
762
  */
760
763
  _resolveAttributeContent(t, r, e) {
761
- var i;
762
- const s = this.store.recommendationProducts[e], n = (i = s == null ? void 0 : s.product_attributes) == null ? void 0 : i[t];
763
- return n != null ? String(n) : r;
764
- }
765
- _getGridCellHtml(t, r, e, o = "", s = "", n = "") {
766
- const i = `${m}${t}`, a = w(at, [i]), c = { product_attributes: { [t]: r } };
767
- let l = a[i](c);
768
- return l = l.replace("<td", `<td width="${e}%"`), n && (l = l.replace(
769
- `padding: ${lt}`,
770
- `padding: ${n}`
764
+ const s = this.store.recommendationProducts[e], i = it(t, this.store.filterList) ? s?.[t] : s?.product_attributes?.[t];
765
+ return typeof i == "string" ? i : typeof i == "number" ? String(i) : r;
766
+ }
767
+ _getGridCellHtml(t, r, e, o = "", s = "", i = "") {
768
+ const n = `${m}${t}`, c = q(et, [n], this.store.filterList), a = {
769
+ [t]: r,
770
+ product_attributes: { [t]: r }
771
+ };
772
+ let l = c[n](a);
773
+ return l = l.replace("<td", `<td width="${e}%"`), i && (l = l.replace(
774
+ `padding: ${rt}`,
775
+ `padding: ${i}`
771
776
  )), o && (l = l.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${o}"`)), s && (l = l.replace(/border="0"/, `border="0" bgcolor="${s}"`)), l;
772
777
  }
773
778
  _getListRowHtml(t, r, e) {
774
- const o = w(ct, [e]), s = { product_attributes: { [t]: r } }, i = o[e](s).replace(/<tr>/, "").replace(/<\/tr>/, "");
775
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${I}="1">${i}</tr>`;
779
+ const o = q(ot, [e], this.store.filterList), s = {
780
+ [t]: r,
781
+ product_attributes: { [t]: r }
782
+ }, n = o[e](s).replace(/<tr>/, "").replace(/<\/tr>/, "");
783
+ return `<tr class="recommendation-attribute-row" ${b}="${e}" ${I}="1">${n}</tr>`;
776
784
  }
777
785
  }
778
786
  export {
779
- ht as COMPOSITION_CONTROL_BLOCK_ID,
780
- Rt as RecommendationCardCompositionControl
787
+ pt as COMPOSITION_CONTROL_BLOCK_ID,
788
+ Et as RecommendationCardCompositionControl
781
789
  };