@useinsider/guido 2.1.0-beta.fd71a10 → 2.1.0-beta.ff1bc98

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 (145) hide show
  1. package/README.md +0 -36
  2. package/dist/@types/config/schemas.js +65 -70
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +58 -69
  5. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +15 -14
  6. package/dist/composables/useBlocksConfig.js +16 -26
  7. package/dist/composables/useHtmlValidator.js +114 -104
  8. package/dist/composables/useRecommendation.js +54 -21
  9. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  10. package/dist/config/compiler/utils/recommendationCompilerUtils.js +116 -0
  11. package/dist/config/migrator/recommendationMigrator.js +2 -2
  12. package/dist/enums/defaults.js +4 -8
  13. package/dist/enums/extensions/recommendationBlock.js +1 -1
  14. package/dist/enums/recommendation.js +16 -15
  15. package/dist/extensions/Blocks/Recommendation/block.js +133 -9
  16. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
  17. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
  18. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +66 -0
  19. package/dist/extensions/Blocks/Recommendation/constants/layout.js +22 -0
  20. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
  24. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
  25. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +92 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +102 -0
  27. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +209 -0
  28. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +52 -0
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +250 -0
  30. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +70 -0
  31. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +160 -0
  32. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +67 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +307 -0
  34. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  35. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
  36. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +108 -0
  37. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
  38. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
  39. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
  40. package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
  41. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
  42. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
  43. package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
  44. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
  45. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
  46. package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
  47. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
  48. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
  49. package/dist/extensions/Blocks/Recommendation/services/configService.js +240 -0
  50. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
  51. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +254 -207
  52. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +233 -0
  53. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
  54. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +66 -0
  55. package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
  56. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +174 -0
  57. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
  58. package/dist/extensions/Blocks/Recommendation/templates/utils.js +134 -0
  59. package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
  60. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
  61. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +26 -15
  62. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
  63. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
  64. package/dist/extensions/Blocks/controlFactories.js +125 -93
  65. package/dist/guido.css +1 -1
  66. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +225 -237
  67. package/dist/services/recommendationApi.js +11 -8
  68. package/dist/services/templateLibraryApi.js +16 -13
  69. package/dist/src/@types/config/schemas.d.ts +0 -8
  70. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  71. package/dist/src/composables/useConfig.d.ts +0 -4
  72. package/dist/src/composables/useRecommendation.d.ts +1 -0
  73. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  74. package/dist/src/enums/defaults.d.ts +0 -4
  75. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +67 -0
  76. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
  77. package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
  78. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
  79. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
  80. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +41 -0
  81. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +35 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
  84. package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
  85. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
  87. package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
  88. package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
  89. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +52 -0
  90. package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
  91. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +79 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +60 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +221 -0
  96. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  97. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
  98. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +34 -0
  99. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
  100. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
  101. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
  102. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
  103. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
  104. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
  105. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
  106. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
  107. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
  108. package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
  109. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
  110. package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
  111. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +138 -468
  112. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
  113. package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
  114. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
  115. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +41 -0
  116. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
  117. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
  118. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
  119. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +66 -0
  120. package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
  121. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +166 -0
  122. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
  123. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  124. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
  125. package/dist/src/stores/config.d.ts +0 -36
  126. package/dist/static/styles/customEditorStyle.css.js +35 -11
  127. package/dist/utils/pairProductVariables.js +57 -56
  128. package/dist/utils/templatePreparation.js +15 -14
  129. package/package.json +1 -1
  130. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
  131. package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
  132. package/dist/extensions/Blocks/Recommendation/control.js +0 -336
  133. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  134. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
  135. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  136. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  137. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
  138. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  139. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  140. package/dist/extensions/ModulesTabIcons/extension.js +0 -17
  141. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
  142. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  143. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  144. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
  145. package/dist/src/extensions/ModulesTabIcons/extension.d.ts +0 -2
@@ -46,8 +46,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
46
46
  senderName: string;
47
47
  subject: string;
48
48
  };
