@useinsider/guido 1.0.3-beta.2cf8046 → 1.0.3-beta.2dd7b80

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 (80) hide show
  1. package/README.md +0 -32
  2. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  3. package/dist/composables/useBlocksConfig.js +2 -1
  4. package/dist/composables/useStripo.js +9 -9
  5. package/dist/enums/extensions/recommendationBlock.js +2 -2
  6. package/dist/enums/onboarding.js +3 -7
  7. package/dist/enums/unsubscribe.js +27 -26
  8. package/dist/extensions/Blocks/Checkbox/block.js +2 -5
  9. package/dist/extensions/Blocks/RadioButton/block.js +2 -5
  10. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +43 -43
  11. package/dist/extensions/Blocks/common-control.js +110 -174
  12. package/dist/guido.css +1 -1
  13. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +168 -213
  14. package/dist/package.json.js +1 -1
  15. package/dist/services/recommendationApi.js +19 -13
  16. package/dist/src/enums/onboarding.d.ts +0 -4
  17. package/dist/src/extensions/Blocks/Checkbox/block.d.ts +0 -1
  18. package/dist/src/extensions/Blocks/RadioButton/block.d.ts +0 -1
  19. package/dist/src/extensions/Blocks/common-control.d.ts +7 -44
  20. package/dist/src/stores/onboarding.d.ts +0 -334
  21. package/dist/src/utils/environmentUtil.d.ts +5 -0
  22. package/dist/static/styles/customEditorStyle.css.js +1 -1
  23. package/dist/stores/onboarding.js +12 -20
  24. package/dist/utils/environmentUtil.js +4 -0
  25. package/dist/utils/genericUtil.js +17 -16
  26. package/package.json +5 -12
  27. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
  28. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
  29. package/dist/extensions/Blocks/Items/block.js +0 -67
  30. package/dist/extensions/Blocks/Items/controls/button/link.js +0 -68
  31. package/dist/extensions/Blocks/Items/controls/cardComposition.js +0 -193
  32. package/dist/extensions/Blocks/Items/controls/image/link.js +0 -68
  33. package/dist/extensions/Blocks/Items/controls/index.js +0 -217
  34. package/dist/extensions/Blocks/Items/controls/name/trimming.js +0 -70
  35. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +0 -107
  36. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +0 -123
  37. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +0 -76
  38. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +0 -61
  39. package/dist/extensions/Blocks/Items/controls/settingsControl.js +0 -280
  40. package/dist/extensions/Blocks/Items/enums/controlEnums.js +0 -5
  41. package/dist/extensions/Blocks/Items/enums/productEnums.js +0 -201
  42. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -76
  43. package/dist/extensions/Blocks/Items/extension.js +0 -19
  44. package/dist/extensions/Blocks/Items/iconsRegistry.js +0 -32
  45. package/dist/extensions/Blocks/Items/items.css.js +0 -23
  46. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +0 -61
  47. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +0 -61
  48. package/dist/extensions/Blocks/Items/settingsPanel.js +0 -106
  49. package/dist/extensions/Blocks/Items/store/items-block.js +0 -71
  50. package/dist/extensions/Blocks/Items/template.js +0 -110
  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 -67
  54. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -44
  55. package/dist/extensions/Blocks/controlFactories.js +0 -223
  56. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
  57. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -13
  58. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -14
  59. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -33
  60. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -14
  61. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -501
  62. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -14
  63. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -19
  64. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -21
  65. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -14
  66. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -13
  67. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -42
  68. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -61
  69. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -160
  70. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -49
  71. package/dist/src/extensions/Blocks/Items/extension.d.ts +0 -2
  72. package/dist/src/extensions/Blocks/Items/iconsRegistry.d.ts +0 -4
  73. package/dist/src/extensions/Blocks/Items/settingsPanel.d.ts +0 -4
  74. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -41
  75. package/dist/src/extensions/Blocks/Items/template.d.ts +0 -16
  76. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  77. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  78. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -44
  79. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  80. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -312
