@wix/himalaya-cli 0.1574.0 → 0.1575.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/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +16 -5
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/telemetry/wix-bi/src/index.d.ts +15 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/telemetry/wix-bi/src/oneapp.d.ts +90 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-bi.mjs +165 -5
- package/dist/cli.mjs +3479 -2601
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/designing-himi-screens.md +7 -1
- package/guides/hhp.md +2 -2
- package/guides/himi-json-output.md +12 -0
- package/guides/push-cli-onboarding.md +10 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +74 -127
- package/templates/beauty-salon/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +18 -5
- package/templates/beauty-salon-owner/dev/index.ts +5 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/branded-lite/dev/index.ts +114 -136
- package/templates/branded-lite/l10n/en.json +570 -0
- package/templates/branded-lite/l10n/he.json +200 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-message-model.ts +1 -1
- package/templates/branded-lite/tier5-src/_shared/business-chat-model.ts +3 -2
- package/templates/branded-lite/tier5-src/_shared/business-chat-presenter.ts +26 -21
- package/templates/branded-lite/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/branded-lite/tier5-src/business-chat/index.ts +184 -63
- package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +18 -5
- package/templates/community-club-owner/dev/index.ts +5 -0
- package/templates/community-club-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/community-club-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/community-club-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/events-meetups-owner/dev/index.ts +3 -0
- package/templates/events-meetups-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/gym-fitness/dev/index.ts +74 -127
- package/templates/gym-fitness/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +18 -5
- package/templates/gym-fitness-owner/dev/index.ts +6 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/nonprofit-cause-owner/dev/index.ts +4 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/owner-lite/dev/index.ts +6 -0
- package/templates/owner-lite/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/owner-lite/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/owner-lite/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/owner-lite/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/podcast-creator-owner/dev/index.ts +5 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/portfolio-creative/dev/index.ts +74 -127
- package/templates/portfolio-creative/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +18 -5
- package/templates/portfolio-creative-owner/dev/index.ts +5 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/restaurant-owner/dev/index.ts +6 -0
- package/templates/restaurant-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
- package/templates/retail-store/dev/index.ts +74 -127
- package/templates/retail-store/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +18 -5
- package/templates/retail-store-owner/dev/index.ts +4 -0
- package/templates/retail-store-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-product-form/index.ts +5 -1
- package/templates/yoga-studio-owner/dev/index.ts +4 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/exclusive-writes.ts +66 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event-form/index.ts +5 -1
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post-form/index.ts +5 -1
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service-form/index.ts +5 -1
|
@@ -17,16 +17,20 @@ export interface LinkableScreen {
|
|
|
17
17
|
parentScreenId: string;
|
|
18
18
|
tabId: string;
|
|
19
19
|
}
|
|
20
|
+
export interface FrogTelemetryConfig {
|
|
21
|
+
src: number;
|
|
22
|
+
variant?: string;
|
|
23
|
+
endpoint?: string;
|
|
24
|
+
commonParams?: "himi" | "oneapp";
|
|
25
|
+
mobileAppId?: string;
|
|
26
|
+
lv?: string;
|
|
27
|
+
}
|
|
20
28
|
export interface TelemetryConfig {
|
|
21
29
|
enabled: boolean;
|
|
22
30
|
samplingRate: number;
|
|
23
31
|
eventAllowlist?: string[];
|
|
24
32
|
ingestUrl?: string;
|
|
25
|
-
frog?:
|
|
26
|
-
src: number;
|
|
27
|
-
variant?: string;
|
|
28
|
-
endpoint?: string;
|
|
29
|
-
};
|
|
33
|
+
frog?: FrogTelemetryConfig;
|
|
30
34
|
sentry?: {
|
|
31
35
|
enabled: boolean;
|
|
32
36
|
dsn: string;
|
|
@@ -127,6 +131,13 @@ export interface WixPlatformConfig {
|
|
|
127
131
|
src?: number;
|
|
128
132
|
endpoint?: string;
|
|
129
133
|
variant?: string;
|
|
134
|
+
/** `"oneapp"` = stamp the RN one-app engine's common fields and POST its envelope
|
|
135
|
+
* (apps replacing the RN Owner / Spaces / Branded apps). Default `"himi"`. */
|
|
136
|
+
commonParams?: "himi" | "oneapp";
|
|
137
|
+
/** oneapp: RN `mobile_app_id` — `owner`, `spaces`, `brandedLite_{msid}` (`{msid}` is replaced). */
|
|
138
|
+
mobileAppId?: string;
|
|
139
|
+
/** oneapp: logger version `_lv`. Default `1.0.0|Himi`. */
|
|
140
|
+
lv?: string;
|
|
130
141
|
};
|
|
131
142
|
/** Petri experiment scope (the conduction namespace for this app). */
|
|
132
143
|
experiments?: {
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts
CHANGED
|
@@ -915,6 +915,12 @@ export interface TelemetryConfig {
|
|
|
915
915
|
src: number;
|
|
916
916
|
variant?: string;
|
|
917
917
|
endpoint?: string;
|
|
918
|
+
/** `"oneapp"` = RN one-app engine common fields + POST envelope (epic #4973). Default `"himi"`. */
|
|
919
|
+
commonParams?: "himi" | "oneapp";
|
|
920
|
+
/** oneapp: RN `mobile_app_id`; `{msid}` is replaced with the bound/active site. */
|
|
921
|
+
mobileAppId?: string;
|
|
922
|
+
/** oneapp: logger version `_lv` (default `1.0.0|Himi`). */
|
|
923
|
+
lv?: string;
|
|
918
924
|
};
|
|
919
925
|
/**
|
|
920
926
|
* Optional Sentry backend (WS-D / RFC 0042 monitoring). When present + `enabled`,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { TelemetrySink, TelemetryEvent } from "@wix/himalaya/core";
|
|
2
|
+
import { type FrogCommonParams, type OneAppFrogContext } from "./oneapp.js";
|
|
3
|
+
export * from "./oneapp.js";
|
|
2
4
|
/**
|
|
3
5
|
* WixFrogTelemetrySink — forwards canonical Himalaya telemetry to a Wix Frog
|
|
4
6
|
* endpoint as fire-and-forget BI beacons (RFC 0042, Wix Platform SDK).
|
|
@@ -35,6 +37,19 @@ export interface WixFrogTelemetrySinkOptions {
|
|
|
35
37
|
* errors (BI is best-effort and must never throw into the emit path). Injected
|
|
36
38
|
* by tests to capture the constructed URL. */
|
|
37
39
|
send?: (url: string) => void;
|
|
40
|
+
/** Which common beacon fields to stamp. `"himi"` (default) is the Symphony beacon
|
|
41
|
+
* below; `"oneapp"` reproduces the RN one-app engine (see `./oneapp.ts`). */
|
|
42
|
+
commonParams?: FrogCommonParams;
|
|
43
|
+
/** oneapp: RN `mobile_app_id` (`owner`, `spaces`, `brandedLite_{msid}`). */
|
|
44
|
+
mobileAppId?: string;
|
|
45
|
+
/** oneapp: logger version `_lv`. Default `1.0.0|Himi`. */
|
|
46
|
+
lv?: string;
|
|
47
|
+
/** oneapp: the host state stamped on every event (identity, device, versions). */
|
|
48
|
+
context?: () => OneAppFrogContext;
|
|
49
|
+
/** oneapp: POST transport (`url`, JSON body). Defaults to a keepalive `fetch` POST. */
|
|
50
|
+
sendPost?: (url: string, body: string) => void;
|
|
51
|
+
/** oneapp: clock for the envelope `dt`. Injected by tests. */
|
|
52
|
+
now?: () => number;
|
|
38
53
|
}
|
|
39
54
|
/** Frog `evid` codes (mirror of the original SymphonyBI.swift). */
|
|
40
55
|
export declare const FROG_EVID: {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `commonParams: "oneapp"` mode of the Wix frog sink (#4711, #4974, epic #4973).
|
|
3
|
+
*
|
|
4
|
+
* Reproduces what the React Native one-app engine sends, so the Himi apps that replace
|
|
5
|
+
* the RN Owner / Spaces / Branded apps keep feeding the same BI tables and dashboards:
|
|
6
|
+
* the engine's common fields, a per-event `src` + endpoint, and the RN POST envelope
|
|
7
|
+
* `{"dt":0,"g":{},"e":[{"dt":<eventTime-sendTime>,"f":{…}}]}`.
|
|
8
|
+
*
|
|
9
|
+
* The contract is the shared fixture `core/schema/fixtures/bi-oneapp-envelope.json`; the
|
|
10
|
+
* web host (`core/web-host/src/telemetry/WixFrogTelemetrySink.ts`), iOS and Android sinks
|
|
11
|
+
* implement the same rules and are tested against the same cases. Pure — no I/O.
|
|
12
|
+
*/
|
|
13
|
+
/** Keys the host always stamps. Removed from event params, then re-stamped from the host,
|
|
14
|
+
* so neither a worker nor a typo can forge them. The first 14 are the adapter-owned
|
|
15
|
+
* names of `wix-private/mobile-native-core` `bi-codegen/src/runtime-fields.js`. */
|
|
16
|
+
export declare const FROG_HOST_STAMPED_FIELDS: readonly string[];
|
|
17
|
+
/** Keys a WORKER may not send through `wixPlatform.bi.track` / `bi.log`: the host-stamped
|
|
18
|
+
* set plus the engine's per-site and per-module fields, which only platform code sets. */
|
|
19
|
+
export declare const FROG_WORKER_RESERVED_FIELDS: readonly string[];
|
|
20
|
+
export declare const ONEAPP_DEFAULT_LV = "1.0.0|Himi";
|
|
21
|
+
export declare const ONEAPP_DEFAULT_ENDPOINT = "oneapp";
|
|
22
|
+
export type FrogCommonParams = "himi" | "oneapp";
|
|
23
|
+
/** The served `telemetryConfig.frog` block, as far as oneapp mode reads it. */
|
|
24
|
+
export interface OneAppFrogConfig {
|
|
25
|
+
/** Fallback src for an event that carries none. */
|
|
26
|
+
src: number;
|
|
27
|
+
/** Fallback endpoint: a bare frog endpoint name (`oneapp`) or a full URL. */
|
|
28
|
+
endpoint?: string;
|
|
29
|
+
/** RN `mobile_app_id` (`owner`, `spaces`, `brandedLite_{msid}`). `{msid}` is replaced. */
|
|
30
|
+
mobileAppId?: string;
|
|
31
|
+
/** Logger version `_lv`. Default `1.0.0|Himi`. */
|
|
32
|
+
lv?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Host state at the moment the event was emitted. Every field is optional except the
|
|
35
|
+
* platform ones; a missing or empty value is omitted from the beacon. */
|
|
36
|
+
export interface OneAppFrogContext {
|
|
37
|
+
os: "ios" | "android" | "web" | string;
|
|
38
|
+
installationId?: string;
|
|
39
|
+
bundleVersion?: string;
|
|
40
|
+
appVersion?: string;
|
|
41
|
+
osVersion?: string;
|
|
42
|
+
deviceModel?: string;
|
|
43
|
+
language?: string;
|
|
44
|
+
bsi?: string;
|
|
45
|
+
/** `undefined` = not known yet: neither `uuid` nor `_visitorId` is stamped. */
|
|
46
|
+
signedIn?: boolean;
|
|
47
|
+
/** The signed-in identity is a site member (Branded / member apps), not a Wix account user. */
|
|
48
|
+
isSiteMember?: boolean;
|
|
49
|
+
/** The Wix account user id (owner apps). Sent as `uuid` unless the user is a site member. */
|
|
50
|
+
userId?: string;
|
|
51
|
+
memberId?: string;
|
|
52
|
+
contactId?: string;
|
|
53
|
+
/** The app's bound site (Branded); wins over an event's own msid. */
|
|
54
|
+
forcedMsid?: string;
|
|
55
|
+
/** The currently selected site; used when the event names none. */
|
|
56
|
+
activeMsid?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface OneAppFrogEventInput {
|
|
59
|
+
type: string;
|
|
60
|
+
screenId?: string;
|
|
61
|
+
payload?: Record<string, unknown>;
|
|
62
|
+
timestampMs: number;
|
|
63
|
+
}
|
|
64
|
+
/** One built event, before envelope encoding. */
|
|
65
|
+
export interface OneAppFrogEvent {
|
|
66
|
+
/** Full POST URL (`https://frog.wix.com/<endpoint>`). */
|
|
67
|
+
url: string;
|
|
68
|
+
/** When the event happened (epoch ms) — becomes `dt` relative to the send time. */
|
|
69
|
+
eventTimeMs: number;
|
|
70
|
+
/** The `f` object, in stamping order. */
|
|
71
|
+
fields: Record<string, string | number>;
|
|
72
|
+
}
|
|
73
|
+
export declare function redactFrogParam(value: string): string;
|
|
74
|
+
export declare function eventEndpoint(eventEndpointValue: string | undefined, configEndpoint: string | undefined): string;
|
|
75
|
+
/** `oneapp` → `https://frog.wix.com/oneapp`; a full URL is kept as-is. */
|
|
76
|
+
export declare function frogEndpointUrl(endpoint: string | undefined): string;
|
|
77
|
+
/** Drop every worker-reserved key from a worker `bi.track` payload. Returns the kept
|
|
78
|
+
* payload and the dropped key names (the caller logs them once in debug). */
|
|
79
|
+
export declare function stripWorkerReservedFields<T extends Record<string, unknown>>(payload: T): {
|
|
80
|
+
payload: T;
|
|
81
|
+
dropped: string[];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Build one oneapp frog event, or `null` for an event oneapp mode does not send.
|
|
85
|
+
* Only explicit `bi` events are sent here; `screen_view` / `action_dispatched` are mapped
|
|
86
|
+
* by the platform screen and action maps (later epic issues), never as generic 501/522.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildOneAppFrogEvent(event: OneAppFrogEventInput, config: OneAppFrogConfig, ctx: OneAppFrogContext): OneAppFrogEvent | null;
|
|
89
|
+
/** The RN `sendEventsV2` POST body for events that share one endpoint URL. */
|
|
90
|
+
export declare function encodeFrogEnvelope(events: ReadonlyArray<Pick<OneAppFrogEvent, "eventTimeMs" | "fields">>, sendTimeMs: number): string;
|
|
@@ -1,14 +1,140 @@
|
|
|
1
|
-
// ../../stdlib/telemetry/wix-bi/src/
|
|
2
|
-
var
|
|
1
|
+
// ../../stdlib/telemetry/wix-bi/src/oneapp.ts
|
|
2
|
+
var FROG_HOST_STAMPED_FIELDS = Object.freeze([
|
|
3
|
+
"src",
|
|
4
|
+
"evid",
|
|
5
|
+
"installationId",
|
|
6
|
+
"client_id",
|
|
7
|
+
"mobile_app_id",
|
|
8
|
+
"osType",
|
|
9
|
+
"_lv",
|
|
10
|
+
"bundleVersion",
|
|
11
|
+
"appVersion",
|
|
12
|
+
"osVersion",
|
|
13
|
+
"deviceModel",
|
|
14
|
+
"mobile_lng",
|
|
15
|
+
"ct",
|
|
16
|
+
"bsi",
|
|
17
|
+
"uuid",
|
|
18
|
+
"_visitorId",
|
|
19
|
+
"_msid",
|
|
20
|
+
"member_id",
|
|
21
|
+
"contactId",
|
|
22
|
+
"_contactId"
|
|
23
|
+
]);
|
|
24
|
+
var FROG_WORKER_RESERVED_FIELDS = Object.freeze([
|
|
25
|
+
...FROG_HOST_STAMPED_FIELDS,
|
|
26
|
+
"ownerId",
|
|
27
|
+
"roles",
|
|
28
|
+
"brand_id",
|
|
29
|
+
"identity_data",
|
|
30
|
+
"moduleName",
|
|
31
|
+
"moduleVersion",
|
|
32
|
+
// Only platform code may attribute an event to a site other than the active one.
|
|
33
|
+
"msid"
|
|
34
|
+
]);
|
|
35
|
+
var ONEAPP_DEFAULT_LV = "1.0.0|Himi";
|
|
36
|
+
var ONEAPP_DEFAULT_ENDPOINT = "oneapp";
|
|
37
|
+
var FROG_ORIGIN = "https://frog.wix.com";
|
|
3
38
|
var REDACT_EMAIL = /[^\s@]+@[^\s@]+\.[^\s@]+/;
|
|
4
39
|
var REDACT_JWT = /\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\b/;
|
|
5
|
-
var REDACT_PHONE = /(?:\+|00)\d[\d\s().-]{6,}\d/;
|
|
6
|
-
function
|
|
40
|
+
var REDACT_PHONE = /(?<![\w-])(?:\+|00)\d[\d\s().-]{6,}\d(?![\w-])/;
|
|
41
|
+
function redactFrogParam(value) {
|
|
7
42
|
if (REDACT_EMAIL.test(value)) return "[redacted-email]";
|
|
8
43
|
if (REDACT_JWT.test(value)) return "[redacted-token]";
|
|
9
44
|
if (REDACT_PHONE.test(value)) return "[redacted-phone]";
|
|
10
45
|
return value;
|
|
11
46
|
}
|
|
47
|
+
var BARE_ENDPOINT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
48
|
+
function eventEndpoint(eventEndpointValue, configEndpoint) {
|
|
49
|
+
return frogEndpointUrl(eventEndpointValue && BARE_ENDPOINT.test(eventEndpointValue) ? eventEndpointValue : configEndpoint);
|
|
50
|
+
}
|
|
51
|
+
function frogEndpointUrl(endpoint) {
|
|
52
|
+
const e = (endpoint ?? "").trim() || ONEAPP_DEFAULT_ENDPOINT;
|
|
53
|
+
if (e.includes("://")) return e;
|
|
54
|
+
return `${FROG_ORIGIN}/${e.replace(/^\/+/, "")}`;
|
|
55
|
+
}
|
|
56
|
+
var nonEmpty = (v) => typeof v === "string" && v.length > 0;
|
|
57
|
+
function stripWorkerReservedFields(payload) {
|
|
58
|
+
const reserved = new Set(FROG_WORKER_RESERVED_FIELDS);
|
|
59
|
+
reserved.delete("evid");
|
|
60
|
+
reserved.delete("src");
|
|
61
|
+
const out = {};
|
|
62
|
+
const dropped = [];
|
|
63
|
+
for (const [k, v] of Object.entries(payload)) {
|
|
64
|
+
if (reserved.has(k)) dropped.push(k);
|
|
65
|
+
else out[k] = v;
|
|
66
|
+
}
|
|
67
|
+
return { payload: out, dropped };
|
|
68
|
+
}
|
|
69
|
+
function buildOneAppFrogEvent(event, config, ctx) {
|
|
70
|
+
if (event.type !== "bi") return null;
|
|
71
|
+
const p = event.payload ?? {};
|
|
72
|
+
const str = (v) => v === void 0 || v === null ? void 0 : String(v);
|
|
73
|
+
const evid = Number(str(p.evid));
|
|
74
|
+
if (!str(p.evid) || !Number.isFinite(evid)) return null;
|
|
75
|
+
const evSrc = Number(str(p.src));
|
|
76
|
+
const src = str(p.src) && Number.isFinite(evSrc) ? evSrc : config.src;
|
|
77
|
+
const url = eventEndpoint(str(p.endpoint), config.endpoint);
|
|
78
|
+
const f = { src, evid };
|
|
79
|
+
const stamped = new Set(FROG_HOST_STAMPED_FIELDS);
|
|
80
|
+
for (const [k, raw] of Object.entries(p)) {
|
|
81
|
+
if (k === "endpoint" || k === "msid" || stamped.has(k)) continue;
|
|
82
|
+
const v = str(raw);
|
|
83
|
+
if (v !== void 0) f[k] = redactFrogParam(v);
|
|
84
|
+
}
|
|
85
|
+
const msid = [ctx.forcedMsid, str(p.msid), ctx.activeMsid].find(nonEmpty);
|
|
86
|
+
const set = (k, v) => {
|
|
87
|
+
if (typeof v === "number" ? Number.isFinite(v) : nonEmpty(v)) f[k] = v;
|
|
88
|
+
};
|
|
89
|
+
set("installationId", ctx.installationId);
|
|
90
|
+
set("client_id", ctx.installationId);
|
|
91
|
+
const appIdTemplate = config.mobileAppId;
|
|
92
|
+
if (nonEmpty(appIdTemplate)) {
|
|
93
|
+
if (!appIdTemplate.includes("{msid}")) set("mobile_app_id", appIdTemplate);
|
|
94
|
+
else if (msid) set("mobile_app_id", appIdTemplate.split("{msid}").join(msid));
|
|
95
|
+
}
|
|
96
|
+
set("osType", ctx.os);
|
|
97
|
+
set("_lv", nonEmpty(config.lv) ? config.lv : ONEAPP_DEFAULT_LV);
|
|
98
|
+
set("bundleVersion", ctx.bundleVersion);
|
|
99
|
+
set("appVersion", ctx.appVersion);
|
|
100
|
+
set("osVersion", ctx.osVersion);
|
|
101
|
+
set("deviceModel", ctx.deviceModel);
|
|
102
|
+
set("mobile_lng", ctx.language);
|
|
103
|
+
set("ct", event.timestampMs);
|
|
104
|
+
set("bsi", ctx.bsi);
|
|
105
|
+
const signedIn = ctx.signedIn === true;
|
|
106
|
+
if (signedIn && !ctx.isSiteMember) set("uuid", ctx.userId);
|
|
107
|
+
if (ctx.signedIn === false) set("_visitorId", ctx.installationId);
|
|
108
|
+
if (msid) {
|
|
109
|
+
f.msid = msid;
|
|
110
|
+
f._msid = msid;
|
|
111
|
+
}
|
|
112
|
+
if (signedIn && ctx.isSiteMember) {
|
|
113
|
+
set("member_id", ctx.memberId);
|
|
114
|
+
set("contactId", ctx.contactId);
|
|
115
|
+
set("_contactId", ctx.contactId);
|
|
116
|
+
}
|
|
117
|
+
return { url, eventTimeMs: event.timestampMs, fields: f };
|
|
118
|
+
}
|
|
119
|
+
function encodeFrogEnvelope(events, sendTimeMs) {
|
|
120
|
+
return JSON.stringify({
|
|
121
|
+
dt: 0,
|
|
122
|
+
g: {},
|
|
123
|
+
e: events.map((e) => ({ dt: e.eventTimeMs - sendTimeMs, f: e.fields }))
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ../../stdlib/telemetry/wix-bi/src/index.ts
|
|
128
|
+
var DEFAULT_ENDPOINT = "https://frog.wix.com/scheduling-assistant";
|
|
129
|
+
var REDACT_EMAIL2 = /[^\s@]+@[^\s@]+\.[^\s@]+/;
|
|
130
|
+
var REDACT_JWT2 = /\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\b/;
|
|
131
|
+
var REDACT_PHONE2 = /(?<![\w-])(?:\+|00)\d[\d\s().-]{6,}\d(?![\w-])/;
|
|
132
|
+
function redactParam(value) {
|
|
133
|
+
if (REDACT_EMAIL2.test(value)) return "[redacted-email]";
|
|
134
|
+
if (REDACT_JWT2.test(value)) return "[redacted-token]";
|
|
135
|
+
if (REDACT_PHONE2.test(value)) return "[redacted-phone]";
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
12
138
|
var FROG_EVID = {
|
|
13
139
|
pageView: 501,
|
|
14
140
|
click: 522
|
|
@@ -65,12 +191,36 @@ function defaultSend(url) {
|
|
|
65
191
|
} catch {
|
|
66
192
|
}
|
|
67
193
|
}
|
|
194
|
+
function defaultSendPost(url, body) {
|
|
195
|
+
try {
|
|
196
|
+
void globalThis.fetch?.(url, { method: "POST", body, keepalive: true, mode: "no-cors", headers: { "Content-Type": "text/plain;charset=UTF-8" } })?.catch(() => {
|
|
197
|
+
});
|
|
198
|
+
} catch {
|
|
199
|
+
}
|
|
200
|
+
}
|
|
68
201
|
function WixFrogTelemetrySink(options) {
|
|
69
202
|
const send = options.send ?? defaultSend;
|
|
203
|
+
const sendPost = options.sendPost ?? defaultSendPost;
|
|
204
|
+
const now = options.now ?? (() => Date.now());
|
|
70
205
|
return {
|
|
71
206
|
sinkId: "wix-bi",
|
|
72
207
|
emit(event) {
|
|
73
208
|
try {
|
|
209
|
+
if (options.commonParams === "oneapp") {
|
|
210
|
+
const ctx = options.context?.() ?? {
|
|
211
|
+
os: "web",
|
|
212
|
+
installationId: resolve(options.installationId),
|
|
213
|
+
activeMsid: resolve(options.msid),
|
|
214
|
+
language: resolve(options.lang) ?? defaultLocale()
|
|
215
|
+
};
|
|
216
|
+
const built = buildOneAppFrogEvent(
|
|
217
|
+
{ type: event.type, screenId: event.screenId, payload: event.payload, timestampMs: event.timestamp ?? now() },
|
|
218
|
+
{ src: options.src, endpoint: options.endpoint, mobileAppId: options.mobileAppId, lv: options.lv },
|
|
219
|
+
ctx
|
|
220
|
+
);
|
|
221
|
+
if (built) sendPost(built.url, encodeFrogEnvelope([built], now()));
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
74
224
|
const url = buildFrogBeacon(event, options);
|
|
75
225
|
if (url) send(url);
|
|
76
226
|
} catch {
|
|
@@ -80,7 +230,17 @@ function WixFrogTelemetrySink(options) {
|
|
|
80
230
|
}
|
|
81
231
|
export {
|
|
82
232
|
FROG_EVID,
|
|
233
|
+
FROG_HOST_STAMPED_FIELDS,
|
|
234
|
+
FROG_WORKER_RESERVED_FIELDS,
|
|
235
|
+
ONEAPP_DEFAULT_ENDPOINT,
|
|
236
|
+
ONEAPP_DEFAULT_LV,
|
|
83
237
|
WixFrogTelemetrySink,
|
|
84
|
-
buildFrogBeacon
|
|
238
|
+
buildFrogBeacon,
|
|
239
|
+
buildOneAppFrogEvent,
|
|
240
|
+
encodeFrogEnvelope,
|
|
241
|
+
eventEndpoint,
|
|
242
|
+
frogEndpointUrl,
|
|
243
|
+
redactFrogParam,
|
|
244
|
+
stripWorkerReservedFields
|
|
85
245
|
};
|
|
86
246
|
//# sourceMappingURL=wix-bi.mjs.map
|