@npaw/forge-web 9.7.5 → 10.0.1
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/dist/forge_kernel_wasm_bg.wasm +0 -0
- package/dist/index.cjs +340 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -15
- package/dist/index.d.ts +93 -15
- package/dist/index.global.js +340 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +340 -1
- package/dist/index.js.map +1 -1
- package/dist/npaw-forge-web.iife.js +341 -2
- package/dist/npaw-forge-web.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -151,6 +151,15 @@ interface ForgeRuntimeConfig {
|
|
|
151
151
|
processEventsBeforeSessionStart?: boolean;
|
|
152
152
|
preSessionEventQueueLimitEvents?: number;
|
|
153
153
|
preSessionEventQueueMaxAgeMs?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Logout guard window in milliseconds (session-update mode only): after
|
|
156
|
+
* `logout()` closes the session, Forge holds the replacement session back
|
|
157
|
+
* for this long so a follow-up `loginSuccess` attaches its own session
|
|
158
|
+
* directly; events raised inside the window are buffered with their
|
|
159
|
+
* original timestamps and flushed into whichever session finally starts.
|
|
160
|
+
* `0` disables the guard. Default 30 000.
|
|
161
|
+
*/
|
|
162
|
+
logoutSessionGuardMs?: number;
|
|
154
163
|
logLevel?: string;
|
|
155
164
|
/**
|
|
156
165
|
* Stable device identifier. Collected automatically unless
|
|
@@ -396,11 +405,51 @@ interface ForgeMutationObserverLike {
|
|
|
396
405
|
disconnect(): void;
|
|
397
406
|
}
|
|
398
407
|
type ForgeMutationObserverFactory = (callback: () => void) => ForgeMutationObserverLike;
|
|
408
|
+
/**
|
|
409
|
+
* The subset of `PerformanceResourceTiming` the network correlator reads.
|
|
410
|
+
*
|
|
411
|
+
* Every phase field is zero for a cross-origin response without a
|
|
412
|
+
* `Timing-Allow-Origin` header, so consumers must treat `responseStart === 0`
|
|
413
|
+
* as "not exposed" rather than "zero milliseconds".
|
|
414
|
+
*/
|
|
415
|
+
interface ForgeResourceTimingLike {
|
|
416
|
+
readonly name: string;
|
|
417
|
+
readonly entryType: string;
|
|
418
|
+
readonly startTime: number;
|
|
419
|
+
readonly duration: number;
|
|
420
|
+
readonly initiatorType?: string;
|
|
421
|
+
readonly nextHopProtocol?: string;
|
|
422
|
+
readonly redirectStart?: number;
|
|
423
|
+
readonly redirectEnd?: number;
|
|
424
|
+
readonly domainLookupStart?: number;
|
|
425
|
+
readonly domainLookupEnd?: number;
|
|
426
|
+
readonly connectStart?: number;
|
|
427
|
+
readonly connectEnd?: number;
|
|
428
|
+
readonly secureConnectionStart?: number;
|
|
429
|
+
readonly requestStart?: number;
|
|
430
|
+
readonly responseStart?: number;
|
|
431
|
+
readonly responseEnd?: number;
|
|
432
|
+
readonly transferSize?: number;
|
|
433
|
+
readonly encodedBodySize?: number;
|
|
434
|
+
readonly decodedBodySize?: number;
|
|
435
|
+
}
|
|
436
|
+
interface ForgeResourceTimingObserverLike {
|
|
437
|
+
disconnect(): void;
|
|
438
|
+
}
|
|
439
|
+
type ForgeResourceTimingObserverFactory = (callback: (entries: readonly ForgeResourceTimingLike[]) => void) => ForgeResourceTimingObserverLike;
|
|
399
440
|
interface ForgeCaptureEnvironment {
|
|
400
441
|
window?: Window;
|
|
401
442
|
document?: Document;
|
|
402
443
|
location?: Location;
|
|
403
|
-
|
|
444
|
+
/**
|
|
445
|
+
* `now` is the capture clock. `getEntriesByType` and the observer factory are
|
|
446
|
+
* the Resource Timing surface used to recover request timings the fetch/XHR
|
|
447
|
+
* wrappers cannot see — connection phases, protocol, and a duration that is
|
|
448
|
+
* not skewed by JS scheduling. Both are optional so a host can inject a
|
|
449
|
+
* clock-only double.
|
|
450
|
+
*/
|
|
451
|
+
performance?: Pick<Performance, "now"> & Partial<Pick<Performance, "getEntriesByType">>;
|
|
452
|
+
resourceTimingObserverFactory?: ForgeResourceTimingObserverFactory;
|
|
404
453
|
timers?: ForgeCaptureTimers;
|
|
405
454
|
intersectionObserverFactory?: ForgeIntersectionObserverFactory;
|
|
406
455
|
mutationObserverFactory?: ForgeMutationObserverFactory;
|
|
@@ -458,6 +507,8 @@ interface ForgeTransportRequest {
|
|
|
458
507
|
headers: Record<string, string>;
|
|
459
508
|
query: NormalizedParams;
|
|
460
509
|
body?: unknown;
|
|
510
|
+
/** The kernel's own serialization of `body`, byte-exact; send this when present. */
|
|
511
|
+
bodyText?: string;
|
|
461
512
|
bodyBytes?: number[];
|
|
462
513
|
}
|
|
463
514
|
interface ForgeHttpResponse {
|
|
@@ -688,6 +739,12 @@ interface ContentMetadata {
|
|
|
688
739
|
nodeType?: string;
|
|
689
740
|
nodeTypeString?: string;
|
|
690
741
|
linkedViewId?: string;
|
|
742
|
+
/** Page/context URL (OLD-parity `referer`); defaults to the current page URL per event when unset. */
|
|
743
|
+
referer?: string;
|
|
744
|
+
/** Traffic origin (OLD-parity `referral`); defaults to `document.referrer` when unset. */
|
|
745
|
+
referral?: string;
|
|
746
|
+
/** Milliseconds from navigation start to player setup (OLD-parity `playerStartupTime`); stamped at adapter attach when unset. */
|
|
747
|
+
playerStartupTimeMs?: number;
|
|
691
748
|
package?: string;
|
|
692
749
|
saga?: string;
|
|
693
750
|
tvShow?: string;
|
|
@@ -811,6 +868,15 @@ interface NetworkObservation {
|
|
|
811
868
|
redirectDurationMs?: number;
|
|
812
869
|
redirectCount?: number;
|
|
813
870
|
protocol?: string;
|
|
871
|
+
/**
|
|
872
|
+
* Resource class of the request as reported by the observing host, e.g. a
|
|
873
|
+
* player adapter classifying its SDK's own downloads. Canonical lowercase
|
|
874
|
+
* tokens: `manifest`, `media`, `media_video`, `media_audio`,
|
|
875
|
+
* `media_subtitles`, `media_thumbnails`, `drm_license`, `drm_key`,
|
|
876
|
+
* `asset_list`. The kernel caps it at 32 chars on the wire (wire key
|
|
877
|
+
* `requestType`, fact `net.request_type`).
|
|
878
|
+
*/
|
|
879
|
+
requestType?: string;
|
|
814
880
|
/**
|
|
815
881
|
* Request/response body sizes in bytes. Body content is never captured:
|
|
816
882
|
* the binding measures the outgoing body bytes when it can and falls back
|
|
@@ -860,20 +926,6 @@ interface ForgeLocationFix {
|
|
|
860
926
|
timestampMs: number;
|
|
861
927
|
}
|
|
862
928
|
|
|
863
|
-
/**
|
|
864
|
-
* Copyright (C) NPAW - All Rights Reserved
|
|
865
|
-
*
|
|
866
|
-
* This source code is protected under international copyright law. All rights
|
|
867
|
-
* reserved and protected by the copyright holders.
|
|
868
|
-
* This file is confidential and only available to authorized individuals with the
|
|
869
|
-
* permission of the copyright holders. If you encounter this file and do not have
|
|
870
|
-
* permission, please contact the copyright holders and delete this file.
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
874
|
-
* @description: Video, player-adapter, and ad-adapter facade classes for Forge Web.
|
|
875
|
-
*/
|
|
876
|
-
|
|
877
929
|
type VideoMetadataSampler = () => MetadataSnapshot | undefined;
|
|
878
930
|
type AdMetadataSampler = () => AdMetadata | undefined;
|
|
879
931
|
interface PlayerAdapterHost {
|
|
@@ -927,6 +979,9 @@ declare class VideoAdapter {
|
|
|
927
979
|
private adAdapter;
|
|
928
980
|
private state;
|
|
929
981
|
private adState;
|
|
982
|
+
/** OLD-parity `playerStartupTime` anchor: ms from navigation start to the
|
|
983
|
+
* moment a player adapter attached to this view. */
|
|
984
|
+
private playerSetupAtMs;
|
|
930
985
|
constructor(runtime: unknown, viewId: number, metadata?: ContentMetadata, qos?: QosSnapshot);
|
|
931
986
|
setPlayerAdapter(adapter: PlayerAdapterHost): void;
|
|
932
987
|
setAdAdapter(adapter: AdAdapterHost): AdAdapter;
|
|
@@ -1044,6 +1099,29 @@ declare class NPAWForge {
|
|
|
1044
1099
|
trackSessionEventStop(name: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1045
1100
|
trackSessionError(errorCode: string, errorMessage?: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1046
1101
|
trackRawEvent(name: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Hot-updates session-level dimensions without restarting the session:
|
|
1104
|
+
* `param1`..`param20` extraparams, `screenName`, or any dimension the NQS
|
|
1105
|
+
* parameter registry marks updatable — new backend dimensions work without
|
|
1106
|
+
* an SDK release. The change reaches NQS on the next session event within
|
|
1107
|
+
* one second, or on an immediate beat after that window; the very next
|
|
1108
|
+
* analytics row shows the new values, and later video views inherit them.
|
|
1109
|
+
*
|
|
1110
|
+
* Identity keys (`username`, `profileId`, `userType`, `anonymousUser`) are
|
|
1111
|
+
* rejected — use the typed identity API (`loginSuccess`,
|
|
1112
|
+
* `profileSelected`, `logout`). Blank values are dropped: NQS never erases
|
|
1113
|
+
* a session value. Requires the account's remote config to enable session
|
|
1114
|
+
* updates; otherwise the update is ignored with a diagnostic.
|
|
1115
|
+
*/
|
|
1116
|
+
updateSession(params: ForgeParams): Promise<ForgeResult>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Reports numeric session metrics (account-registered custom metrics).
|
|
1119
|
+
* Values accumulate on the server per the account's registered operation
|
|
1120
|
+
* (sum/min/average/...) and settle on the session close row. Re-sending an
|
|
1121
|
+
* unchanged value is a no-op. Same remote-config gating as
|
|
1122
|
+
* {@link updateSession}.
|
|
1123
|
+
*/
|
|
1124
|
+
updateSessionMetrics(metrics: Record<string, number>): Promise<ForgeResult>;
|
|
1047
1125
|
/**
|
|
1048
1126
|
* Emits a `raw_search` event. The query text is subject to the kernel-side
|
|
1049
1127
|
* remote visible-text privacy policy, which can strip it before any payload
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,15 @@ interface ForgeRuntimeConfig {
|
|
|
151
151
|
processEventsBeforeSessionStart?: boolean;
|
|
152
152
|
preSessionEventQueueLimitEvents?: number;
|
|
153
153
|
preSessionEventQueueMaxAgeMs?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Logout guard window in milliseconds (session-update mode only): after
|
|
156
|
+
* `logout()` closes the session, Forge holds the replacement session back
|
|
157
|
+
* for this long so a follow-up `loginSuccess` attaches its own session
|
|
158
|
+
* directly; events raised inside the window are buffered with their
|
|
159
|
+
* original timestamps and flushed into whichever session finally starts.
|
|
160
|
+
* `0` disables the guard. Default 30 000.
|
|
161
|
+
*/
|
|
162
|
+
logoutSessionGuardMs?: number;
|
|
154
163
|
logLevel?: string;
|
|
155
164
|
/**
|
|
156
165
|
* Stable device identifier. Collected automatically unless
|
|
@@ -396,11 +405,51 @@ interface ForgeMutationObserverLike {
|
|
|
396
405
|
disconnect(): void;
|
|
397
406
|
}
|
|
398
407
|
type ForgeMutationObserverFactory = (callback: () => void) => ForgeMutationObserverLike;
|
|
408
|
+
/**
|
|
409
|
+
* The subset of `PerformanceResourceTiming` the network correlator reads.
|
|
410
|
+
*
|
|
411
|
+
* Every phase field is zero for a cross-origin response without a
|
|
412
|
+
* `Timing-Allow-Origin` header, so consumers must treat `responseStart === 0`
|
|
413
|
+
* as "not exposed" rather than "zero milliseconds".
|
|
414
|
+
*/
|
|
415
|
+
interface ForgeResourceTimingLike {
|
|
416
|
+
readonly name: string;
|
|
417
|
+
readonly entryType: string;
|
|
418
|
+
readonly startTime: number;
|
|
419
|
+
readonly duration: number;
|
|
420
|
+
readonly initiatorType?: string;
|
|
421
|
+
readonly nextHopProtocol?: string;
|
|
422
|
+
readonly redirectStart?: number;
|
|
423
|
+
readonly redirectEnd?: number;
|
|
424
|
+
readonly domainLookupStart?: number;
|
|
425
|
+
readonly domainLookupEnd?: number;
|
|
426
|
+
readonly connectStart?: number;
|
|
427
|
+
readonly connectEnd?: number;
|
|
428
|
+
readonly secureConnectionStart?: number;
|
|
429
|
+
readonly requestStart?: number;
|
|
430
|
+
readonly responseStart?: number;
|
|
431
|
+
readonly responseEnd?: number;
|
|
432
|
+
readonly transferSize?: number;
|
|
433
|
+
readonly encodedBodySize?: number;
|
|
434
|
+
readonly decodedBodySize?: number;
|
|
435
|
+
}
|
|
436
|
+
interface ForgeResourceTimingObserverLike {
|
|
437
|
+
disconnect(): void;
|
|
438
|
+
}
|
|
439
|
+
type ForgeResourceTimingObserverFactory = (callback: (entries: readonly ForgeResourceTimingLike[]) => void) => ForgeResourceTimingObserverLike;
|
|
399
440
|
interface ForgeCaptureEnvironment {
|
|
400
441
|
window?: Window;
|
|
401
442
|
document?: Document;
|
|
402
443
|
location?: Location;
|
|
403
|
-
|
|
444
|
+
/**
|
|
445
|
+
* `now` is the capture clock. `getEntriesByType` and the observer factory are
|
|
446
|
+
* the Resource Timing surface used to recover request timings the fetch/XHR
|
|
447
|
+
* wrappers cannot see — connection phases, protocol, and a duration that is
|
|
448
|
+
* not skewed by JS scheduling. Both are optional so a host can inject a
|
|
449
|
+
* clock-only double.
|
|
450
|
+
*/
|
|
451
|
+
performance?: Pick<Performance, "now"> & Partial<Pick<Performance, "getEntriesByType">>;
|
|
452
|
+
resourceTimingObserverFactory?: ForgeResourceTimingObserverFactory;
|
|
404
453
|
timers?: ForgeCaptureTimers;
|
|
405
454
|
intersectionObserverFactory?: ForgeIntersectionObserverFactory;
|
|
406
455
|
mutationObserverFactory?: ForgeMutationObserverFactory;
|
|
@@ -458,6 +507,8 @@ interface ForgeTransportRequest {
|
|
|
458
507
|
headers: Record<string, string>;
|
|
459
508
|
query: NormalizedParams;
|
|
460
509
|
body?: unknown;
|
|
510
|
+
/** The kernel's own serialization of `body`, byte-exact; send this when present. */
|
|
511
|
+
bodyText?: string;
|
|
461
512
|
bodyBytes?: number[];
|
|
462
513
|
}
|
|
463
514
|
interface ForgeHttpResponse {
|
|
@@ -688,6 +739,12 @@ interface ContentMetadata {
|
|
|
688
739
|
nodeType?: string;
|
|
689
740
|
nodeTypeString?: string;
|
|
690
741
|
linkedViewId?: string;
|
|
742
|
+
/** Page/context URL (OLD-parity `referer`); defaults to the current page URL per event when unset. */
|
|
743
|
+
referer?: string;
|
|
744
|
+
/** Traffic origin (OLD-parity `referral`); defaults to `document.referrer` when unset. */
|
|
745
|
+
referral?: string;
|
|
746
|
+
/** Milliseconds from navigation start to player setup (OLD-parity `playerStartupTime`); stamped at adapter attach when unset. */
|
|
747
|
+
playerStartupTimeMs?: number;
|
|
691
748
|
package?: string;
|
|
692
749
|
saga?: string;
|
|
693
750
|
tvShow?: string;
|
|
@@ -811,6 +868,15 @@ interface NetworkObservation {
|
|
|
811
868
|
redirectDurationMs?: number;
|
|
812
869
|
redirectCount?: number;
|
|
813
870
|
protocol?: string;
|
|
871
|
+
/**
|
|
872
|
+
* Resource class of the request as reported by the observing host, e.g. a
|
|
873
|
+
* player adapter classifying its SDK's own downloads. Canonical lowercase
|
|
874
|
+
* tokens: `manifest`, `media`, `media_video`, `media_audio`,
|
|
875
|
+
* `media_subtitles`, `media_thumbnails`, `drm_license`, `drm_key`,
|
|
876
|
+
* `asset_list`. The kernel caps it at 32 chars on the wire (wire key
|
|
877
|
+
* `requestType`, fact `net.request_type`).
|
|
878
|
+
*/
|
|
879
|
+
requestType?: string;
|
|
814
880
|
/**
|
|
815
881
|
* Request/response body sizes in bytes. Body content is never captured:
|
|
816
882
|
* the binding measures the outgoing body bytes when it can and falls back
|
|
@@ -860,20 +926,6 @@ interface ForgeLocationFix {
|
|
|
860
926
|
timestampMs: number;
|
|
861
927
|
}
|
|
862
928
|
|
|
863
|
-
/**
|
|
864
|
-
* Copyright (C) NPAW - All Rights Reserved
|
|
865
|
-
*
|
|
866
|
-
* This source code is protected under international copyright law. All rights
|
|
867
|
-
* reserved and protected by the copyright holders.
|
|
868
|
-
* This file is confidential and only available to authorized individuals with the
|
|
869
|
-
* permission of the copyright holders. If you encounter this file and do not have
|
|
870
|
-
* permission, please contact the copyright holders and delete this file.
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
874
|
-
* @description: Video, player-adapter, and ad-adapter facade classes for Forge Web.
|
|
875
|
-
*/
|
|
876
|
-
|
|
877
929
|
type VideoMetadataSampler = () => MetadataSnapshot | undefined;
|
|
878
930
|
type AdMetadataSampler = () => AdMetadata | undefined;
|
|
879
931
|
interface PlayerAdapterHost {
|
|
@@ -927,6 +979,9 @@ declare class VideoAdapter {
|
|
|
927
979
|
private adAdapter;
|
|
928
980
|
private state;
|
|
929
981
|
private adState;
|
|
982
|
+
/** OLD-parity `playerStartupTime` anchor: ms from navigation start to the
|
|
983
|
+
* moment a player adapter attached to this view. */
|
|
984
|
+
private playerSetupAtMs;
|
|
930
985
|
constructor(runtime: unknown, viewId: number, metadata?: ContentMetadata, qos?: QosSnapshot);
|
|
931
986
|
setPlayerAdapter(adapter: PlayerAdapterHost): void;
|
|
932
987
|
setAdAdapter(adapter: AdAdapterHost): AdAdapter;
|
|
@@ -1044,6 +1099,29 @@ declare class NPAWForge {
|
|
|
1044
1099
|
trackSessionEventStop(name: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1045
1100
|
trackSessionError(errorCode: string, errorMessage?: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1046
1101
|
trackRawEvent(name: string, params?: ForgeParams): Promise<ForgeResult>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Hot-updates session-level dimensions without restarting the session:
|
|
1104
|
+
* `param1`..`param20` extraparams, `screenName`, or any dimension the NQS
|
|
1105
|
+
* parameter registry marks updatable — new backend dimensions work without
|
|
1106
|
+
* an SDK release. The change reaches NQS on the next session event within
|
|
1107
|
+
* one second, or on an immediate beat after that window; the very next
|
|
1108
|
+
* analytics row shows the new values, and later video views inherit them.
|
|
1109
|
+
*
|
|
1110
|
+
* Identity keys (`username`, `profileId`, `userType`, `anonymousUser`) are
|
|
1111
|
+
* rejected — use the typed identity API (`loginSuccess`,
|
|
1112
|
+
* `profileSelected`, `logout`). Blank values are dropped: NQS never erases
|
|
1113
|
+
* a session value. Requires the account's remote config to enable session
|
|
1114
|
+
* updates; otherwise the update is ignored with a diagnostic.
|
|
1115
|
+
*/
|
|
1116
|
+
updateSession(params: ForgeParams): Promise<ForgeResult>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Reports numeric session metrics (account-registered custom metrics).
|
|
1119
|
+
* Values accumulate on the server per the account's registered operation
|
|
1120
|
+
* (sum/min/average/...) and settle on the session close row. Re-sending an
|
|
1121
|
+
* unchanged value is a no-op. Same remote-config gating as
|
|
1122
|
+
* {@link updateSession}.
|
|
1123
|
+
*/
|
|
1124
|
+
updateSessionMetrics(metrics: Record<string, number>): Promise<ForgeResult>;
|
|
1047
1125
|
/**
|
|
1048
1126
|
* Emits a `raw_search` event. The query text is subject to the kernel-side
|
|
1049
1127
|
* remote visible-text privacy policy, which can strip it before any payload
|