@grafana/faro-web-sdk 1.14.3 → 1.16.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 (174) hide show
  1. package/dist/bundle/faro-web-sdk.iife.js +1 -1
  2. package/dist/bundle/types/index.d.ts +3 -3
  3. package/dist/bundle/types/instrumentations/console/instrumentation.d.ts +1 -1
  4. package/dist/bundle/types/instrumentations/errors/instrumentation.d.ts +1 -1
  5. package/dist/bundle/types/instrumentations/index.d.ts +1 -1
  6. package/dist/bundle/types/instrumentations/performance/instrumentation.d.ts +1 -1
  7. package/dist/bundle/types/instrumentations/session/instrumentation.d.ts +1 -1
  8. package/dist/bundle/types/instrumentations/session/sessionManager/sessionManagerUtils.d.ts +1 -1
  9. package/dist/bundle/types/instrumentations/userActions/const.d.ts +0 -1
  10. package/dist/bundle/types/instrumentations/userActions/httpRequestMonitor.d.ts +2 -1
  11. package/dist/bundle/types/instrumentations/userActions/index.d.ts +2 -2
  12. package/dist/bundle/types/instrumentations/userActions/instrumentation.d.ts +2 -1
  13. package/dist/bundle/types/instrumentations/userActions/processUserActionEventHandler.d.ts +3 -2
  14. package/dist/bundle/types/instrumentations/userActions/types.d.ts +15 -2
  15. package/dist/bundle/types/instrumentations/view/instrumentation.d.ts +1 -1
  16. package/dist/bundle/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  17. package/dist/bundle/types/instrumentations/webVitals/webVitalsBasic.d.ts +8 -10
  18. package/dist/bundle/types/instrumentations/webVitals/webVitalsWithAttribution.d.ts +2 -4
  19. package/dist/bundle/types/transports/console/transport.d.ts +1 -1
  20. package/dist/bundle/types/transports/fetch/transport.d.ts +3 -3
  21. package/dist/bundle/types/utils/index.d.ts +1 -1
  22. package/dist/bundle/types/utils/url.d.ts +8 -0
  23. package/dist/cjs/config/getWebInstrumentations.js +1 -2
  24. package/dist/cjs/config/getWebInstrumentations.js.map +1 -1
  25. package/dist/cjs/config/makeCoreConfig.js +1 -2
  26. package/dist/cjs/config/makeCoreConfig.js.map +1 -1
  27. package/dist/cjs/index.js +8 -7
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/initialize.js +1 -2
  30. package/dist/cjs/initialize.js.map +1 -1
  31. package/dist/cjs/instrumentations/console/instrumentation.js.map +1 -1
  32. package/dist/cjs/instrumentations/errors/getErrorDetails.js +3 -4
  33. package/dist/cjs/instrumentations/errors/getErrorDetails.js.map +1 -1
  34. package/dist/cjs/instrumentations/errors/getValueAndTypeFromMessage.js +1 -2
  35. package/dist/cjs/instrumentations/errors/getValueAndTypeFromMessage.js.map +1 -1
  36. package/dist/cjs/instrumentations/errors/instrumentation.js.map +1 -1
  37. package/dist/cjs/instrumentations/errors/registerOnerror.js +1 -2
  38. package/dist/cjs/instrumentations/errors/registerOnerror.js.map +1 -1
  39. package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js +1 -2
  40. package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
  41. package/dist/cjs/instrumentations/errors/stackFrames/buildStackFrame.js +1 -2
  42. package/dist/cjs/instrumentations/errors/stackFrames/buildStackFrame.js.map +1 -1
  43. package/dist/cjs/instrumentations/errors/stackFrames/getDataFromSafariExtensions.js +1 -2
  44. package/dist/cjs/instrumentations/errors/stackFrames/getDataFromSafariExtensions.js.map +1 -1
  45. package/dist/cjs/instrumentations/errors/stackFrames/getStackFramesFromError.js +1 -2
  46. package/dist/cjs/instrumentations/errors/stackFrames/getStackFramesFromError.js.map +1 -1
  47. package/dist/cjs/instrumentations/errors/stackFrames/parseStacktrace.js +1 -2
  48. package/dist/cjs/instrumentations/errors/stackFrames/parseStacktrace.js.map +1 -1
  49. package/dist/cjs/instrumentations/index.js +2 -1
  50. package/dist/cjs/instrumentations/index.js.map +1 -1
  51. package/dist/cjs/instrumentations/performance/instrumentation.js +2 -2
  52. package/dist/cjs/instrumentations/performance/instrumentation.js.map +1 -1
  53. package/dist/cjs/instrumentations/performance/navigation.js +1 -2
  54. package/dist/cjs/instrumentations/performance/navigation.js.map +1 -1
  55. package/dist/cjs/instrumentations/performance/performanceUtils.js +7 -10
  56. package/dist/cjs/instrumentations/performance/performanceUtils.js.map +1 -1
  57. package/dist/cjs/instrumentations/performance/resource.js +1 -2
  58. package/dist/cjs/instrumentations/performance/resource.js.map +1 -1
  59. package/dist/cjs/instrumentations/session/instrumentation.js.map +1 -1
  60. package/dist/cjs/instrumentations/session/sessionManager/PersistentSessionsManager.js.map +1 -1
  61. package/dist/cjs/instrumentations/session/sessionManager/VolatileSessionManager.js.map +1 -1
  62. package/dist/cjs/instrumentations/session/sessionManager/getSessionManagerByConfig.js +1 -2
  63. package/dist/cjs/instrumentations/session/sessionManager/getSessionManagerByConfig.js.map +1 -1
  64. package/dist/cjs/instrumentations/session/sessionManager/sampling.js +1 -2
  65. package/dist/cjs/instrumentations/session/sessionManager/sampling.js.map +1 -1
  66. package/dist/cjs/instrumentations/session/sessionManager/sessionManagerUtils.js +5 -6
  67. package/dist/cjs/instrumentations/session/sessionManager/sessionManagerUtils.js.map +1 -1
  68. package/dist/cjs/instrumentations/userActions/const.js +1 -2
  69. package/dist/cjs/instrumentations/userActions/const.js.map +1 -1
  70. package/dist/cjs/instrumentations/userActions/domMutationMonitor.js +1 -2
  71. package/dist/cjs/instrumentations/userActions/domMutationMonitor.js.map +1 -1
  72. package/dist/cjs/instrumentations/userActions/httpRequestMonitor.js +56 -47
  73. package/dist/cjs/instrumentations/userActions/httpRequestMonitor.js.map +1 -1
  74. package/dist/cjs/instrumentations/userActions/index.js +2 -1
  75. package/dist/cjs/instrumentations/userActions/index.js.map +1 -1
  76. package/dist/cjs/instrumentations/userActions/instrumentation.js +13 -1
  77. package/dist/cjs/instrumentations/userActions/instrumentation.js.map +1 -1
  78. package/dist/cjs/instrumentations/userActions/performanceEntriesMonitor.js +1 -2
  79. package/dist/cjs/instrumentations/userActions/performanceEntriesMonitor.js.map +1 -1
  80. package/dist/cjs/instrumentations/userActions/processUserActionEventHandler.js +121 -60
  81. package/dist/cjs/instrumentations/userActions/processUserActionEventHandler.js.map +1 -1
  82. package/dist/cjs/instrumentations/userActions/types.js.map +1 -1
  83. package/dist/cjs/instrumentations/userActions/util.js +1 -2
  84. package/dist/cjs/instrumentations/userActions/util.js.map +1 -1
  85. package/dist/cjs/instrumentations/view/instrumentation.js.map +1 -1
  86. package/dist/cjs/instrumentations/webVitals/instrumentation.js.map +1 -1
  87. package/dist/cjs/instrumentations/webVitals/webVitalsWithAttribution.js.map +1 -1
  88. package/dist/cjs/metas/browser/meta.js.map +1 -1
  89. package/dist/cjs/metas/page/meta.js +1 -2
  90. package/dist/cjs/metas/page/meta.js.map +1 -1
  91. package/dist/cjs/metas/session/createSession.js +1 -2
  92. package/dist/cjs/metas/session/createSession.js.map +1 -1
  93. package/dist/cjs/transports/console/transport.js.map +1 -1
  94. package/dist/cjs/transports/fetch/transport.js +3 -4
  95. package/dist/cjs/transports/fetch/transport.js.map +1 -1
  96. package/dist/cjs/utils/index.js +2 -1
  97. package/dist/cjs/utils/index.js.map +1 -1
  98. package/dist/cjs/utils/throttle.js +1 -2
  99. package/dist/cjs/utils/throttle.js.map +1 -1
  100. package/dist/cjs/utils/url.js +22 -3
  101. package/dist/cjs/utils/url.js.map +1 -1
  102. package/dist/cjs/utils/webStorage.js +5 -5
  103. package/dist/cjs/utils/webStorage.js.map +1 -1
  104. package/dist/esm/config/getWebInstrumentations.js.map +1 -1
  105. package/dist/esm/config/makeCoreConfig.js.map +1 -1
  106. package/dist/esm/index.js +3 -3
  107. package/dist/esm/index.js.map +1 -1
  108. package/dist/esm/initialize.js.map +1 -1
  109. package/dist/esm/instrumentations/console/instrumentation.js.map +1 -1
  110. package/dist/esm/instrumentations/errors/getErrorDetails.js.map +1 -1
  111. package/dist/esm/instrumentations/errors/registerOnerror.js.map +1 -1
  112. package/dist/esm/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
  113. package/dist/esm/instrumentations/errors/stackFrames/buildStackFrame.js.map +1 -1
  114. package/dist/esm/instrumentations/errors/stackFrames/getDataFromSafariExtensions.js.map +1 -1
  115. package/dist/esm/instrumentations/errors/stackFrames/getStackFramesFromError.js.map +1 -1
  116. package/dist/esm/instrumentations/index.js +1 -1
  117. package/dist/esm/instrumentations/index.js.map +1 -1
  118. package/dist/esm/instrumentations/performance/instrumentation.js.map +1 -1
  119. package/dist/esm/instrumentations/performance/navigation.js.map +1 -1
  120. package/dist/esm/instrumentations/performance/performanceUtils.js +1 -3
  121. package/dist/esm/instrumentations/performance/performanceUtils.js.map +1 -1
  122. package/dist/esm/instrumentations/performance/resource.js.map +1 -1
  123. package/dist/esm/instrumentations/session/instrumentation.js.map +1 -1
  124. package/dist/esm/instrumentations/session/sessionManager/PersistentSessionsManager.js.map +1 -1
  125. package/dist/esm/instrumentations/session/sessionManager/VolatileSessionManager.js.map +1 -1
  126. package/dist/esm/instrumentations/session/sessionManager/sampling.js.map +1 -1
  127. package/dist/esm/instrumentations/session/sessionManager/sessionManagerUtils.js.map +1 -1
  128. package/dist/esm/instrumentations/userActions/const.js +0 -1
  129. package/dist/esm/instrumentations/userActions/const.js.map +1 -1
  130. package/dist/esm/instrumentations/userActions/httpRequestMonitor.js +56 -48
  131. package/dist/esm/instrumentations/userActions/httpRequestMonitor.js.map +1 -1
  132. package/dist/esm/instrumentations/userActions/index.js +1 -1
  133. package/dist/esm/instrumentations/userActions/index.js.map +1 -1
  134. package/dist/esm/instrumentations/userActions/instrumentation.js +12 -1
  135. package/dist/esm/instrumentations/userActions/instrumentation.js.map +1 -1
  136. package/dist/esm/instrumentations/userActions/performanceEntriesMonitor.js.map +1 -1
  137. package/dist/esm/instrumentations/userActions/processUserActionEventHandler.js +114 -60
  138. package/dist/esm/instrumentations/userActions/processUserActionEventHandler.js.map +1 -1
  139. package/dist/esm/instrumentations/userActions/types.js.map +1 -1
  140. package/dist/esm/instrumentations/view/instrumentation.js.map +1 -1
  141. package/dist/esm/instrumentations/webVitals/instrumentation.js.map +1 -1
  142. package/dist/esm/instrumentations/webVitals/webVitalsWithAttribution.js.map +1 -1
  143. package/dist/esm/metas/browser/meta.js.map +1 -1
  144. package/dist/esm/metas/page/meta.js.map +1 -1
  145. package/dist/esm/transports/fetch/transport.js +1 -1
  146. package/dist/esm/transports/fetch/transport.js.map +1 -1
  147. package/dist/esm/utils/index.js +1 -1
  148. package/dist/esm/utils/index.js.map +1 -1
  149. package/dist/esm/utils/throttle.js.map +1 -1
  150. package/dist/esm/utils/url.js +20 -1
  151. package/dist/esm/utils/url.js.map +1 -1
  152. package/dist/esm/utils/webStorage.js.map +1 -1
  153. package/dist/types/index.d.ts +3 -3
  154. package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
  155. package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
  156. package/dist/types/instrumentations/index.d.ts +1 -1
  157. package/dist/types/instrumentations/performance/instrumentation.d.ts +1 -1
  158. package/dist/types/instrumentations/session/instrumentation.d.ts +1 -1
  159. package/dist/types/instrumentations/session/sessionManager/sessionManagerUtils.d.ts +1 -1
  160. package/dist/types/instrumentations/userActions/const.d.ts +0 -1
  161. package/dist/types/instrumentations/userActions/httpRequestMonitor.d.ts +2 -1
  162. package/dist/types/instrumentations/userActions/index.d.ts +2 -2
  163. package/dist/types/instrumentations/userActions/instrumentation.d.ts +2 -1
  164. package/dist/types/instrumentations/userActions/processUserActionEventHandler.d.ts +3 -2
  165. package/dist/types/instrumentations/userActions/types.d.ts +15 -2
  166. package/dist/types/instrumentations/view/instrumentation.d.ts +1 -1
  167. package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  168. package/dist/types/instrumentations/webVitals/webVitalsBasic.d.ts +8 -10
  169. package/dist/types/instrumentations/webVitals/webVitalsWithAttribution.d.ts +2 -4
  170. package/dist/types/transports/console/transport.d.ts +1 -1
  171. package/dist/types/transports/fetch/transport.d.ts +3 -3
  172. package/dist/types/utils/index.d.ts +1 -1
  173. package/dist/types/utils/url.d.ts +8 -0
  174. package/package.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F;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,mBAAqC;IAC3E,IAAI,yBAAyB,CAAC,mBAAmB,CAAC,EAAE;QAClD,MAAM,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KAC7C;AACH,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAEvF,SAAS,yBAAyB,CAAC,mBAAqC;IACtE,IAAI,mBAAmB,KAAK,cAAc,CAAC,KAAK,EAAE;QAChD,OAAO,uBAAuB,CAAC;KAChC;IAED,IAAI,mBAAmB,KAAK,cAAc,CAAC,OAAO,EAAE;QAClD,OAAO,yBAAyB,CAAC;KAClC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { faro } from '@grafana/faro-core';\n\nexport const webStorageType = {\n session: 'sessionStorage',\n local: 'localStorage',\n} as const;\n\ntype StorageMechanism = (typeof webStorageType)[keyof typeof webStorageType];\n\n/**\n * Check if selected web storage mechanism is available.\n * @param type storage mechanism to test availability for.\n * @returns\n */\nexport function isWebStorageAvailable(type: StorageMechanism): boolean {\n try {\n let storage;\n storage = window[type];\n\n const testItem = '__faro_storage_test__';\n storage.setItem(testItem, testItem);\n storage.removeItem(testItem);\n return true;\n } catch (error) {\n // the above can throw\n faro.internalLogger?.info(`Web storage of type ${type} is not available. Reason: ${error}`);\n return false;\n }\n}\n\n/**\n * Get item from SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function getItem(key: string, webStorageMechanism: StorageMechanism): string | null {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n return window[webStorageMechanism].getItem(key);\n }\n\n return null;\n}\n\n/**\n * Store item in SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param value: the item data.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function setItem(key: string, value: string, webStorageMechanism: StorageMechanism): void {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n try {\n window[webStorageMechanism].setItem(key, value);\n } catch (error) {\n // do nothing\n }\n }\n}\n\n/**\n * Remove item from SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function removeItem(key: string, webStorageMechanism: StorageMechanism): void {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n window[webStorageMechanism].removeItem(key);\n }\n}\n\nexport const isLocalStorageAvailable = isWebStorageAvailable(webStorageType.local);\nexport const isSessionStorageAvailable = isWebStorageAvailable(webStorageType.session);\n\nfunction isWebStorageTypeAvailable(webStorageMechanism: StorageMechanism) {\n if (webStorageMechanism === webStorageType.local) {\n return isLocalStorageAvailable;\n }\n\n if (webStorageMechanism === webStorageType.session) {\n return isSessionStorageAvailable;\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"webStorage.js","sourceRoot":"","sources":["../../../src/utils/webStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,cAAc;CACb,CAAC;AAIX;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAsB;;IAC1D,IAAI,CAAC;QACH,IAAI,OAAO,CAAC;QACZ,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,QAAQ,GAAG,uBAAuB,CAAC;QACzC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACpC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,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,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,IAAI,mBAAmB,KAAK,cAAc,CAAC,OAAO,EAAE,CAAC;QACnD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { faro } from '@grafana/faro-core';\n\nexport const webStorageType = {\n session: 'sessionStorage',\n local: 'localStorage',\n} as const;\n\ntype StorageMechanism = (typeof webStorageType)[keyof typeof webStorageType];\n\n/**\n * Check if selected web storage mechanism is available.\n * @param type storage mechanism to test availability for.\n * @returns\n */\nexport function isWebStorageAvailable(type: StorageMechanism): boolean {\n try {\n let storage;\n storage = window[type];\n\n const testItem = '__faro_storage_test__';\n storage.setItem(testItem, testItem);\n storage.removeItem(testItem);\n return true;\n } catch (error) {\n // the above can throw\n faro.internalLogger?.info(`Web storage of type ${type} is not available. Reason: ${error}`);\n return false;\n }\n}\n\n/**\n * Get item from SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function getItem(key: string, webStorageMechanism: StorageMechanism): string | null {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n return window[webStorageMechanism].getItem(key);\n }\n\n return null;\n}\n\n/**\n * Store item in SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param value: the item data.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function setItem(key: string, value: string, webStorageMechanism: StorageMechanism): void {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n try {\n window[webStorageMechanism].setItem(key, value);\n } catch (error) {\n // do nothing\n }\n }\n}\n\n/**\n * Remove item from SessionStorage or LocalStorage.\n * @param key: the item key.\n * @param webStorageMechanism: wether the item shall be received form local storage or session storage. Defaults to local storage.\n */\nexport function removeItem(key: string, webStorageMechanism: StorageMechanism): void {\n if (isWebStorageTypeAvailable(webStorageMechanism)) {\n window[webStorageMechanism].removeItem(key);\n }\n}\n\nexport const isLocalStorageAvailable = isWebStorageAvailable(webStorageType.local);\nexport const isSessionStorageAvailable = isWebStorageAvailable(webStorageType.session);\n\nfunction isWebStorageTypeAvailable(webStorageMechanism: StorageMechanism) {\n if (webStorageMechanism === webStorageType.local) {\n return isLocalStorageAvailable;\n }\n\n if (webStorageMechanism === webStorageType.session) {\n return isSessionStorageAvailable;\n }\n\n return false;\n}\n"]}
@@ -7,8 +7,8 @@ export type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectio
7
7
  export { browserMeta, createSession, sdkMeta } from './metas';
8
8
  export { ConsoleTransport, FetchTransport } from './transports';
9
9
  export type { ClockFn, ConsoleTransportOptions, FetchTransportOptions, FetchTransportRequestOptions, } from './transports';
10
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, isEmpty, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, apiMessageBus, Observable, merge, USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE, } from '@grafana/faro-core';
10
+ export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, isEmpty, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, apiMessageBus, Observable, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, } from '@grafana/faro-core';
11
11
  export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, ApiMessageBusMessages, UserActionStartMessage, UserActionEndMessage, UserActionCancelMessage, UserAction, } from '@grafana/faro-core';
