@salesforce/platform-sdk 12.2.0 → 12.3.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.
@@ -305,7 +305,7 @@ const S = "Accept-Language", ge = (t) => {
305
305
  return l(t);
306
306
  const [r, n] = t;
307
307
  return (r instanceof Request && !n?.headers ? r.headers.has(S) : new Headers(n?.headers).has(S)) ? l(t) : l(b(S, e, t));
308
- }, Ee = "X-SFDC-Client-Name", Se = "X-SFDC-Client-Version", Ce = "@salesforce/platform-sdk", xe = "12.2.0", De = (t) => {
308
+ }, Ee = "X-SFDC-Client-Name", Se = "X-SFDC-Client-Version", Ce = "@salesforce/platform-sdk", xe = "12.3.1", De = (t) => {
309
309
  let e = b(Ee, Ce, t);
310
310
  return e = b(Se, xe, e), l(e);
311
311
  }, Oe = "X-CSRF-Token";
@@ -0,0 +1,131 @@
1
+ import { isInitialized } from 'o11y/orchestrator';
2
+ /**
3
+ * Configuration for auto-instrumentation initialization.
4
+ * Extends the orchestrator config with sensible defaults.
5
+ */
6
+ export interface AutoInstrumentationOptions {
7
+ /**
8
+ * Telemetry ingestion endpoint URL.
9
+ * @example 'https://telemetry.salesforce.com/ingest'
10
+ */
11
+ endpoint: string;
12
+ /**
13
+ * Static environment attributes attached to all telemetry events.
14
+ */
15
+ environment: {
16
+ /** Application name (required) */
17
+ appName: string;
18
+ /** Application version */
19
+ appVersion?: string;
20
+ /** Application experience (e.g., 'desktop', 'mobile') */
21
+ appExperience?: string;
22
+ /** Device identifier */
23
+ deviceId?: string;
24
+ /** Device model */
25
+ deviceModel?: string;
26
+ /** SDK version */
27
+ sdkVersion?: string;
28
+ };
29
+ /**
30
+ * Application namespace attached to telemetry payloads. Forwarded to the orchestrator,
31
+ * which applies its own default (e.g. 'sf.agentic') when omitted.
32
+ */
33
+ namespace?: string;
34
+ /**
35
+ * Use Base64-encoded JSON for upload (instead of multipart/form-data).
36
+ * @default false
37
+ */
38
+ useBase64Json?: boolean;
39
+ /**
40
+ * Form data key for telemetry payload (when not using Base64 JSON).
41
+ * @default 'telemetry'
42
+ */
43
+ formDataKey?: string;
44
+ /**
45
+ * Maximum number of unique schemas the collector will buffer.
46
+ * @default 10000
47
+ */
48
+ maxUniqueSchemas?: number;
49
+ /**
50
+ * Interval (in milliseconds) for periodic telemetry uploads.
51
+ * @default 30000
52
+ */
53
+ periodicUploadIntervalMs?: number;
54
+ /**
55
+ * Optional callback to check if a root activity is in progress.
56
+ * Used to defer uploads during active interactions.
57
+ */
58
+ isRootActivityInProgress?: () => boolean;
59
+ /**
60
+ * Optional logging function for internal diagnostics.
61
+ * @default no-op
62
+ */
63
+ log?: (...args: unknown[]) => void;
64
+ /**
65
+ * Optional error handler for upload failures.
66
+ */
67
+ onUploadError?: (error: unknown) => void;
68
+ /**
69
+ * Activate click tracking (click → interaction root-activity).
70
+ * Forwarded to the orchestrator, which applies its own default when omitted.
71
+ */
72
+ enableClickTracking?: boolean;
73
+ /**
74
+ * Activate SPA history/navigation tracking.
75
+ * Forwarded to the orchestrator, which applies its own default when omitted.
76
+ */
77
+ enableHistoryTracking?: boolean;
78
+ /**
79
+ * Activate the generic monitor suite inside `o11y/orchestrator`'s `initialize()`
80
+ * (PageContext, ConsoleCollector, RootActivityManager, Web Vitals, network
81
+ * instrumentation, History/Click monitors, initial root activity/pageview).
82
+ * This is a drop-in activator, so this defaults to `true` here even though the
83
+ * underlying SDK defaults it to `false`. Set to `false` to opt out.
84
+ * @default true (observability)
85
+ */
86
+ activateGenericMonitors?: boolean;
87
+ /**
88
+ * Drain the pre-init tenant-app queue (`__SF_O11Y_QUEUE__`) on initialize.
89
+ * Preserves the pre-266.13.0 unconditional drain, so this defaults to `true`
90
+ * here even though the underlying SDK now defaults it to `false`. Set to `false` to opt out.
91
+ * @default true (observability)
92
+ */
93
+ drainAppQueue?: boolean;
94
+ /**
95
+ * Drain the pre-init first-party queue (`__SF_O11Y_QUEUE_1P__`) on initialize.
96
+ * Preserves the pre-266.13.0 unconditional drain, so this defaults to `true`
97
+ * here even though the underlying SDK now defaults it to `false`. Set to `false` to opt out.
98
+ * @default true (observability)
99
+ */
100
+ drainFirstPartyQueue?: boolean;
101
+ /**
102
+ * Whether the app is running in production. Forwarded to the orchestrator as-is; the
103
+ * SDK applies its own default (`true`) when omitted.
104
+ * @default true (SDK)
105
+ */
106
+ isProduction?: boolean;
107
+ }
108
+ /**
109
+ * Initializes o11y telemetry with the provided configuration.
110
+ *
111
+ * This function is **idempotent**: calling it multiple times, or from multiple
112
+ * bundles on the same page, will NO-OP if telemetry is already initialized.
113
+ *
114
+ * It only maps its friendly config to an `OrchestratorConfig` and delegates to
115
+ * `o11y/orchestrator`'s `initialize()`. As of o11y 266.13.0, `initialize()` performs the
116
+ * full setup AND monitor activation when `activateGenericMonitors` is true (PageContext,
117
+ * ConsoleCollector, RootActivityManager, Web Vitals, network instrumentation, History/Click
118
+ * monitors, initial root activity/pageview, and pre-init queue draining), including all
119
+ * non-DOM/SSR, version-mismatch, and cross-bundle guards. The legacy `AutomaticClickTracker`
120
+ * is never activated.
121
+ *
122
+ * @param options - Auto-instrumentation initialization configuration
123
+ */
124
+ export declare function initializeAutoInstrumentation(options: AutoInstrumentationOptions): void;
125
+ /**
126
+ * Re-exports the orchestrator's `isInitialized` so callers can check init state without re-initializing.
127
+ *
128
+ * @returns `true` if telemetry has been initialized, `false` otherwise
129
+ */
130
+ export { isInitialized };
131
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAc,aAAa,EAA2B,MAAM,mBAAmB,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAA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;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { isInitialized as i, initialize as a } from "o11y/orchestrator";
2
+ import { isInitialized as o } from "o11y/orchestrator";
3
+ function c(e) {
4
+ if (globalThis.__SF_O11Y_AUTO_INSTALLED__ || i())
5
+ return;
6
+ const r = {
7
+ endpoint: e.endpoint,
8
+ environment: e.environment,
9
+ useBase64Json: e.useBase64Json,
10
+ formDataKey: e.formDataKey,
11
+ maxUniqueSchemas: e.maxUniqueSchemas,
12
+ periodicUploadIntervalMs: e.periodicUploadIntervalMs,
13
+ isRootActivityInProgress: e.isRootActivityInProgress,
14
+ log: e.log,
15
+ onUploadError: e.onUploadError,
16
+ // activation is now performed by the orchestrator (o11y 266.13.0+)
17
+ activateGenericMonitors: e.activateGenericMonitors ?? !0,
18
+ enableClickTracking: e.enableClickTracking,
19
+ enableHistoryTracking: e.enableHistoryTracking,
20
+ namespace: e.namespace,
21
+ isProduction: e.isProduction,
22
+ // preserve pre-266.13.0 unconditional pre-init queue draining (SDK now defaults these OFF)
23
+ drainAppQueue: e.drainAppQueue ?? !0,
24
+ drainFirstPartyQueue: e.drainFirstPartyQueue ?? !0
25
+ };
26
+ a(r);
27
+ }
28
+ export {
29
+ c as initializeAutoInstrumentation,
30
+ o as isInitialized
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "12.2.0",
3
+ "version": "12.3.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,6 +46,9 @@
46
46
  ],
