@useinsider/guido 2.0.0-beta.a3f32aa → 2.0.0-beta.b46bbf6
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.
- package/dist/@types/config/schemas.js +33 -45
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +27 -29
- package/dist/composables/useSave.js +11 -13
- package/dist/composables/useStripo.js +54 -55
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +283 -0
- package/dist/extensions/Blocks/Items/block.js +39 -40
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +28 -26
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +132 -127
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +296 -123
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +11 -20
- package/dist/extensions/Blocks/Recommendation/control.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +64 -53
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +366 -287
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -26
- package/dist/src/@types/config/types.d.ts +1 -7
- package/dist/src/composables/useConfig.d.ts +2 -6
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
- package/dist/src/stores/config.d.ts +18 -145
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +0 -7
- package/package.json +3 -3
- package/dist/package.json.js +0 -7
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - Default values for optional configuration
|
|
8
8
|
* - Validation utilities
|
|
9
9
|
*/
|
|
10
|
-
export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema,
|
|
11
|
-
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput,
|
|
10
|
+
export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
|
|
11
|
+
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
|
|
12
12
|
export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
|
|
13
13
|
export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
|
|
14
14
|
export type { ValidationResult, ValidationError, } from './validator';
|
|
@@ -5,14 +5,7 @@
|
|
|
5
5
|
* All types are inferred from these schemas to ensure single source of truth.
|
|
6
6
|
* @module @types/config/schemas
|
|
7
7
|
*/
|
|
8
|
-
import type { SavedTemplateDetails } from '../stripo';
|
|
9
8
|
import * as v from 'valibot';
|
|
10
|
-
/**
|
|
11
|
-
* Handler function for external validation before save
|
|
12
|
-
* @param data - The template details to validate
|
|
13
|
-
* @returns Promise<boolean> - true if valid, false to cancel save
|
|
14
|
-
*/
|
|
15
|
-
export type ExternalValidationHandler = (data: SavedTemplateDetails) => Promise<boolean>;
|
|
16
9
|
/**
|
|
17
10
|
* Message type constants for email templates
|
|
18
11
|
*/
|
|
@@ -153,6 +146,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
153
146
|
readonly displayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
154
147
|
/** Enable unsubscribe block */
|
|
155
148
|
readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
149
|
+
/** Disable modules panel in the editor */
|
|
150
|
+
readonly modulesDisabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
156
151
|
}, undefined>;
|
|
157
152
|
/**
|
|
158
153
|
* Default block types available in Stripo
|
|
@@ -349,16 +344,6 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
349
344
|
/** Skip default compiler rules */
|
|
350
345
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
351
346
|
}, undefined>;
|
|
352
|
-
/**
|
|
353
|
-
* Callbacks configuration - event handlers and hooks
|
|
354
|
-
*/
|
|
355
|
-
export declare const CallbacksSchema: v.ObjectSchema<{
|
|
356
|
-
/**
|
|
357
|
-
* External validation handler called before save completes.
|
|
358
|
-
* Return false to cancel the save operation.
|
|
359
|
-
*/
|
|
360
|
-
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
361
|
-
}, undefined>;
|
|
362
347
|
/**
|
|
363
348
|
* Complete Guido configuration schema
|
|
364
349
|
*
|
|
@@ -371,7 +356,6 @@ export declare const CallbacksSchema: v.ObjectSchema<{
|
|
|
371
356
|
* - features: Feature toggles
|
|
372
357
|
* - blocks: Block configuration
|
|
373
358
|
* - compiler: HTML compilation
|
|
374
|
-
* - callbacks: Event handlers and hooks
|
|
375
359
|
*/
|
|
376
360
|
export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
377
361
|
/** Identity configuration (required) */
|
|
@@ -457,6 +441,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
457
441
|
readonly displayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
458
442
|
/** Enable unsubscribe block */
|
|
459
443
|
readonly unsubscribe: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
444
|
+
/** Disable modules panel in the editor */
|
|
445
|
+
readonly modulesDisabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
460
446
|
}, undefined>, {}>;
|
|
461
447
|
/** Block configuration */
|
|
462
448
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -520,12 +506,4 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
520
506
|
/** Skip default compiler rules */
|
|
521
507
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
522
508
|
}, undefined>, {}>;
|
|
523
|
-
/** Callbacks and event handlers */
|
|
524
|
-
readonly callbacks: v.OptionalSchema<v.ObjectSchema<{
|
|
525
|
-
/**
|
|
526
|
-
* External validation handler called before save completes.
|
|
527
|
-
* Return false to cancel the save operation.
|
|
528
|
-
*/
|
|
529
|
-
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
530
|
-
}, undefined>, {}>;
|
|
531
509
|
}, undefined>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* This ensures type definitions are always in sync with validation.
|
|
6
6
|
* @module @types/config/types
|
|
7
7
|
*/
|
|
8
|
-
import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema,
|
|
8
|
+
import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema } from './schemas';
|
|
9
9
|
import type * as v from 'valibot';
|
|
10
10
|
/**
|
|
11
11
|
* Complete validated Guido configuration.
|
|
@@ -41,10 +41,6 @@ export type FeaturesConfig = v.InferOutput<typeof FeaturesSchema>;
|
|
|
41
41
|
export type BlocksConfig = v.InferOutput<typeof BlocksSchema>;
|
|
42
42
|
/** Compiler configuration (custom rules, ignore defaults) */
|
|
43
43
|
export type CompilerConfig = v.InferOutput<typeof CompilerSchema>;
|
|
44
|
-
/** Callbacks configuration (event handlers and hooks) */
|
|
45
|
-
export type CallbacksConfig = v.InferOutput<typeof CallbacksSchema>;
|
|
46
|
-
/** Re-export ExternalValidationHandler for convenience */
|
|
47
|
-
export type { ExternalValidationHandler };
|
|
48
44
|
/** Email header configuration (senderName, subject) */
|
|
49
45
|
export type EmailHeader = v.InferOutput<typeof EmailHeaderSchema>;
|
|
50
46
|
/** Dynamic content item */
|
|
@@ -89,8 +85,6 @@ export type FeaturesConfigInput = v.InferInput<typeof FeaturesSchema>;
|
|
|
89
85
|
export type BlocksConfigInput = v.InferInput<typeof BlocksSchema>;
|
|
90
86
|
/** Input type for compiler configuration */
|
|
91
87
|
export type CompilerConfigInput = v.InferInput<typeof CompilerSchema>;
|
|
92
|
-
/** Input type for callbacks configuration */
|
|
93
|
-
export type CallbacksConfigInput = v.InferInput<typeof CallbacksSchema>;
|
|
94
88
|
/** Default Stripo block types */
|
|
95
89
|
export type DefaultBlockType = v.InferOutput<typeof DefaultBlockTypeSchema>;
|
|
96
90
|
/** Custom Guido block types */
|
|
@@ -52,6 +52,7 @@ export declare const useConfig: () => {
|
|
|
52
52
|
testMessage: boolean;
|
|
53
53
|
displayConditions: boolean;
|
|
54
54
|
unsubscribe: boolean;
|
|
55
|
+
modulesDisabled: boolean;
|
|
55
56
|
};
|
|
56
57
|
blocks: {
|
|
57
58
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -89,9 +90,6 @@ export declare const useConfig: () => {
|
|
|
89
90
|
})[];
|
|
90
91
|
ignoreDefaultRules: boolean;
|
|
91
92
|
};
|
|
92
|
-
callbacks: {
|
|
93
|
-
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
94
|
-
};
|
|
95
93
|
} | null>;
|
|
96
94
|
initialized: import("vue").Ref<boolean>;
|
|
97
95
|
identity: import("vue").ComputedRef<{
|
|
@@ -139,6 +137,7 @@ export declare const useConfig: () => {
|
|
|
139
137
|
testMessage: boolean;
|
|
140
138
|
displayConditions: boolean;
|
|
141
139
|
unsubscribe: boolean;
|
|
140
|
+
modulesDisabled: boolean;
|
|
142
141
|
} | null>;
|
|
143
142
|
blocks: import("vue").ComputedRef<{
|
|
144
143
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -176,9 +175,6 @@ export declare const useConfig: () => {
|
|
|
176
175
|
})[];
|
|
177
176
|
ignoreDefaultRules: boolean;
|
|
178
177
|
} | null>;
|
|
179
|
-
callbacks: import("vue").ComputedRef<{
|
|
180
|
-
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
181
|
-
} | null>;
|
|
182
178
|
templateId: import("vue").ComputedRef<string>;
|
|
183
179
|
userId: import("vue").ComputedRef<string>;
|
|
184
180
|
variationId: import("vue").ComputedRef<string>;
|
|
@@ -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
|
|
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(
|
|
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
|
|
72
|
-
*
|
|
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
|
|
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 }: {
|