49
- savedModulesFolderName: string;
50
- defaultModulesFolderName: string;
51
49
  };
52
50
  ui: {
53
51
  showHeader: boolean;
@@ -143,8 +141,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
143
141
  senderName: string;
144
142
  subject: string;
145
143
  };
146
- savedModulesFolderName: string;
147
- defaultModulesFolderName: string;
148
144
  };
149
145
  ui: {
150
146
  showHeader: boolean;
@@ -240,8 +236,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
240
236
  senderName: string;
241
237
  subject: string;
242
238
  };
243
- savedModulesFolderName: string;
244
- defaultModulesFolderName: string;
245
239
  };
246
240
  ui: {
247
241
  showHeader: boolean;
@@ -337,8 +331,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
337
331
  senderName: string;
338
332
  subject: string;
339
333
  };
340
- savedModulesFolderName: string;
341
- defaultModulesFolderName: string;
342
334
  };
343
335
  ui: {
344
336
  showHeader: boolean;
@@ -434,8 +426,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
434
426
  senderName: string;
435
427
  subject: string;
436
428
  };
437
- savedModulesFolderName: string;
438
- defaultModulesFolderName: string;
439
429
  };
440
430
  ui: {
441
431
  showHeader: boolean;
@@ -531,8 +521,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
531
521
  senderName: string;
532
522
  subject: string;
533
523
  };
534
- savedModulesFolderName: string;
535
- defaultModulesFolderName: string;
536
524
  };
537
525
  ui: {
538
526
  showHeader: boolean;
@@ -628,8 +616,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
628
616
  senderName: string;
629
617
  subject: string;
630
618
  };
631
- savedModulesFolderName: string;
632
- defaultModulesFolderName: string;
633
619
  };
634
620
  ui: {
635
621
  showHeader: boolean;
@@ -725,8 +711,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
725
711
  senderName: string;
726
712
  subject: string;
727
713
  };
728
- savedModulesFolderName: string;
729
- defaultModulesFolderName: string;
730
714
  };
731
715
  ui: {
732
716
  showHeader: boolean;
@@ -822,8 +806,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
822
806
  senderName: string;
823
807
  subject: string;
824
808
  };
825
- savedModulesFolderName: string;
826
- defaultModulesFolderName: string;
827
809
  };
828
810
  ui: {
829
811
  showHeader: boolean;
@@ -919,8 +901,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
919
901
  senderName: string;
920
902
  subject: string;
921
903
  };
922
- savedModulesFolderName: string;
923
- defaultModulesFolderName: string;
924
904
  };
925
905
  ui: {
926
906
  showHeader: boolean;
@@ -1016,8 +996,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1016
996
  senderName: string;
1017
997
  subject: string;
1018
998
  };
1019
- savedModulesFolderName: string;
1020
- defaultModulesFolderName: string;
1021
999
  };
1022
1000
  ui: {
1023
1001
  showHeader: boolean;
@@ -1113,8 +1091,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1113
1091
  senderName: string;
1114
1092
  subject: string;
1115
1093
  };
1116
- savedModulesFolderName: string;
1117
- defaultModulesFolderName: string;
1118
1094
  };
1119
1095
  ui: {
1120
1096
  showHeader: boolean;
@@ -1210,8 +1186,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1210
1186
  senderName: string;
1211
1187
  subject: string;
1212
1188
  };
1213
- savedModulesFolderName: string;
1214
- defaultModulesFolderName: string;
1215
1189
  };
1216
1190
  ui: {
1217
1191
  showHeader: boolean;
@@ -1307,8 +1281,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1307
1281
  senderName: string;
1308
1282
  subject: string;
1309
1283
  };
1310
- savedModulesFolderName: string;
1311
- defaultModulesFolderName: string;
1312
1284
  };
1313
1285
  ui: {
1314
1286
  showHeader: boolean;
@@ -1404,8 +1376,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1404
1376
  senderName: string;
1405
1377
  subject: string;
1406
1378
  };
