@reyaxyz/athena-logger 0.3.18 → 0.3.20

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.
@@ -18,11 +18,16 @@ var state_1 = require("./state");
18
18
  var action = function (params) {
19
19
  var action = params.action, message = params.message, payload = params.payload;
20
20
  var walletAddress = (0, state_1.getWalletAddress)();
21
+ var walletName = (0, state_1.getWalletName)();
21
22
  var chainId = (0, state_1.getChainId)();
22
23
  if (!walletAddress) {
23
24
  console.warn('Logger missing wallet address');
24
25
  return;
25
26
  }
27
+ if (!walletName) {
28
+ console.warn('Logger missing wallet name');
29
+ return;
30
+ }
26
31
  if (!chainId) {
27
32
  console.warn('Logger missing chainId');
28
33
  return;
@@ -37,17 +42,23 @@ var action = function (params) {
37
42
  }
38
43
  browser_logs_1.datadogLogs.logger.info("athena.user_journey/".concat(action).concat(message ? ": ".concat(message) : ''), __assign(__assign({}, payload), { user: {
39
44
  walletAddress: walletAddress,
45
+ walletName: walletName,
40
46
  chainId: chainId,
41
47
  } }));
42
48
  };
43
49
  var error = function (params) {
44
50
  var action = params.action, error = params.error, message = params.message, payload = params.payload;
45
51
  var walletAddress = (0, state_1.getWalletAddress)();
52
+ var walletName = (0, state_1.getWalletName)();
46
53
  var chainId = (0, state_1.getChainId)();
47
54
  if (!walletAddress) {
48
55
  console.warn('Logger missing wallet address');
49
56
  return;
50
57
  }
58
+ if (!walletName) {
59
+ console.warn('Logger missing wallet name');
60
+ return;
61
+ }
51
62
  if (!chainId) {
52
63
  console.warn('Logger missing chainId');
53
64
  return;
@@ -62,12 +73,17 @@ var error = function (params) {
62
73
  }
63
74
  browser_logs_1.datadogLogs.logger.error("athena.user_journey/".concat(action).concat(message ? ": ".concat(message) : ''), __assign(__assign({}, payload), { user: {
64
75
  walletAddress: walletAddress,
76
+ walletName: walletName,
65
77
  chainId: chainId,
66
78
  } }), error);
67
79
  };
68
80
  var start = function (params) {
69
- var address = params.address, chainId = params.chainId;
70
- (0, state_1.initialize)(address, chainId);
81
+ var address = params.address, chainId = params.chainId, walletName = params.walletName;
82
+ (0, state_1.initialize)({
83
+ walletAddress: address,
84
+ chainId: chainId,
85
+ walletName: walletName,
86
+ });
71
87
  if (!shared_1.allowLogging) {
72
88
  console.warn("Athena.UserJourney.start was called", params);
73
89
  return;
@@ -78,6 +94,7 @@ var start = function (params) {
78
94
  }
79
95
  action({
80
96
  action: 'wallet_connected',
97
+ payload: { walletAddress: address, chainId: chainId, walletName: walletName },
81
98
  });
82
99
  };
83
100
  var switchChain = function (chainId) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/user-journey/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAAoD;AACpD,uCAAiE;AACjE,iCAMiB;AAOjB,IAAM,MAAM,GAAG,UAAC,MAA+B;IACrC,IAAA,MAAM,GAAuB,MAAM,OAA7B,EAAE,OAAO,GAAc,MAAM,QAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC5C,IAAM,aAAa,GAAG,IAAA,wBAAgB,GAAE,CAAC;IACzC,IAAM,OAAO,GAAG,IAAA,kBAAU,GAAE,CAAC;IAE7B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,qBAAY,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAA,4BAAmB,GAAE,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,0BAAW,CAAC,MAAM,CAAC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AAC;AAEW,QAAA,WAAW,GAAG;IACzB,MAAM,QAAA;IACN,KAAK,OAAA;IACL,KAAK,OAAA;IACL,WAAW,aAAA;IACX,IAAI,MAAA;CACL,CAAC","sourcesContent":["import { datadogLogs } from '@datadog/browser-logs';\nimport { allowLogging, isLoggerInitialized } from '../../shared';\nimport {\n clear,\n getChainId,\n getWalletAddress,\n initialize,\n setChainId,\n} from './state';\nimport {\n UserJourneyActionParams,\n UserJourneyErrorParams,\n UserJourneyStartParams,\n} from './types';\n\nconst action = (params: UserJourneyActionParams) => {\n const { action, message, payload } = params;\n const walletAddress = getWalletAddress();\n const chainId = getChainId();\n\n if (!walletAddress) {\n console.warn('Logger missing wallet address');\n return;\n }\n\n if (!chainId) {\n console.warn('Logger missing chainId');\n return;\n }\n\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.action was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n datadogLogs.logger.info(\n `athena.user_journey/${action}${message ? `: ${message}` : ''}`,\n {\n ...payload,\n user: {\n walletAddress,\n chainId,\n },\n },\n );\n};\n\nconst error = (params: UserJourneyErrorParams) => {\n const { action, error, message, payload } = params;\n const walletAddress = getWalletAddress();\n const chainId = getChainId();\n\n if (!walletAddress) {\n console.warn('Logger missing wallet address');\n return;\n }\n\n if (!chainId) {\n console.warn('Logger missing chainId');\n return;\n }\n\n if (!allowLogging) {\n console.error(`Athena.UserJourney.error was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n datadogLogs.logger.error(\n `athena.user_journey/${action}${message ? `: ${message}` : ''}`,\n {\n ...payload,\n user: {\n walletAddress,\n chainId,\n },\n },\n error as Error,\n );\n};\n\nconst start = (params: UserJourneyStartParams) => {\n const { address, chainId } = params;\n initialize(address, chainId);\n\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.start was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n action({\n action: 'wallet_connected',\n });\n};\n\nconst switchChain = (chainId: number) => {\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.switchChain was called`, { chainId });\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n setChainId(chainId);\n action({\n action: `chain_changed`,\n });\n};\n\nconst stop = () => {\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.stop was called`);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n action({\n action: 'wallet_disconnected',\n });\n clear();\n};\n\nexport const userJourney = {\n action,\n error,\n start,\n switchChain,\n stop,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/user-journey/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAAoD;AACpD,uCAAiE;AACjE,iCAOiB;AAOjB,IAAM,MAAM,GAAG,UAAC,MAA+B;IACrC,IAAA,MAAM,GAAuB,MAAM,OAA7B,EAAE,OAAO,GAAc,MAAM,QAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC5C,IAAM,aAAa,GAAG,IAAA,wBAAgB,GAAE,CAAC;IACzC,IAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAC;IACnC,IAAM,OAAO,GAAG,IAAA,kBAAU,GAAE,CAAC;IAE7B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,qBAAY,EAAE,CAAC;QAClB,OAAO,CAAC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BAAmB,GAAE,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;IACpB,MAAM,CAAC;QACL,MAAM,EAAE,eAAe;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,IAAM,IAAI,GAAG;IACX,IAAI,CAAC,qBAAY,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAA,4BAAmB,GAAE,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,MAAM,CAAC;QACL,MAAM,EAAE,qBAAqB;KAC9B,CAAC,CAAC;IACH,IAAA,aAAK,GAAE,CAAC;AACV,CAAC,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,MAAM,QAAA;IACN,KAAK,OAAA;IACL,KAAK,OAAA;IACL,WAAW,aAAA;IACX,IAAI,MAAA;CACL,CAAC","sourcesContent":["import { datadogLogs } from '@datadog/browser-logs';\nimport { allowLogging, isLoggerInitialized } from '../../shared';\nimport {\n clear,\n getChainId,\n getWalletAddress,\n getWalletName,\n initialize,\n setChainId,\n} from './state';\nimport {\n UserJourneyActionParams,\n UserJourneyErrorParams,\n UserJourneyStartParams,\n} from './types';\n\nconst action = (params: UserJourneyActionParams) => {\n const { action, message, payload } = params;\n const walletAddress = getWalletAddress();\n const walletName = getWalletName();\n const chainId = getChainId();\n\n if (!walletAddress) {\n console.warn('Logger missing wallet address');\n return;\n }\n\n if (!walletName) {\n console.warn('Logger missing wallet name');\n return;\n }\n\n if (!chainId) {\n console.warn('Logger missing chainId');\n return;\n }\n\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.action was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n datadogLogs.logger.info(\n `athena.user_journey/${action}${message ? `: ${message}` : ''}`,\n {\n ...payload,\n user: {\n walletAddress,\n walletName,\n chainId,\n },\n },\n );\n};\n\nconst error = (params: UserJourneyErrorParams) => {\n const { action, error, message, payload } = params;\n const walletAddress = getWalletAddress();\n const walletName = getWalletName();\n const chainId = getChainId();\n\n if (!walletAddress) {\n console.warn('Logger missing wallet address');\n return;\n }\n\n if (!walletName) {\n console.warn('Logger missing wallet name');\n return;\n }\n\n if (!chainId) {\n console.warn('Logger missing chainId');\n return;\n }\n\n if (!allowLogging) {\n console.error(`Athena.UserJourney.error was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n datadogLogs.logger.error(\n `athena.user_journey/${action}${message ? `: ${message}` : ''}`,\n {\n ...payload,\n user: {\n walletAddress,\n walletName,\n chainId,\n },\n },\n error as Error,\n );\n};\n\nconst start = (params: UserJourneyStartParams) => {\n const { address, chainId, walletName } = params;\n initialize({\n walletAddress: address,\n chainId,\n walletName,\n });\n\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.start was called`, params);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n action({\n action: 'wallet_connected',\n payload: { walletAddress: address, chainId, walletName },\n });\n};\n\nconst switchChain = (chainId: number) => {\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.switchChain was called`, { chainId });\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n setChainId(chainId);\n action({\n action: `chain_changed`,\n });\n};\n\nconst stop = () => {\n if (!allowLogging) {\n console.warn(`Athena.UserJourney.stop was called`);\n return;\n }\n\n if (!isLoggerInitialized()) {\n console.warn('Logger not initialized');\n return;\n }\n\n action({\n action: 'wallet_disconnected',\n });\n clear();\n};\n\nexport const userJourney = {\n action,\n error,\n start,\n switchChain,\n stop,\n};\n"]}
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clear = exports.setChainId = exports.setWalletAddress = exports.getChainId = exports.getWalletAddress = exports.initialize = void 0;
3
+ exports.clear = exports.setChainId = exports.setWalletAddress = exports.getChainId = exports.getWalletName = exports.getWalletAddress = exports.initialize = void 0;
4
4
  var state = {
5
5
  walletAddress: null,
6
+ walletName: null,
6
7
  chainId: null,
7
8
  };
8
- var initialize = function (walletAddress, chainId) {
9
+ var initialize = function (_a) {
10
+ var walletAddress = _a.walletAddress, walletName = _a.walletName, chainId = _a.chainId;
9
11
  state.walletAddress = walletAddress;
10
12
  state.chainId = chainId;
13
+ state.walletName = walletName;
11
14
  };
12
15
  exports.initialize = initialize;
13
16
  var getWalletAddress = function () { return state.walletAddress; };
14
17
  exports.getWalletAddress = getWalletAddress;
18
+ var getWalletName = function () { return state.walletName; };
19
+ exports.getWalletName = getWalletName;
15
20
  var getChainId = function () { return state.chainId; };
16
21
  exports.getChainId = getChainId;
17
22
  var setWalletAddress = function (walletAddress) {
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"/","sources":["modules/user-journey/state.ts"],"names":[],"mappings":";;;AAKA,IAAM,KAAK,GAAqB;IAC9B,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,IAAM,UAAU,GAAG,UAAC,aAAqB,EAAE,OAAe;IACxD,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B,CAAC,CAAC;AAmBA,gCAAU;AAjBZ,IAAM,gBAAgB,GAAG,cAAM,OAAA,KAAK,CAAC,aAAa,EAAnB,CAAmB,CAAC;AAkBjD,4CAAgB;AAjBlB,IAAM,UAAU,GAAG,cAAM,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC;AAkBrC,gCAAU;AAhBZ,IAAM,gBAAgB,GAAG,UAAC,aAAqB;IAC7C,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;AACtC,CAAC,CAAC;AAeA,4CAAgB;AAblB,IAAM,UAAU,GAAG,UAAC,OAAe;IACjC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B,CAAC,CAAC;AAYA,gCAAU;AAVZ,IAAM,KAAK,GAAG;IACZ,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AAQA,sBAAK","sourcesContent":["type UserJourneyState = {\n walletAddress: string | null;\n chainId: number | null;\n};\n\nconst state: UserJourneyState = {\n walletAddress: null,\n chainId: null,\n};\n\nconst initialize = (walletAddress: string, chainId: number) => {\n state.walletAddress = walletAddress;\n state.chainId = chainId;\n};\n\nconst getWalletAddress = () => state.walletAddress;\nconst getChainId = () => state.chainId;\n\nconst setWalletAddress = (walletAddress: string) => {\n state.walletAddress = walletAddress;\n};\n\nconst setChainId = (chainId: number) => {\n state.chainId = chainId;\n};\n\nconst clear = () => {\n state.walletAddress = null;\n state.chainId = null;\n};\n\nexport {\n initialize,\n getWalletAddress,\n getChainId,\n setWalletAddress,\n setChainId,\n clear,\n};\n"]}
1
+ {"version":3,"file":"state.js","sourceRoot":"/","sources":["modules/user-journey/state.ts"],"names":[],"mappings":";;;AAMA,IAAM,KAAK,GAAqB;IAC9B,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,IAAM,UAAU,GAAG,UAAC,EAQnB;QAPC,aAAa,mBAAA,EACb,UAAU,gBAAA,EACV,OAAO,aAAA;IAMP,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAChC,CAAC,CAAC;AAoBA,gCAAU;AAlBZ,IAAM,gBAAgB,GAAG,cAAM,OAAA,KAAK,CAAC,aAAa,EAAnB,CAAmB,CAAC;AAmBjD,4CAAgB;AAlBlB,IAAM,aAAa,GAAG,cAAM,OAAA,KAAK,CAAC,UAAU,EAAhB,CAAgB,CAAC;AAmB3C,sCAAa;AAlBf,IAAM,UAAU,GAAG,cAAM,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC;AAmBrC,gCAAU;AAjBZ,IAAM,gBAAgB,GAAG,UAAC,aAAqB;IAC7C,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;AACtC,CAAC,CAAC;AAgBA,4CAAgB;AAdlB,IAAM,UAAU,GAAG,UAAC,OAAe;IACjC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B,CAAC,CAAC;AAaA,gCAAU;AAXZ,IAAM,KAAK,GAAG;IACZ,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AASA,sBAAK","sourcesContent":["type UserJourneyState = {\n walletAddress: string | null;\n walletName: string | null;\n chainId: number | null;\n};\n\nconst state: UserJourneyState = {\n walletAddress: null,\n walletName: null,\n chainId: null,\n};\n\nconst initialize = ({\n walletAddress,\n walletName,\n chainId,\n}: {\n walletAddress: string;\n walletName: string;\n chainId: number;\n}) => {\n state.walletAddress = walletAddress;\n state.chainId = chainId;\n state.walletName = walletName;\n};\n\nconst getWalletAddress = () => state.walletAddress;\nconst getWalletName = () => state.walletName;\nconst getChainId = () => state.chainId;\n\nconst setWalletAddress = (walletAddress: string) => {\n state.walletAddress = walletAddress;\n};\n\nconst setChainId = (chainId: number) => {\n state.chainId = chainId;\n};\n\nconst clear = () => {\n state.walletAddress = null;\n state.chainId = null;\n};\n\nexport {\n initialize,\n getWalletAddress,\n getWalletName,\n getChainId,\n setWalletAddress,\n setChainId,\n clear,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/user-journey/types.ts"],"names":[],"mappings":"","sourcesContent":["export type UserJourneyActionParams = {\n action: string;\n message?: string;\n payload?: Record<string, unknown>;\n};\n\nexport type UserJourneyErrorParams = {\n action: string;\n error: Error | unknown;\n message?: string;\n payload?: Record<string, unknown>;\n};\n\nexport type UserJourneyStartParams = {\n address: string;\n chainId: number;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/user-journey/types.ts"],"names":[],"mappings":"","sourcesContent":["export type UserJourneyActionParams = {\n action: string;\n message?: string;\n payload?: Record<string, unknown>;\n};\n\nexport type UserJourneyErrorParams = {\n action: string;\n error: Error | unknown;\n message?: string;\n payload?: Record<string, unknown>;\n};\n\nexport type UserJourneyStartParams = {\n address: string;\n walletName: string;\n chainId: number;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/user-journey/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAkIjB,eAAO,MAAM,WAAW;qBAhIA,uBAAuB;oBAqCxB,sBAAsB;oBAsCtB,sBAAsB;2BAmBf,MAAM;;CAwCnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/user-journey/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAqJjB,eAAO,MAAM,WAAW;qBAnJA,uBAAuB;oBA4CxB,sBAAsB;oBA6CtB,sBAAsB;2BAwBf,MAAM;;CAwCnC,CAAC"}
@@ -1,8 +1,13 @@
1
- declare const initialize: (walletAddress: string, chainId: number) => void;
1
+ declare const initialize: ({ walletAddress, walletName, chainId, }: {
2
+ walletAddress: string;
3
+ walletName: string;
4
+ chainId: number;
5
+ }) => void;
2
6
  declare const getWalletAddress: () => string | null;
7
+ declare const getWalletName: () => string | null;
3
8
  declare const getChainId: () => number | null;
4
9
  declare const setWalletAddress: (walletAddress: string) => void;
5
10
  declare const setChainId: (chainId: number) => void;
6
11
  declare const clear: () => void;
7
- export { initialize, getWalletAddress, getChainId, setWalletAddress, setChainId, clear, };
12
+ export { initialize, getWalletAddress, getWalletName, getChainId, setWalletAddress, setChainId, clear, };
8
13
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"/","sources":["modules/user-journey/state.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,UAAU,kBAAmB,MAAM,WAAW,MAAM,SAGzD,CAAC;AAEF,QAAA,MAAM,gBAAgB,qBAA4B,CAAC;AACnD,QAAA,MAAM,UAAU,qBAAsB,CAAC;AAEvC,QAAA,MAAM,gBAAgB,kBAAmB,MAAM,SAE9C,CAAC;AAEF,QAAA,MAAM,UAAU,YAAa,MAAM,SAElC,CAAC;AAEF,QAAA,MAAM,KAAK,YAGV,CAAC;AAEF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,KAAK,GACN,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"/","sources":["modules/user-journey/state.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,UAAU;mBAKC,MAAM;gBACT,MAAM;aACT,MAAM;UAKhB,CAAC;AAEF,QAAA,MAAM,gBAAgB,qBAA4B,CAAC;AACnD,QAAA,MAAM,aAAa,qBAAyB,CAAC;AAC7C,QAAA,MAAM,UAAU,qBAAsB,CAAC;AAEvC,QAAA,MAAM,gBAAgB,kBAAmB,MAAM,SAE9C,CAAC;AAEF,QAAA,MAAM,UAAU,YAAa,MAAM,SAElC,CAAC;AAEF,QAAA,MAAM,KAAK,YAGV,CAAC;AAEF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,KAAK,GACN,CAAC"}
@@ -11,6 +11,7 @@ export type UserJourneyErrorParams = {
11
11
  };
12
12
  export type UserJourneyStartParams = {
13
13
  address: string;
14
+ walletName: string;
14
15
  chainId: number;
15
16
  };
16
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/user-journey/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/user-journey/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/athena-logger",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,7 +33,7 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.128.2"
36
+ "@reyaxyz/common": "0.129.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@datadog/browser-logs": "5.17.1",
@@ -43,5 +43,5 @@
43
43
  "@datadog/browser-logs": "5.17.1"
44
44
  },
45
45
  "packageManager": "pnpm@8.3.1",
46
- "gitHead": "10f0514b6fcddfa4c032c1fc6937f551353a06ed"
46
+ "gitHead": "6c11e8f65bb519d2cbb4d7e0abfb0da3183fd15d"
47
47
  }
@@ -4,6 +4,7 @@ import {
4
4
  clear,
5
5
  getChainId,
6
6
  getWalletAddress,
7
+ getWalletName,
7
8
  initialize,
8
9
  setChainId,
9
10
  } from './state';
@@ -16,6 +17,7 @@ import {
16
17
  const action = (params: UserJourneyActionParams) => {
17
18
  const { action, message, payload } = params;
18
19
  const walletAddress = getWalletAddress();
20
+ const walletName = getWalletName();
19
21
  const chainId = getChainId();
20
22
 
21
23
  if (!walletAddress) {
@@ -23,6 +25,11 @@ const action = (params: UserJourneyActionParams) => {
23
25
  return;
24
26
  }
25
27
 
28
+ if (!walletName) {
29
+ console.warn('Logger missing wallet name');
30
+ return;
31
+ }
32
+
26
33
  if (!chainId) {
27
34
  console.warn('Logger missing chainId');
28
35
  return;
@@ -44,6 +51,7 @@ const action = (params: UserJourneyActionParams) => {
44
51
  ...payload,
45
52
  user: {
46
53
  walletAddress,
54
+ walletName,
47
55
  chainId,
48
56
  },
49
57
  },
@@ -53,6 +61,7 @@ const action = (params: UserJourneyActionParams) => {
53
61
  const error = (params: UserJourneyErrorParams) => {
54
62
  const { action, error, message, payload } = params;
55
63
  const walletAddress = getWalletAddress();
64
+ const walletName = getWalletName();
56
65
  const chainId = getChainId();
57
66
 
58
67
  if (!walletAddress) {
@@ -60,6 +69,11 @@ const error = (params: UserJourneyErrorParams) => {
60
69
  return;
61
70
  }
62
71
 
72
+ if (!walletName) {
73
+ console.warn('Logger missing wallet name');
74
+ return;
75
+ }
76
+
63
77
  if (!chainId) {
64
78
  console.warn('Logger missing chainId');
65
79
  return;
@@ -81,6 +95,7 @@ const error = (params: UserJourneyErrorParams) => {
81
95
  ...payload,
82
96
  user: {
83
97
  walletAddress,
98
+ walletName,
84
99
  chainId,
85
100
  },
86
101
  },
@@ -89,8 +104,12 @@ const error = (params: UserJourneyErrorParams) => {
89
104
  };
90
105
 
91
106
  const start = (params: UserJourneyStartParams) => {
92
- const { address, chainId } = params;
93
- initialize(address, chainId);
107
+ const { address, chainId, walletName } = params;
108
+ initialize({
109
+ walletAddress: address,
110
+ chainId,
111
+ walletName,
112
+ });
94
113
 
95
114
  if (!allowLogging) {
96
115
  console.warn(`Athena.UserJourney.start was called`, params);
@@ -104,6 +123,7 @@ const start = (params: UserJourneyStartParams) => {
104
123
 
105
124
  action({
106
125
  action: 'wallet_connected',
126
+ payload: { walletAddress: address, chainId, walletName },
107
127
  });
108
128
  };
109
129
 
@@ -1,19 +1,31 @@
1
1
  type UserJourneyState = {
2
2
  walletAddress: string | null;
3
+ walletName: string | null;
3
4
  chainId: number | null;
4
5
  };
5
6
 
6
7
  const state: UserJourneyState = {
7
8
  walletAddress: null,
9
+ walletName: null,
8
10
  chainId: null,
9
11
  };
10
12
 
11
- const initialize = (walletAddress: string, chainId: number) => {
13
+ const initialize = ({
14
+ walletAddress,
15
+ walletName,
16
+ chainId,
17
+ }: {
18
+ walletAddress: string;
19
+ walletName: string;
20
+ chainId: number;
21
+ }) => {
12
22
  state.walletAddress = walletAddress;
13
23
  state.chainId = chainId;
24
+ state.walletName = walletName;
14
25
  };
15
26
 
16
27
  const getWalletAddress = () => state.walletAddress;
28
+ const getWalletName = () => state.walletName;
17
29
  const getChainId = () => state.chainId;
18
30
 
19
31
  const setWalletAddress = (walletAddress: string) => {
@@ -32,6 +44,7 @@ const clear = () => {
32
44
  export {
33
45
  initialize,
34
46
  getWalletAddress,
47
+ getWalletName,
35
48
  getChainId,
36
49
  setWalletAddress,
37
50
  setChainId,
@@ -13,5 +13,6 @@ export type UserJourneyErrorParams = {
13
13
 
14
14
  export type UserJourneyStartParams = {
15
15
  address: string;
16
+ walletName: string;
16
17
  chainId: number;
17
18
  };