@opexa/portal-components 0.0.722 → 0.0.724
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/components/DepositWithdrawal/PaymentMethods.js +5 -0
- package/dist/components/DepositWithdrawal/Withdrawal/GCashStandardCashInWithdrawal/GCashStandardCashInWithdrawal.js +1 -1
- package/dist/components/PortalProvider/PushNotifications.js +10 -2
- package/dist/components/SignIn/MobileNumberSignIn.js +23 -8
- package/dist/components/SignIn/NameAndPasswordSignIn.js +43 -16
- package/package.json +1 -1
|
@@ -86,6 +86,11 @@ const OPTIONS = [
|
|
|
86
86
|
label: 'GCash Webpay',
|
|
87
87
|
image: gcash,
|
|
88
88
|
},
|
|
89
|
+
{
|
|
90
|
+
value: 'GCASH_STANDARD_CASH_IN',
|
|
91
|
+
label: 'GCash Standard Cash In',
|
|
92
|
+
image: gcash,
|
|
93
|
+
},
|
|
89
94
|
];
|
|
90
95
|
export function PaymentMethods(props) {
|
|
91
96
|
const options = props.options?.length
|
|
@@ -55,7 +55,7 @@ export function GCashStandardCashInWithdrawal() {
|
|
|
55
55
|
});
|
|
56
56
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
57
57
|
const paymentSettings = paymentSettingsQuery.data;
|
|
58
|
-
const gatewaySettings = paymentSettings?.
|
|
58
|
+
const gatewaySettings = paymentSettings?.gcashStandardCashInWithdrawalGatewaySettings;
|
|
59
59
|
const minimumAmount = parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
60
60
|
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
61
61
|
const definition = z.object({
|
|
@@ -7,6 +7,8 @@ import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
|
7
7
|
import { registerFCMDevice } from '../../services/trigger.js';
|
|
8
8
|
export const LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY = 'push-notication-token';
|
|
9
9
|
export const PushNotification = () => {
|
|
10
|
+
console.log('remove listeners on each render to avoid duplicates');
|
|
11
|
+
PushNotifications.removeAllListeners();
|
|
10
12
|
const session = useSessionQuery();
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
const platform = Capacitor.getPlatform();
|
|
@@ -29,8 +31,11 @@ export const PushNotification = () => {
|
|
|
29
31
|
console.log('App resumed - checking push notification permissions');
|
|
30
32
|
});
|
|
31
33
|
PushNotifications.addListener('registration', async ({ value }) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
|
|
35
|
+
if (pushToken === value) {
|
|
36
|
+
console.log('Push token already registered, skipping re-registration.');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
34
39
|
localStorage.setItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY, value);
|
|
35
40
|
if (session.data?.status === 'authenticated') {
|
|
36
41
|
await registerFCMDevice({
|
|
@@ -55,6 +60,9 @@ export const PushNotification = () => {
|
|
|
55
60
|
console.info('🚀 Push action performed');
|
|
56
61
|
console.info(JSON.stringify(notification));
|
|
57
62
|
});
|
|
63
|
+
return () => {
|
|
64
|
+
PushNotifications.removeAllListeners();
|
|
65
|
+
};
|
|
58
66
|
}, [session.data?.status, session.data?.token]);
|
|
59
67
|
return null;
|
|
60
68
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Capacitor } from '@capacitor/core';
|
|
2
3
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
4
|
import dynamic from 'next/dynamic';
|
|
4
5
|
import Image from 'next/image';
|
|
@@ -22,11 +23,12 @@ import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
|
22
23
|
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
23
24
|
import pagcorLogo from '../../images/pagcor-round-icon.png';
|
|
24
25
|
import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
|
|
25
|
-
import { unregisterFCMDevice } from '../../services/trigger.js';
|
|
26
|
+
import { registerFCMDevice, unregisterFCMDevice } from '../../services/trigger.js';
|
|
26
27
|
import { Button } from '../../ui/Button/index.js';
|
|
27
28
|
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
28
29
|
import { Field } from '../../ui/Field/index.js';
|
|
29
30
|
import { PinInput } from '../../ui/PinInput/index.js';
|
|
31
|
+
import { LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY } from '../PortalProvider/PushNotifications.js';
|
|
30
32
|
import { FacebookSignInTrigger } from './FacebookSignInTrigger.js';
|
|
31
33
|
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
32
34
|
const GoogleSignInButton = dynamic(() => import('./GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
|
|
@@ -56,13 +58,26 @@ export function MobileNumberSignIn() {
|
|
|
56
58
|
globalStore.signIn.setOpen(false);
|
|
57
59
|
const session = await getSession();
|
|
58
60
|
invariant(session.status === 'authenticated');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (Capacitor.isNativePlatform()) {
|
|
62
|
+
const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
|
|
63
|
+
await unregisterFCMDevice({
|
|
64
|
+
type: ['IOS', 'ANDROID'],
|
|
65
|
+
}, {
|
|
66
|
+
headers: {
|
|
67
|
+
Authorization: `Bearer ${session.token}`,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (pushToken) {
|
|
71
|
+
await registerFCMDevice({
|
|
72
|
+
type: Capacitor.getPlatform() === 'android' ? 'ANDROID' : 'IOS',
|
|
73
|
+
token: pushToken,
|
|
74
|
+
}, {
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${session.token}`,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
66
81
|
if (signInProps.shouldShowResponsibleGamingReminder) {
|
|
67
82
|
globalStore.responsibleGamingReminder.setOpen(true);
|
|
68
83
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useDialogContext } from '@ark-ui/react/dialog';
|
|
3
|
+
import { Capacitor } from '@capacitor/core';
|
|
3
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
5
|
import dynamic from 'next/dynamic';
|
|
5
6
|
import Image from 'next/image';
|
|
@@ -21,11 +22,12 @@ import { EyeIcon } from '../../icons/EyeIcon.js';
|
|
|
21
22
|
import { EyeOffIcon } from '../../icons/EyeOffIcon.js';
|
|
22
23
|
import pagcorLogo from '../../images/pagcor-round-icon.png';
|
|
23
24
|
import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
|
|
24
|
-
import { unregisterFCMDevice } from '../../services/trigger.js';
|
|
25
|
+
import { registerFCMDevice, unregisterFCMDevice } from '../../services/trigger.js';
|
|
25
26
|
import { Button } from '../../ui/Button/index.js';
|
|
26
27
|
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
27
28
|
import { Field } from '../../ui/Field/index.js';
|
|
28
29
|
import { PasswordInput } from '../../ui/PasswordInput/index.js';
|
|
30
|
+
import { LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY } from '../PortalProvider/PushNotifications.js';
|
|
29
31
|
import { FacebookSignInTrigger } from './FacebookSignInTrigger.js';
|
|
30
32
|
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
31
33
|
const GoogleSignInButton = dynamic(() => import('./GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
|
|
@@ -56,13 +58,26 @@ export function NameAndPasswordSignIn() {
|
|
|
56
58
|
else {
|
|
57
59
|
const session = await getSession();
|
|
58
60
|
invariant(session.status === 'authenticated');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (Capacitor.isNativePlatform()) {
|
|
62
|
+
const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
|
|
63
|
+
await unregisterFCMDevice({
|
|
64
|
+
type: ['IOS', 'ANDROID'],
|
|
65
|
+
}, {
|
|
66
|
+
headers: {
|
|
67
|
+
Authorization: `Bearer ${session.token}`,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (pushToken) {
|
|
71
|
+
await registerFCMDevice({
|
|
72
|
+
type: Capacitor.getPlatform() === 'android' ? 'ANDROID' : 'IOS',
|
|
73
|
+
token: pushToken,
|
|
74
|
+
}, {
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${session.token}`,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
66
81
|
if (!hasSavedBiometry()) {
|
|
67
82
|
globalStore.registerBiometrics.setOpen(true);
|
|
68
83
|
}
|
|
@@ -95,20 +110,32 @@ export function NameAndPasswordSignIn() {
|
|
|
95
110
|
form.reset();
|
|
96
111
|
const session = await getSession();
|
|
97
112
|
invariant(session.status === 'authenticated');
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
if (Capacitor.isNativePlatform()) {
|
|
114
|
+
const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
|
|
115
|
+
await unregisterFCMDevice({
|
|
116
|
+
type: ['IOS', 'ANDROID'],
|
|
117
|
+
}, {
|
|
118
|
+
headers: {
|
|
119
|
+
Authorization: `Bearer ${session.token}`,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
if (pushToken) {
|
|
123
|
+
await registerFCMDevice({
|
|
124
|
+
type: Capacitor.getPlatform() === 'android' ? 'ANDROID' : 'IOS',
|
|
125
|
+
token: pushToken,
|
|
126
|
+
}, {
|
|
127
|
+
headers: {
|
|
128
|
+
Authorization: `Bearer ${session.token}`,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
105
133
|
if (signInProps.shouldShowResponsibleGamingReminder) {
|
|
106
134
|
globalStore.responsibleGamingReminder.setOpen(true);
|
|
107
135
|
}
|
|
108
136
|
if (signInProps.shouldShowDisclaimer) {
|
|
109
137
|
globalStore.disclaimer.setOpen(true);
|
|
110
138
|
}
|
|
111
|
-
console.log('hasSavedBiometry', hasSavedBiometry());
|
|
112
139
|
if (!hasSavedBiometry()) {
|
|
113
140
|
globalStore.registerBiometrics.setOpen(true);
|
|
114
141
|
}
|