@useinsider/guido 1.0.3-beta.dfb1fcf → 1.0.3-beta.e1adf59

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 (130) hide show
  1. package/README.md +3 -144
  2. package/dist/components/Guido.vue.js +10 -12
  3. package/dist/components/Guido.vue2.js +101 -84
  4. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
  6. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  7. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  8. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +9 -9
  9. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +17 -30
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +10 -12
  11. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -19
  12. package/dist/composables/useApiErrorTracking.js +120 -0
  13. package/dist/composables/useErrorTracking.js +98 -0
  14. package/dist/composables/useGuidoActions.js +9 -19
  15. package/dist/composables/useHttp.js +89 -52
  16. package/dist/composables/useStripo.js +163 -66
  17. package/dist/composables/useStripoErrorCategory.js +86 -0
  18. package/dist/composables/useStripoSlackNotifier.js +47 -0
  19. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  20. package/dist/config/migrator/index.js +6 -7
  21. package/dist/enums/defaults.js +8 -16
  22. package/dist/enums/onboarding.js +1 -2
  23. package/dist/enums/unsubscribe.js +25 -27
  24. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  25. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  26. package/dist/extensions/Blocks/Recommendation/block.js +3 -6
  27. package/dist/extensions/Blocks/Recommendation/control.js +65 -109
  28. package/dist/extensions/Blocks/Recommendation/extension.js +7 -18
  29. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -159
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/template.js +200 -0
  32. package/dist/extensions/Blocks/common-control.js +43 -125
  33. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  34. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  35. package/dist/guido.css +1 -1
  36. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +100 -312
  37. package/dist/package.json.js +1 -1
  38. package/dist/services/slackNotificationService.js +167 -0
  39. package/dist/services/stripoApi.js +49 -19
  40. package/dist/services/stripoErrorDeduplicationService.js +91 -0
  41. package/dist/src/@types/generic.d.ts +6 -42
  42. package/dist/src/components/Guido.vue.d.ts +3 -4
  43. package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +1 -3
  44. package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +1 -3
  45. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  46. package/dist/src/composables/useApiErrorTracking.d.ts +26 -0
  47. package/dist/src/composables/useErrorTracking.d.ts +30 -0
  48. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  49. package/dist/src/composables/useStripoErrorCategory.d.ts +26 -0
  50. package/dist/src/composables/useStripoSlackNotifier.d.ts +8 -0
  51. package/dist/src/enums/onboarding.d.ts +0 -1
  52. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  53. package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -11
  54. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Recommendation/template.d.ts +6 -0
  56. package/dist/src/extensions/Blocks/common-control.d.ts +0 -21
  57. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  58. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  59. package/dist/src/services/slackNotificationService.d.ts +110 -0
  60. package/dist/src/services/stripoErrorDeduplicationService.d.ts +75 -0
  61. package/dist/src/stores/config.d.ts +2 -10
  62. package/dist/src/stores/dynamic-content.d.ts +3 -3
  63. package/dist/src/stores/editor.d.ts +1 -1
  64. package/dist/src/stores/onboarding.d.ts +1 -1
  65. package/dist/src/stores/preview.d.ts +1 -1
  66. package/dist/src/stores/recommendation.d.ts +1 -1
  67. package/dist/src/stores/save-as-template.d.ts +1 -1
  68. package/dist/src/stores/toaster.d.ts +1 -1
  69. package/dist/src/stores/unsubscribe.d.ts +1 -1
  70. package/dist/src/stores/version-history.d.ts +1 -1
  71. package/dist/src/utils/dateUtil.d.ts +0 -21
  72. package/dist/src/utils/genericUtil.d.ts +0 -1
  73. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  74. package/dist/static/styles/components/wide-panel.css.js +4 -0
  75. package/dist/static/styles/customEditorStyle.css.js +0 -19
  76. package/dist/stores/config.js +5 -5
  77. package/dist/stores/dynamic-content.js +2 -2
  78. package/dist/stores/editor.js +1 -1
  79. package/dist/stores/onboarding.js +27 -27
  80. package/dist/stores/preview.js +1 -1
  81. package/dist/stores/recommendation.js +3 -3
  82. package/dist/stores/save-as-template.js +2 -2
  83. package/dist/stores/toaster.js +1 -1
  84. package/dist/stores/unsubscribe.js +1 -1
  85. package/dist/stores/version-history.js +4 -4
  86. package/dist/utils/dateUtil.js +3 -24
  87. package/dist/utils/genericUtil.js +9 -20
  88. package/package.json +3 -3
  89. package/dist/composables/useBlocksConfig.js +0 -49
  90. package/dist/config/migrator/recommendationMigrator.js +0 -293
  91. package/dist/enums/date.js +0 -6
  92. package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -193
  93. package/dist/extensions/Blocks/Recommendation/constants.js +0 -14
  94. package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
  95. package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -272
  96. package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
  97. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
  98. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
  99. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
  100. package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
  101. package/dist/extensions/Blocks/Recommendation/controls/priceHideControl.js +0 -60
  102. package/dist/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.js +0 -160
  103. package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
  104. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -184
  105. package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
  106. package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
  107. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
  108. package/dist/extensions/Blocks/controlFactories.js +0 -234
  109. package/dist/src/composables/useBlocksConfig.d.ts +0 -11
  110. package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
  111. package/dist/src/enums/date.d.ts +0 -4
  112. package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -79
  113. package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -91
  114. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  115. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -71
  116. package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
  117. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  118. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  119. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  120. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  121. package/dist/src/extensions/Blocks/Recommendation/controls/priceHideControl.d.ts +0 -16
  122. package/dist/src/extensions/Blocks/Recommendation/controls/priceInlineLayoutControl.d.ts +0 -50
  123. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
  124. package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
  125. package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
  126. package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
  127. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
  128. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -95
  129. package/dist/src/utils/environmentUtil.d.ts +0 -5
  130. package/dist/utils/environmentUtil.js +0 -4
