@useinsider/guido 3.21.0-beta.7e166b5 → 3.21.0-beta.8a9421f

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.
@@ -19,9 +19,9 @@ export declare class RecommendationBlock extends Block {
19
19
  private _resetSourceIds;
20
20
  /** Ids handed to duplicates the document root does not show yet: a copied module renames all its blocks at once. */
21
21
  private _unsettledDuplicateIds;
22
- private _arrivedNodes;
23
- /** Ids whose arrival or duplicate refresh is in flight, so a second refresh of the same block does not race it. */
24
- private _refreshingIds;
22
+ private _arrivedBlocks;
23
+ /** Strategy each in-flight arrival or duplicate refresh is fetching, by block id, so a second one does not race it. */
24
+ private _refreshClaims;
25
25
  constructor();
26
26
  getId(): string;
27
27
  getIcon(): string;
@@ -96,15 +96,20 @@ export declare class RecommendationBlock extends Block {
96
96
  */
97
97
  private _queueArrivalRefresh;
98
98
  private _refreshArrivedBlocks;
99
+ /**
100
+ * A new document reports each block to onCreated and onDocumentInit, not always in one batch, so a
101
+ * claimed block refreshes again only once the document shows it under another strategy (a restored version).
102
+ */
103
+ private _canClaimRefresh;
104
+ private _releaseRefreshClaim;
99
105
  /**
100
106
  * Heals a duplicate that slipped past the create-time `_detectDuplicate`
101
107
  * scan (or that was persisted by an older template before SD-142352).
102
108
  * When two blocks share a `recommendation-id`, the first occurrence in DOM
103
109
  * order is treated as the source and any later sibling is reassigned a
104
- * fresh id. The store entry and active-block focus are intentionally not
105
- * touched here: each block's persisted `esd-ext-config` carries its own
106
- * truth and the regular save-time hydration (`hydrateRecommendationStore`)
107
- * will seed the new id from that. Skipping `setCurrentBlock` avoids
110
+ * fresh id and queued for the arrival refresh, which seeds the new id's
111
+ * store entry from its persisted `esd-ext-config`. The source's store
112
+ * entry is not cloned and focus is not moved. Skipping `setCurrentBlock` avoids
108
113
  * yanking the user's current selection mid-edit when the heal fires from
109
114
  * `onDocumentChanged`.
110
115
  */
@@ -120,9 +125,9 @@ export declare class RecommendationBlock extends Block {
120
125
  *
121
126
  * Used by `_handleDuplicate` at create-time (which additionally clones the
122
127
  * store entry and focuses the new block) and by `_healLingeringDuplicate`
123
- * at document-change time (which intentionally skips store/focus side
124
- * effects so older bug-affected templates can self-repair without
125
- * disturbing the user's current selection).
128
+ * at document-change time (which skips the clone and focus change so older
129
+ * bug-affected templates can self-repair without disturbing the user's
130
+ * current selection, and queues the arrival refresh for the new id).
126
131
  */
127
132
  private _reassignDuplicateId;
128
133
  /**
@@ -1,4 +1,6 @@
1
1
  import type { RecommendationNodeConfig } from '../types/nodeConfig';
2
+ /** A saved module keeps the id it was saved with, so it can arrive sharing the id of an unrelated block. */
3
+ export declare function resolveSourceConfig(sourceId: number, arrived: RecommendationNodeConfig): RecommendationNodeConfig;
2
4
  /**
3
5
  * Re-reads the strategy of a duplicated block and its source and redraws both: the clone copies the
4
6
  * cards the source last drew, so a strategy edited since then only reached a block once selected (SD-153266).
@@ -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,2 @@
1
+ /** Null when package.json does not pin `guido.stripo.version`. */
2
+ export declare const getStripoRuntimeBaseUrl: () => string | null;
@@ -0,0 +1,9 @@
1
+ const s = "2.79.0", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-MFU2R4FE.js", "chunk-2PIEA5YN.js", "chunk-5FVAINMG.js", "chunk-67OKDPNA.js", "chunk-BEE4NTMB.js", "chunk-FXMA33WF.js", "chunk-HEM7M3GC.js", "chunk-IP346EOD.js", "chunk-J3Q2HMUE.js", "chunk-JER72PP5.js", "chunk-LXRTAID3.js", "chunk-MV5VZJ34.js", "chunk-RTXKBDZV.js", "chunk-UQMM7Q74.js", "chunk-WCDYHSTN.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"], c = {
2
+ version: s,
3
+ files: n
4
+ };
5
+ export {
6
+ c as default,
7
+ n as files,
8
+ s as version
9
+ };
@@ -0,0 +1,26 @@
1
+ import s from "../static/stripo-runtime-manifest.json.js";
2
+ import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
3
+ const r = "data-guido-prefetch", d = "pending", o = "settled", i = `link[${r}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, 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"), n = () => t.setAttribute(r, o);
8
+ t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(r, d), t.addEventListener("load", n, { once: !0 }), t.addEventListener("error", n, { once: !0 }), document.head.appendChild(t);
9
+ }, T = () => {
10
+ try {
11
+ const e = c(), t = document.querySelector(i) !== null;
12
+ if (!e || t || a() || E())
13
+ return;
14
+ s.files.forEach((n) => m(`${e}${n}`));
15
+ } catch (e) {
16
+ console.debug("guido: runtime prefetch skipped", e);
17
+ }
18
+ }, g = () => {
19
+ const e = Array.from(document.querySelectorAll(i));
20
+ return e.length ? e.every((t) => t.getAttribute(r) === o) ? "done" : "pending" : "none";
21
+ };
22
+ export {
23
+ r as RUNTIME_PREFETCH_ATTRIBUTE,
24
+ T as prefetchGuidoRuntime,
25
+ g as readRuntimePrefetchState
26
+ };
@@ -0,0 +1,9 @@
1
+ import r from "../package.json.js";
2
+ const e = "https://email-static.useinsider.com/guido/", n = () => {
3
+ var s;
4
+ const t = r.guido, o = (s = t == null ? void 0 : t.stripo) == null ? void 0 : s.version;
5
+ return o ? `${e}${o}/` : null;
6
+ };
7
+ export {
8
+ n as getStripoRuntimeBaseUrl
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.21.0-beta.7e166b5",
3
+ "version": "3.21.0-beta.8a9421f",
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
  },