@useinsider/guido 3.9.0-beta.ba394b1 → 3.9.0-beta.c84fcd0
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/useCustomInterfaceAppearance.js +18 -16
- package/dist/composables/useStripo.js +37 -39
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/enums/toaster.js +2 -2
- package/dist/extensions/Blocks/Items/block.js +57 -37
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +53 -45
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
- package/dist/services/templateLibraryApi.js +8 -9
- package/dist/src/enums/toaster.d.ts +2 -2
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +12 -0
- package/dist/src/stores/toaster.d.ts +3 -2
- package/dist/static/styles/components/notification.css.js +74 -0
- package/dist/stores/toaster.js +10 -10
- package/package.json +2 -2
- package/dist/composables/useStripoNotifications.js +0 -26
- package/dist/src/composables/useStripoNotifications.d.ts +0 -10
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ItemInCartOptions as p, DefaultConfigValues as i, SETTINGS_ENUMS as c } from "../enums/settingsEnums.js";
|
|
3
3
|
function _() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
|
-
const
|
|
7
|
-
function y() {
|
|
6
|
+
const S = (r) => r.replace(/\$/g, "$$$$");
|
|
7
|
+
function y(r, t) {
|
|
8
|
+
const e = p[t], n = e ? e.findIndex((u) => u.value === r) : -1;
|
|
9
|
+
if (n >= 0)
|
|
10
|
+
return String(n + 1);
|
|
11
|
+
const o = typeof r == "string" ? r.match(/\((\d+)\)/) : null;
|
|
12
|
+
return (o == null ? void 0 : o[1]) ?? "1";
|
|
13
|
+
}
|
|
14
|
+
function A() {
|
|
8
15
|
return {
|
|
9
16
|
initialized: !0,
|
|
10
17
|
blockInstanceId: _(),
|
|
11
|
-
source:
|
|
12
|
-
type:
|
|
18
|
+
source: c.ITEMS_TYPE.CART_ITEMS,
|
|
19
|
+
type: c.ITEMS_TYPE.CART_ITEMS,
|
|
13
20
|
itemsSelectValue: i.cartItemsSelectControlValue,
|
|
14
|
-
orientation:
|
|
21
|
+
orientation: c.ORIENTATION.VERTICAL,
|
|
15
22
|
nameTrimming: i.productNameTrimmingControlValue === "1",
|
|
16
23
|
priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
|
|
17
24
|
priceFormatted: i.productPriceFormattedControlValue === "1",
|
|
@@ -33,7 +40,7 @@ function y() {
|
|
|
33
40
|
buttonVisible: i.productButtonVisible === "1"
|
|
34
41
|
};
|
|
35
42
|
}
|
|
36
|
-
function
|
|
43
|
+
function g(r) {
|
|
37
44
|
if (!r)
|
|
38
45
|
return null;
|
|
39
46
|
const t = r.closest(".items-block-v2");
|
|
@@ -41,14 +48,14 @@ function p(r) {
|
|
|
41
48
|
}
|
|
42
49
|
function m(r) {
|
|
43
50
|
return r ? {
|
|
44
|
-
CartItems:
|
|
45
|
-
BrowsedItems:
|
|
46
|
-
PurchasedItems:
|
|
51
|
+
CartItems: c.ITEMS_TYPE.CART_ITEMS,
|
|
52
|
+
BrowsedItems: c.ITEMS_TYPE.BROWSED_ITEMS,
|
|
53
|
+
PurchasedItems: c.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
47
54
|
// Also handle already correct formats
|
|
48
|
-
CART_ITEMS:
|
|
49
|
-
BROWSED_ITEMS:
|
|
50
|
-
PURCHASED_ITEMS:
|
|
51
|
-
}[r] ||
|
|
55
|
+
CART_ITEMS: c.ITEMS_TYPE.CART_ITEMS,
|
|
56
|
+
BROWSED_ITEMS: c.ITEMS_TYPE.BROWSED_ITEMS,
|
|
57
|
+
PURCHASED_ITEMS: c.ITEMS_TYPE.PURCHASED_ITEMS
|
|
58
|
+
}[r] || c.ITEMS_TYPE.CART_ITEMS : c.ITEMS_TYPE.CART_ITEMS;
|
|
52
59
|
}
|
|
53
60
|
function f(r, t) {
|
|
54
61
|
if (!r)
|
|
@@ -56,27 +63,27 @@ function f(r, t) {
|
|
|
56
63
|
if (r.includes("{{"))
|
|
57
64
|
return r;
|
|
58
65
|
if (/^\d+$/.test(r)) {
|
|
59
|
-
const e = parseInt(r) - 1,
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
66
|
+
const e = parseInt(r) - 1, n = p[t];
|
|
67
|
+
if (n && n[e])
|
|
68
|
+
return n[e].value;
|
|
62
69
|
}
|
|
63
70
|
return i.cartItemsSelectControlValue;
|
|
64
71
|
}
|
|
65
|
-
function
|
|
72
|
+
function I(r) {
|
|
66
73
|
const t = r.querySelector("esd-config-block");
|
|
67
74
|
if (!t)
|
|
68
75
|
return null;
|
|
69
|
-
const e = (
|
|
76
|
+
const e = (a, s) => a == null ? s : a === "1" || a === "true", n = (a, s) => a || s, o = t.getAttribute("data-type"), u = m(o), d = t.getAttribute("data-cart_items_select_control_value"), l = f(d, u);
|
|
70
77
|
return {
|
|
71
78
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
|
-
blockInstanceId:
|
|
79
|
+
blockInstanceId: n(
|
|
73
80
|
t.getAttribute("data-block-instance-id"),
|
|
74
81
|
_()
|
|
75
82
|
),
|
|
76
|
-
source:
|
|
77
|
-
type:
|
|
83
|
+
source: u,
|
|
84
|
+
type: u,
|
|
78
85
|
itemsSelectValue: l,
|
|
79
|
-
orientation: t.getAttribute("data-card_orientation_control_value") ||
|
|
86
|
+
orientation: t.getAttribute("data-card_orientation_control_value") || c.ORIENTATION.VERTICAL,
|
|
80
87
|
nameTrimming: e(
|
|
81
88
|
t.getAttribute("data-product_name_control_trim"),
|
|
82
89
|
!0
|
|
@@ -93,11 +100,11 @@ function C(r) {
|
|
|
93
100
|
t.getAttribute("data-product_price_control_single_price"),
|
|
94
101
|
!1
|
|
95
102
|
),
|
|
96
|
-
priceCurrencySymbol:
|
|
103
|
+
priceCurrencySymbol: n(
|
|
97
104
|
t.getAttribute("data-product_price_control_currency_symbol"),
|
|
98
105
|
i.productPriceCurrencySymbolControlValue
|
|
99
106
|
),
|
|
100
|
-
priceCurrencyLocation:
|
|
107
|
+
priceCurrencyLocation: n(
|
|
101
108
|
t.getAttribute("data-product_price_currency_location"),
|
|
102
109
|
i.productPriceCurrencyLocationControlValue
|
|
103
110
|
),
|
|
@@ -106,15 +113,15 @@ function C(r) {
|
|
|
106
113
|
t.getAttribute("data-product_quantity_control_enabled"),
|
|
107
114
|
!0
|
|
108
115
|
),
|
|
109
|
-
buttonLink:
|
|
116
|
+
buttonLink: n(
|
|
110
117
|
t.getAttribute("data-product_button_link"),
|
|
111
118
|
i.productButtonLinkControlValue
|
|
112
119
|
),
|
|
113
|
-
imageLink:
|
|
120
|
+
imageLink: n(
|
|
114
121
|
t.getAttribute("data-product_image_link"),
|
|
115
122
|
i.productImageLinkControlValue
|
|
116
123
|
),
|
|
117
|
-
buttonLabel:
|
|
124
|
+
buttonLabel: n(
|
|
118
125
|
t.getAttribute("data-product_button_control_label"),
|
|
119
126
|
"Buy"
|
|
120
127
|
),
|
|
@@ -149,7 +156,7 @@ function C(r) {
|
|
|
149
156
|
)
|
|
150
157
|
};
|
|
151
158
|
}
|
|
152
|
-
function
|
|
159
|
+
function C(r) {
|
|
153
160
|
if (typeof r.getAttribute != "function")
|
|
154
161
|
return null;
|
|
155
162
|
const t = r.getAttribute("esd-ext-config");
|
|
@@ -163,31 +170,32 @@ function I(r) {
|
|
|
163
170
|
}
|
|
164
171
|
return null;
|
|
165
172
|
}
|
|
166
|
-
function
|
|
167
|
-
const t =
|
|
173
|
+
function V(r) {
|
|
174
|
+
const t = g(r);
|
|
168
175
|
if (!t)
|
|
169
176
|
return null;
|
|
170
177
|
const e = t.getNodeConfig();
|
|
171
178
|
if (e && e.initialized)
|
|
172
179
|
return e;
|
|
180
|
+
const n = C(t);
|
|
181
|
+
if (n)
|
|
182
|
+
return n;
|
|
173
183
|
const o = I(t);
|
|
174
|
-
|
|
175
|
-
return o;
|
|
176
|
-
const c = C(t);
|
|
177
|
-
return c || null;
|
|
184
|
+
return o || null;
|
|
178
185
|
}
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
186
|
+
function M(r, t, e, n) {
|
|
187
|
+
const o = g(r);
|
|
188
|
+
if (!o)
|
|
182
189
|
return;
|
|
183
|
-
const d = { ...
|
|
184
|
-
l.modifyHtml(
|
|
190
|
+
const d = { ...o.getNodeConfig() || {}, ...e }, l = n ?? t.getDocumentModifier();
|
|
191
|
+
l.modifyHtml(o).setNodeConfig(d), n || l.apply(new b("Update Items block configuration"));
|
|
185
192
|
}
|
|
186
193
|
export {
|
|
187
|
-
|
|
194
|
+
y as deriveItemNumber,
|
|
195
|
+
S as escapeReplacement,
|
|
188
196
|
_ as generateBlockInstanceId,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
A as getDefaultItemsBlockConfig,
|
|
198
|
+
V as getItemsBlockConfig,
|
|
199
|
+
g as getItemsBlockContainer,
|
|
200
|
+
M as setItemsBlockConfig
|
|
193
201
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useToaster as
|
|
1
|
+
import { useToaster as r } from "../../../composables/useToaster.js";
|
|
2
2
|
import { useTranslations as s } from "../../../composables/useTranslations.js";
|
|
3
|
-
import { ToasterTypeOptions as
|
|
3
|
+
import { ToasterTypeOptions as n } from "../../../enums/toaster.js";
|
|
4
4
|
import { countLiveRecommendationBlocks as i } from "./utils/recommendationBlockCount.js";
|
|
5
|
-
const
|
|
6
|
-
const { showToaster: o } =
|
|
5
|
+
const a = "newsletter.multiple-reco-blocks-warning", f = () => {
|
|
6
|
+
const { showToaster: o } = r(), t = s();
|
|
7
7
|
return { warnIfMultipleBlocks: (e) => {
|
|
8
8
|
i(e) > 1 && o({
|
|
9
|
-
type:
|
|
10
|
-
message: t(
|
|
9
|
+
type: n.Dark,
|
|
10
|
+
message: t(a)
|
|
11
11
|
});
|
|
12
12
|
} };
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
f as useRecommendationBlockWarning
|
|
16
16
|
};
|
|
@@ -4,12 +4,11 @@ import { useToaster as C } from "../composables/useToaster.js";
|
|
|
4
4
|
import { useTranslations as h } from "../composables/useTranslations.js";
|
|
5
5
|
import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
|
|
6
6
|
import { EditorType as v } from "../enums/defaults.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useSaveAsTemplateStore as A } from "../stores/save-as-template.js";
|
|
7
|
+
import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
|
|
10
9
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
11
|
-
import { useTemplatePreparation as
|
|
12
|
-
const
|
|
10
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
11
|
+
const $ = () => {
|
|
13
12
|
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
|
|
14
13
|
return {
|
|
15
14
|
getCategories: async () => {
|
|
@@ -40,7 +39,7 @@ const j = () => {
|
|
|
40
39
|
createTemplate: async () => {
|
|
41
40
|
var e, t, d, y;
|
|
42
41
|
try {
|
|
43
|
-
const { prepareTemplateDetails: i } =
|
|
42
|
+
const { prepareTemplateDetails: i } = A(), s = x(), a = await i();
|
|
44
43
|
if (p("liquidSyntax") && !await g(a.compiledHtml))
|
|
45
44
|
return !1;
|
|
46
45
|
const f = {
|
|
@@ -54,7 +53,7 @@ const j = () => {
|
|
|
54
53
|
unsubscriptionPreferencePageStatus: !1,
|
|
55
54
|
unsubscriptionPreferencePages: [],
|
|
56
55
|
recommendationCampaignUrls: r(
|
|
57
|
-
|
|
56
|
+
N().recommendationCampaignUrls
|
|
58
57
|
),
|
|
59
58
|
recommendationConfigs: r({}),
|
|
60
59
|
isGuido: !0,
|
|
@@ -75,7 +74,7 @@ const j = () => {
|
|
|
75
74
|
"newsletter.template-library-save-alert",
|
|
76
75
|
{ templateName: s.getTemplateName }
|
|
77
76
|
),
|
|
78
|
-
type:
|
|
77
|
+
type: "alert"
|
|
79
78
|
}), !1) : (l({
|
|
80
79
|
message: u(
|
|
81
80
|
"newsletter.template-library-save-success",
|
|
@@ -90,5 +89,5 @@ const j = () => {
|
|
|
90
89
|
};
|
|
91
90
|
};
|
|
92
91
|
export {
|
|
93
|
-
|
|
92
|
+
$ as useTemplateLibraryApi
|
|
94
93
|
};
|
|
@@ -33,4 +33,13 @@ export declare class ItemsBlock extends Block {
|
|
|
33
33
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
34
34
|
*/
|
|
35
35
|
onDocumentChanged(node: ImmutableHtmlNode): void;
|
|
36
|
+
/**
|
|
37
|
+
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
|
|
38
|
+
* `.ins-product-td` container from the recovered config. Required for saved modules:
|
|
39
|
+
* `migrate()` (which backfills these) only runs at template load — never when a module
|
|
40
|
+
* is dropped into a live editor — so this is the one place the namespace + index get
|
|
41
|
+
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
42
|
+
* relies on this td-level fallback in pairProductVariables.
|
|
43
|
+
*/
|
|
44
|
+
private _stampProductTdDomAttributes;
|
|
36
45
|
}
|
|
@@ -3,6 +3,13 @@ declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
|
|
|
3
3
|
type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
|
|
4
4
|
type OrientationType = 'vertical' | 'horizontal';
|
|
5
5
|
type PriceOrientationType = 'vertical' | 'horizontal';
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a bare migrate-block `<td>` in a `<tr>` so it forms a valid table row.
|
|
8
|
+
* Stripo renders its `BlockType.*` tags as full rows, so both the migrate template
|
|
9
|
+
* (here) and the orientation-change rebuild (settingsControl._reOrderTemplate) must
|
|
10
|
+
* emit `<tr><td>` — otherwise the code editor flags the bare cell as invalid.
|
|
11
|
+
*/
|
|
12
|
+
export declare const wrapInTableRow: (html: string) => string;
|
|
6
13
|
type TemplateParameters = {
|
|
7
14
|
orientation: OrientationType;
|
|
8
15
|
itemsType: ProductType;
|
|
@@ -40,6 +40,18 @@ export declare function generateBlockInstanceId(): string;
|
|
|
40
40
|
* Prevents currency symbols like "$", "R$", "HK$" from being interpreted as special replacement patterns.
|
|
41
41
|
*/
|
|
42
42
|
export declare const escapeReplacement: (str: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Derives a card's 1-based product index from its `itemsSelectValue`.
|
|
45
|
+
* Prefers the position within ItemInCartOptions for the type; falls back to the
|
|
46
|
+
* `(N)` token in the value (e.g. "{{Browsed Item (3) Url}}" -> "3"); defaults to "1".
|
|
47
|
+
*
|
|
48
|
+
* Single source of truth so block.ts, settingsControl and template.ts stay in sync —
|
|
49
|
+
* the number feeds `data-number`, which pairProductVariables reads to index merge tags.
|
|
50
|
+
*
|
|
51
|
+
* `itemsSelectValue` is typed loosely because callers pass it straight from parsed
|
|
52
|
+
* configs where the field can be absent — the runtime guard below is load-bearing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveItemNumber(itemsSelectValue: string | undefined, itemsType: ProductType): string;
|
|
43
55
|
/**
|
|
44
56
|
* Returns default ItemsBlockConfig values.
|
|
45
57
|
* These are used when initializing a new block or when migrating from legacy format.
|
|
@@ -4,14 +4,15 @@ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToas
|
|
|
4
4
|
status: boolean;
|
|
5
5
|
type: import("@@/Types/toaster").ToasterType;
|
|
6
6
|
text: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
withIcon: boolean;
|
|
7
9
|
withoutLeftMargin: boolean;
|
|
8
|
-
autoHide: boolean;
|
|
9
10
|
actionButton?: {
|
|
10
11
|
text: string;
|
|
11
12
|
onClick: () => void;
|
|
12
13
|
} | undefined;
|
|
13
14
|
} & import("pinia").PiniaCustomStateProperties<ToasterState>) => boolean;
|
|
14
15
|
}, {
|
|
15
|
-
showToaster(this: ToasterState, { type, message, actionButton
|
|
16
|
+
showToaster(this: ToasterState, { type, message, actionButton }: ToasterOptions): void;
|
|
16
17
|
hideToaster(this: ToasterState): void;
|
|
17
18
|
}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const n = `ue-notifications-container {
|
|
2
|
+
left: 96px;
|
|
3
|
+
margin: 0;
|
|
4
|
+
bottom: 32px;
|
|
5
|
+
top: unset;
|
|
6
|
+
width: unset;
|
|
7
|
+
position: fixed;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
ue-notifications-container ue-message + ue-message {
|
|
11
|
+
margin-bottom: 24px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
ue-notifications-container .alert-message-wrapper {
|
|
15
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
16
|
+
border: none;
|
|
17
|
+
padding: 16px 24px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ue-notifications-container .alert-message-wrapper.info,
|
|
21
|
+
ue-notifications-container .alert-message-wrapper.loader {
|
|
22
|
+
background-color: var(--guido-color-background-toaster-info) !important;
|
|
23
|
+
color: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.alert-message-wrapper .alert-message-main {
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ue-notifications-container ue-caption .caption {
|
|
31
|
+
color: var(--guido-color-white) !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ue-block-thumb-hint {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
|
|
39
|
+
width: calc(100% - 64px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
|
|
43
|
+
font-size: 15px;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ue-notifications-container .alert-message-text,
|
|
48
|
+
ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
|
|
49
|
+
ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
|
|
50
|
+
color: var(--guido-color-white);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ue-notifications-container ue-message ue-button.close {
|
|
54
|
+
margin: 0 0 0 16px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ue-notifications-container .alert-message-wrapper.success {
|
|
58
|
+
background: var(--guido-color-background-toaster-success);
|
|
59
|
+
color: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ue-notifications-container .alert-message-wrapper.error {
|
|
63
|
+
background: var(--guido-color-background-toaster-error);
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ue-notifications-container .alert-message-wrapper.warn {
|
|
68
|
+
background: var(--guido-color-background-toaster-warn);
|
|
69
|
+
color: inherit;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
export {
|
|
73
|
+
n as default
|
|
74
|
+
};
|
package/dist/stores/toaster.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ToasterTypeOptions as e } from "../enums/toaster.js";
|
|
2
|
-
import { defineStore as
|
|
3
|
-
const
|
|
2
|
+
import { defineStore as i } from "pinia";
|
|
3
|
+
const a = () => ({
|
|
4
4
|
status: !1,
|
|
5
5
|
type: e.Success,
|
|
6
6
|
text: "",
|
|
7
|
+
icon: "",
|
|
8
|
+
withIcon: !0,
|
|
7
9
|
withoutLeftMargin: !1,
|
|
8
|
-
autoHide: !0,
|
|
9
10
|
actionButton: void 0
|
|
10
|
-
}),
|
|
11
|
-
state: () =>
|
|
11
|
+
}), n = i("guidoToaster", {
|
|
12
|
+
state: () => a(),
|
|
12
13
|
getters: {
|
|
13
|
-
|
|
14
|
-
shouldAutoHide: (t) => t.status && !!t.text && t.autoHide
|
|
14
|
+
shouldAutoHide: (t) => t.status && !!t.text
|
|
15
15
|
},
|
|
16
16
|
actions: {
|
|
17
|
-
showToaster({ type: t = e.Success, message: s, actionButton: o
|
|
18
|
-
this.status = !0, this.text = s, this.type = t, this.actionButton = o
|
|
17
|
+
showToaster({ type: t = e.Success, message: s, actionButton: o }) {
|
|
18
|
+
this.status = !0, this.text = s, this.type = t, this.actionButton = o;
|
|
19
19
|
},
|
|
20
20
|
hideToaster() {
|
|
21
21
|
this.status = !1;
|
|
@@ -23,5 +23,5 @@ const u = () => ({
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
n as useToasterStore
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.c84fcd0",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@stripoinc/ui-editor-extensions": "3.8.0",
|
|
40
|
-
"@useinsider/design-system-vue": "1.
|
|
40
|
+
"@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
|
|
41
41
|
"@vueuse/core": "11.3.0",
|
|
42
42
|
"lodash-es": "4.17.21",
|
|
43
43
|
"pinia": "2.3.1",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useToaster as d } from "./useToaster.js";
|
|
2
|
-
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
3
|
-
const g = () => {
|
|
4
|
-
const { showToaster: l, hideToaster: u } = d();
|
|
5
|
-
let s = null;
|
|
6
|
-
const n = (o, t, i, e, f = !0) => {
|
|
7
|
-
s = i;
|
|
8
|
-
const r = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
|
|
9
|
-
l({ type: o, message: t, actionButton: r, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
|
|
10
|
-
};
|
|
11
|
-
return { getStripoNotifications: () => ({
|
|
12
|
-
info: (o, t, i) => n(c.Info, o, t, i),
|
|
13
|
-
success: (o, t, i) => n(c.Success, o, t, i),
|
|
14
|
-
warn: (o, t, i) => n(c.Warning, o, t, i),
|
|
15
|
-
error: (o, t, i) => n(c.Alert, o, t, i),
|
|
16
|
-
// A loader marks an in-progress operation; Stripo dismisses it via hide(id)
|
|
17
|
-
// when finished, so it must not auto-hide.
|
|
18
|
-
loader: (o, t, i) => n(c.Info, o, t, i, !1),
|
|
19
|
-
hide: (o) => {
|
|
20
|
-
s === o && (u(), s = null);
|
|
21
|
-
}
|
|
22
|
-
}) };
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
g as useStripoNotifications
|
|
26
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StripoNotifications } from '@@/Types/stripo';
|
|
2
|
-
/**
|
|
3
|
-
* Adapter that routes Stripo's in-editor notifications through Guido's own
|
|
4
|
-
* InToasts-based toaster, so the editor only ever shows one toaster style.
|
|
5
|
-
* Passed to `initEditor` as the `notifications` config (Stripo then delegates
|
|
6
|
-
* rendering to us instead of drawing its native <ue-notifications-container>).
|
|
7
|
-
*/
|
|
8
|
-
export declare const useStripoNotifications: () => {
|
|
9
|
-
getStripoNotifications: () => StripoNotifications;
|
|
10
|
-
};
|