@burdenoff/microfe-theglobalfuel 2026.705.5 → 2026.709.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,5 +3,7 @@ import { TheGlobalFuelProvider as t, useTheGlobalFuel as n } from "./theglobalfu
3
3
  import { cn as r } from "./theglobalfuel/utils/cn.js";
4
4
  import { formatCo2e as i, formatCoords as a, formatDate as o, formatDateTime as s, formatEnumLabel as c, formatMoney as l, formatNumber as u, formatPercent as d, formatQuantity as f, formatRelativeTime as p, formatTonnesCo2e as m, formatUnit as h, formatVolume as g, isExpired as _ } from "./theglobalfuel/utils/formatters.js";
5
5
  import { TheGlobalFuelRoot as v } from "./theglobalfuel/TheGlobalFuelRoot.js";
6
+ import { gatherPageContext as y } from "./theglobalfuel/utils/pageContext.js";
7
+ import { useSandboxAssistantTransport as b } from "./theglobalfuel/services/createSandboxAssistantTransport.js";
6
8
  import "./theglobalfuel/index.js";
7
- export { t as TheGlobalFuelProvider, v as TheGlobalFuelRoot, r as cn, i as formatCo2e, a as formatCoords, o as formatDate, s as formatDateTime, c as formatEnumLabel, l as formatMoney, u as formatNumber, d as formatPercent, f as formatQuantity, p as formatRelativeTime, m as formatTonnesCo2e, h as formatUnit, g as formatVolume, _ as isExpired, e as joinPath, n as useTheGlobalFuel };
9
+ export { t as TheGlobalFuelProvider, v as TheGlobalFuelRoot, r as cn, i as formatCo2e, a as formatCoords, o as formatDate, s as formatDateTime, c as formatEnumLabel, l as formatMoney, u as formatNumber, d as formatPercent, f as formatQuantity, p as formatRelativeTime, m as formatTonnesCo2e, h as formatUnit, g as formatVolume, y as gatherPageContext, _ as isExpired, e as joinPath, b as useSandboxAssistantTransport, n as useTheGlobalFuel };
@@ -4,3 +4,4 @@ import "./useNotify.js";
4
4
  import "./useTheFiles.js";
5
5
  import "./useTheComments.js";
6
6
  import "./useTheTags.js";
