@useinsider/guido 3.22.0-beta.e1b5da2 → 3.22.0-beta.e9b6f94

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 (45) hide show
  1. package/README.md +35 -4
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +118 -108
  4. package/dist/composables/useEditorOpenMetrics.js +167 -0
  5. package/dist/composables/useStripo.js +93 -82
  6. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  7. package/dist/config/migrator/recommendation/compositionMapper.js +49 -56
  8. package/dist/config/migrator/recommendation/extractors.js +40 -100
  9. package/dist/config/migrator/recommendation/htmlBuilder.js +207 -285
  10. package/dist/config/migrator/recommendation/settingsMapper.js +36 -37
  11. package/dist/config/migrator/recommendation/themeMapper.js +41 -53
  12. package/dist/config/migrator/recommendationMigrator.js +61 -68
  13. package/dist/config/migrator/unsubscribeMigrator.js +60 -87
  14. package/dist/extensions/Blocks/Recommendation/block.js +24 -33
  15. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +19 -20
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +163 -148
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +22 -23
  18. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +18 -19
  19. package/dist/extensions/Blocks/Recommendation/templates/utils.js +91 -82
  20. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -3
  21. package/dist/guido.css +1 -1
  22. package/dist/library.js +12 -10
  23. package/dist/package.json.js +6 -4
  24. package/dist/public/prefetchRuntime.js +4 -0
  25. package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
  26. package/dist/src/composables/useStripo.d.ts +2 -1
  27. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +1 -3
  28. package/dist/src/config/migrator/recommendation/extractors.d.ts +6 -35
  29. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +1 -3
  30. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +1 -3
  31. package/dist/src/config/migrator/recommendation/types.d.ts +1 -11
  32. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  33. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -2
  34. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +13 -1
  35. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +19 -2
  36. package/dist/src/library.d.ts +1 -0
  37. package/dist/src/public/prefetchRuntime.d.ts +1 -0
  38. package/dist/src/utils/runtimePrefetch.d.ts +4 -0
  39. package/dist/src/utils/stripoRuntime.d.ts +3 -0
  40. package/dist/static/stripo-runtime-manifest.json.js +9 -0
  41. package/dist/utils/runtimePrefetch.js +26 -0
  42. package/dist/utils/stripoRuntime.js +13 -0
  43. package/package.json +6 -1
  44. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +0 -12
  45. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +0 -9
