@dynamic-labs/sdk-react-core 2.1.0-alpha.1 → 2.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- package/src/lib/Main.cjs +5 -0
- package/src/lib/Main.js +5 -0
- package/src/lib/components/Alert/Alert.cjs +2 -2
- package/src/lib/components/Alert/Alert.js +2 -2
- package/src/lib/components/Alert/Alert.types.d.ts +1 -0
- package/src/lib/components/EmailForm/EmailForm.cjs +1 -1
- package/src/lib/components/EmailForm/EmailForm.js +1 -1
- package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +1 -1
- package/src/lib/components/PhoneNumberField/PhoneNumberField.js +1 -1
- package/src/lib/components/RadioButton/RadioButton.cjs +14 -0
- package/src/lib/components/RadioButton/RadioButton.d.ts +5 -0
- package/src/lib/components/RadioButton/RadioButton.js +10 -0
- package/src/lib/components/RadioButton/index.d.ts +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.d.ts +2 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +2 -2
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +5 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +5 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/ViewContext/ViewContext.cjs +2 -2
- package/src/lib/context/ViewContext/ViewContext.js +2 -2
- package/src/lib/context/ViewContext/types/index.d.ts +7 -2
- package/src/lib/data/api/user/user.cjs +16 -0
- package/src/lib/data/api/user/user.js +16 -1
- package/src/lib/data/api/wallets/wallets.cjs +5 -1
- package/src/lib/data/api/wallets/wallets.js +5 -1
- package/src/lib/events/dynamicEvents.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +6 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +6 -0
- package/src/lib/locale/en/translation.cjs +43 -2
- package/src/lib/locale/en/translation.d.ts +43 -2
- package/src/lib/locale/en/translation.js +43 -2
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +22 -17
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +22 -17
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +8 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +8 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -1
- package/src/lib/utils/hooks/useMergeUserAccounts/index.d.ts +1 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +99 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.d.ts +4 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +95 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +2 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +2 -4
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.cjs +3 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.js +3 -3
- package/src/lib/views/CollectUserDataView/useFields.cjs +1 -0
- package/src/lib/views/CollectUserDataView/useFields.d.ts +2 -0
- package/src/lib/views/CollectUserDataView/useFields.js +1 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.cjs +126 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.d.ts +6 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.js +122 -0
- package/src/lib/views/MergeUserAccountsConflictsView/index.d.ts +1 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +123 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +4 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +119 -0
- package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +3 -3
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +3 -3
- package/src/lib/views/viewToComponentMap.cjs +4 -0
- package/src/lib/views/viewToComponentMap.d.ts +2 -0
- package/src/lib/views/viewToComponentMap.js +4 -0
|
@@ -48,7 +48,11 @@ const linkWallet = (environmentId_1, _a, userJwt_1) => _tslib.__awaiter(void 0,
|
|
|
48
48
|
throw new utils.WalletUsedError(data.code);
|
|
49
49
|
}
|
|
50
50
|
if (data.code === 'merge_accounts_confirmation') {
|
|
51
|
-
throw new utils.MergeAccountsConfirmationError(
|
|
51
|
+
throw new utils.MergeAccountsConfirmationError({
|
|
52
|
+
code: data.code,
|
|
53
|
+
mergeConflicts: data.payload.mergeConflicts,
|
|
54
|
+
walletAddress: publicWalletAddress,
|
|
55
|
+
});
|
|
52
56
|
}
|
|
53
57
|
return undefined;
|
|
54
58
|
}
|
|
@@ -44,7 +44,11 @@ const linkWallet = (environmentId_1, _a, userJwt_1) => __awaiter(void 0, [enviro
|
|
|
44
44
|
throw new WalletUsedError(data.code);
|
|
45
45
|
}
|
|
46
46
|
if (data.code === 'merge_accounts_confirmation') {
|
|
47
|
-
throw new MergeAccountsConfirmationError(
|
|
47
|
+
throw new MergeAccountsConfirmationError({
|
|
48
|
+
code: data.code,
|
|
49
|
+
mergeConflicts: data.payload.mergeConflicts,
|
|
50
|
+
walletAddress: publicWalletAddress,
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
return undefined;
|
|
50
54
|
}
|
|
@@ -11,7 +11,7 @@ export type DynamicEvents = {
|
|
|
11
11
|
authFlowCancelled: () => void;
|
|
12
12
|
emailVerificationResult: (param: boolean, email: string) => void;
|
|
13
13
|
smsVerificationResult: (param: boolean, phone: PhoneData) => void;
|
|
14
|
-
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined) => void;
|
|
14
|
+
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined, authToken: string | undefined) => void;
|
|
15
15
|
embeddedWalletFailed: (error: unknown) => void;
|
|
16
16
|
passkeyRecoveryCompleted: (wallet: Wallet) => void;
|
|
17
17
|
passkeyRecoveryFailed: (error: unknown) => void;
|
|
@@ -92,6 +92,11 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, }) =>
|
|
|
92
92
|
const { setExistentAccountData } = AccountExistsContext.useAccountExistsContext();
|
|
93
93
|
const { setSocialProvider } = SocialRedirectContext.useSocialRedirectContext();
|
|
94
94
|
const handleBackClick = React.useCallback(() => {
|
|
95
|
+
var _a;
|
|
96
|
+
if ((_a = view.events) === null || _a === void 0 ? void 0 : _a.onBackClick) {
|
|
97
|
+
view.events.onBackClick();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
95
100
|
if (view.type === 'farcaster-connect-view') {
|
|
96
101
|
setSocialProvider(undefined);
|
|
97
102
|
dynamicEvents.dynamicEvents.emit('farcasterConnectCancelled');
|
|
@@ -106,6 +111,7 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, }) =>
|
|
|
106
111
|
goToInitialView();
|
|
107
112
|
}, [
|
|
108
113
|
view.type,
|
|
114
|
+
view.events,
|
|
109
115
|
goToInitialView,
|
|
110
116
|
setExistentAccountData,
|
|
111
117
|
setError,
|
|
@@ -88,6 +88,11 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, }) =>
|
|
|
88
88
|
const { setExistentAccountData } = useAccountExistsContext();
|
|
89
89
|
const { setSocialProvider } = useSocialRedirectContext();
|
|
90
90
|
const handleBackClick = useCallback(() => {
|
|
91
|
+
var _a;
|
|
92
|
+
if ((_a = view.events) === null || _a === void 0 ? void 0 : _a.onBackClick) {
|
|
93
|
+
view.events.onBackClick();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
91
96
|
if (view.type === 'farcaster-connect-view') {
|
|
92
97
|
setSocialProvider(undefined);
|
|
93
98
|
dynamicEvents.emit('farcasterConnectCancelled');
|
|
@@ -102,6 +107,7 @@ const Header = ({ onClose: handleClose, heading, projectSettings, copykey, }) =>
|
|
|
102
107
|
goToInitialView();
|
|
103
108
|
}, [
|
|
104
109
|
view.type,
|
|
110
|
+
view.events,
|
|
105
111
|
goToInitialView,
|
|
106
112
|
setExistentAccountData,
|
|
107
113
|
setError,
|
|
@@ -871,6 +871,48 @@ const translation = {
|
|
|
871
871
|
/**
|
|
872
872
|
* @description copy keys for merge user accounts view
|
|
873
873
|
* @default
|
|
874
|
+
* {
|
|
875
|
+
confirm_button: 'Merge accounts',
|
|
876
|
+
errors: {
|
|
877
|
+
merge_error: 'Something went wrong, please try again.',
|
|
878
|
+
},
|
|
879
|
+
same_wallet: {
|
|
880
|
+
content: 'Your wallet is currently used by 2 different accounts.',
|
|
881
|
+
title: 'Same wallet in use',
|
|
882
|
+
},
|
|
883
|
+
}
|
|
884
|
+
*/
|
|
885
|
+
dyn_merge_user_accounts: {
|
|
886
|
+
confirm_button: 'Merge accounts',
|
|
887
|
+
errors: {
|
|
888
|
+
merge_error: 'Something went wrong, please try again.',
|
|
889
|
+
},
|
|
890
|
+
same_wallet: {
|
|
891
|
+
content: 'Your wallet is currently used by 2 different accounts.',
|
|
892
|
+
title: 'Same wallet in use',
|
|
893
|
+
},
|
|
894
|
+
},
|
|
895
|
+
/**
|
|
896
|
+
* @description copy keys for merge user accounts conflicts view
|
|
897
|
+
* @default
|
|
898
|
+
* {
|
|
899
|
+
confirm_button: 'Confirm & Merge',
|
|
900
|
+
errors: {
|
|
901
|
+
merge_error: 'Something went wrong, please try again.',
|
|
902
|
+
},
|
|
903
|
+
title: 'Confirm your preferences',
|
|
904
|
+
}
|
|
905
|
+
*/
|
|
906
|
+
dyn_merge_user_accounts_conflicts: {
|
|
907
|
+
confirm_button: 'Confirm & Merge',
|
|
908
|
+
errors: {
|
|
909
|
+
merge_error: 'Something went wrong, please try again.',
|
|
910
|
+
},
|
|
911
|
+
title: 'Confirm your preferences',
|
|
912
|
+
},
|
|
913
|
+
/**
|
|
914
|
+
* @description copy keys for merge user accounts view when using email associated to a different account
|
|
915
|
+
* @default
|
|
874
916
|
* {
|
|
875
917
|
cancel_button: "No, I'll use a different email",
|
|
876
918
|
confirm_button: 'Yes, link to existing account',
|
|
@@ -880,10 +922,9 @@ const translation = {
|
|
|
880
922
|
existing_account: 'An account already exists that uses',
|
|
881
923
|
existing_account_trail: 'email.',
|
|
882
924
|
title: 'Would you like to link this wallet to this existing account?',
|
|
883
|
-
},
|
|
884
925
|
}
|
|
885
926
|
*/
|
|
886
|
-
|
|
927
|
+
dyn_merge_user_accounts_with_same_email: {
|
|
887
928
|
cancel_button: "No, I'll use a different email",
|
|
888
929
|
confirm_button: 'Yes, link to existing account',
|
|
889
930
|
errors: {
|
|
@@ -867,6 +867,48 @@ export declare const translation: {
|
|
|
867
867
|
/**
|
|
868
868
|
* @description copy keys for merge user accounts view
|
|
869
869
|
* @default
|
|
870
|
+
* {
|
|
871
|
+
confirm_button: 'Merge accounts',
|
|
872
|
+
errors: {
|
|
873
|
+
merge_error: 'Something went wrong, please try again.',
|
|
874
|
+
},
|
|
875
|
+
same_wallet: {
|
|
876
|
+
content: 'Your wallet is currently used by 2 different accounts.',
|
|
877
|
+
title: 'Same wallet in use',
|
|
878
|
+
},
|
|
879
|
+
}
|
|
880
|
+
*/
|
|
881
|
+
dyn_merge_user_accounts: {
|
|
882
|
+
confirm_button: string;
|
|
883
|
+
errors: {
|
|
884
|
+
merge_error: string;
|
|
885
|
+
};
|
|
886
|
+
same_wallet: {
|
|
887
|
+
content: string;
|
|
888
|
+
title: string;
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* @description copy keys for merge user accounts conflicts view
|
|
893
|
+
* @default
|
|
894
|
+
* {
|
|
895
|
+
confirm_button: 'Confirm & Merge',
|
|
896
|
+
errors: {
|
|
897
|
+
merge_error: 'Something went wrong, please try again.',
|
|
898
|
+
},
|
|
899
|
+
title: 'Confirm your preferences',
|
|
900
|
+
}
|
|
901
|
+
*/
|
|
902
|
+
dyn_merge_user_accounts_conflicts: {
|
|
903
|
+
confirm_button: string;
|
|
904
|
+
errors: {
|
|
905
|
+
merge_error: string;
|
|
906
|
+
};
|
|
907
|
+
title: string;
|
|
908
|
+
};
|
|
909
|
+
/**
|
|
910
|
+
* @description copy keys for merge user accounts view when using email associated to a different account
|
|
911
|
+
* @default
|
|
870
912
|
* {
|
|
871
913
|
cancel_button: "No, I'll use a different email",
|
|
872
914
|
confirm_button: 'Yes, link to existing account',
|
|
@@ -876,10 +918,9 @@ export declare const translation: {
|
|
|
876
918
|
existing_account: 'An account already exists that uses',
|
|
877
919
|
existing_account_trail: 'email.',
|
|
878
920
|
title: 'Would you like to link this wallet to this existing account?',
|
|
879
|
-
},
|
|
880
921
|
}
|
|
881
922
|
*/
|
|
882
|
-
|
|
923
|
+
dyn_merge_user_accounts_with_same_email: {
|
|
883
924
|
cancel_button: string;
|
|
884
925
|
confirm_button: string;
|
|
885
926
|
errors: {
|
|
@@ -867,6 +867,48 @@ const translation = {
|
|
|
867
867
|
/**
|
|
868
868
|
* @description copy keys for merge user accounts view
|
|
869
869
|
* @default
|
|
870
|
+
* {
|
|
871
|
+
confirm_button: 'Merge accounts',
|
|
872
|
+
errors: {
|
|
873
|
+
merge_error: 'Something went wrong, please try again.',
|
|
874
|
+
},
|
|
875
|
+
same_wallet: {
|
|
876
|
+
content: 'Your wallet is currently used by 2 different accounts.',
|
|
877
|
+
title: 'Same wallet in use',
|
|
878
|
+
},
|
|
879
|
+
}
|
|
880
|
+
*/
|
|
881
|
+
dyn_merge_user_accounts: {
|
|
882
|
+
confirm_button: 'Merge accounts',
|
|
883
|
+
errors: {
|
|
884
|
+
merge_error: 'Something went wrong, please try again.',
|
|
885
|
+
},
|
|
886
|
+
same_wallet: {
|
|
887
|
+
content: 'Your wallet is currently used by 2 different accounts.',
|
|
888
|
+
title: 'Same wallet in use',
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
/**
|
|
892
|
+
* @description copy keys for merge user accounts conflicts view
|
|
893
|
+
* @default
|
|
894
|
+
* {
|
|
895
|
+
confirm_button: 'Confirm & Merge',
|
|
896
|
+
errors: {
|
|
897
|
+
merge_error: 'Something went wrong, please try again.',
|
|
898
|
+
},
|
|
899
|
+
title: 'Confirm your preferences',
|
|
900
|
+
}
|
|
901
|
+
*/
|
|
902
|
+
dyn_merge_user_accounts_conflicts: {
|
|
903
|
+
confirm_button: 'Confirm & Merge',
|
|
904
|
+
errors: {
|
|
905
|
+
merge_error: 'Something went wrong, please try again.',
|
|
906
|
+
},
|
|
907
|
+
title: 'Confirm your preferences',
|
|
908
|
+
},
|
|
909
|
+
/**
|
|
910
|
+
* @description copy keys for merge user accounts view when using email associated to a different account
|
|
911
|
+
* @default
|
|
870
912
|
* {
|
|
871
913
|
cancel_button: "No, I'll use a different email",
|
|
872
914
|
confirm_button: 'Yes, link to existing account',
|
|
@@ -876,10 +918,9 @@ const translation = {
|
|
|
876
918
|
existing_account: 'An account already exists that uses',
|
|
877
919
|
existing_account_trail: 'email.',
|
|
878
920
|
title: 'Would you like to link this wallet to this existing account?',
|
|
879
|
-
},
|
|
880
921
|
}
|
|
881
922
|
*/
|
|
882
|
-
|
|
923
|
+
dyn_merge_user_accounts_with_same_email: {
|
|
883
924
|
cancel_button: "No, I'll use a different email",
|
|
884
925
|
confirm_button: 'Yes, link to existing account',
|
|
885
926
|
errors: {
|
|
@@ -22,6 +22,7 @@ export type DynamicEventsCallbacks = {
|
|
|
22
22
|
export type OnAuthSuccess = (params: {
|
|
23
23
|
authToken: string;
|
|
24
24
|
handleLogOut: () => Promise<void>;
|
|
25
|
+
minAuthToken: string;
|
|
25
26
|
isAuthenticated: boolean;
|
|
26
27
|
primaryWallet: Wallet | null;
|
|
27
28
|
user: UserProfile;
|
|
@@ -46,4 +47,4 @@ destination: {
|
|
|
46
47
|
value: PhoneData;
|
|
47
48
|
}) => void;
|
|
48
49
|
export type OnUserProfileUpdate = (user: UserProfile) => void;
|
|
49
|
-
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined) => void;
|
|
50
|
+
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined, authToken: string | undefined) => void;
|