@dynamic-labs/wallet-book 4.0.0-alpha.8 → 4.0.0

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 (38) hide show
  1. package/CHANGELOG.md +496 -1
  2. package/README.md +1 -1
  3. package/package.cjs +1 -1
  4. package/package.js +1 -1
  5. package/package.json +5 -5
  6. package/src/build/sources/walletConnectOverrides/index.d.ts +16 -0
  7. package/src/components/WalletIcon.cjs +15 -7
  8. package/src/components/WalletIcon.d.ts +278 -3
  9. package/src/components/WalletIcon.js +17 -9
  10. package/src/helpers/getWalletBookWallet.d.ts +1 -1
  11. package/src/helpers/getWalletIconData.cjs +39 -0
  12. package/src/helpers/getWalletIconData.d.ts +5 -0
  13. package/src/helpers/getWalletIconData.js +35 -0
  14. package/src/helpers/index.d.ts +2 -4
  15. package/src/helpers/isWalletBookPopulated.cjs +8 -0
  16. package/src/helpers/isWalletBookPopulated.d.ts +2 -0
  17. package/src/helpers/isWalletBookPopulated.js +4 -0
  18. package/src/hooks/fetchWalletBook/fetchWalletBook.cjs +0 -1
  19. package/src/hooks/fetchWalletBook/fetchWalletBook.js +0 -1
  20. package/src/hooks/useWalletBookCdn.cjs +13 -0
  21. package/src/hooks/useWalletBookCdn.js +13 -0
  22. package/src/index.cjs +6 -10
  23. package/src/index.d.ts +1 -2
  24. package/src/index.js +3 -6
  25. package/wallet-book-fallbacks.cjs +152 -10
  26. package/wallet-book-fallbacks.js +152 -10
  27. package/src/helpers/getWalletLinks.cjs +0 -34
  28. package/src/helpers/getWalletLinks.d.ts +0 -10
  29. package/src/helpers/getWalletLinks.js +0 -30
  30. package/src/helpers/getWalletPrimaryColor.cjs +0 -14
  31. package/src/helpers/getWalletPrimaryColor.d.ts +0 -2
  32. package/src/helpers/getWalletPrimaryColor.js +0 -10
  33. package/src/helpers/isWalletEventSupported.cjs +0 -8
  34. package/src/helpers/isWalletEventSupported.d.ts +0 -2
  35. package/src/helpers/isWalletEventSupported.js +0 -4
  36. package/src/helpers/isWalletMethodSupported.cjs +0 -8
  37. package/src/helpers/isWalletMethodSupported.d.ts +0 -2
  38. package/src/helpers/isWalletMethodSupported.js +0 -4
