@useinsider/guido 2.0.0-beta.bf65edd → 2.0.0-beta.c0d8594

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 (61) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +3 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +57 -61
  5. package/dist/components/organisms/base/Toaster.vue.js +6 -6
  6. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +6 -6
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  9. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  10. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  12. package/dist/composables/useStripo.js +40 -40
  13. package/dist/config/migrator/index.js +9 -8
  14. package/dist/config/migrator/itemsBlockMigrator.js +283 -0
  15. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  16. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  17. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  18. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  19. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  20. package/dist/extensions/Blocks/Items/block.js +39 -40
  21. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  22. package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
  23. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  24. package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
  25. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
  26. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
  27. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
  28. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
  29. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +145 -136
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
  32. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
  33. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
  34. package/dist/extensions/Blocks/Items/settingsPanel.js +4 -4
  35. package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
  36. package/dist/extensions/Blocks/Items/template.js +312 -125
  37. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
  38. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +17 -44
  39. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  40. package/dist/extensions/Blocks/common-control.js +64 -53
  41. package/dist/extensions/Blocks/controlFactories.js +139 -118
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +370 -286
  44. package/dist/package.json.js +1 -1
  45. package/dist/services/stripoApi.js +6 -10
  46. package/dist/src/@types/config/schemas.d.ts +4 -0
  47. package/dist/src/composables/useConfig.d.ts +2 -0
  48. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  49. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  50. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  51. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  53. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  54. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  56. package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
  57. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
  58. package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
  59. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  60. package/dist/src/stores/config.d.ts +17 -0
  61. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- const o = { stripo: { version: "2.47.0" } }, s = {
1
+ const o = { stripo: { version: "2.52.0" } }, s = {
2
2
  guido: o
3
3
  };
4
4
  export {
@@ -1,8 +1,8 @@
1
1
  import { useHttp as m } from "../composables/useHttp.js";
2
- import { useToaster as u } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as i } from "../enums/defaults.js";
2
+ import { useToaster as i } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
4
4
  const y = () => {
5
- const { get: r } = m(), { handleError: o } = u();
5
+ const { get: r } = m(), { handleError: o } = i();
6
6
  return {
7
7
  getToken: async () => {
8
8
  try {
@@ -26,17 +26,13 @@ const y = () => {
26
26
  getDefaultTemplate: async () => {
27
27
  const t = {
28
28
  html: "",
29
- css: "",
30
- forceRecreate: !0
29
+ css: ""
31
30
  };
32
31
  try {
33
- const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= i ? s : 0, { data: n } = await r(
32
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
34
33
  `/stripo/default-template/${l}`
35
34
  ), a = typeof n == "string" ? JSON.parse(n) : n;
36
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : {
37
- ...a,
38
- forceRecreate: !0
39
- };
35
+ return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
40
36
  } catch (e) {
41
37
  return o(e, "Failed to fetch default template"), t;
42
38
  }
@@ -90,6 +90,8 @@ export declare const TemplateSchema: v.ObjectSchema<{
90
90
  }, undefined>, undefined>, readonly []>;
91
91
  /** Selected unsubscribe page IDs */
92
92
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
93
+ /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
94
+ readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
93
95
  }, undefined>;
94
96
  /**
95
97
  * Email header configuration (sender name and subject)
@@ -400,6 +402,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
400
402
  }, undefined>, undefined>, readonly []>;
401
403
  /** Selected unsubscribe page IDs */
402
404
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
405
+ /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
406
+ readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
403
407
  }, undefined>, {}>;
404
408
  /** Editor settings */
405
409
  readonly editor: v.OptionalSchema<v.ObjectSchema<{
@@ -31,6 +31,7 @@ export declare const useConfig: () => {
31
31
  } | undefined;
32
32
  }[];
33
33
  selectedUnsubscribePages: number[];
34
+ forceRecreate: boolean;
34
35
  };
35
36
  editor: {
36
37
  locale: string;
@@ -116,6 +117,7 @@ export declare const useConfig: () => {
116
117
  } | undefined;
117
118
  }[];
118
119
  selectedUnsubscribePages: number[];
120
+ forceRecreate: boolean;
119
121
  } | null>;
120
122
  editor: import("vue").ComputedRef<{
121
123
  locale: string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Migrates legacy ItemsBlock templates to v2 format
3
+ * @param html - HTML string containing legacy items blocks
4
+ * @returns Migrated HTML with replaced variables and cleaned conditionals
5
+ */
6
+ export declare function migrateItemsBlock(html: string): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Control IDs used in the CouponBlock Extension
3
+ * These IDs are returned by the getId() method of each control
4
+ */
5
+ export declare enum CouponControlId {
6
+ TEXT_ALIGN = "coupon-block-text-align-control",
7
+ TEXT_COLOR = "coupon-block-text-color-control",
8
+ TEXT_SIZE = "coupon-block-text-size-control",
9
+ TEXT_STYLE = "coupon-block-text-style-control",
10
+ TEXT_FONT_FAMILY = "coupon-block-text-font-family-control",
11
+ TEXT_BACKGROUND = "coupon-block-text-background-control",
12
+ TEXT_PADDINGS = "coupon-block-text-paddings-control",
13
+ TEXT_LINE_SPACING = "coupon-block-text-line-spacing-control"
14
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * CouponBlock Control Instances
3
+ *
4
+ * This file generates all control instances for the CouponBlock
5
+ * using the reusable factory functions from controlFactories.ts
6
+ *
7
+ * Note: Factory-generated controls use runtime class generation which TypeScript
8
+ * cannot fully type-check. The controls are type-safe at runtime.
9
+ *
10
+ * These controls apply directly to the selected root element (no targetBlockId/containerSelector)
11
+ * to ensure styles are applied correctly regardless of nested element structure.
12
+ */
13
+ export declare const TextAlignControl: {
14
+ new (): {
15
+ getId(): string;
16
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
17
+ getParentControlId(): string;
18
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
19
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
20
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
21
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
22
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
23
+ };
24
+ };
25
+ export declare const TextColorControl: {
26
+ new (): {
27
+ getId(): string;
28
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
29
+ getParentControlId(): string;
30
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
31
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
32
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
33
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
34
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
35
+ };
36
+ };
37
+ export declare const TextSizeControl: {
38
+ new (): {
39
+ getId(): string;
40
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
41
+ getParentControlId(): string;
42
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
43
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
44
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
45
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
46
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
47
+ };
48
+ };
49
+ export declare const TextStyleControl: {
50
+ new (): {
51
+ getId(): string;
52
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
53
+ getParentControlId(): string;
54
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
55
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
56
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
57
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
58
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
59
+ };
60
+ };
61
+ export declare const TextFontFamilyControl: {
62
+ new (): {
63
+ getId(): string;
64
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
65
+ getParentControlId(): string;
66
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
67
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
68
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
69
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
70
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
71
+ };
72
+ };
73
+ export declare const TextBackgroundControl: {
74
+ new (): {
75
+ getId(): string;
76
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
77
+ getParentControlId(): string;
78
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
79
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
80
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
81
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
82
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
83
+ };
84
+ };
85
+ export declare const TextPaddingsControl: {
86
+ new (): {
87
+ getId(): string;
88
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
89
+ getParentControlId(): string;
90
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
91
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
92
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
93
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
94
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
95
+ };
96
+ };
97
+ export declare const TextLineSpacingControl: {
98
+ new (): {
99
+ getId(): string;
100
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
101
+ getParentControlId(): string;
102
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
103
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
104
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
105
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
106
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
107
+ };
108
+ };
@@ -1,3 +1,3 @@
1
- declare const migrationTemplate = "\n <td \n class=\"coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block\" \n esd-extension-block-id=\"coupon-block\"\n >\n <p class=\"ins-title\" contenteditable=\"false\">{@COUPON_CODE}</p>\n </td>\n";
1
+ declare const migrationTemplate = "\n <td\n class=\"coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block\"\n esd-extension-block-id=\"coupon-block\"\n >\n <p class=\"ins-title\" contenteditable=\"false\">{@COUPON_CODE}</p>\n </td>\n";
2
2
  export declare function getDefaultTemplate(): string;
3
3
  export default migrationTemplate;
@@ -8,7 +8,5 @@ export declare class ButtonLinkControl extends CommonControl {
8
8
  getTemplate(): string;
9
9
  onRender(): void;
10
10
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
11
- _listenToFormUpdates(): void;
12
- _onLinkChange(value: string): void;
13
11
  _getLink(): string;
14
12
  }
@@ -8,7 +8,5 @@ export declare class ImageLinkControl extends CommonControl {
8
8
  getTemplate(): string;
9
9
  onRender(): void;
10
10
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
11
- _listenToFormUpdates(): void;
12
- _onLinkChange(value: string): void;
13
11
  _getLink(): string;
14
12
  }
@@ -9,7 +9,7 @@ export declare class PriceOrientationControl extends CommonControl {
9
9
  onRender(): void;
10
10
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
11
11
  _onPriceOrientationChange(value: string): void;
12
- private _updateHorizontalLayout;
13
12
  private _updateVerticalLayout;
13
+ private _updateHorizontalLayout;
14
14
  _getPriceOrientation(): string;
15
15
  }
@@ -31,10 +31,6 @@ export declare class ItemsBlockControl extends CommonControl {
31
31
  _updatePrice(price: string): void;
32
32
  _updateOriginalPrice(originalPrice: string): void;
33
33
  _updateQuantity(quantity: string): void;
34
- /**
35
- * @todo Optimize template reordering for performance.
36
- * @description Reorders the template structure based on current orientation and visibility settings.
37
- */
38
34
  _reOrderTemplate(): void;
39
35
  _updateDataTypeAttributes(itemsType: ProductType): void;
40
36
  _updateDataNumberAttributes(itemId: string): void;
@@ -1,6 +1,8 @@
1
+ import type { ItemsBlockConfig } from './utils/nodeConfigUtils';
1
2
  declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
2
3
  type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
3
4
  type OrientationType = 'vertical' | 'horizontal';
5
+ type PriceOrientationType = 'vertical' | 'horizontal';
4
6
  type TemplateParameters = {
5
7
  orientation: OrientationType;
6
8
  itemsType: ProductType;
@@ -8,6 +10,23 @@ type TemplateParameters = {
8
10
  currencySymbol?: string;
9
11
  currencyLocation?: string;
10
12
  formattedPrice?: boolean;
13
+ migrate?: boolean;
14
+ /** Legacy config format (data-* attributes from esd-config-block) */
15
+ configBlockAttributes?: Record<string, string>;
16
+ /** New config format (Stripo V2 nodeConfig from esd-ext-config) */
17
+ nodeConfig?: Partial<ItemsBlockConfig>;
18
+ /** Extracted styles from a[product-attr="name"] for migration */
19
+ nameStyles?: string;
20
+ /** Extracted styles from a.es-button for migration */
21
+ buttonStyles?: string;
22
+ /** Extracted styles from p[product-attr="price"] for migration */
23
+ priceStyles?: string;
24
+ /** Extracted styles from p[product-attr="originalPrice"] for migration */
25
+ originalPriceStyles?: string;
26
+ /** Extracted styles from p[product-attr="quantity"] for migration */
27
+ quantityStyles?: string;
28
+ /** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
29
+ priceOrientation?: PriceOrientationType;
11
30
  };
12
31
  /**
13
32
  * Generates the default template for the Items Block.
@@ -20,5 +39,5 @@ type TemplateParameters = {
20
39
  * @param params.formattedPrice - Whether to use formatted price display
21
40
  * @returns HTML template string for the Items Block
22
41
  */
23
- export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, formattedPrice, }: TemplateParameters): string;
42
+ export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, migrate, formattedPrice, configBlockAttributes, nodeConfig, nameStyles, buttonStyles, priceStyles, originalPriceStyles, quantityStyles, priceOrientation, }: TemplateParameters): string;
24
43
  export default migrationTemplate;
@@ -0,0 +1,71 @@
1
+ import { OrientationType, ProductType } from '@@/Types/extensions/items';
2
+ import { ImmutableHtmlNode, ImmutableHtmlElementNode, ControlApi, BlockApi } from '@stripoinc/ui-editor-extensions';
3
+ /**
4
+ * Typed configuration object for Items Block.
5
+ * Replaces the deprecated esd-config-block data-* attributes approach.
6
+ * Configuration is stored directly on the block node using Stripo V2's getNodeConfig/setNodeConfig API.
7
+ */
8
+ export interface ItemsBlockConfig {
9
+ initialized: boolean;
10
+ blockInstanceId: string;
11
+ source: ProductType;
12
+ type: ProductType;
13
+ itemsSelectValue: string;
14
+ orientation: OrientationType;
15
+ nameTrimming: boolean;
16
+ nameControlEnabled: boolean;
17
+ priceHideDiscount: boolean;
18
+ priceFormatted: boolean;
19
+ priceCurrencySymbol: string;
20
+ priceCurrencyLocation: string;
21
+ priceControlOpened: boolean;
22
+ priceOrientation: 'vertical' | 'horizontal';
23
+ quantityControlEnabled: boolean;
24
+ buttonLink: string;
25
+ imageLink: string;
26
+ buttonLabel: string;
27
+ imageVisible: boolean;
28
+ nameVisible: boolean;
29
+ quantityVisible: boolean;
30
+ priceVisible: boolean;
31
+ originalPriceVisible: boolean;
32
+ buttonVisible: boolean;
33
+ }
34
+ /**
35
+ * Generates a unique block instance ID.
36
+ */
37
+ export declare function generateBlockInstanceId(): string;
38
+ /**
39
+ * Returns default ItemsBlockConfig values.
40
+ * These are used when initializing a new block or when migrating from legacy format.
41
+ */
42
+ export declare function getDefaultItemsBlockConfig(): ItemsBlockConfig;
43
+ /**
44
+ * Gets the Items block container element from the current node.
45
+ * The container is identified by the `.items-block-v2` class (new) or `.esd-cart-items-block` (legacy).
46
+ * @param currentNode - The current node from the control (usually this.currentNode)
47
+ * @returns The container element or null if not found
48
+ */
49
+ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
50
+ /**
51
+ * Gets the node configuration from the Items block.
52
+ * Uses Stripo V2's getNodeConfig() API.
53
+ * Falls back to migrating from legacy esd-config-block if nodeConfig is empty.
54
+ * @param currentNode - The current node from the control
55
+ * @returns The ItemsBlockConfig object or null if not found
56
+ */
57
+ export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined): ItemsBlockConfig | null;
58
+ /**
59
+ * Sets the node configuration on the Items block.
60
+ * Uses Stripo V2's setNodeConfig() API.
61
+ * @param currentNode - The current node from the control
62
+ * @param api - The API object (ControlApi or BlockApi)
63
+ * @param config - The configuration to set (partial update supported)
64
+ */
65
+ export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
66
+ /**
67
+ * Gets the block instance ID from the node config.
68
+ * @param currentNode - The current node from the control
69
+ * @returns The block instance ID or null if not found
70
+ */
71
+ export declare function getBlockInstanceIdFromConfig(currentNode: ImmutableHtmlNode | undefined): string | null;
@@ -56,25 +56,30 @@ export declare abstract class CommonControl extends Control {
56
56
  onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
57
57
  onDestroy(): void;
58
58
  /**
59
- * Gets the config block element from the current node.
59
+ * Gets the Items block container element from the current node.
60
+ * @returns The container element or null if not found
61
+ */
62
+ protected getItemsBlockContainer(): ImmutableHtmlElementNode | null;
63
+ /**
64
+ * Gets the config block element from the current node (legacy support).
65
+ * @deprecated Use getNodeConfig() from nodeConfigUtils instead for Stripo V2
60
66
  * @returns The config block element or null if not found
61
67
  */
62
68
  protected getConfigBlock(): ImmutableHtmlElementNode | null;
63
69
  /**
64
- * Gets the current block instance ID from the config block.
65
- * @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
70
+ * Gets the current block instance ID from the node config (Stripo V2) or legacy config block.
66
71
  * @returns The block instance ID or null if not found
67
72
  */
68
- protected getBlockInstanceId(blockInstanceIdAttribute?: string): string | null;
73
+ protected getBlockInstanceId(): string | null;
69
74
  /**
70
75
  * Handles block instance change detection and syncing.
71
- * This is a helper method for controls that need to sync attributes when switching between block instances.
72
- * @param syncFunction - Function to call when block instance changes (to sync from attributes)
76
+ * This is a helper method for controls that need to sync config when switching between block instances.
77
+ * Uses Stripo V2 nodeConfig API for block instance tracking.
78
+ * @param syncFunction - Function to call when block instance changes (to sync from node config)
73
79
  * @param updateUI - Function to call to update the UI (called both on change and when same block)
74
- * @param blockInstanceIdAttribute - The attribute name for block instance ID (default: 'data-block-instance-id')
75
80
  * @returns true if block instance changed, false otherwise
76
81
  */
77
- protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void, blockInstanceIdAttribute?: string): boolean;
82
+ protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void): boolean;
78
83
  _GuLabel({ text, name, position }: LabelProps): string;
79
84
  _GuToggle(name: string): string;
80
85
  _GuSelectItem({ text, value }: {
@@ -12,8 +12,9 @@
12
12
  import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
13
13
  /**
14
14
  * Factory function to create text align controls for different block elements
15
+ * When targetBlockId and containerSelector are not provided, applies directly to root
15
16
  */
16
- export declare function createTextAlignControl(controlId: string, targetBlockId: string, containerSelector: string): {
17
+ export declare function createTextAlignControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
17
18
  new (): {
18
19
  getId(): string;
19
20
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -27,8 +28,9 @@ export declare function createTextAlignControl(controlId: string, targetBlockId:
27
28
  };
28
29
  /**
29
30
  * Factory function to create text color controls for different block elements
31
+ * When targetBlockId and containerSelector are not provided, applies directly to root
30
32
  */
31
- export declare function createTextColorControl(controlId: string, targetBlockId: string, containerSelector?: string): {
33
+ export declare function createTextColorControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
32
34
  new (): {
33
35
  getId(): string;
34
36
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -42,8 +44,9 @@ export declare function createTextColorControl(controlId: string, targetBlockId:
42
44
  };
43
45
  /**
44
46
  * Factory function to create text size controls for different block elements
47
+ * When targetBlockId and containerSelector are not provided, applies directly to root
45
48
  */
46
- export declare function createTextSizeControl(controlId: string, targetBlockId: string, containerSelector?: string): {
49
+ export declare function createTextSizeControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
47
50
  new (): {
48
51
  getId(): string;
49
52
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -57,8 +60,9 @@ export declare function createTextSizeControl(controlId: string, targetBlockId:
57
60
  };
58
61
  /**
59
62
  * Factory function to create text style controls for different block elements
63
+ * When targetBlockId and containerSelector are not provided, applies directly to root
60
64
  */
61
- export declare function createTextStyleControl(controlId: string, targetBlockId: string, containerSelector?: string): {
65
+ export declare function createTextStyleControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
62
66
  new (): {
63
67
  getId(): string;
64
68
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -72,8 +76,9 @@ export declare function createTextStyleControl(controlId: string, targetBlockId:
72
76
  };
73
77
  /**
74
78
  * Factory function to create text font family controls for different block elements
79
+ * When targetBlockId and containerSelector are not provided, applies directly to root
75
80
  */
76
- export declare function createTextFontFamilyControl(controlId: string, targetBlockId: string, containerSelector?: string): {
81
+ export declare function createTextFontFamilyControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
77
82
  new (): {
78
83
  getId(): string;
79
84
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -87,8 +92,9 @@ export declare function createTextFontFamilyControl(controlId: string, targetBlo
87
92
  };
88
93
  /**
89
94
  * Factory function to create text background color controls for different block elements
95
+ * When targetBlockId and containerSelector are not provided, applies directly to root
90
96
  */
91
- export declare function createTextBackgroundColorControl(controlId: string, targetBlockId: string, containerSelector?: string): {
97
+ export declare function createTextBackgroundColorControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
92
98
  new (): {
93
99
  getId(): string;
94
100
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -102,8 +108,25 @@ export declare function createTextBackgroundColorControl(controlId: string, targ
102
108
  };
103
109
  /**
104
110
  * Factory function to create paddings controls for different block elements
111
+ * When targetBlockId and containerSelector are not provided, applies directly to root
105
112
  */
106
- export declare function createPaddingsControl(controlId: string, targetBlockId: string, containerSelector?: string): {
113
+ export declare function createPaddingsControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
114
+ new (): {
115
+ getId(): string;
116
+ getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
117
+ getParentControlId(): string;
118
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
119
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
120
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
121
+ getAdditionalModifications(_root: ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
122
+ isVisible(_node: ImmutableHtmlNode): boolean;
123
+ };
124
+ };
125
+ /**
126
+ * Factory function to create text line spacing controls for different block elements
127
+ * When targetBlockId and containerSelector are not provided, applies directly to root
128
+ */
129
+ export declare function createTextLineSpacingControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
107
130
  new (): {
108
131
  getId(): string;
109
132
  getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
@@ -36,6 +36,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
36
36
  } | undefined;
37
37
  }[];
38
38
  selectedUnsubscribePages: number[];
39
+ forceRecreate: boolean;
39
40
  };
40
41
  editor: {
41
42
  locale: string;
@@ -127,6 +128,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
127
128
  } | undefined;
128
129
  }[];
129
130
  selectedUnsubscribePages: number[];
131
+ forceRecreate: boolean;
130
132
  };
131
133
  editor: {
132
134
  locale: string;
@@ -218,6 +220,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
218
220
  } | undefined;
219
221
  }[];
220
222
  selectedUnsubscribePages: number[];
223
+ forceRecreate: boolean;
221
224
  };
222
225
  editor: {
223
226
  locale: string;
@@ -309,6 +312,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
309
312
  } | undefined;
310
313
  }[];
311
314
  selectedUnsubscribePages: number[];
315
+ forceRecreate: boolean;
312
316
  };
313
317
  editor: {
314
318
  locale: string;
@@ -400,6 +404,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
400
404
  } | undefined;
401
405
  }[];
402
406
  selectedUnsubscribePages: number[];
407
+ forceRecreate: boolean;
403
408
  };
404
409
  editor: {
405
410
  locale: string;
@@ -491,6 +496,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
491
496
  } | undefined;
492
497
  }[];
493
498
  selectedUnsubscribePages: number[];
499
+ forceRecreate: boolean;
494
500
  };
495
501
  editor: {
496
502
  locale: string;
@@ -582,6 +588,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
582
588
  } | undefined;
583
589
  }[];
584
590
  selectedUnsubscribePages: number[];
591
+ forceRecreate: boolean;
585
592
  };
586
593
  editor: {
587
594
  locale: string;
@@ -673,6 +680,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
673
680
  } | undefined;
674
681
  }[];
675
682
  selectedUnsubscribePages: number[];
683
+ forceRecreate: boolean;
676
684
  };
677
685
  editor: {
678
686
  locale: string;
@@ -764,6 +772,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
764
772
  } | undefined;
765
773
  }[];
