@useinsider/guido 2.0.0-beta.0ebba08 → 2.0.0-beta.11fdcf2

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 (58) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  2. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  3. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  4. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  5. package/dist/config/migrator/index.js +9 -8
  6. package/dist/config/migrator/itemsBlockMigrator.js +334 -0
  7. package/dist/extensions/Blocks/Items/block.js +36 -40
  8. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  9. package/dist/extensions/Blocks/Items/controls/cardComposition.js +66 -46
  10. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  11. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  12. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  13. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  14. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
  15. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  16. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  17. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  18. package/dist/extensions/Blocks/Items/controls/settingsControl.js +152 -143
  19. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  20. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  21. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -5
  22. package/dist/extensions/Blocks/Items/extension.js +11 -9
  23. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
  24. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
  25. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  26. package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
  27. package/dist/extensions/Blocks/Items/template.js +387 -140
  28. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +174 -0
  29. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  30. package/dist/extensions/Blocks/common-control.js +26 -27
  31. package/dist/extensions/Blocks/controlFactories.js +55 -45
  32. package/dist/guido.css +1 -1
  33. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -285
  34. package/dist/package.json.js +1 -1
  35. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  36. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  37. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  38. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  39. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  40. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  41. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  42. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  43. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  44. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -2
  45. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  46. package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
  47. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
  48. package/dist/src/extensions/Blocks/common-control.d.ts +9 -10
  49. package/dist/utils/pairProductVariables.js +61 -58
  50. package/package.json +3 -3
  51. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  52. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  53. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  54. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  55. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  56. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  57. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  58. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
@@ -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 {
@@ -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;
@@ -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
  }
@@ -29,5 +29,14 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
29
29
  _onProductQuantityChange(value: boolean): void;
30
30
  _onProductPriceChange(value: boolean): void;
31
31
  _onProductOriginalPriceChange(value: boolean): void;
32
+ /**
33
+ * Updates both price cell widths in vertical layout based on priceOrientation and visibility.
34
+ * - When priceOrientation is 'vertical': both cells are 100% (stacked layout)
35
+ * - When priceOrientation is 'horizontal':
36
+ * - When original price is hidden, price cell expands to 100%
37
+ * - When price is hidden, original price cell expands to 100%
38
+ * - When both are visible, they share 50% each
39
+ */
40
+ _updatePriceCellWidthsForVerticalLayout(): void;
32
41
  _onProductButtonChange(value: boolean): void;
33
42
  }
@@ -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
  }