@@ -1,8 +1,283 @@
1
- import React, { FC, ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  type WalletIconProps = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & {
3
+ icon?: string | undefined;
3
4
  walletKey: string | undefined;
4
- } & {
5
5
  children?: ReactNode | any;
6
+ isGroup?: boolean;
6
7
  };
7
- export declare const WalletIcon: FC<WalletIconProps>;
8
+ type WalletBookWalletIconProps = Omit<WalletIconProps, 'icon' | 'iconUrl'>;
9
+ export declare const WalletIcon: ({ icon, walletKey, isGroup, children, ...props }: WalletIconProps) => React.FunctionComponentElement<WalletBookWalletIconProps> | React.DetailedReactHTMLElement<{
10
+ alt: string | undefined;
11
+ src: string;
12
+ ref?: React.LegacyRef<HTMLImageElement> | undefined;
13
+ key?: React.Key | null | undefined;
14
+ crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
15
+ decoding?: "async" | "auto" | "sync" | undefined;
16
+ height?: string | number | undefined;
17
+ loading?: "eager" | "lazy" | undefined;
18
+ referrerPolicy?: React.HTMLAttributeReferrerPolicy | undefined;
19
+ sizes?: string | undefined;
20
+ srcSet?: string | undefined;
21
+ useMap?: string | undefined;
22
+ width?: string | number | undefined;
23
+ defaultChecked?: boolean | undefined;
24
+ defaultValue?: string | number | readonly string[] | undefined;
25
+ suppressContentEditableWarning?: boolean | undefined;
26
+ suppressHydrationWarning?: boolean | undefined;
27
+ accessKey?: string | undefined;
28
+ className?: string | undefined;
29
+ contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
30
+ contextMenu?: string | undefined;
31
+ dir?: string | undefined;
32
+ draggable?: (boolean | "true" | "false") | undefined;
33
+ hidden?: boolean | undefined;
34
+ id?: string | undefined;
35
+ lang?: string | undefined;
36
+ nonce?: string | undefined;
37
+ placeholder?: string | undefined;
38
+ slot?: string | undefined;
39
+ spellCheck?: (boolean | "true" | "false") | undefined;
40
+ style?: React.CSSProperties | undefined;
41
+ tabIndex?: number | undefined;
42
+ title?: string | undefined;
43
+ translate?: "yes" | "no" | undefined;
44
+ radioGroup?: string | undefined;
45
+ role?: React.AriaRole | undefined;
46
+ about?: string | undefined;
47
+ datatype?: string | undefined;
48
+ inlist?: any;
49
+ prefix?: string | undefined;
50
+ property?: string | undefined;
51
+ resource?: string | undefined;
52
+ typeof?: string | undefined;
53
+ vocab?: string | undefined;
54
+ autoCapitalize?: string | undefined;
55
+ autoCorrect?: string | undefined;
56
+ autoSave?: string | undefined;
57
+ color?: string | undefined;
58
+ itemProp?: string | undefined;
59
+ itemScope?: boolean | undefined;
60
+ itemType?: string | undefined;
61
+ itemID?: string | undefined;
62
+ itemRef?: string | undefined;
63
+ results?: number | undefined;
64
+ security?: string | undefined;
65
+ unselectable?: "on" | "off" | undefined;
66
+ inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
67
+ is?: string | undefined;
68
+ 'aria-activedescendant'?: string | undefined;
69
+ 'aria-atomic'?: (boolean | "true" | "false") | undefined;
70
+ 'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
71
+ 'aria-busy'?: (boolean | "true" | "false") | undefined;
72
+ 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
73
+ 'aria-colcount'?: number | undefined;
74
+ 'aria-colindex'?: number | undefined;
75
+ 'aria-colspan'?: number | undefined;
76
+ 'aria-controls'?: string | undefined;
77
+ 'aria-current'?: boolean | "true" | "false" | "time" | "date" | "page" | "step" | "location" | undefined;
78
+ 'aria-describedby'?: string | undefined;
79
+ 'aria-details'?: string | undefined;
80
+ 'aria-disabled'?: (boolean | "true" | "false") | undefined;
81
+ 'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
82
+ 'aria-errormessage'?: string | undefined;
83
+ 'aria-expanded'?: (boolean | "true" | "false") | undefined;
84
+ 'aria-flowto'?: string | undefined;
85
+ 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
86
+ 'aria-haspopup'?: boolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefined;
87
+ 'aria-hidden'?: (boolean | "true" | "false") | undefined;
88
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
89
+ 'aria-keyshortcuts'?: string | undefined;
90
+ 'aria-label'?: string | undefined;
91
+ 'aria-labelledby'?: string | undefined;
92
+ 'aria-level'?: number | undefined;
93
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
94
+ 'aria-modal'?: (boolean | "true" | "false") | undefined;
95
+ 'aria-multiline'?: (boolean | "true" | "false") | undefined;
96
+ 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
97
+ 'aria-orientation'?: "horizontal" | "vertical" | undefined;
98
+ 'aria-owns'?: string | undefined;
99
+ 'aria-placeholder'?: string | undefined;
100
+ 'aria-posinset'?: number | undefined;
101
+ 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
102
+ 'aria-readonly'?: (boolean | "true" | "false") | undefined;
103
+ 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
104
+ 'aria-required'?: (boolean | "true" | "false") | undefined;
105
+ 'aria-roledescription'?: string | undefined;
106
+ 'aria-rowcount'?: number | undefined;
107
+ 'aria-rowindex'?: number | undefined;
108
+ 'aria-rowspan'?: number | undefined;
109
+ 'aria-selected'?: (boolean | "true" | "false") | undefined;
110
+ 'aria-setsize'?: number | undefined;
111
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
112
+ 'aria-valuemax'?: number | undefined;
113
+ 'aria-valuemin'?: number | undefined;
114
+ 'aria-valuenow'?: number | undefined;
115
+ 'aria-valuetext'?: string | undefined;
116
+ dangerouslySetInnerHTML?: {
117
+ __html: string;
118
+ } | undefined;
119
+ onCopy?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
120
+ onCopyCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
121
+ onCut?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
122
+ onCutCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
123
+ onPaste?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
124
+ onPasteCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
125
+ onCompositionEnd?: React.CompositionEventHandler<HTMLImageElement> | undefined;
126
+ onCompositionEndCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
127
+ onCompositionStart?: React.CompositionEventHandler<HTMLImageElement> | undefined;
128
+ onCompositionStartCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
129
+ onCompositionUpdate?: React.CompositionEventHandler<HTMLImageElement> | undefined;
130
+ onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
131
+ onFocus?: React.FocusEventHandler<HTMLImageElement> | undefined;
132
+ onFocusCapture?: React.FocusEventHandler<HTMLImageElement> | undefined;
133
+ onBlur?: React.FocusEventHandler<HTMLImageElement> | undefined;
134
+ onBlurCapture?: React.FocusEventHandler<HTMLImageElement> | undefined;
135
+ onChange?: React.FormEventHandler<HTMLImageElement> | undefined;
136
+ onChangeCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
137
+ onBeforeInput?: React.FormEventHandler<HTMLImageElement> | undefined;
138
+ onBeforeInputCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
139
+ onInput?: React.FormEventHandler<HTMLImageElement> | undefined;
140
+ onInputCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
141
+ onReset?: React.FormEventHandler<HTMLImageElement> | undefined;
142
+ onResetCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
143
+ onSubmit?: React.FormEventHandler<HTMLImageElement> | undefined;
144
+ onSubmitCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
145
+ onInvalid?: React.FormEventHandler<HTMLImageElement> | undefined;
146
+ onInvalidCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
147
+ onLoad?: React.ReactEventHandler<HTMLImageElement> | undefined;
148
+ onLoadCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
149
+ onError?: React.ReactEventHandler<HTMLImageElement> | undefined;
150
+ onErrorCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
151
+ onKeyDown?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
152
+ onKeyDownCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
153
+ onKeyPress?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
154
+ onKeyPressCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
155
+ onKeyUp?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
156
+ onKeyUpCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
157
+ onAbort?: React.ReactEventHandler<HTMLImageElement> | undefined;
158
+ onAbortCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
159
+ onCanPlay?: React.ReactEventHandler<HTMLImageElement> | undefined;
160
+ onCanPlayCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
161
+ onCanPlayThrough?: React.ReactEventHandler<HTMLImageElement> | undefined;
162
+ onCanPlayThroughCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
163
+ onDurationChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
164
+ onDurationChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
165
+ onEmptied?: React.ReactEventHandler<HTMLImageElement> | undefined;
166
+ onEmptiedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
167
+ onEncrypted?: React.ReactEventHandler<HTMLImageElement> | undefined;
168
+ onEncryptedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
169
+ onEnded?: React.ReactEventHandler<HTMLImageElement> | undefined;
170
+ onEndedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
171
+ onLoadedData?: React.ReactEventHandler<HTMLImageElement> | undefined;
172
+ onLoadedDataCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
173
+ onLoadedMetadata?: React.ReactEventHandler<HTMLImageElement> | undefined;
174
+ onLoadedMetadataCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
175
+ onLoadStart?: React.ReactEventHandler<HTMLImageElement> | undefined;
176
+ onLoadStartCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
177
+ onPause?: React.ReactEventHandler<HTMLImageElement> | undefined;
178
+ onPauseCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
179
+ onPlay?: React.ReactEventHandler<HTMLImageElement> | undefined;
180
+ onPlayCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
181
+ onPlaying?: React.ReactEventHandler<HTMLImageElement> | undefined;
182
+ onPlayingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
183
+ onProgress?: React.ReactEventHandler<HTMLImageElement> | undefined;
184
+ onProgressCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
185
+ onRateChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
186
+ onRateChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
187
+ onResize?: React.ReactEventHandler<HTMLImageElement> | undefined;
188
+ onResizeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
189
+ onSeeked?: React.ReactEventHandler<HTMLImageElement> | undefined;
190
+ onSeekedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
191
+ onSeeking?: React.ReactEventHandler<HTMLImageElement> | undefined;
192
+ onSeekingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
193
+ onStalled?: React.ReactEventHandler<HTMLImageElement> | undefined;
194
+ onStalledCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
195
+ onSuspend?: React.ReactEventHandler<HTMLImageElement> | undefined;
196
+ onSuspendCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
197
+ onTimeUpdate?: React.ReactEventHandler<HTMLImageElement> | undefined;
198
+ onTimeUpdateCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
199
+ onVolumeChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
200
+ onVolumeChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
201
+ onWaiting?: React.ReactEventHandler<HTMLImageElement> | undefined;
202
+ onWaitingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
203
+ onAuxClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
204
+ onAuxClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
205
+ onClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
206
+ onClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
207
+ onContextMenu?: React.MouseEventHandler<HTMLImageElement> | undefined;
208
+ onContextMenuCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
209
+ onDoubleClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
210
+ onDoubleClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
211
+ onDrag?: React.DragEventHandler<HTMLImageElement> | undefined;
212
+ onDragCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
213
+ onDragEnd?: React.DragEventHandler<HTMLImageElement> | undefined;
214
+ onDragEndCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
215
+ onDragEnter?: React.DragEventHandler<HTMLImageElement> | undefined;
216
+ onDragEnterCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
217
+ onDragExit?: React.DragEventHandler<HTMLImageElement> | undefined;
218
+ onDragExitCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
219
+ onDragLeave?: React.DragEventHandler<HTMLImageElement> | undefined;
220
+ onDragLeaveCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
221
+ onDragOver?: React.DragEventHandler<HTMLImageElement> | undefined;
222
+ onDragOverCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
223
+ onDragStart?: React.DragEventHandler<HTMLImageElement> | undefined;
224
+ onDragStartCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
225
+ onDrop?: React.DragEventHandler<HTMLImageElement> | undefined;
226
+ onDropCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
227
+ onMouseDown?: React.MouseEventHandler<HTMLImageElement> | undefined;
228
+ onMouseDownCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
229
+ onMouseEnter?: React.MouseEventHandler<HTMLImageElement> | undefined;
230
+ onMouseLeave?: React.MouseEventHandler<HTMLImageElement> | undefined;
231
+ onMouseMove?: React.MouseEventHandler<HTMLImageElement> | undefined;
232
+ onMouseMoveCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
233
+ onMouseOut?: React.MouseEventHandler<HTMLImageElement> | undefined;
234
+ onMouseOutCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
235
+ onMouseOver?: React.MouseEventHandler<HTMLImageElement> | undefined;
236
+ onMouseOverCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
237
+ onMouseUp?: React.MouseEventHandler<HTMLImageElement> | undefined;
238
+ onMouseUpCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
239
+ onSelect?: React.ReactEventHandler<HTMLImageElement> | undefined;
240
+ onSelectCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
241
+ onTouchCancel?: React.TouchEventHandler<HTMLImageElement> | undefined;
242
+ onTouchCancelCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
243
+ onTouchEnd?: React.TouchEventHandler<HTMLImageElement> | undefined;
244
+ onTouchEndCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
245
+ onTouchMove?: React.TouchEventHandler<HTMLImageElement> | undefined;
246
+ onTouchMoveCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
247
+ onTouchStart?: React.TouchEventHandler<HTMLImageElement> | undefined;
248
+ onTouchStartCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
249
+ onPointerDown?: React.PointerEventHandler<HTMLImageElement> | undefined;
250
+ onPointerDownCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
251
+ onPointerMove?: React.PointerEventHandler<HTMLImageElement> | undefined;
252
+ onPointerMoveCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
253
+ onPointerUp?: React.PointerEventHandler<HTMLImageElement> | undefined;
254
+ onPointerUpCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
255
+ onPointerCancel?: React.PointerEventHandler<HTMLImageElement> | undefined;
256
+ onPointerCancelCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
257
+ onPointerEnter?: React.PointerEventHandler<HTMLImageElement> | undefined;
258
+ onPointerEnterCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
259
+ onPointerLeave?: React.PointerEventHandler<HTMLImageElement> | undefined;
260
+ onPointerLeaveCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
261
+ onPointerOver?: React.PointerEventHandler<HTMLImageElement> | undefined;
262
+ onPointerOverCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
263
+ onPointerOut?: React.PointerEventHandler<HTMLImageElement> | undefined;
264
+ onPointerOutCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
265
+ onGotPointerCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
266
+ onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
267
+ onLostPointerCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
268
+ onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
269
+ onScroll?: React.UIEventHandler<HTMLImageElement> | undefined;
270
+ onScrollCapture?: React.UIEventHandler<HTMLImageElement> | undefined;
271
+ onWheel?: React.WheelEventHandler<HTMLImageElement> | undefined;
272
+ onWheelCapture?: React.WheelEventHandler<HTMLImageElement> | undefined;
273
+ onAnimationStart?: React.AnimationEventHandler<HTMLImageElement> | undefined;
274
+ onAnimationStartCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
275
+ onAnimationEnd?: React.AnimationEventHandler<HTMLImageElement> | undefined;
276
+ onAnimationEndCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
277
+ onAnimationIteration?: React.AnimationEventHandler<HTMLImageElement> | undefined;
278
+ onAnimationIterationCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
279
+ onTransitionEnd?: React.TransitionEventHandler<HTMLImageElement> | undefined;
280
+ onTransitionEndCapture?: React.TransitionEventHandler<HTMLImageElement> | undefined;
281
+ 'data-testid': string;
282
+ }, HTMLImageElement>;
8
283
  export {};
@@ -1,26 +1,34 @@
1
1
  'use client'
2
2
  import { __rest } from '../../_virtual/_tslib.js';
3
- import { useState, createElement, Fragment } from 'react';
4
- import { getWalletIconUrl, getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
5
- import { findWalletBookWallet } from '../helpers/findWalletBookWallet.js';
3
+ import { createElement, useState, Fragment } from 'react';
4
+ import { getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
6
5
  import '../helpers/renderTemplate.js';
7
6
  import '../helpers/logger.js';
7
+ import { getWalletIconData } from '../helpers/getWalletIconData.js';
8
8
  import { useWalletBookContext } from '../context/WalletBookContext.js';
9
9
 
10
- const WalletIcon = (_a) => {
11
- var { walletKey, children } = _a, props = __rest(_a, ["walletKey", "children"]);
10
+ const WalletBookWalletIcon = (_a) => {
11
+ var { walletKey, isGroup, children } = _a, props = __rest(_a, ["walletKey", "isGroup", "children"]);
12
12
  const { walletBook } = useWalletBookContext();
13
- const walletData = findWalletBookWallet(walletBook, walletKey);
14
13
  const [imgError, setImgError] = useState(false);
15
- const walletIconUrl = getWalletIconUrl(walletBook, walletKey);
14
+ const { walletIconUrl, walletIconAlt } = getWalletIconData(walletBook, walletKey, isGroup);
16
15
  const defaultWalletIconUrl = getDefaultWalletIconUrl();
17
- if (!walletData || !walletData.brand || !walletIconUrl) {
16
+ if (!walletIconUrl) {
18
17
  return createElement(Fragment, {}, children);
19
18
  }
20
19
  const onError = () => {
21
20
  setImgError(true);
22
21
  };
23
- return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletData.brand.alt, onError: onError, src: imgError ? defaultWalletIconUrl : walletIconUrl }), children);
22
+ return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletIconAlt, onError: onError, src: imgError ? defaultWalletIconUrl : walletIconUrl }), children);
23
+ };
24
+ const WalletIcon = (_a) => {
25
+ var { icon, walletKey, isGroup, children } = _a, props = __rest(_a, ["icon", "walletKey", "isGroup", "children"]);
26
+ if (!icon) {
27
+ return createElement(WalletBookWalletIcon, Object.assign({ children,
28
+ isGroup,
29
+ walletKey }, props));
30
+ }
31
+ return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletKey, src: icon }), children);
24
32
  };
