@useinsider/guido 3.6.0 → 3.7.0-beta.04f8814

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 (41) hide show
  1. package/README.md +14 -0
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +75 -72
  4. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  5. package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +9 -9
  8. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +2 -2
  9. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +24 -22
  10. package/dist/composables/useActionsApi.js +16 -15
  11. package/dist/composables/useHtmlCompiler.js +40 -22
  12. package/dist/composables/useRecommendation.js +34 -33
  13. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +127 -123
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +51 -47
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +12 -11
  16. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +46 -46
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +35 -29
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +28 -28
  20. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +8 -8
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +56 -49
  22. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
  23. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -17
  24. package/dist/extensions/Blocks/Unsubscribe/control.js +33 -26
  25. package/dist/guido.css +1 -1
  26. package/dist/src/components/Guido.vue.d.ts +1 -0
  27. package/dist/src/composables/useHtmlCompiler.d.ts +1 -0
  28. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +7 -0
  29. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +8 -0
  31. package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
  33. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.test.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  35. package/dist/src/utils/ampErrorFilter.d.ts +2 -0
  36. package/dist/src/utils/ampErrorFilter.test.d.ts +1 -0
  37. package/dist/src/utils/templatePreparation.d.ts +16 -0
  38. package/dist/src/utils/templatePreparation.test.d.ts +1 -0
  39. package/dist/utils/ampErrorFilter.js +8 -0
  40. package/dist/utils/templatePreparation.js +59 -58
  41. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