@@ -0,0 +1,18 @@
1
+ import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
+ import { CommonControl } from '../../../common-control';
3
+ import { ItemsBlockControlId } from '../../enums/controlEnums';
4
+ export declare const CONTROL_BLOCK_ID = ItemsBlockControlId.PRICE_SINGLE_PRICE;
5
+ export declare class PriceSinglePriceControl extends CommonControl {
6
+ private store;
7
+ getId(): string;
8
+ getTemplate(): string;
9
+ onRender(): void;
10
+ onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
11
+ /**
12
+ * Syncs single price state from nodeConfig.
13
+ */
14
+ private _syncSinglePriceFromNodeConfig;
15
+ _onSinglePriceChange(value: boolean): void;
16
+ private _updatePriceBlock;
17
+ _getSinglePrice(): string;
18
+ }
@@ -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;
@@ -42,6 +42,7 @@ export declare enum ItemsBlockControlId {
42
42
  PRICE_PADDINGS = "items-block-price-paddings-control",
43
43
  PRICE_HIDE_DISCOUNT = "items-block-price-hide-discount-control",
44
44
  PRICE_FORMATTED_PRICE = "items-block-price-formatted-price-control",
45
+ PRICE_SINGLE_PRICE = "items-block-price-single-price-control",
45
46
  PRICE_CURRENCY_SYMBOL = "items-block-price-currency-symbol-control",
46
47
  PRICE_CURRENCY_LOCATION = "items-block-price-currency-location-control",
47
48
  PRICE_ORIENTATION = "items-block-price-orientation-control",
@@ -1,30 +1,4 @@
1
1
  export declare const templateFirstLine = "<td align=\"center\" class=\"ins-product-td items-block items-block-v2\">";
2
- export declare const configAttributes: {
3
- TYPE: string;
4
- ITEMS_INDEX_SELECT_CONTROL_VALUE: string;
5
- ORIENTATION: string;
6
- PRODUCT_NAME_TRIMMING: string;
7
- PRODUCT_PRICE_HIDE_DISCOUNT: string;
8
- PRODUCT_PRICE_FORMATTED: string;
9
- PRODUCT_PRICE_CURRENCY_SYMBOL: string;
10
- PRODUCT_PRICE_CURRENCY_LOCATION: string;
11
- PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION: string;
12
- PRODUCT_BUTTON_LINK: string;
13
- PRODUCT_IMAGE_LINK: string;
14
- PRODUCT_NAME_CONTROL_VALUE: string;
15
- PRODUCT_QUANTITY_CONTROL_VALUE: string;
16
- PRODUCT_PRICE_CONTROL_VALUE: string;
17
- BLOCK_INSTANCE_ID: string;
18
- NAME_CONTROL_ENABLED: string;
19
- QUANTITY_CONTROL_ENABLED: string;
20
- PRICE_CONTROL_OPENED: string;
21
- PRODUCT_IMAGE_VISIBLE: string;
22
- PRODUCT_NAME_VISIBLE: string;
23
- PRODUCT_QUANTITY_VISIBLE: string;
24
- PRODUCT_PRICE_VISIBLE: string;
25
- PRODUCT_ORIGINAL_PRICE_VISIBLE: string;
26
- PRODUCT_BUTTON_VISIBLE: string;
27
- };
28
2
  export declare const productPairs: {
29
3
  PAIRS_FOR_EXTENSION: {
30
4
  imageSrc: {
@@ -79,25 +53,37 @@ export declare const productPairs: {
79
53
  CART_ITEMS: {
80
54
  PRICE: string;
81
55
  PRICE_FORMATTED: string;
56
+ SINGLE_PRICE: string;
57
+ SINGLE_PRICE_FORMATTED: string;
82
58
  CURRENCY: string;
83
59
  DEFAULT_PRICE: string;
84
60
  DEFAULT_PRICE_FORMATTED: string;
61
+ DEFAULT_SINGLE_PRICE: string;
62
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
85
63
  DEFAULT_CURRENCY: string;
86
64
  };
87
65
  BROWSED_ITEMS: {
88
66
  PRICE: string;
89
67
  PRICE_FORMATTED: string;
68
+ SINGLE_PRICE: string;
69
+ SINGLE_PRICE_FORMATTED: string;
90
70
  CURRENCY: string;
91
71
  DEFAULT_PRICE: string;
92
72
  DEFAULT_PRICE_FORMATTED: string;
73
+ DEFAULT_SINGLE_PRICE: string;
74
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
93
75
  DEFAULT_CURRENCY: string;
94
76
  };
95
77
  PURCHASED_ITEMS: {
96
78
  PRICE: string;
97
79
  PRICE_FORMATTED: string;
80
+ SINGLE_PRICE: string;
81
+ SINGLE_PRICE_FORMATTED: string;
98
82
  CURRENCY: string;
99
83
  DEFAULT_PRICE: string;
100
84
  DEFAULT_PRICE_FORMATTED: string;
85
+ DEFAULT_SINGLE_PRICE: string;
86
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
101
87
  DEFAULT_CURRENCY: string;
102
88
  };
103
89
  };
@@ -105,25 +91,37 @@ export declare const productPairs: {
105
91
  CART_ITEMS: {
106
92
  PRICE: string;
107
93
  PRICE_FORMATTED: string;
94
+ SINGLE_PRICE: string;
95
+ SINGLE_PRICE_FORMATTED: string;
108
96
  CURRENCY: string;
109
97
  DEFAULT_PRICE: string;
110
98
  DEFAULT_PRICE_FORMATTED: string;
99
+ DEFAULT_SINGLE_PRICE: string;
100
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
111
101
  DEFAULT_CURRENCY: string;
112
102
  };
113
103
  BROWSED_ITEMS: {
114
104
  PRICE: string;
115
105
  PRICE_FORMATTED: string;
106
+ SINGLE_PRICE: string;
107
+ SINGLE_PRICE_FORMATTED: string;
116
108
  CURRENCY: string;
117
109
  DEFAULT_PRICE: string;
118
110
  DEFAULT_PRICE_FORMATTED: string;
111
+ DEFAULT_SINGLE_PRICE: string;
112
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
119
113
  DEFAULT_CURRENCY: string;
120
114
  };
121
115
  PURCHASED_ITEMS: {
122
116
  PRICE: string;
123
117
  PRICE_FORMATTED: string;
118
+ SINGLE_PRICE: string;
119
+ SINGLE_PRICE_FORMATTED: string;
124
120
  CURRENCY: string;
125
121
  DEFAULT_PRICE: string;
126
122
  DEFAULT_PRICE_FORMATTED: string;
123
+ DEFAULT_SINGLE_PRICE: string;
124
+ DEFAULT_SINGLE_PRICE_FORMATTED: string;
127
125
  DEFAULT_CURRENCY: string;
128
126
  };
129
127
  };
@@ -29,11 +29,9 @@ export declare const DefaultConfigValues: {
29
29
  productPriceCurrencyLocationControlValue: string;
30
30
  productButtonLinkControlValue: string;
31
31
  productImageLinkControlValue: string;
32
- productNameControlEnabled: string;
33
32
  productQuantityControlOpened: string;
34
33
  productNameControlTrim: string;
35
34
  productQuantityControlEnabled: string;
36
- productPriceControlOpened: string;
37
35
  productImageVisible: string;
38
36
  productNameVisible: string;
39
37
  productQuantityVisible: string;
@@ -41,6 +39,7 @@ export declare const DefaultConfigValues: {
41
39
  productOriginalPriceVisible: string;
42
40
  productButtonVisible: string;
43
41
  productImageWidth: string;
42
+ productImageHeight: string;
44
43
  };
45
44
  export declare const ItemInCartOptions: {
46
45
  [x: string]: {
@@ -10,6 +10,7 @@ interface ItemsBlockState {
10
10
  currencySymbol: string;
11
11
  currencyLocation: string;
12
12
  formattedPrice: boolean;
13
+ singlePrice: boolean;
13
14
  priceOrientation: 'vertical' | 'horizontal';
14
15
  templateData: {
15
16
  imageSrc: string;
@@ -31,6 +32,7 @@ export declare const useItemsBlockStore: import("pinia").StoreDefinition<"guidoI
31
32
  setCurrencySymbol(currencySymbol: string): void;
32
33
  setCurrencyLocation(currencyLocation: string): void;
33
34
  setFormattedPrice(formattedPrice: boolean): void;
35
+ setSinglePrice(singlePrice: boolean): void;
34
36
  setPriceOrientation(priceOrientation: "vertical" | "horizontal"): void;
35
37
  setTemplateData(templateData: ItemsBlockState["templateData"]): void;
36
38
  updateFromAttributes(attributes: {
@@ -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,25 @@ type TemplateParameters = {
8
10
  currencySymbol?: string;
9
11
  currencyLocation?: string;
10
12
  formattedPrice?: boolean;
13
+ /** Whether to show single product price (price divided by quantity) */
14
+ singlePrice?: boolean;
15
+ migrate?: boolean;
16
+ /** Legacy config format (data-* attributes for migration) */
17
+ configBlockAttributes?: Record<string, string>;
18
+ /** New config format (Stripo V2 nodeConfig from esd-ext-config) */
19
+ nodeConfig?: Partial<ItemsBlockConfig>;
20
+ /** Extracted styles from a[product-attr="name"] for migration */
21
+ nameStyles?: string;
22
+ /** Extracted styles from a.es-button for migration */
23
+ buttonStyles?: string;
24
+ /** Extracted styles from p[product-attr="price"] for migration */
25
+ priceStyles?: string;
26
+ /** Extracted styles from p[product-attr="originalPrice"] for migration */
27
+ originalPriceStyles?: string;
28
+ /** Extracted styles from p[product-attr="quantity"] for migration */
29
+ quantityStyles?: string;
30
+ /** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
31
+ priceOrientation?: PriceOrientationType;
11
32
  };
12
33
  /**
13
34
  * Generates the default template for the Items Block.
@@ -20,5 +41,5 @@ type TemplateParameters = {
20
41
  * @param params.formattedPrice - Whether to use formatted price display
21
42
  * @returns HTML template string for the Items Block
22
43
  */
23
- export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, formattedPrice, }: TemplateParameters): string;
44
+ export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, migrate, formattedPrice, configBlockAttributes, nodeConfig, nameStyles, buttonStyles, priceStyles, originalPriceStyles, quantityStyles, priceOrientation, }: TemplateParameters): string;
24
45
  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
+ * Configuration is stored directly on the block node using Stripo V2's getNodeConfig/setNodeConfig API.
6
+ */
7
+ export interface ItemsBlockConfig {
8
+ initialized: boolean;
9
+ blockInstanceId: string;
10
+ source: ProductType;
11
+ type: ProductType;
12
+ itemsSelectValue: string;
13
+ orientation: OrientationType;
14
+ nameTrimming: boolean;
15
+ priceHideDiscount: boolean;
16
+ priceFormatted: boolean;
17
+ priceSinglePrice: boolean;
18
+ priceCurrencySymbol: string;
19
+ priceCurrencyLocation: string;
20
+ priceOrientation: 'vertical' | 'horizontal';
21
+ quantityControlEnabled: boolean;
22
+ buttonLink: string;
23
+ imageLink: string;
24
+ buttonLabel: string;
25
+ /** Whether button should be full width (true = es-fw class) or inline (false = es-il class) */
26
+ buttonFullWidth: boolean;
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 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,24 @@ 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.
60
- * @returns The config block element or null if not found
59
+ * Gets the Items block container element from the current node.
60
+ * @returns The container element or null if not found
61
61
  */
62
- protected getConfigBlock(): ImmutableHtmlElementNode | null;
62
+ protected getItemsBlockContainer(): ImmutableHtmlElementNode | null;
63
63
  /**
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')
64
+ * Gets the current block instance ID from the node config (Stripo V2).
66
65
  * @returns The block instance ID or null if not found
67
66
  */
68
- protected getBlockInstanceId(blockInstanceIdAttribute?: string): string | null;
67
+ protected getBlockInstanceId(): string | null;
69
68
  /**
70
69
  * 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)
70
+ * This is a helper method for controls that need to sync config when switching between block instances.
71
+ * Uses Stripo V2 nodeConfig API for block instance tracking.
72
+ * @param syncFunction - Function to call when block instance changes (to sync from node config)
73
73
  * @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
74
  * @returns true if block instance changed, false otherwise
76
75
  */
77
- protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void, blockInstanceIdAttribute?: string): boolean;
76
+ protected handleBlockInstanceChange(syncFunction: (node: ImmutableHtmlNode) => void, updateUI: () => void): boolean;
78
77
  _GuLabel({ text, name }: LabelProps): string;
79
78
  _GuToggle(name: string): string;
80
79
  _GuSelectItem({ text, value }: {
@@ -1,74 +1,77 @@
1
1
  import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function M(H) {
3
- const m = H.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), C = w.PAIRS_FOR_EXTENSION;
4
- Object.entries(C).forEach(([n, d]) => {
2
+ function P(k) {
3
+ const m = k.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), R = w.PAIRS_FOR_EXTENSION;
4
+ Object.entries(R).forEach(([n, l]) => {
5
5
  $.querySelectorAll(".ins-product-td").forEach((o) => {
6
- const h = o.getAttribute("data-number") || "1", _ = o.getAttribute("data-type") || "CART_ITEMS";
6
+ const E = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
7
  o.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
8
  var y;
9
- const b = e.getAttribute("data-type") || _, u = e.getAttribute("data-number") || h, p = d[b];
9
+ const T = e.getAttribute("data-type") || b, u = e.getAttribute("data-number") || E, p = l[T];
10
10
  if (p)
11
11
  switch (n) {
12
12
  case "imageSrc": {
13
- let t = null, i = null;
14
- if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
13
+ let t = null, c = null;
14
+ if (e.tagName === "IMG" ? (t = e, c = t.closest("a")) : (t = e.querySelector("img"), c = e.querySelector("a") || e.closest("a")), !t)
15
15
  break;
16
- const c = p.DEFAULT, a = p.ATTR;
17
- if (c && t.src) {
16
+ const i = p.DEFAULT, a = p.ATTR;
17
+ if (i && t.src) {
18
18
  const r = t.src;
19
- c.some((l) => {
20
- const s = l.split("/").pop() || "", F = r.split("/").pop() || "";
21
- return r.includes(l) || r.includes(s) || F === s;
19
+ i.some((d) => {
20
+ const s = d.split("/").pop() || "", _ = r.split("/").pop() || "";
21
+ return r.includes(d) || r.includes(s) || _ === s;
22
22
  }) && (t.src = `{{${a}_${u}}}`);
23
23
  }
24
- if (i) {
25
- const r = (y = C.itemLink) == null ? void 0 : y[b];
24
+ if (c) {
25
+ const r = (y = R.itemLink) == null ? void 0 : y[T];
26
26
  if (r) {
27
- const f = r.HREF, l = r.DEFAULT_HREF || "#!", s = i.href;
28
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(l) || s === `${window.location.href}${l}` || !s || s === window.location.href) && (i.href = `{{${f}_${u}}}`);
27
+ const f = r.HREF, d = r.DEFAULT_HREF || "#!", s = c.href;
28
+ (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(d) || s === `${window.location.href}${d}` || !s || s === window.location.href) && (c.href = `{{${f}_${u}}}`);
29
29
  }
30
30
  }
31
31
  break;
32
32
  }
33
33
  case "name": {
34
- const t = p, i = t.ATTR, c = t.DEFAULT_HREF || "#!", a = t.HREF;
35
- e.textContent && (e.textContent = `{{${i}_${u}}}`);
34
+ const t = p, c = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
+ e.textContent && (e.textContent = `{{${c}_${u}}}`);
36
36
  const r = e.closest("a") || (e.tagName === "A" ? e : null);
37
37
  if (r && a) {
38
- const f = r.href, l = `${window.location.href}${c}`;
39
- (f === l || f.endsWith(c)) && (r.href = `{{${a}_${u}}}`);
38
+ const f = r.href, d = `${window.location.href}${i}`;
39
+ (f === d || f.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
40
40
  }
41
41
  break;
42
42
  }
43
43
  case "price":
44
44
  case "originalPrice": {
45
- const t = p, c = e.getAttribute("data-formated") === "true", a = e.getAttribute("data-curency") || "before", r = c ? t.PRICE_FORMATTED : t.PRICE, f = t.CURRENCY;
46
- let l = `{{${r}_${u}}}`;
47
- if (f) {
48
- const s = `{{${f}_${u}}}`;
49
- l = a === "after" ? `${l} ${s}` : `${s} ${l}`;
45
+ const t = p, c = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = c === "true", r = i === "true", f = e.getAttribute("data-curency") || "before";
46
+ let d;
47
+ r ? d = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : d = a ? t.PRICE_FORMATTED : t.PRICE;
48
+ const s = t.CURRENCY;
49
+ let _ = `{{${d}_${u}}}`;
50
+ if (s) {
51
+ const H = `{{${s}_${u}}}`;
52
+ _ = f === "after" ? `${_} ${H}` : `${H} ${_}`;
50
53
  }
51
- e.textContent = l;
54
+ e.textContent = _;
52
55
  break;
53
56
  }
54
57
  case "quantity": {
55
- const t = p, i = t.ATTR, c = t.DEFAULT;
56
- e.textContent && e.textContent.trim() === c && (e.textContent = `{{${i}_${u}}}`);
58
+ const t = p, c = t.ATTR, i = t.DEFAULT;
59
+ e.textContent && e.textContent.trim() === i && (e.textContent = `{{${c}_${u}}}`);
57
60
  break;
58
61
  }
59
62
  case "button": {
60
- const t = p, i = t.HREF, c = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
63
+ const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
61
64
  if (a) {
62
- const r = a.href || "", f = `${window.location.href}${c}`;
63
- (r === "" || r === "#" || r === f || r.endsWith(c) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${i}_${u}}}`);
65
+ const r = a.href || "", f = `${window.location.href}${i}`;
66
+ (r === "" || r === "#" || r === f || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${c}_${u}}}`);
64
67
  }
65
68
  break;
66
69
  }
67
70
  case "itemLink": {
68
- const t = p, i = t.HREF, c = t.DEFAULT_HREF || "#!", a = e;
71
+ const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
69
72
  if (a.href) {
70
- const r = a.href, f = `${window.location.href}${c}`;
71
- (r === f || r.endsWith(c)) && (a.href = `{{${i}_${u}}}`);
73
+ const r = a.href, f = `${window.location.href}${i}`;
74
+ (r === f || r.endsWith(i)) && (a.href = `{{${c}_${u}}}`);
72
75
  }
73
76
  break;
74
77
  }
@@ -83,21 +86,21 @@ function M(H) {
83
86
  });
84
87
  });
85
88
  });
86
- const S = $.querySelectorAll(".ins-product-td"), R = [];
87
- S.forEach((n) => {
88
- const d = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), h = n.outerHTML;
89
- R.push({
89
+ const F = $.querySelectorAll(".ins-product-td"), S = [];
90
+ F.forEach((n) => {
91
+ const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), E = n.outerHTML;
92
+ S.push({
90
93
  element: n,
91
- outerHtml: h,
92
- type: d,
94
+ outerHtml: E,
95
+ type: l,
93
96
  number: A,
94
97
  nodup: o || void 0
95
98
  });
96
99
  });
97
- let E = $.body.innerHTML;
98
- R.reverse().forEach(({ outerHtml: n, type: d, number: A }) => {
100
+ let h = $.body.innerHTML;
101
+ S.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
99
102
  let o = "";
100
- switch (d) {
103
+ switch (l) {
101
104
  case "CART_ITEMS":
102
105
  o = "ins_apr_total_product_kind";
103
106
  break;
@@ -109,28 +112,28 @@ function M(H) {
109
112
  break;
110
113
  }
111
114
  if (o) {
112
- const _ = parseInt(A) - 1, b = `${`{% if ${o} > ${_} %}`}${n}{% endif %}`;
113
- E = E.replace(n, b);
115
+ const b = parseInt(A) - 1, T = `${`{% if ${o} > ${b} %}`}${n}{% endif %}`;
116
+ h = h.replace(n, T);
114
117
  }
115
118
  });
116
- const k = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), T = [];
117
- return k.forEach((n) => {
118
- const d = n.getAttribute("data-number"), A = n.getAttribute("data-type");
119
- if (!d || A !== "CART_ITEMS")
119
+ const I = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
120
+ return I.forEach((n) => {
121
+ const l = n.getAttribute("data-number"), A = n.getAttribute("data-type");
122
+ if (!l || A !== "CART_ITEMS")
120
123
  return;
121
124
  const o = n.closest(".product-original-price-class");
122
125
  if (o) {
123
- const h = o.outerHTML;
124
- T.some((g) => g.tdOuterHtml === h) || T.push({ tdOuterHtml: h, number: d });
126
+ const E = o.outerHTML;
127
+ g.some((C) => C.tdOuterHtml === E) || g.push({ tdOuterHtml: E, number: l });
125
128
  }
126
- }), T.reverse().forEach(({ tdOuterHtml: n, number: d }) => {
127
- const A = `{% if ins_apr_price_${d} != ins_apr_originalprice_${d} %}`;
128
- if (!E.includes(A) && !n.includes("{% if")) {
129
- const h = `${A}${n}{% endif %}`;
130
- E = E.replace(n, h);
129
+ }), g.reverse().forEach(({ tdOuterHtml: n, number: l }) => {
130
+ const A = `{% if ins_apr_price_${l} != ins_apr_originalprice_${l} %}`;
131
+ if (!h.includes(A) && !n.includes("{% if")) {
132
+ const E = `${A}${n}{% endif %}`;
133
+ h = h.replace(n, E);
131
134
  }
132
- }), E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
135
+ }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
133
136
  }
134
137
  export {
135
- M as pairProductVariables
138
+ P as pairProductVariables
136
139
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.0.0-beta.0ebba08",
3
+ "version": "2.0.0-beta.11fdcf2",
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",
@@ -31,7 +31,7 @@
31
31
  "author": "",
32
32
  "license": "ISC",
33
33
  "dependencies": {
34
- "@stripoinc/ui-editor-extensions": "3.3.0",
34
+ "@stripoinc/ui-editor-extensions": "3.5.0",
35
35
  "@useinsider/design-system-vue": "0.14.20",
36
36
  "@vueuse/core": "11.3.0",
37
37
  "lodash-es": "4.17.21",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "guido": {
87
87
  "stripo": {
88
- "version": "2.47.0"
88
+ "version": "2.52.0"
89
89
  }
90
90
  }
91
91
  }
@@ -1,17 +0,0 @@
1
- function r(t) {
2
- if (!t)
3
- return null;
4
- const n = t.closest(".items-block-v2");
5
- return n ? n.querySelector("esd-config-block") : null;
6
- }
7
- function o(t, n = !1) {
8
- return t == null ? n : t === "1" || t === "true";
9
- }
10
- function e(t, n = "") {
11
- return t || n;
12
- }
13
- export {
14
- o as attributeToBoolean,
15
- e as attributeToString,
16
- r as getConfigBlock
17
- };