@@ -121,8 +121,14 @@ export declare class RecommendationBlockControl extends CommonControl {
121
121
  private _fetchBlockData;
122
122
  private _isPanelOn;
123
123
  /**
124
- * Falls back to the first available option when the block's currency or locale is not offered (a new block on
125
- * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
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
  /**
@@ -1,7 +1,6 @@
1
1
  import type { CurrencyConfig } from '../types/nodeConfig';
2
2
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
3
3
  import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
4
- export { resolveInlinePriceOrder } from '../utils/inlinePriceOrder';
5
4
  type PriceKey = 'price' | 'original_price' | 'discount';
6
5
  /**
7
6
  * Current currency configuration from the store, in CurrencyConfig shape.
@@ -23,6 +22,18 @@ export declare function isSamePrice(product: RecommendationProduct): boolean;
23
22
  * e.g., "rating_star" → "Rating Star"
24
23
  */
25
24
  export declare function toDisplayName(attrName: string): string;
25
+ /**
26
+ * Resolves the inline (side-by-side) price layout from the composition order so
27
+ * it matches the stacked order. `anchor` is whichever of price / original price
28
+ * comes first in the composition (the merged cell renders there); `skip` is the
29
+ * other (dropped, since it's merged in); `originalFirst` puts the original price
30
+ * on the left when it precedes the sale price (the default composition order).
31
+ */
32
+ export declare function resolveInlinePriceOrder(composition: string[]): {
33
+ originalFirst: boolean;
34
+ anchor: string;
35
+ skip: string;
36
+ };
26
37
  /**
27
38
  * Reduces a raw product-attribute value to a displayable scalar string.
28
39
  * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
@@ -317,3 +328,4 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
317
328
  * @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
318
329
  */
319
330
  export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
331
+ export {};
@@ -1,5 +1,22 @@
1
1
  /**
2
- * Maps legacy strategy keys to `RecommendationFeedSourceMaps` keys; product-bound ones (ids 11, 12, excluded from the
3
- * dropdown) become `mostPopular`. Unknown keys pass through so a future algorithm is not silently defaulted.
2
+ * Maps legacy algorithm strategy keys (used by templates authored against the
3
+ * old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
4
+ *
5
+ * Renames are matched by feed-source id:
6
+ * - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
7
+ * - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
8
+ * - `trending` → `trendingProducts` (id 40, path `trending`)
9
+ * - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
10
+ * - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
11
+ * - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
12
+ *
13
+ * Used at two boundaries:
14
+ * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
15
+ * the new key.
16
+ * 2. The algorithm dropdown control, so already-saved blocks that still carry
17
+ * a legacy key resolve to a matching dropdown option.
18
+ *
19
+ * Unknown values pass through untouched so a future-added algorithm doesn't
20
+ * silently default.
4
21
  */
5
22
  export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
@@ -4,5 +4,6 @@ export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidat
4
4
  export { assignTrackingIds, readTrackFloor, readTrackSeq } from './public/trackingIds';
5
5
  export { useGuidoEmailEditorStore } from './public/editorState';
6
6
  export type { GuidoEmailEditorState } from './public/editorState';
7
+ export { prefetchGuidoRuntime } from './public/prefetchRuntime';
7
8
  export type { StripoEventType } from './@types/events';
8
9
  export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
@@ -0,0 +1 @@
1
+ export { prefetchGuidoRuntime } from '../utils/runtimePrefetch';
@@ -0,0 +1,4 @@
1
+ export type RuntimePrefetchState = 'none' | 'pending' | 'done';
2
+ export declare const RUNTIME_PREFETCH_ATTRIBUTE = "data-guido-prefetch";
3
+ export declare const prefetchGuidoRuntime: () => void;
4
+ export declare const readRuntimePrefetchState: () => RuntimePrefetchState;
@@ -0,0 +1,3 @@
1
+ /** Null when package.json does not pin `guido.stripo.version`. */
2
+ export declare const getStripoVersion: () => string | null;
3
+ export declare const getStripoRuntimeBaseUrl: () => string | null;
@@ -0,0 +1,9 @@
1
+ const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
2
+ version: s,
3
+ files: n
4
+ };
5
+ export {
6
+ i as default,
7
+ n as files,
8
+ s as version
9
+ };
@@ -0,0 +1,26 @@
1
+ import i from "../static/stripo-runtime-manifest.json.js";
2
+ import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
3
+ const n = "data-guido-prefetch", d = "pending", o = "settled", s = `link[${n}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, p = () => document.createElement("link").relList.supports("prefetch"), E = () => {
4
+ const { connection: e } = navigator;
5
+ return (e == null ? void 0 : e.saveData) === !0 || u.includes((e == null ? void 0 : e.effectiveType) ?? "");
6
+ }, m = (e) => {
7
+ const t = document.createElement("link"), r = () => t.setAttribute(n, o);
8
+ t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(n, d), t.addEventListener("load", r, { once: !0 }), t.addEventListener("error", r, { once: !0 }), document.head.appendChild(t);
9
+ }, T = () => {
10
+ try {
11
+ const e = c(), t = document.querySelector(s) !== null;
12
+ if (!e || t || !p() || a() || E())
13
+ return;
14
+ i.files.forEach((r) => m(`${e}${r}`));
15
+ } catch (e) {
16
+ console.debug("guido: runtime prefetch skipped", e);
17
+ }
18
+ }, g = () => {
19
+ const e = Array.from(document.querySelectorAll(s));
20
+ return e.length ? e.every((t) => t.getAttribute(n) === o) ? "done" : "pending" : "none";
21
+ };
22
+ export {
23
+ n as RUNTIME_PREFETCH_ATTRIBUTE,
24
+ T as prefetchGuidoRuntime,
25
+ g as readRuntimePrefetchState
26
+ };
@@ -0,0 +1,13 @@
1
+ import r from "../package.json.js";
2
+ const s = "https://email-static.useinsider.com/guido/", e = () => {
3
+ var o;
4
+ const t = r.guido;
5
+ return (o = t == null ? void 0 : t.stripo) == null ? void 0 : o.version;
6
+ }, n = () => {
7
+ const t = e();
8
+ return t ? `${s}${t}/` : null;
9
+ };
10
+ export {
11
+ n as getStripoRuntimeBaseUrl,
12
+ e as getStripoVersion
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.22.0-beta.e1b5da2",
3
+ "version": "3.22.0-beta.e9b6f94",
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",
@@ -22,6 +22,10 @@
22
22
  "types": "./dist/src/public/editorState.d.ts",
23
23
  "import": "./dist/public/editorState.js"
24
24
  },
25
+ "./prefetch": {
26
+ "types": "./dist/src/public/prefetchRuntime.d.ts",
27
+ "import": "./dist/public/prefetchRuntime.js"
28
+ },
25
29
  "./style": "./dist/guido.css"
26
30
  },
27
31
  "scripts": {
@@ -45,6 +49,7 @@
45
49
  "coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
46
50
  "test:mutation": "stryker run",
47
51
  "test:mutation:since": "CHANGED=$(git diff --name-only --diff-filter=AMR origin/develop...HEAD -- 'src/**/*.ts' ':(glob)src/components/organisms/onboarding/**/*.vue' ':(glob)src/components/organisms/header/**/*.vue' ':(glob)src/components/organisms/unsubscribe/**/*.vue' ':(glob)src/components/organisms/save-as-template/**/*.vue' ':(glob)src/components/organisms/email-preview/**/*.vue' ':(glob)src/components/wrappers/**/*.vue' 'src/components/Guido.vue' ':(exclude)src/**/*.test.ts' ':(exclude)src/**/index.ts' ':(exclude)src/@types/**' ':(exclude)src/enums/**' ':(exclude)src/mock/**' ':(exclude)src/**/_Boilerplate/**' | paste -sd, -); if [ -n \"$CHANGED\" ]; then stryker run --incremental --mutate \"$CHANGED\"; else echo \"No changed mutatable src files vs origin/develop\"; fi",
52
+ "stripo:manifest": "node scripts/stripo-runtime-manifest.mjs",
48
53
  "prepare": "husky",
49
54
  "preinstall": "rm -rf ./node_modules/.vite"
50
55
  },
@@ -1,12 +0,0 @@
1
- import { ATTR_PRODUCT_PRICE as n, ATTR_PRODUCT_OLD_PRICE as e } from "../constants/selectors.js";
2
- function d(i) {
3
- const o = i.indexOf(n), t = i.indexOf(e), r = t !== -1 && (o === -1 || t < o);
4
- return {
5
- originalFirst: r,
6
- anchor: r ? e : n,
7
- skip: r ? n : e
8
- };
9
- }
10
- export {
11
- d as resolveInlinePriceOrder
12
- };
@@ -1,9 +0,0 @@
1
- /**
2
- * Resolves the inline price layout from the composition order: `anchor` is whichever price comes first (the merged
3
- * cell renders there), `skip` is the other; `originalFirst` puts the original price on the left.
4
- */
5
- export declare function resolveInlinePriceOrder(composition: string[]): {
6
- originalFirst: boolean;
7
- anchor: string;
8
- skip: string;
9
- };