@oxy.so/services 11.4.0 → 11.5.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/signIn/OxyEmailAccountChoice.js +113 -0
- package/lib/commonjs/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +70 -3
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/accountFlowParts.js +2 -0
- package/lib/commonjs/ui/components/signIn/accountFlowParts.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/PreferencesScreen.js +3 -4
- package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
- 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/signIn/OxyEmailAccountChoice.js +110 -0
- package/lib/module/ui/components/signIn/OxyEmailAccountChoice.js.map +1 -0
- 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/accountFlowParts.js +2 -0
- package/lib/module/ui/components/signIn/accountFlowParts.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/PreferencesScreen.js +3 -4
- package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
- 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/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/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/accountFlowParts.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/PreferencesScreen.d.ts.map +1 -1
- 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/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/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/accountFlowParts.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/PreferencesScreen.d.ts.map +1 -1
- package/package.json +5 -6
- 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/signIn/OxyEmailAccountChoice.tsx +116 -0
- package/src/ui/components/signIn/OxySignInPanel.tsx +89 -4
- package/src/ui/components/signIn/accountFlowParts.tsx +2 -0
- package/src/ui/screens/AccountMembersScreen.tsx +27 -71
- package/src/ui/screens/PreferencesScreen.tsx +0 -2
- 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
|
@@ -30,8 +30,13 @@ const ASSIGNABLE_ROLES: AssignableRole[] = ['admin', 'editor', 'developer', 'bil
|
|
|
30
30
|
const errorMessage = (error: unknown, fallback: string): string =>
|
|
31
31
|
error instanceof Error && error.message ? error.message : fallback;
|
|
32
32
|
|
|
33
|
+
const isUserNotFound = (error: unknown): boolean => {
|
|
34
|
+
const message = error instanceof Error ? error.message.toLowerCase() : '';
|
|
35
|
+
return message.includes('user not found') || message.includes('not found');
|
|
36
|
+
};
|
|
37
|
+
|
|
33
38
|
/**
|
|
34
|
-
* Manage the members of an account (invite by email, change roles,
|
|
39
|
+
* Manage the members of an account (invite by username/email, change roles,
|
|
35
40
|
* remove, transfer ownership). Gated on the caller's `callerMembership`
|
|
36
41
|
* permissions. Receives the target `accountId` via navigation props.
|
|
37
42
|
*/
|
|
@@ -81,27 +86,6 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
81
86
|
queryFn: () => oxyServices.accounts.members.list(id),
|
|
82
87
|
enabled: canUsePrivateApi && id.length > 0 && canRead,
|
|
83
88
|
});
|
|
84
|
-
const invitationsQuery = useQuery({
|
|
85
|
-
queryKey: ['account-invitations', id],
|
|
86
|
-
queryFn: () => oxyServices.accounts.invitations.list(id),
|
|
87
|
-
enabled: canUsePrivateApi && !!id && canRead,
|
|
88
|
-
});
|
|
89
|
-
const invitationAction = useMutation({
|
|
90
|
-
mutationFn: async ({
|
|
91
|
-
invitationId,
|
|
92
|
-
action,
|
|
93
|
-
}: {
|
|
94
|
-
invitationId: string;
|
|
95
|
-
action: 'resend' | 'cancel';
|
|
96
|
-
}) => {
|
|
97
|
-
if (action === 'resend') await oxyServices.accounts.invitations.resend(id, invitationId);
|
|
98
|
-
else await oxyServices.accounts.invitations.cancel(id, invitationId);
|
|
99
|
-
},
|
|
100
|
-
onSuccess: () => {
|
|
101
|
-
void invitationsQuery.refetch();
|
|
102
|
-
},
|
|
103
|
-
onError: (error) => toast.error(errorMessage(error, 'Could not update invitation')),
|
|
104
|
-
});
|
|
105
89
|
const members = useMemo<AccountMember[]>(() => membersQuery.data ?? [], [membersQuery.data]);
|
|
106
90
|
const memberUserIds = useMemo(
|
|
107
91
|
() => [...new Set(members.map((member) => member.memberUserId).filter((id) => id.length > 0))],
|
|
@@ -142,7 +126,6 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
142
126
|
// tables — mirror the SDK's per-account prefix sweep so every cached member
|
|
143
127
|
// list refetches, not only the account that was mutated.
|
|
144
128
|
queryClient.invalidateQueries({ queryKey: ['accounts', 'members'] });
|
|
145
|
-
queryClient.invalidateQueries({ queryKey: ['account-invitations', id] });
|
|
146
129
|
queryClient.invalidateQueries({ queryKey: ['accounts', 'detail', id] });
|
|
147
130
|
}, [queryClient, id]);
|
|
148
131
|
|
|
@@ -154,20 +137,24 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
154
137
|
const inviteMutation = useMutation({
|
|
155
138
|
mutationKey: ['accounts', 'members', 'invite', id],
|
|
156
139
|
mutationFn: (input: { usernameOrEmail: string; role: AssignableRole }) =>
|
|
157
|
-
oxyServices.accounts.
|
|
158
|
-
email: input.usernameOrEmail,
|
|
159
|
-
role: input.role,
|
|
160
|
-
}),
|
|
140
|
+
oxyServices.accounts.members.invite(id, input),
|
|
161
141
|
onSuccess: () => {
|
|
162
142
|
setInviteIdentifier('');
|
|
163
143
|
setInviteRole('editor');
|
|
164
144
|
setInviteError(null);
|
|
165
145
|
invalidateMembers();
|
|
166
|
-
toast.success('
|
|
146
|
+
toast.success(t('accounts.members.toasts.added') || 'Member added');
|
|
167
147
|
},
|
|
168
148
|
onError: (error) => {
|
|
169
|
-
|
|
170
|
-
|
|
149
|
+
if (isUserNotFound(error)) {
|
|
150
|
+
const message = t('accounts.members.errors.userNotFound') || 'User not found';
|
|
151
|
+
setInviteError(message);
|
|
152
|
+
toast.error(message);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
toast.error(
|
|
156
|
+
errorMessage(error, t('accounts.members.toasts.addFailed') || 'Failed to add member'),
|
|
157
|
+
);
|
|
171
158
|
},
|
|
172
159
|
});
|
|
173
160
|
|
|
@@ -220,12 +207,14 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
220
207
|
const handleInvite = useCallback(() => {
|
|
221
208
|
const usernameOrEmail = inviteIdentifier.trim();
|
|
222
209
|
if (!usernameOrEmail) {
|
|
223
|
-
setInviteError(
|
|
210
|
+
setInviteError(
|
|
211
|
+
t('accounts.members.errors.identifierRequired') || 'Enter a username or email to invite',
|
|
212
|
+
);
|
|
224
213
|
return;
|
|
225
214
|
}
|
|
226
215
|
setInviteError(null);
|
|
227
216
|
inviteMutation.mutate({ usernameOrEmail, role: inviteRole });
|
|
228
|
-
}, [inviteIdentifier, inviteRole, inviteMutation]);
|
|
217
|
+
}, [inviteIdentifier, inviteRole, inviteMutation, t]);
|
|
229
218
|
|
|
230
219
|
const handleChangeRole = useCallback(
|
|
231
220
|
(member: AccountMember, role: AccountRole) => {
|
|
@@ -293,11 +282,13 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
293
282
|
{/* Invite form */}
|
|
294
283
|
{canInvite ? (
|
|
295
284
|
<View className="gap-space-12 p-space-16 rounded-radius-20 bg-fill">
|
|
296
|
-
<Text className="text-body font-semibold text-text">
|
|
285
|
+
<Text className="text-body font-semibold text-text">
|
|
286
|
+
{t('accounts.members.invite.title') || 'Add a member'}
|
|
287
|
+
</Text>
|
|
297
288
|
<TextField isInvalid={!!inviteError}>
|
|
298
289
|
<TextFieldInput
|
|
299
290
|
floatingLabel
|
|
300
|
-
label={'
|
|
291
|
+
label={t('accounts.members.invite.identifierLabel') || 'Username or email'}
|
|
301
292
|
value={inviteIdentifier}
|
|
302
293
|
onChangeText={(value) => {
|
|
303
294
|
setInviteIdentifier(value);
|
|
@@ -341,49 +332,14 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
341
332
|
onPress={handleInvite}
|
|
342
333
|
disabled={inviteMutation.isPending || !inviteIdentifier.trim()}
|
|
343
334
|
loading={inviteMutation.isPending}
|
|
344
|
-
accessibilityLabel={'
|
|
335
|
+
accessibilityLabel={t('accounts.members.invite.submit') || 'Add member'}
|
|
345
336
|
className="w-full"
|
|
346
337
|
>
|
|
347
|
-
{'
|
|
338
|
+
{t('accounts.members.invite.submit') || 'Add member'}
|
|
348
339
|
</Button>
|
|
349
340
|
</View>
|
|
350
341
|
) : null}
|
|
351
342
|
|
|
352
|
-
{canRead ? (
|
|
353
|
-
<View className="gap-space-12">
|
|
354
|
-
<Text className="text-body font-semibold text-text">Pending invitations</Text>
|
|
355
|
-
{invitationsQuery.isError ? <Text>Could not load invitations.</Text> : null}
|
|
356
|
-
{(invitationsQuery.data ?? []).map((invitation) => (
|
|
357
|
-
<View key={invitation.id} className="gap-space-8 p-space-16 rounded-radius-20 bg-fill">
|
|
358
|
-
<Text>
|
|
359
|
-
{invitation.email} · {roleLabel(invitation.role)} · {invitation.status}
|
|
360
|
-
</Text>
|
|
361
|
-
<Text>Expires {new Date(invitation.expiresAt).toLocaleDateString()}</Text>
|
|
362
|
-
{canInvite ? (
|
|
363
|
-
<Button
|
|
364
|
-
disabled={invitationAction.isPending}
|
|
365
|
-
onPress={() =>
|
|
366
|
-
invitationAction.mutate({ invitationId: invitation.id, action: 'resend' })
|
|
367
|
-
}
|
|
368
|
-
>
|
|
369
|
-
Resend
|
|
370
|
-
</Button>
|
|
371
|
-
) : null}
|
|
372
|
-
{canRemove ? (
|
|
373
|
-
<Button
|
|
374
|
-
disabled={invitationAction.isPending}
|
|
375
|
-
onPress={() =>
|
|
376
|
-
invitationAction.mutate({ invitationId: invitation.id, action: 'cancel' })
|
|
377
|
-
}
|
|
378
|
-
>
|
|
379
|
-
Cancel invitation
|
|
380
|
-
</Button>
|
|
381
|
-
) : null}
|
|
382
|
-
</View>
|
|
383
|
-
))}
|
|
384
|
-
</View>
|
|
385
|
-
) : null}
|
|
386
|
-
|
|
387
343
|
{/* Member list */}
|
|
388
344
|
{canRead ? (
|
|
389
345
|
<View className="gap-space-8">
|
|
@@ -5,7 +5,6 @@ import { Switch } from '@oxy.so/bloom/switch';
|
|
|
5
5
|
import { useTheme } from '@oxy.so/bloom/theme';
|
|
6
6
|
import type { UserPreferences } from '@oxy.so/core';
|
|
7
7
|
import { getNativeLanguageName } from '@oxy.so/core';
|
|
8
|
-
import { DisplayCurrencySelector } from '../components/DisplayCurrencySelector';
|
|
9
8
|
import type { BaseScreenProps } from '../types/navigation';
|
|
10
9
|
import { SettingsIcon } from '../components/SettingsIcon';
|
|
11
10
|
import { useI18n } from '../hooks/useI18n';
|
|
@@ -159,7 +158,6 @@ const PreferencesScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, navigat
|
|
|
159
158
|
</SettingsListGroup>
|
|
160
159
|
|
|
161
160
|
<SettingsListGroup title={t('preferences.sections.region') || 'Region'}>
|
|
162
|
-
<DisplayCurrencySelector />
|
|
163
161
|
<SettingsListItem
|
|
164
162
|
icon={<SettingsIcon name="clock-outline" color={bloomTheme.colors.info} />}
|
|
165
163
|
title={t('preferences.items.timezone.title') || 'Timezone'}
|
|
@@ -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,IAAAF,WAAA,CAAAG,GAAA,EAACC,iBAAiB;IAAaF,KAAK,EAAEA;EAAM,GAApBA,KAAsB,CAAC;AACxD;AAEA,SAASE,iBAAiBA,CAAC;EAAEF;AAAyB,CAAC,EAAE;EACvD,MAAM;IAAEG,WAAW;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC;EAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAC3E,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAkC,IAAI,CAAC;EAC7E,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAF,eAAQ,EAAC,EAAE,CAAC;EACtC,MAAM,CAACG,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAJ,eAAQ,EAAC,KAAK,C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AA,CAAAG,GAAA,EAACP,WAAA,CAAAuC,IAAI;QAAAD,QAAA,EAAC;MAGN,CAAM,CAAC,eACP,IAAAlC,WAAA,CAAAG,GAAA,EAACN,OAAA,CAAAiD,MAAM;QAACC,QAAQ,EAAEhC,IAAK;QAACiC,OAAO,EAAEA,CAAA,KAAMxC,iBAAiB,CAAC,CAAE;QAAA0B,QAAA,EACxD5B,IAAI,GAAG,gBAAgB,GAAG;MAA2B,CAChD,CAAC,eACT,IAAAN,WAAA,CAAAG,GAAA,EAACN,OAAA,CAAAiD,MAAM;QAACC,QAAQ,EAAEhC,IAAI,IAAI,CAACT,IAAI,IAAI,CAACI,OAAO,IAAIJ,IAAI,CAAC2C,IAAI,KAAK,UAAW;QAACD,OAAO,EAAEnB,MAAO;QAAAK,QAAA,EAAC;MAE1F,CAAQ,CAAC;IAAA,CACT,CACH,EACArB,KAAK,gBAAG,IAAAb,WAAA,CAAAG,GAAA,EAACP,WAAA,CAAAuC,IAAI;MAACC,iBAAiB,EAAC,OAAO;MAAAF,QAAA,EAAErB;IAAK,CAAO,CAAC,GAAG,IAAI,EAC7D,CAACX,KAAK,gBAAG,IAAAF,WAAA,CAAAG,GAAA,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,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,uBAAuBA,CAAA,EAAG;EACxC,MAAM;IAAEC,QAAQ;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAG,IAAAC,sCAAkB,EAAC,CAAC;EAC1E,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,gBAAO,EAAC,CAAC;EACvB,oBACE,IAAAX,WAAA,CAAAY,IAAA,EAACjB,YAAA,CAAAkB,IAAI;IAAAC,QAAA,gBACH,IAAAd,WAAA,CAAAe,GAAA,EAAClB,WAAA,CAAAmB,IAAI;MAAAF,QAAA,EAAEJ,CAAC,CAAC,mCAAmC;IAAC,CAAO,CAAC,eACrD,IAAAV,WAAA,CAAAe,GAAA,EAACnB,iBAAA,CAAAqB,gBAAgB;MACfC,IAAI,EAAC,OAAO;MACZC,KAAK,EAAET,CAAC,CAAC,mCAAmC,CAAE;MAC9CU,KAAK,EAAEf,QAAS;MAChBgB,aAAa,EAAGD,KAAK,IAAK;QACxB,MAAME,QAAQ,GAAGC,sCAAkB,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,KAAKL,KAAK,CAAC;QAClE,IAAIE,QAAQ,IAAI,CAACf,QAAQ,EAAED,cAAc,CAACgB,QAAQ,CAAC;MACrD,CAAE;MAAAR,QAAA,EAEDS,sCAAkB,CAACG,GAAG,CAAEN,KAAK,iBAC5B,IAAApB,WAAA,CAAAe,GAAA,EAACnB,iBAAA,CAAA+B,oBAAoB;QAAaP,KAAK,EAAEA,KAAM;QAACQ,QAAQ,EAAErB,QAAS;QAAAO,QAAA,eACjE,IAAAd,WAAA,CAAAe,GAAA,EAACnB,iBAAA,CAAAiC,wBAAwB;UAAAf,QAAA,EAAEM;QAAK,CAA2B;MAAC,GADnCA,KAEL,CACvB;IAAC,CACc,CAAC,EAClBZ,KAAK,iBACJ,IAAAR,WAAA,CAAAe,GAAA,EAAClB,WAAA,CAAAmB,IAAI;MAACc,uBAAuB,EAAC,QAAQ;MAAAhB,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":";;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,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;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wB;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":"../../../../src","sources":["ui/components/AccountInvitationAcceptance.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAASC,uBAAuB,QAAQ,cAAc;AACtD,SAASC,MAAM,QAAQ,0BAAuB;;AAE9C;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AACA,OAAO,SAASC,2BAA2BA,CAAC;EAAEC;AAAyB,CAAC,EAAE;EACxE,oBAAON,IAAA,CAACO,iBAAiB;IAAaD,KAAK,EAAEA;EAAM,GAApBA,KAAsB,CAAC;AAC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IAAI,CAACqB,EAAE,KAAKrB,IAAI,CAAC+B,KAAK,IAAI/B,IAAI,CAACqB,EAAE,GAAG,GAClG,eAAe;MAAA,CACf,CAAC,eACP9B,IAAA,CAACL,IAAI;QAAAqC,QAAA,EAAC;MAGN,CAAM,CAAC,eACPhC,IAAA,CAACJ,MAAM;QAAC6C,QAAQ,EAAEzB,IAAK;QAAC0B,OAAO,EAAEA,CAAA,KAAM/B,iBAAiB,CAAC,CAAE;QAAAqB,QAAA,EACxDvB,IAAI,GAAG,gBAAgB,GAAG;MAA2B,CAChD,CAAC,eACTT,IAAA,CAACJ,MAAM;QAAC6C,QAAQ,EAAEzB,IAAI,IAAI,CAACP,IAAI,IAAI,CAACG,OAAO,IAAIH,IAAI,CAACkC,IAAI,KAAK,UAAW;QAACD,OAAO,EAAEb,MAAO;QAAAG,QAAA,EAAC;MAE1F,CAAQ,CAAC;IAAA,CACT,CACH,EACAlB,KAAK,gBAAGd,IAAA,CAACL,IAAI;MAACsC,iBAAiB,EAAC,OAAO;MAAAD,QAAA,EAAElB;IAAK,CAAO,CAAC,GAAG,IAAI,EAC7D,CAACR,KAAK,gBAAGN,IAAA,CAACL,IAAI;MAAAqC,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
|