25
33
 
26
34
  export { WalletIcon };
@@ -1,2 +1,2 @@
1
1
  import { WalletBookSchema, WalletSchema } from '../schemas';
2
- export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined, walletFallback?: WalletSchema) => WalletSchema;
2
+ export declare const getWalletBookWallet: (walletBook: WalletBookSchema | undefined, walletKey: string | undefined, walletFallback?: WalletSchema) => WalletSchema;
@@ -0,0 +1,39 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var getWalletBookWallet = require('./getWalletBookWallet.cjs');
7
+ var getBrandIconUrl = require('./getBrandIconUrl.cjs');
8
+ var logger = require('./logger.cjs');
9
+ var findWalletGroup = require('./findWalletGroup.cjs');
10
+
11
+ const getWalletIconData = (walletBook, walletKey, isGroup) => {
12
+ if (!walletKey) {
13
+ return {
14
+ walletIconAlt: '',
15
+ walletIconUrl: '',
16
+ };
17
+ }
18
+ try {
19
+ const walletData = isGroup
20
+ ? findWalletGroup.findWalletGroup(walletBook, walletKey)
21
+ : getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
22
+ const iconData = walletData === null || walletData === void 0 ? void 0 : walletData.brand;
23
+ if (iconData) {
24
+ return {
25
+ walletIconAlt: iconData.alt,
26
+ walletIconUrl: getBrandIconUrl.getBrandIconUrl(iconData),
27
+ };
28
+ }
29
+ }
30
+ catch (err) {
31
+ logger.logger.error(err);
32
+ }
33
+ return {
34
+ walletIconAlt: '',
35
+ walletIconUrl: '',
36
+ };
37
+ };
38
+
39
+ exports.getWalletIconData = getWalletIconData;
@@ -0,0 +1,5 @@
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const getWalletIconData: (walletBook: WalletBookSchema, walletKey?: string, isGroup?: boolean) => {
3
+ walletIconAlt: string | undefined;
4
+ walletIconUrl: string | undefined;
5
+ };
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+ import { getWalletBookWallet } from './getWalletBookWallet.js';
3
+ import { getBrandIconUrl } from './getBrandIconUrl.js';
4
+ import { logger } from './logger.js';
5
+ import { findWalletGroup } from './findWalletGroup.js';
6
+
7
+ const getWalletIconData = (walletBook, walletKey, isGroup) => {
8
+ if (!walletKey) {
9
+ return {
10
+ walletIconAlt: '',
11
+ walletIconUrl: '',
12
+ };
13
+ }
14
+ try {
15
+ const walletData = isGroup
16
+ ? findWalletGroup(walletBook, walletKey)
17
+ : getWalletBookWallet(walletBook, walletKey);
18
+ const iconData = walletData === null || walletData === void 0 ? void 0 : walletData.brand;
19
+ if (iconData) {
20
+ return {
21
+ walletIconAlt: iconData.alt,
22
+ walletIconUrl: getBrandIconUrl(iconData),
23
+ };
24
+ }
25
+ }
26
+ catch (err) {
27
+ logger.error(err);
28
+ }
29
+ return {
30
+ walletIconAlt: '',
31
+ walletIconUrl: '',
32
+ };
33
+ };
34
+
35
+ export { getWalletIconData };
@@ -1,7 +1,5 @@
1
1
  export * from './getWalletIconUrl';