12
12
  export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session';
13
- export { getIgnoreUrls } from './utils/url';
14
- export { userActionDataAttribute } from './instrumentations/userActions/const';
13
+ export { getIgnoreUrls, getUrlFromResource } from './utils/url';
14
+ export { userActionDataAttribute, startUserAction } from './instrumentations/userActions';
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
3
3
  export declare class ConsoleInstrumentation extends BaseInstrumentation {
4
4
  private options;
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-console";
6
- readonly version = "1.14.3";
6
+ readonly version = "1.16.0";
7
7
  static defaultDisabledLevels: LogLevel[];
8
8
  static consoleErrorPrefix: string;
9
9
  private errorSerializer;
@@ -1,6 +1,6 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ErrorsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
4
- readonly version = "1.14.3";
4
+ readonly version = "1.16.0";
5
5
  initialize(): void;
6
6
  }
@@ -7,4 +7,4 @@ export { ViewInstrumentation } from './view';
7
7
  export { WebVitalsInstrumentation } from './webVitals';
8
8
  export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './session';
9
9
  export { PerformanceInstrumentation } from './performance';
10
- export { UserActionInstrumentation, userActionDataAttribute } from './userActions';
10
+ export { UserActionInstrumentation, userActionDataAttribute, startUserAction } from './userActions';
@@ -3,6 +3,6 @@ import type { ResourceEntryMessage } from './types';
3
3
  export declare const performanceEntriesSubscription: Observable<ResourceEntryMessage>;
