@guidelytech/sdk-core 0.14.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/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ export { C as CaptureMarker, a as CaptureOutgoingMessage } from './capture-4Egpj
|
|
|
13
13
|
import './http-zOI8d2c2.cjs';
|
|
14
14
|
|
|
15
15
|
declare const SDK_NAME = "@guidelytech/sdk-core";
|
|
16
|
-
declare const SDK_VERSION = "0.
|
|
16
|
+
declare const SDK_VERSION = "0.16.0";
|
|
17
17
|
declare const DEFAULT_API_URL = "https://api.guidely.app";
|
|
18
18
|
/**
|
|
19
19
|
* Framework-independent Guidely client. Create one per page with {@link createGuidely} or
|
|
@@ -252,6 +252,11 @@ declare class GuidelyClient {
|
|
|
252
252
|
getGuides(): ReadonlyArray<PublishedGuide>;
|
|
253
253
|
isGuideCompleted(idOrKey: string): boolean;
|
|
254
254
|
openResourceCenter(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Opens one help article: in Scout's Help tab when the messenger is on, otherwise in the resource
|
|
257
|
+
* center. Help-article links in guides (`#guidely-article:<id>`) call this.
|
|
258
|
+
*/
|
|
259
|
+
openArticle(articleId: string): void;
|
|
255
260
|
closeResourceCenter(): void;
|
|
256
261
|
/** Opens the Scout messenger (when enabled for the project), optionally on a tab. */
|
|
257
262
|
openMessenger(tab?: MessengerTab): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { C as CaptureMarker, a as CaptureOutgoingMessage } from './capture-C-4R5
|
|
|
13
13
|
import './http-BXys2d-j.js';
|
|
14
14
|
|
|
15
15
|
declare const SDK_NAME = "@guidelytech/sdk-core";
|
|
16
|
-
declare const SDK_VERSION = "0.
|
|
16
|
+
declare const SDK_VERSION = "0.16.0";
|
|
17
17
|
declare const DEFAULT_API_URL = "https://api.guidely.app";
|
|
18
18
|
/**
|
|
19
19
|
* Framework-independent Guidely client. Create one per page with {@link createGuidely} or
|
|
@@ -252,6 +252,11 @@ declare class GuidelyClient {
|
|
|
252
252
|
getGuides(): ReadonlyArray<PublishedGuide>;
|
|
253
253
|
isGuideCompleted(idOrKey: string): boolean;
|
|
254
254
|
openResourceCenter(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Opens one help article: in Scout's Help tab when the messenger is on, otherwise in the resource
|
|
257
|
+
* center. Help-article links in guides (`#guidely-article:<id>`) call this.
|
|
258
|
+
*/
|
|
259
|
+
openArticle(articleId: string): void;
|
|
255
260
|
closeResourceCenter(): void;
|
|
256
261
|
/** Opens the Scout messenger (when enabled for the project), optionally on a tab. */
|
|
257
262
|
openMessenger(tab?: MessengerTab): void;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-XML74K2P.js";
|
|
23
23
|
|
|
24
24
|
// src/client.ts
|
|
25
|
-
import { evaluateRules, localizeGuide, localizeResourceCenter, normalizeLocale, randomId as randomId2, rolloutBucket, sanitizeProperties, supportsPlatform, visibleAnnouncements, visitorLocales } from "@guidelytech/shared/runtime";
|
|
25
|
+
import { articleIdFromHref, evaluateRules, localizeGuide, localizeResourceCenter, normalizeLocale, randomId as randomId2, rolloutBucket, sanitizeProperties, supportsPlatform, visibleAnnouncements, visitorLocales } from "@guidelytech/shared/runtime";
|
|
26
26
|
import {
|
|
27
27
|
closestComposed as closestComposed4,
|
|
28
28
|
composedTarget,
|
|
@@ -1098,7 +1098,7 @@ function createMessengerTransport(opts) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
1100
|
// src/messenger-visitor.ts
|
|
1101
|
-
import { firstNameFromTraits } from "@guidelytech/shared/runtime";
|
|
1101
|
+
import { firstNameFromTraits, videoThumbnailUrl } from "@guidelytech/shared/runtime";
|
|
1102
1102
|
import { urlMatches } from "@guidelytech/guide-runtime";
|
|
1103
1103
|
var PAGE_GUIDE_KINDS = /* @__PURE__ */ new Set(["flow", "tooltip", "modal"]);
|
|
1104
1104
|
var CATCH_ALL = /* @__PURE__ */ new Set(["", "*", "**", "/*", "/**", "/"]);
|
|
@@ -1159,7 +1159,7 @@ function buildMessengerVisitor(input) {
|
|
|
1159
1159
|
key: g.key,
|
|
1160
1160
|
title: step.title || g.name,
|
|
1161
1161
|
body: plainText(step.body ?? ""),
|
|
1162
|
-
imageUrl: step.imageUrl || null,
|
|
1162
|
+
imageUrl: step.imageUrl || videoThumbnailUrl(step.videoUrl) || null,
|
|
1163
1163
|
publishedAt: g.publishedAt,
|
|
1164
1164
|
// Read once opened in the News tab, or once the announcement itself was shown.
|
|
1165
1165
|
unread: !seen.has(g.id) && !(state.guides[g.id]?.impressions ?? 0)
|
|
@@ -1415,7 +1415,7 @@ var loadRecorder = async () => (await import("./recorder.js")).recorder;
|
|
|
1415
1415
|
|
|
1416
1416
|
// src/client.ts
|
|
1417
1417
|
var SDK_NAME = "@guidelytech/sdk-core";
|
|
1418
|
-
var SDK_VERSION = "0.
|
|
1418
|
+
var SDK_VERSION = "0.16.0";
|
|
1419
1419
|
var DEFAULT_API_URL = "https://api.guidely.app";
|
|
1420
1420
|
var PAGE_SCOPED = /* @__PURE__ */ new Set(["page_load", "url_match", "element_click", "element_visible", "delay"]);
|
|
1421
1421
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -1681,6 +1681,15 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
1681
1681
|
const onClick = (e) => this.handleDocumentClick(e);
|
|
1682
1682
|
doc.addEventListener("click", onClick, true);
|
|
1683
1683
|
this.cleanups.push(() => doc.removeEventListener("click", onClick, true));
|
|
1684
|
+
const onArticleLink = (e) => {
|
|
1685
|
+
if (e.defaultPrevented) return;
|
|
1686
|
+
const articleId = articleIdFromHref(composedTarget(e)?.closest?.("a[href]")?.getAttribute("href"));
|
|
1687
|
+
if (!articleId) return;
|
|
1688
|
+
e.preventDefault();
|
|
1689
|
+
this.openArticle(articleId);
|
|
1690
|
+
};
|
|
1691
|
+
doc.addEventListener("click", onArticleLink);
|
|
1692
|
+
this.cleanups.push(() => doc.removeEventListener("click", onArticleLink));
|
|
1684
1693
|
const onVisibility = () => {
|
|
1685
1694
|
const hidden = doc.visibilityState === "hidden";
|
|
1686
1695
|
this.pageTracker.setHidden(hidden);
|
|
@@ -2654,6 +2663,7 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
2654
2663
|
if (action === "start_guide" && value) this.setTimer(() => this.startGuide(value), 0);
|
|
2655
2664
|
else if (action === "event" && value) this.track(value);
|
|
2656
2665
|
else if (action === "open_resource_center") this.openResourceCenter();
|
|
2666
|
+
else if (action === "open_article" && value) this.openArticle(value);
|
|
2657
2667
|
},
|
|
2658
2668
|
onEnd: (reason) => {
|
|
2659
2669
|
if (exclusive) {
|
|
@@ -3064,6 +3074,19 @@ var GuidelyClient = class _GuidelyClient {
|
|
|
3064
3074
|
if (!this.resourceCenter) this.renderPersistentWidgets();
|
|
3065
3075
|
this.resourceCenter?.open();
|
|
3066
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Opens one help article: in Scout's Help tab when the messenger is on, otherwise in the resource
|
|
3079
|
+
* center. Help-article links in guides (`#guidely-article:<id>`) call this.
|
|
3080
|
+
*/
|
|
3081
|
+
openArticle(articleId) {
|
|
3082
|
+
if (this.config?.messenger?.enabled) {
|
|
3083
|
+
void this.loadMessenger().then((m) => m?.openArticle(articleId));
|
|
3084
|
+
return;
|
|
3085
|
+
}
|
|
3086
|
+
if (!this.resourceCenter) this.renderPersistentWidgets();
|
|
3087
|
+
if (this.resourceCenter) this.resourceCenter.openArticle(articleId);
|
|
3088
|
+
else this.log("openArticle: the resource center is not enabled or published for this environment");
|
|
3089
|
+
}
|
|
3067
3090
|
closeResourceCenter() {
|
|
3068
3091
|
if (this.messenger) return this.closeMessenger();
|
|
3069
3092
|
this.resourceCenter?.close();
|