@useinsider/guido 2.1.0-beta.bc18abc → 2.1.0-beta.da327fa
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/composables/useActionsApi.js +15 -13
- package/dist/config/migrator/itemsBlockMigrator.js +140 -123
- package/dist/extensions/Blocks/Items/block.js +19 -28
- package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
- package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
- package/dist/extensions/Blocks/Items/template.js +181 -175
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +3 -3
- package/dist/extensions/Blocks/common-control.js +91 -92
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
- package/package.json +1 -1
- package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
|
@@ -3,15 +3,10 @@ import { CommonControl } from '../../../common-control';
|
|
|
3
3
|
import { ItemsBlockControlId } from '../../enums/controlEnums';
|
|
4
4
|
export declare const CONTROL_BLOCK_ID = ItemsBlockControlId.PRICE_SINGLE_PRICE;
|
|
5
5
|
export declare class PriceSinglePriceControl extends CommonControl {
|
|
6
|
-
private store;
|
|
7
6
|
getId(): string;
|
|
8
7
|
getTemplate(): string;
|
|
9
8
|
onRender(): void;
|
|
10
9
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
11
|
-
/**
|
|
12
|
-
* Syncs single price state from nodeConfig.
|
|
13
|
-
*/
|
|
14
|
-
private _syncSinglePriceFromNodeConfig;
|
|
15
10
|
_onSinglePriceChange(value: boolean): void;
|
|
16
11
|
private _updatePriceBlock;
|
|
17
12
|
_getSinglePrice(): string;
|
|
@@ -3,12 +3,10 @@ import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
|
3
3
|
import { CommonControl } from '../../common-control';
|
|
4
4
|
export declare const CONTROL_BLOCK_ID = "ui-elements-items-block";
|
|
5
5
|
export declare class ItemsBlockControl extends CommonControl {
|
|
6
|
-
private store;
|
|
7
6
|
getId(): string;
|
|
8
7
|
getTemplate(): string;
|
|
9
8
|
onRender(): void;
|
|
10
9
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
11
|
-
onDestroy(): void;
|
|
12
10
|
_getItemsType(): string;
|
|
13
11
|
_getOrientation(): string;
|
|
14
12
|
_getItemInCart(): string;
|
|
@@ -18,7 +16,7 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
18
16
|
_initializeSelectItems(): void;
|
|
19
17
|
_listenToFormUpdates(): void;
|
|
20
18
|
_renderTemplate(): void;
|
|
21
|
-
_getTemplateData(): {
|
|
19
|
+
_getTemplateData(itemsTypeOverride?: ProductType, itemIdOverride?: string): {
|
|
22
20
|
imageSrc: string;
|
|
23
21
|
name: string;
|
|
24
22
|
price: string;
|
|
@@ -26,15 +24,15 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
26
24
|
quantity: string;
|
|
27
25
|
button: string;
|
|
28
26
|
};
|
|
29
|
-
_updateImageSrc(imageSrc: string): void;
|
|
30
|
-
_updateName(name: string): void;
|
|
31
|
-
_updatePrice(price: string): void;
|
|
32
|
-
_updateOriginalPrice(originalPrice: string): void;
|
|
33
|
-
_updateQuantity(quantity: string): void;
|
|
34
|
-
_reOrderTemplate(): void;
|
|
35
|
-
_updateDataTypeAttributes(itemsType: ProductType): void;
|
|
36
|
-
_updateDataNumberAttributes(itemId: string): void;
|
|
37
|
-
_reFillTemplate(): void;
|
|
27
|
+
_updateImageSrc(imageSrc: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
28
|
+
_updateName(name: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
29
|
+
_updatePrice(price: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
30
|
+
_updateOriginalPrice(originalPrice: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
31
|
+
_updateQuantity(quantity: string, itemsTypeOverride: ProductType | undefined, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
32
|
+
_reOrderTemplate(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
33
|
+
_updateDataTypeAttributes(itemsType: ProductType, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
34
|
+
_updateDataNumberAttributes(itemId: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
|
|
35
|
+
_reFillTemplate(itemsType?: ProductType): void;
|
|
38
36
|
_recalculateTrimming(): void;
|
|
39
37
|
private _getParagraphFromBlock;
|
|
40
38
|
private _escapeRegex;
|
|
@@ -66,8 +66,9 @@ export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | und
|
|
|
66
66
|
* @param currentNode - The current node from the control
|
|
67
67
|
* @param api - The API object (ControlApi or BlockApi)
|
|
68
68
|
* @param config - The configuration to set (partial update supported)
|
|
69
|
+
* @param modifier - Optional document modifier for batching updates
|
|
69
70
|
*/
|
|
70
|
-
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
|
|
71
|
+
export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>, modifier?: ReturnType<typeof api.getDocumentModifier>): void;
|
|
71
72
|
/**
|
|
72
73
|
* Gets the block instance ID from the node config.
|
|
73
74
|
* @param currentNode - The current node from the control
|
|
@@ -66,14 +66,13 @@ export declare abstract class CommonControl extends Control {
|
|
|
66
66
|
*/
|
|
67
67
|
protected getBlockInstanceId(): string | null;
|
|
68
68
|
/**
|
|
69
|
-
* Handles block instance change detection and
|
|
70
|
-
* This is a helper method for controls that need to
|
|
69
|
+
* Handles block instance change detection and UI updates.
|
|
70
|
+
* This is a helper method for controls that need to update UI when switching between block instances.
|
|
71
71
|
* Uses Stripo V2 nodeConfig API for block instance tracking.
|
|
72
|
-
* @param
|
|
73
|
-
* @param updateUI - Function to call to update the UI (called both on change and when same block)
|
|
72
|
+
* @param updateUI - Function to call to update the UI (called on every update)
|
|
74
73
|
* @returns true if block instance changed, false otherwise
|
|
75
74
|
*/
|
|
76
|
-
protected handleBlockInstanceChange(
|
|
75
|
+
protected handleBlockInstanceChange(updateUI: () => void): boolean;
|
|
77
76
|
_GuLabel({ text, name }: LabelProps): string;
|
|
78
77
|
_GuToggle(name: string): string;
|
|
79
78
|
_GuSelectItem({ text, value }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.da327fa",
|
|
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",
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { defineStore as s } from "pinia";
|
|
2
|
-
import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
|
|
3
|
-
const n = (t) => t.replace(/Url\}/, "Image}"), r = (t) => t.replace(/Image\}/, "Url}"), i = () => {
|
|
4
|
-
const t = e.cartItemsSelectControlValue;
|
|
5
|
-
return {
|
|
6
|
-
itemsType: e.itemsType,
|
|
7
|
-
itemIds: t,
|
|
8
|
-
imageLink: n(t),
|
|
9
|
-
buttonLink: r(t),
|
|
10
|
-
orientation: e.cardOrientationControlValue,
|
|
11
|
-
nameTrimming: !0,
|
|
12
|
-
hideDiscount: !0,
|
|
13
|
-
currencySymbol: "USD",
|
|
14
|
-
currencyLocation: "0",
|
|
15
|
-
formattedPrice: !0,
|
|
16
|
-
singlePrice: !1,
|
|
17
|
-
priceOrientation: "vertical",
|
|
18
|
-
templateData: {
|
|
19
|
-
imageSrc: "",
|
|
20
|
-
name: "",
|
|
21
|
-
price: "",
|
|
22
|
-
originalPrice: "",
|
|
23
|
-
quantity: "",
|
|
24
|
-
button: ""
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}, m = s("guidoItemsBlock", {
|
|
28
|
-
state: () => i(),
|
|
29
|
-
actions: {
|
|
30
|
-
setItemsType(t) {
|
|
31
|
-
this.itemsType = t;
|
|
32
|
-
},
|
|
33
|
-
setItemIds(t) {
|
|
34
|
-
this.itemIds = t, this.imageLink = n(t), this.buttonLink = r(t);
|
|
35
|
-
},
|
|
36
|
-
setImageLink(t) {
|
|
37
|
-
this.imageLink = t;
|
|
38
|
-
},
|
|
39
|
-
setButtonLink(t) {
|
|
40
|
-
this.buttonLink = t;
|
|
41
|
-
},
|
|
42
|
-
setOrientation(t) {
|
|
43
|
-
this.orientation = t;
|
|
44
|
-
},
|
|
45
|
-
setNameTrimming(t) {
|
|
46
|
-
this.nameTrimming = t;
|
|
47
|
-
},
|
|
48
|
-
setHideDiscount(t) {
|
|
49
|
-
this.hideDiscount = t;
|
|
50
|
-
},
|
|
51
|
-
setCurrencySymbol(t) {
|
|
52
|
-
this.currencySymbol = t;
|
|
53
|
-
},
|
|
54
|
-
setCurrencyLocation(t) {
|
|
55
|
-
this.currencyLocation = t;
|
|
56
|
-
},
|
|
57
|
-
setFormattedPrice(t) {
|
|
58
|
-
this.formattedPrice = t;
|
|
59
|
-
},
|
|
60
|
-
setSinglePrice(t) {
|
|
61
|
-
this.singlePrice = t;
|
|
62
|
-
},
|
|
63
|
-
setPriceOrientation(t) {
|
|
64
|
-
this.priceOrientation = t;
|
|
65
|
-
},
|
|
66
|
-
setTemplateData(t) {
|
|
67
|
-
this.templateData = t;
|
|
68
|
-
},
|
|
69
|
-
updateFromAttributes(t) {
|
|
70
|
-
t.itemsType && (this.itemsType = t.itemsType), t.itemIds && this.setItemIds(t.itemIds), t.orientation && (this.orientation = t.orientation);
|
|
71
|
-
},
|
|
72
|
-
reset() {
|
|
73
|
-
Object.assign(this, i());
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
export {
|
|
78
|
-
m as useItemsBlockStore
|
|
79
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { OrientationType, ProductType } from '@@/Types/extensions/items';
|
|
2
|
-
interface ItemsBlockState {
|
|
3
|
-
itemsType: ProductType;
|
|
4
|
-
itemIds: string;
|
|
5
|
-
imageLink: string;
|
|
6
|
-
buttonLink: string;
|
|
7
|
-
orientation: OrientationType;
|
|
8
|
-
nameTrimming: boolean;
|
|
9
|
-
hideDiscount: boolean;
|
|
10
|
-
currencySymbol: string;
|
|
11
|
-
currencyLocation: string;
|
|
12
|
-
formattedPrice: boolean;
|
|
13
|
-
singlePrice: boolean;
|
|
14
|
-
priceOrientation: 'vertical' | 'horizontal';
|
|
15
|
-
templateData: {
|
|
16
|
-
imageSrc: string;
|
|
17
|
-
name: string;
|
|
18
|
-
price: string;
|
|
19
|
-
originalPrice: string;
|
|
20
|
-
quantity: string;
|
|
21
|
-
button: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export declare const useItemsBlockStore: import("pinia").StoreDefinition<"guidoItemsBlock", ItemsBlockState, {}, {
|
|
25
|
-
setItemsType(itemsType: ProductType): void;
|
|
26
|
-
setItemIds(itemIds: string): void;
|
|
27
|
-
setImageLink(imageLink: string): void;
|
|
28
|
-
setButtonLink(buttonLink: string): void;
|
|
29
|
-
setOrientation(orientation: OrientationType): void;
|
|
30
|
-
setNameTrimming(nameTrimming: boolean): void;
|
|
31
|
-
setHideDiscount(hideDiscount: boolean): void;
|
|
32
|
-
setCurrencySymbol(currencySymbol: string): void;
|
|
33
|
-
setCurrencyLocation(currencyLocation: string): void;
|
|
34
|
-
setFormattedPrice(formattedPrice: boolean): void;
|
|
35
|
-
setSinglePrice(singlePrice: boolean): void;
|
|
36
|
-
setPriceOrientation(priceOrientation: "vertical" | "horizontal"): void;
|
|
37
|
-
setTemplateData(templateData: ItemsBlockState["templateData"]): void;
|
|
38
|
-
updateFromAttributes(attributes: {
|
|
39
|
-
itemsType?: string;
|
|
40
|
-
itemIds?: string;
|
|
41
|
-
orientation?: string;
|
|
42
|
-
}): void;
|
|
43
|
-
reset(): void;
|
|
44
|
-
}>;
|
|
45
|
-
export {};
|