@useinsider/guido 3.16.0-beta.efbb91f → 3.16.0-beta.fe1df65

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.
Files changed (81) hide show
  1. package/dist/components/Guido.vue.js +8 -8
  2. package/dist/components/Guido.vue2.js +76 -78
  3. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  4. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  5. package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +23 -45
  8. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  9. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  10. package/dist/composables/useHtmlValidator.js +0 -1
  11. package/dist/composables/useRecommendation.js +20 -19
  12. package/dist/composables/useSave.js +41 -84
  13. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  14. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  15. package/dist/config/migrator/index.js +9 -8
  16. package/dist/config/migrator/itemsBlockMigrator.js +1 -1
  17. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  18. package/dist/config/migrator/recommendation/extractors.js +29 -24
  19. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  20. package/dist/config/migrator/recommendationMigrator.js +18 -15
  21. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  22. package/dist/enums/recommendation.js +17 -17
  23. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
  24. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  25. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +23 -22
  27. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +29 -26
  28. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
  29. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
  30. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +29 -28
  31. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  32. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  33. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  34. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  35. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -32
  36. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  37. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  38. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  39. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  40. package/dist/guido.css +1 -1
  41. package/dist/src/components/Guido.vue.d.ts +1 -17
  42. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  43. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  44. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  45. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  46. package/dist/src/composables/useHtmlValidator.d.ts +0 -14
  47. package/dist/src/composables/useSave.d.ts +1 -6
  48. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  49. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  50. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  51. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +1 -0
  52. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  53. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  54. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  55. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
  58. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  60. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  61. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  62. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  63. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  64. package/dist/src/stores/config.d.ts +0 -5
  65. package/dist/src/utils/templatePreparation.d.ts +0 -30
  66. package/dist/static/styles/customEditorStyle.css.js +3 -1
  67. package/dist/stores/config.js +6 -13
  68. package/dist/utils/templatePreparation.js +25 -28
  69. package/package.json +1 -1
  70. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  71. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -61
  72. package/dist/composables/useSaveValidation.js +0 -276
  73. package/dist/composables/useSaveValidationRollout.js +0 -9
  74. package/dist/enums/save-validation.js +0 -4
  75. package/dist/src/@types/save-validation.d.ts +0 -19
  76. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  77. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  78. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  79. package/dist/src/enums/save-validation.d.ts +0 -27
  80. package/dist/src/stores/save-validation.d.ts +0 -22
  81. package/dist/stores/save-validation.js +0 -30
