@dynamic-labs/wallet-book 0.19.0-alpha.7 → 0.19.0-alpha.8

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,28 @@
1
1
 
2
+ ## [0.19.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.7...v0.19.0-alpha.8) (2023-09-11)
3
+
4
+
5
+ ### Features
6
+
7
+ * add onSignedMessage callback ([#3118](https://github.com/dynamic-labs/DynamicAuth/issues/3118)) ([acc36f6](https://github.com/dynamic-labs/DynamicAuth/commit/acc36f6cf584eb05a019027475a6e2e413fd6bd5))
8
+ * add social sign-in without embedded wallet ([#3172](https://github.com/dynamic-labs/DynamicAuth/issues/3172)) ([ff1acc6](https://github.com/dynamic-labs/DynamicAuth/commit/ff1acc6d9753ba745ac01c5ef6d26f2e4291b752))
9
+ * show default wallet icon when image breaks ([#3234](https://github.com/dynamic-labs/DynamicAuth/issues/3234)) ([657e6bb](https://github.com/dynamic-labs/DynamicAuth/commit/657e6bbc1cdcd840562d25194a827ea833237c1a))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * catch error sending sdkSettings and log warning ([#3274](https://github.com/dynamic-labs/DynamicAuth/issues/3274)) ([fcbe01b](https://github.com/dynamic-labs/DynamicAuth/commit/fcbe01bc733a73f38aebd6ffb0969b040dd2f781))
15
+ * detect if oauth popup is blocked and throw error ([#3250](https://github.com/dynamic-labs/DynamicAuth/issues/3250)) ([b87ddf3](https://github.com/dynamic-labs/DynamicAuth/commit/b87ddf399104e29c56566abbbecab6ff947992d6))
16
+ * display error message to user if social account already exits ([#3258](https://github.com/dynamic-labs/DynamicAuth/issues/3258)) ([bb52cb4](https://github.com/dynamic-labs/DynamicAuth/commit/bb52cb4ae42d89310d435584ed4ece126f9b6a4a))
17
+ * don't call callbacks if window closed due to oauth process complete ([#3252](https://github.com/dynamic-labs/DynamicAuth/issues/3252)) ([09a3c73](https://github.com/dynamic-labs/DynamicAuth/commit/09a3c73446aa337f24e0875cd4a0af617ea8ca84))
18
+ * issue where unexpected token would occur when bundlers defined process.env ([#3283](https://github.com/dynamic-labs/DynamicAuth/issues/3283)) ([d31d0a4](https://github.com/dynamic-labs/DynamicAuth/commit/d31d0a4011256f59cb3760acdc2c3dfe6c5b504a))
19
+ * login view layout updates ([#3231](https://github.com/dynamic-labs/DynamicAuth/issues/3231)) ([7762d06](https://github.com/dynamic-labs/DynamicAuth/commit/7762d067bdd4b3f313a15308262f18dac0b961ab))
20
+ * **MagicWalletConnector:** remove async from getWeb3Provider method ([#3230](https://github.com/dynamic-labs/DynamicAuth/issues/3230)) ([69356e9](https://github.com/dynamic-labs/DynamicAuth/commit/69356e9b0bd1800acdf24fc96c72b094b595eaa7))
21
+ * remove react component props from sending to sdk api ([#3282](https://github.com/dynamic-labs/DynamicAuth/issues/3282)) ([b0d8f2b](https://github.com/dynamic-labs/DynamicAuth/commit/b0d8f2b9dd0856a5a7bd862f6c3499b65ec29f64))
22
+ * seprate ls checks for dynamiccontext and wagmi settings ([#3275](https://github.com/dynamic-labs/DynamicAuth/issues/3275)) ([aa4e756](https://github.com/dynamic-labs/DynamicAuth/commit/aa4e756a10310ce216b5942d0d6845f7092a89a2))
23
+ * use context to handle social sign-in and display message while processing ([#3216](https://github.com/dynamic-labs/DynamicAuth/issues/3216)) ([0e3ce73](https://github.com/dynamic-labs/DynamicAuth/commit/0e3ce73eafbb8d5725377c9a8cbd86a82d6c525f))
24
+ * **wallet-connect-v2:** use appropriate default chain id with WC v2 ([#3218](https://github.com/dynamic-labs/DynamicAuth/issues/3218)) ([2e6e7be](https://github.com/dynamic-labs/DynamicAuth/commit/2e6e7beb801ea5a8dc7429970bcd1e705610d605))
25
+
2
26
  ## [0.19.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.6...v0.19.0-alpha.7) (2023-08-31)
3
27
 
4
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wallet-book",
3
- "version": "0.19.0-alpha.7",
3
+ "version": "0.19.0-alpha.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "zod": "3.21.4",
29
- "@dynamic-labs/logger": "0.19.0-alpha.7"
29
+ "@dynamic-labs/logger": "0.19.0-alpha.8"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^17.0.2 || ^18.0.0",
@@ -74,6 +74,18 @@ export declare const applyOverrides: (sourceData: any, overrides?: {
74
74
  };
75
75
  };
76
76
  };
77
+ safe: {
78
+ mobile: {
79
+ native: {
80
+ action: string;
81
+ value: null;
82
+ };
83
+ universal: {
84
+ action: string;
85
+ value: null;
86
+ };
87
+ };
88
+ };
77
89
  safepal: {
78
90
  switchNetworkOnlyFromWallet: {
79
91
  action: string;
@@ -186,6 +198,18 @@ export declare const walletConnectOverrides: {
186
198
  };
187
199
  };
188
200
  };
201
+ safe: {
202
+ mobile: {
203
+ native: {
204
+ action: string;
205
+ value: null;
206
+ };
207
+ universal: {
208
+ action: string;
209
+ value: null;
210
+ };
211
+ };
212
+ };
189
213
  safepal: {
190
214
  switchNetworkOnlyFromWallet: {
191
215
  action: string;
@@ -11,18 +11,24 @@ require('../schemas/walletBookSchema.cjs');
11
11
  require('../schemas/walletSchema.cjs');
12
12
  var useWalletBookContext = require('../hooks/useWalletBookContext.cjs');
13
13
 
14
- const WalletIcon = ({ walletName, children, ...props }) => {
14
+ const WalletIcon = ({ walletKey, children, ...props }) => {
15
15
  const { walletBook } = useWalletBookContext.useWalletBookContext();
16
- const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletName);
17
- const walletIconUrl = getWalletIconUrl.getWalletIconUrl(walletBook, walletName);
16
+ const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletKey);
17
+ const [imgError, setImgError] = react.useState(false);
18
+ const walletIconUrl = getWalletIconUrl.getWalletIconUrl(walletBook, walletKey);
19
+ const defaultWalletIconUrl = getWalletIconUrl.getDefaultWalletIconUrl();
18
20
  if (!walletData || !walletData.brand || !walletIconUrl) {
19
21
  return react.createElement(react.Fragment, {}, children);
20
22
  }
23
+ const onError = () => {
24
+ setImgError(true);
25
+ };
21
26
  return react.createElement('img', {
22
- 'data-testid': `wallet-icon-${walletName}`,
27
+ 'data-testid': `wallet-icon-${walletKey}`,
23
28
  ...props,
24
29
  alt: walletData.brand.alt,
25
- src: walletIconUrl,
30
+ onError: onError,
31
+ src: imgError ? defaultWalletIconUrl : walletIconUrl,
26
32
  }, children);
27
33
  };
28
34
 
@@ -1,6 +1,6 @@
1
1
  import React, { FC, ReactNode } from 'react';
2
2
  type WalletIconProps = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & {
3
- walletName: string | undefined;
3
+ walletKey: string | undefined;
4
4
  } & {
5
5
  children?: ReactNode | any;
6
6
  };
@@ -1,5 +1,5 @@
1
- import { createElement, Fragment } from 'react';
2
- import { getWalletIconUrl } from '../helpers/getWalletIconUrl.js';
1
+ import { useState, createElement, Fragment } from 'react';
2
+ import { getWalletIconUrl, getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
3
3
  import { findWalletBookWallet } from '../helpers/findWalletBookWallet.js';
4
4
  import '../helpers/logger.js';
5
5
  import '../schemas/walletConnectSourceSchema.js';
@@ -7,18 +7,24 @@ import '../schemas/walletBookSchema.js';
7
7
  import '../schemas/walletSchema.js';
8
8
  import { useWalletBookContext } from '../hooks/useWalletBookContext.js';
9
9
 
10
- const WalletIcon = ({ walletName, children, ...props }) => {
10
+ const WalletIcon = ({ walletKey, children, ...props }) => {
11
11
  const { walletBook } = useWalletBookContext();
12
- const walletData = findWalletBookWallet(walletBook, walletName);
13
- const walletIconUrl = getWalletIconUrl(walletBook, walletName);
12
+ const walletData = findWalletBookWallet(walletBook, walletKey);
13
+ const [imgError, setImgError] = useState(false);
14
+ const walletIconUrl = getWalletIconUrl(walletBook, walletKey);
15
+ const defaultWalletIconUrl = getDefaultWalletIconUrl();
14
16
  if (!walletData || !walletData.brand || !walletIconUrl) {
15
17
  return createElement(Fragment, {}, children);
16
18
  }
19
+ const onError = () => {
20
+ setImgError(true);
21
+ };
17
22
  return createElement('img', {
18
- 'data-testid': `wallet-icon-${walletName}`,
23
+ 'data-testid': `wallet-icon-${walletKey}`,
19
24
  ...props,
20
25
  alt: walletData.brand.alt,
21
- src: walletIconUrl,
26
+ onError: onError,
27
+ src: imgError ? defaultWalletIconUrl : walletIconUrl,
22
28
  }, children);
23
29
  };
24
30
 
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
  var logger = require('./logger.cjs');
7
7
 
8
- const findWalletBookWallet = (walletBook, walletName) => {
8
+ const findWalletBookWallet = (walletBook, walletKey) => {
9
9
  try {
10
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletName);
10
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
11
11
  return walletData;
12
12
  }
13
13
  catch (err) {
@@ -1,5 +1,5 @@
1
1
  import { WalletBookSchema } from '../schemas';
2
- export declare const findWalletBookWallet: (walletBook: WalletBookSchema, walletName: string | undefined) => {
2
+ export declare const findWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined) => {
3
3
  name: string;
4
4
  brand?: {
5
5
  alt?: string | undefined;
@@ -1,9 +1,9 @@
1
1
  import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
  import { logger } from './logger.js';
3
3
 
4
- const findWalletBookWallet = (walletBook, walletName) => {
4
+ const findWalletBookWallet = (walletBook, walletKey) => {
5
5
  try {
6
- const walletData = getWalletBookWallet(walletBook, walletName);
6
+ const walletData = getWalletBookWallet(walletBook, walletKey);
7
7
  return walletData;
8
8
  }
9
9
  catch (err) {
@@ -2,9 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const getWalletBookCdnUrl = () => process.env['WALLET_BOOK_CDN_URL'] ??
6
- process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
7
- process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
8
- 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json';
5
+ /* eslint-disable arrow-body-style */
6
+ // This method needs to be wrapped correctly to avoid bundler issues
7
+ // that may update process.env variable via custom configs in customers apps
8
+ const getWalletBookCdnUrl = () => {
9
+ return (process.env['WALLET_BOOK_CDN_URL'] ??
10
+ process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
11
+ process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
12
+ 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
13
+ };
9
14
 
10
15
  exports.getWalletBookCdnUrl = getWalletBookCdnUrl;
@@ -1,6 +1,11 @@
1
- const getWalletBookCdnUrl = () => process.env['WALLET_BOOK_CDN_URL'] ??
2
- process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
3
- process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
4
- 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json';
1
+ /* eslint-disable arrow-body-style */
2
+ // This method needs to be wrapped correctly to avoid bundler issues
3
+ // that may update process.env variable via custom configs in customers apps
4
+ const getWalletBookCdnUrl = () => {
5
+ return (process.env['WALLET_BOOK_CDN_URL'] ??
6
+ process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
7
+ process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
8
+ 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
9
+ };
5
10
 
6
11
  export { getWalletBookCdnUrl };
@@ -6,9 +6,9 @@ var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
  var logger = require('./logger.cjs');
7
7
  var renderTemplate = require('./renderTemplate.cjs');
8
8
 
9
- const getWalletIconUrl = (walletBook, walletName) => {
9
+ const getWalletIconUrl = (walletBook, walletKey) => {
10
10
  try {
11
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletName);
11
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
12
12
  if (walletData?.brand?.spriteId) {
13
13
  return renderTemplate.renderTemplate('iconicUrl', walletData.brand.spriteId);
14
14
  }
@@ -20,6 +20,16 @@ const getWalletIconUrl = (walletBook, walletName) => {
20
20
  logger.logger.error(err);
21
21
  }
22
22
  return '';
23
+ };
24
+ const getDefaultWalletIconUrl = () => {
25
+ try {
26
+ return renderTemplate.renderTemplate('iconicUrl', 'defaultwallet');
27
+ }
28
+ catch (err) {
29
+ logger.logger.error(err);
30
+ }
31
+ return '';
23
32
  };
24
33
 
34
+ exports.getDefaultWalletIconUrl = getDefaultWalletIconUrl;
25
35
  exports.getWalletIconUrl = getWalletIconUrl;
@@ -1,2 +1,3 @@
1
1
  import { WalletBookSchema } from '../schemas';
2
- export declare const getWalletIconUrl: (walletBook: WalletBookSchema, walletName?: string) => string | undefined;
2
+ export declare const getWalletIconUrl: (walletBook: WalletBookSchema, walletKey?: string) => string | undefined;
3
+ export declare const getDefaultWalletIconUrl: () => string | undefined;
@@ -2,9 +2,9 @@ import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
  import { logger } from './logger.js';
3
3
  import { renderTemplate } from './renderTemplate.js';
4
4
 
5
- const getWalletIconUrl = (walletBook, walletName) => {
5
+ const getWalletIconUrl = (walletBook, walletKey) => {
6
6
  try {
7
- const walletData = getWalletBookWallet(walletBook, walletName);
7
+ const walletData = getWalletBookWallet(walletBook, walletKey);
8
8
  if (walletData?.brand?.spriteId) {
9
9
  return renderTemplate('iconicUrl', walletData.brand.spriteId);
10
10
  }
@@ -16,6 +16,15 @@ const getWalletIconUrl = (walletBook, walletName) => {
16
16
  logger.error(err);
17
17
  }
18
18
  return '';
19
+ };
20
+ const getDefaultWalletIconUrl = () => {
21
+ try {
22
+ return renderTemplate('iconicUrl', 'defaultwallet');
23
+ }
24
+ catch (err) {
25
+ logger.error(err);
26
+ }
27
+ return '';
19
28
  };
20
29
 
21
- export { getWalletIconUrl };
30
+ export { getDefaultWalletIconUrl, getWalletIconUrl };
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var findWalletBookWallet = require('./findWalletBookWallet.cjs');
6
6
  var renderTemplate = require('./renderTemplate.cjs');
7
7
 
8
- const getWalletLinks = (walletBook, walletName) => {
9
- const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletName);
8
+ const getWalletLinks = (walletBook, walletKey) => {
9
+ const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletKey);
10
10
  const links = {
11
11
  android: '',
12
12
  brave: '',
@@ -7,4 +7,4 @@ export type WalletLinks = {
7
7
  firefox: string;
8
8
  ios: string;
9
9
  };
10
- export declare const getWalletLinks: (walletBook: WalletBookSchema, walletName: string) => WalletLinks;
10
+ export declare const getWalletLinks: (walletBook: WalletBookSchema, walletKey: string) => WalletLinks;
@@ -1,8 +1,8 @@
1
1
  import { findWalletBookWallet } from './findWalletBookWallet.js';
2
2
  import { renderTemplate } from './renderTemplate.js';
3
3
 
4
- const getWalletLinks = (walletBook, walletName) => {
5
- const walletData = findWalletBookWallet(walletBook, walletName);
4
+ const getWalletLinks = (walletBook, walletKey) => {
5
+ const walletData = findWalletBookWallet(walletBook, walletKey);
6
6
  const links = {
7
7
  android: '',
8
8
  brave: '',
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
 
7
- const getWalletPrimaryColor = (walletBook, walletName) => {
8
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletName);
7
+ const getWalletPrimaryColor = (walletBook, walletKey) => {
8
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
9
9
  return walletData?.brand?.primaryColor;
10
10
  };
11
11
 
@@ -1,2 +1,2 @@
1
1
  import { WalletBookSchema } from '../schemas';
2
- export declare const getWalletPrimaryColor: (walletBook: WalletBookSchema, walletName: string) => string | undefined;
2
+ export declare const getWalletPrimaryColor: (walletBook: WalletBookSchema, walletKey: string) => string | undefined;
@@ -1,7 +1,7 @@
1
1
  import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
 
3
- const getWalletPrimaryColor = (walletBook, walletName) => {
4
- const walletData = getWalletBookWallet(walletBook, walletName);
3
+ const getWalletPrimaryColor = (walletBook, walletKey) => {
4
+ const walletData = getWalletBookWallet(walletBook, walletKey);
5
5
  return walletData?.brand?.primaryColor;
6
6
  };
7
7