- var d = Object.defineProperty;
2
- var h = (a, s, e) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
3
- var u = (a, s, e) => h(a, typeof s != "symbol" ? s + "" : s, e);
1
+ var T = Object.defineProperty;
2
+ var p = (o, s, e) => s in o ? T(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e;
3
+ var c = (o, s, e) => p(o, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
5
- import { Control as T, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { DATA_ATTRIBUTES as p } from "./utils/constants.js";
7
- import { parsePageList as _ } from "./utils/utils.js";
8
- const v = "ui-elements-unsubscribe", r = {
5
+ import { Control as _, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { DATA_ATTRIBUTES as d } from "./utils/constants.js";
7
+ import { parsePageList as h } from "./utils/utils.js";
8
+ const g = "ui-elements-unsubscribe", r = {
9
9
  SELECT_BUTTON: "selectTemplateButton",
10
10
  PREV_BUTTON: "prevButton",
11
11
  NEXT_BUTTON: "nextButton",
12
12
  COUNTER_TEXT: "counterText",
13
13
  PREVIEW_IMAGE: "previewImage"
14
14
  };
15
- class B extends T {
15
+ class B extends _ {
16
16
  constructor() {
17
17
  super(...arguments);
18
- u(this, "currentPreviewIndex", 0);
19
- u(this, "currentNode");
20
- u(this, "currentPages");
21
- u(this, "valueChangeHandlers", []);
22
- u(this, "lastParsedAttribute");
18
+ c(this, "currentPreviewIndex", 0);
19
+ c(this, "currentNode");
20
+ c(this, "currentPages");
21
+ c(this, "valueChangeHandlers", []);
22
+ c(this, "lastParsedAttribute");
23
23
  }
24
24
  getId() {
25
- return v;
25
+ return g;
26
26
  }
27
27
  getTemplate() {
28
28
  return `
@@ -34,8 +34,8 @@ class B extends T {
34
34
  }
35
35
  onTemplateNodeUpdated(e) {
36
36
  if (this.currentNode = e, "getAttribute" in this.currentNode) {
37
- const t = this.currentNode.getAttribute(p.PAGE_LIST);
38
- t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
37
+ const t = this.currentNode.getAttribute(d.PAGE_LIST);
38
+ t && (t !== this.lastParsedAttribute && (this.currentPages = h(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
39
39
  }
40
40
  }
41
41
  onRender() {
@@ -62,11 +62,18 @@ class B extends T {
62
62
  _onButtonClick() {
63
63
  try {
64
64
  const e = l();
65
- e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
65
+ this._reseedSelectionFromBlock(), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
66
66
  } catch (e) {
67
67
  console.error("[UnsubscribeControl] Failed to open drawer:", e);
68
68
  }
69
69
  }
70
+ _reseedSelectionFromBlock() {
71
+ const e = l();
72
+ if (e.$reset(), !this.currentNode || !("getAttribute" in this.currentNode))
73
+ return;
74
+ const t = this.currentNode.getAttribute(d.PAGE_TYPE), a = this.currentNode.getAttribute(d.PAGE_LIST);
75
+ !t || !a || (e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(a)));
76
+ }
70
77
  _onPrevClick() {
71
78
  this.currentPreviewIndex > 0 && (this.currentPreviewIndex--, this._updatePreview(), this._updateCounter());
72
79
  }
@@ -80,21 +87,21 @@ class B extends T {
80
87
  var e;
81
88
  if ((e = this.currentPages) != null && e.length)
82
89
  try {
83
- const t = this.currentPages[this.currentPreviewIndex], o = l().getThumbnailByTemplateId(t);
84
- if (!o) {
90
+ const t = this.currentPages[this.currentPreviewIndex], u = l().getThumbnailByTemplateId(t);
91
+ if (!u) {
85
92
  console.warn("[UnsubscribeControl] No thumbnail found for page:", t);
86
93
  return;
87
94
  }
88
95
  this.api.updateValues({
89
- [r.PREVIEW_IMAGE]: o
96
+ [r.PREVIEW_IMAGE]: u
90
97
  });
91
98
  } catch (t) {
92
99
  console.error("[UnsubscribeControl] Failed to update preview:", t);
93
100
  }
94
101
  }
95
102
  _updateCounter() {
96
- const e = this.currentPreviewIndex + 1, t = this.totalTemplates, c = this.currentPreviewIndex === 0, o = this.currentPreviewIndex >= t - 1;
97
- this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, c), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, o), this.api.setUIEAttribute(
103
+ const e = this.currentPreviewIndex + 1, t = this.totalTemplates, a = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
104
+ this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, a), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
98
105
  r.COUNTER_TEXT,
99
106
  i.LABEL.text,
100
107
  `${this.api.translate("Showing")} ${e} ${this.api.translate("of")} ${t}`
@@ -135,14 +142,14 @@ class B extends T {
135
142
  </${n.LABEL}>
136
143
  `;
137
144
  }
138
- _getIconButton(e, t, c) {
139
- const o = c ? `${i.BUTTON.disabled}="true"` : "";
145
+ _getIconButton(e, t, a) {
146
+ const u = a ? `${i.BUTTON.disabled}="true"` : "";
140
147
  return `
141
148
  <${n.BUTTON}
142
149
  id="${e}"
143
150
  class="flat-inline flat-white"
144
151
  ${i.BUTTON.name}="${e}"
145
- ${o}
152
+ ${u}
146
153
  >
147
154
  <${n.ICON}
148
155
  src="${t}"
@@ -165,6 +172,6 @@ class B extends T {
165
172
  }
166
173
  }
167
174
  export {
168
- v as UNSUBSCRIBE_CONTROL_ID,
175
+ g as UNSUBSCRIBE_CONTROL_ID,
169
176
  B as UnsubscribeControl
170
177
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-b293a2b0]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-b293a2b0]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-b293a2b0]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-f6a8cb4c]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-f6a8cb4c]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-f6a8cb4c]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-f6a8cb4c]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-f6a8cb4c]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
@@ -12,6 +12,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
12
12
  };
13
13
  hasChanges: import("vue").ComputedRef<boolean>;
14
14
  saveSilent: () => Promise<Omit<SavedTemplateDetails, "metadata" | "silent"> | undefined> | undefined;
15
+ setLoading: (value: boolean) => void;
15
16
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
17
  "dynamic-content:open": (detail: {
17
18
  text: string;
@@ -1,4 +1,5 @@
1
1
  import type { CompilationResult } from '@@/Types/html-compiler';
2
2
  export declare const useHtmlCompiler: () => {
3
3
  compileHtml: (html: string) => CompilationResult;
4
+ compileAmpHtml: (amp: string) => CompilationResult;
4
5
  };
@@ -17,4 +17,11 @@ export declare const DEFAULT_CELL_PADDING = "0 5px";
17
17
  * Used by controls to reliably select direct children for spacing adjustments
18
18
  */
19
19
  export declare const ATTRIBUTE_CELL_CLASS = "attribute-cell";
20
+ /**
21
+ * Builds an empty filler cell used to pad incomplete rows (productsPerRow >
22
+ * number of products). Without fillers, table-layout:fixed redistributes the
23
+ * width among fewer cells and stretches them. Shared by the template and the
24
+ * card-composition control so both render identical filler markup.
25
+ */
26
+ export declare function buildFillerCell(columnWidth: string, padding?: string): string;
20
27
  export declare const gridElementRenderer: ElementRenderer;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { RecommendationProduct } from '@@/Types/recommendation';
8
8
  import { type Orientation, type PrepareProductRowsOptions } from './utils';
9
- export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, } from './utils';
9
+ export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, } from './utils';
10
10
  /**
11
11
  * Unified function to prepare product rows for any layout.
12
12
  * Delegates to the appropriate layout-specific implementation.
@@ -5,6 +5,14 @@ import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT
5
5
  * e.g., "rating_star" → "Rating Star"
6
6
  */
7
7
  export declare function toDisplayName(attrName: string): string;
8
+ /**
9
+ * Reduces a raw product-attribute value to a displayable scalar string.
10
+ * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
11
+ * their last item by the email renderer at send time, so we mirror that here to
12
+ * keep the editor preview consistent with what is actually sent.
13
+ * Returns undefined when there is no displayable string/number.
14
+ */
15
+ export declare function toDisplayableAttributeValue(value: unknown): string | undefined;
8
16
  /**
9
17
  * Checks whether an attribute is a default (top-level) product attribute
10
18
  * vs a custom product attribute (nested under `product_attributes`).
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the extra recommendation feed query params for an account, if any.
3
+ * Accounts without customizations get an empty object.
4
+ * @param partnerName Account subdomain (`config.partner.name`)
5
+ * @param strategy Recommendation strategy key of the block
6
+ */
7
+ export declare function getPartnerRecommendationParams(partnerName: string, strategy: string): Record<string, string>;
@@ -15,6 +15,7 @@ export declare class UnsubscribeControl extends Control {
15
15
  private get totalTemplates();
16
16
  private _listenToFormUpdates;
17
17
  private _onButtonClick;
18
+ private _reseedSelectionFromBlock;
18
19
  private _onPrevClick;
19
20
  private _onNextClick;
20
21
  private _loadAndUpdatePreview;
@@ -0,0 +1,2 @@
1
+ export declare const AMP_ERROR_WHITELISTED_TOKENS: string[];
2
+ export declare const filterAmpErrors: (ampErrors: string[]) => string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,20 @@
1
1
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
+ /**
3
+ * Collects every unsubscribe page id referenced by the unsubscribe blocks
4
+ * present in the email HTML, deduped.
5
+ *
6
+ * The email's unsubscribe link is variation-scoped on the backend, which
7
+ * resolves the page to render from the page ids the FE persists for that
8
+ * variation. Those ids must reflect the blocks actually in the email — not a
9
+ * UI-only selection store — otherwise a block that entered the editor by any
10
+ * path other than the page-selection UI (e.g. a dropped saved module) sends an
11
+ * empty association and the backend falls back to the default page.
12
+ *
13
+ * Read from raw editor HTML: the `data-unsubscribe-page-list` attribute lives
14
+ * on the block node there (the save-time sync-module extractor relies on the
15
+ * same source), so it is reliably present regardless of how the block was added.
16
+ */
17
+ export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
2
18
  export declare const useTemplatePreparation: () => {
3
19
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
4
20
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { MERGE_TAGS as t } from "../enums/unsubscribe.js";
2
+ const E = Object.values(t), c = (r) => r.filter(
3
+ (e) => !E.some((o) => e.includes(o))
4
+ );
5
+ export {
6
+ E as AMP_ERROR_WHITELISTED_TOKENS,
7
+ c as filterAmpErrors
8
+ };
@@ -1,58 +1,58 @@
1
- import { useActionsApi as C } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { useActionsApi as P } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as w } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
9
- function E(i, o) {
10
- const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
11
- return t.forEach((r) => {
12
- const a = r.getAttribute(S.PAGE_LIST);
13
- a && c.push(...D(a));
14
- }), o.filter((r) => c.includes(r));
5
+ import { DATA_ATTRIBUTES as h } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as E } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as U } from "../stores/unsubscribe.js";
9
+ function F(s) {
10
+ const o = new DOMParser().parseFromString(s, "text/html").querySelectorAll(`[${h.PAGE_LIST}]`), t = [];
11
+ return o.forEach((n) => {
12
+ const a = n.getAttribute(h.PAGE_LIST);
13
+ a && t.push(...E(a));
14
+ }), [...new Set(t)];
15
15
  }
16
- async function U(i) {
17
- const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
16
+ async function R(s) {
17
+ const m = new DOMParser().parseFromString(s, "text/html").querySelectorAll(".recommendation-block-v2");
18
18
  if (m.length === 0)
19
19
  return;
20
- const l = b();
20
+ const o = b();
21
21
  m.forEach((t) => {
22
- var g, f, u, n, y;
23
- const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
24
- if (!Number.isFinite(r))
22
+ var c, p, g, f, r;
23
+ const n = t.getAttribute("recommendation-id"), a = n ? Number(n) : NaN;
24
+ if (!Number.isFinite(a))
25
25
  return;
26
- const a = t.getAttribute("esd-ext-config");
27
- if (!a)
26
+ const d = t.getAttribute("esd-ext-config");
27
+ if (!d)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(a);
31
+ e = JSON.parse(d);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
- const p = {
38
- strategy: e.strategy ?? s.strategy,
39
- language: e.language ?? s.language,
40
- size: e.size ?? s.size,
37
+ const y = {
38
+ strategy: e.strategy ?? i.strategy,
39
+ language: e.language ?? i.language,
40
+ size: e.size ?? i.size,
41
41
  // Spread the default arrays so each block gets a fresh reference
42
42
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
- productIds: e.productIds ?? [...s.productIds],
44
- filters: e.filters ?? [...s.filters],
45
- shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
46
- currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
47
- currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
48
- currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
49
- currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
50
- currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
43
+ productIds: e.productIds ?? [...i.productIds],
44
+ filters: e.filters ?? [...i.filters],
45
+ shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
46
+ currencyCode: ((c = e.currency) == null ? void 0 : c.code) ?? l.code,
47
+ currencyAlignment: ((p = e.currency) == null ? void 0 : p.alignment) ?? l.alignment,
48
+ currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? l.decimalCount,
49
+ currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? l.decimalSeparator,
50
+ currencyThousandSeparator: ((r = e.currency) == null ? void 0 : r.thousandSeparator) ?? l.thousandSeparator
51
51
  };
52
- l.seedBlockUrlConfig(r, p);
52
+ o.seedBlockUrlConfig(a, y);
53
53
  });
54
54
  try {
55
- await l.fetchRecommendationCreateData();
55
+ await o.fetchRecommendationCreateData();
56
56
  } catch (t) {
57
57
  console.warn(
58
58
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -60,42 +60,43 @@ async function U(i) {
60
60
  );
61
61
  }
62
62
  }
63
- const _ = () => {
64
- const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
63
+ const v = () => {
64
+ const s = H(), u = U(), { getCompiledEmail: m, getTemplateData: o } = P(), { compileHtml: t, compileAmpHtml: n } = w();
65
65
  return {
66
66
  prepareTemplateDetails: async () => {
67
- const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
67
+ const { html: d, ampHtml: e = "", ampErrors: y = [] } = await m({
68
68
  minimize: !0,
69
69
  resetDataSavedFlag: !1
70
- }), { html: p, css: g, syncModulesIds: f = [] } = await l();
71
- o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
72
- const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
70
+ }), { html: c, css: p, syncModulesIds: g = [] } = await o();
71
+ u.selectedUnsubscribePages.length && await u.fetchTemplates(), await R(c);
72
+ const { compiledHtml: f, stats: r, appliedRules: A } = t(d), C = e && n(e).compiledHtml, T = s.getSelectedDynamicContentList, D = b(), S = F(c);
73
73
  return console.debug("HTML Compilation Stats:", {
74
- originalSize: n.originalSize,
75
- compiledSize: n.compiledSize,
76
- reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
- appliedRules: y,
78
- executionTime: `${n.executionTime.toFixed(2)}ms`
74
+ originalSize: r.originalSize,
75
+ compiledSize: r.compiledSize,
76
+ reduction: `${r.reductionPercentage.toFixed(2)}%`,
77
+ appliedRules: A,
78
+ executionTime: `${r.executionTime.toFixed(2)}ms`
79
79
  }), {
80
- dynamicContentList: h,
81
- compiledHtml: u,
82
- rawHtml: p,
83
- css: g,
84
- ampHtml: a,
85
- ampErrors: e,
86
- modules: f.map(Number),
80
+ dynamicContentList: T,
81
+ compiledHtml: f,
82
+ rawHtml: c,
83
+ css: p,
84
+ ampHtml: C,
85
+ ampErrors: y,
86
+ modules: g.map(Number),
87
87
  recommendation: {
88
- campaignUrls: A.recommendationCampaignUrls,
88
+ campaignUrls: D.recommendationCampaignUrls,
89
89
  configs: {}
90
90
  },
91
91
  unsubscribe: {
92
- status: o.unsubscribePagesStatus,
93
- config: E(u, o.selectedUnsubscribePages)
92
+ status: S.length > 0,
93
+ config: S
94
94
  }
95
95
  };
96
96
  }
97
97
  };
98
98
  };
99
99
  export {
100
- _ as useTemplatePreparation
100
+ F as getHtmlReferencedUnsubscribePages,
101
+ v as useTemplatePreparation
101
102
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.6.0",
3
+ "version": "3.7.0-beta.04f8814",
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",