@@ -1,276 +0,0 @@
1
- import { getIgnoredRecommendationBlockIds as B } from "../config/compiler/utils/recommendationIgnoreUtils.js";
2
- import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as Y, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
3
- import { SaveValidationRule as o } from "../enums/save-validation.js";
4
- import { ToasterTypeOptions as r } from "../enums/toaster.js";
5
- import { BLOCK_ROOT_SELECTOR as U } from "../extensions/Blocks/Checkbox/constants/selectors.js";
6
- import { itemsBlockDynamicVariables as M } from "../extensions/Blocks/Items/enums/productEnums.js";
7
- import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
- import { useRecommendationExtensionStore as W } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { RecommendationRequiredFieldsKey as G } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
- import { useConfigStore as q } from "../stores/config.js";
11
- import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
12
- import { useRecommendationStore as V } from "../stores/recommendation.js";
13
- import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
14
- import { useTemplatePreparation as X } from "../utils/templatePreparation.js";
15
- import { useActionsApi as j } from "./useActionsApi.js";
16
- import { useConfig as z } from "./useConfig.js";
17
- import { useHtmlCompiler as $ } from "./useHtmlCompiler.js";
18
- import { buildPartnerAttributeNameSet as Q, getInvalidDynamicContentTags as Z, findInvalidCustomFields as J } from "./useHtmlValidator.js";
19
- import { useHttp as tt } from "./useHttp.js";
20
- import { useTranslations as et } from "./useTranslations.js";
21
- import { findInvalidCouponBlocks as nt, COUPON_TAG_MODIFIED_KEY as it } from "./validators/useCouponBlockValidator.js";
22
- import { findDuplicateUnsubPageTypes as ot, countUnsubBlocksWithoutPage as rt, EMPTY_BLOCK_KEY as st } from "./validators/useUnsubscribeBlockValidator.js";
23
- const at = "newsletter.html-content-is-empty", ct = "custom-fields.missing-closing-braces", lt = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", ut = "newsletter.display-conditions-invalid-syntax", mt = "custom-conditions.wrong-equality-operators", dt = "custom-conditions.missing-if-endif-tag", pt = "custom-conditions.no-space-after-braces", gt = "custom-conditions.no-braces-inside-if-tag", ft = "newsletter.fill-all-necessary-fields", yt = "newsletter.invalid-image-type", Et = "unsubscribe-templates.select-checkbox-groups", It = "unsubscribe-templates.select-radio-button-groups", St = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Ct = "/newsletter/template-library/check-template-html-body", _t = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, ht = ["if", "endif", "else", "elif", "now"], kt = (e) => !ht.includes(e.toLowerCase()), Tt = (e) => ["if", "endif"].includes(e.toLowerCase());
24
- function Ft(e) {
25
- return nt(e).map((i) => ({
26
- rule: o.CouponTagModified,
27
- type: r.Warning,
28
- key: it,
29
- detail: i
30
- }));
31
- }
32
- function Ot(e) {
33
- return ot(e).map((i) => ({
34
- rule: o.DuplicateUnsubBlock,
35
- type: r.Error,
36
- key: i.messageKey
37
- }));
38
- }
39
- function Lt(e) {
40
- return Array.from({ length: rt(e) }, () => ({
41
- rule: o.UnsubBlockMissingTemplate,
42
- type: r.Warning,
43
- key: st
44
- }));
45
- }
46
- function Nt(e, i) {
47
- const n = e.match(L);
48
- if (!n)
49
- return [];
50
- const a = [];
51
- return n.forEach((u) => {
52
- const s = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
53
- if (s && s.length > 0) {
54
- const [m] = s;
55
- kt(m) && !i.includes(m) && a.push({
56
- rule: o.CustomFieldScript,
57
- type: r.Warning,
58
- key: I,
59
- detail: m
60
- });
61
- }
62
- }), a;
63
- }
64
- function Rt(e) {
65
- return e.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: at }];
66
- }
67
- function At(e) {
68
- const i = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
69
- return i > n ? [{
70
- rule: o.MismatchedBraces,
71
- type: r.Warning,
72
- key: ct
73
- }] : i < n ? [{
74
- rule: o.MismatchedBraces,
75
- type: r.Warning,
76
- key: lt
77
- }] : [];
78
- }
79
- function bt(e) {
80
- return Z(e).map((i) => ({
81
- rule: o.InvalidDynamicTag,
82
- type: r.Warning,
83
- key: I,
84
- detail: i
85
- }));
86
- }
87
- function Dt(e, i, n, a) {
88
- const u = [...e.matchAll(/recommendation-id="(\d+)"/g)].map((s) => s[1]);
89
- return J(e, i, u, n, a).map((s) => ({
90
- rule: o.InvalidCustomField,
91
- type: r.Error,
92
- key: I,
93
- detail: s
94
- }));
95
- }
96
- function vt(e) {
97
- const i = e.match(/{%(.*?)%}/g), n = [], a = [];
98
- if (i && i.forEach((u) => {
99
- const s = u.match(Y), m = u.match(x), y = (s == null ? void 0 : s.join("")) || "";
100
- (!s || u !== y) && !m && a.push({
101
- rule: o.ConditionsSyntax,
102
- type: r.Error,
103
- key: ut,
104
- detail: u
105
- }), s && s.forEach((g) => {
106
- g.trim() === "=" && a.push({
107
- rule: o.WrongEqualityOperator,
108
- type: r.Error,
109
- key: mt
110
- }), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
111
- Tt(f) && n.push(f);
112
- });
113
- });
114
- }), n.length) {
115
- const u = n.filter((m) => m === "if").length, s = n.filter((m) => m === "endif").length;
116
- u !== s && a.push({
117
- rule: o.MissingIfEndif,
118
- type: r.Error,
119
- key: dt
120
- });
121
- }
122
- return a;
123
- }
124
- function Kt(e) {
125
- const i = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length;
126
- return i === n ? [] : [{
127
- rule: o.ConditionTagSpacing,
128
- type: r.Warning,
129
- key: pt
130
- }];
131
- }
132
- function wt(e) {
133
- return (e.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, a) => n + a, 0) === 0 ? [] : [{
134
- rule: o.BracesInsideIfTag,
135
- type: r.Warning,
136
- key: gt
137
- }];
138
- }
139
- function Bt(e) {
140
- return (e.match(_t) ?? []).map((i) => ({
141
- rule: o.InvalidImageType,
142
- type: r.Error,
143
- key: yt,
144
- detail: i
145
- }));
146
- }
147
- function O(e, i, n, a) {
148
- const u = new DOMParser().parseFromString(e, "text/html");
149
- return Array.from(u.querySelectorAll(i)).filter((s) => {
150
- var m;
151
- return !((m = s.id) != null && m.trim());
152
- }).map(() => ({ rule: n, type: r.Error, key: a }));
153
- }
154
- const se = () => {
155
- const { config: e, isFeatureEnabled: i } = z(), n = et(), { post: a } = tt(), { getCompiledEmail: u, getTemplateData: s } = j(), { compileHtml: m } = $(), { hydrateRecommendationStore: y } = X(), g = H(), f = V(), E = W(), N = q(), R = (t) => ({
156
- rule: t.rule,
157
- type: t.type,
158
- detail: t.detail,
159
- message: "key" in t ? n(t.key) : t.message
160
- }), A = async (t) => {
161
- if (t.size === 0)
162
- return /* @__PURE__ */ new Set();
163
- try {
164
- await E.fetchRecommendationFilters();
165
- } catch {
166
- return null;
167
- }
168
- return Q(E.filterList);
169
- }, b = async (t) => {
170
- try {
171
- const l = await a(Ct, { html: T(t) }), { status: c, message: d } = l.data, p = [];
172
- return c || p.push({
173
- rule: o.InvalidLinks,
174
- type: r.Error,
175
- ...c === void 0 ? { message: d } : { key: St }
176
- }), d === n(k) && p.push({
177
- rule: o.LinkCheckInProgress,
178
- type: r.Error,
179
- key: k
180
- }), p;
181
- } catch (l) {
182
- return console.warn("Link-check collector failed; skipping the link rule.", l), [];
183
- }
184
- }, D = async (t) => {
185
- try {
186
- const l = await a("/newsletter/contents/validate-syntax", [{
187
- identifier: "default",
188
- syntax: "liquid",
189
- contents: {
190
- subject: null,
191
- preheader: null,
192
- html: T(t),
193
- ampHtml: null
194
- }
195
- }]);
196
- if (!Array.isArray(l.data)) {
197
- const d = l.data;
198
- return [{
199
- rule: o.LiquidSyntax,
200
- type: r.Warning,
201
- message: d.message ?? n(F)
202
- }];
203
- }
204
- const [c] = l.data;
205
- return Object.values((c == null ? void 0 : c.errors) ?? {}).map((d) => ({
206
- rule: o.LiquidSyntax,
207
- type: r.Warning,
208
- message: d.replace(/^line \d+:\s*/, "")
209
- }));
210
- } catch {
211
- return [{
212
- rule: o.LiquidSyntax,
213
- type: r.Error,
214
- message: n(F)
215
- }];
216
- }
217
- }, v = () => {
218
- const t = E.invalidBlockIds().map((c) => ({
219
- rule: o.RecommendationRequiredFields,
220
- type: r.Error,
221
- key: G,
222
- detail: c
223
- })), l = (f.recommendationConfigs ?? []).filter((c) => c.filters.some((d) => d.value === "")).map(() => ({
224
- rule: o.RecommendationFilters,
225
- type: r.Error,
226
- key: ft
227
- }));
228
- return [...t, ...l];
229
- }, K = async (t, l) => {
230
- var _, h;
231
- const c = [
232
- ...l.map((w) => w.value),
233
- ...M,
234
- ...((h = (_ = e.value) == null ? void 0 : _.template) == null ? void 0 : h.customFieldAttributes) ?? []
235
- ], d = B(t), p = await A(d), { isTransactional: C } = N;
236
- return [
237
- ...await b(t),
238
- ...C ? [] : Nt(t, c),
239
- ...Rt(t),
240
- ...At(t),
241
- ...bt(t),
242
- ...C ? [] : Dt(t, c, d, p),
243
- ...vt(t),
244
- ...Kt(t),
245
- ...wt(t),
246
- ...v(),
247
- ...Bt(t),
248
- ...O(
249
- t,
250
- U,
251
- o.CheckboxUnsubGroup,
252
- Et
253
- ),
254
- ...O(
255
- t,
256
- P,
257
- o.RadioButtonUnsubGroup,
258
- It
259
- )
260
- ];
261
- }, S = async (t, l) => [
262
- ...Ft(t),
263
- ...Ot(t),
264
- ...Lt(t),
265
- ...i("liquidSyntax") ? await D(t) : await K(t, l)
266
- ].map(R);
267
- return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
268
- const { html: t } = await s();
269
- await y(t);
270
- const { html: l } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: c } = m(l);
271
- return S(c, g.getSelectedDynamicContentList);
272
- } };
273
- };
274
- export {
275
- se as useSaveValidation
276
- };
@@ -1,9 +0,0 @@
1
- import { useConfigStore as t } from "../stores/config.js";
2
- import { computed as o } from "vue";
3
- const n = ["newsletteruatcamp", "newsletterqacamp"], c = () => {
4
- const e = t();
5
- return { isEnabled: o(() => n.includes(e.partnerName)) };
6
- };
7
- export {
8
- c as useSaveValidationRollout
9
- };
@@ -1,4 +0,0 @@
1
- var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
2
- export {
3
- n as SaveValidationRule
4
- };
@@ -1,19 +0,0 @@
1
- import type { SaveValidationRule } from '@@/Enums/save-validation';
2
- import type { ToasterTypeOptions } from '@@/Enums/toaster';
3
- /** Which action triggered the validation run. Drives telemetry only in v1. */
4
- export type SaveValidationIntent = 'save' | 'back' | 'test';
5
- /**
6
- * A single validation failure instance, one per drawer row. Names avoid the
7
- * public `ValidationError` (config validation) collision — NOT exported from
8
- * library.ts.
9
- */
10
- export interface SaveValidationError {
11
- /** Stable discriminator for tests and de-duplication. */
12
- rule: SaveValidationRule;
13
- /** Final translated string — trans() is applied at collect time. */
14
- message: string;
15
- /** Raw user content (field name / tag / src) — not i18n. */
16
- detail?: string;
17
- /** Mirrors the legacy toaster severity. Kept for the discriminator/tests; the drawer renders a uniform icon and never reads it. */
18
- type: ToasterTypeOptions;
19
- }
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,6 +0,0 @@
1
- import type { DynamicContent } from '@@/Types/generic';
2
- import type { SaveValidationError } from '@@/Types/save-validation';
3
- export declare const useSaveValidation: () => {
4
- collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]) => Promise<SaveValidationError[]>;
5
- validateCurrentTemplate: () => Promise<SaveValidationError[]>;
6
- };
@@ -1,3 +0,0 @@
1
- export declare const useSaveValidationRollout: () => {
2
- isEnabled: import("vue").ComputedRef<boolean>;
3
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * Stable discriminators for each save-validation rule site — one per rule that
3
- * can produce a drawer row, kept in sync with the collector + legacy validator chains.
4
- */
5
- export declare enum SaveValidationRule {
6
- CouponTagModified = "coupon-tag-modified",
7
- DuplicateUnsubBlock = "duplicate-unsub-block",
8
- UnsubBlockMissingTemplate = "unsub-block-missing-template",
9
- LiquidSyntax = "liquid-syntax",
10
- InvalidLinks = "invalid-links",
11
- LinkCheckInProgress = "link-check-in-progress",
12
- CustomFieldScript = "custom-field-script",
13
- EmptyHtml = "empty-html",
14
- MismatchedBraces = "mismatched-braces",
15
- InvalidDynamicTag = "invalid-dynamic-tag",
16
- InvalidCustomField = "invalid-custom-field",
17
- ConditionsSyntax = "conditions-syntax",
18
- WrongEqualityOperator = "wrong-equality-operator",
19
- MissingIfEndif = "missing-if-endif",
20
- ConditionTagSpacing = "condition-tag-spacing",
21
- BracesInsideIfTag = "braces-inside-if-tag",
22
- RecommendationRequiredFields = "recommendation-required-fields",
23
- RecommendationFilters = "recommendation-filters",
24
- InvalidImageType = "invalid-image-type",
25
- CheckboxUnsubGroup = "checkbox-unsub-group",
26
- RadioButtonUnsubGroup = "radio-button-unsub-group"
27
- }
@@ -1,22 +0,0 @@
1
- import type { SaveValidationError, SaveValidationIntent } from '@@/Types/save-validation';
2
- interface SaveValidationState {
3
- errors: SaveValidationError[];
4
- isDrawerOpen: boolean;
5
- intent: SaveValidationIntent | null;
6
- }
7
- export declare const useSaveValidationStore: import("pinia").StoreDefinition<"guidoSaveValidation", SaveValidationState, {
8
- errorCount: (state: {
9
- errors: {
10
- rule: import("../enums/save-validation").SaveValidationRule;
11
- message: string;
12
- detail?: string | undefined;
13
- type: import("../enums/toaster").ToasterTypeOptions;
14
- }[];
15
- isDrawerOpen: boolean;
16
- intent: SaveValidationIntent | null;
17
- } & import("pinia").PiniaCustomStateProperties<SaveValidationState>) => number;
18
- }, {
19
- open(errors: SaveValidationError[], intent: SaveValidationIntent): void;
20
- close(): void;
21
- }>;
22
- export {};
@@ -1,30 +0,0 @@
1
- import { defineStore as n } from "pinia";
2
- function i(e) {
3
- const t = /* @__PURE__ */ new Set();
4
- return e.filter((r) => {
5
- const s = JSON.stringify([r.message, r.detail ?? ""]);
6
- return t.has(s) ? !1 : (t.add(s), !0);
7
- });
8
- }
9
- const o = n("guidoSaveValidation", {
10
- state: () => ({
11
- errors: [],
12
- isDrawerOpen: !1,
13
- intent: null
14
- }),
15
- getters: {
16
- errorCount: (e) => e.errors.length
17
- },
18
- actions: {
19
- open(e, t) {
20
- this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
21
- },
22
- // Errors are retained so rows don't blank during the ~300ms close animation.
23
- close() {
24
- this.isDrawerOpen = !1;
25
- }
26
- }
27
- });
28
- export {
29
- o as useSaveValidationStore
30
- };