@useinsider/guido 3.3.0-beta.a7a5213 → 3.3.0-beta.c1c552a

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 (26) hide show
  1. package/dist/composables/useCustomInterfaceAppearance.js +16 -18
  2. package/dist/composables/useHtmlValidator.js +36 -41
  3. package/dist/composables/useRecommendation.js +2 -2
  4. package/dist/composables/useStripo.js +49 -47
  5. package/dist/composables/useStripoNotifications.js +28 -0
  6. package/dist/enums/extensions/recommendationBlock.js +41 -95
  7. package/dist/enums/toaster.js +1 -1
  8. package/dist/enums/unsubscribe.js +24 -25
  9. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  10. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  11. package/dist/extensions/Blocks/Recommendation/block.js +36 -43
  12. package/dist/extensions/Blocks/Recommendation/services/configService.js +26 -33
  13. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -35
  14. package/dist/package.json.js +1 -1
  15. package/dist/src/composables/useStripoNotifications.d.ts +4 -0
  16. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -5
  17. package/dist/src/enums/toaster.d.ts +2 -1
  18. package/dist/src/enums/unsubscribe.d.ts +3 -8
  19. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +3 -11
  20. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -7
  21. package/dist/src/stores/toaster.d.ts +2 -1
  22. package/dist/stores/toaster.js +10 -9
  23. package/package.json +2 -2
  24. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +0 -33
  25. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -21
  26. package/dist/static/styles/components/notification.css.js +0 -74
@@ -1,15 +1,14 @@
1
- import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as y } from "../../../../enums/extensions/recommendationBlock.js";
1
+ import { RecommendationFeedSourceMaps as S, getOperatorOptions as R, PriceAttributes as y } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
4
  import { defineStore as P } from "pinia";
5
5
  import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
7
- import { getDefaultProducts as S } from "../templates/utils.js";
7
+ import { getDefaultProducts as g } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
9
  import { isFilterValid as w } from "../validation/filterSchema.js";
10
- import { isConfigValid as v } from "../validation/requiredFields.js";
11
10
  const h = C();
