@useinsider/guido 2.0.0-beta.ac3cd4d → 2.0.0-beta.afc5689
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/README.md +2 -0
- package/dist/@types/config/schemas.js +38 -50
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +15 -17
- 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/LeftSlot.vue.js +12 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
- 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 +40 -40
- 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/button/link.js +22 -29
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +145 -136
- 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/settingsPanel.js +4 -4
- package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
- package/dist/extensions/Blocks/Items/template.js +312 -125
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +17 -44
- 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/extensions/Blocks/controlFactories.js +55 -45
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -285
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +6 -10
- 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/button/link.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
- 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 -146
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/stores/config.js +0 -7
- package/package.json +3 -3
package/dist/package.json.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useHttp as m } from "../composables/useHttp.js";
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { MAX_DEFAULT_TEMPLATE_ID as
|
|
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 } =
|
|
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 <=
|
|
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
|
}
|
|
@@ -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
|
*/
|
|
@@ -97,6 +90,8 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
97
90
|
}, undefined>, undefined>, readonly []>;
|
|
98
91
|
/** Selected unsubscribe page IDs */
|
|
99
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>;
|
|
100
95
|
}, undefined>;
|
|
101
96
|
/**
|
|
102
97
|
* Email header configuration (sender name and subject)
|
|
@@ -351,16 +346,6 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
351
346
|
/** Skip default compiler rules */
|
|
352
347
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
353
348
|
}, undefined>;
|
|
354
|
-
/**
|
|
355
|
-
* Callbacks configuration - event handlers and hooks
|
|
356
|
-
*/
|
|
357
|
-
export declare const CallbacksSchema: v.ObjectSchema<{
|
|
358
|
-
/**
|
|
359
|
-
* External validation handler called before save completes.
|
|
360
|
-
* Return false to cancel the save operation.
|
|
361
|
-
*/
|
|
362
|
-
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
363
|
-
}, undefined>;
|
|
364
349
|
/**
|
|
365
350
|
* Complete Guido configuration schema
|
|
366
351
|
*
|
|
@@ -373,7 +358,6 @@ export declare const CallbacksSchema: v.ObjectSchema<{
|
|
|
373
358
|
* - features: Feature toggles
|
|
374
359
|
* - blocks: Block configuration
|
|
375
360
|
* - compiler: HTML compilation
|
|
376
|
-
* - callbacks: Event handlers and hooks
|
|
377
361
|
*/
|
|
378
362
|
export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
379
363
|
/** Identity configuration (required) */
|
|
@@ -418,6 +402,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
418
402
|
}, undefined>, undefined>, readonly []>;
|
|
419
403
|
/** Selected unsubscribe page IDs */
|
|
420
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>;
|
|
421
407
|
}, undefined>, {}>;
|
|
422
408
|
/** Editor settings */
|
|
423
409
|
readonly editor: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -524,12 +510,4 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
524
510
|
/** Skip default compiler rules */
|
|
525
511
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
526
512
|
}, undefined>, {}>;
|
|
527
|
-
/** Callbacks and event handlers */
|
|
528
|
-
readonly callbacks: v.OptionalSchema<v.ObjectSchema<{
|
|
529
|
-
/**
|
|
530
|
-
* External validation handler called before save completes.
|
|
531
|
-
* Return false to cancel the save operation.
|
|
532
|
-
*/
|
|
533
|
-
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
534
|
-
}, undefined>, {}>;
|
|
535
513
|
}, 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 */
|
|
@@ -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;
|
|
@@ -90,9 +91,6 @@ export declare const useConfig: () => {
|
|
|
90
91
|
})[];
|
|
91
92
|
ignoreDefaultRules: boolean;
|
|
92
93
|
};
|
|
93
|
-
callbacks: {
|
|
94
|
-
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
95
|
-
};
|
|
96
94
|
} | null>;
|
|
97
95
|
initialized: import("vue").Ref<boolean>;
|
|
98
96
|
identity: import("vue").ComputedRef<{
|
|
@@ -119,6 +117,7 @@ export declare const useConfig: () => {
|
|
|
119
117
|
} | undefined;
|
|
120
118
|
}[];
|
|
121
119
|
selectedUnsubscribePages: number[];
|
|
120
|
+
forceRecreate: boolean;
|
|
122
121
|
} | null>;
|
|
123
122
|
editor: import("vue").ComputedRef<{
|
|
124
123
|
locale: string;
|
|
@@ -178,9 +177,6 @@ export declare const useConfig: () => {
|
|
|
178
177
|
})[];
|
|
179
178
|
ignoreDefaultRules: boolean;
|
|
180
179
|
} | null>;
|
|
181
|
-
callbacks: import("vue").ComputedRef<{
|
|
182
|
-
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
183
|
-
} | null>;
|
|
184
180
|
templateId: import("vue").ComputedRef<string>;
|
|
185
181
|
userId: import("vue").ComputedRef<string>;
|
|
186
182
|
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 }: {
|