@oxy.so/services 11.4.0 → 11.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.
- package/lib/commonjs/index.js +0 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +47 -3
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js +2 -2
- package/lib/commonjs/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
- package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
- package/lib/commonjs/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
- package/lib/commonjs/ui/components/organizations/OrganizationSettings.js +4 -4
- package/lib/commonjs/ui/components/organizations/OrganizationSettings.js.map +1 -1
- package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js +2 -2
- package/lib/commonjs/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js +3 -3
- package/lib/commonjs/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxyEmailAccountChoice.js +113 -0
- package/lib/commonjs/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
- package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js +6 -2
- package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js +4 -4
- package/lib/commonjs/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +76 -9
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js +6 -6
- package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/ReauthStep.js +4 -4
- package/lib/commonjs/ui/components/signIn/ReauthStep.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/accountFlowParts.js +24 -22
- package/lib/commonjs/ui/components/signIn/accountFlowParts.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +7 -4
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +5 -2
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/oauth/applicationSessionLane.js +2 -2
- package/lib/commonjs/ui/oauth/applicationSessionLane.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +20 -63
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +12 -12
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PreferencesScreen.js +3 -4
- package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/identityCrypto.js +19 -0
- package/lib/commonjs/ui/utils/identityCrypto.js.map +1 -0
- package/lib/module/index.js +0 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/boot/runProviderColdBoot.js +47 -3
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/components/organizations/OrganizationClaimReview.js +2 -2
- package/lib/module/ui/components/organizations/OrganizationClaimReview.js.map +1 -1
- package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js +5 -5
- package/lib/module/ui/components/organizations/OrganizationDirectorySearch.js.map +1 -1
- package/lib/module/ui/components/organizations/OrganizationSettings.js +4 -4
- package/lib/module/ui/components/organizations/OrganizationSettings.js.map +1 -1
- package/lib/module/ui/components/organizations/OrganizationTypePicker.js +1 -1
- package/lib/module/ui/components/organizations/OrganizationTypePicker.js.map +1 -1
- package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js +1 -1
- package/lib/module/ui/components/signIn/OxyAuthenticatorPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxyEmailAccountChoice.js +110 -0
- package/lib/module/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
- package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js +5 -1
- package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxyPasswordPanel.js +1 -1
- package/lib/module/ui/components/signIn/OxyPasswordPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxySignInPanel.js +71 -4
- package/lib/module/ui/components/signIn/OxySignInPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxySignUpPanel.js +5 -5
- package/lib/module/ui/components/signIn/OxySignUpPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/ReauthStep.js +1 -1
- package/lib/module/ui/components/signIn/ReauthStep.js.map +1 -1
- package/lib/module/ui/components/signIn/accountFlowParts.js +3 -1
- package/lib/module/ui/components/signIn/accountFlowParts.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +6 -3
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +4 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/oauth/applicationSessionLane.js +2 -2
- package/lib/module/ui/oauth/applicationSessionLane.js.map +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js +20 -63
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +6 -6
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/PreferencesScreen.js +3 -4
- package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/module/ui/utils/identityCrypto.js +13 -0
- package/lib/module/ui/utils/identityCrypto.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +0 -4
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxyEmailAccountChoice.d.ts +20 -0
- package/lib/typescript/commonjs/ui/components/signIn/OxyEmailAccountChoice.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts +2 -0
- package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/ReauthStep.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +1 -7
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/usePersonalPlans.d.ts +1 -2
- package/lib/typescript/commonjs/ui/hooks/queries/usePersonalPlans.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +43 -0
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +0 -4
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationClaimReview.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationDirectorySearch.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationSettings.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts +1 -1
- package/lib/typescript/module/ui/components/organizations/OrganizationTypePicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxyAuthenticatorPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxyEmailAccountChoice.d.ts +20 -0
- package/lib/typescript/module/ui/components/signIn/OxyEmailAccountChoice.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts +2 -0
- package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/signIn/ReauthStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts +1 -1
- package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +1 -7
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/usePersonalPlans.d.ts +1 -2
- package/lib/typescript/module/ui/hooks/queries/usePersonalPlans.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts +43 -0
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -0
- package/package.json +6 -7
- package/src/index.ts +0 -5
- package/src/ui/boot/__tests__/coldBootNoIdpRedirect.test.ts +166 -3
- package/src/ui/boot/runProviderColdBoot.ts +49 -4
- package/src/ui/components/organizations/OrganizationClaimReview.tsx +3 -5
- package/src/ui/components/organizations/OrganizationDirectorySearch.tsx +12 -9
- package/src/ui/components/organizations/OrganizationSettings.tsx +6 -9
- package/src/ui/components/organizations/OrganizationTypePicker.tsx +2 -1
- package/src/ui/components/signIn/OxyAuthenticatorPanel.tsx +2 -1
- package/src/ui/components/signIn/OxyEmailAccountChoice.tsx +116 -0
- package/src/ui/components/signIn/OxyLinkCommonsPanel.tsx +3 -1
- package/src/ui/components/signIn/OxyPasswordPanel.tsx +1 -1
- package/src/ui/components/signIn/OxySignInPanel.tsx +93 -6
- package/src/ui/components/signIn/OxySignUpPanel.tsx +6 -9
- package/src/ui/components/signIn/ReauthStep.tsx +2 -6
- package/src/ui/components/signIn/accountFlowParts.tsx +4 -2
- package/src/ui/context/OxyContext.tsx +7 -3
- package/src/ui/context/hooks/useAuthOperations.ts +2 -1
- package/src/ui/oauth/applicationSessionLane.ts +2 -2
- package/src/ui/screens/AccountMembersScreen.tsx +27 -71
- package/src/ui/screens/AccountSettingsScreen.tsx +6 -2
- package/src/ui/screens/CreateAccountScreen.tsx +10 -9
- package/src/ui/screens/PreferencesScreen.tsx +0 -2
- package/src/ui/utils/identityCrypto.ts +10 -0
- package/lib/commonjs/ui/components/AccountInvitationAcceptance.js +0 -97
- package/lib/commonjs/ui/components/AccountInvitationAcceptance.js.map +0 -1
- package/lib/commonjs/ui/components/DisplayCurrencySelector.js +0 -49
- package/lib/commonjs/ui/components/DisplayCurrencySelector.js.map +0 -1
- package/lib/commonjs/ui/hooks/useDisplayCurrency.js +0 -77
- package/lib/commonjs/ui/hooks/useDisplayCurrency.js.map +0 -1
- package/lib/commonjs/ui/hooks/useDisplayPrice.js +0 -59
- package/lib/commonjs/ui/hooks/useDisplayPrice.js.map +0 -1
- package/lib/module/ui/components/AccountInvitationAcceptance.js +0 -94
- package/lib/module/ui/components/AccountInvitationAcceptance.js.map +0 -1
- package/lib/module/ui/components/DisplayCurrencySelector.js +0 -44
- package/lib/module/ui/components/DisplayCurrencySelector.js.map +0 -1
- package/lib/module/ui/hooks/useDisplayCurrency.js +0 -72
- package/lib/module/ui/hooks/useDisplayCurrency.js.map +0 -1
- package/lib/module/ui/hooks/useDisplayPrice.js +0 -56
- package/lib/module/ui/hooks/useDisplayPrice.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/AccountInvitationAcceptance.d.ts +0 -5
- package/lib/typescript/commonjs/ui/components/AccountInvitationAcceptance.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/DisplayCurrencySelector.d.ts +0 -3
- package/lib/typescript/commonjs/ui/components/DisplayCurrencySelector.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/useDisplayCurrency.d.ts +0 -11
- package/lib/typescript/commonjs/ui/hooks/useDisplayCurrency.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/useDisplayPrice.d.ts +0 -6
- package/lib/typescript/commonjs/ui/hooks/useDisplayPrice.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/AccountInvitationAcceptance.d.ts +0 -5
- package/lib/typescript/module/ui/components/AccountInvitationAcceptance.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/DisplayCurrencySelector.d.ts +0 -3
- package/lib/typescript/module/ui/components/DisplayCurrencySelector.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/useDisplayCurrency.d.ts +0 -11
- package/lib/typescript/module/ui/hooks/useDisplayCurrency.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/useDisplayPrice.d.ts +0 -6
- package/lib/typescript/module/ui/hooks/useDisplayPrice.d.ts.map +0 -1
- package/src/ui/components/AccountInvitationAcceptance.tsx +0 -90
- package/src/ui/components/DisplayCurrencySelector.tsx +0 -38
- package/src/ui/components/__tests__/AccountInvitationAcceptance.test.tsx +0 -61
- package/src/ui/hooks/useDisplayCurrency.ts +0 -64
- package/src/ui/hooks/useDisplayPrice.ts +0 -40
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AccountInvitationAcceptance = AccountInvitationAcceptance;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _typography = require("@oxy.so/bloom/typography");
|
|
10
|
-
var _button = require("@oxy.so/bloom/button");
|
|
11
|
-
var _core = require("@oxy.so/core");
|
|
12
|
-
var _OxyContext = require("../context/OxyContext.js");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
/** The link never grants access on navigation, preview, sign-in or account switching. */
|
|
15
|
-
function AccountInvitationAcceptance({
|
|
16
|
-
token
|
|
17
|
-
}) {
|
|
18
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(InvitationContent, {
|
|
19
|
-
token: token
|
|
20
|
-
}, token);
|
|
21
|
-
}
|
|
22
|
-
function InvitationContent({
|
|
23
|
-
token
|
|
24
|
-
}) {
|
|
25
|
-
const {
|
|
26
|
-
oxyServices,
|
|
27
|
-
user,
|
|
28
|
-
canUsePrivateApi,
|
|
29
|
-
openAccountDialog
|
|
30
|
-
} = (0, _OxyContext.useOxy)();
|
|
31
|
-
const [preview, setPreview] = (0, _react.useState)(null);
|
|
32
|
-
const [error, setError] = (0, _react.useState)('');
|
|
33
|
-
const [busy, setBusy] = (0, _react.useState)(false);
|
|
34
|
-
const [accepted, setAccepted] = (0, _react.useState)(false);
|
|
35
|
-
(0, _react.useEffect)(() => {
|
|
36
|
-
let alive = true;
|
|
37
|
-
setPreview(null);
|
|
38
|
-
setError('');
|
|
39
|
-
if (canUsePrivateApi && token) {
|
|
40
|
-
oxyServices.accounts.invitations.preview(token).then(value => {
|
|
41
|
-
if (alive) setPreview(value);
|
|
42
|
-
}).catch(reason => {
|
|
43
|
-
if (alive) setError(reason instanceof Error ? reason.message : 'Invitation unavailable');
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return () => {
|
|
47
|
-
alive = false;
|
|
48
|
-
};
|
|
49
|
-
}, [oxyServices, canUsePrivateApi, token]);
|
|
50
|
-
const accept = async () => {
|
|
51
|
-
if (!user || !preview) return;
|
|
52
|
-
setBusy(true);
|
|
53
|
-
setError('');
|
|
54
|
-
try {
|
|
55
|
-
await oxyServices.accounts.invitations.accept(token, user.id);
|
|
56
|
-
setAccepted(true);
|
|
57
|
-
} catch (reason) {
|
|
58
|
-
setError(reason instanceof Error ? reason.message : 'Could not accept invitation');
|
|
59
|
-
} finally {
|
|
60
|
-
setBusy(false);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
64
|
-
className: "gap-space-16 p-space-24",
|
|
65
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
66
|
-
className: "text-title font-semibold text-text",
|
|
67
|
-
children: "Account invitation"
|
|
68
|
-
}), canUsePrivateApi && token && !preview && !error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
69
|
-
accessibilityRole: "progressbar",
|
|
70
|
-
children: "Loading invitation\u2026"
|
|
71
|
-
}) : null, accepted ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
72
|
-
children: "Invitation accepted. You can now access this account."
|
|
73
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
|
-
children: [preview ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.Text, {
|
|
75
|
-
children: ["Join ", preview.account.displayName ?? preview.account.username, " as", ' ', preview.invitation.role, "."]
|
|
76
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_typography.Text, {
|
|
77
|
-
children: ["Selected account:", ' ', user ? `${user.name?.displayName ?? (0, _core.getNormalizedUserHandle)(user) ?? user.id} (${user.email ?? user.id})` : 'Not signed in']
|
|
78
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
79
|
-
children: "The selected account receives access. Its email can differ from the invitation address. No access is granted until you confirm."
|
|
80
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
81
|
-
disabled: busy,
|
|
82
|
-
onPress: () => openAccountDialog(),
|
|
83
|
-
children: user ? 'Change account' : 'Sign in or create account'
|
|
84
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
85
|
-
disabled: busy || !user || !preview || user.kind !== 'personal',
|
|
86
|
-
onPress: accept,
|
|
87
|
-
children: "Confirm and accept"
|
|
88
|
-
})]
|
|
89
|
-
}), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
90
|
-
accessibilityRole: "alert",
|
|
91
|
-
children: error
|
|
92
|
-
}) : null, !token ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
93
|
-
children: "This invitation link is incomplete."
|
|
94
|
-
}) : null]
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=AccountInvitationAcceptance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_typography","_button","_core","_OxyContext","_jsxRuntime","AccountInvitationAcceptance","token","jsx","InvitationContent","oxyServices","user","canUsePrivateApi","openAccountDialog","useOxy","preview","setPreview","useState","error","setError","busy","setBusy","accepted","setAccepted","useEffect","alive","accounts","invitations","then","value","catch","reason","Error","message","accept","id","jsxs","View","className","children","Text","accessibilityRole","Fragment","account","displayName","username","invitation","role","name","getNormalizedUserHandle","email","Button","disabled","onPress","kind"],"sourceRoot":"../../../../src","sources":["ui/components/AccountInvitationAcceptance.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA+C,IAAAM,WAAA,GAAAN,OAAA;AAE/C;AACO,SAASO,2BAA2BA,CAAC;EAAEC;AAAyB,CAAC,EAAE;EACxE,oBAAO,IAA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AA,EAACP,WAAA,CAAAuC,IAAI;MAAAD,QAAA,EAAC;IAAmC,CAAM,CAAC,GAAG,IAAI;EAAA,CAC7D,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DisplayCurrencySelector = DisplayCurrencySelector;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _segmentedControl = require("@oxy.so/bloom/segmented-control");
|
|
10
|
-
var _typography = require("@oxy.so/bloom/typography");
|
|
11
|
-
var _useDisplayCurrency = require("../hooks/useDisplayCurrency.js");
|
|
12
|
-
var _useI18n = require("../hooks/useI18n.js");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function DisplayCurrencySelector() {
|
|
16
|
-
const {
|
|
17
|
-
currency,
|
|
18
|
-
selectCurrency,
|
|
19
|
-
isSaving,
|
|
20
|
-
error
|
|
21
|
-
} = (0, _useDisplayCurrency.useDisplayCurrency)();
|
|
22
|
-
const {
|
|
23
|
-
t
|
|
24
|
-
} = (0, _useI18n.useI18n)();
|
|
25
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
26
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
27
|
-
children: t('preferences.displayCurrency.label')
|
|
28
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_segmentedControl.SegmentedControl, {
|
|
29
|
-
type: "radio",
|
|
30
|
-
label: t('preferences.displayCurrency.label'),
|
|
31
|
-
value: currency,
|
|
32
|
-
onValueChange: value => {
|
|
33
|
-
const selected = _useDisplayCurrency.DISPLAY_CURRENCIES.find(item => item === value);
|
|
34
|
-
if (selected && !isSaving) selectCurrency(selected);
|
|
35
|
-
},
|
|
36
|
-
children: _useDisplayCurrency.DISPLAY_CURRENCIES.map(value => /*#__PURE__*/(0, _jsxRuntime.jsx)(_segmentedControl.SegmentedControlItem, {
|
|
37
|
-
value: value,
|
|
38
|
-
disabled: isSaving,
|
|
39
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_segmentedControl.SegmentedControlItemText, {
|
|
40
|
-
children: value
|
|
41
|
-
})
|
|
42
|
-
}, value))
|
|
43
|
-
}), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
44
|
-
accessibilityLiveRegion: "polite",
|
|
45
|
-
children: t('preferences.displayCurrency.saveFailed')
|
|
46
|
-
})]
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=DisplayCurrencySelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_segmentedControl","_typography","_useDisplayCurrency","_useI18n","_jsxRuntime","e","__esModule","default","DisplayCurrencySelector","currency","selectCurrency","isSaving","error","useDisplayCurrency","t","useI18n","jsxs","View","children","jsx","Text","SegmentedControl","type","label","value","onValueChange","selected","DISPLAY_CURRENCIES","find","item","map","SegmentedControlItem","disabled","SegmentedControlItemText","accessibilityLiveRegion"],"sourceRoot":"../../../../src","sources":["ui/components/DisplayCurrencySelector.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAA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AAAhB,QAAA,EAAEJ,CAAC,CAAC,wCAAwC;IAAC,CAAO,CAC3F;EAAA,CACG,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DISPLAY_CURRENCIES = void 0;
|
|
7
|
-
exports.useDisplayCurrency = useDisplayCurrency;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactQuery = require("@tanstack/react-query");
|
|
10
|
-
var _core = require("@oxy.so/core");
|
|
11
|
-
var _OxyContext = require("../context/OxyContext.js");
|
|
12
|
-
var _useAccountQueries = require("./queries/useAccountQueries.js");
|
|
13
|
-
var _queryKeys = require("./queries/queryKeys.js");
|
|
14
|
-
var _authStore = require("../stores/authStore.js");
|
|
15
|
-
var _mutationKeys = require("./mutations/mutationKeys.js");
|
|
16
|
-
const DISPLAY_CURRENCIES = exports.DISPLAY_CURRENCIES = ['USD', 'EUR', 'FAIR'];
|
|
17
|
-
let anonymousCurrency = 'USD';
|
|
18
|
-
const anonymousListeners = new Set();
|
|
19
|
-
const subscribeAnonymous = listener => {
|
|
20
|
-
anonymousListeners.add(listener);
|
|
21
|
-
return () => {
|
|
22
|
-
anonymousListeners.delete(listener);
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const anonymousSnapshot = () => anonymousCurrency;
|
|
26
|
-
|
|
27
|
-
/** Account-scoped server preference. A late save can never replace another account. */
|
|
28
|
-
function useDisplayCurrency() {
|
|
29
|
-
const {
|
|
30
|
-
oxyServices,
|
|
31
|
-
activeSessionId,
|
|
32
|
-
isAuthenticated,
|
|
33
|
-
user
|
|
34
|
-
} = (0, _OxyContext.useOxy)();
|
|
35
|
-
const current = (0, _useAccountQueries.useCurrentUser)({
|
|
36
|
-
enabled: isAuthenticated
|
|
37
|
-
});
|
|
38
|
-
const client = (0, _reactQuery.useQueryClient)();
|
|
39
|
-
const anonymous = (0, _react.useSyncExternalStore)(subscribeAnonymous, anonymousSnapshot, () => 'USD');
|
|
40
|
-
const currency = isAuthenticated ? current.data?.userPreferences?.displayCurrency ?? user?.userPreferences?.displayCurrency ?? 'USD' : anonymous;
|
|
41
|
-
const mutation = (0, _reactQuery.useMutation)({
|
|
42
|
-
mutationKey: [..._mutationKeys.mutationKeys.account.updateSettings],
|
|
43
|
-
mutationFn: async input => {
|
|
44
|
-
const updated = await (0, _core.authenticatedApiCall)(oxyServices, input.sessionId, () => oxyServices.users.updateMe({
|
|
45
|
-
userPreferences: {
|
|
46
|
-
displayCurrency: input.currency
|
|
47
|
-
}
|
|
48
|
-
}));
|
|
49
|
-
if (updated.id !== input.userId) throw new Error('Account changed. Please try again.');
|
|
50
|
-
return updated;
|
|
51
|
-
},
|
|
52
|
-
onSuccess: (updated, input) => {
|
|
53
|
-
client.setQueryData(_queryKeys.queryKeys.accounts.current(input.sessionId), updated);
|
|
54
|
-
if (_authStore.useAuthStore.getState().user?.id === input.userId) _authStore.useAuthStore.getState().setUser(updated);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
function selectCurrency(next) {
|
|
58
|
-
if (!DISPLAY_CURRENCIES.includes(next)) return;
|
|
59
|
-
if (!isAuthenticated) {
|
|
60
|
-
anonymousCurrency = next;
|
|
61
|
-
for (const listener of anonymousListeners) listener();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (activeSessionId && user?.id) mutation.mutate({
|
|
65
|
-
currency: next,
|
|
66
|
-
sessionId: activeSessionId,
|
|
67
|
-
userId: user.id
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
currency,
|
|
72
|
-
selectCurrency,
|
|
73
|
-
isSaving: mutation.isPending,
|
|
74
|
-
error: mutation.error
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=useDisplayCurrency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactQuery","_core","_OxyContext","_useAccountQueries","_queryKeys","_authStore","_mutationKeys","DISPLAY_CURRENCIES","exports","anonymousCurrency","anonymousListeners","Set","subscribeAnonymous","listener","add","delete","anonymousSnapshot","useDisplayCurrency","oxyServices","activeSessionId","isAuthenticated","user","useOxy","current","useCurrentUser","enabled","client","useQueryClient","anonymous","useSyncExternalStore","currency","data","userPreferences","displayCurrency","mutation","useMutation","mutationKey","mutationKeys","account","updateSettings","mutationFn","input","updated","authenticatedApiCall","sessionId","users","updateMe","id","userId","Error","onSuccess","setQueryData","queryKeys","accounts","useAuthStore","getState","setUser","selectCurrency","next","includes","mutate","isSaving","isPending","error"],"sourceRoot":"../../../../src","sources":["ui/hooks/useDisplayCurrency.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAGO,MAAMQ,kBAA8C,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;AAEpF,IAAIE,iBAAkC,GAAG,KAAK;AAC9C,MAAMC,kBAAkB,GAAG,IAAIC,GAAG,CAAa,CAAC;AAChD,MAAMC,kBAAkB,GAAIC,QAAoB,IAAK;EACnDH,kBAAkB,CAACI,GAAG,CAACD,QAAQ,CAAC;EAChC,OAAO,MAAM;IACXH,kBAAkB,CAACK,MAAM,CAACF,QAAQ,CAAC;EACrC,CAAC;AACH,CAAC;AACD,MAAMG,iBAAiB,GAAGA,CAAA,KAAMP,iBAAiB;;AAEjD;AACO,SAASQ,kBAAkBA,CAAA,EAAG;EACnC,MAAM;IAAEC,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AAKN,KAAK,CAACO,MAAM,EACnDM,uBAAY,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAACd,OAAO,CAAC;IAC5C;EACF,CAAC,CAAC;EACF,SAASe,cAAcA,CAACC,IAAqB,EAAE;IAC7C,IAAI,CAACnD,kBAAkB,CAACoD,QAAQ,CAACD,IAAI,CAAC,EAAE;IACxC,IAAI,CAACtC,eAAe,EAAE;MACpBX,iBAAiB,GAAGiD,IAAI;MACxB,KAAK,MAAM7C,QAAQ,IAAIH,kBAAkB,EAAEG,QAAQ,CAAC,CAAC;MACrD;IACF;IACA,IAAIM,eAAe,IAAIE,IAAI,EAAE0B,EAAE,EAC7Bb,QAAQ,CAAC0B,MAAM,CAAC;MAAE9B,QAAQ,EAAE4B,IAAI;MAAEd,SAAS,EAAEzB,eAAe;MAAE6B,MAAM,EAAE3B,IAAI,CAAC0B;IAAG,CAAC,CAAC;EACpF;EACA,OAAO;IAAEjB,QAAQ;IAAE2B,cAAc;IAAEI,QAAQ,EAAE3B,QAAQ,CAAC4B,SAAS;IAAEC,KAAK,EAAE7B,QAAQ,CAAC6B;EAAM,CAAC;AAC1F","ignoreList":[]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useDisplayPrice = useDisplayPrice;
|
|
7
|
-
var _reactQuery = require("@tanstack/react-query");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _display = require("@peable.to/sdk/display");
|
|
10
|
-
var _useDisplayCurrency = require("./useDisplayCurrency.js");
|
|
11
|
-
var _useI18n = require("./useI18n.js");
|
|
12
|
-
/** Display conversion only. Pricing and checkout request bodies retain their source units. */
|
|
13
|
-
function useDisplayPrice() {
|
|
14
|
-
const {
|
|
15
|
-
currency
|
|
16
|
-
} = (0, _useDisplayCurrency.useDisplayCurrency)();
|
|
17
|
-
const {
|
|
18
|
-
t
|
|
19
|
-
} = (0, _useI18n.useI18n)();
|
|
20
|
-
const [now, setNow] = (0, _react.useState)(Date.now);
|
|
21
|
-
const rates = (0, _reactQuery.useQuery)({
|
|
22
|
-
queryKey: ['display-currency', 'faircoin-indexed-price'],
|
|
23
|
-
queryFn: ({
|
|
24
|
-
signal
|
|
25
|
-
}) => (0, _display.readDisplayRates)({
|
|
26
|
-
signal
|
|
27
|
-
}),
|
|
28
|
-
enabled: currency !== 'USD',
|
|
29
|
-
staleTime: 30_000,
|
|
30
|
-
gcTime: 0,
|
|
31
|
-
retry: false,
|
|
32
|
-
refetchInterval: 60_000,
|
|
33
|
-
refetchOnWindowFocus: 'always'
|
|
34
|
-
});
|
|
35
|
-
(0, _react.useEffect)(() => {
|
|
36
|
-
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
37
|
-
return () => clearInterval(timer);
|
|
38
|
-
}, []);
|
|
39
|
-
function formatUsd(minorUnits) {
|
|
40
|
-
const display = (0, _display.convertDisplayAmount)({
|
|
41
|
-
units: String(minorUnits),
|
|
42
|
-
currency: 'USD',
|
|
43
|
-
displayCurrency: currency,
|
|
44
|
-
rates: rates.isError ? null : rates.data,
|
|
45
|
-
now
|
|
46
|
-
});
|
|
47
|
-
if (!display) return t('preferences.displayCurrency.unavailable', {
|
|
48
|
-
currency
|
|
49
|
-
});
|
|
50
|
-
return currency === 'USD' ? display : t('preferences.displayCurrency.approximate', {
|
|
51
|
-
amount: display
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
currency,
|
|
56
|
-
formatUsd
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=useDisplayPrice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactQuery","require","_react","_display","_useDisplayCurrency","_useI18n","useDisplayPrice","currency","useDisplayCurrency","t","useI18n","now","setNow","useState","Date","rates","useQuery","queryKey","queryFn","signal","readDisplayRates","enabled","staleTime","gcTime","retry","refetchInterval","refetchOnWindowFocus","useEffect","timer","setInterval","clearInterval","formatUsd","minorUnits","display","convertDisplayAmount","units","String","displayCurrency","isError","data","amount"],"sourceRoot":"../../../../src","sources":["ui/hooks/useDisplayPrice.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA;AACO,SAASK,eAAeA,CAAA,EAAG;EAChC,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,sCAAkB,EAAC,CAAC;EACzC,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,gBAAO,EAAC,CAAC;EACvB,MAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAG,IAAAC,eAAQ,EAACC,IAAI,CAACH,GAAG,CAAC;EACxC,MAAMI,KAAK,GAAG,IAAAC,oBAAQ,EAAC;IACrBC,QAAQ,EAAE,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;IACxDC,OAAO,EAAEA,CAAC;MAAEC;IAAO,CAAC,KAAK,IAAAC,yBAAgB,EAAC;MAAED;IAAO,CAAC,CAAC;IACrDE,OAAO,EAAEd,QAAQ,KAAK,KAAK;IAC3Be,SAAS,EAAE,MAAM;IACjBC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,KAAK;IACZC,eAAe,EAAE,MAAM;IACvBC,oBAAoB,EAAE;EACxB,CAAC,CAAC;EACF,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,KAAK,GAAGC,WAAW,CAAC,MAAMjB,MAAM,CAACE,IAAI,CAACH,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACzD,OAAO,MAAMmB,aAAa,CAACF,KAAK,CAAC;EACnC,CAAC,EAAE,EAAE,CAAC;EACN,SAASG,SAASA,CAACC,UAAkB,EAAE;IACrC,MAAMC,OAAO,GAAG,IAAAC,6BAAoB,EAAC;MACnCC,KAAK,EAAEC,MAAM,CAACJ,UAAU,CAAC;MACzBzB,QAAQ,EAAE,KAAK;MACf8B,eAAe,EAAE9B,QAAQ;MACzBQ,KAAK,EAAEA,KAAK,CAACuB,OAAO,GAAG,IAAI,GAAGvB,KAAK,CAACwB,IAAI;MACxC5B;IACF,CAAC,CAAC;IACF,IAAI,CAACsB,OAAO,EAAE,OAAOxB,CAAC,CAAC,yCAAyC,EAAE;MAAEF;IAAS,CAAC,CAAC;IAC/E,OAAOA,QAAQ,KAAK,KAAK,GACrB0B,OAAO,GACPxB,CAAC,CAAC,yCAAyC,EAAE;MAAE+B,MAAM,EAAEP;IAAQ,CAAC,CAAC;EACvE;EACA,OAAO;IAAE1B,QAAQ;IAAEwB;EAAU,CAAC;AAChC","ignoreList":[]}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { Text } from '@oxy.so/bloom/typography';
|
|
6
|
-
import { Button } from '@oxy.so/bloom/button';
|
|
7
|
-
import { getNormalizedUserHandle } from '@oxy.so/core';
|
|
8
|
-
import { useOxy } from "../context/OxyContext.js";
|
|
9
|
-
|
|
10
|
-
/** The link never grants access on navigation, preview, sign-in or account switching. */
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
-
export function AccountInvitationAcceptance({
|
|
13
|
-
token
|
|
14
|
-
}) {
|
|
15
|
-
return /*#__PURE__*/_jsx(InvitationContent, {
|
|
16
|
-
token: token
|
|
17
|
-
}, token);
|
|
18
|
-
}
|
|
19
|
-
function InvitationContent({
|
|
20
|
-
token
|
|
21
|
-
}) {
|
|
22
|
-
const {
|
|
23
|
-
oxyServices,
|
|
24
|
-
user,
|
|
25
|
-
canUsePrivateApi,
|
|
26
|
-
openAccountDialog
|
|
27
|
-
} = useOxy();
|
|
28
|
-
const [preview, setPreview] = useState(null);
|
|
29
|
-
const [error, setError] = useState('');
|
|
30
|
-
const [busy, setBusy] = useState(false);
|
|
31
|
-
const [accepted, setAccepted] = useState(false);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
let alive = true;
|
|
34
|
-
setPreview(null);
|
|
35
|
-
setError('');
|
|
36
|
-
if (canUsePrivateApi && token) {
|
|
37
|
-
oxyServices.accounts.invitations.preview(token).then(value => {
|
|
38
|
-
if (alive) setPreview(value);
|
|
39
|
-
}).catch(reason => {
|
|
40
|
-
if (alive) setError(reason instanceof Error ? reason.message : 'Invitation unavailable');
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return () => {
|
|
44
|
-
alive = false;
|
|
45
|
-
};
|
|
46
|
-
}, [oxyServices, canUsePrivateApi, token]);
|
|
47
|
-
const accept = async () => {
|
|
48
|
-
if (!user || !preview) return;
|
|
49
|
-
setBusy(true);
|
|
50
|
-
setError('');
|
|
51
|
-
try {
|
|
52
|
-
await oxyServices.accounts.invitations.accept(token, user.id);
|
|
53
|
-
setAccepted(true);
|
|
54
|
-
} catch (reason) {
|
|
55
|
-
setError(reason instanceof Error ? reason.message : 'Could not accept invitation');
|
|
56
|
-
} finally {
|
|
57
|
-
setBusy(false);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
61
|
-
className: "gap-space-16 p-space-24",
|
|
62
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
63
|
-
className: "text-title font-semibold text-text",
|
|
64
|
-
children: "Account invitation"
|
|
65
|
-
}), canUsePrivateApi && token && !preview && !error ? /*#__PURE__*/_jsx(Text, {
|
|
66
|
-
accessibilityRole: "progressbar",
|
|
67
|
-
children: "Loading invitation\u2026"
|
|
68
|
-
}) : null, accepted ? /*#__PURE__*/_jsx(Text, {
|
|
69
|
-
children: "Invitation accepted. You can now access this account."
|
|
70
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
71
|
-
children: [preview ? /*#__PURE__*/_jsxs(Text, {
|
|
72
|
-
children: ["Join ", preview.account.displayName ?? preview.account.username, " as", ' ', preview.invitation.role, "."]
|
|
73
|
-
}) : null, /*#__PURE__*/_jsxs(Text, {
|
|
74
|
-
children: ["Selected account:", ' ', user ? `${user.name?.displayName ?? getNormalizedUserHandle(user) ?? user.id} (${user.email ?? user.id})` : 'Not signed in']
|
|
75
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
76
|
-
children: "The selected account receives access. Its email can differ from the invitation address. No access is granted until you confirm."
|
|
77
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
78
|
-
disabled: busy,
|
|
79
|
-
onPress: () => openAccountDialog(),
|
|
80
|
-
children: user ? 'Change account' : 'Sign in or create account'
|
|
81
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
82
|
-
disabled: busy || !user || !preview || user.kind !== 'personal',
|
|
83
|
-
onPress: accept,
|
|
84
|
-
children: "Confirm and accept"
|
|
85
|
-
})]
|
|
86
|
-
}), error ? /*#__PURE__*/_jsx(Text, {
|
|
87
|
-
accessibilityRole: "alert",
|
|
88
|
-
children: error
|
|
89
|
-
}) : null, !token ? /*#__PURE__*/_jsx(Text, {
|
|
90
|
-
children: "This invitation link is incomplete."
|
|
91
|
-
}) : null]
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=AccountInvitationAcceptance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","View","Text","Button","getNormalizedUserHandle","useOxy","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","AccountInvitationAcceptance","token","InvitationContent","oxyServices","user","canUsePrivateApi","openAccountDialog","preview","setPreview","error","setError","busy","setBusy","accepted","setAccepted","alive","accounts","invitations","then","value","catch","reason","Error","message","accept","id","className","children","accessibilityRole","account","displayName","username","invitation","role","name","email","disabled","onPress","kind"],"sourceRoot":"../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AqC,QAAA,EAAC;IAAmC,CAAM,CAAC,GAAG,IAAI;EAAA,CAC7D,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { SegmentedControl, SegmentedControlItem, SegmentedControlItemText } from '@oxy.so/bloom/segmented-control';
|
|
6
|
-
import { Text } from '@oxy.so/bloom/typography';
|
|
7
|
-
import { DISPLAY_CURRENCIES, useDisplayCurrency } from "../hooks/useDisplayCurrency.js";
|
|
8
|
-
import { useI18n } from "../hooks/useI18n.js";
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
export function DisplayCurrencySelector() {
|
|
11
|
-
const {
|
|
12
|
-
currency,
|
|
13
|
-
selectCurrency,
|
|
14
|
-
isSaving,
|
|
15
|
-
error
|
|
16
|
-
} = useDisplayCurrency();
|
|
17
|
-
const {
|
|
18
|
-
t
|
|
19
|
-
} = useI18n();
|
|
20
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
21
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
22
|
-
children: t('preferences.displayCurrency.label')
|
|
23
|
-
}), /*#__PURE__*/_jsx(SegmentedControl, {
|
|
24
|
-
type: "radio",
|
|
25
|
-
label: t('preferences.displayCurrency.label'),
|
|
26
|
-
value: currency,
|
|
27
|
-
onValueChange: value => {
|
|
28
|
-
const selected = DISPLAY_CURRENCIES.find(item => item === value);
|
|
29
|
-
if (selected && !isSaving) selectCurrency(selected);
|
|
30
|
-
},
|
|
31
|
-
children: DISPLAY_CURRENCIES.map(value => /*#__PURE__*/_jsx(SegmentedControlItem, {
|
|
32
|
-
value: value,
|
|
33
|
-
disabled: isSaving,
|
|
34
|
-
children: /*#__PURE__*/_jsx(SegmentedControlItemText, {
|
|
35
|
-
children: value
|
|
36
|
-
})
|
|
37
|
-
}, value))
|
|
38
|
-
}), error && /*#__PURE__*/_jsx(Text, {
|
|
39
|
-
accessibilityLiveRegion: "polite",
|
|
40
|
-
children: t('preferences.displayCurrency.saveFailed')
|
|
41
|
-
})]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=DisplayCurrencySelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","SegmentedControl","SegmentedControlItem","SegmentedControlItemText","Text","DISPLAY_CURRENCIES","useDisplayCurrency","useI18n","jsx","_jsx","jsxs","_jsxs","DisplayCurrencySelector","currency","selectCurrency","isSaving","error","t","children","type","label","value","onValueChange","selected","find","item","map","disabled","accessibilityLiveRegion"],"sourceRoot":"../../../../src","sources":["ui/components/DisplayCurrencySelector.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SACEC,gBAAgB,EAChBC,oBAAoB,EACpBC,wBAAwB,QACnB,iCAAiC;AACxC,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,gCAA6B;AACpF,SAASC,OAAO,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACxC,MAAM;IAAEC,QAAQ;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAGV,kBAAkB,CAAC,CAAC;EAC1E,MAAM;IAAEW;EAAE,CAAC,GAAGV,OAAO,CAAC,CAAC;EACvB,oBACEI,KAAA,CAACX,IAAI;IAAAkB,QAAA,gBACHT,IAAA,CAACL,IAAI;MAAAc,QAAA,EAAED,CAAC,CAAC,mCAAmC;IAAC,CAAO,CAAC,eACrDR,IAAA,CAACR,gBAAgB;MACfkB,IAAI,EAAC,OAAO;MACZC,KAAK,EAAEH,CAAC,CAAC,mCAAmC,CAAE;MAC9CI,KAAK,EAAER,QAAS;MAChBS,aAAa,EAAGD,KAAK,IAAK;QACxB,MAAME,QAAQ,GAAGlB,kBAAkB,CAACmB,IAAI,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,KAAK,CAAC;QAClE,IAAIE,QAAQ,IAAI,CAACR,QAAQ,EAAED,cAAc,CAACS,QAAQ,CAAC;MACrD,CAAE;MAAAL,QAAA,EAEDb,kBAAkB,CAACqB,GAAG,CAAEL,KAAK,iBAC5BZ,IAAA,CAACP,oBAAoB;QAAamB,KAAK,EAAEA,KAAM;QAACM,QAAQ,EAAEZ,QAAS;QAAAG,QAAA,eACjET,IAAA,CAACN,wBAAwB;UAAAe,QAAA,EAAEG;QAAK,CAA2B;MAAC,GADnCA,KAEL,CACvB;IAAC,CACc,CAAC,EAClBL,KAAK,iBACJP,IAAA,CAACL,IAAI;MAACwB,uBAAuB,EAAC,QAAQ;MAAAV,QAAA,EAAED,CAAC,CAAC,wCAAwC;IAAC,CAAO,CAC3F;EAAA,CACG,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useSyncExternalStore } from 'react';
|
|
4
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { authenticatedApiCall } from '@oxy.so/core';
|
|
6
|
-
import { useOxy } from "../context/OxyContext.js";
|
|
7
|
-
import { useCurrentUser } from "./queries/useAccountQueries.js";
|
|
8
|
-
import { queryKeys } from "./queries/queryKeys.js";
|
|
9
|
-
import { useAuthStore } from "../stores/authStore.js";
|
|
10
|
-
import { mutationKeys } from "./mutations/mutationKeys.js";
|
|
11
|
-
export const DISPLAY_CURRENCIES = ['USD', 'EUR', 'FAIR'];
|
|
12
|
-
let anonymousCurrency = 'USD';
|
|
13
|
-
const anonymousListeners = new Set();
|
|
14
|
-
const subscribeAnonymous = listener => {
|
|
15
|
-
anonymousListeners.add(listener);
|
|
16
|
-
return () => {
|
|
17
|
-
anonymousListeners.delete(listener);
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
const anonymousSnapshot = () => anonymousCurrency;
|
|
21
|
-
|
|
22
|
-
/** Account-scoped server preference. A late save can never replace another account. */
|
|
23
|
-
export function useDisplayCurrency() {
|
|
24
|
-
const {
|
|
25
|
-
oxyServices,
|
|
26
|
-
activeSessionId,
|
|
27
|
-
isAuthenticated,
|
|
28
|
-
user
|
|
29
|
-
} = useOxy();
|
|
30
|
-
const current = useCurrentUser({
|
|
31
|
-
enabled: isAuthenticated
|
|
32
|
-
});
|
|
33
|
-
const client = useQueryClient();
|
|
34
|
-
const anonymous = useSyncExternalStore(subscribeAnonymous, anonymousSnapshot, () => 'USD');
|
|
35
|
-
const currency = isAuthenticated ? current.data?.userPreferences?.displayCurrency ?? user?.userPreferences?.displayCurrency ?? 'USD' : anonymous;
|
|
36
|
-
const mutation = useMutation({
|
|
37
|
-
mutationKey: [...mutationKeys.account.updateSettings],
|
|
38
|
-
mutationFn: async input => {
|
|
39
|
-
const updated = await authenticatedApiCall(oxyServices, input.sessionId, () => oxyServices.users.updateMe({
|
|
40
|
-
userPreferences: {
|
|
41
|
-
displayCurrency: input.currency
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
if (updated.id !== input.userId) throw new Error('Account changed. Please try again.');
|
|
45
|
-
return updated;
|
|
46
|
-
},
|
|
47
|
-
onSuccess: (updated, input) => {
|
|
48
|
-
client.setQueryData(queryKeys.accounts.current(input.sessionId), updated);
|
|
49
|
-
if (useAuthStore.getState().user?.id === input.userId) useAuthStore.getState().setUser(updated);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
function selectCurrency(next) {
|
|
53
|
-
if (!DISPLAY_CURRENCIES.includes(next)) return;
|
|
54
|
-
if (!isAuthenticated) {
|
|
55
|
-
anonymousCurrency = next;
|
|
56
|
-
for (const listener of anonymousListeners) listener();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (activeSessionId && user?.id) mutation.mutate({
|
|
60
|
-
currency: next,
|
|
61
|
-
sessionId: activeSessionId,
|
|
62
|
-
userId: user.id
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
currency,
|
|
67
|
-
selectCurrency,
|
|
68
|
-
isSaving: mutation.isPending,
|
|
69
|
-
error: mutation.error
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=useDisplayCurrency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSyncExternalStore","useMutation","useQueryClient","authenticatedApiCall","useOxy","useCurrentUser","queryKeys","useAuthStore","mutationKeys","DISPLAY_CURRENCIES","anonymousCurrency","anonymousListeners","Set","subscribeAnonymous","listener","add","delete","anonymousSnapshot","useDisplayCurrency","oxyServices","activeSessionId","isAuthenticated","user","current","enabled","client","anonymous","currency","data","userPreferences","displayCurrency","mutation","mutationKey","account","updateSettings","mutationFn","input","updated","sessionId","users","updateMe","id","userId","Error","onSuccess","setQueryData","accounts","getState","setUser","selectCurrency","next","includes","mutate","isSaving","isPending","error"],"sourceRoot":"../../../../src","sources":["ui/hooks/useDisplayCurrency.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,OAAO;AAC5C,SAASC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AACnE,SAASC,oBAAoB,QAA8B,cAAc;AACzE,SAASC,MAAM,QAAQ,0BAAuB;AAC9C,SAASC,cAAc,QAAQ,gCAA6B;AAC5D,SAASC,SAAS,QAAQ,wBAAqB;AAC/C,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,YAAY,QAAQ,6BAA0B;AAGvD,OAAO,MAAMC,kBAA8C,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;AAEpF,IAAIC,iBAAkC,GAAG,KAAK;AAC9C,MAAMC,kBAAkB,GAAG,IAAIC,GAAG,CAAa,CAAC;AAChD,MAAMC,kBAAkB,GAAIC,QAAo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AACP,OAAO,EAAED,KAAK,KAAK;MAC7BX,MAAM,CAACoB,YAAY,CAACvC,SAAS,CAACwC,QAAQ,CAACvB,OAAO,CAACa,KAAK,CAACE,SAAS,CAAC,EAAED,OAAO,CAAC;MACzE,IAAI9B,YAAY,CAACwC,QAAQ,CAAC,CAAC,CAACzB,IAAI,EAAEmB,EAAE,KAAKL,KAAK,CAACM,MAAM,EACnDnC,YAAY,CAACwC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAACX,OAAO,CAAC;IAC5C;EACF,CAAC,CAAC;EACF,SAASY,cAAcA,CAACC,IAAqB,EAAE;IAC7C,IAAI,CAACzC,kBAAkB,CAAC0C,QAAQ,CAACD,IAAI,CAAC,EAAE;IACxC,IAAI,CAAC7B,eAAe,EAAE;MACpBX,iBAAiB,GAAGwC,IAAI;MACxB,KAAK,MAAMpC,QAAQ,IAAIH,kBAAkB,EAAEG,QAAQ,CAAC,CAAC;MACrD;IACF;IACA,IAAIM,eAAe,IAAIE,IAAI,EAAEmB,EAAE,EAC7BV,QAAQ,CAACqB,MAAM,CAAC;MAAEzB,QAAQ,EAAEuB,IAAI;MAAEZ,SAAS,EAAElB,eAAe;MAAEsB,MAAM,EAAEpB,IAAI,CAACmB;IAAG,CAAC,CAAC;EACpF;EACA,OAAO;IAAEd,QAAQ;IAAEsB,cAAc;IAAEI,QAAQ,EAAEtB,QAAQ,CAACuB,SAAS;IAAEC,KAAK,EAAExB,QAAQ,CAACwB;EAAM,CAAC;AAC1F","ignoreList":[]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useQuery } from '@tanstack/react-query';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
import { convertDisplayAmount, readDisplayRates } from '@peable.to/sdk/display';
|
|
6
|
-
import { useDisplayCurrency } from "./useDisplayCurrency.js";
|
|
7
|
-
import { useI18n } from "./useI18n.js";
|
|
8
|
-
|
|
9
|
-
/** Display conversion only. Pricing and checkout request bodies retain their source units. */
|
|
10
|
-
export function useDisplayPrice() {
|
|
11
|
-
const {
|
|
12
|
-
currency
|
|
13
|
-
} = useDisplayCurrency();
|
|
14
|
-
const {
|
|
15
|
-
t
|
|
16
|
-
} = useI18n();
|
|
17
|
-
const [now, setNow] = useState(Date.now);
|
|
18
|
-
const rates = useQuery({
|
|
19
|
-
queryKey: ['display-currency', 'faircoin-indexed-price'],
|
|
20
|
-
queryFn: ({
|
|
21
|
-
signal
|
|
22
|
-
}) => readDisplayRates({
|
|
23
|
-
signal
|
|
24
|
-
}),
|
|
25
|
-
enabled: currency !== 'USD',
|
|
26
|
-
staleTime: 30_000,
|
|
27
|
-
gcTime: 0,
|
|
28
|
-
retry: false,
|
|
29
|
-
refetchInterval: 60_000,
|
|
30
|
-
refetchOnWindowFocus: 'always'
|
|
31
|
-
});
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
34
|
-
return () => clearInterval(timer);
|
|
35
|
-
}, []);
|
|
36
|
-
function formatUsd(minorUnits) {
|
|
37
|
-
const display = convertDisplayAmount({
|
|
38
|
-
units: String(minorUnits),
|
|
39
|
-
currency: 'USD',
|
|
40
|
-
displayCurrency: currency,
|
|
41
|
-
rates: rates.isError ? null : rates.data,
|
|
42
|
-
now
|
|
43
|
-
});
|
|
44
|
-
if (!display) return t('preferences.displayCurrency.unavailable', {
|
|
45
|
-
currency
|
|
46
|
-
});
|
|
47
|
-
return currency === 'USD' ? display : t('preferences.displayCurrency.approximate', {
|
|
48
|
-
amount: display
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
currency,
|
|
53
|
-
formatUsd
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=useDisplayPrice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","useEffect","useState","convertDisplayAmount","readDisplayRates","useDisplayCurrency","useI18n","useDisplayPrice","currency","t","now","setNow","Date","rates","queryKey","queryFn","signal","enabled","staleTime","gcTime","retry","refetchInterval","refetchOnWindowFocus","timer","setInterval","clearInterval","formatUsd","minorUnits","display","units","String","displayCurrency","isError","data","amount"],"sourceRoot":"../../../../src","sources":["ui/hooks/useDisplayPrice.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,wBAAwB;AAC/E,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,OAAO,QAAQ,cAAW;;AAEnC;AACA,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAM;IAAEC;EAAS,CAAC,GAAGH,kBAAkB,CAAC,CAAC;EACzC,MAAM;IAAEI;EAAE,CAAC,GAAGH,OAAO,CAAC,CAAC;EACvB,MAAM,CAACI,GAAG,EAAEC,MAAM,CAAC,GAAGT,QAAQ,CAACU,IAAI,CAACF,GAAG,CAAC;EACxC,MAAMG,KAAK,GAAGb,QAAQ,CAAC;IACrBc,QAAQ,EAAE,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;IACxDC,OAAO,EAAEA,CAAC;MAAEC;IAAO,CAAC,KAAKZ,gBAAgB,CAAC;MAAEY;IAAO,CAAC,CAAC;IACrDC,OAAO,EAAET,QAAQ,KAAK,KAAK;IAC3BU,SAAS,EAAE,MAAM;IACjBC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,KAAK;IACZC,eAAe,EAAE,MAAM;IACvBC,oBAAoB,EAAE;EACxB,CAAC,CAAC;EACFrB,SAAS,CAAC,MAAM;IACd,MAAMsB,KAAK,GAAGC,WAAW,CAAC,MAAMb,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACzD,OAAO,MAAMe,aAAa,CAACF,KAAK,CAAC;EACnC,CAAC,EAAE,EAAE,CAAC;EACN,SAASG,SAASA,CAACC,UAAkB,EAAE;IACrC,MAAMC,OAAO,GAAGzB,oBAAoB,CAAC;MACnC0B,KAAK,EAAEC,MAAM,CAACH,UAAU,CAAC;MACzBnB,QAAQ,EAAE,KAAK;MACfuB,eAAe,EAAEvB,QAAQ;MACzBK,KAAK,EAAEA,KAAK,CAACmB,OAAO,GAAG,IAAI,GAAGnB,KAAK,CAACoB,IAAI;MACxCvB;IACF,CAAC,CAAC;IACF,IAAI,CAACkB,OAAO,EAAE,OAAOnB,CAAC,CAAC,yCAAyC,EAAE;MAAED;IAAS,CAAC,CAAC;IAC/E,OAAOA,QAAQ,KAAK,KAAK,GACrBoB,OAAO,GACPnB,CAAC,CAAC,yCAAyC,EAAE;MAAEyB,MAAM,EAAEN;IAAQ,CAAC,CAAC;EACvE;EACA,OAAO;IAAEpB,QAAQ;IAAEkB;EAAU,CAAC;AAChC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountInvitationAcceptance.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/AccountInvitationAcceptance.tsx"],"names":[],"mappings":"AAQA,yFAAyF;AACzF,wBAAgB,2BAA2B,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,+BAEvE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayCurrencySelector.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/DisplayCurrencySelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,uBAAuB,sBA0BtC"}
|