@servicetitan/journey 2.0.0 → 3.0.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.
Files changed (233) hide show
  1. package/README.md +1 -1
  2. package/dist/__test-utils__/test-runtime.d.ts.map +1 -0
  3. package/dist/__test-utils__/test-runtime.js +54 -0
  4. package/dist/__test-utils__/test-runtime.js.map +1 -0
  5. package/dist/__tests__/core/ambient.test.d.ts.map +1 -0
  6. package/dist/__tests__/core/api.test.d.ts +2 -0
  7. package/dist/__tests__/core/api.test.d.ts.map +1 -0
  8. package/dist/__tests__/core/define-journey.test.d.ts.map +1 -0
  9. package/dist/__tests__/core/requests.test.d.ts.map +1 -0
  10. package/dist/__tests__/core/runtime.test.d.ts.map +1 -0
  11. package/dist/__tests__/core/sanitize.test.d.ts +2 -0
  12. package/dist/__tests__/core/sanitize.test.d.ts.map +1 -0
  13. package/dist/__tests__/core/step.test.d.ts.map +1 -0
  14. package/dist/__tests__/core/timeouts.test.d.ts.map +1 -0
  15. package/dist/__tests__/global.test.d.ts +3 -0
  16. package/dist/__tests__/global.test.d.ts.map +1 -0
  17. package/dist/__tests__/hardening.test.d.ts +2 -0
  18. package/dist/__tests__/hardening.test.d.ts.map +1 -0
  19. package/dist/__tests__/integrations/axios.test.d.ts.map +1 -0
  20. package/dist/__tests__/integrations/context.test.d.ts.map +1 -0
  21. package/dist/__tests__/integrations/expose-app-journey.test.d.ts.map +1 -0
  22. package/dist/__tests__/integrations/fetch.test.d.ts.map +1 -0
  23. package/dist/__tests__/integrations/host-mfe.test.d.ts +2 -0
  24. package/dist/__tests__/integrations/host-mfe.test.d.ts.map +1 -0
  25. package/dist/__tests__/integrations/jquery.test.d.ts.map +1 -0
  26. package/dist/__tests__/integrations/request-key.test.d.ts.map +1 -0
  27. package/dist/__tests__/integrations/scope.test.d.ts.map +1 -0
  28. package/dist/__tests__/integrations/use-journey-step.test.d.ts +2 -0
  29. package/dist/__tests__/integrations/use-journey-step.test.d.ts.map +1 -0
  30. package/dist/__tests__/sinks/console.test.d.ts +2 -0
  31. package/dist/__tests__/sinks/console.test.d.ts.map +1 -0
  32. package/dist/__tests__/sinks/datadog.test.d.ts.map +1 -0
  33. package/dist/__tests__/sinks/sinks.test.d.ts.map +1 -0
  34. package/dist/config.d.ts +61 -13
  35. package/dist/config.d.ts.map +1 -1
  36. package/dist/config.js +98 -29
  37. package/dist/config.js.map +1 -1
  38. package/dist/core/abort-error.d.ts +4 -0
  39. package/dist/core/abort-error.d.ts.map +1 -0
  40. package/dist/core/abort-error.js +22 -0
  41. package/dist/core/abort-error.js.map +1 -0
  42. package/dist/core/api.d.ts +43 -0
  43. package/dist/core/api.d.ts.map +1 -0
  44. package/dist/core/api.js +122 -0
  45. package/dist/core/api.js.map +1 -0
  46. package/dist/{endpoint-policy.d.ts → core/endpoint-policy.d.ts} +14 -4
  47. package/dist/core/endpoint-policy.d.ts.map +1 -0
  48. package/dist/core/endpoint-policy.js +70 -0
  49. package/dist/core/endpoint-policy.js.map +1 -0
  50. package/dist/core/index.d.ts +6 -5
  51. package/dist/core/index.d.ts.map +1 -1
  52. package/dist/core/index.js +4 -3
  53. package/dist/core/index.js.map +1 -1
  54. package/dist/core/limits.d.ts +29 -0
  55. package/dist/core/limits.d.ts.map +1 -0
  56. package/dist/core/limits.js +63 -0
  57. package/dist/core/limits.js.map +1 -0
  58. package/dist/core/request-policy.d.ts +39 -0
  59. package/dist/core/request-policy.d.ts.map +1 -0
  60. package/dist/core/request-policy.js +18 -0
  61. package/dist/core/request-policy.js.map +1 -0
  62. package/dist/core/runtime.d.ts +95 -17
  63. package/dist/core/runtime.d.ts.map +1 -1
  64. package/dist/core/runtime.js +435 -124
  65. package/dist/core/runtime.js.map +1 -1
  66. package/dist/core/sanitize.d.ts +23 -0
  67. package/dist/core/sanitize.d.ts.map +1 -0
  68. package/dist/core/sanitize.js +143 -0
  69. package/dist/core/sanitize.js.map +1 -0
  70. package/dist/core/step-tag.d.ts +31 -6
  71. package/dist/core/step-tag.d.ts.map +1 -1
  72. package/dist/core/step-tag.js +62 -9
  73. package/dist/core/step-tag.js.map +1 -1
  74. package/dist/core/types.d.ts +76 -26
  75. package/dist/core/types.d.ts.map +1 -1
  76. package/dist/core/types.js +4 -1
  77. package/dist/core/types.js.map +1 -1
  78. package/dist/global.d.ts +145 -0
  79. package/dist/global.d.ts.map +1 -0
  80. package/dist/global.js +326 -0
  81. package/dist/global.js.map +1 -0
  82. package/dist/index.d.ts +9 -5
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +9 -5
  85. package/dist/index.js.map +1 -1
  86. package/dist/integrations/axios.d.ts +5 -1
  87. package/dist/integrations/axios.d.ts.map +1 -1
  88. package/dist/integrations/axios.js +146 -34
  89. package/dist/integrations/axios.js.map +1 -1
  90. package/dist/integrations/fetch.d.ts +6 -4
  91. package/dist/integrations/fetch.d.ts.map +1 -1
  92. package/dist/integrations/fetch.js +105 -26
  93. package/dist/integrations/fetch.js.map +1 -1
  94. package/dist/integrations/http-report.d.ts +27 -0
  95. package/dist/integrations/http-report.d.ts.map +1 -0
  96. package/dist/integrations/http-report.js +123 -0
  97. package/dist/integrations/http-report.js.map +1 -0
  98. package/dist/integrations/jquery/index.d.ts +10 -6
  99. package/dist/integrations/jquery/index.d.ts.map +1 -1
  100. package/dist/integrations/jquery/index.js +28 -9
  101. package/dist/integrations/jquery/index.js.map +1 -1
  102. package/dist/integrations/jquery/instrument.d.ts +14 -5
  103. package/dist/integrations/jquery/instrument.d.ts.map +1 -1
  104. package/dist/integrations/jquery/instrument.js +111 -29
  105. package/dist/integrations/jquery/instrument.js.map +1 -1
  106. package/dist/integrations/react/context.d.ts +4 -1
  107. package/dist/integrations/react/context.d.ts.map +1 -1
  108. package/dist/integrations/react/context.js +4 -1
  109. package/dist/integrations/react/context.js.map +1 -1
  110. package/dist/integrations/react/scope.d.ts +14 -3
  111. package/dist/integrations/react/scope.d.ts.map +1 -1
  112. package/dist/integrations/react/scope.js +48 -9
  113. package/dist/integrations/react/scope.js.map +1 -1
  114. package/dist/integrations/react/stable-config-keys.d.ts +6 -0
  115. package/dist/integrations/react/stable-config-keys.d.ts.map +1 -0
  116. package/dist/integrations/react/stable-config-keys.js +21 -0
  117. package/dist/integrations/react/stable-config-keys.js.map +1 -0
  118. package/dist/integrations/react/use-journey-step.d.ts +11 -0
  119. package/dist/integrations/react/use-journey-step.d.ts.map +1 -0
  120. package/dist/integrations/react/use-journey-step.js +19 -0
  121. package/dist/integrations/react/use-journey-step.js.map +1 -0
  122. package/dist/integrations/request-key.d.ts +8 -3
  123. package/dist/integrations/request-key.d.ts.map +1 -1
  124. package/dist/integrations/request-key.js +10 -9
  125. package/dist/integrations/request-key.js.map +1 -1
  126. package/dist/integrations/soft-skip.d.ts +7 -0
  127. package/dist/integrations/soft-skip.d.ts.map +1 -0
  128. package/dist/integrations/soft-skip.js +30 -0
  129. package/dist/integrations/soft-skip.js.map +1 -0
  130. package/dist/sinks/console.d.ts +11 -0
  131. package/dist/sinks/console.d.ts.map +1 -0
  132. package/dist/sinks/console.js +19 -0
  133. package/dist/sinks/console.js.map +1 -0
  134. package/dist/sinks/datadog.d.ts +12 -1
  135. package/dist/sinks/datadog.d.ts.map +1 -1
  136. package/dist/sinks/datadog.js +42 -25
  137. package/dist/sinks/datadog.js.map +1 -1
  138. package/package.json +2 -2
  139. package/src/{__mocks__ → __test-utils__}/test-runtime.ts +15 -4
  140. package/src/__tests__/config.test.ts +158 -42
  141. package/src/__tests__/{ambient.test.ts → core/ambient.test.ts} +23 -16
  142. package/src/__tests__/{registry.test.ts → core/api.test.ts} +35 -30
  143. package/src/__tests__/{define-journey.test.ts → core/define-journey.test.ts} +33 -15
  144. package/src/__tests__/{requests.test.ts → core/requests.test.ts} +61 -39
  145. package/src/__tests__/{runtime.test.ts → core/runtime.test.ts} +84 -37
  146. package/src/__tests__/core/sanitize.test.ts +69 -0
  147. package/src/__tests__/{step.test.ts → core/step.test.ts} +146 -52
  148. package/src/__tests__/{timeouts.test.ts → core/timeouts.test.ts} +83 -13
  149. package/src/__tests__/global.test.ts +154 -0
  150. package/src/__tests__/hardening.test.ts +613 -0
  151. package/src/__tests__/integrations/axios.test.ts +616 -0
  152. package/src/__tests__/{context.test.tsx → integrations/context.test.tsx} +1 -1
  153. package/src/__tests__/{expose-app-journey.test.ts → integrations/expose-app-journey.test.ts} +11 -5
  154. package/src/__tests__/{fetch.test.ts → integrations/fetch.test.ts} +159 -25
  155. package/src/__tests__/integrations/host-mfe.test.ts +548 -0
  156. package/src/__tests__/integrations/jquery.test.ts +539 -0
  157. package/src/__tests__/{request-key.test.ts → integrations/request-key.test.ts} +1 -1
  158. package/src/__tests__/integrations/scope.test.tsx +286 -0
  159. package/src/__tests__/integrations/use-journey-step.test.tsx +43 -0
  160. package/src/__tests__/sinks/console.test.ts +103 -0
  161. package/src/__tests__/{datadog.test.ts → sinks/datadog.test.ts} +109 -5
  162. package/src/__tests__/{sinks.test.ts → sinks/sinks.test.ts} +13 -12
  163. package/src/config.ts +173 -41
  164. package/src/core/abort-error.ts +24 -0
  165. package/src/core/api.ts +159 -0
  166. package/src/{endpoint-policy.ts → core/endpoint-policy.ts} +46 -4
  167. package/src/core/index.ts +16 -17
  168. package/src/core/limits.ts +73 -0
  169. package/src/core/request-policy.ts +66 -0
  170. package/src/core/runtime.ts +560 -137
  171. package/src/core/sanitize.ts +177 -0
  172. package/src/core/step-tag.ts +90 -11
  173. package/src/core/types.ts +82 -26
  174. package/src/global.ts +466 -0
  175. package/src/index.ts +31 -18
  176. package/src/integrations/axios.ts +183 -45
  177. package/src/integrations/fetch.ts +127 -41
  178. package/src/integrations/http-report.ts +184 -0
  179. package/src/integrations/jquery/index.ts +37 -18
  180. package/src/integrations/jquery/instrument.ts +126 -42
  181. package/src/integrations/react/context.ts +4 -1
  182. package/src/integrations/react/scope.tsx +61 -10
  183. package/src/integrations/react/stable-config-keys.ts +28 -0
  184. package/src/integrations/react/use-journey-step.ts +31 -0
  185. package/src/integrations/request-key.ts +18 -10
  186. package/src/integrations/soft-skip.ts +35 -0
  187. package/src/sinks/console.ts +21 -0
  188. package/src/sinks/datadog.ts +52 -33
  189. package/dist/__mocks__/test-runtime.d.ts.map +0 -1
  190. package/dist/__tests__/ambient.test.d.ts.map +0 -1
  191. package/dist/__tests__/axios.test.d.ts.map +0 -1
  192. package/dist/__tests__/context.test.d.ts.map +0 -1
  193. package/dist/__tests__/datadog.test.d.ts.map +0 -1
  194. package/dist/__tests__/define-journey.test.d.ts.map +0 -1
  195. package/dist/__tests__/expose-app-journey.test.d.ts.map +0 -1
  196. package/dist/__tests__/fetch.test.d.ts.map +0 -1
  197. package/dist/__tests__/jquery.test.d.ts.map +0 -1
  198. package/dist/__tests__/registry.test.d.ts +0 -2
  199. package/dist/__tests__/registry.test.d.ts.map +0 -1
  200. package/dist/__tests__/request-key.test.d.ts.map +0 -1
  201. package/dist/__tests__/requests.test.d.ts.map +0 -1
  202. package/dist/__tests__/runtime.test.d.ts.map +0 -1
  203. package/dist/__tests__/scope.test.d.ts.map +0 -1
  204. package/dist/__tests__/sinks.test.d.ts.map +0 -1
  205. package/dist/__tests__/step.test.d.ts.map +0 -1
  206. package/dist/__tests__/timeouts.test.d.ts.map +0 -1
  207. package/dist/core/registry.d.ts +0 -50
  208. package/dist/core/registry.d.ts.map +0 -1
  209. package/dist/core/registry.js +0 -102
  210. package/dist/core/registry.js.map +0 -1
  211. package/dist/endpoint-policy.d.ts.map +0 -1
  212. package/dist/endpoint-policy.js +0 -39
  213. package/dist/endpoint-policy.js.map +0 -1
  214. package/src/__tests__/axios.test.ts +0 -365
  215. package/src/__tests__/jquery.test.ts +0 -327
  216. package/src/__tests__/scope.test.tsx +0 -128
  217. package/src/core/registry.ts +0 -162
  218. /package/dist/{__mocks__ → __test-utils__}/test-runtime.d.ts +0 -0
  219. /package/dist/__tests__/{ambient.test.d.ts → core/ambient.test.d.ts} +0 -0
  220. /package/dist/__tests__/{define-journey.test.d.ts → core/define-journey.test.d.ts} +0 -0
  221. /package/dist/__tests__/{requests.test.d.ts → core/requests.test.d.ts} +0 -0
  222. /package/dist/__tests__/{runtime.test.d.ts → core/runtime.test.d.ts} +0 -0
  223. /package/dist/__tests__/{step.test.d.ts → core/step.test.d.ts} +0 -0
  224. /package/dist/__tests__/{timeouts.test.d.ts → core/timeouts.test.d.ts} +0 -0
  225. /package/dist/__tests__/{axios.test.d.ts → integrations/axios.test.d.ts} +0 -0
  226. /package/dist/__tests__/{context.test.d.ts → integrations/context.test.d.ts} +0 -0
  227. /package/dist/__tests__/{expose-app-journey.test.d.ts → integrations/expose-app-journey.test.d.ts} +0 -0
  228. /package/dist/__tests__/{fetch.test.d.ts → integrations/fetch.test.d.ts} +0 -0
  229. /package/dist/__tests__/{jquery.test.d.ts → integrations/jquery.test.d.ts} +0 -0
  230. /package/dist/__tests__/{request-key.test.d.ts → integrations/request-key.test.d.ts} +0 -0
  231. /package/dist/__tests__/{scope.test.d.ts → integrations/scope.test.d.ts} +0 -0
  232. /package/dist/__tests__/{datadog.test.d.ts → sinks/datadog.test.d.ts} +0 -0
  233. /package/dist/__tests__/{sinks.test.d.ts → sinks/sinks.test.d.ts} +0 -0
