kenobi-js 0.1.39 → 0.1.40
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/browser/dist.js +5 -35
- package/browser/dist.js.map +2 -2
- package/browser/dist.min.js +5 -5
- package/package.json +1 -1
package/browser/dist.js
CHANGED
|
@@ -2439,7 +2439,6 @@ var KenobiLib = (() => {
|
|
|
2439
2439
|
__publicField(this, "currentUrl");
|
|
2440
2440
|
__publicField(this, "navTicking", false);
|
|
2441
2441
|
__publicField(this, "transitionDefaults");
|
|
2442
|
-
__publicField(this, "cueCardPaths");
|
|
2443
2442
|
__publicField(this, "startAutoTransform", /* @__PURE__ */ __name(async () => {
|
|
2444
2443
|
try {
|
|
2445
2444
|
this.syncChangeStack();
|
|
@@ -2572,18 +2571,6 @@ var KenobiLib = (() => {
|
|
|
2572
2571
|
__publicField(this, "getDurationInMilliseconds", /* @__PURE__ */ __name((start, end) => +end - +start, "getDurationInMilliseconds"));
|
|
2573
2572
|
__publicField(this, "formatThousands", /* @__PURE__ */ __name((number) => new Intl.NumberFormat("en-US").format(number), "formatThousands"));
|
|
2574
2573
|
__publicField(this, "setDebug", /* @__PURE__ */ __name((value) => this.config.debug = value, "setDebug"));
|
|
2575
|
-
/**
|
|
2576
|
-
* Checks if a path matches a pattern (exact match only).
|
|
2577
|
-
*/
|
|
2578
|
-
__publicField(this, "matchesPathPattern", /* @__PURE__ */ __name((path, pattern) => {
|
|
2579
|
-
const normalizedPath = path === "/" ? "/" : path.replace(/\/$/, "");
|
|
2580
|
-
const normalizedPattern = pattern === "/" ? "/" : pattern.replace(/\/$/, "");
|
|
2581
|
-
return normalizedPath === normalizedPattern;
|
|
2582
|
-
}, "matchesPathPattern"));
|
|
2583
|
-
/**
|
|
2584
|
-
* Checks if the given path matches any of the configured cueCardPaths.
|
|
2585
|
-
*/
|
|
2586
|
-
__publicField(this, "isPathAllowedForCueCard", /* @__PURE__ */ __name((path) => this.cueCardPaths.some((pattern) => this.matchesPathPattern(path, pattern)), "isPathAllowedForCueCard"));
|
|
2587
2574
|
__publicField(this, "isInputElement", /* @__PURE__ */ __name((el) => {
|
|
2588
2575
|
if (!(el instanceof HTMLInputElement) && !(el instanceof HTMLTextAreaElement) && !(el instanceof HTMLSelectElement))
|
|
2589
2576
|
return false;
|
|
@@ -3102,13 +3089,6 @@ var KenobiLib = (() => {
|
|
|
3102
3089
|
this.log("warn", "CueCard already initialized, skipping...");
|
|
3103
3090
|
return;
|
|
3104
3091
|
}
|
|
3105
|
-
if (!this.isPathAllowedForCueCard(this.currentPath)) {
|
|
3106
|
-
this.log(
|
|
3107
|
-
"debug",
|
|
3108
|
-
`CueCard not mounted: path "${this.currentPath}" not in allowed paths`
|
|
3109
|
-
);
|
|
3110
|
-
return;
|
|
3111
|
-
}
|
|
3112
3092
|
const configResponse = await this.fetchCueCardConfig(this.currentPath);
|
|
3113
3093
|
if (!configResponse || !configResponse.enabled) {
|
|
3114
3094
|
this.log(
|
|
@@ -3156,26 +3136,17 @@ var KenobiLib = (() => {
|
|
|
3156
3136
|
}, "initCueCard"));
|
|
3157
3137
|
/**
|
|
3158
3138
|
* Syncs CueCard visibility based on the current path.
|
|
3159
|
-
*
|
|
3139
|
+
* Checks with the server if an active template exists for the new path.
|
|
3160
3140
|
* Called after navigation changes.
|
|
3161
3141
|
*/
|
|
3162
|
-
__publicField(this, "syncCueCardVisibility", /* @__PURE__ */ __name(() => {
|
|
3142
|
+
__publicField(this, "syncCueCardVisibility", /* @__PURE__ */ __name(async () => {
|
|
3163
3143
|
if (!this.config.publicKey) return;
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
this.log(
|
|
3167
|
-
"debug",
|
|
3168
|
-
`Navigated to allowed path "${this.currentPath}", checking for active template...`
|
|
3169
|
-
);
|
|
3170
|
-
void this.initCueCard();
|
|
3171
|
-
} else if (!isAllowed && this.cueCardInstance) {
|
|
3172
|
-
this.log(
|
|
3173
|
-
"debug",
|
|
3174
|
-
`Navigated away from allowed paths to "${this.currentPath}", unmounting CueCard`
|
|
3175
|
-
);
|
|
3144
|
+
if (this.cueCardInstance) {
|
|
3145
|
+
this.log("debug", `Navigation detected, unmounting CueCard`);
|
|
3176
3146
|
this.cueCardInstance.unmount();
|
|
3177
3147
|
this.cueCardInstance = null;
|
|
3178
3148
|
}
|
|
3149
|
+
void this.initCueCard();
|
|
3179
3150
|
}, "syncCueCardVisibility"));
|
|
3180
3151
|
/**
|
|
3181
3152
|
* Triggers personalization by calling the API with the provided input.
|
|
@@ -3255,7 +3226,6 @@ var KenobiLib = (() => {
|
|
|
3255
3226
|
this.config.transitionDefaults
|
|
3256
3227
|
);
|
|
3257
3228
|
this.orchestrator = new TransitionOrchestrator();
|
|
3258
|
-
this.cueCardPaths = this.config.cueCardPaths ?? ["/"];
|
|
3259
3229
|
this.syncVisitorKey();
|
|
3260
3230
|
this.currentPath = this.getCurrentPath();
|
|
3261
3231
|
this.currentUrl = this.getCurrentUrl();
|