1407
- savedModulesFolderName: string;
1408
- defaultModulesFolderName: string;
1409
1379
  };
1410
1380
  ui: {
1411
1381
  showHeader: boolean;
@@ -1501,8 +1471,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1501
1471
  senderName: string;
1502
1472
  subject: string;
1503
1473
  };
1504
- savedModulesFolderName: string;
1505
- defaultModulesFolderName: string;
1506
1474
  };
1507
1475
  ui: {
1508
1476
  showHeader: boolean;
@@ -1598,8 +1566,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1598
1566
  senderName: string;
1599
1567
  subject: string;
1600
1568
  };
1601
- savedModulesFolderName: string;
1602
- defaultModulesFolderName: string;
1603
1569
  };
1604
1570
  ui: {
1605
1571
  showHeader: boolean;
@@ -1695,8 +1661,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1695
1661
  senderName: string;
1696
1662
  subject: string;
1697
1663
  };
1698
- savedModulesFolderName: string;
1699
- defaultModulesFolderName: string;
1700
1664
  };
1701
1665
  ui: {
1702
1666
  showHeader: boolean;
@@ -19,22 +19,46 @@ const n = `.esd-x,
19
19
  box-shadow: none;
20
20
  }
21
21
  .ins-product-cart ue-node-actions,
22
- .ins-recommendation-v3-block-v2 .product-attribute-cell ue-node-actions,
23
- .ins-recommendation-v3-block-v2 .product-attribute-cell ue-node-panel {
22
+ /* Horizontal layout - hide for info, image, and button cells */
23
+ .ins-recommendation-v3-block-v2 .product-info-cell ue-node-actions,
24
+ .ins-recommendation-v3-block-v2 .product-info-cell ue-node-panel,
25
+ .ins-recommendation-v3-block-v2 .product-image-cell ue-node-actions,
26
+ .ins-recommendation-v3-block-v2 .product-image-cell ue-node-panel,
27
+ .ins-recommendation-v3-block-v2 .button-cell ue-node-actions,
28
+ .ins-recommendation-v3-block-v2 .button-cell ue-node-panel,
29
+ /* Vertical layout - hide for product-card-segment inner cells */
30
+ .ins-recommendation-v3-block-v2 .product-card-segment ue-node-actions,
31
+ .ins-recommendation-v3-block-v2 .product-card-segment ue-node-panel,
32
+ /* Hide for specific product attribute cells in both layouts */
33
+ .ins-recommendation-v3-block-v2 .product-image ue-node-actions,
34
+ .ins-recommendation-v3-block-v2 .product-image ue-node-panel,
35
+ .ins-recommendation-v3-block-v2 .product-name ue-node-actions,
36
+ .ins-recommendation-v3-block-v2 .product-name ue-node-panel,
37
+ .ins-recommendation-v3-block-v2 .product-price ue-node-actions,
38
+ .ins-recommendation-v3-block-v2 .product-price ue-node-panel,
39
+ .ins-recommendation-v3-block-v2 .product-old-price ue-node-actions,
40
+ .ins-recommendation-v3-block-v2 .product-old-price ue-node-panel,
41
+ .ins-recommendation-v3-block-v2 .product-omnibus-price ue-node-actions,
42
+ .ins-recommendation-v3-block-v2 .product-omnibus-price ue-node-panel,
43
+ .ins-recommendation-v3-block-v2 .product-omnibus-discount ue-node-actions,
44
+ .ins-recommendation-v3-block-v2 .product-omnibus-discount ue-node-panel,
45
+ .ins-recommendation-v3-block-v2 .product-button ue-node-actions,
46
+ .ins-recommendation-v3-block-v2 .product-button ue-node-panel {
24
47
  display: none !important;
25
48
  }
26
49
 
27
- /* Apply to the table cell (td) with text-trim-enabled class */
28
- .text-trim-enabled {
29
- max-width: 0 !important;
50
+ /* Mobile layout: hide mobile container by default in editor */
51
+ .ins-recommendation-mobile-container {
52
+ display: none;
30
53
  }
31
54
 
32
- .text-trim-enabled p {
33
- overflow: hidden !important;
34
- text-overflow: ellipsis !important;
35
- white-space: nowrap !important;
36
- margin: 0 !important;
37
- display: block !important;
55
+ /* Mobile layout: when Stripo mobile mode is active, swap containers */
56
+ .ue-mobile-mode .ins-recommendation-desktop-container {
57
+ display: none !important;
58
+ }
59
+
60
+ .ue-mobile-mode .ins-recommendation-mobile-container {
61
+ display: table !important;
38
62
  }
39
63
  `;
40
64
  export {
@@ -1,77 +1,77 @@
1
- import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function P(k) {
3
- const m = k.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), R = w.PAIRS_FOR_EXTENSION;
4
- Object.entries(R).forEach(([n, l]) => {
5
- $.querySelectorAll(".ins-product-td").forEach((o) => {
6
- const E = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
- o.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
- var y;
9
- const T = e.getAttribute("data-type") || b, u = e.getAttribute("data-number") || E, p = l[T];
1
+ import { productPairs as P } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ function L(F) {
3
+ const R = F.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(R, "text/html"), y = P.PAIRS_FOR_EXTENSION;
4
+ Object.entries(y).forEach(([n, l]) => {
5
+ $.querySelectorAll(".ins-product-td").forEach((c) => {
6
+ const E = c.getAttribute("data-number") || "1", T = c.getAttribute("data-type") || "CART_ITEMS";
7
+ c.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
+ var H;
9
+ const b = e.getAttribute("data-type") || T, u = e.getAttribute("data-number") || E, p = l[b];
10
10
  if (p)
11
11
  switch (n) {
12
12
  case "imageSrc": {
13
- let t = null, c = null;
14
- if (e.tagName === "IMG" ? (t = e, c = t.closest("a")) : (t = e.querySelector("img"), c = e.querySelector("a") || e.closest("a")), !t)
13
+ let t = null, o = null;
14
+ if (e.tagName === "IMG" ? (t = e, o = t.closest("a")) : (t = e.querySelector("img"), o = e.querySelector("a") || e.closest("a")), !t)
15
15
  break;
16
16
  const i = p.DEFAULT, a = p.ATTR;
17
17
  if (i && t.src) {
18
18
  const r = t.src;
19
- i.some((d) => {
20
- const s = d.split("/").pop() || "", _ = r.split("/").pop() || "";
21
- return r.includes(d) || r.includes(s) || _ === s;
19
+ i.some((f) => {
20
+ const s = f.split("/").pop() || "", _ = r.split("/").pop() || "";
21
+ return r.includes(f) || r.includes(s) || _ === s;
22
22
  }) && (t.src = `{{${a}_${u}}}`);
23
23
  }
24
- if (c) {
25
- const r = (y = R.itemLink) == null ? void 0 : y[T];
24
+ if (o) {
25
+ const r = (H = y.itemLink) == null ? void 0 : H[b];
26
26
  if (r) {
27
- const f = r.HREF, d = r.DEFAULT_HREF || "#!", s = c.href;
28
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(d) || s === `${window.location.href}${d}` || !s || s === window.location.href) && (c.href = `{{${f}_${u}}}`);
27
+ const d = r.HREF, f = r.DEFAULT_HREF || "#!", s = o.href;
28
+ (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(f) || s === `${window.location.href}${f}` || !s || s === window.location.href) && (o.href = `{{${d}_${u}}}`);
29
29
  }
30
30
  }
31
31
  break;
32
32
  }
33
33
  case "name": {
34
- const t = p, c = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
- e.textContent && (e.textContent = `{{${c}_${u}}}`);
34
+ const t = p, o = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
+ e.textContent && (e.textContent = `{{${o}_${u}}}`);
36
36
  const r = e.closest("a") || (e.tagName === "A" ? e : null);
37
37
  if (r && a) {
38
- const f = r.href, d = `${window.location.href}${i}`;
39
- (f === d || f.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
38
+ const d = r.href, f = `${window.location.href}${i}`;
39
+ (d === f || d.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
40
40
  }
41
41
  break;
42
42
  }
43
43
  case "price":
44
44
  case "originalPrice": {
45
- const t = p, c = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = c === "true", r = i === "true", f = e.getAttribute("data-curency") || "before";
46
- let d;
47
- r ? d = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : d = a ? t.PRICE_FORMATTED : t.PRICE;
45
+ const t = p, o = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = o === "true", r = i === "true", d = e.getAttribute("data-curency") || "before";
46
+ let f;
47
+ r ? f = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : f = a ? t.PRICE_FORMATTED : t.PRICE;
48
48
  const s = t.CURRENCY;
49
- let _ = `{{${d}_${u}}}`;
49
+ let _ = `{{${f}_${u}}}`;
50
50
  if (s) {
51
- const H = `{{${s}_${u}}}`;
52
- _ = f === "after" ? `${_} ${H}` : `${H} ${_}`;
51
+ const k = `{{${s}_${u}}}`;
52
+ _ = d === "after" ? `${_} ${k}` : `${k} ${_}`;
53
53
  }
54
54
  e.textContent = _;
55
55
  break;
56
56
  }
57
57
  case "quantity": {
58
- const t = p, c = t.ATTR, i = t.DEFAULT;
59
- e.textContent && e.textContent.trim() === i && (e.textContent = `{{${c}_${u}}}`);
58
+ const t = p, o = t.ATTR, i = t.DEFAULT;
59
+ e.textContent && e.textContent.trim() === i && (e.textContent = `{{${o}_${u}}}`);
60
60
  break;
61
61
  }
62
62
  case "button": {
63
- const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
63
+ const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
64
64
  if (a) {
65
- const r = a.href || "", f = `${window.location.href}${i}`;
66
- (r === "" || r === "#" || r === f || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${c}_${u}}}`);
65
+ const r = a.href || "", d = `${window.location.href}${i}`;
66
+ (r === "" || r === "#" || r === d || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${o}_${u}}}`);
67
67
  }
68
68
  break;
69
69
  }
70
70
  case "itemLink": {
71
- const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
71
+ const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
72
72
  if (a.href) {
73
- const r = a.href, f = `${window.location.href}${i}`;
74
- (r === f || r.endsWith(i)) && (a.href = `{{${c}_${u}}}`);
73
+ const r = a.href, d = `${window.location.href}${i}`;
74
+ (r === d || r.endsWith(i)) && (a.href = `{{${o}_${u}}}`);
75
75
  }
76
76
  break;
77
77
  }
@@ -86,44 +86,45 @@ function P(k) {
86
86
  });
87
87
  });
88
88
  });
89
- const F = $.querySelectorAll(".ins-product-td"), S = [];
90
- F.forEach((n) => {
91
- const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), E = n.outerHTML;
92
- S.push({
89
+ const S = R.match(/<!DOCTYPE[^>]*>/i), I = S ? `${S[0]}
90
+ ` : "", w = $.querySelectorAll(".ins-product-td"), m = [];
91
+ w.forEach((n) => {
92
+ const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", c = n.getAttribute("data-nodup"), E = n.outerHTML;
93
+ m.push({
93
94
  element: n,
94
95
  outerHtml: E,
95
96
  type: l,
96
97
  number: A,
97
- nodup: o || void 0
98
+ nodup: c || void 0
98
99
  });
99
100
  });
100
- let h = $.body.innerHTML;
101
- S.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
102
- let o = "";
101
+ let h = I + $.documentElement.outerHTML;
102
+ m.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
103
+ let c = "";
103
104
  switch (l) {
104
105
  case "CART_ITEMS":
105
- o = "ins_apr_total_product_kind";
106
+ c = "ins_apr_total_product_kind";
106
107
  break;
107
108
  case "BROWSED_ITEMS":
108
- o = "browsed_item_total_product_kind";
109
+ c = "browsed_item_total_product_kind";
109
110
  break;
110
111
  case "PURCHASED_ITEMS":
111
- o = "purchased_item_total_product_kind";
112
+ c = "purchased_item_total_product_kind";
112
113
  break;
113
114
  }
114
- if (o) {
115
- const b = parseInt(A) - 1, T = `${`{% if ${o} > ${b} %}`}${n}{% endif %}`;
116
- h = h.replace(n, T);
115
+ if (c) {
116
+ const T = parseInt(A) - 1, b = `${`{% if ${c} > ${T} %}`}${n}{% endif %}`;
117
+ h = h.replace(n, b);
117
118
  }
118
119
  });
119
- const I = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
120
- return I.forEach((n) => {
120
+ const M = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
121
+ return M.forEach((n) => {
121
122
  const l = n.getAttribute("data-number"), A = n.getAttribute("data-type");
122
123
  if (!l || A !== "CART_ITEMS")
123
124
  return;
124
- const o = n.closest(".product-original-price-class");
125
- if (o) {
126
- const E = o.outerHTML;
125
+ const c = n.closest(".product-original-price-class");
126
+ if (c) {
127
+ const E = c.outerHTML;
127
128
  g.some((C) => C.tdOuterHtml === E) || g.push({ tdOuterHtml: E, number: l });
128
129
  }
129
130
  }), g.reverse().forEach(({ tdOuterHtml: n, number: l }) => {
@@ -135,5 +136,5 @@ function P(k) {
135
136
  }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
136
137
  }
137
138
  export {
138
- P as pairProductVariables
139
+ L as pairProductVariables
139
140
  };
@@ -1,31 +1,32 @@
1
- import { useActionsApi as b } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as f } from "../composables/useHtmlCompiler.js";
3
- import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
4
- import { useUnsubscribeStore as T } from "../stores/unsubscribe.js";
5
- const P = () => {
6
- const i = C(), t = T(), { getCompiledEmail: o, getTemplateData: s, editorSave: n } = b(), { compileHtml: a } = f();
1
+ import { useActionsApi as f } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
5
+ import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
6
+ const E = () => {
7
+ const o = x(), t = y(), { getCompiledEmail: i, getTemplateData: n, editorSave: s } = f(), { compileHtml: m } = C();
7
8
  return {
8
9
  prepareTemplateDetails: async () => {
9
- const { html: r, ampHtml: m = "", ampErrors: c = [] } = await o({
10
+ const { html: a, ampHtml: r = "", ampErrors: c = [] } = await i({
10
11
  minimize: !0,
11
12
  resetDataSavedFlag: !1
12
- }), { html: l, css: p, syncModulesIds: u = [] } = await s(), { compiledHtml: d, stats: e, appliedRules: g } = a(r), S = i.getSelectedDynamicContentList;
13
- return n(), console.debug("HTML Compilation Stats:", {
13
+ }), { html: l, css: p, syncModulesIds: u = [] } = await n(), { compiledHtml: d, stats: e, appliedRules: S } = m(a), g = o.getSelectedDynamicContentList, b = T();
14
+ return s(), console.debug("HTML Compilation Stats:", {
14
15
  originalSize: e.originalSize,
15
16
  compiledSize: e.compiledSize,
16
17
  reduction: `${e.reductionPercentage.toFixed(2)}%`,
17
- appliedRules: g,
18
+ appliedRules: S,
18
19
  executionTime: `${e.executionTime.toFixed(2)}ms`
19
20
  }), {
20
- dynamicContentList: S,
21
+ dynamicContentList: g,
21
22
  compiledHtml: d,
22
23
  rawHtml: l,
23
24
  css: p,
24
- ampHtml: m,
25
+ ampHtml: r,
25
26
  ampErrors: c,
26
27
  modules: u,
27
28
  recommendation: {
28
- campaignUrls: {},
29
+ campaignUrls: b.recommendationCampaignUrls,
29
30
  configs: {}
30
31
  },
31
32
  unsubscribe: {
@@ -37,5 +38,5 @@ const P = () => {
37
38
  };
38
39
  };
39
40
  export {
40
- P as useTemplatePreparation
41
+ E as useTemplatePreparation
41
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.fd71a10",
3
+ "version": "2.1.0-beta.ff1bc98",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,187 +0,0 @@
1
- import { ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as _ } from "../common-control.js";
3
- import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as f, ATTR_PRODUCT_BUTTON as g } from "./constants.js";
4
- const R = "ui-elements-recommendation-card-composition", l = ".recommendation-attribute-row", A = "tr.recommendation-product-row", c = "data-card-composition", a = "data-attribute-type", d = "data-visibility", s = [
5
- { key: m, label: "Product Image", visible: !0 },
6
- { key: y, label: "Product Name", visible: !0 },
7
- { key: T, label: "Product Price", visible: !0 },
8
- { key: h, label: "Product Original Price", visible: !0 },
9
- { key: C, label: "Omnibus Price", visible: !1 },
10
- { key: f, label: "Omnibus Discount", visible: !1 },
11
- { key: g, label: "Product Button", visible: !0 }
12
- ];
13
- class N extends _ {
14
- getId() {
15
- return R;
16
- }
17
- getTemplate() {
18
- const t = s.map((i) => ({
19
- key: i.key,
20
- label: i.label,
21
- content: this._createItemContent(i.label, i.key)
22
- }));
23
- return `
24
- <div class="container">
25
- ${this._GuLabel({ text: "Card Element Order & Visibility" })}
26
- ${this._GuOrderable("cardComposition", t)}
27
- </div>
28
- `;
29
- }
30
- onRender() {
31
- this._initializeComposition(), this._registerValueChangeListeners();
32
- }
33
- onTemplateNodeUpdated(t) {
34
- super.onTemplateNodeUpdated(t), this._initializeComposition();
35
- }
36
- /**
37
- * Creates the HTML content for an orderable item with label and toggle
38
- */
39
- _createItemContent(t, i) {
40
- return `
41
- <div style="display: flex; align-items: center; justify-content: space-between;
42
- padding: 8px; gap: 8px;">
43
- <span style="flex: 1;">${t}</span>
44
- ${this._GuToggle(`visibility_${i}`)}
45
- </div>
46
- `;
47
- }
48
- /**
49
- * Registers event listeners for composition and visibility changes
50
- */
51
- _registerValueChangeListeners() {
52
- this.api.onValueChanged("cardComposition", (t) => {
53
- this._applyCompositionToBlock(t);
54
- }), s.forEach((t) => {
55
- this.api.onValueChanged(`visibility_${t.key}`, (i) => {
56
- this._applyVisibilityToBlock(t.key, i);
57
- });
58
- });
59
- }
60
- /**
61
- * Initializes composition order and visibility state from the current node
62
- */
63
- _initializeComposition() {
64
- const t = this._readCompositionFromNode(), i = this._readVisibilityFromRows(), e = {
65
- cardComposition: t,
66
- ...this._buildVisibilityValues(i)
67
- };
68
- this.api.updateValues(e);
69
- }
70
- /**
71
- * Reads composition order from node's data-card-composition attribute
72
- * Falls back to default order if attribute is not present
73
- */
74
- _readCompositionFromNode() {
75
- if (!this.currentNode || !("getAttribute" in this.currentNode))
76
- return s.map((i) => i.key);
77
- const t = this.currentNode.getAttribute(c);
78
- return t ? t.split(",").filter(Boolean) : s.map((i) => i.key);
79
- }
80
- /**
81
- * Builds visibility values object from the visibility map
82
- */
83
- _buildVisibilityValues(t) {
84
- return s.reduce((i, e) => (i[`visibility_${e.key}`] = t[e.key] ?? !0, i), {});
85
- }
86
- /**
87
- * Read visibility state from individual row elements' data-visibility attributes
88
- * This ensures toggles reflect the actual DOM state
89
- */
90
- _readVisibilityFromRows() {
91
- if (!this.currentNode)
92
- return this._getDefaultVisibilities();
93
- const t = Array.from(this.currentNode.querySelectorAll(l));
94
- console.debug("_readVisibilityFromRows - found attribute rows:", t.length);
95
- const i = this._extractVisibilityFromRows(t);
96
- return this._mergeWithDefaults(i);
97
- }
98
- /**
99
- * Returns default visibility values for all items
100
- */
101
- _getDefaultVisibilities() {
102
- return s.reduce((t, i) => (t[i.key] = i.visible, t), {});
103
- }
104
- /**
105
- * Extracts visibility values from DOM nodes
106
- */
107
- _extractVisibilityFromRows(t) {
108
- const i = {};
109
- return t.forEach((e) => {
110
- if (!("getAttribute" in e))
111
- return;
112
- const o = e.getAttribute(a), r = e.getAttribute(d);
113
- o && r !== null && (i[o] = this._parseVisibilityValue(r), console.debug(
114
- `_readVisibilityFromRows - ${o}: ${i[o]} (raw: ${r})`
115
- ));
116
- }), i;
117
- }
118
- /**
119
- * Parses visibility value from string to boolean
120
- * Accepts "1", "true" as true, everything else as false
121
- */
122
- _parseVisibilityValue(t) {
123
- return t === "1" || t === "true";
124
- }
125
- /**
126
- * Merges extracted visibilities with default values for missing keys
127
- */
128
- _mergeWithDefaults(t) {
129
- return s.forEach((i) => {
130
- i.key in t || (t[i.key] = i.visible, console.debug(`_readVisibilityFromRows - ${i.key}: using default ${i.visible}`));
131
- }), t;
132
- }
133
- /**
134
- * Apply the reordered composition to the block's HTML structure
135
- * Updates the data-card-composition attribute and reorders product attributes
136
- */
137
- _applyCompositionToBlock(t) {
138
- if (console.debug("_applyCompositionToBlock - composition:", t), !this.currentNode) {
139
- console.debug("_applyCompositionToBlock - no current node");
140
- return;
141
- }
142
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(c, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t);
143
- }
144
- /**
145
- * Reorders attribute rows within each product row based on composition order
146
- */
147
- _reorderProductAttributes(t) {
148
- if (!this.currentNode)
149
- return;
150
- const i = this.currentNode.querySelectorAll(A);
151
- if (!(i != null && i.length))
152
- return;
153
- const e = this.api.getDocumentModifier();
154
- i.forEach((o) => {
155
- const r = this._buildCompositionHtml(o, t);
156
- e.modifyHtml(o).setInnerHtml(r);
157
- }), e.apply(new n("Reorder product attributes"));
158
- }
159
- /**
160
- * Builds HTML string with attributes ordered according to composition
161
- */
162
- _buildCompositionHtml(t, i) {
163
- return i.reduce((e, o) => {
164
- const r = t.querySelector(`${l}[${a}="${o}"]`);
165
- return r && "getOuterHTML" in r ? e + r.getOuterHTML() : e;
166
- }, "");
167
- }
168
- /**
169
- * Apply visibility changes to the block's HTML structure
170
- * Updates display style and data-visibility attribute for all matching rows
171
- */
172
- _applyVisibilityToBlock(t, i) {
173
- if (console.debug("_applyVisibilityToBlock", t, i), !this.currentNode)
174
- return;
175
- const e = this.currentNode.querySelectorAll(`${l}[${a}="${t}"]`);
176
- if (!(e != null && e.length))
177
- return;
178
- const o = i ? "table-row" : "none", r = i ? "1" : "0", p = `Set ${t} visibility to ${i ? "visible" : "hidden"}`, u = this.api.getDocumentModifier();
179
- e.forEach((b) => {
180
- u.modifyHtml(b).setStyle("display", o).setAttribute(d, r);
181
- }), u.apply(new n(p));
182
- }
183
- }
184
- export {
185
- R as COMPOSITION_CONTROL_BLOCK_ID,
186
- N as RecommendationCardCompositionControl
187
- };