package/README.md CHANGED
@@ -4,4 +4,4 @@ Critical user journey monitoring for Datadog RUM (`user_journey` custom actions)
4
4
 
5
5
  - **Docs:** [Journey](https://docs.st.dev/docs/frontend/journey) (source: [`packages/docs/docs/journey.mdx`](../docs/docs/journey.mdx))
6
6
 
7
- Prefer `defineJourney` handles (`.start` / `.step` / `.complete`). Soft ambient attributes HTTP only when exactly one step is in flight — use `step.tag()` after `await` or when steps overlap.
7
+ Prefer `defineJourney` handles (`.start` / `.step` / `.complete`). Soft ambient attributes HTTP only when exactly one step is in flight — pass `{ stamp: step.stamp() }` after `await` or when steps overlap. `start()` always opens a new instance. Default aborted-request policy is `continue`.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-runtime.d.ts","sourceRoot":"","sources":["../../src/__test-utils__/test-runtime.ts"],"names":[],"mappings":"AAQA,sDAAsD;AACtD,eAAO,MAAM,cAAc;;;;;;CAMjB,CAAC;AAEX,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,OAE9C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,QAqBxD"}
@@ -0,0 +1,54 @@
1
+ import { resetJourney } from '../core/runtime';
2
+ import { resetSharedPolicies, setJourneyDefaultEnabled } from '../global';
3
+ import { sendToConsole } from '../sinks/console';
4
+ import { sendToDatadog } from '../sinks/datadog';
5
+ /** Package default sinks installed by `config.ts` bootstrap. */ const DEFAULT_SINKS = [
6
+ sendToDatadog,
7
+ sendToConsole
8
+ ];
9
+ /** Standard journey def used across engine suites. */ export const baseJourneyDef = {
10
+ name: 'journey-under-test',
11
+ team: 'platform',
12
+ group: 'test',
13
+ service: 'journey',
14
+ timeoutMs: 0
15
+ };
16
+ /** Last emitted journey payload from a sink mock. */ export function lastJourney(emitMock) {
17
+ return emitMock.mock.calls[emitMock.mock.calls.length - 1][0].journey;
18
+ }
19
+ /**
20
+ * Wire `emitMock` as the only sink and restore package defaults after each test.
21
+ * Call once at the top of a `describe` block.
22
+ */ export function useJourneyTestRuntime(emitMock) {
23
+ beforeEach(()=>{
24
+ setJourneyDefaultEnabled(true);
25
+ resetSharedPolicies();
26
+ resetJourney({
27
+ sinks: [
28
+ emitMock
29
+ ],
30
+ slowRequests: {
31
+ defaultMs: 4000,
32
+ endpoints: []
33
+ }
34
+ });
35
+ emitMock.mockClear();
36
+ });
37
+ afterEach(()=>{
38
+ setJourneyDefaultEnabled(false);
39
+ localStorage.clear();
40
+ sessionStorage.clear();
41
+ resetSharedPolicies();
42
+ resetJourney({
43
+ sinks: [
44
+ ...DEFAULT_SINKS
45
+ ],
46
+ slowRequests: {
47
+ defaultMs: 4000,
48
+ endpoints: []
49
+ }
50
+ });
51
+ });
52
+ }
53
+
54
+ //# sourceMappingURL=test-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/__test-utils__/test-runtime.ts"],"sourcesContent":["import { resetJourney } from '../core/runtime';\nimport { resetSharedPolicies, setJourneyDefaultEnabled } from '../global';\nimport { sendToConsole } from '../sinks/console';\nimport { sendToDatadog } from '../sinks/datadog';\n\n/** Package default sinks installed by `config.ts` bootstrap. */\nconst DEFAULT_SINKS = [sendToDatadog, sendToConsole] as const;\n\n/** Standard journey def used across engine suites. */\nexport const baseJourneyDef = {\n name: 'journey-under-test',\n team: 'platform',\n group: 'test',\n service: 'journey',\n timeoutMs: 0,\n} as const;\n\n/** Last emitted journey payload from a sink mock. */\nexport function lastJourney(emitMock: jest.Mock) {\n return emitMock.mock.calls[emitMock.mock.calls.length - 1][0].journey;\n}\n\n/**\n * Wire `emitMock` as the only sink and restore package defaults after each test.\n * Call once at the top of a `describe` block.\n */\nexport function useJourneyTestRuntime(emitMock: jest.Mock) {\n beforeEach(() => {\n setJourneyDefaultEnabled(true);\n resetSharedPolicies();\n resetJourney({\n sinks: [emitMock],\n slowRequests: { defaultMs: 4_000, endpoints: [] },\n });\n emitMock.mockClear();\n });\n\n afterEach(() => {\n setJourneyDefaultEnabled(false);\n localStorage.clear();\n sessionStorage.clear();\n resetSharedPolicies();\n resetJourney({\n sinks: [...DEFAULT_SINKS],\n slowRequests: { defaultMs: 4_000, endpoints: [] },\n });\n });\n}\n"],"names":["resetJourney","resetSharedPolicies","setJourneyDefaultEnabled","sendToConsole","sendToDatadog","DEFAULT_SINKS","baseJourneyDef","name","team","group","service","timeoutMs","lastJourney","emitMock","mock","calls","length","journey","useJourneyTestRuntime","beforeEach","sinks","slowRequests","defaultMs","endpoints","mockClear","afterEach","localStorage","clear","sessionStorage"],"mappings":"AAAA,SAASA,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,mBAAmB,EAAEC,wBAAwB,QAAQ,YAAY;AAC1E,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,aAAa,QAAQ,mBAAmB;AAEjD,8DAA8D,GAC9D,MAAMC,gBAAgB;IAACD;IAAeD;CAAc;AAEpD,oDAAoD,GACpD,OAAO,MAAMG,iBAAiB;IAC1BC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,SAAS;IACTC,WAAW;AACf,EAAW;AAEX,mDAAmD,GACnD,OAAO,SAASC,YAAYC,QAAmB;IAC3C,OAAOA,SAASC,IAAI,CAACC,KAAK,CAACF,SAASC,IAAI,CAACC,KAAK,CAACC,MAAM,GAAG,EAAE,CAAC,EAAE,CAACC,OAAO;AACzE;AAEA;;;CAGC,GACD,OAAO,SAASC,sBAAsBL,QAAmB;IACrDM,WAAW;QACPjB,yBAAyB;QACzBD;QACAD,aAAa;YACToB,OAAO;gBAACP;aAAS;YACjBQ,cAAc;gBAAEC,WAAW;gBAAOC,WAAW,EAAE;YAAC;QACpD;QACAV,SAASW,SAAS;IACtB;IAEAC,UAAU;QACNvB,yBAAyB;QACzBwB,aAAaC,KAAK;QAClBC,eAAeD,KAAK;QACpB1B;QACAD,aAAa;YACToB,OAAO;mBAAIf;aAAc;YACzBgB,cAAc;gBAAEC,WAAW;gBAAOC,WAAW,EAAE;YAAC;QACpD;IACJ;AACJ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ambient.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/ambient.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/api.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-journey.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/define-journey.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/requests.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/runtime.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sanitize.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/sanitize.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/step.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeouts.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/core/timeouts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** @jest-environment jsdom */
2
+ import '../config';
3
+ //# sourceMappingURL=global.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/global.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hardening.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardening.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hardening.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/axios.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/context.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expose-app-journey.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/expose-app-journey.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/fetch.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=host-mfe.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-mfe.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/host-mfe.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jquery.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/jquery.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-key.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/request-key.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/scope.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-journey-step.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-journey-step.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations/use-journey-step.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=console.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/sinks/console.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datadog.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/sinks/datadog.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sinks.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/sinks/sinks.test.ts"],"names":[],"mappings":""}
package/dist/config.d.ts CHANGED
@@ -1,32 +1,72 @@
1
- import { type JourneySink } from './core/registry';
2
- import { type AppRequestTimeouts, type EndpointPolicy } from './endpoint-policy';
1
+ import type { JourneySink } from './core/types';
2
+ import type { RequestPolicyConfig } from './core/request-policy';
3
+ import { type SlowRequestConfig } from './core/endpoint-policy';
3
4
  import { type AxiosLikeInstance } from './integrations/axios';
4
5
  import { type InstrumentFetchOptions } from './integrations/fetch';
5
6
  import { type JqueryStatic, type WindowWithAppJourney } from './integrations/jquery';
6
- export { longestEndpointMatch, sortEndpointsByLongestMatch } from './endpoint-policy';
7
- export type { AppRequestTimeouts, EndpointPolicy };
8
7
  /** Optional app-wide / per-bundle configuration. */
9
8
  export interface JourneyConfig {
10
- /** App-wide request-timeout fallback. Defaults to { defaultMs: 4000, endpoints: [] }. */
11
- requestTimeouts?: AppRequestTimeouts;
9
+ /**
10
+ * App-wide slow-request thresholds (shared on `__stJourney` for all package copies).
11
+ * Package fallback remains `{ defaultMs: 4000, endpoints: [] }` until set.
12
+ * Desktop / KO hosts should set `defaultMs` and ignore noisy endpoint prefixes.
13
+ */
14
+ slowRequests?: SlowRequestConfig;
15
+ /**
16
+ * How attributed aborted/cancelled HTTP counts toward the open journey.
17
+ * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'`.
18
+ */
19
+ httpAbortedRequests?: RequestPolicyConfig;
20
+ /**
21
+ * How attributed 4xx responses count toward the open journey.
22
+ * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'` (no verdict change).
23
+ */
24
+ httpClientErrorRequests?: RequestPolicyConfig;
25
+ /**
26
+ * When true (default), untagged instrumented HTTP is attributed to the sole
27
+ * in-flight step (if exactly one). When false, only explicit `step.stamp()` attributes.
28
+ * Prefer false on busy desktop / shared jQuery shells with background traffic.
29
+ * Shared on `__stJourney`.
30
+ */
31
+ autoAttributeRequests?: boolean;
32
+ /**
33
+ * Default cap on recorded steps per journey (default 50). Per-journey
34
+ * `JourneyDef.maxSteps` overrides. Excess steps are dropped and
35
+ * `tags.steps_truncated` is set.
36
+ */
37
+ maxSteps?: number;
38
+ /**
39
+ * Applied when a journey omits `timeoutMs`.
40
+ * Default is 15m and closes as `excluded` with `journey-idle-timeout`.
41
+ * Pass `0` to disable this idle timeout.
42
+ */
43
+ defaultJourneyIdleMs?: number;
12
44
  /**
13
45
  * Replace the sink list used when a journey finishes.
14
46
  * Only applied when provided — omit to leave the current list unchanged.
15
- * Package default is `[sendToDatadog]`; pass `[]` to disable emission.
47
+ * Package default is `[sendToDatadog, sendToConsole]`; pass `[]` to disable emission.
48
+ * `sendToConsole` is a no-op unless `sessionStorage['st:journey:debug'] === 'true'`.
49
+ * First `sinks` on this bundle wins; a later `configureJourney({ sinks })` is ignored.
16
50
  */
17
51
  sinks?: readonly JourneySink[];
18
52
  /**
19
53
  * Wire this bundle's axios instance (host or MFE). Same as `instrumentAxios(axios)`.
20
54
  * Register any async request interceptors (e.g. auth) before `configureJourney`.
55
+ * Soft-skips when axios is missing / not axios-like — safe to pass a host instance that may be absent.
21
56
  */
22
- axios?: AxiosLikeInstance;
57
+ axios?: AxiosLikeInstance | null;
23
58
  /**
24
59
  * Wire fetch. `true` wraps `globalThis.fetch`; pass options for a scoped target / baseURL.
25
- * Same as `instrumentFetch(...)`.
60
+ * Same as `instrumentFetch(...)`. Soft-skips when the target has no callable `fetch`.
61
+ * Prefer host-only for `globalThis.fetch` — MFEs inherit the host wrapper.
26
62
  */
27
- fetch?: true | InstrumentFetchOptions;
28
- /** Wire this bundle's jQuery static. Same as `instrumentJquery($)`. */
29
- jquery?: JqueryStatic;
63
+ fetch?: true | InstrumentFetchOptions | null;
64
+ /**
65
+ * Wire jQuery. Pass a `$` instance, or `true` to use `globalThis.$` / `globalThis.jQuery`.
66
+ * `false` skips wiring. Soft-skips when `$` is missing / not real jQuery.
67
+ * Prefer host-only for shared `$`.
68
+ */
69
+ jquery?: boolean | JqueryStatic | null;
30
70
  /**
31
71
  * Publish `window.App.Journey` for Knockout / legacy hosts.
32
72
  * `true` uses the real window; pass a target object in tests.
@@ -36,7 +76,15 @@ export interface JourneyConfig {
36
76
  /**
37
77
  * Apply bundle options: request thresholds, sinks, and/or HTTP / legacy wiring.
38
78
  * Optional — call once at startup. Pass this bundle's own axios / `$` / fetch target.
79
+ * Policy knobs (`slowRequests`, `httpAbortedRequests`, `httpClientErrorRequests`,
80
+ * `autoAttributeRequests`) are stored on shared `__stJourney` so MFEs inherit host settings.
81
+ * No-ops when `isJourneyEnabled()` is false (host default or force flag).
82
+ * Never throws: missing/invalid config and failures soft-skip (warn / error to console).
39
83
  */
40
84
  export declare function configureJourney(config: JourneyConfig): void;
41
- export declare function getRequestTimeouts(): AppRequestTimeouts;
85
+ /**
86
+ * @internal Read the module runtime's app-wide slow-request config.
87
+ * Prefer `configureJourney({ slowRequests })` to set thresholds. Test / introspection only.
88
+ */
89
+ export declare function getSlowRequests(): SlowRequestConfig;
42
90
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAEH,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAGH,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC5B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACtF,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC;AAEnD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC1B,yFAAyF;IACzF,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,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E,iBAAiB,GAAG,IAAI,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,sBAAsB,GAAG,IAAI,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;CACrD;AAUD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAoG5D;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAEnD"}
package/dist/config.js CHANGED
@@ -1,46 +1,115 @@
1
- import { defaultRuntime } from './core/runtime';
2
- import { setJourneySinks } from './core/registry';
3
- import { sortEndpointsByLongestMatch } from './endpoint-policy';
1
+ import { moduleRuntime } from './core/runtime';
2
+ import { areSharedPoliciesLocked, getSharedSlowRequests, isJourneyEnabled, registerJourneyRuntime, seedSharedPolicies, warnIfSlowRequestsUnset } from './global';
3
+ import { sortEndpointsByLongestMatch } from './core/endpoint-policy';
4
4
  import { instrumentAxios } from './integrations/axios';
5
5
  import { instrumentFetch } from './integrations/fetch';
6
6
  import { exposeAppJourney, instrumentJquery } from './integrations/jquery';
7
+ import { resolveGlobalJquery } from './integrations/jquery/instrument';
8
+ import { sendToConsole } from './sinks/console';
7
9
  import { sendToDatadog } from './sinks/datadog';
8
- export { longestEndpointMatch, sortEndpointsByLongestMatch } from './endpoint-policy';
9
10
  /*
10
- * Default emission target. Kept as a module side effect so any import of this file
11
- * (see index.ts `import './config'`) installs Datadog. configureJourney only replaces
12
- * sinks when `sinks` is passed explicitly.
13
- */ setJourneySinks([
14
- sendToDatadog
11
+ * Default emission targets + `__stJourney` bag. Kept as a module side effect so any import
12
+ * of this file (see index.ts `import './config'`) installs Datadog, console, and
13
+ * `__stJourney`. configureJourney only replaces sinks when `sinks` is passed explicitly.
14
+ */ moduleRuntime.setSinks([
15
+ sendToDatadog,
16
+ sendToConsole
15
17
  ]);
18
+ registerJourneyRuntime(moduleRuntime);
16
19
  /**
17
20
  * Apply bundle options: request thresholds, sinks, and/or HTTP / legacy wiring.
18
21
  * Optional — call once at startup. Pass this bundle's own axios / `$` / fetch target.
22
+ * Policy knobs (`slowRequests`, `httpAbortedRequests`, `httpClientErrorRequests`,
23
+ * `autoAttributeRequests`) are stored on shared `__stJourney` so MFEs inherit host settings.
24
+ * No-ops when `isJourneyEnabled()` is false (host default or force flag).
25
+ * Never throws: missing/invalid config and failures soft-skip (warn / error to console).
19
26
  */ export function configureJourney(config) {
20
- if (config.requestTimeouts !== undefined) {
21
- defaultRuntime.setRequestTimeouts({
22
- ...config.requestTimeouts,
23
- endpoints: sortEndpointsByLongestMatch(config.requestTimeouts.endpoints)
24
- });
27
+ if (config == null || typeof config !== 'object') {
28
+ // eslint-disable-next-line no-console -- soft-skip missing host config
29
+ console.warn('[journey] configureJourney: skipped — missing');
30
+ return;
25
31
  }
26
- if (config.sinks !== undefined) {
27
- setJourneySinks(config.sinks);
32
+ if (!isJourneyEnabled()) {
33
+ // eslint-disable-next-line no-console -- soft-skip when host default and force are off
34
+ console.warn('[journey] configureJourney: skipped — disabled (call setJourneyDefaultEnabled(true) or __stJourney.enable(), then configureJourney again / reload)');
35
+ return;
28
36
  }
29
- if (config.axios !== undefined) {
30
- instrumentAxios(config.axios);
31
- }
32
- if (config.fetch !== undefined) {
33
- instrumentFetch(config.fetch === true ? {} : config.fetch);
34
- }
35
- if (config.jquery !== undefined) {
36
- instrumentJquery(config.jquery);
37
- }
38
- if (config.exposeAppJourney) {
39
- exposeAppJourney(config.exposeAppJourney === true ? undefined : config.exposeAppJourney);
37
+ try {
38
+ const overlay = {};
39
+ const policyPatch = {};
40
+ let hasPolicyKnob = false;
41
+ if (config.slowRequests !== undefined) {
42
+ const sorted = {
43
+ ...config.slowRequests,
44
+ endpoints: sortEndpointsByLongestMatch(config.slowRequests.endpoints)
45
+ };
46
+ policyPatch.slowRequests = sorted;
47
+ policyPatch.slowRequestsConfigured = true;
48
+ overlay.slowRequests = sorted;
49
+ hasPolicyKnob = true;
50
+ }
51
+ if (config.httpAbortedRequests !== undefined) {
52
+ policyPatch.httpAbortedRequests = config.httpAbortedRequests;
53
+ overlay.httpAbortedRequests = config.httpAbortedRequests;
54
+ hasPolicyKnob = true;
55
+ }
56
+ if (config.httpClientErrorRequests !== undefined) {
57
+ policyPatch.httpClientErrorRequests = config.httpClientErrorRequests;
58
+ overlay.httpClientErrorRequests = config.httpClientErrorRequests;
59
+ hasPolicyKnob = true;
60
+ }
61
+ if (config.autoAttributeRequests !== undefined) {
62
+ policyPatch.autoAttributeRequests = config.autoAttributeRequests;
63
+ overlay.autoAttributeRequests = config.autoAttributeRequests;
64
+ hasPolicyKnob = true;
65
+ }
66
+ if (hasPolicyKnob) {
67
+ if (!areSharedPoliciesLocked()) {
68
+ seedSharedPolicies(policyPatch);
69
+ }
70
+ moduleRuntime.setPolicyOverlay(overlay);
71
+ }
72
+ if (config.maxSteps !== undefined) {
73
+ moduleRuntime.setMaxSteps(config.maxSteps);
74
+ }
75
+ if (config.defaultJourneyIdleMs !== undefined) {
76
+ moduleRuntime.setDefaultJourneyIdleMs(config.defaultJourneyIdleMs);
77
+ }
78
+ if (config.sinks !== undefined) {
79
+ if (!moduleRuntime.trySetConfiguredSinks(config.sinks)) {
80
+ // eslint-disable-next-line no-console -- first-writer sinks
81
+ console.warn('[journey] configureJourney: sinks already set on this runtime — ignoring');
82
+ }
83
+ }
84
+ const wiringTransport = config.axios !== undefined || config.fetch !== undefined || config.jquery !== undefined && config.jquery !== false;
85
+ if (wiringTransport) {
86
+ warnIfSlowRequestsUnset();
87
+ }
88
+ if (config.axios !== undefined) {
89
+ instrumentAxios(config.axios);
90
+ }
91
+ if (config.fetch !== undefined) {
92
+ instrumentFetch(config.fetch === true ? {} : config.fetch);
93
+ }
94
+ if (config.jquery === true) {
95
+ instrumentJquery(resolveGlobalJquery());
96
+ } else if (config.jquery !== undefined && config.jquery !== false) {
97
+ instrumentJquery(config.jquery);
98
+ }
99
+ if (config.exposeAppJourney) {
100
+ exposeAppJourney(config.exposeAppJourney === true ? undefined : config.exposeAppJourney);
101
+ }
102
+ } catch (err) {
103
+ // eslint-disable-next-line no-console -- soft-fail host wiring
104
+ console.error('[journey] configureJourney failed', err);
40
105
  }
41
106
  }
42
- export function getRequestTimeouts() {
43
- return defaultRuntime.getRequestTimeouts();
107
+ /**
108
+ * @internal Read the module runtime's app-wide slow-request config.
109
+ * Prefer `configureJourney({ slowRequests })` to set thresholds. Test / introspection only.
110
+ */ export function getSlowRequests() {
111
+ var _getSharedSlowRequests;
112
+ return (_getSharedSlowRequests = getSharedSlowRequests()) !== null && _getSharedSlowRequests !== void 0 ? _getSharedSlowRequests : moduleRuntime.getSlowRequests();
44
113
  }
45
114
 
46
115
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import { defaultRuntime } from './core/runtime';\nimport { setJourneySinks, type JourneySink } from './core/registry';\nimport {\n sortEndpointsByLongestMatch,\n type AppRequestTimeouts,\n type EndpointPolicy,\n} from './endpoint-policy';\nimport { instrumentAxios, type AxiosLikeInstance } from './integrations/axios';\nimport { instrumentFetch, type InstrumentFetchOptions } from './integrations/fetch';\nimport {\n exposeAppJourney,\n instrumentJquery,\n type JqueryStatic,\n type WindowWithAppJourney,\n} from './integrations/jquery';\nimport { sendToDatadog } from './sinks/datadog';\n\nexport { longestEndpointMatch, sortEndpointsByLongestMatch } from './endpoint-policy';\nexport type { AppRequestTimeouts, EndpointPolicy };\n\n/** Optional app-wide / per-bundle configuration. */\nexport interface JourneyConfig {\n /** App-wide request-timeout fallback. Defaults to { defaultMs: 4000, endpoints: [] }. */\n requestTimeouts?: AppRequestTimeouts;\n /**\n * Replace the sink list used when a journey finishes.\n * Only applied when provided — omit to leave the current list unchanged.\n * Package default is `[sendToDatadog]`; pass `[]` to disable emission.\n */\n sinks?: readonly JourneySink[];\n /**\n * Wire this bundle's axios instance (host or MFE). Same as `instrumentAxios(axios)`.\n * Register any async request interceptors (e.g. auth) before `configureJourney`.\n */\n axios?: AxiosLikeInstance;\n /**\n * Wire fetch. `true` wraps `globalThis.fetch`; pass options for a scoped target / baseURL.\n * Same as `instrumentFetch(...)`.\n */\n fetch?: true | InstrumentFetchOptions;\n /** Wire this bundle's jQuery static. Same as `instrumentJquery($)`. */\n jquery?: JqueryStatic;\n /**\n * Publish `window.App.Journey` for Knockout / legacy hosts.\n * `true` uses the real window; pass a target object in tests.\n */\n exposeAppJourney?: boolean | WindowWithAppJourney;\n}\n\n/*\n * Default emission target. Kept as a module side effect so any import of this file\n * (see index.ts `import './config'`) installs Datadog. configureJourney only replaces\n * sinks when `sinks` is passed explicitly.\n */\nsetJourneySinks([sendToDatadog]);\n\n/**\n * Apply bundle options: request thresholds, sinks, and/or HTTP / legacy wiring.\n * Optional — call once at startup. Pass this bundle's own axios / `$` / fetch target.\n */\nexport function configureJourney(config: JourneyConfig): void {\n if (config.requestTimeouts !== undefined) {\n defaultRuntime.setRequestTimeouts({\n ...config.requestTimeouts,\n endpoints: sortEndpointsByLongestMatch(config.requestTimeouts.endpoints),\n });\n }\n if (config.sinks !== undefined) {\n setJourneySinks(config.sinks);\n }\n if (config.axios !== undefined) {\n instrumentAxios(config.axios);\n }\n if (config.fetch !== undefined) {\n instrumentFetch(config.fetch === true ? {} : config.fetch);\n }\n if (config.jquery !== undefined) {\n instrumentJquery(config.jquery);\n }\n if (config.exposeAppJourney) {\n exposeAppJourney(config.exposeAppJourney === true ? undefined : config.exposeAppJourney);\n }\n}\n\nexport function getRequestTimeouts(): AppRequestTimeouts {\n return defaultRuntime.getRequestTimeouts();\n}\n"],"names":["defaultRuntime","setJourneySinks","sortEndpointsByLongestMatch","instrumentAxios","instrumentFetch","exposeAppJourney","instrumentJquery","sendToDatadog","longestEndpointMatch","configureJourney","config","requestTimeouts","undefined","setRequestTimeouts","endpoints","sinks","axios","fetch","jquery","getRequestTimeouts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SAASC,eAAe,QAA0B,kBAAkB;AACpE,SACIC,2BAA2B,QAGxB,oBAAoB;AAC3B,SAASC,eAAe,QAAgC,uBAAuB;AAC/E,SAASC,eAAe,QAAqC,uBAAuB;AACpF,SACIC,gBAAgB,EAChBC,gBAAgB,QAGb,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,SAASC,oBAAoB,EAAEN,2BAA2B,QAAQ,oBAAoB;AAgCtF;;;;CAIC,GACDD,gBAAgB;IAACM;CAAc;AAE/B;;;CAGC,GACD,OAAO,SAASE,iBAAiBC,MAAqB;IAClD,IAAIA,OAAOC,eAAe,KAAKC,WAAW;QACtCZ,eAAea,kBAAkB,CAAC;YAC9B,GAAGH,OAAOC,eAAe;YACzBG,WAAWZ,4BAA4BQ,OAAOC,eAAe,CAACG,SAAS;QAC3E;IACJ;IACA,IAAIJ,OAAOK,KAAK,KAAKH,WAAW;QAC5BX,gBAAgBS,OAAOK,KAAK;IAChC;IACA,IAAIL,OAAOM,KAAK,KAAKJ,WAAW;QAC5BT,gBAAgBO,OAAOM,KAAK;IAChC;IACA,IAAIN,OAAOO,KAAK,KAAKL,WAAW;QAC5BR,gBAAgBM,OAAOO,KAAK,KAAK,OAAO,CAAC,IAAIP,OAAOO,KAAK;IAC7D;IACA,IAAIP,OAAOQ,MAAM,KAAKN,WAAW;QAC7BN,iBAAiBI,OAAOQ,MAAM;IAClC;IACA,IAAIR,OAAOL,gBAAgB,EAAE;QACzBA,iBAAiBK,OAAOL,gBAAgB,KAAK,OAAOO,YAAYF,OAAOL,gBAAgB;IAC3F;AACJ;AAEA,OAAO,SAASc;IACZ,OAAOnB,eAAemB,kBAAkB;AAC5C"}
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import { moduleRuntime } from './core/runtime';\nimport type { JourneySink } from './core/types';\nimport type { RequestPolicyConfig } from './core/request-policy';\nimport {\n areSharedPoliciesLocked,\n getSharedSlowRequests,\n isJourneyEnabled,\n registerJourneyRuntime,\n seedSharedPolicies,\n warnIfSlowRequestsUnset,\n} from './global';\nimport { sortEndpointsByLongestMatch, type SlowRequestConfig } from './core/endpoint-policy';\nimport { instrumentAxios, type AxiosLikeInstance } from './integrations/axios';\nimport { instrumentFetch, type InstrumentFetchOptions } from './integrations/fetch';\nimport {\n exposeAppJourney,\n instrumentJquery,\n type JqueryStatic,\n type WindowWithAppJourney,\n} from './integrations/jquery';\nimport { resolveGlobalJquery } from './integrations/jquery/instrument';\nimport { sendToConsole } from './sinks/console';\nimport { sendToDatadog } from './sinks/datadog';\n\n/** Optional app-wide / per-bundle configuration. */\nexport interface JourneyConfig {\n /**\n * App-wide slow-request thresholds (shared on `__stJourney` for all package copies).\n * Package fallback remains `{ defaultMs: 4000, endpoints: [] }` until set.\n * Desktop / KO hosts should set `defaultMs` and ignore noisy endpoint prefixes.\n */\n slowRequests?: SlowRequestConfig;\n /**\n * How attributed aborted/cancelled HTTP counts toward the open journey.\n * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'`.\n */\n httpAbortedRequests?: RequestPolicyConfig;\n /**\n * How attributed 4xx responses count toward the open journey.\n * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'` (no verdict change).\n */\n httpClientErrorRequests?: RequestPolicyConfig;\n /**\n * When true (default), untagged instrumented HTTP is attributed to the sole\n * in-flight step (if exactly one). When false, only explicit `step.stamp()` attributes.\n * Prefer false on busy desktop / shared jQuery shells with background traffic.\n * Shared on `__stJourney`.\n */\n autoAttributeRequests?: boolean;\n /**\n * Default cap on recorded steps per journey (default 50). Per-journey\n * `JourneyDef.maxSteps` overrides. Excess steps are dropped and\n * `tags.steps_truncated` is set.\n */\n maxSteps?: number;\n /**\n * Applied when a journey omits `timeoutMs`.\n * Default is 15m and closes as `excluded` with `journey-idle-timeout`.\n * Pass `0` to disable this idle timeout.\n */\n defaultJourneyIdleMs?: number;\n /**\n * Replace the sink list used when a journey finishes.\n * Only applied when provided — omit to leave the current list unchanged.\n * Package default is `[sendToDatadog, sendToConsole]`; pass `[]` to disable emission.\n * `sendToConsole` is a no-op unless `sessionStorage['st:journey:debug'] === 'true'`.\n * First `sinks` on this bundle wins; a later `configureJourney({ sinks })` is ignored.\n */\n sinks?: readonly JourneySink[];\n /**\n * Wire this bundle's axios instance (host or MFE). Same as `instrumentAxios(axios)`.\n * Register any async request interceptors (e.g. auth) before `configureJourney`.\n * Soft-skips when axios is missing / not axios-like — safe to pass a host instance that may be absent.\n */\n axios?: AxiosLikeInstance | null;\n /**\n * Wire fetch. `true` wraps `globalThis.fetch`; pass options for a scoped target / baseURL.\n * Same as `instrumentFetch(...)`. Soft-skips when the target has no callable `fetch`.\n * Prefer host-only for `globalThis.fetch` — MFEs inherit the host wrapper.\n */\n fetch?: true | InstrumentFetchOptions | null;\n /**\n * Wire jQuery. Pass a `$` instance, or `true` to use `globalThis.$` / `globalThis.jQuery`.\n * `false` skips wiring. Soft-skips when `$` is missing / not real jQuery.\n * Prefer host-only for shared `$`.\n */\n jquery?: boolean | JqueryStatic | null;\n /**\n * Publish `window.App.Journey` for Knockout / legacy hosts.\n * `true` uses the real window; pass a target object in tests.\n */\n exposeAppJourney?: boolean | WindowWithAppJourney;\n}\n\n/*\n * Default emission targets + `__stJourney` bag. Kept as a module side effect so any import\n * of this file (see index.ts `import './config'`) installs Datadog, console, and\n * `__stJourney`. configureJourney only replaces sinks when `sinks` is passed explicitly.\n */\nmoduleRuntime.setSinks([sendToDatadog, sendToConsole]);\nregisterJourneyRuntime(moduleRuntime);\n\n/**\n * Apply bundle options: request thresholds, sinks, and/or HTTP / legacy wiring.\n * Optional — call once at startup. Pass this bundle's own axios / `$` / fetch target.\n * Policy knobs (`slowRequests`, `httpAbortedRequests`, `httpClientErrorRequests`,\n * `autoAttributeRequests`) are stored on shared `__stJourney` so MFEs inherit host settings.\n * No-ops when `isJourneyEnabled()` is false (host default or force flag).\n * Never throws: missing/invalid config and failures soft-skip (warn / error to console).\n */\nexport function configureJourney(config: JourneyConfig): void {\n if (config == null || typeof config !== 'object') {\n // eslint-disable-next-line no-console -- soft-skip missing host config\n console.warn('[journey] configureJourney: skipped — missing');\n return;\n }\n if (!isJourneyEnabled()) {\n // eslint-disable-next-line no-console -- soft-skip when host default and force are off\n console.warn(\n '[journey] configureJourney: skipped — disabled (call setJourneyDefaultEnabled(true) or __stJourney.enable(), then configureJourney again / reload)'\n );\n return;\n }\n\n try {\n const overlay: {\n slowRequests?: SlowRequestConfig;\n httpAbortedRequests?: RequestPolicyConfig;\n httpClientErrorRequests?: RequestPolicyConfig;\n autoAttributeRequests?: boolean;\n } = {};\n\n const policyPatch: Parameters<typeof seedSharedPolicies>[0] = {};\n let hasPolicyKnob = false;\n\n if (config.slowRequests !== undefined) {\n const sorted = {\n ...config.slowRequests,\n endpoints: sortEndpointsByLongestMatch(config.slowRequests.endpoints),\n };\n policyPatch.slowRequests = sorted;\n policyPatch.slowRequestsConfigured = true;\n overlay.slowRequests = sorted;\n hasPolicyKnob = true;\n }\n if (config.httpAbortedRequests !== undefined) {\n policyPatch.httpAbortedRequests = config.httpAbortedRequests;\n overlay.httpAbortedRequests = config.httpAbortedRequests;\n hasPolicyKnob = true;\n }\n if (config.httpClientErrorRequests !== undefined) {\n policyPatch.httpClientErrorRequests = config.httpClientErrorRequests;\n overlay.httpClientErrorRequests = config.httpClientErrorRequests;\n hasPolicyKnob = true;\n }\n if (config.autoAttributeRequests !== undefined) {\n policyPatch.autoAttributeRequests = config.autoAttributeRequests;\n overlay.autoAttributeRequests = config.autoAttributeRequests;\n hasPolicyKnob = true;\n }\n\n if (hasPolicyKnob) {\n if (!areSharedPoliciesLocked()) {\n seedSharedPolicies(policyPatch);\n }\n moduleRuntime.setPolicyOverlay(overlay);\n }\n if (config.maxSteps !== undefined) {\n moduleRuntime.setMaxSteps(config.maxSteps);\n }\n if (config.defaultJourneyIdleMs !== undefined) {\n moduleRuntime.setDefaultJourneyIdleMs(config.defaultJourneyIdleMs);\n }\n if (config.sinks !== undefined) {\n if (!moduleRuntime.trySetConfiguredSinks(config.sinks)) {\n // eslint-disable-next-line no-console -- first-writer sinks\n console.warn(\n '[journey] configureJourney: sinks already set on this runtime — ignoring'\n );\n }\n }\n\n const wiringTransport =\n config.axios !== undefined ||\n config.fetch !== undefined ||\n (config.jquery !== undefined && config.jquery !== false);\n if (wiringTransport) {\n warnIfSlowRequestsUnset();\n }\n\n if (config.axios !== undefined) {\n instrumentAxios(config.axios);\n }\n if (config.fetch !== undefined) {\n instrumentFetch(config.fetch === true ? {} : config.fetch);\n }\n if (config.jquery === true) {\n instrumentJquery(resolveGlobalJquery());\n } else if (config.jquery !== undefined && config.jquery !== false) {\n instrumentJquery(config.jquery);\n }\n if (config.exposeAppJourney) {\n exposeAppJourney(\n config.exposeAppJourney === true ? undefined : config.exposeAppJourney\n );\n }\n } catch (err) {\n // eslint-disable-next-line no-console -- soft-fail host wiring\n console.error('[journey] configureJourney failed', err);\n }\n}\n\n/**\n * @internal Read the module runtime's app-wide slow-request config.\n * Prefer `configureJourney({ slowRequests })` to set thresholds. Test / introspection only.\n */\nexport function getSlowRequests(): SlowRequestConfig {\n return getSharedSlowRequests() ?? moduleRuntime.getSlowRequests();\n}\n"],"names":["moduleRuntime","areSharedPoliciesLocked","getSharedSlowRequests","isJourneyEnabled","registerJourneyRuntime","seedSharedPolicies","warnIfSlowRequestsUnset","sortEndpointsByLongestMatch","instrumentAxios","instrumentFetch","exposeAppJourney","instrumentJquery","resolveGlobalJquery","sendToConsole","sendToDatadog","setSinks","configureJourney","config","console","warn","overlay","policyPatch","hasPolicyKnob","slowRequests","undefined","sorted","endpoints","slowRequestsConfigured","httpAbortedRequests","httpClientErrorRequests","autoAttributeRequests","setPolicyOverlay","maxSteps","setMaxSteps","defaultJourneyIdleMs","setDefaultJourneyIdleMs","sinks","trySetConfiguredSinks","wiringTransport","axios","fetch","jquery","err","error","get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,MAAM,KAAKjB,aAAaP,OAAOwB,MAAM,KAAK,OAAO;YAC/D9B,iBAAiBM,OAAOwB,MAAM;QAClC;QACA,IAAIxB,OAAOP,gBAAgB,EAAE;YACzBA,iBACIO,OAAOP,gBAAgB,KAAK,OAAOc,YAAYP,OAAOP,gBAAgB;QAE9E;IACJ,EAAE,OAAOgC,KAAK;QACV,+DAA+D;QAC/DxB,QAAQyB,KAAK,CAAC,qCAAqCD;IACvD;AACJ;AAEA;;;CAGC,GACD,OAAO,SAASE;QACL1C;IAAP,QAAOA,yBAAAA,qCAAAA,oCAAAA,yBAA2BF,cAAc4C,eAAe;AACnE"}
@@ -0,0 +1,4 @@
1
+ export declare function isAbortError(error: unknown): boolean;
2
+ /** Axios cancel token, CanceledError, AbortError, or ERR_CANCELED. */
3
+ export declare function isCanceledError(error: unknown): boolean;
4
+ //# sourceMappingURL=abort-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-error.d.ts","sourceRoot":"","sources":["../../src/core/abort-error.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASpD;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWvD"}
@@ -0,0 +1,22 @@
1
+ export function isAbortError(error) {
2
+ if (error == null || typeof error !== 'object') {
3
+ return false;
4
+ }
5
+ const err = error;
6
+ if (err.name === 'AbortError' || err.name === 'CanceledError') {
7
+ return true;
8
+ }
9
+ return err.code === 'ERR_CANCELED';
10
+ }
11
+ /** Axios cancel token, CanceledError, AbortError, or ERR_CANCELED. */ export function isCanceledError(error) {
12
+ if (isAbortError(error)) {
13
+ return true;
14
+ }
15
+ if (error == null || typeof error !== 'object') {
16
+ return false;
17
+ }
18
+ /* eslint-disable @typescript-eslint/naming-convention -- axios Cancel token wire format */ const err = error;
19
+ return err.__CANCEL__ === true;
20
+ /* eslint-enable @typescript-eslint/naming-convention */ }
21
+
22
+ //# sourceMappingURL=abort-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/abort-error.ts"],"sourcesContent":["export function isAbortError(error: unknown): boolean {\n if (error == null || typeof error !== 'object') {\n return false;\n }\n const err = error as { name?: string; code?: string | number };\n if (err.name === 'AbortError' || err.name === 'CanceledError') {\n return true;\n }\n return err.code === 'ERR_CANCELED';\n}\n\n/** Axios cancel token, CanceledError, AbortError, or ERR_CANCELED. */\nexport function isCanceledError(error: unknown): boolean {\n if (isAbortError(error)) {\n return true;\n }\n if (error == null || typeof error !== 'object') {\n return false;\n }\n /* eslint-disable @typescript-eslint/naming-convention -- axios Cancel token wire format */\n const err = error as { __CANCEL__?: boolean };\n return err.__CANCEL__ === true;\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n"],"names":["isAbortError","error","err","name","code","isCanceledError","__CANCEL__"],"mappings":"AAAA,OAAO,SAASA,aAAaC,KAAc;IACvC,IAAIA,SAAS,QAAQ,OAAOA,UAAU,UAAU;QAC5C,OAAO;IACX;IACA,MAAMC,MAAMD;IACZ,IAAIC,IAAIC,IAAI,KAAK,gBAAgBD,IAAIC,IAAI,KAAK,iBAAiB;QAC3D,OAAO;IACX;IACA,OAAOD,IAAIE,IAAI,KAAK;AACxB;AAEA,oEAAoE,GACpE,OAAO,SAASC,gBAAgBJ,KAAc;IAC1C,IAAID,aAAaC,QAAQ;QACrB,OAAO;IACX;IACA,IAAIA,SAAS,QAAQ,OAAOA,UAAU,UAAU;QAC5C,OAAO;IACX;IACA,yFAAyF,GACzF,MAAMC,MAAMD;IACZ,OAAOC,IAAII,UAAU,KAAK;AAC1B,sDAAsD,GAC1D"}
@@ -0,0 +1,43 @@
1
+ import { JourneyStepStamp } from './step-tag';
2
+ import type { JourneyDef, JourneyHandle, JourneyStepOptions, JourneyStepTarget, StepHandle, StepRecord, TagValue } from './types';
3
+ /**
4
+ * Unique in-flight step as a stamp-ready {@link JourneyStepStamp}, or null when
5
+ * auto-attribute is disabled, or when 0 or 2+ steps are in flight app-wide.
6
+ * Ambient stamps never carry `score` or `ignore`. Untagged traffic is attributed
7
+ * to that lone step even if unrelated — prefer `step.stamp()` when the page has
8
+ * background instrumented requests. Disable via
9
+ * `configureJourney({ autoAttributeRequests: false })`.
10
+ */
11
+ export declare function singleInFlightJourneyStep(): JourneyStepStamp | null;
12
+ /** @internal Clear cached ambient stamp when runtime state changes. */
13
+ export declare function invalidateAmbientStamp(step?: StepRecord): void;
14
+ /**
15
+ * Prefer an explicit `step.stamp()` value; else the ambient in-flight stamp.
16
+ * Same-realm stamps are returned as-is (identity + score + ignore). Branded
17
+ * foreign copies are adopted into a local stamp. Raw StepRecords are not stamps.
18
+ */
19
+ export declare function resolveStamp(explicit?: unknown): JourneyStepStamp | undefined;
20
+ /**
21
+ * Record a finished backend request against a captured step.
22
+ * 5xx / network / slow (over threshold) mark Bad; 4xx is not counted. Fail-fast on breach.
23
+ * @internal Prefer {@link onHttpComplete} from adapters.
24
+ */
25
+ export declare function reportBackendRequest(step: StepRecord | undefined, status: number | undefined, durationMs: number, requestKey: string): void;
26
+ /**
27
+ * Run one step of a named journey. Runs untraced (noop handle) when no matching journey is open.
28
+ * `journey` may be a name, null, an ordered candidate list, a def, or a handle.
29
+ * A def or handle auto-starts when that journey is not already open; a bare name does not.
30
+ * Prefer `defineJourney(...).step` when you own the journey config.
31
+ */
32
+ export declare function journeyStep<T>(journey: JourneyStepTarget, stepName: string, fn: (step: StepHandle) => T | Promise<T>, opts?: JourneyStepOptions): Promise<T>;
33
+ /** Merge custom tags onto an open journey. No-op if not open. Prefer `handle.setTags`. */
34
+ export declare function setJourneyTags(name: string | null, tags: Record<string, TagValue>): void;
35
+ /** Mark a named journey Bad for a custom reason (fail-fast). Prefer `handle.fail`. */
36
+ export declare function failJourney(name: string, reason: string): void;
37
+ /** Successful end. Outcome stays Bad if a breach already occurred. No-op when name is null. Prefer `handle.complete`. */
38
+ export declare function completeJourney(name: string | null, tags?: Record<string, TagValue>): void;
39
+ /** User left before finishing. Stays Bad if a breach already occurred (breach-anchored). Prefer `handle.exclude`. */
40
+ export declare function excludeJourney(name: string): void;
41
+ /** Turn a journey config into a handle with bound lifecycle methods. Preferred public API. */
42
+ export declare function defineJourney(config: JourneyDef): JourneyHandle;
43
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/core/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EACR,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,QAAQ,EACX,MAAM,SAAS,CAAC;AAKjB;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,gBAAgB,GAAG,IAAI,CAiBnE;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAK9D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAM7E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACnB,IAAI,CAKN;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAC/B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxC,IAAI,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EA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