47
47
  "i18n": [
48
48
  "./dist/i18n/index.d.ts"
49
+ ],
50
+ "observability": [
51
+ "./dist/observability/index.d.ts"
49
52
  ]
50
53
  }
51
54
  },
@@ -110,6 +113,11 @@
110
113
  "import": "./dist/i18n/index.js",
111
114
  "default": "./dist/i18n/index.js"
112
115
  },
116
+ "./observability": {
117
+ "types": "./dist/observability/index.d.ts",
118
+ "import": "./dist/observability/index.js",
119
+ "default": "./dist/observability/index.js"
120
+ },
113
121
  "./package.json": "./package.json"
114
122
  },
115
123
  "directories": {
@@ -139,12 +147,12 @@
139
147
  "@conduit-client/service-pubsub": "3.19.6",
140
148
  "@conduit-client/service-retry": "3.19.6",
141
149
  "@conduit-client/utils": "3.19.6",
142
- "@salesforce/jsonrpc": "^12.2.0",
150
+ "@salesforce/jsonrpc": "^12.3.1",
143
151
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
144
152
  },
145
153
  "peerDependencies": {
146
- "o11y": ">=260.0.0",
147
- "o11y_schema": ">=264.85.0"
154
+ "o11y": ">=266.13.0",
155
+ "o11y_schema": ">=264.109.0"
148
156
  },
149
157
  "devDependencies": {
150
158
  "ts-morph": "^27.0.2",