@@ -1,193 +0,0 @@
1
- import { ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as b } 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 b {
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 this._getDefaultComposition();
77
- const t = this.currentNode.getAttribute(c);
78
- return t ? t.split(",").filter(Boolean) : this._getDefaultComposition();
79
- }
80
- /**
81
- * Gets default composition order
82
- */
83
- _getDefaultComposition() {
84
- return s.map((t) => t.key);
85
- }
86
- /**
87
- * Builds visibility values object from the visibility map
88
- */
89
- _buildVisibilityValues(t) {
90
- return s.reduce((i, e) => (i[`visibility_${e.key}`] = t[e.key] ?? !0, i), {});
91
- }
92
- /**
93
- * Read visibility state from individual row elements' data-visibility attributes
94
- * This ensures toggles reflect the actual DOM state
95
- */
96
- _readVisibilityFromRows() {
97
- if (!this.currentNode)
98
- return this._getDefaultVisibilities();
99
- const t = Array.from(this.currentNode.querySelectorAll(l));
100
- console.debug("_readVisibilityFromRows - found attribute rows:", t.length);
101
- const i = this._extractVisibilityFromRows(t);
102
- return this._mergeWithDefaults(i);
103
- }
104
- /**
105
- * Returns default visibility values for all items
106
- */
107
- _getDefaultVisibilities() {
108
- return s.reduce((t, i) => (t[i.key] = i.visible, t), {});
109
- }
110
- /**
111
- * Extracts visibility values from DOM nodes
112
- */
113
- _extractVisibilityFromRows(t) {
114
- const i = {};
115
- return t.forEach((e) => {
116
- if (!("getAttribute" in e))
117
- return;
118
- const o = e.getAttribute(a), r = e.getAttribute(d);
119
- o && r !== null && (i[o] = this._parseVisibilityValue(r), console.debug(
120
- `_readVisibilityFromRows - ${o}: ${i[o]} (raw: ${r})`
121
- ));
122
- }), i;
123
- }
124
- /**
125
- * Parses visibility value from string to boolean
126
- * Accepts "1", "true" as true, everything else as false
127
- */
128
- _parseVisibilityValue(t) {
129
- return t === "1" || t === "true";
130
- }
131
- /**
132
- * Merges extracted visibilities with default values for missing keys
133
- */
134
- _mergeWithDefaults(t) {
135
- return s.forEach((i) => {
136
- i.key in t || (t[i.key] = i.visible, console.debug(`_readVisibilityFromRows - ${i.key}: using default ${i.visible}`));
137
- }), t;
138
- }
139
- /**
140
- * Apply the reordered composition to the block's HTML structure
141
- * Updates the data-card-composition attribute and reorders product attributes
142
- */
143
- _applyCompositionToBlock(t) {
144
- if (console.debug("_applyCompositionToBlock - composition:", t), !this.currentNode) {
145
- console.debug("_applyCompositionToBlock - no current node");
146
- return;
147
- }
148
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(c, t.join(",")).apply(new n("Update card composition")), this._reorderProductAttributes(t);
149
- }
150
- /**
151
- * Reorders attribute rows within each product row based on composition order
152
- */
153
- _reorderProductAttributes(t) {
154
- if (!this.currentNode)
155
- return;
156
- const i = this.currentNode.querySelectorAll(A);
157
- if (!(i != null && i.length))
158
- return;
159
- const e = this.api.getDocumentModifier();
160
- i.forEach((o) => {
161
- const r = this._buildCompositionHtml(o, t);
162
- e.modifyHtml(o).setInnerHtml(r);
163
- }), e.apply(new n("Reorder product attributes"));
164
- }
165
- /**
166
- * Builds HTML string with attributes ordered according to composition
167
- */
168
- _buildCompositionHtml(t, i) {
169
- return i.reduce((e, o) => {
170
- const r = t.querySelector(`${l}[${a}="${o}"]`);
171
- return r && "getOuterHTML" in r ? e + r.getOuterHTML() : e;
172
- }, "");
173
- }
174
- /**
175
- * Apply visibility changes to the block's HTML structure
176
- * Updates display style and data-visibility attribute for all matching rows
177
- */
178
- _applyVisibilityToBlock(t, i) {
179
- if (console.debug("_applyVisibilityToBlock", t, i), !this.currentNode)
180
- return;
181
- const e = this.currentNode.querySelectorAll(`${l}[${a}="${t}"]`);
182
- if (!(e != null && e.length))
183
- return;
184
- const o = i ? "table-row" : "none", r = i ? "1" : "0", p = `Set ${t} visibility to ${i ? "visible" : "hidden"}`, u = this.api.getDocumentModifier();
185
- e.forEach((_) => {
186
- u.modifyHtml(_).setStyle("display", o).setAttribute(d, r);
187
- }), u.apply(new n(p));
188
- }
189
- }
190
- export {
191
- R as COMPOSITION_CONTROL_BLOCK_ID,
192
- N as RecommendationCardCompositionControl
193
- };
@@ -1,14 +0,0 @@
1
- const _ = "productImage", i = "productName", n = "productPrice", b = "productOldPrice", l = "productOmnibusPrice", N = "productOmnibusDiscount", O = "productButton", T = "data-price-inline";
2
- var o = /* @__PURE__ */ ((c) => (c.BUTTON = "recommendation-block-button", c.NAME = "recommendation-block-name", c.PRICE = "recommendation-block-price", c.OLD_PRICE = "recommendation-block-old-price", c.OMNIBUS_PRICE = "recommendation-block-omnibus-price", c.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", c.IMAGE = "recommendation-block-image", c))(o || {}), r = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_LINE_SPACING = "recommendation-block-name-line-spacing-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_HIDE_IF_SAME = "recommendation-block-price-hide-if-same-control", c.PRICE_LINE_SPACING = "recommendation-block-price-line-spacing-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_LINE_SPACING = "recommendation-block-old-price-line-spacing-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_LINE_SPACING = "recommendation-block-omnibus-price-line-spacing-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_LINE_SPACING = "recommendation-block-omnibus-discount-line-spacing-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.PRICE_INLINE_LAYOUT = "recommendation-block-price-inline-layout-control", c))(r || {});
3
- export {
4
- T as ATTR_DATA_PRICE_INLINE,
5
- O as ATTR_PRODUCT_BUTTON,
6
- _ as ATTR_PRODUCT_IMAGE,
7
- i as ATTR_PRODUCT_NAME,
8
- b as ATTR_PRODUCT_OLD_PRICE,
9
- N as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
10
- l as ATTR_PRODUCT_OMNIBUS_PRICE,
11
- n as ATTR_PRODUCT_PRICE,
12
- o as RecommendationBlockId,
13
- r as RecommendationControlId
14
- };
@@ -1,68 +0,0 @@
1
- import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as d } from "../../common-control.js";
3
- const c = "recommendation-card-background-color-control", o = {
4
- CARD_BACKGROUND_COLOR: "cardBackgroundColor"
5
- };
6
- class u extends d {
7
- getId() {
8
- return c;
9
- }
10
- getTemplate() {
11
- return `
12
- <div class="card-bg-control-container">
13
- ${this._GuTwoColumns([
14
- this._GuLabel({ text: "Card Background Color" }),
15
- this._GuColorPicker(o.CARD_BACKGROUND_COLOR)
16
- ])}
17
- </div>
18
- `;
19
- }
20
- onRender() {
21
- this._setFormValues(), this._listenToFormUpdates();
22
- }
23
- onTemplateNodeUpdated(r) {
24
- super.onTemplateNodeUpdated(r), this._setFormValues();
25
- }
26
- _setFormValues() {
27
- const r = this._getCurrentCardBackgroundColor();
28
- this.api.updateValues({
29
- [o.CARD_BACKGROUND_COLOR]: r
30
- });
31
- }
32
- /**
33
- * Reads the current background color from the first product card wrapper
34
- * @returns The background color value or 'transparent' if not found
35
- */
36
- _getCurrentCardBackgroundColor() {
37
- if (!this.currentNode || !("querySelectorAll" in this.currentNode))
38
- return "transparent";
39
- const r = this.currentNode.querySelector(".product-card-wrapper");
40
- return !r || !("getStyle" in r) ? "transparent" : r.getStyle("background-color") || "transparent";
41
- }
42
- /**
43
- * Handles card background color changes
44
- * Applies the color to all product card wrapper elements
45
- */
46
- _onCardBackgroundColorChange(r) {
47
- if (!this.currentNode || !("querySelectorAll" in this.currentNode))
48
- return;
49
- const e = Array.from(
50
- this.currentNode.querySelectorAll(".product-card-wrapper")
51
- );
52
- if (e.length === 0)
53
- return;
54
- const t = this.api.getDocumentModifier();
55
- e.forEach((n) => {
56
- t.modifyHtml(n).setStyle("background-color", r);
57
- }), t.apply(new a("Update card background color"));
58
- }
59
- _listenToFormUpdates() {
60
- this.api.onValueChanged(o.CARD_BACKGROUND_COLOR, (r) => {
61
- this._onCardBackgroundColorChange(r);
62
- });
63
- }
64
- }
65
- export {
66
- c as CARD_BACKGROUND_COLOR_CONTROL_ID,
67
- u as CardBackgroundColorControl
68
- };
@@ -1,272 +0,0 @@
1
- import { createButtonAlignControl as _, createButtonBorderControl as i, createButtonBorderRadiusControl as S, createButtonColorControl as T, createButtonFitToContainerControl as E, createButtonFontFamilyControl as B, createButtonMarginsControl as s, createButtonPaddingsControl as P, createButtonTextControl as U, createButtonTextSizeControl as a, createButtonTextStyleAndFontColorControl as R, createImageMarginsControl as M, createImageSizeControl as A, createTextAlignControl as C, createTextBackgroundColorControl as r, createTextColorControl as I, createTextFontFamilyControl as O, createTextLineSpacingControl as N, createPaddingsControl as e, createTextSizeControl as c, createTextStyleControl as l } from "../../controlFactories.js";
2
- import { RecommendationBlockId as o, RecommendationControlId as t } from "../constants.js";
3
- import { PriceInlineLayoutControl as mo } from "./priceInlineLayoutControl.js";
4
- const n = ".ins-recommendation-product-container", L = C(
5
- t.NAME_ALIGN,
6
- o.NAME,
7
- n
8
- ), m = I(
9
- t.NAME_COLOR,
10
- o.NAME,
11
- n
12
- ), d = c(
13
- t.NAME_SIZE,
14
- o.NAME,
15
- n
16
- ), g = l(
17
- t.NAME_STYLE,
18
- o.NAME,
19
- n
20
- ), F = O(
21
- t.NAME_FONT_FAMILY,
22
- o.NAME,
23
- n
24
- ), G = r(
25
- t.NAME_BACKGROUND,
26
- o.NAME,
27
- n
28
- ), y = e(
29
- t.NAME_PADDINGS,
30
- o.NAME,
31
- n
32
- ), b = N(
33
- t.NAME_LINE_SPACING,
34
- o.NAME,
35
- n
36
- ), x = C(
37
- t.PRICE_ALIGN,
38
- o.PRICE,
39
- n
40
- ), Y = I(
41
- t.PRICE_COLOR,
42
- o.PRICE,
43
- n
44
- ), p = c(
45
- t.PRICE_SIZE,
46
- o.PRICE,
47
- n
48
- ), z = l(
49
- t.PRICE_STYLE,
50
- o.PRICE,
51
- n
52
- ), k = O(
53
- t.PRICE_FONT_FAMILY,
54
- o.PRICE,
55
- n
56
- ), Z = r(
57
- t.PRICE_BACKGROUND,
58
- o.PRICE,
59
- n
60
- ), K = e(
61
- t.PRICE_PADDINGS,
62
- o.PRICE,
63
- n
64
- ), f = N(
65
- t.PRICE_LINE_SPACING,
66
- o.PRICE,
67
- n
68
- ), X = C(
69
- t.OLD_PRICE_ALIGN,
70
- o.OLD_PRICE,
71
- n
72
- ), h = I(
73
- t.OLD_PRICE_COLOR,
74
- o.OLD_PRICE,
75
- n
76
- ), j = c(
77
- t.OLD_PRICE_SIZE,
78
- o.OLD_PRICE,
79
- n
80
- ), q = l(
81
- t.OLD_PRICE_STYLE,
82
- o.OLD_PRICE,
83
- n
84
- ), v = O(
85
- t.OLD_PRICE_FONT_FAMILY,
86
- o.OLD_PRICE,
87
- n
88
- ), w = r(
89
- t.OLD_PRICE_BACKGROUND,
90
- o.OLD_PRICE,
91
- n
92
- ), H = e(
93
- t.OLD_PRICE_PADDINGS,
94
- o.OLD_PRICE,
95
- n
96
- ), J = N(
97
- t.OLD_PRICE_LINE_SPACING,
98
- o.OLD_PRICE,
99
- n
100
- ), Q = C(
101
- t.OMNIBUS_PRICE_ALIGN,
102
- o.OMNIBUS_PRICE,
103
- n
104
- ), V = I(
105
- t.OMNIBUS_PRICE_COLOR,
106
- o.OMNIBUS_PRICE,
107
- n
108
- ), W = c(
109
- t.OMNIBUS_PRICE_SIZE,
110
- o.OMNIBUS_PRICE,
111
- n
112
- ), $ = l(
113
- t.OMNIBUS_PRICE_STYLE,
114
- o.OMNIBUS_PRICE,
115
- n
116
- ), oo = O(
117
- t.OMNIBUS_PRICE_FONT_FAMILY,
118
- o.OMNIBUS_PRICE,
119
- n
120
- ), to = r(
121
- t.OMNIBUS_PRICE_BACKGROUND,
122
- o.OMNIBUS_PRICE,
123
- n
124
- ), no = e(
125
- t.OMNIBUS_PRICE_PADDINGS,
126
- o.OMNIBUS_PRICE,
127
- n
128
- ), Co = N(
129
- t.OMNIBUS_PRICE_LINE_SPACING,
130
- o.OMNIBUS_PRICE,
131
- n
132
- ), ro = C(
133
- t.OMNIBUS_DISCOUNT_ALIGN,
134
- o.OMNIBUS_DISCOUNT,
135
- n
136
- ), Io = I(
137
- t.OMNIBUS_DISCOUNT_COLOR,
138
- o.OMNIBUS_DISCOUNT,
139
- n
140
- ), Oo = c(
141
- t.OMNIBUS_DISCOUNT_SIZE,
142
- o.OMNIBUS_DISCOUNT,
143
- n
144
- ), No = l(
145
- t.OMNIBUS_DISCOUNT_STYLE,
146
- o.OMNIBUS_DISCOUNT,
147
- n
148
- ), eo = O(
149
- t.OMNIBUS_DISCOUNT_FONT_FAMILY,
150
- o.OMNIBUS_DISCOUNT,
151
- n
152
- ), co = r(
153
- t.OMNIBUS_DISCOUNT_BACKGROUND,
154
- o.OMNIBUS_DISCOUNT,
155
- n
156
- ), lo = e(
157
- t.OMNIBUS_DISCOUNT_PADDINGS,
158
- o.OMNIBUS_DISCOUNT,
159
- n
160
- ), _o = N(
161
- t.OMNIBUS_DISCOUNT_LINE_SPACING,
162
- o.OMNIBUS_DISCOUNT,
163
- n
164
- ), io = _(
165
- t.BUTTON_ALIGN,
166
- o.BUTTON,
167
- n
168
- ), So = i(
169
- t.BUTTON_BORDER,
170
- o.BUTTON,
171
- n
172
- ), To = S(
173
- t.BUTTON_BORDER_RADIUS,
174
- o.BUTTON,
175
- n
176
- ), Eo = T(
177
- t.BUTTON_COLOR,
178
- o.BUTTON,
179
- n
180
- ), Bo = B(
181
- t.BUTTON_FONT_FAMILY,
182
- o.BUTTON,
183
- n
184
- ), so = s(
185
- t.BUTTON_MARGINS,
186
- o.BUTTON,
187
- n
188
- ), Po = P(
189
- t.BUTTON_PADDINGS,
190
- o.BUTTON,
191
- n
192
- ), Uo = U(
193
- t.BUTTON_TEXT,
194
- o.BUTTON,
195
- n
196
- ), ao = a(
197
- t.BUTTON_TEXT_SIZE,
198
- o.BUTTON,
199
- n
200
- ), Ro = R(
201
- t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
202
- o.BUTTON,
203
- n
204
- ), Mo = E(
205
- t.BUTTON_FIT_TO_CONTENT,
206
- o.BUTTON,
207
- n
208
- ), Ao = A(
209
- t.IMAGE_SIZE,
210
- o.IMAGE,
211
- n
212
- ), Do = M(
213
- t.IMAGE_MARGINS,
214
- o.IMAGE,
215
- n
216
- );
217
- export {
218
- io as ButtonAlignControl,
219
- So as ButtonBorderControl,
220
- To as ButtonBorderRadiusControl,
221
- Eo as ButtonColorControl,
222
- Mo as ButtonFitToContentControl,
223
- Bo as ButtonFontFamilyControl,
224
- so as ButtonMarginsControl,
225
- Po as ButtonPaddingsControl,
226
- Uo as ButtonTextControl,
227
- ao as ButtonTextSizeControl,
228
- Ro as ButtonTextStyleAndFontColorControl,
229
- Do as ImageMarginsControl,
230
- Ao as ImageSizeControl,
231
- L as NameAlignControl,
232
- G as NameBackgroundControl,
233
- m as NameColorControl,
234
- F as NameFontFamilyControl,
235
- b as NameLineSpacingControl,
236
- y as NamePaddingsControl,
237
- d as NameSizeControl,
238
- g as NameStyleControl,
239
- X as OldPriceAlignControl,
240
- w as OldPriceBackgroundControl,
241
- h as OldPriceColorControl,
242
- v as OldPriceFontFamilyControl,
243
- J as OldPriceLineSpacingControl,
244
- H as OldPricePaddingsControl,
245
- j as OldPriceSizeControl,
246
- q as OldPriceStyleControl,
247
- ro as OmnibusDiscountAlignControl,
248
- co as OmnibusDiscountBackgroundControl,
249
- Io as OmnibusDiscountColorControl,
250
- eo as OmnibusDiscountFontFamilyControl,
251
- _o as OmnibusDiscountLineSpacingControl,
252
- lo as OmnibusDiscountPaddingsControl,
253
- Oo as OmnibusDiscountSizeControl,
254
- No as OmnibusDiscountStyleControl,
255
- Q as OmnibusPriceAlignControl,
256
- to as OmnibusPriceBackgroundControl,
257
- V as OmnibusPriceColorControl,
258
- oo as OmnibusPriceFontFamilyControl,
259
- Co as OmnibusPriceLineSpacingControl,
260
- no as OmnibusPricePaddingsControl,
261
- W as OmnibusPriceSizeControl,
262
- $ as OmnibusPriceStyleControl,
263
- x as PriceAlignControl,
264
- Z as PriceBackgroundControl,
265
- Y as PriceColorControl,
266
- k as PriceFontFamilyControl,
267
- mo as PriceInlineLayoutControl,
268
- f as PriceLineSpacingControl,
269
- K as PricePaddingsControl,
270
- p as PriceSizeControl,
271
- z as PriceStyleControl
272
- };
@@ -1,74 +0,0 @@
1
- import { ModificationDescription as m } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as c } from "../../common-control.js";
3
- import { RecommendationControlId as d, RecommendationBlockId as a } from "../constants.js";
4
- const n = {
5
- TEXT_TRIM_ENABLED: "textTrimEnabled"
6
- }, r = "text-trim-enabled", l = ".ins-recommendation-product-container";
7
- class E extends c {
8
- getId() {
9
- return d.NAME_TEXT_TRIM;
10
- }
11
- getTemplate() {
12
- return `
13
- <div class="name-text-trim-control-container">
14
- ${this._GuTwoColumns([
15
- this._GuLabel({ text: "Trim Long Text" }),
16
- this._GuToggle(n.TEXT_TRIM_ENABLED)
17
- ])}
18
- </div>
19
- `;
20
- }
21
- onRender() {
22
- this._setFormValues(), this._listenToFormUpdates();
23
- }
24
- onTemplateNodeUpdated(e) {
25
- super.onTemplateNodeUpdated(e), this._setFormValues();
26
- }
27
- _setFormValues() {
28
- const e = this._getCurrentTrimState();
29
- this.api.updateValues({
30
- [n.TEXT_TRIM_ENABLED]: e
31
- });
32
- }
33
- _getCurrentTrimState() {
34
- if (!this.currentNode || !("hasClass" in this.currentNode))
35
- return !1;
36
- if (this.currentNode.hasClass(r))
37
- return !0;
38
- const e = this.currentNode.closest(l);
39
- if (!e)
40
- return !1;
41
- const t = e.querySelector(
42
- `[esd-extension-block-id="${a.NAME}"]`
43
- );
44
- return t && "hasClass" in t ? t.hasClass(r) : !1;
45
- }
46
- _onTextTrimChange(e) {
47
- if (!this.currentNode || !("closest" in this.currentNode))
48
- return;
49
- const t = this.currentNode.closest(l);
50
- if (!t || !("querySelectorAll" in t))
51
- return;
52
- const s = Array.from(
53
- t.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
54
- );
55
- if (!s.length)
56
- return;
57
- const o = this.api.getDocumentModifier();
58
- s.forEach((i) => {
59
- e ? o.modifyHtml(i).setClass(r) : o.modifyHtml(i).removeClass(r);
60
- }), o.apply(
61
- new m(
62
- e ? "Enable product name text trimming" : "Disable product name text trimming"
63
- )
64
- );
65
- }
66
- _listenToFormUpdates() {
67
- this.api.onValueChanged(n.TEXT_TRIM_ENABLED, (e) => {
68
- this._onTextTrimChange(e);
69
- });
70
- }
71
- }
72
- export {
73
- E as NameTextTrimControl
74
- };
@@ -1,71 +0,0 @@
1
- import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as m } from "../../common-control.js";
3
- import { RecommendationControlId as l, RecommendationBlockId as d } from "../constants.js";
4
- import { preserveTextStyles as T } from "../utils/preserveTextStyles.js";
5
- const f = ".ins-recommendation-product-container", i = "data-text-after", u = "", p = ".omnibus-text-after";
6
- class E extends m {
7
- getId() {
8
- return l.OMNIBUS_DISCOUNT_TEXT_AFTER;
9
- }
10
- getTemplate() {
11
- return `
12
- <div class="omnibus-discount-text-after-control-container">
13
- ${this._GuTwoColumns([
14
- this._GuLabel({ text: "Text After" }),
15
- this._GuTextInput({
16
- name: "omnibusDiscountTextAfter",
17
- placeholder: "e.g., off!",
18
- className: "es-180w"
19
- })
20
- ])}
21
- </div>
22
- `;
23
- }
24
- onRender() {
25
- this._setFormValues(), this._listenToFormUpdates();
26
- }
27
- onTemplateNodeUpdated(t) {
28
- super.onTemplateNodeUpdated(t), this._setFormValues();
29
- }
30
- _setFormValues() {
31
- const t = this._getCurrentText();
32
- this.api.updateValues({
33
- omnibusDiscountTextAfter: t
34
- });
35
- }
36
- _getCurrentText() {
37
- if (!this.currentNode || !("getAttribute" in this.currentNode))
38
- return u;
39
- const t = this.currentNode.getAttribute(i);
40
- return t === null ? u : t;
41
- }
42
- _onTextChange(t) {
43
- if (!this.currentNode || !("closest" in this.currentNode))
44
- return;
45
- const e = this.currentNode.closest(f);
46
- if (!e || !("querySelectorAll" in e))
47
- return;
48
- const n = Array.from(
49
- e.querySelectorAll(`[esd-extension-block-id="${d.OMNIBUS_DISCOUNT}"]`)
50
- );
51
- if (!n.length)
52
- return;
53
- const o = this.api.getDocumentModifier();
54
- n.forEach((s) => {
55
- o.modifyHtml(s).setAttribute(i, t);
56
- const r = s.querySelector(p);
57
- if (r) {
58
- const c = T(r, t);
59
- o.modifyHtml(r).setInnerHtml(c);
60
- }
61
- }), o.apply(new a("Update omnibus discount text after"));
62
- }
63
- _listenToFormUpdates() {
64
- this.api.onValueChanged("omnibusDiscountTextAfter", (t) => {
65
- this._onTextChange(t);
66
- });
67
- }
68
- }
69
- export {
70
- E as OmnibusDiscountTextAfterControl
71
- };