@getpara/react-sdk 1.2.0 → 1.3.1
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/dist/MoonPayEmbed-GAWXP6V7.js +2 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.br +0 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.gz +0 -0
- package/dist/index.js +675 -5
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/package.json +8 -7
- package/dist/modal/ParaModal.js +0 -281
- package/dist/modal/components/Account/Account.js +0 -60
- package/dist/modal/components/AddFunds/AddFunds.js +0 -147
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
- package/dist/modal/components/AddFunds/index.js +0 -3
- package/dist/modal/components/AuthInput/AuthInput.js +0 -221
- package/dist/modal/components/AuthInput/countryCodes.js +0 -40
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
- package/dist/modal/components/Body/Body.js +0 -232
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
- package/dist/modal/components/ChainSwitch/config.js +0 -11
- package/dist/modal/components/Controls/Controls.js +0 -54
- package/dist/modal/components/Controls/Selects.js +0 -159
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
- package/dist/modal/components/ExternalWalletStep/config.js +0 -11
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
- package/dist/modal/components/Footer/Footer.js +0 -71
- package/dist/modal/components/Header/Header.js +0 -24
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
- package/dist/modal/components/Hero/Hero.js +0 -119
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
- package/dist/modal/components/ModalContent/ModalContent.js +0 -282
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
- package/dist/modal/components/OAuth/OAuth.js +0 -125
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
- package/dist/modal/components/Waiting/Waiting.js +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
- package/dist/modal/components/WalletCard/WalletCard.js +0 -93
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
- package/dist/modal/components/common.js +0 -67
- package/dist/modal/components/index.js +0 -1
- package/dist/modal/constants/constants.js +0 -93
- package/dist/modal/constants/defaults.js +0 -5
- package/dist/modal/constants/oAuthLogos.js +0 -18
- package/dist/modal/hooks/useActiveWallet.js +0 -11
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
- package/dist/modal/hooks/useGoBack.js +0 -34
- package/dist/modal/index.js +0 -9
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
- package/dist/modal/providers/ExternalWalletContext.js +0 -253
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
- package/dist/modal/stores/index.js +0 -3
- package/dist/modal/stores/modal/actions.js +0 -64
- package/dist/modal/stores/modal/useModalStore.js +0 -41
- package/dist/modal/stores/para/actions.js +0 -5
- package/dist/modal/stores/para/useParaStore.js +0 -3
- package/dist/modal/stores/theme/actions.js +0 -24
- package/dist/modal/stores/theme/useThemeStore.js +0 -14
- package/dist/modal/stores/userInfo/actions.js +0 -34
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -21
- package/dist/modal/types/modalProps.js +0 -7
- package/dist/modal/utils/authLayoutHelpers.js +0 -2
- package/dist/modal/utils/getMailtoLink.js +0 -5
- package/dist/modal/utils/getTileButtonFlex.js +0 -15
- package/dist/modal/utils/isPasskeySupported.js +0 -10
- package/dist/modal/utils/openPopup.js +0 -55
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
- package/dist/modal/utils/steps.js +0 -215
- package/dist/modal/utils/stringFormatters.js +0 -12
- package/dist/modal/utils/validateOnRampConfig.js +0 -26
- package/dist/provider/ParaProvider.js +0 -17
- package/dist/provider/actions/checkIfUserExists.js +0 -26
- package/dist/provider/actions/createUser.js +0 -30
- package/dist/provider/actions/getAccount.js +0 -24
- package/dist/provider/actions/getWallet.js +0 -16
- package/dist/provider/actions/initiateLogin.js +0 -23
- package/dist/provider/actions/keepSessionAlive.js +0 -23
- package/dist/provider/actions/logout.js +0 -20
- package/dist/provider/actions/signMessage.js +0 -23
- package/dist/provider/actions/signTransaction.js +0 -23
- package/dist/provider/actions/waitForAccountCreation.js +0 -24
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
- package/dist/provider/hooks/index.js +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -10
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
- package/dist/provider/hooks/mutations/useLogout.js +0 -33
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -2
- package/dist/provider/hooks/queries/useAccount.js +0 -23
- package/dist/provider/hooks/queries/useWallet.js +0 -24
- package/dist/provider/hooks/utils/index.js +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
- package/dist/provider/hooks/utils/useClient.js +0 -8
- package/dist/provider/hooks/utils/useEventListeners.js +0 -87
- package/dist/provider/hooks/utils/useInternalClient.js +0 -9
- package/dist/provider/hooks/utils/useModal.js +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -3
- package/dist/provider/stores/getters.js +0 -5
- package/dist/provider/stores/slices/client.js +0 -4
- package/dist/provider/stores/slices/index.js +0 -3
- package/dist/provider/stores/slices/modal.js +0 -4
- package/dist/provider/stores/slices/wallet.js +0 -6
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -14
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/renameMutations.js +0 -19
- /package/dist/{modal/css → css}/modal.css +0 -0
- /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { initiateLogin } from '../../actions/initiateLogin.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for initiating a user login
|
|
16
|
-
*/
|
|
17
|
-
export const useInitiateLogin = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield initiateLogin(client, args); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'initiateLogin');
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { keepSessionAlive } from '../../actions/keepSessionAlive.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for keeping a session alive
|
|
16
|
-
*/
|
|
17
|
-
export const useKeepSessionAlive = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield keepSessionAlive(client); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'keepSessionAlive');
|
|
23
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { logout } from '../../actions/logout.js';
|
|
13
|
-
import { useStore } from '../../stores/useStore.js';
|
|
14
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
15
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
16
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
17
|
-
/**
|
|
18
|
-
* Hook for logging out a user
|
|
19
|
-
*/
|
|
20
|
-
export const useLogout = () => {
|
|
21
|
-
const client = useClient();
|
|
22
|
-
const queryClient = useQueryClient();
|
|
23
|
-
const clearSelectedWallet = useStore(state => state.clearSelectedWallet);
|
|
24
|
-
const mutation = useMutation({
|
|
25
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield logout(client); }),
|
|
26
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
28
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
29
|
-
clearSelectedWallet();
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'logout');
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient, useWallet } from '../index.js';
|
|
12
|
-
import { signMessage } from '../../actions/signMessage.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for signing a message
|
|
16
|
-
*/
|
|
17
|
-
export const useSignMessage = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const { data: wallet } = useWallet();
|
|
20
|
-
const mutation = useMutation({
|
|
21
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
let walletId = args === null || args === void 0 ? void 0 : args.walletId;
|
|
23
|
-
if (!walletId) {
|
|
24
|
-
walletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error('no wallet id found');
|
|
28
|
-
}
|
|
29
|
-
return yield signMessage(client, Object.assign(Object.assign({}, args), { walletId }));
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'signMessage');
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient, useWallet } from '../index.js';
|
|
12
|
-
import { signTransaction } from '../../actions/signTransaction.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for signing a transaction
|
|
16
|
-
*/
|
|
17
|
-
export const useSignTransaction = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const { data: wallet } = useWallet();
|
|
20
|
-
const mutation = useMutation({
|
|
21
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
let walletId = args === null || args === void 0 ? void 0 : args.walletId;
|
|
23
|
-
if (!walletId) {
|
|
24
|
-
walletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error('no wallet id found');
|
|
28
|
-
}
|
|
29
|
-
return yield signTransaction(client, Object.assign(Object.assign({}, args), { walletId }));
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'signTransaction');
|
|
33
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForAccountCreation } from '../../actions/waitForAccountCreation.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for account creation
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForAccountCreation = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield waitForAccountCreation(client); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForAccountCreation');
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForLoginAndSetup } from '../../actions/waitForLoginAndSetup.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for user login and account setup
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForLoginAndSetup = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield waitForLoginAndSetup(client, args); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForLoginAndSetup');
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForPasskeyAndCreateWallet } from '../../actions/waitForPasskeyAndCreateWallet.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for session setup and wallet creation
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForPasskeyAndCreateWallet = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield waitForPasskeyAndCreateWallet(client); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForPasskeyAndCreateWallet');
|
|
30
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useQuery } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { getAccount } from '../../actions/getAccount.js';
|
|
13
|
-
export const ACCOUNT_BASE_KEY = 'PARA_ACCOUNT';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for retrieving a user account
|
|
16
|
-
*/
|
|
17
|
-
export const useAccount = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
return useQuery({
|
|
20
|
-
queryKey: [ACCOUNT_BASE_KEY, client === null || client === void 0 ? void 0 : client.getUserId()],
|
|
21
|
-
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield getAccount(client); }),
|
|
22
|
-
});
|
|
23
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useQuery } from '@tanstack/react-query';
|
|
11
|
-
import { useClient, useWalletState } from '../index.js';
|
|
12
|
-
import { getWallet } from '../../actions/getWallet.js';
|
|
13
|
-
export const WALLET_BASE_KEY = 'PARA_WALLET';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for retrieving the selected wallet
|
|
16
|
-
*/
|
|
17
|
-
export const useWallet = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const { selectedWallet } = useWalletState();
|
|
20
|
-
return useQuery({
|
|
21
|
-
queryKey: [WALLET_BASE_KEY, client === null || client === void 0 ? void 0 : client.getUserId(), selectedWallet.id, selectedWallet.type],
|
|
22
|
-
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield getWallet(client, selectedWallet); }),
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useEffect, useRef } from 'react';
|
|
11
|
-
import { useAccount, useClient, useKeepSessionAlive, useLogout } from '../index.js';
|
|
12
|
-
const SESSION_CHECK_INTERVAL = 60000;
|
|
13
|
-
const SESSION_REFRESH_THRESHOLD = 300000;
|
|
14
|
-
export const useAutoSessionKeepAlive = ({ disabled }) => {
|
|
15
|
-
const client = useClient();
|
|
16
|
-
const { data: account } = useAccount();
|
|
17
|
-
const { logoutAsync } = useLogout();
|
|
18
|
-
const { keepSessionAliveAsync } = useKeepSessionAlive();
|
|
19
|
-
const sessionCheckInterval = useRef(null);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!client || disabled) {
|
|
22
|
-
clearSessionMonitoring();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (account === null || account === void 0 ? void 0 : account.isConnected) {
|
|
26
|
-
setupSessionMonitoring();
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
clearSessionMonitoring();
|
|
30
|
-
}
|
|
31
|
-
return () => clearSessionMonitoring();
|
|
32
|
-
}, [client, account, disabled]);
|
|
33
|
-
const getSessionExpiry = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
try {
|
|
35
|
-
const sessionCookie = yield client.retrieveSessionCookie();
|
|
36
|
-
if (!sessionCookie)
|
|
37
|
-
return null;
|
|
38
|
-
const expiresMatch = sessionCookie.match(/Expires=([^;]+)/);
|
|
39
|
-
return expiresMatch ? new Date(expiresMatch[1]) : null;
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const setupSessionMonitoring = () => {
|
|
46
|
-
clearSessionMonitoring();
|
|
47
|
-
sessionCheckInterval.current = setInterval(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
const expiry = yield getSessionExpiry();
|
|
49
|
-
if (!expiry) {
|
|
50
|
-
yield logoutAsync();
|
|
51
|
-
clearSessionMonitoring();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const timeUntilExpiry = expiry.getTime() - Date.now();
|
|
55
|
-
if (timeUntilExpiry <= 0) {
|
|
56
|
-
yield logoutAsync();
|
|
57
|
-
clearSessionMonitoring();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (timeUntilExpiry <= SESSION_REFRESH_THRESHOLD) {
|
|
61
|
-
try {
|
|
62
|
-
yield keepSessionAliveAsync();
|
|
63
|
-
setupSessionMonitoring();
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
console.error('Failed to keep session alive:', err);
|
|
67
|
-
yield logoutAsync();
|
|
68
|
-
clearSessionMonitoring();
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}), SESSION_CHECK_INTERVAL);
|
|
73
|
-
};
|
|
74
|
-
const clearSessionMonitoring = () => {
|
|
75
|
-
if (sessionCheckInterval.current) {
|
|
76
|
-
clearInterval(sessionCheckInterval.current);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { useClient, useWalletState } from '../index.js';
|
|
4
|
-
import { ParaEvent, } from '@getpara/web-sdk';
|
|
5
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
6
|
-
import { useStore } from '../../stores/useStore.js';
|
|
7
|
-
import { WALLET_BASE_KEY } from '../../hooks/queries/useWallet.js';
|
|
8
|
-
export const useEventListeners = ({ onLogin, onLogout, onAccountSetup, onAccountCreation, onSignMessage, onSignTransaction, onWalletCreated, onPregenWalletClaimed, onExternalWalletChange, onWalletsChange, } = {}) => {
|
|
9
|
-
const queryClient = useQueryClient();
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const clearSelectedWallet = useStore(state => state.clearSelectedWallet);
|
|
12
|
-
const { selectedWallet, setSelectedWallet } = useWalletState();
|
|
13
|
-
const loginListener = (event) => {
|
|
14
|
-
loginOrSetupListener();
|
|
15
|
-
onLogin === null || onLogin === void 0 ? void 0 : onLogin(event);
|
|
16
|
-
};
|
|
17
|
-
const accountSetupListener = (event) => {
|
|
18
|
-
loginOrSetupListener();
|
|
19
|
-
onAccountSetup === null || onAccountSetup === void 0 ? void 0 : onAccountSetup(event);
|
|
20
|
-
};
|
|
21
|
-
const loginOrSetupListener = () => {
|
|
22
|
-
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
23
|
-
queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
24
|
-
};
|
|
25
|
-
const accountCreationListener = (event) => {
|
|
26
|
-
onAccountCreation === null || onAccountCreation === void 0 ? void 0 : onAccountCreation(event);
|
|
27
|
-
};
|
|
28
|
-
const logoutListener = (event) => {
|
|
29
|
-
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
30
|
-
clearSelectedWallet();
|
|
31
|
-
onLogout === null || onLogout === void 0 ? void 0 : onLogout(event);
|
|
32
|
-
};
|
|
33
|
-
const signMessageListener = (event) => {
|
|
34
|
-
onSignMessage === null || onSignMessage === void 0 ? void 0 : onSignMessage(event);
|
|
35
|
-
};
|
|
36
|
-
const signTransactionListener = (event) => {
|
|
37
|
-
onSignTransaction === null || onSignTransaction === void 0 ? void 0 : onSignTransaction(event);
|
|
38
|
-
};
|
|
39
|
-
const walletChangeListener = (event) => {
|
|
40
|
-
updateSelectedWallet();
|
|
41
|
-
onWalletsChange === null || onWalletsChange === void 0 ? void 0 : onWalletsChange(event);
|
|
42
|
-
};
|
|
43
|
-
const externalWalletChangeListener = (event) => {
|
|
44
|
-
updateSelectedWallet();
|
|
45
|
-
onExternalWalletChange === null || onExternalWalletChange === void 0 ? void 0 : onExternalWalletChange(event);
|
|
46
|
-
};
|
|
47
|
-
const walletCreatedListener = (event) => {
|
|
48
|
-
onWalletCreated === null || onWalletCreated === void 0 ? void 0 : onWalletCreated(event);
|
|
49
|
-
};
|
|
50
|
-
const pregenWalletClaimedListener = (event) => {
|
|
51
|
-
onPregenWalletClaimed === null || onPregenWalletClaimed === void 0 ? void 0 : onPregenWalletClaimed(event);
|
|
52
|
-
};
|
|
53
|
-
const updateSelectedWallet = () => {
|
|
54
|
-
if (!client) {
|
|
55
|
-
clearSelectedWallet();
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (!(selectedWallet === null || selectedWallet === void 0 ? void 0 : selectedWallet.id) || !client.findWallet(selectedWallet === null || selectedWallet === void 0 ? void 0 : selectedWallet.id)) {
|
|
59
|
-
const defaultWallet = client.findWallet(undefined, undefined, { forbidPregen: true });
|
|
60
|
-
setSelectedWallet({ id: defaultWallet === null || defaultWallet === void 0 ? void 0 : defaultWallet.id, type: defaultWallet === null || defaultWallet === void 0 ? void 0 : defaultWallet.type });
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
window.addEventListener(ParaEvent.LOGIN_EVENT, loginListener);
|
|
65
|
-
window.addEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
|
|
66
|
-
window.addEventListener(ParaEvent.ACCOUNT_CREATION_EVENT, accountCreationListener);
|
|
67
|
-
window.addEventListener(ParaEvent.LOGOUT_EVENT, logoutListener);
|
|
68
|
-
window.addEventListener(ParaEvent.SIGN_MESSAGE_EVENT, signMessageListener);
|
|
69
|
-
window.addEventListener(ParaEvent.SIGN_TRANSACTION_EVENT, signTransactionListener);
|
|
70
|
-
window.addEventListener(ParaEvent.WALLETS_CHANGE_EVENT, walletChangeListener);
|
|
71
|
-
window.addEventListener(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, externalWalletChangeListener);
|
|
72
|
-
window.addEventListener(ParaEvent.WALLET_CREATED, walletCreatedListener);
|
|
73
|
-
window.addEventListener(ParaEvent.PREGEN_WALLET_CLAIMED, pregenWalletClaimedListener);
|
|
74
|
-
return () => {
|
|
75
|
-
window.removeEventListener(ParaEvent.LOGIN_EVENT, loginListener);
|
|
76
|
-
window.removeEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
|
|
77
|
-
window.removeEventListener(ParaEvent.ACCOUNT_CREATION_EVENT, accountCreationListener);
|
|
78
|
-
window.removeEventListener(ParaEvent.LOGOUT_EVENT, logoutListener);
|
|
79
|
-
window.removeEventListener(ParaEvent.SIGN_MESSAGE_EVENT, signMessageListener);
|
|
80
|
-
window.removeEventListener(ParaEvent.SIGN_TRANSACTION_EVENT, signTransactionListener);
|
|
81
|
-
window.removeEventListener(ParaEvent.WALLETS_CHANGE_EVENT, walletChangeListener);
|
|
82
|
-
window.removeEventListener(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, externalWalletChangeListener);
|
|
83
|
-
window.removeEventListener(ParaEvent.WALLET_CREATED, walletCreatedListener);
|
|
84
|
-
window.removeEventListener(ParaEvent.PREGEN_WALLET_CLAIMED, pregenWalletClaimedListener);
|
|
85
|
-
};
|
|
86
|
-
}, [client]);
|
|
87
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// DO NOT EXPORT THIS FROM THE INDEX!
|
|
2
|
-
import { useStore } from '../../stores/useStore.js';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for retrieving the Para internal client
|
|
5
|
-
*/
|
|
6
|
-
export const useInternalClient = () => {
|
|
7
|
-
const client = useStore(state => state.client);
|
|
8
|
-
return client;
|
|
9
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useStore } from '../../stores/useStore.js';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for controlling the Para modal
|
|
4
|
-
*/
|
|
5
|
-
export const useModal = () => {
|
|
6
|
-
const isOpen = useStore(state => state.isOpen);
|
|
7
|
-
const setIsOpen = useStore(state => state.setIsOpen);
|
|
8
|
-
const openModal = () => {
|
|
9
|
-
setIsOpen(true);
|
|
10
|
-
};
|
|
11
|
-
const closeModal = () => {
|
|
12
|
-
setIsOpen(false);
|
|
13
|
-
};
|
|
14
|
-
return { isOpen, openModal, closeModal };
|
|
15
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useStore } from '../../stores/useStore.js';
|
|
2
|
-
import { useClient } from './useClient.js';
|
|
3
|
-
/**
|
|
4
|
-
* Hook for controlling selected wallet
|
|
5
|
-
*/
|
|
6
|
-
export const useWalletState = () => {
|
|
7
|
-
const client = useClient();
|
|
8
|
-
const selectedWalletId = useStore(state => state.selectedWalletId);
|
|
9
|
-
const selectedWalletType = useStore(state => state.selectedWalletType);
|
|
10
|
-
const setStoredSelectedWallet = useStore(state => state.setSelectedWallet);
|
|
11
|
-
const clearSelectedWallet = useStore(state => state.clearSelectedWallet);
|
|
12
|
-
const setSelectedWallet = ({ id, type }) => {
|
|
13
|
-
try {
|
|
14
|
-
const validId = client.findWalletId(id, { type: [type] });
|
|
15
|
-
if (validId !== id) {
|
|
16
|
-
clearSelectedWallet();
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
setStoredSelectedWallet(id, type);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
clearSelectedWallet();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
selectedWallet: {
|
|
28
|
-
id: selectedWalletId,
|
|
29
|
-
type: selectedWalletType,
|
|
30
|
-
},
|
|
31
|
-
setSelectedWallet,
|
|
32
|
-
};
|
|
33
|
-
};
|
package/dist/provider/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { vanillaStore } from './useStore.js';
|
|
2
|
-
export const getClient = () => vanillaStore.getState().client;
|
|
3
|
-
export const getIsOpen = () => vanillaStore.getState().isOpen;
|
|
4
|
-
export const getSelectedWalletId = () => vanillaStore.getState().selectedWalletId;
|
|
5
|
-
export const getSelectedWalletType = () => vanillaStore.getState().selectedWalletType;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export const createWalletSlice = set => ({
|
|
2
|
-
selectedWalletId: undefined,
|
|
3
|
-
selectedWalletType: undefined,
|
|
4
|
-
setSelectedWallet: (selectedWalletId, selectedWalletType) => set({ selectedWalletId, selectedWalletType }),
|
|
5
|
-
clearSelectedWallet: () => set({ selectedWalletId: undefined, selectedWalletType: undefined }),
|
|
6
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createStore, useStore as useZustandStore } from 'zustand';
|
|
2
|
-
import { createClientSlice, createModalSlice, createWalletSlice } from './slices/index.js';
|
|
3
|
-
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
4
|
-
export const vanillaStore = createStore()(persist((...a) => (Object.assign(Object.assign(Object.assign({}, createClientSlice(...a)), createModalSlice(...a)), createWalletSlice(...a))), {
|
|
5
|
-
version: 1,
|
|
6
|
-
name: '@PARA/web-state',
|
|
7
|
-
storage: createJSONStorage(() => sessionStorage),
|
|
8
|
-
partialize: state => ({
|
|
9
|
-
selectedWalletId: state.selectedWalletId,
|
|
10
|
-
selectedWalletType: state.selectedWalletType,
|
|
11
|
-
}),
|
|
12
|
-
}));
|
|
13
|
-
const createBoundedUseStore = (store => selector => useZustandStore(store, selector));
|
|
14
|
-
export const useStore = createBoundedUseStore(vanillaStore);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
export function renameMutations(mutationObj, name) {
|
|
13
|
-
const { mutate: _, mutateAsync: __ } = mutationObj, mutationNoMutate = __rest(mutationObj, ["mutate", "mutateAsync"]);
|
|
14
|
-
const newMutations = {
|
|
15
|
-
[name]: mutationObj.mutate,
|
|
16
|
-
[`${name}Async`]: mutationObj.mutateAsync,
|
|
17
|
-
};
|
|
18
|
-
return Object.assign(Object.assign({}, newMutations), mutationNoMutate);
|
|
19
|
-
}
|
|
File without changes
|
|
File without changes
|