@guidelytech/sdk-core 0.15.0 → 0.16.0
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/README.md +1 -0
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/capture-CgN69Lxq.d.cts +0 -100
- package/dist/capture-Csz721-A.d.ts +0 -100
- package/dist/chunk-JUSM7J5N.js +0 -376
- package/dist/chunk-JUSM7J5N.js.map +0 -1
- package/dist/chunk-ZAF2KRJA.js +0 -334
- package/dist/chunk-ZAF2KRJA.js.map +0 -1
- package/dist/health-sbP9JwTE.d.cts +0 -90
- package/dist/health-sbP9JwTE.d.ts +0 -90
- package/dist/http-Cb6KYYFv.d.cts +0 -61
- package/dist/http-D047Ngxk.d.ts +0 -61
- package/dist/types-BDlebXrm.d.ts +0 -314
- package/dist/types-Mtlmlj5C.d.cts +0 -314
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ event, never thrown into the host application.
|
|
|
81
81
|
| `completeChecklistTask(idOrKey, taskId)` | Manual completion; syncs to `/sdk/checklists/:id/progress`. |
|
|
82
82
|
| `openChecklist(idOrKey)` / `closeChecklist(idOrKey)` | Show/hide the checklist panel (re-renders a dismissed checklist). |
|
|
83
83
|
| `openResourceCenter()` / `closeResourceCenter()` | Toggle the resource center panel. |
|
|
84
|
+
| `openArticle(articleId)` | Open one help article (Scout's Help tab when the messenger is on). Links to `#guidely-article:<id>` anywhere on the page, including guide bodies, do this. |
|
|
84
85
|
| `refresh()` | Re-fetch config now. |
|
|
85
86
|
| `on(event, cb): () => void` / `off(event, cb)` | Subscribe to events (below). |
|
|
86
87
|
| `getContext()` | The `TargetingContext` used for rule evaluation (debugging). |
|
package/dist/index.cjs
CHANGED
|
@@ -1735,7 +1735,7 @@ function buildMessengerVisitor(input) {
|
|
|
1735
1735
|
key: g.key,
|
|
1736
1736
|
title: step.title || g.name,
|
|
1737
1737
|
body: plainText(step.body ?? ""),
|
|
1738
|
-
imageUrl: step.imageUrl || null,
|
|
1738
|
+
imageUrl: step.imageUrl || (0, import_runtime15.videoThumbnailUrl)(step.videoUrl) || null,
|
|
1739
1739
|
publishedAt: g.publishedAt,
|
|
1740
1740
|
// Read once opened in the News tab, or once the announcement itself was shown.
|
|
1741
1741
|
unread: !seen.has(g.id) && !(state.guides[g.id]?.impressions ?? 0)
|
|
@@ -2118,7 +2118,7 @@ var loadRecorder = async () => (await import("./recorder.cjs")).recorder;
|
|
|
2118
2118
|
|
|
2119
2119
|
// src/client.ts
|
|
2120
2120
|
var SDK_NAME = "@guidelytech/sdk-core";
|
|
2121
|
-
var SDK_VERSION = "0.
|
|
2121
|
+
var SDK_VERSION = "0.16.0";
|
|
2122
2122
|
var DEFAULT_API_URL = "https://api.guidely.app";
|
|
2123
2123
|
var PAGE_SCOPED = /* @__PURE__ */ new Set(["page_load", "url_match", "element_click", "element_visible", "delay"]);
|
|
2124
2124
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -2384,6 +2384,15 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
2384
2384
|
const onClick = (e) => this.handleDocumentClick(e);
|
|
2385
2385
|
doc.addEventListener("click", onClick, true);
|
|
2386
2386
|
this.cleanups.push(() => doc.removeEventListener("click", onClick, true));
|
|
2387
|
+
const onArticleLink = (e) => {
|
|
2388
|
+
if (e.defaultPrevented) return;
|
|
2389
|
+
const articleId = (0, import_runtime18.articleIdFromHref)((0, import_guide_runtime5.composedTarget)(e)?.closest?.("a[href]")?.getAttribute("href"));
|
|
2390
|
+
if (!articleId) return;
|
|
2391
|
+
e.preventDefault();
|
|
2392
|
+
this.openArticle(articleId);
|
|
2393
|
+
};
|
|
2394
|
+
doc.addEventListener("click", onArticleLink);
|
|
2395
|
+
this.cleanups.push(() => doc.removeEventListener("click", onArticleLink));
|
|
2387
2396
|
const onVisibility = () => {
|
|
2388
2397
|
const hidden = doc.visibilityState === "hidden";
|
|
2389
2398
|
this.pageTracker.setHidden(hidden);
|
|
@@ -3357,6 +3366,7 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
3357
3366
|
if (action === "start_guide" && value) this.setTimer(() => this.startGuide(value), 0);
|
|
3358
3367
|
else if (action === "event" && value) this.track(value);
|
|
3359
3368
|
else if (action === "open_resource_center") this.openResourceCenter();
|
|
3369
|
+
else if (action === "open_article" && value) this.openArticle(value);
|
|
3360
3370
|
},
|
|
3361
3371
|
onEnd: (reason) => {
|
|
3362
3372
|
if (exclusive) {
|
|
@@ -3767,6 +3777,19 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
3767
3777
|
if (!this.resourceCenter) this.renderPersistentWidgets();
|
|
3768
3778
|
this.resourceCenter?.open();
|
|
3769
3779
|
}
|
|
3780
|
+
/**
|
|
3781
|
+
* Opens one help article: in Scout's Help tab when the messenger is on, otherwise in the resource
|
|
3782
|
+
* center. Help-article links in guides (`#guidely-article:<id>`) call this.
|
|
3783
|
+
*/
|
|
3784
|
+
openArticle(articleId) {
|
|
3785
|
+
if (this.config?.messenger?.enabled) {
|
|
3786
|
+
void this.loadMessenger().then((m) => m?.openArticle(articleId));
|
|
3787
|
+
return;
|
|
3788
|
+
}
|
|
3789
|
+
if (!this.resourceCenter) this.renderPersistentWidgets();
|
|
3790
|
+
if (this.resourceCenter) this.resourceCenter.openArticle(articleId);
|
|
3791
|
+
else this.log("openArticle: the resource center is not enabled or published for this environment");
|
|
3792
|
+
}
|
|
3770
3793
|
closeResourceCenter() {
|
|
3771
3794
|
if (this.messenger) return this.closeMessenger();
|
|
3772
3795
|
this.resourceCenter?.close();
|