@useinsider/guido 3.21.2-beta.4b0fed7 → 3.21.2-beta.928b4a8
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/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
- package/dist/config/migrator/recommendation/compositionMapper.js +49 -56
- package/dist/config/migrator/recommendation/extractors.js +29 -68
- package/dist/config/migrator/recommendation/htmlBuilder.js +200 -283
- package/dist/config/migrator/recommendation/settingsMapper.js +32 -35
- package/dist/config/migrator/recommendationMigrator.js +29 -32
- package/dist/extensions/Blocks/Recommendation/block.js +24 -33
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +162 -146
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +1 -3
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -20
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -3
- package/dist/src/stores/unsubscribe.d.ts +10 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/stores/unsubscribe.js +28 -24
- package/dist/utils/pairProductVariables.js +98 -90
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +1 -1
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { useActionsApi as h } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as S } from "../composables/useConfig.js";
|
|
3
|
+
import { useHttp as v } from "../composables/useHttp.js";
|
|
4
|
+
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as A } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
|
+
import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
|
|
8
|
+
import { EditorType as H } from "../enums/defaults.js";
|
|
9
|
+
import { ToasterTypeOptions as P } from "../enums/toaster.js";
|
|
10
|
+
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
|
|
10
12
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { useTemplatePreparation as
|
|
13
|
-
const
|
|
14
|
-
const { get: n, post: m } =
|
|
13
|
+
import { isPlainObject as q } from "../utils/genericUtil.js";
|
|
14
|
+
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
|
+
const Z = () => {
|
|
16
|
+
const { get: n, post: m } = v(), { handleError: s, showToaster: l } = x(), { config: c, isFeatureEnabled: p } = S(), { validateLiquidSyntax: T } = N(), { validateSingleHtmlDocument: w } = E(), { getTemplateData: b } = h(), u = A();
|
|
15
17
|
return {
|
|
16
18
|
getCategories: async () => {
|
|
17
19
|
try {
|
|
18
20
|
const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
|
|
19
21
|
return e;
|
|
20
22
|
} catch (e) {
|
|
21
|
-
return
|
|
23
|
+
return s(e, "Failed to fetch template categories"), [];
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
26
|
checkTemplateNameAvailability: async (e) => {
|
|
@@ -35,27 +37,30 @@ const B = () => {
|
|
|
35
37
|
);
|
|
36
38
|
return t.toString();
|
|
37
39
|
} catch (t) {
|
|
38
|
-
return
|
|
40
|
+
return s(t, "Failed to create category"), "";
|
|
39
41
|
}
|
|
40
42
|
},
|
|
41
43
|
createTemplate: async () => {
|
|
42
44
|
var e, t, d, y;
|
|
43
45
|
try {
|
|
44
|
-
const { prepareTemplateDetails: i } =
|
|
45
|
-
if (
|
|
46
|
+
const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
|
|
47
|
+
if (!w(g.html))
|
|
46
48
|
return !1;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const a = await i(g);
|
|
50
|
+
if (p("liquidSyntax") && !await T(a.compiledHtml))
|
|
51
|
+
return !1;
|
|
52
|
+
const C = {
|
|
53
|
+
name: o.getTemplateName,
|
|
54
|
+
categories: o.getSelectedCategoryIds,
|
|
50
55
|
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
51
|
-
editorType:
|
|
56
|
+
editorType: H,
|
|
52
57
|
messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
53
58
|
content: r(a.compiledHtml),
|
|
54
59
|
css: r(a.css),
|
|
55
60
|
unsubscriptionPreferencePageStatus: !1,
|
|
56
61
|
unsubscriptionPreferencePages: [],
|
|
57
62
|
recommendationCampaignUrls: r(
|
|
58
|
-
|
|
63
|
+
D().recommendationCampaignUrls
|
|
59
64
|
),
|
|
60
65
|
recommendationConfigs: r({}),
|
|
61
66
|
isGuido: !0,
|
|
@@ -67,31 +72,31 @@ const B = () => {
|
|
|
67
72
|
css: a.css,
|
|
68
73
|
dynamicContentList: a.dynamicContentList
|
|
69
74
|
})
|
|
70
|
-
}, { data:
|
|
75
|
+
}, { data: f } = await m(
|
|
71
76
|
"/newsletter/template-library/create-template",
|
|
72
|
-
|
|
77
|
+
C
|
|
73
78
|
);
|
|
74
|
-
if (!
|
|
79
|
+
if (!q(f))
|
|
75
80
|
throw new Error("Unexpected create-template response");
|
|
76
|
-
return
|
|
81
|
+
return f.type === "alert" ? (l({
|
|
77
82
|
message: u(
|
|
78
83
|
"newsletter.template-library-save-alert",
|
|
79
|
-
{ templateName:
|
|
84
|
+
{ templateName: o.getTemplateName }
|
|
80
85
|
),
|
|
81
|
-
type:
|
|
86
|
+
type: P.Error
|
|
82
87
|
}), !1) : (l({
|
|
83
88
|
message: u(
|
|
84
89
|
"newsletter.template-library-save-success",
|
|
85
|
-
{ templateName:
|
|
90
|
+
{ templateName: o.getTemplateName }
|
|
86
91
|
),
|
|
87
92
|
type: "success"
|
|
88
93
|
}), !0);
|
|
89
94
|
} catch (i) {
|
|
90
|
-
return
|
|
95
|
+
return s(i, "Failed to create template"), !1;
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
};
|
|
94
99
|
};
|
|
95
100
|
export {
|
|
96
|
-
|
|
101
|
+
Z as useTemplateLibraryApi
|
|
97
102
|
};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { type LegacyVariable, type MappedComposition } from './types';
|
|
2
|
-
export declare function mapComposition(variables: LegacyVariable[] | undefined
|
|
3
|
-
oldPriceFirst?: boolean;
|
|
4
|
-
}): MappedComposition;
|
|
2
|
+
export declare function mapComposition(variables: LegacyVariable[] | undefined): MappedComposition;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LegacyVariable } from './types';
|
|
2
1
|
export declare function extractTitleText(block: Element): string;
|
|
3
2
|
/**
|
|
4
3
|
* Fallback for legacy configs that carry no `p_recommendation_title` variable:
|
|
@@ -8,25 +7,6 @@ export declare function extractTitleText(block: Element): string;
|
|
|
8
7
|
* @returns True when the legacy block renders a visible title
|
|
9
8
|
*/
|
|
10
9
|
export declare function hasVisibleTitle(block: Element): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* A rendered title container with no text showed the user no title, whatever the config's `hidden` flag says.
|
|
13
|
-
* @param block - The legacy recommendation block element
|
|
14
|
-
* @returns True when the legacy block renders an empty title container
|
|
15
|
-
*/
|
|
16
|
-
export declare function hasEmptyTitle(block: Element): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Reads which price the legacy card renders first. Prices sharing a `positionIdx` are ordered by this.
|
|
19
|
-
* @param block - The legacy recommendation block element
|
|
20
|
-
* @returns True only when both prices render and the original price comes first
|
|
21
|
-
*/
|
|
22
|
-
export declare function isOldPriceFirst(block: Element): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Legacy keeps the text color and the name's trim toggle in the rendered `<p>`, not in the config theme.
|
|
25
|
-
* @param variables - The legacy composition variables
|
|
26
|
-
* @param block - The legacy recommendation block element
|
|
27
|
-
* @returns The variables, with `textColor` / `textTrimming` filled from the rendered HTML where the theme lacks them
|
|
28
|
-
*/
|
|
29
|
-
export declare function withRenderedTextTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
|
|
30
10
|
/**
|
|
31
11
|
* Card background lives on either the block (`bgcolor`/`style`) or per-card
|
|
32
12
|
* cells (`.product-card`). Returns empty string when no background is set —
|
|
@@ -65,7 +65,6 @@ export declare class RecommendationBlock extends Block {
|
|
|
65
65
|
*/
|
|
66
66
|
onDelete(node: ImmutableHtmlNode): void;
|
|
67
67
|
private _ensureMobileFitRule;
|
|
68
|
-
private _ensureTextTrimCss;
|
|
69
68
|
private _syncHeightBound;
|
|
70
69
|
/**
|
|
71
70
|
* Warns (dark advisory toaster) when the design holds more than one live
|
|
@@ -121,8 +121,14 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
121
121
|
private _fetchBlockData;
|
|
122
122
|
private _isPanelOn;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
124
|
+
* Applies smart defaults for newly dropped blocks.
|
|
125
|
+
*
|
|
126
|
+
* For new blocks (config still matches hardcoded defaults), validates that
|
|
127
|
+
* the default currency and algorithm are available from the API response.
|
|
128
|
+
* If not, falls back to the first available option.
|
|
129
|
+
*
|
|
130
|
+
* Saved templates with user-customized config are left unchanged because
|
|
131
|
+
* their values won't match the hardcoded defaults.
|
|
126
132
|
*/
|
|
127
133
|
private _applySmartDefaults;
|
|
128
134
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Maps legacy algorithm strategy keys (used by templates authored against the
|
|
3
3
|
* old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
|
|
4
4
|
*
|
|
5
|
-
* `viewedTogether` and `purchasedTogether` map to `mostPopular`: their feed sources (ids 11, 12) need a
|
|
6
|
-
* product id and are excluded from the algorithm dropdown (`EXCLUDED_ALGORITHM_IDS`).
|
|
7
|
-
*
|
|
8
5
|
* Renames are matched by feed-source id:
|
|
6
|
+
* - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
|
|
7
|
+
* - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
|
|
9
8
|
* - `trending` → `trendingProducts` (id 40, path `trending`)
|
|
10
9
|
* - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
|
|
11
10
|
* - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
|
|
@@ -26,6 +26,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
26
26
|
createdAt: string;
|
|
27
27
|
updatedAt: string;
|
|
28
28
|
status: number;
|
|
29
|
+
isDefault?: boolean | undefined;
|
|
29
30
|
}[];
|
|
30
31
|
selectedTemplates: Record<number, number>;
|
|
31
32
|
selectedUnsubscribePages: number[];
|
|
@@ -51,6 +52,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
51
52
|
createdAt: string;
|
|
52
53
|
updatedAt: string;
|
|
53
54
|
status: number;
|
|
55
|
+
isDefault?: boolean | undefined;
|
|
54
56
|
}[];
|
|
55
57
|
selectedTemplates: Record<number, number>;
|
|
56
58
|
selectedUnsubscribePages: number[];
|
|
@@ -76,6 +78,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
76
78
|
createdAt: string;
|
|
77
79
|
updatedAt: string;
|
|
78
80
|
status: number;
|
|
81
|
+
isDefault?: boolean | undefined;
|
|
79
82
|
}[];
|
|
80
83
|
selectedTemplates: Record<number, number>;
|
|
81
84
|
selectedUnsubscribePages: number[];
|
|
@@ -99,6 +102,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
99
102
|
createdAt: string;
|
|
100
103
|
updatedAt: string;
|
|
101
104
|
status: number;
|
|
105
|
+
isDefault?: boolean | undefined;
|
|
102
106
|
}[];
|
|
103
107
|
getThumbnailByTemplateId: (state: {
|
|
104
108
|
templates: {
|
|
@@ -113,6 +117,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
113
117
|
createdAt: string;
|
|
114
118
|
updatedAt: string;
|
|
115
119
|
status: number;
|
|
120
|
+
isDefault?: boolean | undefined;
|
|
116
121
|
}[];
|
|
117
122
|
selectedTemplates: Record<number, number>;
|
|
118
123
|
selectedUnsubscribePages: number[];
|
|
@@ -138,6 +143,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
138
143
|
createdAt: string;
|
|
139
144
|
updatedAt: string;
|
|
140
145
|
status: number;
|
|
146
|
+
isDefault?: boolean | undefined;
|
|
141
147
|
}[];
|
|
142
148
|
selectedTemplates: Record<number, number>;
|
|
143
149
|
selectedUnsubscribePages: number[];
|
|
@@ -163,6 +169,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
163
169
|
createdAt: string;
|
|
164
170
|
updatedAt: string;
|
|
165
171
|
status: number;
|
|
172
|
+
isDefault?: boolean | undefined;
|
|
166
173
|
}[];
|
|
167
174
|
selectedTemplates: Record<number, number>;
|
|
168
175
|
selectedUnsubscribePages: number[];
|
|
@@ -188,6 +195,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
188
195
|
createdAt: string;
|
|
189
196
|
updatedAt: string;
|
|
190
197
|
status: number;
|
|
198
|
+
isDefault?: boolean | undefined;
|
|
191
199
|
}[];
|
|
192
200
|
selectedTemplates: Record<number, number>;
|
|
193
201
|
selectedUnsubscribePages: number[];
|
|
@@ -213,6 +221,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
213
221
|
createdAt: string;
|
|
214
222
|
updatedAt: string;
|
|
215
223
|
status: number;
|
|
224
|
+
isDefault?: boolean | undefined;
|
|
216
225
|
}[];
|
|
217
226
|
selectedTemplates: Record<number, number>;
|
|
218
227
|
selectedUnsubscribePages: number[];
|
|
@@ -238,6 +247,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
238
247
|
createdAt: string;
|
|
239
248
|
updatedAt: string;
|
|
240
249
|
status: number;
|
|
250
|
+
isDefault?: boolean | undefined;
|
|
241
251
|
}[];
|
|
242
252
|
selectedTemplates: Record<number, number>;
|
|
243
253
|
selectedUnsubscribePages: number[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TemplateData } from '@@/Types/actions-api';
|
|
1
2
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
2
3
|
/**
|
|
3
4
|
* Collects every unsubscribe page id referenced by the unsubscribe blocks
|
|
@@ -44,7 +45,7 @@ export declare function getHtmlReferencedUnsubscribePages(html: string): number[
|
|
|
44
45
|
*/
|
|
45
46
|
declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
|
|
46
47
|
export declare const useTemplatePreparation: () => {
|
|
47
|
-
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
|
+
prepareTemplateDetails: (prefetched?: TemplateData) => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
49
|
hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
|
|
49
50
|
};
|
|
50
51
|
export {};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { TYPE_COLLECTIONS as
|
|
1
|
+
import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
3
|
import { defineStore as u } from "pinia";
|
|
4
4
|
let o = null;
|
|
5
|
-
const
|
|
5
|
+
const p = () => ({
|
|
6
6
|
templates: [],
|
|
7
7
|
selectedTemplates: {},
|
|
8
8
|
selectedUnsubscribePages: [],
|
|
9
|
-
selectedCollectionType:
|
|
10
|
-
activeType:
|
|
9
|
+
selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
|
|
10
|
+
activeType: r.GLOBAL_UNSUBSCRIBE,
|
|
11
11
|
pageSelectionUpdateStatus: !1,
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
15
|
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
16
|
pendingBlockId: null
|
|
17
|
-
})
|
|
18
|
-
|
|
17
|
+
});
|
|
18
|
+
function h(e) {
|
|
19
|
+
return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
|
|
20
|
+
}
|
|
21
|
+
const f = u("guidoUnsubscribe", {
|
|
22
|
+
state: () => p(),
|
|
19
23
|
getters: {
|
|
20
|
-
getSelectedCollection: (e) =>
|
|
24
|
+
getSelectedCollection: (e) => c[e.selectedCollectionType],
|
|
21
25
|
getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
|
|
22
26
|
getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
|
|
23
27
|
getThumbnailByTemplateId: (e) => (t) => {
|
|
@@ -25,31 +29,31 @@ const r = () => ({
|
|
|
25
29
|
return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
|
|
26
30
|
},
|
|
27
31
|
getSelectedUnsubscribePagesByCollection: (e) => (t) => {
|
|
28
|
-
const l =
|
|
32
|
+
const l = c[t];
|
|
29
33
|
if (!l)
|
|
30
34
|
return [];
|
|
31
35
|
const s = /* @__PURE__ */ new Map();
|
|
32
36
|
e.templates.forEach((n) => {
|
|
33
37
|
s.set(n.id, n.type);
|
|
34
38
|
});
|
|
35
|
-
const
|
|
39
|
+
const i = new Set(l);
|
|
36
40
|
return e.selectedUnsubscribePages.filter((n) => {
|
|
37
41
|
const a = s.get(n);
|
|
38
|
-
return a !== void 0 &&
|
|
42
|
+
return a !== void 0 && i.has(a);
|
|
39
43
|
});
|
|
40
44
|
},
|
|
41
45
|
isActiveTypeFirstInCollection: (e) => {
|
|
42
|
-
const t =
|
|
46
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
43
47
|
return e.activeType === t[0];
|
|
44
48
|
},
|
|
45
49
|
isActiveTypeLastInCollection: (e) => {
|
|
46
|
-
const t =
|
|
50
|
+
const t = c[e.selectedCollectionType] ?? [];
|
|
47
51
|
return e.activeType === t[t.length - 1];
|
|
48
52
|
},
|
|
49
53
|
hasTemplatesByCollectionType: (e) => {
|
|
50
54
|
const t = {};
|
|
51
|
-
return (
|
|
52
|
-
t[s] = e.templates.some((
|
|
55
|
+
return (c[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
56
|
+
t[s] = e.templates.some((i) => i.type === s);
|
|
53
57
|
}), t;
|
|
54
58
|
},
|
|
55
59
|
unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
|
|
@@ -58,7 +62,7 @@ const r = () => ({
|
|
|
58
62
|
$reset() {
|
|
59
63
|
const { templates: e, selectedUnsubscribePages: t } = this;
|
|
60
64
|
Object.assign(this, {
|
|
61
|
-
...
|
|
65
|
+
...p(),
|
|
62
66
|
templates: e,
|
|
63
67
|
selectedUnsubscribePages: t
|
|
64
68
|
});
|
|
@@ -66,28 +70,28 @@ const r = () => ({
|
|
|
66
70
|
async fetchTemplates(e = !1) {
|
|
67
71
|
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
68
72
|
const { getUnsubscribePages: t } = d();
|
|
69
|
-
this.templates = await t();
|
|
73
|
+
this.templates = h(await t());
|
|
70
74
|
})().finally(() => {
|
|
71
75
|
o = null;
|
|
72
76
|
})), await o);
|
|
73
77
|
},
|
|
74
78
|
setCollection(e) {
|
|
75
79
|
this.selectedCollectionType = e;
|
|
76
|
-
const t =
|
|
80
|
+
const t = c[e];
|
|
77
81
|
if (t && t.length > 0) {
|
|
78
82
|
[this.activeType] = t;
|
|
79
83
|
const l = { ...this.selectedTemplates };
|
|
80
84
|
t.forEach((s) => {
|
|
81
85
|
if (!l[s]) {
|
|
82
|
-
const
|
|
83
|
-
|
|
86
|
+
const i = this.templates.find((n) => n.type === s);
|
|
87
|
+
i && (l[s] = i.id);
|
|
84
88
|
}
|
|
85
89
|
}), this.selectedTemplates = l;
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
setCollectionWithoutAutoSelection(e) {
|
|
89
93
|
this.selectedCollectionType = e;
|
|
90
|
-
const t =
|
|
94
|
+
const t = c[e];
|
|
91
95
|
t && t.length > 0 && ([this.activeType] = t);
|
|
92
96
|
},
|
|
93
97
|
setSelectedTemplate(e) {
|
|
@@ -107,12 +111,12 @@ const r = () => ({
|
|
|
107
111
|
loadSelectedTemplates(e) {
|
|
108
112
|
const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
|
|
109
113
|
e.forEach((s) => {
|
|
110
|
-
const
|
|
111
|
-
|
|
114
|
+
const i = t.get(s);
|
|
115
|
+
i !== void 0 && (l[i] = s);
|
|
112
116
|
}), this.selectedTemplates = l;
|
|
113
117
|
},
|
|
114
118
|
getSelectedTemplatesByCollection(e) {
|
|
115
|
-
const t =
|
|
119
|
+
const t = c[e], l = [];
|
|
116
120
|
return t.forEach((s) => {
|
|
117
121
|
this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
|
|
118
122
|
}), l;
|
|
@@ -129,5 +133,5 @@ const r = () => ({
|
|
|
129
133
|
}
|
|
130
134
|
});
|
|
131
135
|
export {
|
|
132
|
-
|
|
136
|
+
f as useUnsubscribeStore
|
|
133
137
|
};
|