2
2
  export * from './getWalletBookWallet';
3
- export * from './getWalletLinks';
4
- export * from './getWalletPrimaryColor';
5
3
  export * from './renderTemplate';
6
4
  export * from './findWalletBookWallet';
7
5
  export * from './logger';
@@ -10,5 +8,5 @@ export * from './findWalletGroup';
10
8
  export * from './getWalletBookCdnUrl';
11
9
  export * from './getBrandIconUrl';
12
10
  export * from './findWalletGroupOverride';
13
- export * from './isWalletMethodSupported';
14
- export * from './isWalletEventSupported';
11
+ export * from './getWalletIconData';
12
+ export * from './isWalletBookPopulated';
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isWalletBookPopulated = (walletBook) => { var _a; return Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length > 0; };
7
+
8
+ exports.isWalletBookPopulated = isWalletBookPopulated;
@@ -0,0 +1,2 @@
1
+ import { WalletBookSchema } from '../schemas/walletBookSchema';
2
+ export declare const isWalletBookPopulated: (walletBook?: WalletBookSchema) => boolean;
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const isWalletBookPopulated = (walletBook) => { var _a; return Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length > 0; };
3
+
4
+ export { isWalletBookPopulated };
@@ -36,7 +36,6 @@ const fetchWalletBook = () => _tslib.__awaiter(void 0, void 0, void 0, function*
36
36
  });