766
774
  selectedUnsubscribePages: number[];
775
+ forceRecreate: boolean;
767
776
  };
768
777
  editor: {
769
778
  locale: string;
@@ -855,6 +864,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
855
864
  } | undefined;
856
865
  }[];
857
866
  selectedUnsubscribePages: number[];
867
+ forceRecreate: boolean;
858
868
  };
859
869
  editor: {
860
870
  locale: string;
@@ -946,6 +956,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
946
956
  } | undefined;
947
957
  }[];
948
958
  selectedUnsubscribePages: number[];
959
+ forceRecreate: boolean;
949
960
  };
950
961
  editor: {
951
962
  locale: string;
@@ -1037,6 +1048,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1037
1048
  } | undefined;
1038
1049
  }[];
1039
1050
  selectedUnsubscribePages: number[];
1051
+ forceRecreate: boolean;
1040
1052
  };
1041
1053
  editor: {
1042
1054
  locale: string;
@@ -1128,6 +1140,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1128
1140
  } | undefined;
1129
1141
  }[];
1130
1142
  selectedUnsubscribePages: number[];
1143
+ forceRecreate: boolean;
1131
1144
  };
1132
1145
  editor: {
1133
1146
  locale: string;
@@ -1219,6 +1232,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1219
1232
  } | undefined;
1220
1233
  }[];
1221
1234
  selectedUnsubscribePages: number[];
1235
+ forceRecreate: boolean;
1222
1236
  };
1223
1237
  editor: {
1224
1238
  locale: string;
@@ -1310,6 +1324,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1310
1324
  } | undefined;
1311
1325
  }[];
1312
1326
  selectedUnsubscribePages: number[];
1327
+ forceRecreate: boolean;
1313
1328
  };
1314
1329
  editor: {
1315
1330
  locale: string;
@@ -1401,6 +1416,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1401
1416
  } | undefined;
1402
1417
  }[];
1403
1418
  selectedUnsubscribePages: number[];
1419
+ forceRecreate: boolean;
1404
1420
  };
1405
1421
  editor: {
1406
1422
  locale: string;
@@ -1492,6 +1508,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1492
1508
  } | undefined;
1493
1509
  }[];
1494
1510
  selectedUnsubscribePages: number[];
1511
+ forceRecreate: boolean;
1495
1512
  };
1496
1513
  editor: {
1497
1514
  locale: string;