12
- let m = null, u = null, d = null;
11
+ let u = null, m = null, d = null;
13
12
  function k() {
14
13
  return {
15
14
  cardsInRow: F,
@@ -49,7 +48,7 @@ function I() {
49
48
  filterSnapshot: null
50
49
  };
51
50
  }
52
- const N = () => ({
51
+ const v = () => ({
53
52
  recommendationCampaignUrls: {},
54
53
  activePredictiveAlgorithms: [],
55
54
  languages: {},
@@ -58,8 +57,8 @@ const N = () => ({
58
57
  blockStates: {},
59
58
  currentRecommendationId: null,
60
59
  configVersion: 0
61
- }), M = P("guidoRecommendationExtension", {
62
- state: () => N(),
60
+ }), _ = P("guidoRecommendationExtension", {
61
+ state: () => v(),
63
62
  getters: {
64
63
  // ====================================================================
65
64
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -114,12 +113,12 @@ const N = () => ({
114
113
  return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
115
114
  },
116
115
  getActivePredictiveAlgorithms: (t) => {
117
- const e = g(), r = [];
118
- return t.activePredictiveAlgorithms.filter((n) => !D.includes(n)).forEach((n) => {
119
- r.push(...e.filter((c) => c.id === n));
120
- }), r.map((n) => ({
121
- text: n.name,
122
- value: n.key
116
+ const e = [];
117
+ return t.activePredictiveAlgorithms.filter((r) => !D.includes(r)).forEach((r) => {
118
+ e.push(...S.filter((n) => n.id === r));
119
+ }), e.map((r) => ({
120
+ text: r.name,
121
+ value: r.key
123
122
  }));
124
123
  },
125
124
  getLanguages: (t) => Object.entries(t.languages).map(([e, r]) => ({
@@ -294,11 +293,11 @@ const N = () => ({
294
293
  // ====================================================================
295
294
  async fetchRecommendationCreateData() {
296
295
  if (!this.activePredictiveAlgorithms.length) {
297
- if (m) {
298
- await m;
296
+ if (u) {
297
+ await u;
299
298
  return;
300
299
  }
301
- m = (async () => {
300
+ u = (async () => {
302
301
  const {
303
302
  activePredictiveAlgorithms: t,
304
303
  languages: e,
@@ -311,26 +310,26 @@ const N = () => ({
311
310
  this.currencyList = r;
312
311
  })();
313
312
  try {
314
- await m;
313
+ await u;
315
314
  } finally {
316
- m = null;
315
+ u = null;
317
316
  }
318
317
  }
319
318
  },
320
319
  async fetchRecommendationFilters() {
321
320
  if (!Object.keys(this.filterList).length) {
322
- if (u) {
323
- await u;
321
+ if (m) {
322
+ await m;
324
323
  return;
325
324
  }
326
- u = (async () => {
325
+ m = (async () => {
327
326
  const t = await h.fetchRecommendationFilters();
328
327
  this.filterList = t;
329
328
  })();
330
329
  try {
331
- await u;
330
+ await m;
332
331
  } finally {
333
- u = null;
332
+ m = null;
334
333
  }
335
334
  }
336
335
  },
@@ -399,14 +398,6 @@ const N = () => ({
399
398
  generateFilterQuery() {
400
399
  return b(this.recommendationConfigs.filters);
401
400
  },
402
- /**
403
- * Validation-only check invoked at save-CTA time. Defined as an action
404
- * (not a getter) so reading it does not register reactive tracking on
405
- * every block's recommendationConfigs across user edits.
406
- */
407
- hasInvalidBlock() {
408
- return Object.values(this.blockStates).some((t) => !v(t.recommendationConfigs, this));
409
- },
410
401
  // ====================================================================
411
402
  // Per-Block Product Fetching
412
403
  // ====================================================================
@@ -426,7 +417,7 @@ const N = () => ({
426
417
  },
427
418
  async _doFetchProducts() {
428
419
  var p;
429
- const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
420
+ const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = S.find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
430
421
  locale: r.language,
431
422
  currency: r.currencySettings.value,
432
423
  partnerName: o.partnerName,
@@ -442,15 +433,15 @@ const N = () => ({
442
433
  f = [];
443
434
  }
444
435
  if (this.blockStates[t]) {
445
- const l = f.length > 0 ? f : S(s);
436
+ const l = f.length > 0 ? f : g(s);
446
437
  l.length < s ? this.blockStates[t].recommendationProducts = [
447
438
  ...l,
448
- ...S(s - l.length)
439
+ ...g(s - l.length)
449
440
  ] : l.length > s ? this.blockStates[t].recommendationProducts = l.slice(0, s) : this.blockStates[t].recommendationProducts = l;
450
441
  }
451
442
  }
452
443
  }
453
444
  });
454
445
  export {
455
- M as useRecommendationExtensionStore
446
+ _ as useRecommendationExtensionStore
456
447
  };
@@ -1,4 +1,4 @@
1
- const o = { stripo: { version: "2.64.0" } }, s = {
1
+ const o = { stripo: { version: "2.62.0" } }, s = {
2
2
  guido: o
3
3
  };
4
4
  export {
@@ -0,0 +1,4 @@
1
+ import type { StripoNotifications } from '@@/Types/stripo';
2
+ export declare const useStripoNotifications: () => {
3
+ getStripoNotifications: () => StripoNotifications;
4
+ };
@@ -6,11 +6,7 @@ export declare const URLS: {
6
6
  export declare const QUERY_PARAMS: {
7
7
  CLIENT_ID: string;
8
8
  };
9
- /**
10
- * Get recommendation feed source maps lazily so translated names resolve at access time.
11
- * Must be called within a Vue component context or after Pinia is initialized.
12
- */
13
- export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
9
+ export declare const RecommendationFeedSourceMaps: RecommendationFeedItem[];
14
10
  export declare const PriceAttributes: string[];
15
11
  export declare const currencyLocationMaps: TextValueObject[];
16
12
  export declare const currencyOperators: TextValueObject[];
@@ -1,5 +1,6 @@
1
1
  export declare enum ToasterTypeOptions {
2
2
  Success = "success",
3
3
  Warning = "warning",
4
- Alert = "alert"
4
+ Alert = "alert",
5
+ Info = "info"
5
6
  }
@@ -18,14 +18,9 @@ export declare const PRODUCT_TYPE_URL_SEGMENTS: {
18
18
  readonly 97: "email";
19
19
  };
20
20
  export declare const INSIDER_ID = "iid";
21
- export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
22
- /**
23
- * Get the default unsubscribe group lazily so the translated name resolves at access time.
24
- * Must be called within a Vue component context or after Pinia is initialized.
25
- */
26
- export declare const getDefaultUnsubscribeGroup: () => {
27
- name: string;
28
- sendGridId: string;
21
+ export declare const DEFAULT_UNSUBSCRIBE_GROUP: {
22
+ readonly name: "Global Unsubscribe";
23
+ readonly sendGridId: "G";
29
24
  };
30
25
  export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
31
26
  export declare const PAGE_TYPES: {
@@ -95,23 +95,15 @@ export declare class RecommendationConfigService {
95
95
  *
96
96
  * Called when a block is first created (dropped into template).
97
97
  * Can optionally merge in partial config from migration.
98
- *
99
- * The `wasFreshDrop` flag distinguishes a brand-new drop (no prior config)
100
- * from a clone (Stripo replays the source's setNodeConfig payload before
101
- * onCreated fires). Callers use this to skip side-effects already inherited
102
- * from the source.
103
98
  * @example
104
99
  * // In Block.onCreated lifecycle
105
- * const { config, wasFreshDrop } = RecommendationConfigService.initializeConfig(this.api, node);
100
+ * RecommendationConfigService.initializeConfig(this.api, node);
106
101
  * @param api - Stripo extension API with document modifier
107
102
  * @param node - The immutable HTML node to initialize
108
103
  * @param partialConfig - Optional partial config to merge with defaults
109
- * @returns The initialized configuration and whether the node was a fresh drop
104
+ * @returns The initialized configuration
110
105
  */
111
- static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): {
112
- config: RecommendationNodeConfig;
113
- wasFreshDrop: boolean;
114
- };
106
+ static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): RecommendationNodeConfig;
115
107
  /**
116
108
  * Save complete configuration to a node
117
109
  *
@@ -1,5 +1,5 @@
1
1
  import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationProduct } from '@@/Types/recommendation';
2
- export interface PerBlockConfigs {
2
+ interface PerBlockConfigs {
3
3
  cardsInRow: number;
4
4
  currencySettings: {
5
5
  name: string;
@@ -272,12 +272,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
272
272
  deleteFilter(filter: Filter): void;
273
273
  addFilter(filter: Filter): void;
274
274
  generateFilterQuery(): string;
275
- /**
276
- * Validation-only check invoked at save-CTA time. Defined as an action
277
- * (not a getter) so reading it does not register reactive tracking on
278
- * every block's recommendationConfigs across user edits.
279
- */
280
- hasInvalidBlock(): boolean;
281
275
  fetchRecommendationProducts(): Promise<void>;
282
276
  _doFetchProducts(): Promise<void>;
283
277
  }>;
@@ -11,8 +11,9 @@ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToas
11
11
  text: string;
12
12
  onClick: () => void;
13
13
  } | undefined;
14
+ autoHide: boolean;
14
15
  } & import("pinia").PiniaCustomStateProperties<ToasterState>) => boolean;
15
16
  }, {
16
- showToaster(this: ToasterState, { type, message, actionButton }: ToasterOptions): void;
17
+ showToaster(this: ToasterState, { type, message, actionButton, autoHide }: ToasterOptions): void;
17
18
  hideToaster(this: ToasterState): void;
18
19
  }>;
@@ -1,21 +1,22 @@
1
1
  import { ToasterTypeOptions as e } from "../enums/toaster.js";
2
- import { defineStore as i } from "pinia";
3
- const a = () => ({
2
+ import { defineStore as a } from "pinia";
3
+ const u = () => ({
4
4
  status: !1,
5
5
  type: e.Success,
6
6
  text: "",
7
7
  icon: "",
8
8
  withIcon: !0,
9
9
  withoutLeftMargin: !1,
10
- actionButton: void 0
11
- }), n = i("guidoToaster", {
12
- state: () => a(),
10
+ actionButton: void 0,
11
+ autoHide: !0
12
+ }), c = a("guidoToaster", {
13
+ state: () => u(),
13
14
  getters: {
14
- shouldAutoHide: (t) => t.status && !!t.text
15
+ shouldAutoHide: (t) => t.status && !!t.text && t.autoHide
15
16
  },
16
17
  actions: {
17
- showToaster({ type: t = e.Success, message: s, actionButton: o }) {
18
- this.status = !0, this.text = s, this.type = t, this.actionButton = o;
18
+ showToaster({ type: t = e.Success, message: o, actionButton: s, autoHide: i = !0 }) {
19
+ this.status = !0, this.text = o, this.type = t, this.actionButton = s, this.autoHide = i;
19
20
  },
20
21
  hideToaster() {
21
22
  this.status = !1;
@@ -23,5 +24,5 @@ const a = () => ({
23
24
  }
24
25
  });
25
26
  export {
26
- n as useToasterStore
27
+ c as useToasterStore
27
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.3.0-beta.a7a5213",
3
+ "version": "3.3.0-beta.c1c552a",
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",
@@ -90,7 +90,7 @@
90
90
  },
91
91
  "guido": {
92
92
  "stripo": {
93
- "version": "2.64.0"
93
+ "version": "2.62.0"
94
94
  }
95
95
  }
96
96
  }
@@ -1,33 +0,0 @@
1
- const o = [
2
- {
3
- key: "locale",
4
- getValue: (e) => e.language,
5
- getAvailableOptions: (e) => Object.keys(e.languages)
6
- },
7
- {
8
- key: "currency",
9
- getValue: (e) => e.currencySettings.value,
10
- getAvailableOptions: (e) => e.currencyList.map((n) => n.text)
11
- }
12
- ], l = "newsletter.recommendation-fill-required-fields";
13
- function u(e, n) {
14
- return o.filter((t) => {
15
- var a;
16
- if (t.condition && !t.condition(e))
17
- return !1;
18
- const i = t.getValue(e);
19
- if (!i)
20
- return !0;
21
- const r = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
22
- return r !== void 0 && !r.includes(i);
23
- }).map((t) => t.key);
24
- }
25
- function s(e, n) {
26
- return u(e, n).length === 0;
27
- }
28
- export {
29
- o as REQUIRED_RECOMMENDATION_FIELDS,
30
- l as RecommendationRequiredFieldsKey,
31
- u as getInvalidFields,
32
- s as isConfigValid
33
- };
@@ -1,21 +0,0 @@
1
- import type { PerBlockConfigs } from '../store/recommendation';
2
- import type { Currency, Languages } from '@@/Types/recommendation';
3
- /**
4
- * Structural slice of the recommendation extension store that descriptors may read.
5
- * Add new fields here when a future descriptor needs them.
6
- */
7
- export interface ExtensionStoreSlice {
8
- languages: Languages;
9
- currencyList: Currency[];
10
- }
11
- interface RequiredField {
12
- key: string;
13
- getValue: (config: PerBlockConfigs) => string;
14
- getAvailableOptions?: (store: ExtensionStoreSlice) => string[];
15
- condition?: (config: PerBlockConfigs) => boolean;
16
- }
17
- export declare const REQUIRED_RECOMMENDATION_FIELDS: RequiredField[];
18
- export declare const RecommendationRequiredFieldsKey = "newsletter.recommendation-fill-required-fields";
19
- export declare function getInvalidFields(config: PerBlockConfigs, store: ExtensionStoreSlice): string[];
20
- export declare function isConfigValid(config: PerBlockConfigs, store: ExtensionStoreSlice): boolean;
21
- export {};
@@ -1,74 +0,0 @@
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
- };