@useinsider/guido 2.0.0-beta.117064 → 2.0.0-beta.11fdcf2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +53 -39
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
- 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/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +334 -0
- package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
- package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
- package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
- package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
- package/dist/extensions/Blocks/Items/block.js +36 -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 -5
- package/dist/extensions/Blocks/Items/extension.js +11 -9
- 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 +387 -140
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +174 -0
- 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 +30 -32
- package/dist/extensions/Blocks/controlFactories.js +139 -118
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +370 -286
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
- package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
- 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 -2
- 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 +71 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +10 -11
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- 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/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
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
13
13
|
/**
|
|
14
14
|
* Factory function to create text align controls for different block elements
|
|
15
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
15
16
|
*/
|
|
16
|
-
export declare function createTextAlignControl(controlId: string, targetBlockId
|
|
17
|
+
export declare function createTextAlignControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
17
18
|
new (): {
|
|
18
19
|
getId(): string;
|
|
19
20
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -27,8 +28,9 @@ export declare function createTextAlignControl(controlId: string, targetBlockId:
|
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
30
|
* Factory function to create text color controls for different block elements
|
|
31
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
30
32
|
*/
|
|
31
|
-
export declare function createTextColorControl(controlId: string, targetBlockId
|
|
33
|
+
export declare function createTextColorControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
32
34
|
new (): {
|
|
33
35
|
getId(): string;
|
|
34
36
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -42,8 +44,9 @@ export declare function createTextColorControl(controlId: string, targetBlockId:
|
|
|
42
44
|
};
|
|
43
45
|
/**
|
|
44
46
|
* Factory function to create text size controls for different block elements
|
|
47
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
45
48
|
*/
|
|
46
|
-
export declare function createTextSizeControl(controlId: string, targetBlockId
|
|
49
|
+
export declare function createTextSizeControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
47
50
|
new (): {
|
|
48
51
|
getId(): string;
|
|
49
52
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -57,8 +60,9 @@ export declare function createTextSizeControl(controlId: string, targetBlockId:
|
|
|
57
60
|
};
|
|
58
61
|
/**
|
|
59
62
|
* Factory function to create text style controls for different block elements
|
|
63
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
60
64
|
*/
|
|
61
|
-
export declare function createTextStyleControl(controlId: string, targetBlockId
|
|
65
|
+
export declare function createTextStyleControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
62
66
|
new (): {
|
|
63
67
|
getId(): string;
|
|
64
68
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -72,8 +76,9 @@ export declare function createTextStyleControl(controlId: string, targetBlockId:
|
|
|
72
76
|
};
|
|
73
77
|
/**
|
|
74
78
|
* Factory function to create text font family controls for different block elements
|
|
79
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
75
80
|
*/
|
|
76
|
-
export declare function createTextFontFamilyControl(controlId: string, targetBlockId
|
|
81
|
+
export declare function createTextFontFamilyControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
77
82
|
new (): {
|
|
78
83
|
getId(): string;
|
|
79
84
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -87,8 +92,9 @@ export declare function createTextFontFamilyControl(controlId: string, targetBlo
|
|
|
87
92
|
};
|
|
88
93
|
/**
|
|
89
94
|
* Factory function to create text background color controls for different block elements
|
|
95
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
90
96
|
*/
|
|
91
|
-
export declare function createTextBackgroundColorControl(controlId: string, targetBlockId
|
|
97
|
+
export declare function createTextBackgroundColorControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
92
98
|
new (): {
|
|
93
99
|
getId(): string;
|
|
94
100
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -102,8 +108,25 @@ export declare function createTextBackgroundColorControl(controlId: string, targ
|
|
|
102
108
|
};
|
|
103
109
|
/**
|
|
104
110
|
* Factory function to create paddings controls for different block elements
|
|
111
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
105
112
|
*/
|
|
106
|
-
export declare function createPaddingsControl(controlId: string, targetBlockId
|
|
113
|
+
export declare function createPaddingsControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
114
|
+
new (): {
|
|
115
|
+
getId(): string;
|
|
116
|
+
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
117
|
+
getParentControlId(): string;
|
|
118
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
119
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
120
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
121
|
+
getAdditionalModifications(_root: ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
122
|
+
isVisible(_node: ImmutableHtmlNode): boolean;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Factory function to create text line spacing controls for different block elements
|
|
127
|
+
* When targetBlockId and containerSelector are not provided, applies directly to root
|
|
128
|
+
*/
|
|
129
|
+
export declare function createTextLineSpacingControl(controlId: string, targetBlockId?: string, containerSelector?: string): {
|
|
107
130
|
new (): {
|
|
108
131
|
getId(): string;
|
|
109
132
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig } from '@@/Types/config';
|
|
1
|
+
import type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, CallbacksConfig } from '@@/Types/config';
|
|
2
2
|
interface ConfigStoreState {
|
|
3
3
|
/** Whether the config has been initialized */
|
|
4
4
|
initialized: boolean;
|
|
@@ -96,6 +96,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
96
96
|
})[];
|
|
97
97
|
ignoreDefaultRules: boolean;
|
|
98
98
|
};
|
|
99
|
+
callbacks: {
|
|
100
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
101
|
+
};
|
|
99
102
|
} | null;
|
|
100
103
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => IdentityConfig | null;
|
|
101
104
|
/**
|
|
@@ -188,6 +191,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
188
191
|
})[];
|
|
189
192
|
ignoreDefaultRules: boolean;
|
|
190
193
|
};
|
|
194
|
+
callbacks: {
|
|
195
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
196
|
+
};
|
|
191
197
|
} | null;
|
|
192
198
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => PartnerConfig | null;
|
|
193
199
|
/**
|
|
@@ -280,6 +286,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
280
286
|
})[];
|
|
281
287
|
ignoreDefaultRules: boolean;
|
|
282
288
|
};
|
|
289
|
+
callbacks: {
|
|
290
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
291
|
+
};
|
|
283
292
|
} | null;
|
|
284
293
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => TemplateConfig | null;
|
|
285
294
|
/**
|
|
@@ -372,6 +381,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
372
381
|
})[];
|
|
373
382
|
ignoreDefaultRules: boolean;
|
|
374
383
|
};
|
|
384
|
+
callbacks: {
|
|
385
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
386
|
+
};
|
|
375
387
|
} | null;
|
|
376
388
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => EditorConfig | null;
|
|
377
389
|
/**
|
|
@@ -464,6 +476,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
464
476
|
})[];
|
|
465
477
|
ignoreDefaultRules: boolean;
|
|
466
478
|
};
|
|
479
|
+
callbacks: {
|
|
480
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
481
|
+
};
|
|
467
482
|
} | null;
|
|
468
483
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => UIConfig | null;
|
|
469
484
|
/**
|
|
@@ -556,6 +571,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
556
571
|
})[];
|
|
557
572
|
ignoreDefaultRules: boolean;
|
|
558
573
|
};
|
|
574
|
+
callbacks: {
|
|
575
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
576
|
+
};
|
|
559
577
|
} | null;
|
|
560
578
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => FeaturesConfig | null;
|
|
561
579
|
/**
|
|
@@ -648,6 +666,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
648
666
|
})[];
|
|
649
667
|
ignoreDefaultRules: boolean;
|
|
650
668
|
};
|
|
669
|
+
callbacks: {
|
|
670
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
671
|
+
};
|
|
651
672
|
} | null;
|
|
652
673
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => BlocksConfig | null;
|
|
653
674
|
/**
|
|
@@ -740,8 +761,106 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
740
761
|
})[];
|
|
741
762
|
ignoreDefaultRules: boolean;
|
|
742
763
|
};
|
|
764
|
+
callbacks: {
|
|
765
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
766
|
+
};
|
|
743
767
|
} | null;
|
|
744
768
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => CompilerConfig | null;
|
|
769
|
+
/**
|
|
770
|
+
* Get the callbacks configuration
|
|
771
|
+
*/
|
|
772
|
+
callbacks: (state: {
|
|
773
|
+
initialized: boolean;
|
|
774
|
+
config: {
|
|
775
|
+
identity: {
|
|
776
|
+
templateId: string;
|
|
777
|
+
userId: string;
|
|
778
|
+
variationId?: string | undefined;
|
|
779
|
+
};
|
|
780
|
+
partner: {
|
|
781
|
+
name: string;
|
|
782
|
+
productType: 60 | 49 | 97;
|
|
783
|
+
messageType: 1 | 2;
|
|
784
|
+
username: string;
|
|
785
|
+
};
|
|
786
|
+
template: {
|
|
787
|
+
html: string;
|
|
788
|
+
css: string;
|
|
789
|
+
preselectedDynamicContent: {
|
|
790
|
+
text: string;
|
|
791
|
+
value: string;
|
|
792
|
+
fallback?: string | undefined;
|
|
793
|
+
format?: {
|
|
794
|
+
key: string;
|
|
795
|
+
value: string;
|
|
796
|
+
} | undefined;
|
|
797
|
+
}[];
|
|
798
|
+
selectedUnsubscribePages: number[];
|
|
799
|
+
forceRecreate: boolean;
|
|
800
|
+
};
|
|
801
|
+
editor: {
|
|
802
|
+
locale: string;
|
|
803
|
+
translationsPath: string;
|
|
804
|
+
migrationDate: number;
|
|
805
|
+
emailHeader: {
|
|
806
|
+
senderName: string;
|
|
807
|
+
subject: string;
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
ui: {
|
|
811
|
+
showHeader: boolean;
|
|
812
|
+
backButtonLabel?: string | undefined;
|
|
813
|
+
};
|
|
814
|
+
features: {
|
|
815
|
+
dynamicContent: boolean;
|
|
816
|
+
saveAsTemplate: boolean;
|
|
817
|
+
versionHistory: boolean;
|
|
818
|
+
testMessage: boolean;
|
|
819
|
+
displayConditions: boolean;
|
|
820
|
+
unsubscribe: boolean;
|
|
821
|
+
modulesDisabled: boolean;
|
|
822
|
+
};
|
|
823
|
+
blocks: {
|
|
824
|
+
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")[];
|
|
825
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
826
|
+
};
|
|
827
|
+
compiler: {
|
|
828
|
+
customRules: ({
|
|
829
|
+
type: "replace";
|
|
830
|
+
search: string;
|
|
831
|
+
replacement: string;
|
|
832
|
+
replaceAll?: boolean | undefined;
|
|
833
|
+
id: string;
|
|
834
|
+
description?: string | undefined;
|
|
835
|
+
priority: number;
|
|
836
|
+
} | {
|
|
837
|
+
type: "regex";
|
|
838
|
+
pattern: string;
|
|
839
|
+
replacement: string;
|
|
840
|
+
flags?: string | undefined;
|
|
841
|
+
id: string;
|
|
842
|
+
description?: string | undefined;
|
|
843
|
+
priority: number;
|
|
844
|
+
} | {
|
|
845
|
+
type: "remove";
|
|
846
|
+
targets: string[];
|
|
847
|
+
id: string;
|
|
848
|
+
description?: string | undefined;
|
|
849
|
+
priority: number;
|
|
850
|
+
} | {
|
|
851
|
+
type: "custom";
|
|
852
|
+
processor: (html: string) => string;
|
|
853
|
+
id: string;
|
|
854
|
+
description?: string | undefined;
|
|
855
|
+
priority: number;
|
|
856
|
+
})[];
|
|
857
|
+
ignoreDefaultRules: boolean;
|
|
858
|
+
};
|
|
859
|
+
callbacks: {
|
|
860
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
861
|
+
};
|
|
862
|
+
} | null;
|
|
863
|
+
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => CallbacksConfig | null;
|
|
745
864
|
/**
|
|
746
865
|
* Get the template ID
|
|
747
866
|
*/
|
|
@@ -832,6 +951,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
832
951
|
})[];
|
|
833
952
|
ignoreDefaultRules: boolean;
|
|
834
953
|
};
|
|
954
|
+
callbacks: {
|
|
955
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
956
|
+
};
|
|
835
957
|
} | null;
|
|
836
958
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
837
959
|
/**
|
|
@@ -924,6 +1046,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
924
1046
|
})[];
|
|
925
1047
|
ignoreDefaultRules: boolean;
|
|
926
1048
|
};
|
|
1049
|
+
callbacks: {
|
|
1050
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1051
|
+
};
|
|
927
1052
|
} | null;
|
|
928
1053
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
929
1054
|
/**
|
|
@@ -1016,6 +1141,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1016
1141
|
})[];
|
|
1017
1142
|
ignoreDefaultRules: boolean;
|
|
1018
1143
|
};
|
|
1144
|
+
callbacks: {
|
|
1145
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1146
|
+
};
|
|
1019
1147
|
} | null;
|
|
1020
1148
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
1021
1149
|
/**
|
|
@@ -1108,6 +1236,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1108
1236
|
})[];
|
|
1109
1237
|
ignoreDefaultRules: boolean;
|
|
1110
1238
|
};
|
|
1239
|
+
callbacks: {
|
|
1240
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1241
|
+
};
|
|
1111
1242
|
} | null;
|
|
1112
1243
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
1113
1244
|
/**
|
|
@@ -1200,6 +1331,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1200
1331
|
})[];
|
|
1201
1332
|
ignoreDefaultRules: boolean;
|
|
1202
1333
|
};
|
|
1334
|
+
callbacks: {
|
|
1335
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1336
|
+
};
|
|
1203
1337
|
} | null;
|
|
1204
1338
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
|
|
1205
1339
|
/**
|
|
@@ -1292,6 +1426,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1292
1426
|
})[];
|
|
1293
1427
|
ignoreDefaultRules: boolean;
|
|
1294
1428
|
};
|
|
1429
|
+
callbacks: {
|
|
1430
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1431
|
+
};
|
|
1295
1432
|
} | null;
|
|
1296
1433
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
|
|
1297
1434
|
/**
|
|
@@ -1384,6 +1521,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1384
1521
|
})[];
|
|
1385
1522
|
ignoreDefaultRules: boolean;
|
|
1386
1523
|
};
|
|
1524
|
+
callbacks: {
|
|
1525
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1526
|
+
};
|
|
1387
1527
|
} | null;
|
|
1388
1528
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
1389
1529
|
/**
|
|
@@ -1476,6 +1616,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1476
1616
|
})[];
|
|
1477
1617
|
ignoreDefaultRules: boolean;
|
|
1478
1618
|
};
|
|
1619
|
+
callbacks: {
|
|
1620
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1621
|
+
};
|
|
1479
1622
|
} | null;
|
|
1480
1623
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => boolean;
|
|
1481
1624
|
/**
|
|
@@ -1568,6 +1711,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1568
1711
|
})[];
|
|
1569
1712
|
ignoreDefaultRules: boolean;
|
|
1570
1713
|
};
|
|
1714
|
+
callbacks: {
|
|
1715
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1716
|
+
};
|
|
1571
1717
|
} | null;
|
|
1572
1718
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => (feature: keyof FeaturesConfig) => boolean;
|
|
1573
1719
|
}, {
|
package/dist/stores/config.js
CHANGED
|
@@ -64,6 +64,13 @@ const s = o("guido-config", {
|
|
|
64
64
|
var e;
|
|
65
65
|
return ((e = i.config) == null ? void 0 : e.compiler) ?? null;
|
|
66
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* Get the callbacks configuration
|
|
69
|
+
*/
|
|
70
|
+
callbacks: (i) => {
|
|
71
|
+
var e;
|
|
72
|
+
return ((e = i.config) == null ? void 0 : e.callbacks) ?? null;
|
|
73
|
+
},
|
|
67
74
|
/**
|
|
68
75
|
* Get the template ID
|
|
69
76
|
*/
|
|
@@ -1,74 +1,77 @@
|
|
|
1
1
|
import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
-
function
|
|
3
|
-
const m =
|
|
4
|
-
Object.entries(
|
|
2
|
+
function P(k) {
|
|
3
|
+
const m = k.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), R = w.PAIRS_FOR_EXTENSION;
|
|
4
|
+
Object.entries(R).forEach(([n, l]) => {
|
|
5
5
|
$.querySelectorAll(".ins-product-td").forEach((o) => {
|
|
6
|
-
const
|
|
6
|
+
const E = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
|
|
7
7
|
o.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
|
|
8
8
|
var y;
|
|
9
|
-
const
|
|
9
|
+
const T = e.getAttribute("data-type") || b, u = e.getAttribute("data-number") || E, p = l[T];
|
|
10
10
|
if (p)
|
|
11
11
|
switch (n) {
|
|
12
12
|
case "imageSrc": {
|
|
13
|
-
let t = null,
|
|
14
|
-
if (e.tagName === "IMG" ? (t = e,
|
|
13
|
+
let t = null, c = null;
|
|
14
|
+
if (e.tagName === "IMG" ? (t = e, c = t.closest("a")) : (t = e.querySelector("img"), c = e.querySelector("a") || e.closest("a")), !t)
|
|
15
15
|
break;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
16
|
+
const i = p.DEFAULT, a = p.ATTR;
|
|
17
|
+
if (i && t.src) {
|
|
18
18
|
const r = t.src;
|
|
19
|
-
|
|
20
|
-
const s =
|
|
21
|
-
return r.includes(
|
|
19
|
+
i.some((d) => {
|
|
20
|
+
const s = d.split("/").pop() || "", _ = r.split("/").pop() || "";
|
|
21
|
+
return r.includes(d) || r.includes(s) || _ === s;
|
|
22
22
|
}) && (t.src = `{{${a}_${u}}}`);
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
25
|
-
const r = (y =
|
|
24
|
+
if (c) {
|
|
25
|
+
const r = (y = R.itemLink) == null ? void 0 : y[T];
|
|
26
26
|
if (r) {
|
|
27
|
-
const f = r.HREF,
|
|
28
|
-
(s === "#" || s === "" || s.endsWith("#!") || s.endsWith(
|
|
27
|
+
const f = r.HREF, d = r.DEFAULT_HREF || "#!", s = c.href;
|
|
28
|
+
(s === "#" || s === "" || s.endsWith("#!") || s.endsWith(d) || s === `${window.location.href}${d}` || !s || s === window.location.href) && (c.href = `{{${f}_${u}}}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
case "name": {
|
|
34
|
-
const t = p,
|
|
35
|
-
e.textContent && (e.textContent = `{{${
|
|
34
|
+
const t = p, c = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
|
|
35
|
+
e.textContent && (e.textContent = `{{${c}_${u}}}`);
|
|
36
36
|
const r = e.closest("a") || (e.tagName === "A" ? e : null);
|
|
37
37
|
if (r && a) {
|
|
38
|
-
const f = r.href,
|
|
39
|
-
(f ===
|
|
38
|
+
const f = r.href, d = `${window.location.href}${i}`;
|
|
39
|
+
(f === d || f.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
|
|
40
40
|
}
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
case "price":
|
|
44
44
|
case "originalPrice": {
|
|
45
|
-
const t = p, c = e.getAttribute("data-formated")
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const t = p, c = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = c === "true", r = i === "true", f = e.getAttribute("data-curency") || "before";
|
|
46
|
+
let d;
|
|
47
|
+
r ? d = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : d = a ? t.PRICE_FORMATTED : t.PRICE;
|
|
48
|
+
const s = t.CURRENCY;
|
|
49
|
+
let _ = `{{${d}_${u}}}`;
|
|
50
|
+
if (s) {
|
|
51
|
+
const H = `{{${s}_${u}}}`;
|
|
52
|
+
_ = f === "after" ? `${_} ${H}` : `${H} ${_}`;
|
|
50
53
|
}
|
|
51
|
-
e.textContent =
|
|
54
|
+
e.textContent = _;
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
54
57
|
case "quantity": {
|
|
55
|
-
const t = p,
|
|
56
|
-
e.textContent && e.textContent.trim() ===
|
|
58
|
+
const t = p, c = t.ATTR, i = t.DEFAULT;
|
|
59
|
+
e.textContent && e.textContent.trim() === i && (e.textContent = `{{${c}_${u}}}`);
|
|
57
60
|
break;
|
|
58
61
|
}
|
|
59
62
|
case "button": {
|
|
60
|
-
const t = p,
|
|
63
|
+
const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
|
|
61
64
|
if (a) {
|
|
62
|
-
const r = a.href || "", f = `${window.location.href}${
|
|
63
|
-
(r === "" || r === "#" || r === f || r.endsWith(
|
|
65
|
+
const r = a.href || "", f = `${window.location.href}${i}`;
|
|
66
|
+
(r === "" || r === "#" || r === f || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${c}_${u}}}`);
|
|
64
67
|
}
|
|
65
68
|
break;
|
|
66
69
|
}
|
|
67
70
|
case "itemLink": {
|
|
68
|
-
const t = p,
|
|
71
|
+
const t = p, c = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
|
|
69
72
|
if (a.href) {
|
|
70
|
-
const r = a.href, f = `${window.location.href}${
|
|
71
|
-
(r === f || r.endsWith(
|
|
73
|
+
const r = a.href, f = `${window.location.href}${i}`;
|
|
74
|
+
(r === f || r.endsWith(i)) && (a.href = `{{${c}_${u}}}`);
|
|
72
75
|
}
|
|
73
76
|
break;
|
|
74
77
|
}
|
|
@@ -83,21 +86,21 @@ function M(H) {
|
|
|
83
86
|
});
|
|
84
87
|
});
|
|
85
88
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const F = $.querySelectorAll(".ins-product-td"), S = [];
|
|
90
|
+
F.forEach((n) => {
|
|
91
|
+
const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), E = n.outerHTML;
|
|
92
|
+
S.push({
|
|
90
93
|
element: n,
|
|
91
|
-
outerHtml:
|
|
92
|
-
type:
|
|
94
|
+
outerHtml: E,
|
|
95
|
+
type: l,
|
|
93
96
|
number: A,
|
|
94
97
|
nodup: o || void 0
|
|
95
98
|
});
|
|
96
99
|
});
|
|
97
|
-
let
|
|
98
|
-
|
|
100
|
+
let h = $.body.innerHTML;
|
|
101
|
+
S.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
|
|
99
102
|
let o = "";
|
|
100
|
-
switch (
|
|
103
|
+
switch (l) {
|
|
101
104
|
case "CART_ITEMS":
|
|
102
105
|
o = "ins_apr_total_product_kind";
|
|
103
106
|
break;
|
|
@@ -109,28 +112,28 @@ function M(H) {
|
|
|
109
112
|
break;
|
|
110
113
|
}
|
|
111
114
|
if (o) {
|
|
112
|
-
const
|
|
113
|
-
|
|
115
|
+
const b = parseInt(A) - 1, T = `${`{% if ${o} > ${b} %}`}${n}{% endif %}`;
|
|
116
|
+
h = h.replace(n, T);
|
|
114
117
|
}
|
|
115
118
|
});
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
119
|
+
const I = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
|
|
120
|
+
return I.forEach((n) => {
|
|
121
|
+
const l = n.getAttribute("data-number"), A = n.getAttribute("data-type");
|
|
122
|
+
if (!l || A !== "CART_ITEMS")
|
|
120
123
|
return;
|
|
121
124
|
const o = n.closest(".product-original-price-class");
|
|
122
125
|
if (o) {
|
|
123
|
-
const
|
|
124
|
-
|
|
126
|
+
const E = o.outerHTML;
|
|
127
|
+
g.some((C) => C.tdOuterHtml === E) || g.push({ tdOuterHtml: E, number: l });
|
|
125
128
|
}
|
|
126
|
-
}),
|
|
127
|
-
const A = `{% if ins_apr_price_${
|
|
128
|
-
if (!
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
}), g.reverse().forEach(({ tdOuterHtml: n, number: l }) => {
|
|
130
|
+
const A = `{% if ins_apr_price_${l} != ins_apr_originalprice_${l} %}`;
|
|
131
|
+
if (!h.includes(A) && !n.includes("{% if")) {
|
|
132
|
+
const E = `${A}${n}{% endif %}`;
|
|
133
|
+
h = h.replace(n, E);
|
|
131
134
|
}
|
|
132
|
-
}),
|
|
135
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
133
136
|
}
|
|
134
137
|
export {
|
|
135
|
-
|
|
138
|
+
P as pairProductVariables
|
|
136
139
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.11fdcf2",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"author": "",
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@stripoinc/ui-editor-extensions": "3.
|
|
34
|
+
"@stripoinc/ui-editor-extensions": "3.5.0",
|
|
35
35
|
"@useinsider/design-system-vue": "0.14.20",
|
|
36
36
|
"@vueuse/core": "11.3.0",
|
|
37
37
|
"lodash-es": "4.17.21",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"guido": {
|
|
87
87
|
"stripo": {
|
|
88
|
-
"version": "2.
|
|
88
|
+
"version": "2.52.0"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function r(t) {
|
|
2
|
-
if (!t)
|
|
3
|
-
return null;
|
|
4
|
-
const n = t.closest(".items-block-v2");
|
|
5
|
-
return n ? n.querySelector("esd-config-block") : null;
|
|
6
|
-
}
|
|
7
|
-
function o(t, n = !1) {
|
|
8
|
-
return t == null ? n : t === "1" || t === "true";
|
|
9
|
-
}
|
|
10
|
-
function e(t, n = "") {
|
|
11
|
-
return t || n;
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
o as attributeToBoolean,
|
|
15
|
-
e as attributeToString,
|
|
16
|
-
r as getConfigBlock
|
|
17
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { configAttributes as i } from "../enums/productEnums.js";
|
|
2
|
-
import { getConfigBlock as c, attributeToBoolean as u, attributeToString as a } from "./configBlockUtils.js";
|
|
3
|
-
function l(r, t) {
|
|
4
|
-
const e = c(r);
|
|
5
|
-
if (!e)
|
|
6
|
-
return;
|
|
7
|
-
const o = e.getAttribute(i[t.attributeName]), n = t.converter(o);
|
|
8
|
-
t.storeSetter(n);
|
|
9
|
-
}
|
|
10
|
-
function b(r, t, e = !1) {
|
|
11
|
-
return {
|
|
12
|
-
attributeName: r,
|
|
13
|
-
storeSetter: t,
|
|
14
|
-
converter: (o) => u(o, e)
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function s(r, t, e = "") {
|
|
18
|
-
return {
|
|
19
|
-
attributeName: r,
|
|
20
|
-
storeSetter: t,
|
|
21
|
-
converter: (o) => a(o, e)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
b as createBooleanSyncConfig,
|
|
26
|
-
s as createStringSyncConfig,
|
|
27
|
-
l as syncAttributeFromConfigBlock
|
|
28
|
-
};
|