@dynamic-labs/sdk-react-core 4.83.1 → 4.84.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 (39) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.cjs +4 -4
  3. package/package.js +4 -4
  4. package/package.json +15 -15
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +1 -0
  8. package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
  9. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -0
  10. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -0
  11. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +1 -0
  12. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +1 -0
  13. package/src/lib/data/api/aleo/getAleoCuratedPrices.d.ts +9 -0
  14. package/src/lib/main.global.cjs +1 -1
  15. package/src/lib/main.global.js +1 -1
  16. package/src/lib/styles/index.shadow.cjs +1 -1
  17. package/src/lib/styles/index.shadow.js +1 -1
  18. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/buildTokenKey.cjs +18 -0
  19. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/buildTokenKey.d.ts +18 -0
  20. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/buildTokenKey.js +14 -0
  21. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/index.d.ts +2 -0
  22. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/nativeTokenKey.cjs +15 -0
  23. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/nativeTokenKey.d.ts +8 -0
  24. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/nativeTokenKey.js +11 -0
  25. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/pollOnShielded.cjs +50 -0
  26. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/pollOnShielded.d.ts +12 -0
  27. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/pollOnShielded.js +45 -0
  28. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/useAleoAutoShieldSponsoredTokens.cjs +48 -41
  29. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/useAleoAutoShieldSponsoredTokens.d.ts +11 -0
  30. package/src/lib/utils/hooks/useAleoAutoShieldSponsoredTokens/useAleoAutoShieldSponsoredTokens.js +47 -40
  31. package/src/lib/utils/hooks/useAleoShieldedBalances/useAleoShieldedBalances.cjs +43 -29
  32. package/src/lib/utils/hooks/useAleoShieldedBalances/useAleoShieldedBalances.js +43 -29
  33. package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.cjs +8 -0
  34. package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.js +9 -1
  35. package/src/lib/utils/hooks/useWalletPassword/useWalletPassword.d.ts +4 -4
  36. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +45 -2
  37. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +46 -3
  38. package/src/lib/widgets/DynamicWidget/views/ManageTrustedDevicesView/ManageTrustedDevicesView.cjs +12 -8
  39. package/src/lib/widgets/DynamicWidget/views/ManageTrustedDevicesView/ManageTrustedDevicesView.js +8 -4
@@ -4,6 +4,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import { useState, useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { getRegisteredDevices, revokeRegisteredDevice, revokeAllRegisteredDevices } from '@dynamic-labs-sdk/client';
7
+ import { useDynamicClient } from '../../../../client/client.js';
7
8
  import { IconButton } from '../../../../components/IconButton/IconButton.js';
8
9
  import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
9
10
  import { Skeleton } from '../../../../components/Skeleton/Skeleton.js';
@@ -22,6 +23,7 @@ const ManageTrustedDevicesView = () => {
22
23
  var _a, _b;
23
24
  const { t } = useTranslation();
24
25
  const { setDynamicWidgetView } = useWidgetContext();
26
+ const dynamicClient = useDynamicClient();
25
27
  const [deviceIdToRemove, setDeviceIdToRemove] = useState(null);
26
28
  const [showRemoveAll, setShowRemoveAll] = useState(false);
27
29
  const { data: devices, isLoading, retrigger, } = usePromise(() => getRegisteredDevices(), {
@@ -33,13 +35,15 @@ const ManageTrustedDevicesView = () => {
33
35
  return;
34
36
  yield revokeRegisteredDevice({ deviceRegistrationId: deviceIdToRemove });
35
37
  setDeviceIdToRemove(null);
36
- retrigger();
37
- }), [deviceIdToRemove, retrigger]);
38
+ // Revoking the current device logs the user out; skip the refetch to avoid a 401.
39
+ if (dynamicClient.user)
40
+ retrigger();
41
+ }), [deviceIdToRemove, dynamicClient, retrigger]);
38
42
  const handleConfirmRemoveAll = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
39
43
  yield revokeAllRegisteredDevices();
40
44
  setShowRemoveAll(false);
41
- retrigger();
42
- }), [retrigger]);
45
+ // revokeAllRegisteredDevices always logs the user out; no refetch needed.
46
+ }), []);
43
47
  const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
44
48
  return (jsxs("div", { className: 'manage-trusted-devices-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_device_management.manage_title', children: t('dyn_device_management.manage_title') }) }) }), jsxs("div", { className: 'manage-trusted-devices-view__scroll-container', children: [isLoading && (jsx(Skeleton, { count: 3, className: 'manage-trusted-devices-view__skeleton', dataTestId: 'trusted-devices-skeleton' })), !isLoading && devices.length === 0 && (jsx(Typography, { className: 'manage-trusted-devices-view__no-devices', variant: 'body_normal', color: 'secondary', copykey: 'dyn_device_management.no_devices', children: t('dyn_device_management.no_devices') })), !isLoading &&
45
49
  devices.map((device) => device.userAgent ? (jsx(TrustedDeviceTile, { userAgent: device.userAgent, createdAt: device.createdAt, isCurrentDevice: device.isCurrentDevice, onClickDelete: () => setDeviceIdToRemove(device.id) }, device.id)) : null)] }), !isLoading && devices.length > 0 && (jsx("div", { className: 'manage-trusted-devices-view__footer', children: jsx(TextButton, { className: 'manage-trusted-devices-view__remove-all-button', onClick: () => setShowRemoveAll(true), "data-testid": 'remove-all-devices-button', children: t('dyn_device_management.remove_all_devices') }) })), deviceIdToRemove !== null && (jsx(RemoveDevicePrompt, { deviceUserAgent: (_b = (_a = devices.find((d) => d.id === deviceIdToRemove)) === null || _a === void 0 ? void 0 : _a.userAgent) !== null && _b !== void 0 ? _b : '', onConfirm: handleConfirmRemoveDevice, onCancel: () => setDeviceIdToRemove(null) })), showRemoveAll && (jsx(RemoveAllDevicesPrompt, { onConfirm: handleConfirmRemoveAll, onCancel: () => setShowRemoveAll(false) }))] }));