4
4
  export declare class PerformanceInstrumentation extends BaseInstrumentation {
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-performance";
6
- readonly version = "1.14.3";
6
+ readonly version = "1.16.0";
7
7
  initialize(): void;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class SessionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-session";
4
- readonly version = "1.14.3";
4
+ readonly version = "1.16.0";
5
5
  private notifiedSession;
6
6
  private sendSessionStartEvent;
7
7
  private createInitialSession;
@@ -1,4 +1,4 @@
1
- import { Meta } from '@grafana/faro-core';
1
+ import type { Meta } from '@grafana/faro-core';
2
2
  import type { FaroUserSession } from './types';
3
3
  type CreateUserSessionObjectParams = {
4
4
  sessionId?: string;
@@ -1,7 +1,6 @@
1
1
  export declare const MESSAGE_TYPE_RESOURCE_ENTRY = "resource-entry";
2
2
  export declare const MESSAGE_TYPE_HTTP_REQUEST_START = "http-request-start";
3
3
  export declare const MESSAGE_TYPE_HTTP_REQUEST_END = "http-request-end";
4
- export declare const MESSAGE_TYPE_HTTP_REQUEST_PENDING = "http-request-pending";
5
4
  export declare const MESSAGE_TYPE_DOM_MUTATION = "dom-mutation";
6
5
  export declare const userActionDataAttributeParsed = "faroUserActionName";
7
6
  export declare const userActionDataAttribute = "data-faro-user-action-name";
@@ -1,5 +1,6 @@
1
1
  import { Observable } from '@grafana/faro-core';
2
+ import type { HttpRequestEndMessage, HttpRequestStartMessage } from './types';
2
3
  /**
3
4
  * Monitors if any http requests are in progress.
4
5
  */
5
- export declare function monitorHttpRequests(): Observable;
6
+ export declare function monitorHttpRequests(): Observable<HttpRequestStartMessage | HttpRequestEndMessage>;
@@ -1,3 +1,3 @@
1
- export { UserActionInstrumentation } from './instrumentation';
2
- export type { DomMutationMessage, HttpRequestEndMessage, HttpRequestStartMessage } from './types';
1
+ export { UserActionInstrumentation, startUserAction } from './instrumentation';
2
+ export type { DomMutationMessage, HttpRequestEndMessage, HttpRequestStartMessage, HttpRequestMessagePayload, } from './types';
3
3
  export { MESSAGE_TYPE_DOM_MUTATION, MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_TYPE_HTTP_REQUEST_START, userActionDataAttribute, } from './const';
@@ -1,6 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class UserActionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-user-action";
4
- readonly version = "1.14.3";
4
+ readonly version = "1.16.0";
5
5
  initialize(): void;
6
6
  }
7
+ export declare function startUserAction(name: string, attributes?: Record<string, string>): void;
@@ -1,2 +1,3 @@
1
- import { Faro } from '@grafana/faro-core';
2
- export declare function getUserEventHandler(faro: Faro): (event: PointerEvent | KeyboardEvent) => void;
1
+ import type { Faro } from '@grafana/faro-core';
2
+ import type { ApiEvent } from './types';
3
+ export declare function getUserEventHandler(faro: Faro): (event: PointerEvent | KeyboardEvent | ApiEvent) => void;
@@ -2,11 +2,24 @@ import type { MESSAGE_TYPE_DOM_MUTATION, MESSAGE_TYPE_HTTP_REQUEST_END, MESSAGE_
2
2
  export type DomMutationMessage = {
3
3
  type: typeof MESSAGE_TYPE_DOM_MUTATION;
4
4
  };
5
+ type RequestApiType = 'xhr' | 'fetch';
6
+ export type HttpRequestMessagePayload = {
7
+ requestId: string;
8
+ url: string;
9
+ method: string;
10
+ apiType: RequestApiType;
11
+ };
5
12
  export type HttpRequestStartMessage = {
6
13
  type: typeof MESSAGE_TYPE_HTTP_REQUEST_START;
7
- pending: number;
14
+ request: HttpRequestMessagePayload;
8
15
  };
9
16
  export type HttpRequestEndMessage = {
10
17
  type: typeof MESSAGE_TYPE_HTTP_REQUEST_END;
11
- pending: number;
18
+ request: HttpRequestMessagePayload;
19
+ };
20
+ export type ApiEvent = {
21
+ name: string;
22
+ attributes?: Record<string, string>;
23
+ type: 'apiEvent';
12
24
  };
25
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ViewInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-view";
4
- readonly version = "1.14.3";
4
+ readonly version = "1.16.0";
5
5
  private notifiedView;
6
6
  private sendViewChangedEvent;
7
7
  initialize(): void;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class WebVitalsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
4
- readonly version = "1.14.3";
4
+ readonly version = "1.16.0";
5
5
  initialize(): void;
6
6
  private intializeWebVitalsInstrumentation;
7
7
  }
@@ -1,17 +1,15 @@
1
- import type { MeasurementsAPI } from '@grafana/faro-core';
1
+ import type { Config, MeasurementsAPI } from '@grafana/faro-core';
2
2
  export declare class WebVitalsBasic {
3
3
  private pushMeasurement;
4
4
  private webVitalConfig?;
5
5
  static mapping: {
6
- cls: (onReport: (metric: import("web-vitals").CLSMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
7
- fcp: (onReport: (metric: import("web-vitals").FCPMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
8
- fid: (onReport: (metric: import("web-vitals").FIDMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
9
- inp: (onReport: (metric: import("web-vitals").INPMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
10
- lcp: (onReport: (metric: import("web-vitals").LCPMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
11
- ttfb: (onReport: (metric: import("web-vitals").TTFBMetric) => void, opts?: import("web-vitals").ReportOpts | undefined) => void;
6
+ cls: (onReport: (metric: import("web-vitals").CLSMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
7
+ fcp: (onReport: (metric: import("web-vitals").FCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
8
+ fid: (onReport: (metric: import("web-vitals").FIDMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
9
+ inp: (onReport: (metric: import("web-vitals").INPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
10
+ lcp: (onReport: (metric: import("web-vitals").LCPMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
11
+ ttfb: (onReport: (metric: import("web-vitals").TTFBMetric) => void, opts?: import("web-vitals").ReportOpts) => void;
12
12
  };
13
- constructor(pushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: {
14
- reportAllChanges?: boolean | undefined;
15
- } | undefined);
13
+ constructor(pushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: Config['webVitalsInstrumentation']);
16
14
  initialize(): void;
17
15
  }
@@ -1,10 +1,8 @@
1
- import type { MeasurementsAPI } from '@grafana/faro-core';
1
+ import type { Config, MeasurementsAPI } from '@grafana/faro-core';
2
2
  export declare class WebVitalsWithAttribution {
3
3
  private corePushMeasurement;
4
4
  private webVitalConfig?;
5
- constructor(corePushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: {
6
- reportAllChanges?: boolean | undefined;
7
- } | undefined);
5
+ constructor(corePushMeasurement: MeasurementsAPI['pushMeasurement'], webVitalConfig?: Config['webVitalsInstrumentation']);
8
6
  initialize(): void;
9
7
  private measureCLS;
10
8
  private measureFCP;
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
4
4
  export declare class ConsoleTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-console";
7
- readonly version = "1.14.3";
7
+ readonly version = "1.16.0";
8
8
  constructor(options?: ConsoleTransportOptions);
9
9
  send(item: TransportItem): void;
10
10
  }
@@ -1,10 +1,10 @@
1
- import { BaseTransport, PromiseBuffer } from '@grafana/faro-core';
2
- import type { Patterns, TransportItem } from '@grafana/faro-core';
1
+ import { BaseTransport } from '@grafana/faro-core';
2
+ import type { Patterns, PromiseBuffer, TransportItem } from '@grafana/faro-core';
3
3
  import type { FetchTransportOptions } from './types';
4
4
  export declare class FetchTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-fetch";
7
- readonly version = "1.14.3";
7
+ readonly version = "1.16.0";
8
8
  promiseBuffer: PromiseBuffer<Response | void>;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private readonly getNow;
@@ -1,3 +1,3 @@
1
1
  export { getItem, isLocalStorageAvailable, isSessionStorageAvailable, isWebStorageAvailable, removeItem, setItem, webStorageType, } from './webStorage';
2
2
  export { throttle } from './throttle';
3
- export { getIgnoreUrls } from './url';
3
+ export { getIgnoreUrls, getUrlFromResource } from './url';
@@ -12,3 +12,11 @@ export declare function getIgnoreUrls(): Patterns;
12
12
  * @returns `true` if the URL is in the list of ignored URLs, `false` otherwise.
13
13
  */
14
14
  export declare function isUrlIgnored(url?: string): boolean;
15
+ /**
16
+ * Extracts a URL string from the given resource.
17
+ *
18
+ * @param resource - The input resource which can be a string, a URL object, or an object with a `toString` method.
19
+ * @returns The URL as a string if the resource is a valid URL-like object, or `undefined` if the resource is not valid.
20
+ *
21
+ */
22
+ export declare function getUrlFromResource(resource: any): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-web-sdk",
3
- "version": "1.14.3",
3
+ "version": "1.16.0",
4
4
  "description": "Faro instrumentations, metas, transports for web.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -55,7 +55,7 @@
55
55
  "quality:circular-deps": "madge --circular ."
56
56
  },
57
57
  "dependencies": {
58
- "@grafana/faro-core": "^1.14.3",
58
+ "@grafana/faro-core": "^1.16.0",
59
59
  "ua-parser-js": "^1.0.32",
60
60
  "web-vitals": "^4.0.1"
61
61
  },
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "eaad1e4e4889aaa9a5a3539e169edc025d993ab0"
70
+ "gitHead": "4b902517e4f28c703ac3db1154209abe25e5216b"
71
71
  }