@useinsider/guido 2.0.0-beta.435da98 → 2.0.0-beta.4f6e85f
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 +55 -39
- 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 +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/composables/useStripo.js +40 -40
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +342 -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 +66 -46
- package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +152 -143
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -3
- package/dist/extensions/Blocks/Items/extension.js +7 -6
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
- package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
- package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
- package/dist/extensions/Blocks/Items/template.js +366 -129
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +184 -0
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +69 -153
- package/dist/extensions/Blocks/Recommendation/constants.js +1 -9
- package/dist/extensions/Blocks/Recommendation/control.js +59 -74
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/align.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/background.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/color.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/size.js +13 -0
- package/dist/extensions/Blocks/Recommendation/controls/price/style.js +13 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +42 -16
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +72 -117
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +64 -85
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +17 -54
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +45 -74
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +29 -30
- 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 +369 -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 +30 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +8 -0
- 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/cardComposition.d.ts +9 -0
- 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/price/singlePrice.d.ts +18 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
- package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +73 -0
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +3 -50
- package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -32
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +2 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +7 -15
- package/dist/src/extensions/Blocks/common-control.d.ts +9 -10
- package/dist/src/stores/config.d.ts +164 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/static/styles/components/wide-panel.css.js +4 -0
- package/dist/static/styles/customEditorStyle.css.js +0 -13
- package/dist/stores/config.js +7 -0
- package/dist/utils/pairProductVariables.js +61 -58
- package/package.json +3 -3
- package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
- package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
- package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
- package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +0 -25
- package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
- package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
- package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
- package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -592
- package/dist/src/extensions/Blocks/Recommendation/controls/nameTextTrimControl.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -19
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, 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';
|
|
10
|
+
export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, 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, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, 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,7 +5,14 @@
|
|
|
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';
|
|
8
9
|
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>;
|
|
9
16
|
/**
|
|
10
17
|
* Message type constants for email templates
|
|
11
18
|
*/
|
|
@@ -90,6 +97,8 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
90
97
|
}, undefined>, undefined>, readonly []>;
|
|
91
98
|
/** Selected unsubscribe page IDs */
|
|
92
99
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
100
|
+
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
101
|
+
readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
93
102
|
}, undefined>;
|
|
94
103
|
/**
|
|
95
104
|
* Email header configuration (sender name and subject)
|
|
@@ -344,6 +353,16 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
344
353
|
/** Skip default compiler rules */
|
|
345
354
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
346
355
|
}, undefined>;
|
|
356
|
+
/**
|
|
357
|
+
* Callbacks configuration - event handlers and hooks
|
|
358
|
+
*/
|
|
359
|
+
export declare const CallbacksSchema: v.ObjectSchema<{
|
|
360
|
+
/**
|
|
361
|
+
* External validation handler called before save completes.
|
|
362
|
+
* Return false to cancel the save operation.
|
|
363
|
+
*/
|
|
364
|
+
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
365
|
+
}, undefined>;
|
|
347
366
|
/**
|
|
348
367
|
* Complete Guido configuration schema
|
|
349
368
|
*
|
|
@@ -356,6 +375,7 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
356
375
|
* - features: Feature toggles
|
|
357
376
|
* - blocks: Block configuration
|
|
358
377
|
* - compiler: HTML compilation
|
|
378
|
+
* - callbacks: Event handlers and hooks
|
|
359
379
|
*/
|
|
360
380
|
export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
361
381
|
/** Identity configuration (required) */
|
|
@@ -400,6 +420,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
400
420
|
}, undefined>, undefined>, readonly []>;
|
|
401
421
|
/** Selected unsubscribe page IDs */
|
|
402
422
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
423
|
+
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
424
|
+
readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
403
425
|
}, undefined>, {}>;
|
|
404
426
|
/** Editor settings */
|
|
405
427
|
readonly editor: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -506,4 +528,12 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
506
528
|
/** Skip default compiler rules */
|
|
507
529
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
508
530
|
}, undefined>, {}>;
|
|
531
|
+
/** Callbacks and event handlers */
|
|
532
|
+
readonly callbacks: v.OptionalSchema<v.ObjectSchema<{
|
|
533
|
+
/**
|
|
534
|
+
* External validation handler called before save completes.
|
|
535
|
+
* Return false to cancel the save operation.
|
|
536
|
+
*/
|
|
537
|
+
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
538
|
+
}, undefined>, {}>;
|
|
509
539
|
}, 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, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema } from './schemas';
|
|
8
|
+
import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, ExternalValidationHandler } from './schemas';
|
|
9
9
|
import type * as v from 'valibot';
|
|
10
10
|
/**
|
|
11
11
|
* Complete validated Guido configuration.
|
|
@@ -41,6 +41,10 @@ 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 };
|
|
44
48
|
/** Email header configuration (senderName, subject) */
|
|
45
49
|
export type EmailHeader = v.InferOutput<typeof EmailHeaderSchema>;
|
|
46
50
|
/** Dynamic content item */
|
|
@@ -85,6 +89,8 @@ export type FeaturesConfigInput = v.InferInput<typeof FeaturesSchema>;
|
|
|
85
89
|
export type BlocksConfigInput = v.InferInput<typeof BlocksSchema>;
|
|
86
90
|
/** Input type for compiler configuration */
|
|
87
91
|
export type CompilerConfigInput = v.InferInput<typeof CompilerSchema>;
|
|
92
|
+
/** Input type for callbacks configuration */
|
|
93
|
+
export type CallbacksConfigInput = v.InferInput<typeof CallbacksSchema>;
|
|
88
94
|
/** Default Stripo block types */
|
|
89
95
|
export type DefaultBlockType = v.InferOutput<typeof DefaultBlockTypeSchema>;
|
|
90
96
|
/** 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,6 +91,9 @@ export declare const useConfig: () => {
|
|
|
90
91
|
})[];
|
|
91
92
|
ignoreDefaultRules: boolean;
|
|
92
93
|
};
|
|
94
|
+
callbacks: {
|
|
95
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
96
|
+
};
|
|
93
97
|
} | null>;
|
|
94
98
|
initialized: import("vue").Ref<boolean>;
|
|
95
99
|
identity: import("vue").ComputedRef<{
|
|
@@ -116,6 +120,7 @@ export declare const useConfig: () => {
|
|
|
116
120
|
} | undefined;
|
|
117
121
|
}[];
|
|
118
122
|
selectedUnsubscribePages: number[];
|
|
123
|
+
forceRecreate: boolean;
|
|
119
124
|
} | null>;
|
|
120
125
|
editor: import("vue").ComputedRef<{
|
|
121
126
|
locale: string;
|
|
@@ -175,6 +180,9 @@ export declare const useConfig: () => {
|
|
|
175
180
|
})[];
|
|
176
181
|
ignoreDefaultRules: boolean;
|
|
177
182
|
} | null>;
|
|
183
|
+
callbacks: import("vue").ComputedRef<{
|
|
184
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
185
|
+
} | null>;
|
|
178
186
|
templateId: import("vue").ComputedRef<string>;
|
|
179
187
|
userId: import("vue").ComputedRef<string>;
|
|
180
188
|
variationId: import("vue").ComputedRef<string>;
|
|
@@ -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
|
}
|
|
@@ -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
|
};
|
|
@@ -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,73 @@
|
|
|
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
|
+
nameControlEnabled: boolean;
|
|
16
|
+
priceHideDiscount: boolean;
|
|
17
|
+
priceFormatted: boolean;
|
|
18
|
+
priceSinglePrice: 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
|
+
/** Whether button should be full width (true = es-fw class) or inline (false = es-il class) */
|
|
28
|
+
buttonFullWidth: boolean;
|
|
29
|
+
imageVisible: boolean;
|
|
30
|
+
nameVisible: boolean;
|
|
31
|
+
quantityVisible: boolean;
|
|
32
|
+
priceVisible: boolean;
|
|
33
|
+
originalPriceVisible: boolean;
|
|
34
|
+
buttonVisible: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generates a unique block instance ID.
|
|
38
|
+
*/
|
|
39
|
+
export declare function generateBlockInstanceId(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Returns default ItemsBlockConfig values.
|
|
42
|
+
* These are used when initializing a new block or when migrating from legacy format.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDefaultItemsBlockConfig(): ItemsBlockConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the Items block container element from the current node.
|
|
47
|
+
* The container is identified by the `.items-block-v2` class (new) or `.esd-cart-items-block` (legacy).
|
|
48
|
+
* @param currentNode - The current node from the control (usually this.currentNode)
|
|
49
|
+
* @returns The container element or null if not found
|
|
50
|
+
*/
|
|
51
|
+
export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the node configuration from the Items block.
|
|
54
|
+
* Uses Stripo V2's getNodeConfig() API.
|
|
55
|
+
* Falls back to migrating from legacy config block if nodeConfig is empty.
|
|
56
|
+
* @param currentNode - The current node from the control
|
|
57
|
+
* @returns The ItemsBlockConfig object or null if not found
|
|
58
|
+
*/
|
|
59
|
+
export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined): ItemsBlockConfig | null;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the node configuration on the Items block.
|
|
62
|
+
* Uses Stripo V2's setNodeConfig() API.
|
|
63
|
+
* @param currentNode - The current node from the control
|
|
64
|
+
* @param api - The API object (ControlApi or BlockApi)
|
|
65
|
+
* @param config - The configuration to set (partial update supported)
|
|
66
|
+
*/
|
|
67
|
+
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the block instance ID from the node config.
|
|
70
|
+
* @param currentNode - The current node from the control
|
|
71
|
+
* @returns The block instance ID or null if not found
|
|
72
|
+
*/
|
|
73
|
+
export declare function getBlockInstanceIdFromConfig(currentNode: ImmutableHtmlNode | undefined): string | null;
|
|
@@ -7,69 +7,22 @@ export interface CardCompositionItem {
|
|
|
7
7
|
visible: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare class RecommendationCardCompositionControl extends CommonControl {
|
|
10
|
+
private currentComposition;
|
|
11
|
+
private currentVisibility;
|
|
10
12
|
getId(): string;
|
|
11
13
|
getTemplate(): string;
|
|
12
14
|
onRender(): void;
|
|
13
15
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
private _createItemContent;
|
|
18
|
-
/**
|
|
19
|
-
* Registers event listeners for composition and visibility changes
|
|
20
|
-
*/
|
|
21
|
-
private _registerValueChangeListeners;
|
|
22
|
-
/**
|
|
23
|
-
* Initializes composition order and visibility state from the current node
|
|
17
|
+
* Initialize the composition order and visibility from the block or use defaults
|
|
24
18
|
*/
|
|
25
19
|
private _initializeComposition;
|
|
26
|
-
/**
|
|
27
|
-
* Reads composition order from node's data-card-composition attribute
|
|
28
|
-
* Falls back to default order if attribute is not present
|
|
29
|
-
*/
|
|
30
|
-
private _readCompositionFromNode;
|
|
31
|
-
/**
|
|
32
|
-
* Builds visibility values object from the visibility map
|
|
33
|
-
*/
|
|
34
|
-
private _buildVisibilityValues;
|
|
35
|
-
/**
|
|
36
|
-
* Read visibility state from individual row elements' data-visibility attributes
|
|
37
|
-
* This ensures toggles reflect the actual DOM state
|
|
38
|
-
*/
|
|
39
|
-
private _readVisibilityFromRows;
|
|
40
|
-
/**
|
|
41
|
-
* Returns default visibility values for all items
|
|
42
|
-
*/
|
|
43
|
-
private _getDefaultVisibilities;
|
|
44
|
-
/**
|
|
45
|
-
* Extracts visibility values from DOM nodes
|
|
46
|
-
*/
|
|
47
|
-
private _extractVisibilityFromRows;
|
|
48
|
-
/**
|
|
49
|
-
* Parses visibility value from string to boolean
|
|
50
|
-
* Accepts "1", "true" as true, everything else as false
|
|
51
|
-
*/
|
|
52
|
-
private _parseVisibilityValue;
|
|
53
|
-
/**
|
|
54
|
-
* Merges extracted visibilities with default values for missing keys
|
|
55
|
-
*/
|
|
56
|
-
private _mergeWithDefaults;
|
|
57
20
|
/**
|
|
58
21
|
* Apply the reordered composition to the block's HTML structure
|
|
59
|
-
* Updates the data-card-composition attribute and reorders product attributes
|
|
60
22
|
*/
|
|
61
23
|
private _applyCompositionToBlock;
|
|
62
|
-
/**
|
|
63
|
-
* Reorders attribute rows within each product row based on composition order
|
|
64
|
-
*/
|
|
65
|
-
private _reorderProductAttributes;
|
|
66
|
-
/**
|
|
67
|
-
* Builds HTML string with attributes ordered according to composition
|
|
68
|
-
*/
|
|
69
|
-
private _buildCompositionHtml;
|
|
70
24
|
/**
|
|
71
25
|
* Apply visibility changes to the block's HTML structure
|
|
72
|
-
* Updates display style and data-visibility attribute for all matching rows
|
|
73
26
|
*/
|
|
74
27
|
private _applyVisibilityToBlock;
|
|
75
28
|
}
|