7
+ import "./useTheAnalytics.js";
@@ -0,0 +1,45 @@
1
+ import { useTheGlobalFuel as e } from "../context/TheGlobalFuelContext.js";
2
+ import "../context/index.js";
3
+ import { useCallback as t } from "react";
4
+ import { useEventBus as n } from "@burdenoff/fe-libs/shared/events";
5
+ //#region src/theglobalfuel/hooks/useTheAnalytics.ts
6
+ function r() {
7
+ let r = n(), { workspaceId: i } = e(), a = t((e, t = {}) => {
8
+ r.emitCustom(e, {
9
+ workspaceId: i,
10
+ ...t
11
+ });
12
+ }, [r, i]);
13
+ return {
14
+ emit: a,
15
+ workspaceId: i,
16
+ trackDashboardViewed: t(() => a("theglobalfuel.dashboard.viewed"), [a]),
17
+ trackAssetCreateClicked: t(() => a("theglobalfuel.asset.create_clicked"), [a]),
18
+ trackAssetCreated: t((e) => a("theglobalfuel.asset.created", { id: e }), [a]),
19
+ trackAssetUpdated: t((e) => a("theglobalfuel.asset.updated", { id: e }), [a]),
20
+ trackAssetDeleted: t((e) => a("theglobalfuel.asset.deleted", { id: e }), [a]),
21
+ trackProductionRecordClicked: t(() => a("theglobalfuel.production.record_clicked"), [a]),
22
+ trackProductionRecorded: t((e) => a("theglobalfuel.production.recorded", { id: e }), [a]),
23
+ trackReserveCreateClicked: t(() => a("theglobalfuel.reserve.create_clicked"), [a]),
24
+ trackReserveCreated: t((e) => a("theglobalfuel.reserve.created", { id: e }), [a]),
25
+ trackContractCreateClicked: t(() => a("theglobalfuel.contract.create_clicked"), [a]),
26
+ trackContractCreated: t((e) => a("theglobalfuel.contract.created", { id: e }), [a]),
27
+ trackContractUpdated: t((e) => a("theglobalfuel.contract.updated", { id: e }), [a]),
28
+ trackShipmentScheduleClicked: t(() => a("theglobalfuel.shipment.schedule_clicked"), [a]),
29
+ trackShipmentScheduled: t((e) => a("theglobalfuel.shipment.scheduled", { id: e }), [a]),
30
+ trackShipmentDelivered: t((e) => a("theglobalfuel.shipment.delivered", { id: e }), [a]),
31
+ trackInventoryLotCreateClicked: t(() => a("theglobalfuel.inventory_lot.create_clicked"), [a]),
32
+ trackInventoryLotCreated: t((e) => a("theglobalfuel.inventory_lot.created", { id: e }), [a]),
33
+ trackInventoryLotStatusSet: t((e) => a("theglobalfuel.inventory_lot.status_set", { id: e }), [a]),
34
+ trackEmissionRecordClicked: t(() => a("theglobalfuel.emission.record_clicked"), [a]),
35
+ trackEmissionRecorded: t((e) => a("theglobalfuel.emission.recorded", { id: e }), [a]),
36
+ trackEmissionVerified: t((e) => a("theglobalfuel.emission.verified", { id: e }), [a]),
37
+ trackComplianceCertCreateClicked: t(() => a("theglobalfuel.compliance_cert.create_clicked"), [a]),
38
+ trackComplianceCertCreated: t((e) => a("theglobalfuel.compliance_cert.created", { id: e }), [a]),
39
+ trackComplianceCertTransitioned: t((e) => a("theglobalfuel.compliance_cert.transitioned", { id: e }), [a])
40
+ };
41
+ }
42
+ //#endregion
43
+ export { r as useTheAnalytics };
44
+
45
+ //# sourceMappingURL=useTheAnalytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheAnalytics.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useTheAnalytics.ts"],"sourcesContent":["/**\n * TheGlobalFuel analytics helpers.\n * @module theglobalfuel/hooks\n *\n * Thin wrapper around the shared event bus. Emits intent + fact pairs for key\n * user actions so the app-shell RybbitSink can forward allow-listed events to\n * Rybbit Cloud. Payloads contain IDs only — no names, bodies or search queries.\n */\n\nimport { useCallback } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport { useTheGlobalFuel } from '../context';\n\nexport function useTheAnalytics() {\n const bus = useEventBus();\n const { workspaceId } = useTheGlobalFuel();\n\n const emit = useCallback(\n (name: string, payload: Record<string, unknown> = {}) => {\n // Use emitCustom for MFE-local domain events until they are merged into\n // the typed BurdenoffEventName union in fe-libs.\n bus.emitCustom(name, { workspaceId, ...payload });\n },\n [bus, workspaceId]\n );\n\n return {\n emit,\n workspaceId,\n trackDashboardViewed: useCallback(\n () => emit('theglobalfuel.dashboard.viewed'),\n [emit]\n ),\n trackAssetCreateClicked: useCallback(\n () => emit('theglobalfuel.asset.create_clicked'),\n [emit]\n ),\n trackAssetCreated: useCallback(\n (id: string) => emit('theglobalfuel.asset.created', { id }),\n [emit]\n ),\n trackAssetUpdated: useCallback(\n (id: string) => emit('theglobalfuel.asset.updated', { id }),\n [emit]\n ),\n trackAssetDeleted: useCallback(\n (id: string) => emit('theglobalfuel.asset.deleted', { id }),\n [emit]\n ),\n trackProductionRecordClicked: useCallback(\n () => emit('theglobalfuel.production.record_clicked'),\n [emit]\n ),\n trackProductionRecorded: useCallback(\n (id: string) => emit('theglobalfuel.production.recorded', { id }),\n [emit]\n ),\n trackReserveCreateClicked: useCallback(\n () => emit('theglobalfuel.reserve.create_clicked'),\n [emit]\n ),\n trackReserveCreated: useCallback(\n (id: string) => emit('theglobalfuel.reserve.created', { id }),\n [emit]\n ),\n trackContractCreateClicked: useCallback(\n () => emit('theglobalfuel.contract.create_clicked'),\n [emit]\n ),\n trackContractCreated: useCallback(\n (id: string) => emit('theglobalfuel.contract.created', { id }),\n [emit]\n ),\n trackContractUpdated: useCallback(\n (id: string) => emit('theglobalfuel.contract.updated', { id }),\n [emit]\n ),\n trackShipmentScheduleClicked: useCallback(\n () => emit('theglobalfuel.shipment.schedule_clicked'),\n [emit]\n ),\n trackShipmentScheduled: useCallback(\n (id: string) => emit('theglobalfuel.shipment.scheduled', { id }),\n [emit]\n ),\n trackShipmentDelivered: useCallback(\n (id: string) => emit('theglobalfuel.shipment.delivered', { id }),\n [emit]\n ),\n trackInventoryLotCreateClicked: useCallback(\n () => emit('theglobalfuel.inventory_lot.create_clicked'),\n [emit]\n ),\n trackInventoryLotCreated: useCallback(\n (id: string) => emit('theglobalfuel.inventory_lot.created', { id }),\n [emit]\n ),\n trackInventoryLotStatusSet: useCallback(\n (id: string) => emit('theglobalfuel.inventory_lot.status_set', { id }),\n [emit]\n ),\n trackEmissionRecordClicked: useCallback(\n () => emit('theglobalfuel.emission.record_clicked'),\n [emit]\n ),\n trackEmissionRecorded: useCallback(\n (id: string) => emit('theglobalfuel.emission.recorded', { id }),\n [emit]\n ),\n trackEmissionVerified: useCallback(\n (id: string) => emit('theglobalfuel.emission.verified', { id }),\n [emit]\n ),\n trackComplianceCertCreateClicked: useCallback(\n () => emit('theglobalfuel.compliance_cert.create_clicked'),\n [emit]\n ),\n trackComplianceCertCreated: useCallback(\n (id: string) => emit('theglobalfuel.compliance_cert.created', { id }),\n [emit]\n ),\n trackComplianceCertTransitioned: useCallback(\n (id: string) => emit('theglobalfuel.compliance_cert.transitioned', { id }),\n [emit]\n ),\n };\n}\n"],"mappings":";;;;;AAaA,SAAgB,IAAkB;CAChC,IAAM,IAAM,GAAa,EACnB,EAAE,mBAAgB,GAAkB,EAEpC,IAAO,GACV,GAAc,IAAmC,EAAE,KAAK;AAGvD,IAAI,WAAW,GAAM;GAAE;GAAa,GAAG;GAAS,CAAC;IAEnD,CAAC,GAAK,EAAY,CACnB;AAED,QAAO;EACL;EACA;EACA,sBAAsB,QACd,EAAK,iCAAiC,EAC5C,CAAC,EAAK,CACP;EACD,yBAAyB,QACjB,EAAK,qCAAqC,EAChD,CAAC,EAAK,CACP;EACD,mBAAmB,GAChB,MAAe,EAAK,+BAA+B,EAAE,OAAI,CAAC,EAC3D,CAAC,EAAK,CACP;EACD,mBAAmB,GAChB,MAAe,EAAK,+BAA+B,EAAE,OAAI,CAAC,EAC3D,CAAC,EAAK,CACP;EACD,mBAAmB,GAChB,MAAe,EAAK,+BAA+B,EAAE,OAAI,CAAC,EAC3D,CAAC,EAAK,CACP;EACD,8BAA8B,QACtB,EAAK,0CAA0C,EACrD,CAAC,EAAK,CACP;EACD,yBAAyB,GACtB,MAAe,EAAK,qCAAqC,EAAE,OAAI,CAAC,EACjE,CAAC,EAAK,CACP;EACD,2BAA2B,QACnB,EAAK,uCAAuC,EAClD,CAAC,EAAK,CACP;EACD,qBAAqB,GAClB,MAAe,EAAK,iCAAiC,EAAE,OAAI,CAAC,EAC7D,CAAC,EAAK,CACP;EACD,4BAA4B,QACpB,EAAK,wCAAwC,EACnD,CAAC,EAAK,CACP;EACD,sBAAsB,GACnB,MAAe,EAAK,kCAAkC,EAAE,OAAI,CAAC,EAC9D,CAAC,EAAK,CACP;EACD,sBAAsB,GACnB,MAAe,EAAK,kCAAkC,EAAE,OAAI,CAAC,EAC9D,CAAC,EAAK,CACP;EACD,8BAA8B,QACtB,EAAK,0CAA0C,EACrD,CAAC,EAAK,CACP;EACD,wBAAwB,GACrB,MAAe,EAAK,oCAAoC,EAAE,OAAI,CAAC,EAChE,CAAC,EAAK,CACP;EACD,wBAAwB,GACrB,MAAe,EAAK,oCAAoC,EAAE,OAAI,CAAC,EAChE,CAAC,EAAK,CACP;EACD,gCAAgC,QACxB,EAAK,6CAA6C,EACxD,CAAC,EAAK,CACP;EACD,0BAA0B,GACvB,MAAe,EAAK,uCAAuC,EAAE,OAAI,CAAC,EACnE,CAAC,EAAK,CACP;EACD,4BAA4B,GACzB,MAAe,EAAK,0CAA0C,EAAE,OAAI,CAAC,EACtE,CAAC,EAAK,CACP;EACD,4BAA4B,QACpB,EAAK,wCAAwC,EACnD,CAAC,EAAK,CACP;EACD,uBAAuB,GACpB,MAAe,EAAK,mCAAmC,EAAE,OAAI,CAAC,EAC/D,CAAC,EAAK,CACP;EACD,uBAAuB,GACpB,MAAe,EAAK,mCAAmC,EAAE,OAAI,CAAC,EAC/D,CAAC,EAAK,CACP;EACD,kCAAkC,QAC1B,EAAK,+CAA+C,EAC1D,CAAC,EAAK,CACP;EACD,4BAA4B,GACzB,MAAe,EAAK,yCAAyC,EAAE,OAAI,CAAC,EACrE,CAAC,EAAK,CACP;EACD,iCAAiC,GAC9B,MAAe,EAAK,8CAA8C,EAAE,OAAI,CAAC,EAC1E,CAAC,EAAK,CACP;EACF"}
@@ -4,3 +4,5 @@ import "./utils/cn.js";
4
4
  import "./utils/formatters.js";
5
5
  import "./context/index.js";
6
6
  import "./TheGlobalFuelRoot.js";
7
+ import "./utils/pageContext.js";
8
+ import "./services/createSandboxAssistantTransport.js";