37
37
  walletBookCache.current = yield utils.retryableFn(fn, {
38
38
  fallbackValue: walletBookSchema.walletBookSchema.parse(walletBookFallbacks["default"]),
39
- logger: logger.logger.createLogger('useWalletBookCdn'),
40
39
  maxRetries: 3,
41
40
  retryStrategy: 'timeout-and-rejection',
42
41
  timeoutMs: 30000,
@@ -28,7 +28,6 @@ const fetchWalletBook = () => __awaiter(void 0, void 0, void 0, function* () {
28
28
  });
29
29
  walletBookCache.current = yield retryableFn(fn, {
30
30
  fallbackValue: walletBookSchema.parse(walletBookFallbacks),
31
- logger: logger.createLogger('useWalletBookCdn'),
32
31
  maxRetries: 3,
33
32
  retryStrategy: 'timeout-and-rejection',
34
33
  timeoutMs: 30000,
@@ -12,6 +12,19 @@ const useWalletBookCdn = () => {
12
12
  const [walletBookState, setWalletBookState] = react.useState(fetchWalletBook.walletBookCache.current);
13
13
  react.useEffect(() => {
14
14
  fetchWalletBook.walletBookEmitter.on('walletBookLoaded', setWalletBookState);
15
+ /**
16
+ * Justification for this setWalletBookState call — imagine the following scenario:
17
+ *
18
+ * 1. fetchWalletBook() is called — the wallet book is not yet loaded
19
+ * 2. useState(walletBookCache.current) is called, and therefore initializes walletBookState to {}
20
+ * 3. Before this effect runs — wallet book is loaded, and the walletBookLoaded event is emitted
21
+ * 4. This effect finally runs and only then subscribes to the walletBookLoaded event
22
+ *
23
+ * In this case, walletBookState would be initialized to {}, and would never be updated to the actual wallet book
24
+ * Therefore, we need to call setWalletBookState(walletBookCache.current)
25
+ * to ensure that walletBookState is initialized to the correct value in this edge case
26
+ */
27
+ setWalletBookState(fetchWalletBook.walletBookCache.current);
15
28
  return () => {
16
29
  fetchWalletBook.walletBookEmitter.off('walletBookLoaded', setWalletBookState);
17
30
  };
@@ -8,6 +8,19 @@ const useWalletBookCdn = () => {
8
8
  const [walletBookState, setWalletBookState] = useState(walletBookCache.current);
9
9
  useEffect(() => {
10
10
  walletBookEmitter.on('walletBookLoaded', setWalletBookState);
11
+ /**
12
+ * Justification for this setWalletBookState call — imagine the following scenario:
13
+ *
14
+ * 1. fetchWalletBook() is called — the wallet book is not yet loaded
15
+ * 2. useState(walletBookCache.current) is called, and therefore initializes walletBookState to {}
16
+ * 3. Before this effect runs — wallet book is loaded, and the walletBookLoaded event is emitted
17
+ * 4. This effect finally runs and only then subscribes to the walletBookLoaded event
18
+ *
19
+ * In this case, walletBookState would be initialized to {}, and would never be updated to the actual wallet book
20
+ * Therefore, we need to call setWalletBookState(walletBookCache.current)
21
+ * to ensure that walletBookState is initialized to the correct value in this edge case
22
+ */
23
+ setWalletBookState(walletBookCache.current);
11
24
  return () => {
12
25
  walletBookEmitter.off('walletBookLoaded', setWalletBookState);
13
26
  };
package/src/index.cjs CHANGED
@@ -8,18 +8,15 @@ var _package = require('../package.cjs');
8
8
  var WalletBookContext = require('./context/WalletBookContext.cjs');
9
9
  var getWalletIconUrl = require('./helpers/getWalletIconUrl.cjs');
10
10
  var getWalletBookWallet = require('./helpers/getWalletBookWallet.cjs');
11
- var getWalletLinks = require('./helpers/getWalletLinks.cjs');
12
- var getWalletPrimaryColor = require('./helpers/getWalletPrimaryColor.cjs');
13
- require('./helpers/renderTemplate.cjs');
11
+ var renderTemplate = require('./helpers/renderTemplate.cjs');
14
12
  var findWalletBookWallet = require('./helpers/findWalletBookWallet.cjs');
15
- require('./helpers/logger.cjs');
13
+ var logger = require('./helpers/logger.cjs');
16
14
  var getWalletGroup = require('./helpers/getWalletGroup.cjs');
17
15
  var findWalletGroup = require('./helpers/findWalletGroup.cjs');
18
16
  var getWalletBookCdnUrl = require('./helpers/getWalletBookCdnUrl.cjs');
19
17
  var getBrandIconUrl = require('./helpers/getBrandIconUrl.cjs');
20
18
  var findWalletGroupOverride = require('./helpers/findWalletGroupOverride.cjs');
21
- var isWalletMethodSupported = require('./helpers/isWalletMethodSupported.cjs');
22
- var isWalletEventSupported = require('./helpers/isWalletEventSupported.cjs');
19
+ var isWalletBookPopulated = require('./helpers/isWalletBookPopulated.cjs');
23
20
  var useWalletBookCdn = require('./hooks/useWalletBookCdn.cjs');
24
21
  var WalletIcon = require('./components/WalletIcon.cjs');
25
22
  var WalletBookContextProvider = require('./components/WalletBookContextProvider.cjs');
@@ -30,16 +27,15 @@ assertPackageVersion.assertPackageVersion('@dynamic-labs/wallet-book', _package.
30
27
  exports.useWalletBookContext = WalletBookContext.useWalletBookContext;
31
28
  exports.getWalletIconUrl = getWalletIconUrl.getWalletIconUrl;
32
29
  exports.getWalletBookWallet = getWalletBookWallet.getWalletBookWallet;
33
- exports.getWalletLinks = getWalletLinks.getWalletLinks;
34
- exports.getWalletPrimaryColor = getWalletPrimaryColor.getWalletPrimaryColor;
30
+ exports.renderTemplate = renderTemplate.renderTemplate;
35
31
  exports.findWalletBookWallet = findWalletBookWallet.findWalletBookWallet;
32
+ exports.logger = logger.logger;
36
33
  exports.getWalletGroup = getWalletGroup.getWalletGroup;
37
34
  exports.findWalletGroup = findWalletGroup.findWalletGroup;
38
35
  exports.getWalletBookCdnUrl = getWalletBookCdnUrl.getWalletBookCdnUrl;
39
36
  exports.getBrandIconUrl = getBrandIconUrl.getBrandIconUrl;
40
37
  exports.findWalletGroupOverride = findWalletGroupOverride.findWalletGroupOverride;
41
- exports.isWalletMethodSupported = isWalletMethodSupported.isWalletMethodSupported;
42
- exports.isWalletEventSupported = isWalletEventSupported.isWalletEventSupported;
38
+ exports.isWalletBookPopulated = isWalletBookPopulated.isWalletBookPopulated;
43
39
  exports.useWalletBookCdn = useWalletBookCdn.useWalletBookCdn;
44
40
  exports.WalletIcon = WalletIcon.WalletIcon;
45
41
  exports.WalletBookContextProvider = WalletBookContextProvider.WalletBookContextProvider;
package/src/index.d.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  */
4
4
  export type { WalletBookSchema, WalletRecordsSchema, } from './schemas/walletBookSchema';
5
5
  export type { WalletSchema } from './schemas/walletSchema';
6
- export type { WalletLinks } from './helpers';
7
6
  /**
8
7
  * CONTEXT
9
8
  */
@@ -11,7 +10,7 @@ export { useWalletBookContext } from './context/WalletBookContext';
11
10
  /**
12
11
  * HELPERS
13
12
  */
14
- export { getWalletBookWallet, getWalletIconUrl, getWalletLinks, getWalletPrimaryColor, getWalletGroup, getWalletBookCdnUrl, findWalletBookWallet, findWalletGroup, getBrandIconUrl, findWalletGroupOverride, isWalletMethodSupported, isWalletEventSupported, } from './helpers';
13
+ export { getWalletBookWallet, getWalletIconUrl, getWalletGroup, getWalletBookCdnUrl, findWalletBookWallet, findWalletGroup, getBrandIconUrl, findWalletGroupOverride, renderTemplate, isWalletBookPopulated, logger, } from './helpers';
15
14
  /**
16
15
  * HOOKS
17
16
  */
package/src/index.js CHANGED
@@ -4,18 +4,15 @@ import { version } from '../package.js';
4
4
  export { useWalletBookContext } from './context/WalletBookContext.js';
5
5
  export { getWalletIconUrl } from './helpers/getWalletIconUrl.js';
6
6
  export { getWalletBookWallet } from './helpers/getWalletBookWallet.js';
7
- export { getWalletLinks } from './helpers/getWalletLinks.js';
8
- export { getWalletPrimaryColor } from './helpers/getWalletPrimaryColor.js';
9
- import './helpers/renderTemplate.js';
7
+ export { renderTemplate } from './helpers/renderTemplate.js';
10
8
  export { findWalletBookWallet } from './helpers/findWalletBookWallet.js';
11
- import './helpers/logger.js';
9
+ export { logger } from './helpers/logger.js';
12
10
  export { getWalletGroup } from './helpers/getWalletGroup.js';
13
11
  export { findWalletGroup } from './helpers/findWalletGroup.js';
14
12
  export { getWalletBookCdnUrl } from './helpers/getWalletBookCdnUrl.js';
15
13
  export { getBrandIconUrl } from './helpers/getBrandIconUrl.js';
16
14
  export { findWalletGroupOverride } from './helpers/findWalletGroupOverride.js';
17
- export { isWalletMethodSupported } from './helpers/isWalletMethodSupported.js';
18
- export { isWalletEventSupported } from './helpers/isWalletEventSupported.js';
15
+ export { isWalletBookPopulated } from './helpers/isWalletBookPopulated.js';
19
16
  export { useWalletBookCdn } from './hooks/useWalletBookCdn.js';
20
17
  export { WalletIcon } from './components/WalletIcon.js';
21
18
  export { WalletBookContextProvider } from './components/WalletBookContextProvider.js';