@@ -1,42 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { CommonControl } from '../../common-control';
3
- export declare const CONTROL_BLOCK_ID = "ui-elements-items-block";
4
- export declare class ItemsBlockControl extends CommonControl {
5
- private store;
6
- getId(): string;
7
- getTemplate(): string;
8
- onRender(): void;
9
- onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
10
- onDestroy(): void;
11
- _getItemsType(): string;
12
- _getOrientation(): string;
13
- _getItemInCart(): string;
14
- _onOrientationChange(value: string): void;
15
- _onItemsTypeChange(value: string, oldValue: string): void;
16
- _onItemIdsChange(value: string): void;
17
- _initializeSelectItems(): void;
18
- _listenToFormUpdates(): void;
19
- _renderTemplate(): void;
20
- _getTemplateData(): {
21
- imageSrc: string;
22
- name: string;
23
- price: string;
24
- originalPrice: string;
25
- quantity: string;
26
- button: string;
27
- };
28
- _updateImageSrc(imageSrc: string): void;
29
- _updateName(name: string): void;
30
- _updatePrice(price: string): void;
31
- _updateOriginalPrice(originalPrice: string): void;
32
- _updateQuantity(quantity: string): void;
33
- _updateButton(button: string): void;
34
- _reOrderTemplate(): void;
35
- _reFillTemplate(): void;
36
- _recalculateTrimming(): void;
37
- private _getParagraphFromBlock;
38
- private _escapeRegex;
39
- private _removeCurrencySymbol;
40
- private _replacePriceNumber;
41
- private _buildPriceContent;
42
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * Block IDs used in the Recommendation Extension
3
- * These IDs are used in the esd-extension-block-id attribute to identify specific blocks
4
- */
5
- export declare enum ItemsBlockId {
6
- BUTTON = "items-block-button",
7
- IMAGE = "items-block-image",
8
- ORIGINAL_PRICE = "items-block-original-price",
9
- PRICE = "items-block-price",
10
- QUANTITY = "items-block-quantity",
11
- NAME = "items-block-name"
12
- }
13
- export declare enum ItemsBlockControlId {
14
- BUTTON_ALIGN = "items-block-button-align-control",
15
- BUTTON_BORDER = "items-block-button-border-control",
16
- BUTTON_BORDER_RADIUS = "items-block-button-border-radius-control",
17
- BUTTON_COLOR = "items-block-button-color-control",
18
- BUTTON_FIT_TO_CONTENT = "items-block-button-fit-to-content-control",
19
- BUTTON_FONT_FAMILY = "items-block-button-font-family-control",
20
- BUTTON_MARGINS = "items-block-button-margins-control",
21
- BUTTON_PADDINGS = "items-block-button-paddings-control",
22
- BUTTON_TEXT = "items-block-button-text-control",
23
- BUTTON_TEXT_SIZE = "items-block-button-text-size-control",
24
- BUTTON_TEXT_STYLE_AND_FONT_COLOR = "items-block-button-text-style-and-font-color-control",
25
- BUTTON_LINK = "items-block-button-link-control",
26
- IMAGE_SIZE = "items-block-image-size-control",
27
- IMAGE_MARGINS = "items-block-image-margins-control",
28
- IMAGE_LINK = "items-block-image-link-control",
29
- ORIGINAL_PRICE_ALIGN = "items-block-original-price-align-control",
30
- ORIGINAL_PRICE_COLOR = "items-block-original-price-color-control",
31
- ORIGINAL_PRICE_SIZE = "items-block-original-price-size-control",
32
- ORIGINAL_PRICE_STYLE = "items-block-original-price-style-control",
33
- ORIGINAL_PRICE_FONT_FAMILY = "items-block-original-price-font-family-control",
34
- ORIGINAL_PRICE_BACKGROUND = "items-block-original-price-background-control",
35
- ORIGINAL_PRICE_PADDINGS = "items-block-original-price-paddings-control",
36
- PRICE_ALIGN = "items-block-price-align-control",
37
- PRICE_COLOR = "items-block-price-color-control",
38
- PRICE_SIZE = "items-block-price-size-control",
39
- PRICE_STYLE = "items-block-price-style-control",
40
- PRICE_FONT_FAMILY = "items-block-price-font-family-control",
41
- PRICE_BACKGROUND = "items-block-price-background-control",
42
- PRICE_PADDINGS = "items-block-price-paddings-control",
43
- PRICE_HIDE_DISCOUNT = "items-block-price-hide-discount-control",
44
- PRICE_FORMATTED_PRICE = "items-block-price-formatted-price-control",
45
- PRICE_CURRENCY_SYMBOL = "items-block-price-currency-symbol-control",
46
- PRICE_CURRENCY_LOCATION = "items-block-price-currency-location-control",
47
- NAME_ALIGN = "items-block-name-align-control",
48
- NAME_COLOR = "items-block-name-color-control",
49
- NAME_SIZE = "items-block-name-size-control",
50
- NAME_STYLE = "items-block-name-style-control",
51
- NAME_FONT_FAMILY = "items-block-name-font-family-control",
52
- NAME_BACKGROUND = "items-block-name-background-control",
53
- NAME_TRIMMING = "items-block-name-trimming-control",
54
- NAME_PADDINGS = "items-block-name-paddings-control",
55
- QUANTITY_ALIGN = "items-block-quantity-align-control",
56
- QUANTITY_COLOR = "items-block-quantity-color-control",
57
- QUANTITY_FONT_FAMILY = "items-block-quantity-font-family-control",
58
- QUANTITY_PADDINGS = "items-block-quantity-paddings-control",
59
- QUANTITY_SIZE = "items-block-quantity-size-control",
60
- QUANTITY_STYLE = "items-block-quantity-style-control"
61
- }
@@ -1,160 +0,0 @@
1
- export declare const configAttributes: {
2
- TYPE: string;
3
- ITEMS_INDEX_SELECT_CONTROL_VALUE: string;
4
- ORIENTATION: string;
5
- PRODUCT_NAME_TRIMMING: string;
6
- PRODUCT_PRICE_HIDE_DISCOUNT: string;
7
- PRODUCT_PRICE_FORMATTED: string;
8
- PRODUCT_PRICE_CURRENCY_SYMBOL: string;
9
- PRODUCT_PRICE_CURRENCY_LOCATION: string;
10
- PRODUCT_BUTTON_LINK: string;
11
- PRODUCT_IMAGE_LINK: string;
12
- PRODUCT_NAME_CONTROL_VALUE: string;
13
- PRODUCT_QUANTITY_CONTROL_VALUE: string;
14
- PRODUCT_PRICE_CONTROL_VALUE: string;
15
- BLOCK_INSTANCE_ID: string;
16
- NAME_CONTROL_ENABLED: string;
17
- QUANTITY_CONTROL_ENABLED: string;
18
- PRICE_CONTROL_OPENED: string;
19
- PRODUCT_IMAGE_VISIBLE: string;
20
- PRODUCT_NAME_VISIBLE: string;
21
- PRODUCT_QUANTITY_VISIBLE: string;
22
- PRODUCT_PRICE_VISIBLE: string;
23
- PRODUCT_ORIGINAL_PRICE_VISIBLE: string;
24
- PRODUCT_BUTTON_VISIBLE: string;
25
- };
26
- export declare const productPairs: {
27
- PAIRS_FOR_EXTENSION: {
28
- imageSrc: {
29
- CART_ITEMS: {
30
- ATTR: string;
31
- DEFAULT: string[];
32
- };
33
- BROWSED_ITEMS: {
34
- ATTR: string;
35
- DEFAULT: string[];
36
- };
37
- PURCHASED_ITEMS: {
38
- ATTR: string;
39
- DEFAULT: string[];
40
- };
41
- };
42
- name: {
43
- CART_ITEMS: {
44
- ATTR: string;
45
- DEFAULT: string[];
46
- HREF: string;
47
- DEFAULT_HREF: string;
48
- };
49
- BROWSED_ITEMS: {
50
- ATTR: string;
51
- DEFAULT: string[];
52
- HREF: string;
53
- DEFAULT_HREF: string;
54
- };
55
- PURCHASED_ITEMS: {
56
- ATTR: string;
57
- DEFAULT: string[];
58
- HREF: string;
59
- DEFAULT_HREF: string;
60
- };
61
- };
62
- quantity: {
63
- CART_ITEMS: {
64
- ATTR: string;
65
- DEFAULT: string;
66
- };
67
- BROWSED_ITEMS: {
68
- ATTR: string;
69
- DEFAULT: string;
70
- };
71
- PURCHASED_ITEMS: {
72
- ATTR: string;
73
- DEFAULT: string;
74
- };
75
- };
76
- price: {
77
- CART_ITEMS: {
78
- PRICE: string;
79
- PRICE_FORMATTED: string;
80
- CURRENCY: string;
81
- DEFAULT_PRICE: string;
82
- DEFAULT_PRICE_FORMATTED: string;
83
- DEFAULT_CURRENCY: string;
84
- };
85
- BROWSED_ITEMS: {
86
- PRICE: string;
87
- PRICE_FORMATTED: string;
88
- CURRENCY: string;
89
- DEFAULT_PRICE: string;
90
- DEFAULT_PRICE_FORMATTED: string;
91
- DEFAULT_CURRENCY: string;
92
- };
93
- PURCHASED_ITEMS: {
94
- PRICE: string;
95
- PRICE_FORMATTED: string;
96
- CURRENCY: string;
97
- DEFAULT_PRICE: string;
98
- DEFAULT_PRICE_FORMATTED: string;
99
- DEFAULT_CURRENCY: string;
100
- };
101
- };
102
- originalPrice: {
103
- CART_ITEMS: {
104
- PRICE: string;
105
- PRICE_FORMATTED: string;
106
- CURRENCY: string;
107
- DEFAULT_PRICE: string;
108
- DEFAULT_PRICE_FORMATTED: string;
109
- DEFAULT_CURRENCY: string;
110
- };
111
- BROWSED_ITEMS: {
112
- PRICE: string;
113
- PRICE_FORMATTED: string;
114
- CURRENCY: string;
115
- DEFAULT_PRICE: string;
116
- DEFAULT_PRICE_FORMATTED: string;
117
- DEFAULT_CURRENCY: string;
118
- };
119
- PURCHASED_ITEMS: {
120
- PRICE: string;
121
- PRICE_FORMATTED: string;
122
- CURRENCY: string;
123
- DEFAULT_PRICE: string;
124
- DEFAULT_PRICE_FORMATTED: string;
125
- DEFAULT_CURRENCY: string;
126
- };
127
- };
128
- button: {
129
- CART_ITEMS: {
130
- HREF: string;
131
- DEFAULT_HREF: string;
132
- DEFAULT_LABEL: string;
133
- };
134
- BROWSED_ITEMS: {
135
- HREF: string;
136
- DEFAULT_HREF: string;
137
- DEFAULT_LABEL: string;
138
- };
139
- PURCHASED_ITEMS: {
140
- HREF: string;
141
- DEFAULT_HREF: string;
142
- DEFAULT_LABEL: string;
143
- };
144
- };
145
- itemLink: {
146
- CART_ITEMS: {
147
- HREF: string;
148
- DEFAULT_HREF: string;
149
- };
150
- BROWSED_ITEMS: {
151
- HREF: string;
152
- DEFAULT_HREF: string;
153
- };
154
- PURCHASED_ITEMS: {
155
- HREF: string;
156
- DEFAULT_HREF: string;
157
- };
158
- };
159
- };
160
- };
@@ -1,49 +0,0 @@
1
- export declare const SETTINGS_ENUMS: {
2
- ITEMS_TYPE: {
3
- CART_ITEMS: string;
4
- BROWSED_ITEMS: string;
5
- PURCHASED_ITEMS: string;
6
- };
7
- ORIENTATION: {
8
- VERTICAL: string;
9
- HORIZONTAL: string;
10
- };
11
- };
12
- export declare const ItemTypeOptions: {
13
- text: string;
14
- value: string;
15
- }[];
16
- export declare const OrientationOptions: {
17
- icon: string;
18
- value: string;
19
- }[];
20
- export declare const DefaultConfigValues: {
21
- itemsType: string;
22
- isDataInitialized: string;
23
- cartItemsSelectControlValue: string;
24
- cardOrientationControlValue: string;
25
- productNameTrimmingControlValue: string;
26
- productPriceHideDiscountControlValue: string;
27
- productPriceFormattedControlValue: string;
28
- productPriceCurrencySymbolControlValue: string;
29
- productPriceCurrencyLocationControlValue: string;
30
- productButtonLinkControlValue: string;
31
- productImageLinkControlValue: string;
32
- productNameControlEnabled: string;
33
- productQuantityControlOpened: string;
34
- productNameControlTrim: string;
35
- productQuantityControlEnabled: string;
36
- productPriceControlOpened: string;
37
- productImageVisible: string;
38
- productNameVisible: string;
39
- productQuantityVisible: string;
40
- productPriceVisible: string;
41
- productOriginalPriceVisible: string;
42
- productButtonVisible: string;
43
- };
44
- export declare const ItemInCartOptions: {
45
- [x: string]: {
46
- text: string;
47
- value: string;
48
- }[];
49
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("@stripoinc/ui-editor-extensions").Extension;
2
- export default _default;
@@ -1,4 +0,0 @@
1
- import { IconsRegistry } from '@stripoinc/ui-editor-extensions';
2
- export declare class ItemsIconsRegistry extends IconsRegistry {
3
- registerIconsSvg(iconsMap: Record<string, string>): void;
4
- }
@@ -1,4 +0,0 @@
1
- import { SettingsPanelRegistry, SettingsPanelTab } from '@stripoinc/ui-editor-extensions';
2
- export declare class SettingsPanel extends SettingsPanelRegistry {
3
- registerBlockControls(blockControlsMap: Record<string, SettingsPanelTab[]>): void;
4
- }
@@ -1,41 +0,0 @@
1
- import type { OrientationType, ProductType } from '@@/Types/extensions/items';
2
- interface ItemsBlockState {
3
- itemsType: ProductType;
4
- itemIds: string;
5
- imageLink: string;
6
- buttonLink: string;
7
- orientation: OrientationType;
8
- nameTrimming: boolean;
9
- hideDiscount: boolean;
10
- currencySymbol: string;
11
- currencyLocation: string;
12
- formattedPrice: boolean;
13
- templateData: {
14
- imageSrc: string;
15
- name: string;
16
- price: string;
17
- originalPrice: string;
18
- quantity: string;
19
- button: string;
20
- };
21
- }
22
- export declare const useItemsBlockStore: import("pinia").StoreDefinition<"guidoItemsBlock", ItemsBlockState, {}, {
23
- setItemsType(itemsType: ProductType): void;
24
- setItemIds(itemIds: string): void;
25
- setImageLink(imageLink: string): void;
26
- setButtonLink(buttonLink: string): void;
27
- setOrientation(orientation: OrientationType): void;
28
- setNameTrimming(nameTrimming: boolean): void;
29
- setHideDiscount(hideDiscount: boolean): void;
30
- setCurrencySymbol(currencySymbol: string): void;
31
- setCurrencyLocation(currencyLocation: string): void;
32
- setFormattedPrice(formattedPrice: boolean): void;
33
- setTemplateData(templateData: ItemsBlockState["templateData"]): void;
34
- updateFromAttributes(attributes: {
35
- itemsType?: string;
36
- itemIds?: string;
37
- orientation?: string;
38
- }): void;
39
- reset(): void;
40
- }>;
41
- export {};
@@ -1,16 +0,0 @@
1
- declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
2
- type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
3
- type OrientationType = 'vertical' | 'horizontal';
4
- type TemplateParameters = {
5
- orientation: OrientationType;
6
- itemsType: ProductType;
7
- itemId: string;
8
- currencySymbol?: string;
9
- currencyLocation?: string;
10
- formattedPrice?: boolean;
11
- };
12
- /**
13
- * @returns The template for the default checkbox block
14
- */
15
- export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, formattedPrice, }: TemplateParameters): string;
16
- export default migrationTemplate;
@@ -1,23 +0,0 @@
1
- import { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Gets the esd-config-block element from the current node.
4
- * Searches within the closest .items-block-v2 container.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @returns The config block element or null if not found
7
- */
8
- export declare function getConfigBlock(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
9
- /**
10
- * Converts an attribute value to a boolean.
11
- * Handles string values '1', 'true', and null/undefined cases.
12
- * @param value - The attribute value (string or null)
13
- * @param defaultValue - Default value to return if value is null/undefined (default: false)
14
- * @returns The boolean value
15
- */
16
- export declare function attributeToBoolean(value: string | null, defaultValue?: boolean): boolean;
17
- /**
18
- * Gets a string attribute value with a default fallback.
19
- * @param value - The attribute value (string or null)
20
- * @param defaultValue - Default value to return if value is null/undefined (default: '')
21
- * @returns The string value or default
22
- */
23
- export declare function attributeToString(value: string | null, defaultValue?: string): string;
@@ -1,32 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { configAttributes } from '../enums/productEnums';
3
- type StoreSetter<T> = (value: T) => void;
4
- interface SyncConfig<T> {
5
- attributeName: keyof typeof configAttributes;
6
- storeSetter: StoreSetter<T>;
7
- converter: (value: string | null) => T;
8
- }
9
- /**
10
- * Generic utility to sync an attribute value from esd-config-block to the store.
11
- * This makes attribute values mutable by syncing them from the DOM.
12
- * @param currentNode - The current node from the control (usually this.currentNode)
13
- * @param config - Configuration object with attribute name, store setter, and value converter
14
- */
15
- export declare function syncAttributeFromConfigBlock<T>(currentNode: ImmutableHtmlNode | undefined, config: SyncConfig<T>): void;
16
- /**
17
- * Helper to create a sync config for boolean attributes.
18
- * @param attributeName - The attribute name from configAttributes
19
- * @param storeSetter - The store setter function
20
- * @param defaultValue - Default value if attribute is not set (default: false)
21
- * @returns Sync configuration object
22
- */
23
- export declare function createBooleanSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<boolean>, defaultValue?: boolean): SyncConfig<boolean>;
24
- /**
25
- * Helper to create a sync config for string attributes.
26
- * @param attributeName - The attribute name from configAttributes
27
- * @param storeSetter - The store setter function
28
- * @param defaultValue - Default value if attribute is not set (default: '')
29
- * @returns Sync configuration object
30
- */
31
- export declare function createStringSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<string>, defaultValue?: string): SyncConfig<string>;
32
- export {};
@@ -1,44 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Reads name trimming value from esd-config-block attribute and updates the store.
4
- * This makes the trimming value mutable by syncing it from the DOM.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- */
7
- export declare function syncNameTrimmingFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
8
- /**
9
- * Reads hide discount value from esd-config-block attribute and updates the store.
10
- * This makes the hide discount value mutable by syncing it from the DOM.
11
- * @param currentNode - The current node from the control (usually this.currentNode)
12
- */
13
- export declare function syncHideDiscountFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
14
- /**
15
- * Reads formatted price value from esd-config-block attribute and updates the store.
16
- * This makes the formatted price value mutable by syncing it from the DOM.
17
- * Defaults to true if not set, since formatted is the default.
18
- * @param currentNode - The current node from the control (usually this.currentNode)
19
- */
20
- export declare function syncFormattedPriceFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
21
- /**
22
- * Reads currency symbol value from esd-config-block attribute and updates the store.
23
- * This makes the currency symbol value mutable by syncing it from the DOM.
24
- * @param currentNode - The current node from the control (usually this.currentNode)
25
- */
26
- export declare function syncCurrencySymbolFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
27
- /**
28
- * Reads currency location value from esd-config-block attribute and updates the store.
29
- * This makes the currency location value mutable by syncing it from the DOM.
30
- * @param currentNode - The current node from the control (usually this.currentNode)
31
- */
32
- export declare function syncCurrencyLocationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
33
- /**
34
- * Reads button link value from esd-config-block attribute and updates the store.
35
- * This makes the button link value mutable by syncing it from the DOM.
36
- * @param currentNode - The current node from the control (usually this.currentNode)
37
- */
38
- export declare function syncButtonLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
39
- /**
40
- * Reads image link value from esd-config-block attribute and updates the store.
41
- * This makes the image link value mutable by syncing it from the DOM.
42
- * @param currentNode - The current node from the control (usually this.currentNode)
43
- */
44
- export declare function syncImageLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
@@ -1,8 +0,0 @@
1
- import { ImmutableHtmlNode, ControlApi } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Updates attributes on the esd-config-block element based on current store state.
4
- * This utility can be called from controls whenever they change values that affect attributes.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @param api - The API object from the control (usually this.api)
7
- */
8
- export declare function updateConfigBlockAttributes(currentNode: ImmutableHtmlNode | undefined, api: ControlApi): void;