@opexa/portal-components 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useSignInMutation.js +30 -1
- package/dist/schemas/forgotPasswordSchema.d.ts +8 -8
- package/dist/services/queries.d.ts +2 -0
- package/dist/services/queries.js +14 -0
- package/dist/services/trigger.d.ts +22 -1
- package/dist/services/trigger.js +21 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Avatar/Avatar.d.ts +9 -9
- package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +72 -72
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +144 -144
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/PinInput/PinInput.d.ts +12 -12
- package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +121 -121
- package/dist/ui/Popover/popover.recipe.d.ts +11 -11
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
3
3
|
import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
|
|
4
4
|
import { useReCaptcha } from 'next-recaptcha-v3';
|
|
5
5
|
import { FINGERPRINT_HEADER_KEY, RECAPTCHA_HEADER_KEY } from '../../constants/index.js';
|
|
6
|
+
import { createPoll } from '../../utils/createPoll.js';
|
|
6
7
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
7
8
|
import { getSignInMutationKey } from '../../utils/mutationKeys.js';
|
|
8
9
|
import { getSessionQueryKey } from '../../utils/queryKeys.js';
|
|
@@ -21,7 +22,7 @@ export const useSignInMutation = (options) => {
|
|
|
21
22
|
? await recaptcha.executeRecaptcha('submit')
|
|
22
23
|
: null;
|
|
23
24
|
const fingerprint = versionSession === 'Inplay' ? await getFingerprint() : null;
|
|
24
|
-
const
|
|
25
|
+
const signInOnce = () => signIn(input, {
|
|
25
26
|
headers: {
|
|
26
27
|
...(token && {
|
|
27
28
|
[RECAPTCHA_HEADER_KEY]: token,
|
|
@@ -37,6 +38,9 @@ export const useSignInMutation = (options) => {
|
|
|
37
38
|
: { Channel: 'IOS' }),
|
|
38
39
|
},
|
|
39
40
|
}, versionSession);
|
|
41
|
+
const authenticator = versionSession === 'Inplay' && input.type === 'NAME_AND_PASSWORD'
|
|
42
|
+
? await pollSignIn(signInOnce)
|
|
43
|
+
: await signInOnce();
|
|
40
44
|
if (!authenticator) {
|
|
41
45
|
await queryClient.invalidateQueries({
|
|
42
46
|
queryKey: getSessionQueryKey(),
|
|
@@ -46,6 +50,31 @@ export const useSignInMutation = (options) => {
|
|
|
46
50
|
},
|
|
47
51
|
});
|
|
48
52
|
};
|
|
53
|
+
async function pollSignIn(signInOnce) {
|
|
54
|
+
const poll = createPoll(async () => {
|
|
55
|
+
try {
|
|
56
|
+
return {
|
|
57
|
+
ok: true,
|
|
58
|
+
authenticator: await signInOnce(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
error,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
until: (result) => result.ok,
|
|
69
|
+
interval: 1500,
|
|
70
|
+
maxAttempt: 5,
|
|
71
|
+
});
|
|
72
|
+
const result = await poll();
|
|
73
|
+
if (!result.ok) {
|
|
74
|
+
throw result.error;
|
|
75
|
+
}
|
|
76
|
+
return result.authenticator;
|
|
77
|
+
}
|
|
49
78
|
let thumbmark_instance;
|
|
50
79
|
async function getFingerprint() {
|
|
51
80
|
if (typeof window === 'undefined')
|
|
@@ -8,24 +8,24 @@ export declare const createForgotPasswordSchema: (mobileNumberParser: MobileNumb
|
|
|
8
8
|
mobileNumber: z.ZodEffects<z.ZodString, string, string>;
|
|
9
9
|
verificationCode: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
mobileNumber: string;
|
|
12
|
-
verificationCode: string;
|
|
13
11
|
password: string;
|
|
12
|
+
verificationCode: string;
|
|
13
|
+
mobileNumber: string;
|
|
14
14
|
confirmPassword: string;
|
|
15
15
|
}, {
|
|
16
|
-
mobileNumber: string;
|
|
17
|
-
verificationCode: string;
|
|
18
16
|
password: string;
|
|
17
|
+
verificationCode: string;
|
|
18
|
+
mobileNumber: string;
|
|
19
19
|
confirmPassword: string;
|
|
20
20
|
}>, {
|
|
21
|
-
mobileNumber: string;
|
|
22
|
-
verificationCode: string;
|
|
23
21
|
password: string;
|
|
22
|
+
verificationCode: string;
|
|
23
|
+
mobileNumber: string;
|
|
24
24
|
confirmPassword: string;
|
|
25
25
|
}, {
|
|
26
|
-
mobileNumber: string;
|
|
27
|
-
verificationCode: string;
|
|
28
26
|
password: string;
|
|
27
|
+
verificationCode: string;
|
|
28
|
+
mobileNumber: string;
|
|
29
29
|
confirmPassword: string;
|
|
30
30
|
}>;
|
|
31
31
|
export type ForgotPasswordSchema = z.infer<ReturnType<typeof createForgotPasswordSchema>>;
|
|
@@ -135,6 +135,8 @@ export declare const JACKPOTS_COUNT = "\n query JackpotsCount($filter: JackpotF
|
|
|
135
135
|
export declare const JACKPOT_PAYOUTS = "\n query JackpotPayouts(\n $first: Int\n $after: Cursor\n $sort: JackpotPayoutSortInput\n $filter: JackpotPayoutFilterInput\n ) {\n jackpotPayouts(first: $first, after: $after, sort: $sort, filter: $filter) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n ... on JackpotPayout {\n id\n member {\n id\n name\n }\n serialCode\n jackpot {\n id\n name\n }\n multiplier\n bet\n amount\n dateTimeCreated\n game {\n provider\n }\n stage\n }\n }\n }\n }\n }\n";
|
|
136
136
|
export declare const REGISTER_FCM_DEVICE = "\n mutation RegisterFCMDevice($input: RegisterFCMDeviceInput!) {\n registerFCMDevice(input: $input)\n }\n";
|
|
137
137
|
export declare const UNREGISTER_FCM_DEVICE = "\n mutation UnregisterFCMDevice($input: UnregisterFCMDeviceInput!) {\n unregisterFCMDevice(input: $input)\n }\n";
|
|
138
|
+
export declare const LINK_FIREBASE_CLOUD_MESSAGING_DEVICE = "\n mutation LinkFirebaseCloudMessagingDevice(\n $input: LinkFirebaseCloudMessagingDeviceInput!\n ) {\n linkFirebaseCloudMessagingDevice(input: $input)\n }\n";
|
|
139
|
+
export declare const UNLINK_FIREBASE_CLOUD_MESSAGING_DEVICE = "\n mutation UnlinkFirebaseCloudMessagingDevice(\n $input: UnlinkFirebaseCloudMessagingDeviceInput!\n ) {\n unlinkFirebaseCloudMessagingDevice(input: $input)\n }\n";
|
|
138
140
|
export declare const MARK_GAME_AS_FAVORITE = "\n mutation MarkGameAsFavorite($input: MarkGameAsFavoriteInput!) {\n markGameAsFavorite(input: $input)\n }\n";
|
|
139
141
|
export declare const UNMARK_GAME_AS_FAVORITE = "\n mutation UnmarkGameAsFavorite($input: UnmarkGameAsFavoriteInput!) {\n unmarkGameAsFavorite(input: $input)\n }\n";
|
|
140
142
|
export declare const FAVORITE_GAMES = "\n query FavoriteGames {\n favoriteGames {\n ... on Game {\n id\n name\n type\n provider\n }\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -3267,6 +3267,20 @@ export const UNREGISTER_FCM_DEVICE = /* GraphQL */ `
|
|
|
3267
3267
|
unregisterFCMDevice(input: $input)
|
|
3268
3268
|
}
|
|
3269
3269
|
`;
|
|
3270
|
+
export const LINK_FIREBASE_CLOUD_MESSAGING_DEVICE = /* GraphQL */ `
|
|
3271
|
+
mutation LinkFirebaseCloudMessagingDevice(
|
|
3272
|
+
$input: LinkFirebaseCloudMessagingDeviceInput!
|
|
3273
|
+
) {
|
|
3274
|
+
linkFirebaseCloudMessagingDevice(input: $input)
|
|
3275
|
+
}
|
|
3276
|
+
`;
|
|
3277
|
+
export const UNLINK_FIREBASE_CLOUD_MESSAGING_DEVICE = /* GraphQL */ `
|
|
3278
|
+
mutation UnlinkFirebaseCloudMessagingDevice(
|
|
3279
|
+
$input: UnlinkFirebaseCloudMessagingDeviceInput!
|
|
3280
|
+
) {
|
|
3281
|
+
unlinkFirebaseCloudMessagingDevice(input: $input)
|
|
3282
|
+
}
|
|
3283
|
+
`;
|
|
3270
3284
|
export const MARK_GAME_AS_FAVORITE = /* GraphQL */ `
|
|
3271
3285
|
mutation MarkGameAsFavorite($input: MarkGameAsFavoriteInput!) {
|
|
3272
3286
|
markGameAsFavorite(input: $input)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Simplify, SimplifyDeep } from 'type-fest';
|
|
2
|
-
import type { BooleanFilterField, FCMDeviceType, Message, PaginatedQuery, Quest } from '../types';
|
|
2
|
+
import type { BooleanFilterField, FCMDeviceType, FirebaseCloudMessagingDeviceType, Message, PaginatedQuery, Quest } from '../types';
|
|
3
3
|
import { type GraphQLRequestOptions } from './graphqlRequest';
|
|
4
4
|
export interface MessagesQueryVariables {
|
|
5
5
|
first?: number;
|
|
@@ -92,3 +92,24 @@ export interface UnregisterFCMDeviceMutation {
|
|
|
92
92
|
}
|
|
93
93
|
export type UnregisterFCMDeviceInput = Simplify<UnregisterFCMDeviceMutationVariables['input']>;
|
|
94
94
|
export declare const unregisterFCMDevice: (input: UnregisterFCMDeviceInput, options?: GraphQLRequestOptions) => Promise<void>;
|
|
95
|
+
export interface LinkFirebaseCloudMessagingDeviceMutationVariables {
|
|
96
|
+
input: {
|
|
97
|
+
token: string;
|
|
98
|
+
type: FirebaseCloudMessagingDeviceType;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface LinkFirebaseCloudMessagingDeviceMutation {
|
|
102
|
+
linkFirebaseCloudMessagingDevice: boolean;
|
|
103
|
+
}
|
|
104
|
+
export type LinkFirebaseCloudMessagingDeviceInput = Simplify<LinkFirebaseCloudMessagingDeviceMutationVariables['input']>;
|
|
105
|
+
export declare const linkFirebaseCloudMessagingDevice: (input: LinkFirebaseCloudMessagingDeviceInput, options?: GraphQLRequestOptions) => Promise<void>;
|
|
106
|
+
export interface UnlinkFirebaseCloudMessagingDeviceMutationVariables {
|
|
107
|
+
input: {
|
|
108
|
+
token?: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export interface UnlinkFirebaseCloudMessagingDeviceMutation {
|
|
112
|
+
unlinkFirebaseCloudMessagingDevice: boolean;
|
|
113
|
+
}
|
|
114
|
+
export type UnlinkFirebaseCloudMessagingDeviceInput = Simplify<UnlinkFirebaseCloudMessagingDeviceMutationVariables['input']>;
|
|
115
|
+
export declare const unlinkFirebaseCloudMessagingDevice: (input: UnlinkFirebaseCloudMessagingDeviceInput, options?: GraphQLRequestOptions) => Promise<void>;
|
package/dist/services/trigger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cache } from 'react';
|
|
2
2
|
import { TRIGGER_GRAPHQL_ENDPOINT } from '../constants/index.js';
|
|
3
3
|
import { graphqlRequest } from './graphqlRequest.js';
|
|
4
|
-
import { AVAILABLE_QUEST_IDS, AVAILABLE_QUESTS, CHECK_IN_DAILY_QUEST, CLAIM_REWARD, MARK_ALL_MESSAGES_AS_READ, MARK_MESSAGE_AS_READ, MESSAGES, REGISTER_FCM_DEVICE, UNREAD_MESSAGES_COUNT, UNREGISTER_FCM_DEVICE, } from './queries.js';
|
|
4
|
+
import { AVAILABLE_QUEST_IDS, AVAILABLE_QUESTS, CHECK_IN_DAILY_QUEST, CLAIM_REWARD, LINK_FIREBASE_CLOUD_MESSAGING_DEVICE, MARK_ALL_MESSAGES_AS_READ, MARK_MESSAGE_AS_READ, MESSAGES, REGISTER_FCM_DEVICE, UNLINK_FIREBASE_CLOUD_MESSAGING_DEVICE, UNREAD_MESSAGES_COUNT, UNREGISTER_FCM_DEVICE, } from './queries.js';
|
|
5
5
|
export const getMessages = cache(async (input, options) => {
|
|
6
6
|
const res = await graphqlRequest(TRIGGER_GRAPHQL_ENDPOINT, MESSAGES, input, options);
|
|
7
7
|
return res.messages;
|
|
@@ -86,6 +86,26 @@ export const unregisterFCMDevice = async (input, options) => {
|
|
|
86
86
|
throw error;
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
+
export const linkFirebaseCloudMessagingDevice = async (input, options) => {
|
|
90
|
+
const res = await graphqlRequest(TRIGGER_GRAPHQL_ENDPOINT, LINK_FIREBASE_CLOUD_MESSAGING_DEVICE, { input }, options);
|
|
91
|
+
if (!res.linkFirebaseCloudMessagingDevice) {
|
|
92
|
+
const error = new Error();
|
|
93
|
+
error.name = 'UnknownError';
|
|
94
|
+
error.message = 'Something went wrong.';
|
|
95
|
+
Error.captureStackTrace?.(error, linkFirebaseCloudMessagingDevice);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export const unlinkFirebaseCloudMessagingDevice = async (input, options) => {
|
|
100
|
+
const res = await graphqlRequest(TRIGGER_GRAPHQL_ENDPOINT, UNLINK_FIREBASE_CLOUD_MESSAGING_DEVICE, { input }, options);
|
|
101
|
+
if (!res.unlinkFirebaseCloudMessagingDevice) {
|
|
102
|
+
const error = new Error();
|
|
103
|
+
error.name = 'UnknownError';
|
|
104
|
+
error.message = 'Something went wrong.';
|
|
105
|
+
Error.captureStackTrace?.(error, unlinkFirebaseCloudMessagingDevice);
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
89
109
|
const ERROR_CODES_MESSAGE_MAP = {
|
|
90
110
|
RewardAlreadyExpiredError: 'Reward is either expired or no longer available',
|
|
91
111
|
RewardAlreadyClaimedError: 'Reward is already claimed',
|
package/dist/types/index.d.ts
CHANGED