@opexa/portal-components 0.0.1121 → 0.0.1122
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.d.ts +7 -2
- package/dist/client/hooks/useSignInMutation.js +3 -2
- package/dist/client/services/signIn.d.ts +2 -2
- package/dist/client/services/signIn.js +5 -1
- package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/SignIn/CrazyWin/MobileNumberSignIn.js +1 -0
- package/dist/components/SignIn/CrazyWin/NameAndPasswordSignIn.js +1 -0
- package/dist/components/SignIn/HappyBingo/MobileNumberSignIn.js +1 -0
- package/dist/components/SignIn/HappyBingo/NameAndPasswordSignIn.js +1 -0
- package/dist/components/SignIn/MobileNumberSignIn.js +1 -0
- package/dist/components/SignIn/MobileNumberSignInternational.js +1 -0
- package/dist/components/SignIn/NameAndPasswordSignIn.js +1 -0
- package/dist/components/SignIn/SignIn.lazy.d.ts +7 -0
- package/dist/components/SignIn/useSignIn.d.ts +2 -0
- package/dist/components/SignIn/useSignIn.js +11 -1
- package/dist/constants/HeaderKey.d.ts +1 -0
- package/dist/constants/HeaderKey.js +1 -0
- package/dist/handlers/postSession.js +4 -2
- package/dist/schemas/forgotPasswordSchema.d.ts +8 -8
- package/dist/services/auth.d.ts +7 -1
- package/dist/services/auth.js +6 -2
- 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 +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
- 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/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- 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 +306 -306
- package/dist/ui/Menu/menu.recipe.d.ts +17 -17
- 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 +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- 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/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
import type { VersionSession } from '../../services/auth';
|
|
3
|
+
import type { Authenticator, MutationConfig } from '../../types';
|
|
2
4
|
import { type SignInInput } from '../services/signIn';
|
|
3
|
-
export
|
|
5
|
+
export interface UseSignInMutationOptions extends MutationConfig<Authenticator | null, SignInInput> {
|
|
6
|
+
versionSession?: VersionSession;
|
|
7
|
+
}
|
|
8
|
+
export declare const useSignInMutation: (options?: UseSignInMutationOptions) => UseMutationResult<Authenticator | null, Error, SignInInput>;
|
|
@@ -7,9 +7,10 @@ import { getSignInMutationKey } from '../../utils/mutationKeys.js';
|
|
|
7
7
|
import { getSessionQueryKey } from '../../utils/queryKeys.js';
|
|
8
8
|
import { getSession } from '../services/getSession.js';
|
|
9
9
|
import { signIn } from '../services/signIn.js';
|
|
10
|
-
export const useSignInMutation = (
|
|
10
|
+
export const useSignInMutation = (options) => {
|
|
11
11
|
const queryClient = getQueryClient();
|
|
12
12
|
const recaptcha = useReCaptcha();
|
|
13
|
+
const { versionSession, ...config } = options ?? {};
|
|
13
14
|
return useMutation({
|
|
14
15
|
...config,
|
|
15
16
|
mutationKey: getSignInMutationKey(),
|
|
@@ -30,7 +31,7 @@ export const useSignInMutation = (config) => {
|
|
|
30
31
|
? { Channel: 'ANDROID' }
|
|
31
32
|
: { Channel: 'IOS' }),
|
|
32
33
|
},
|
|
33
|
-
});
|
|
34
|
+
}, versionSession);
|
|
34
35
|
if (!authenticator) {
|
|
35
36
|
await queryClient.invalidateQueries({
|
|
36
37
|
queryKey: getSessionQueryKey(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateSessionInput } from '../../services/auth';
|
|
1
|
+
import type { CreateSessionInput, VersionSession } from '../../services/auth';
|
|
2
2
|
import { type HttpRequestOptions } from '../../services/httpRequest';
|
|
3
3
|
import type { Authenticator } from '../../types';
|
|
4
4
|
export type SignInInput = CreateSessionInput;
|
|
5
|
-
export declare function signIn(input: SignInInput, options?: HttpRequestOptions): Promise<Authenticator | null>;
|
|
5
|
+
export declare function signIn(input: SignInInput, options?: HttpRequestOptions, versionSession?: VersionSession): Promise<Authenticator | null>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Capacitor } from '@capacitor/core';
|
|
2
|
+
import { SESSION_VERSION_HEADER_KEY } from '../../constants/index.js';
|
|
2
3
|
import { httpRequest, } from '../../services/httpRequest.js';
|
|
3
4
|
const platform = Capacitor.getPlatform();
|
|
4
|
-
export async function signIn(input, options) {
|
|
5
|
+
export async function signIn(input, options, versionSession = 'default') {
|
|
6
|
+
const headers = new Headers(options?.headers);
|
|
7
|
+
headers.set(SESSION_VERSION_HEADER_KEY, versionSession);
|
|
5
8
|
const res = await httpRequest.json('/api/sessions', {
|
|
6
9
|
...options,
|
|
10
|
+
headers,
|
|
7
11
|
body: JSON.stringify(input),
|
|
8
12
|
method: 'POST',
|
|
9
13
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const AurixPayQRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
status: "idle" | "
|
|
3
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
4
4
|
deposit: import("../../../../types").Deposit | null;
|
|
5
5
|
errorMessage: {
|
|
6
6
|
name: string;
|
|
@@ -13,7 +13,7 @@ export declare const AurixPayQRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useAurixPayQRPHDepositContext: () => {
|
|
16
|
-
status: "idle" | "
|
|
16
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
17
17
|
deposit: import("../../../../types").Deposit | null;
|
|
18
18
|
errorMessage: {
|
|
19
19
|
name: string;
|
package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
|
|
|
5
5
|
promo?: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function useAurixPayQRPHDeposit(): {
|
|
8
|
-
status: "idle" | "
|
|
8
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
9
9
|
deposit: Deposit | null;
|
|
10
10
|
errorMessage: {
|
|
11
11
|
name: string;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
3
|
view: "form" | "vca";
|
|
4
|
-
status: "waiting" | "
|
|
4
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -14,7 +14,7 @@ export declare const OnlineBankDepositContext: (props: {
|
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
16
|
view: "form" | "vca";
|
|
17
|
-
status: "waiting" | "
|
|
17
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
20
20
|
deposit: import("../../../../types").Deposit | null;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Deposit } from '../../../../types';
|
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
4
|
view: "form" | "vca";
|
|
5
|
-
status: "waiting" | "
|
|
5
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
8
8
|
deposit: Deposit | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
status: "idle" | "
|
|
3
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
4
4
|
deposit: import("../../../../types").Deposit | null;
|
|
5
5
|
errorMessage: {
|
|
6
6
|
name: string;
|
|
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
status: "idle" | "
|
|
16
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
17
17
|
deposit: import("../../../../types").Deposit | null;
|
|
18
18
|
errorMessage: {
|
|
19
19
|
name: string;
|
|
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
|
|
|
5
5
|
promo?: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function useQRPHDeposit(): {
|
|
8
|
-
status: "idle" | "
|
|
8
|
+
status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
|
|
9
9
|
deposit: Deposit | null;
|
|
10
10
|
errorMessage: {
|
|
11
11
|
name: string;
|
|
@@ -45,6 +45,7 @@ export function NameAndPasswordSignIn() {
|
|
|
45
45
|
disclaimer: ctx.disclaimer,
|
|
46
46
|
})));
|
|
47
47
|
const signInMutation = useSignInMutation({
|
|
48
|
+
versionSession: signInProps.versionSession,
|
|
48
49
|
onSuccess: async (authenticator) => {
|
|
49
50
|
if (authenticator) {
|
|
50
51
|
context.setStep(2);
|
|
@@ -42,6 +42,7 @@ export function NameAndPasswordSignIn() {
|
|
|
42
42
|
disclaimer: ctx.disclaimer,
|
|
43
43
|
})));
|
|
44
44
|
const signInMutation = useSignInMutation({
|
|
45
|
+
versionSession: signInProps.versionSession,
|
|
45
46
|
onSuccess: async (authenticator) => {
|
|
46
47
|
if (authenticator) {
|
|
47
48
|
context.setStep(2);
|
|
@@ -55,6 +55,7 @@ export function NameAndPasswordSignIn() {
|
|
|
55
55
|
})));
|
|
56
56
|
const [formType, setFormType] = useState('NAME_AND_PASSWORD');
|
|
57
57
|
const signInMutation = useSignInMutation({
|
|
58
|
+
versionSession: signInProps.versionSession,
|
|
58
59
|
onSuccess: async (authenticator) => {
|
|
59
60
|
if (authenticator) {
|
|
60
61
|
context.setStep(2);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ImageProps } from 'next/image';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { VersionSession } from '../../services/auth';
|
|
3
4
|
import type { CountryCode } from '../../utils/countries/types';
|
|
4
5
|
import { type UseSignInProps } from './useSignIn';
|
|
5
6
|
export interface ClassNameEntries {
|
|
@@ -24,5 +25,11 @@ export interface SignInProps extends UseSignInProps {
|
|
|
24
25
|
shouldShowResponsibleGamingReminder?: boolean;
|
|
25
26
|
shouldShowDisclaimer?: boolean;
|
|
26
27
|
variant?: 'crazywin' | 'happybingo';
|
|
28
|
+
/**
|
|
29
|
+
* Selects which auth session endpoint the sign-in flow targets.
|
|
30
|
+
* - `default` (default): `${AUTH_ENDPOINT}/sessions`
|
|
31
|
+
* - `Inplay`: `${AUTH_ENDPOINT}/v3/inplay/sessions`
|
|
32
|
+
*/
|
|
33
|
+
versionSession?: VersionSession;
|
|
27
34
|
}
|
|
28
35
|
export declare function SignIn(props: SignInProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export type SignInStep = 1 | 2 | (number & {});
|
|
2
2
|
export type SignInType = 'NAME_AND_PASSWORD' | 'MOBILE_NUMBER';
|
|
3
|
+
export type SignInActiveTab = 'Mobile' | 'Username';
|
|
3
4
|
export interface UseSignInProps {
|
|
4
5
|
types?: SignInType[];
|
|
5
6
|
defaultType?: SignInType;
|
|
7
|
+
defaultActiveTab?: SignInActiveTab;
|
|
6
8
|
}
|
|
7
9
|
export interface UseSignInReturn {
|
|
8
10
|
step: SignInStep;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
const ACTIVE_TAB_TYPE_MAP = {
|
|
3
|
+
Mobile: 'MOBILE_NUMBER',
|
|
4
|
+
Username: 'NAME_AND_PASSWORD',
|
|
5
|
+
};
|
|
2
6
|
export function useSignIn(props) {
|
|
3
7
|
const types = !props?.types?.length
|
|
4
8
|
? ['MOBILE_NUMBER', 'NAME_AND_PASSWORD']
|
|
5
9
|
: props.types;
|
|
10
|
+
const defaultActiveType = props?.defaultActiveTab
|
|
11
|
+
? ACTIVE_TAB_TYPE_MAP[props.defaultActiveTab]
|
|
12
|
+
: props?.defaultType ?? ACTIVE_TAB_TYPE_MAP.Mobile;
|
|
13
|
+
const initialType = types.includes(defaultActiveType)
|
|
14
|
+
? defaultActiveType
|
|
15
|
+
: types[0];
|
|
6
16
|
const [step, setStep] = useState(1);
|
|
7
|
-
const [type, setType] = useState(
|
|
17
|
+
const [type, setType] = useState(initialType);
|
|
8
18
|
return {
|
|
9
19
|
step,
|
|
10
20
|
setStep,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addDays, addMinutes, subMinutes } from 'date-fns';
|
|
2
2
|
import { NextResponse } from 'next/server';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { ACCESS_TOKEN_COOKIE_NAME, DOMAIN_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, } from '../constants/index.js';
|
|
4
|
+
import { ACCESS_TOKEN_COOKIE_NAME, DOMAIN_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, SESSION_VERSION_HEADER_KEY, } from '../constants/index.js';
|
|
5
5
|
import { createSession } from '../services/auth.js';
|
|
6
6
|
const CreateSessionDefinition = z.union([
|
|
7
7
|
z.object({
|
|
@@ -41,6 +41,8 @@ export async function postSession(request) {
|
|
|
41
41
|
}
|
|
42
42
|
const recaptcha = request.headers.get(RECAPTCHA_HEADER_KEY);
|
|
43
43
|
const domain = request.headers.get(DOMAIN_HEADER_KEY);
|
|
44
|
+
const versionSessionHeader = request.headers.get(SESSION_VERSION_HEADER_KEY);
|
|
45
|
+
const versionSession = versionSessionHeader === 'Inplay' ? 'Inplay' : 'default';
|
|
44
46
|
try {
|
|
45
47
|
const res = await createSession(parsed.data, {
|
|
46
48
|
headers: {
|
|
@@ -58,7 +60,7 @@ export async function postSession(request) {
|
|
|
58
60
|
}),
|
|
59
61
|
...(channel && { Channel: channel }),
|
|
60
62
|
},
|
|
61
|
-
});
|
|
63
|
+
}, versionSession);
|
|
62
64
|
if (res.authenticator) {
|
|
63
65
|
return NextResponse.json({
|
|
64
66
|
ok: true,
|
|
@@ -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
|
-
password: string;
|
|
12
|
-
verificationCode: string;
|
|
13
11
|
mobileNumber: string;
|
|
12
|
+
verificationCode: string;
|
|
13
|
+
password: string;
|
|
14
14
|
confirmPassword: string;
|
|
15
15
|
}, {
|
|
16
|
-
password: string;
|
|
17
|
-
verificationCode: string;
|
|
18
16
|
mobileNumber: string;
|
|
17
|
+
verificationCode: string;
|
|
18
|
+
password: string;
|
|
19
19
|
confirmPassword: string;
|
|
20
20
|
}>, {
|
|
21
|
-
password: string;
|
|
22
|
-
verificationCode: string;
|
|
23
21
|
mobileNumber: string;
|
|
22
|
+
verificationCode: string;
|
|
23
|
+
password: string;
|
|
24
24
|
confirmPassword: string;
|
|
25
25
|
}, {
|
|
26
|
-
password: string;
|
|
27
|
-
verificationCode: string;
|
|
28
26
|
mobileNumber: string;
|
|
27
|
+
verificationCode: string;
|
|
28
|
+
password: string;
|
|
29
29
|
confirmPassword: string;
|
|
30
30
|
}>;
|
|
31
31
|
export type ForgotPasswordSchema = z.infer<ReturnType<typeof createForgotPasswordSchema>>;
|
package/dist/services/auth.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface CreateSessionInput__Token {
|
|
|
22
22
|
token: string;
|
|
23
23
|
}
|
|
24
24
|
export type CreateSessionInput = CreateSessionInput__UsernameAndPassword | CreateSessionInput__MobileNumber | CreateSessionInput__Maya | CreateSessionInput__Token;
|
|
25
|
+
/**
|
|
26
|
+
* Controls which auth endpoint is used to create a session.
|
|
27
|
+
* - `default` -> `${AUTH_ENDPOINT}/sessions`
|
|
28
|
+
* - `Inplay` -> `${AUTH_ENDPOINT}/v3/inplay/sessions`
|
|
29
|
+
*/
|
|
30
|
+
export type VersionSession = 'default' | 'Inplay';
|
|
25
31
|
export interface CreateSessionTwoFactorAuthDisabledMutation {
|
|
26
32
|
session: {
|
|
27
33
|
id: string;
|
|
@@ -46,7 +52,7 @@ export interface CreateSessionTwoFactorAuthEnabledMutation {
|
|
|
46
52
|
authenticator: Authenticator;
|
|
47
53
|
}
|
|
48
54
|
export type CreateSessionMutation = CreateSessionTwoFactorAuthDisabledMutation | CreateSessionTwoFactorAuthEnabledMutation;
|
|
49
|
-
export declare function createSession(input: CreateSessionInput, options?: HttpRequestOptions): Promise<CreateSessionMutation>;
|
|
55
|
+
export declare function createSession(input: CreateSessionInput, options?: HttpRequestOptions, versionSession?: VersionSession): Promise<CreateSessionMutation>;
|
|
50
56
|
export declare function createSessionLibangan(input: CreateSessionInput__Libangan, options?: HttpRequestOptions): Promise<{
|
|
51
57
|
session: {
|
|
52
58
|
id: string;
|
package/dist/services/auth.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { AUTH_ENDPOINT } from '../constants/index.js';
|
|
2
2
|
import { httpRequest } from './httpRequest.js';
|
|
3
3
|
import { sha256 } from './sha256.js';
|
|
4
|
-
|
|
4
|
+
const SESSION_ENDPOINTS = {
|
|
5
|
+
default: '/sessions',
|
|
6
|
+
Inplay: '/v3/inplay/sessions',
|
|
7
|
+
};
|
|
8
|
+
export async function createSession(input, options, versionSession = 'default') {
|
|
5
9
|
const headers = new Headers();
|
|
6
10
|
if (input.type === 'NAME_AND_PASSWORD') {
|
|
7
11
|
const password = await sha256(input.password);
|
|
@@ -26,7 +30,7 @@ export async function createSession(input, options) {
|
|
|
26
30
|
headers.set(key, value);
|
|
27
31
|
});
|
|
28
32
|
try {
|
|
29
|
-
return await httpRequest.json(`${AUTH_ENDPOINT}
|
|
33
|
+
return await httpRequest.json(`${AUTH_ENDPOINT}${SESSION_ENDPOINTS[versionSession]}`, {
|
|
30
34
|
...options,
|
|
31
35
|
method: 'POST',
|
|
32
36
|
headers,
|