@dynamic-labs/logger 3.0.0-alpha.13 → 3.0.0-alpha.15

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/CHANGELOG.md CHANGED
@@ -1,4 +1,50 @@
1
1
 
2
+ ## [3.0.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2024-07-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * catch third party wallet construction errors ([#6268](https://github.com/dynamic-labs/DynamicAuth/issues/6268)) ([badef39](https://github.com/dynamic-labs/DynamicAuth/commit/badef39d753c7d29925c6c8680053027bd99b69b))
8
+ * decode all solana transactions ([#6294](https://github.com/dynamic-labs/DynamicAuth/issues/6294)) ([5220ab2](https://github.com/dynamic-labs/DynamicAuth/commit/5220ab29381f3a7f1afc7043332b5a018b47eb0a))
9
+ * passkey cta ([#6255](https://github.com/dynamic-labs/DynamicAuth/issues/6255)) ([1b1b152](https://github.com/dynamic-labs/DynamicAuth/commit/1b1b152a24b409c5d941a9c92a003daf0bbe48a1))
10
+
11
+ ## [3.0.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.13...v3.0.0-alpha.14) (2024-07-09)
12
+
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ * remove setPrimaryWallet in favor of useSwitchWallet (#6212)
17
+ * move getBalance method to wallet so it can be fetched for any wallet not just the active one (#6200)
18
+ * make Wallet a class instead of just a type (#6094)
19
+
20
+ ### Features
21
+
22
+ * add @dynamic-labs/solana-extension ([#6140](https://github.com/dynamic-labs/DynamicAuth/issues/6140)) ([c0e2a06](https://github.com/dynamic-labs/DynamicAuth/commit/c0e2a067dd83163094b58a15696df8654da47c65))
23
+ * add solana support for multi-asset ([#6222](https://github.com/dynamic-labs/DynamicAuth/issues/6222)) ([9660d79](https://github.com/dynamic-labs/DynamicAuth/commit/9660d7962f1fb01011d68397bb367fdfc5335ca9))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * allow closing re-connect wallet modal ([#6250](https://github.com/dynamic-labs/DynamicAuth/issues/6250)) ([55ba25b](https://github.com/dynamic-labs/DynamicAuth/commit/55ba25bd3e907629aaa26e788885bfa38f8fe350))
29
+ * move getBalance method to wallet so it can be fetched for any wallet not just the active one ([#6200](https://github.com/dynamic-labs/DynamicAuth/issues/6200)) ([ee94773](https://github.com/dynamic-labs/DynamicAuth/commit/ee94773df9b31462a325666760fcf1fc70dec68a))
30
+ * move getNameService method to wallet so name service data can be fetched for any wallet ([#6205](https://github.com/dynamic-labs/DynamicAuth/issues/6205)) ([6671ae9](https://github.com/dynamic-labs/DynamicAuth/commit/6671ae92532ffc1889e24519e75f47d336ac0da6))
31
+ * relax phone number length validation ([#6226](https://github.com/dynamic-labs/DynamicAuth/issues/6226)) ([f0969b4](https://github.com/dynamic-labs/DynamicAuth/commit/f0969b4fbdafde07125cddecb16b4bfd011ea65e))
32
+ * sdkHasLoaded flipping back to false with otp ([#6242](https://github.com/dynamic-labs/DynamicAuth/issues/6242)) ([32ad9dd](https://github.com/dynamic-labs/DynamicAuth/commit/32ad9dd2dae7775f494506773fb343fe1a249c65))
33
+ * send transaction demo undefined address/value ([#6248](https://github.com/dynamic-labs/DynamicAuth/issues/6248)) ([036a511](https://github.com/dynamic-labs/DynamicAuth/commit/036a511fb848ef461edd9b7a5d79d478b0f1cf23))
34
+ * set last active account on accountChange request ([#6218](https://github.com/dynamic-labs/DynamicAuth/issues/6218)) ([05797d2](https://github.com/dynamic-labs/DynamicAuth/commit/05797d292aab8b4de02555594d4d1bbd4c9543eb))
35
+ * show ledger toggle when linking wallet ([#6202](https://github.com/dynamic-labs/DynamicAuth/issues/6202)) ([a449c0b](https://github.com/dynamic-labs/DynamicAuth/commit/a449c0bfc4e3a75ccd7084b930c48fbd6c14f691))
36
+ * show user wallet in profile view on single wallet mode even if it's not primary ([#6187](https://github.com/dynamic-labs/DynamicAuth/issues/6187)) ([ffaaeb2](https://github.com/dynamic-labs/DynamicAuth/commit/ffaaeb2c6cbb2868a381d85451ae5574024156bb))
37
+ * stop auto-switching to connected secondary wallet if primary wallet is not connected ([#6196](https://github.com/dynamic-labs/DynamicAuth/issues/6196)) ([4e8bcd2](https://github.com/dynamic-labs/DynamicAuth/commit/4e8bcd2d02d3fca54a0ed29c45b386ae99266b84))
38
+ * stop coinbase and solflare popups when secondary ([#6225](https://github.com/dynamic-labs/DynamicAuth/issues/6225)) ([7e9c104](https://github.com/dynamic-labs/DynamicAuth/commit/7e9c1049a09c9fd513c9a2a746d6baac916f1bf4))
39
+ * stop sending double sign request on network switch ([e325709](https://github.com/dynamic-labs/DynamicAuth/commit/e325709bb5d2d1331fe16cc705398fc7b1cc292a))
40
+ * tunrkey solana signer accept uint8array message ([#6137](https://github.com/dynamic-labs/DynamicAuth/issues/6137)) ([70f89ce](https://github.com/dynamic-labs/DynamicAuth/commit/70f89ce0dafa4c99b318c9c5adce59083cd6d284))
41
+ * update formatting of phantom bitcoin publickey ([#6210](https://github.com/dynamic-labs/DynamicAuth/issues/6210)) ([f58cea9](https://github.com/dynamic-labs/DynamicAuth/commit/f58cea99333fd7c6af8f56f637ee32f1f7ce8d76))
42
+ * use white color in farcaster qr code when in dark mode ([#6245](https://github.com/dynamic-labs/DynamicAuth/issues/6245)) ([a91958d](https://github.com/dynamic-labs/DynamicAuth/commit/a91958d8773be138da8f54791c4c67866257bbad))
43
+
44
+
45
+ * make Wallet a class instead of just a type ([#6094](https://github.com/dynamic-labs/DynamicAuth/issues/6094)) ([6dc4672](https://github.com/dynamic-labs/DynamicAuth/commit/6dc4672951cfadc22a6c569e74eae3485bd472f3))
46
+ * remove setPrimaryWallet in favor of useSwitchWallet ([#6212](https://github.com/dynamic-labs/DynamicAuth/issues/6212)) ([de125e1](https://github.com/dynamic-labs/DynamicAuth/commit/de125e1ebbc20507e4ec07f337f5f5fd13aabcbe))
47
+
2
48
  ## [3.0.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.12...v3.0.0-alpha.13) (2024-06-27)
3
49
 
4
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/logger",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
package/src/index.cjs CHANGED
@@ -100,11 +100,11 @@ class Logger {
100
100
  if (Logger.globalKeys.emitErrors &&
101
101
  !IGNORE_MESSAGES.includes(message === null || message === void 0 ? void 0 : message.toString()) &&
102
102
  typeof window !== 'undefined') {
103
- this.emitHttpLogs(level, message, ...args);
103
+ this.emitHttpLogs(level, message, { args });
104
104
  }
105
105
  });
106
106
  }
107
- emitHttpLogs(level, message, ...args) {
107
+ emitHttpLogs(level, message, { args = [], transformMeta = (meta) => meta }) {
108
108
  messageQueue.push({ args, level, message });
109
109
  if (messageQueue.length === 1) {
110
110
  /**
@@ -124,7 +124,7 @@ class Logger {
124
124
  Object.assign(body, {
125
125
  level: types.LogLevel[msg.level],
126
126
  message: [msg.message, ...remainingArgs].join(' '),
127
- meta: this.meta,
127
+ meta: transformMeta(this.meta),
128
128
  url: {
129
129
  hostname: (_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname,
130
130
  origin: (_b = window.location) === null || _b === void 0 ? void 0 : _b.origin,
@@ -156,6 +156,16 @@ class Logger {
156
156
  }));
157
157
  }
158
158
  }
159
+ /**
160
+ * Emits an INFO type message to the backend for analysis and debugging
161
+ */
162
+ instrument(message, ...args) {
163
+ return this.emitHttpLogs(types.LogLevel.INFO, message, {
164
+ args,
165
+ // Don't send entire user to avoid storing PII
166
+ transformMeta: (meta) => { var _a; return meta && { userId: (_a = meta['user']) === null || _a === void 0 ? void 0 : _a.userId }; },
167
+ });
168
+ }
159
169
  log(level, message, ...args) {
160
170
  const enableTroubleshootMode = typeof window !== 'undefined' &&
161
171
  (window === null || window === void 0 ? void 0 : window.dynamic_enableTroubleshootMode) === true;
package/src/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  import { LogLevel, Message } from './types';
3
3
  export { LogLevel } from './types';
4
+ type EmitHttpOptions = {
5
+ args?: any[];
6
+ transformMeta?: (meta: Record<string, any> | undefined) => Record<string, any> | undefined;
7
+ };
4
8
  export declare class Logger {
5
9
  private name;
6
10
  private level;
@@ -19,7 +23,11 @@ export declare class Logger {
19
23
  setLogLevel(level: LogLevel | keyof typeof LogLevel): void;
20
24
  private formatMessage;
21
25
  private captureAndSend;
22
- private emitHttpLogs;
26
+ emitHttpLogs(level: LogLevel, message: Message, { args, transformMeta }: EmitHttpOptions): void;
27
+ /**
28
+ * Emits an INFO type message to the backend for analysis and debugging
29
+ */
30
+ instrument(message: Message, ...args: NonNullable<EmitHttpOptions['args']>): void;
23
31
  log(level: LogLevel, message: Message, ...args: any[]): void;
24
32
  debug(message: Message, ...args: any[]): void;
25
33
  info(message: Message, ...args: any[]): void;
package/src/index.js CHANGED
@@ -93,11 +93,11 @@ class Logger {
93
93
  if (Logger.globalKeys.emitErrors &&
94
94
  !IGNORE_MESSAGES.includes(message === null || message === void 0 ? void 0 : message.toString()) &&
95
95
  typeof window !== 'undefined') {
96
- this.emitHttpLogs(level, message, ...args);
96
+ this.emitHttpLogs(level, message, { args });
97
97
  }
98
98
  });
99
99
  }
100
- emitHttpLogs(level, message, ...args) {
100
+ emitHttpLogs(level, message, { args = [], transformMeta = (meta) => meta }) {
101
101
  messageQueue.push({ args, level, message });
102
102
  if (messageQueue.length === 1) {
103
103
  /**
@@ -117,7 +117,7 @@ class Logger {
117
117
  Object.assign(body, {
118
118
  level: LogLevel[msg.level],
119
119
  message: [msg.message, ...remainingArgs].join(' '),
120
- meta: this.meta,
120
+ meta: transformMeta(this.meta),
121
121
  url: {
122
122
  hostname: (_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname,
123
123
  origin: (_b = window.location) === null || _b === void 0 ? void 0 : _b.origin,
@@ -149,6 +149,16 @@ class Logger {
149
149
  }));
150
150
  }
151
151
  }
152
+ /**
153
+ * Emits an INFO type message to the backend for analysis and debugging
154
+ */
155
+ instrument(message, ...args) {
156
+ return this.emitHttpLogs(LogLevel.INFO, message, {
157
+ args,
158
+ // Don't send entire user to avoid storing PII
159
+ transformMeta: (meta) => { var _a; return meta && { userId: (_a = meta['user']) === null || _a === void 0 ? void 0 : _a.userId }; },
160
+ });
161
+ }
152
162
  log(level, message, ...args) {
153
163
  const enableTroubleshootMode = typeof window !== 'undefined' &&
154
164
  (window === null || window === void 0 ? void 0 : window.dynamic_enableTroubleshootMode) === true;