@useinsider/guido 3.3.0-beta.e7d65e1 → 3.3.0-beta.f723108

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.
@@ -0,0 +1,33 @@
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
+ };
@@ -6,7 +6,11 @@ export declare const URLS: {
6
6
  export declare const QUERY_PARAMS: {
7
7
  CLIENT_ID: string;
8
8
  };
9
- export declare const RecommendationFeedSourceMaps: RecommendationFeedItem[];
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[];
10
14
  export declare const PriceAttributes: string[];
11
15
  export declare const currencyLocationMaps: TextValueObject[];
12
16
  export declare const currencyOperators: TextValueObject[];
@@ -18,9 +18,14 @@ 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: {
22
- readonly name: "Global Unsubscribe";
23
- readonly sendGridId: "G";
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;
24
29
  };
25
30
  export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
26
31
  export declare const PAGE_TYPES: {
@@ -1,4 +1,4 @@
1
- declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
1
+ declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button-block\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
2
2
  /**
3
3
  * @returns The template for the default checkbox block
4
4
  */
@@ -95,15 +95,23 @@ 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.
98
103
  * @example
99
104
  * // In Block.onCreated lifecycle
100
- * RecommendationConfigService.initializeConfig(this.api, node);
105
+ * const { config, wasFreshDrop } = RecommendationConfigService.initializeConfig(this.api, node);
101
106
  * @param api - Stripo extension API with document modifier
102
107
  * @param node - The immutable HTML node to initialize
103
108
  * @param partialConfig - Optional partial config to merge with defaults
104
- * @returns The initialized configuration
109
+ * @returns The initialized configuration and whether the node was a fresh drop
105
110
  */
106
- static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): RecommendationNodeConfig;
111
+ static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): {
112
+ config: RecommendationNodeConfig;
113
+ wasFreshDrop: boolean;
114
+ };
107
115
  /**
108
116
  * Save complete configuration to a node
109
117
  *
@@ -1,5 +1,5 @@
1
1
  import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationProduct } from '@@/Types/recommendation';
2
- interface PerBlockConfigs {
2
+ export interface PerBlockConfigs {
3
3
  cardsInRow: number;
4
4
  currencySettings: {
5
5
  name: string;
@@ -272,6 +272,12 @@ 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;
275
281
  fetchRecommendationProducts(): Promise<void>;
276
282
  _doFetchProducts(): Promise<void>;
277
283
  }>;
@@ -0,0 +1,21 @@
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.3.0-beta.e7d65e1",
3
+ "version": "3.3.0-beta.f723108",
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",