@dynamic-labs/sdk-react-core 4.5.3 → 4.6.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 (49) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  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/context/DynamicContext/DynamicContext.cjs +3 -1
  9. package/src/lib/context/DynamicContext/DynamicContext.js +3 -1
  10. package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +1 -0
  11. package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
  12. package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
  13. package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
  14. package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs +2 -1
  15. package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js +2 -1
  16. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +31 -4
  17. package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +31 -4
  18. package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +2 -1
  19. package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +3 -2
  20. package/src/lib/data/api/user/user.cjs +10 -0
  21. package/src/lib/data/api/user/user.d.ts +1 -0
  22. package/src/lib/data/api/user/user.js +10 -1
  23. package/src/lib/store/state/projectSettings/projectSettings.cjs +1 -0
  24. package/src/lib/store/state/projectSettings/projectSettings.d.ts +3 -1
  25. package/src/lib/store/state/projectSettings/projectSettings.js +1 -0
  26. package/src/lib/utils/hooks/index.d.ts +1 -0
  27. package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +6 -4
  28. package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.d.ts +6 -3
  29. package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +6 -4
  30. package/src/lib/utils/hooks/useDeleteUserAccount/index.d.ts +1 -0
  31. package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs +119 -0
  32. package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.d.ts +7 -0
  33. package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js +115 -0
  34. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +9 -3
  35. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +10 -4
  36. package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.cjs +27 -0
  37. package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.d.ts +2 -0
  38. package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.js +23 -0
  39. package/src/lib/utils/hooks/useFundWithWallet/utils/index.d.ts +1 -0
  40. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -0
  41. package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -0
  42. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +14 -1
  43. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +14 -1
  44. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.cjs +25 -0
  45. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.d.ts +7 -0
  46. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.js +21 -0
  47. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/index.d.ts +1 -0
  48. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.cjs +5 -23
  49. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.js +5 -23
@@ -1,39 +1,21 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../../../_virtual/_tslib.js';
3
3
  import { useCallback } from 'react';
4
- import { DynamicError } from '@dynamic-labs/utils';
5
- import { useProjectSettings } from '../../../../../../store/state/projectSettings/projectSettings.js';
6
4
  import { useFundWithWallet } from '../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.js';
5
+ import { getPromptAmountParams } from './getPromptAmountParams/getPromptAmountParams.js';
7
6
 
8
7
  const useStartExternalWalletFunding = () => {
9
- var _a, _b, _c;
10
8
  const { connectWalletForFunding, promptAmountAndFund } = useFundWithWallet();
11
- const settings = useProjectSettings();
12
9
  return useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
13
- var _d, _e, _f, _g, _h, _j;
14
10
  try {
15
11
  const externalWallet = yield connectWalletForFunding();
16
- const walletChain = externalWallet.connector.connectedChain;
17
- const chainSettings = (_g = (_f = (_e = (_d = settings === null || settings === void 0 ? void 0 : settings.sdk.funding) === null || _d === void 0 ? void 0 : _d.externalWallets) === null || _e === void 0 ? void 0 : _e.defaultSettings) === null || _f === void 0 ? void 0 : _f.chainSettings) === null || _g === void 0 ? void 0 : _g.find(({ chain }) => chain === walletChain);
18
- // This is always supposed to be present, otherwise there's some backend error
19
- if (!((_h = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _h === void 0 ? void 0 : _h.value) || !((_j = chainSettings === null || chainSettings === void 0 ? void 0 : chainSettings.token) === null || _j === void 0 ? void 0 : _j.rule))
20
- throw new DynamicError(`No external wallet funding chain settings found for chain ${walletChain}`);
21
- promptAmountAndFund({
22
- externalWallet,
23
- token: {
24
- rule: chainSettings.token.rule,
25
- value: chainSettings.token.value,
26
- },
27
- });
12
+ const props = getPromptAmountParams({ externalWallet });
13
+ promptAmountAndFund(props);
28
14
  }
29
- catch (_k) {
15
+ catch (_a) {
30
16
  /* empty */
31
17
  }
32
- }), [
33
- connectWalletForFunding,
34
- promptAmountAndFund,
35
- (_c = (_b = (_a = settings === null || settings === void 0 ? void 0 : settings.sdk.funding) === null || _a === void 0 ? void 0 : _a.externalWallets) === null || _b === void 0 ? void 0 : _b.defaultSettings) === null || _c === void 0 ? void 0 : _c.chainSettings,
36
- ]);
18
+ }), [connectWalletForFunding, promptAmountAndFund]);
37
19
  };
38
20
 
39
21
  export { useStartExternalWalletFunding };