@fire-spark/analytics 0.14.0 → 0.15.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { StorefrontHttpError, storefrontJson } from "@fire-spark/core";
1
+ import { StorefrontHttpError, logError, storefrontJson } from "@fire-spark/core";
2
2
  //#region src/context.ts
3
3
  const SDK_VERSION = "0.0.1";
4
4
  const intlContext = () => {
@@ -842,6 +842,24 @@ const resolveAdapters = (opts) => {
842
842
  if (!opts?.exclude) return available;
843
843
  return available.filter((adapter) => !opts.exclude?.includes(adapter.provider));
844
844
  };
845
+ const reportDestinationError = (provider, name, error) => {
846
+ if (provider !== "masivo") return;
847
+ console.error("Masivo destination failed", {
848
+ event: name,
849
+ error
850
+ });
851
+ try {
852
+ const logged = logError(error, {
853
+ alias: "masivo.destination",
854
+ detail: name
855
+ });
856
+ Promise.resolve(logged).catch((logFailure) => {
857
+ console.error("Masivo destination error was not logged", logFailure);
858
+ });
859
+ } catch (logFailure) {
860
+ console.error("Masivo destination error was not logged", logFailure);
861
+ }
862
+ };
845
863
  const itemsOf = (params) => {
846
864
  if (!Array.isArray(params.items)) return void 0;
847
865
  return params.items.filter((row) => {
@@ -909,7 +927,9 @@ const fanoutAdapters = async (event, opts) => {
909
927
  consent,
910
928
  runtimeId
911
929
  ], currency, context);
912
- } catch {}
930
+ } catch (error) {
931
+ reportDestinationError(adapter.provider, event.name, error);
932
+ }
913
933
  };
914
934
  await Promise.all(adapters.map(send));
915
935
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fire-spark/analytics",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Fire Spark storefront analytics SDK",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -17,7 +17,7 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@fire-spark/core": "^0.14.0"
20
+ "@fire-spark/core": "^0.15.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsdown": "^0.22.14",