@opexa/portal-components 0.0.241 → 0.0.243
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/useCamera.d.ts +6 -1
- package/dist/client/hooks/useCamera.js +57 -12
- package/dist/client/hooks/useFeatureFlag.d.ts +21 -5
- package/dist/client/hooks/useFeatureFlag.js +49 -9
- package/dist/components/Bonus/Bonus.client.js +1 -1
- package/dist/components/Cashback/Cashback.client.js +1 -1
- package/dist/components/CustomPromo/CustomPromo.js +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/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +2 -1
- package/dist/components/DepositWithdrawal/utils.d.ts +3 -0
- package/dist/components/DepositWithdrawal/utils.js +31 -0
- package/dist/components/GameLaunch/GameLaunch.lazy.js +1 -1
- package/dist/components/GamesSearch/GamesSearch.js +1 -1
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/KYC/AutoOpen.js +3 -8
- package/dist/components/KYC/utils.js +18 -18
- package/dist/components/Messages/Message.js +3 -2
- package/dist/components/Messages/MessagePopup.js +3 -2
- package/dist/components/News/News.js +1 -1
- package/dist/components/PortalProvider/FeatureFlag.d.ts +1 -0
- package/dist/components/PortalProvider/FeatureFlag.js +26 -0
- package/dist/components/PortalProvider/PortalProvider.js +2 -1
- package/dist/components/Promo/Promo.client.js +1 -1
- package/dist/components/Search/Search.lazy.js +1 -1
- package/dist/components/SignIn/MobileNumberSignIn.js +4 -2
- package/dist/components/SignIn/NameAndPasswordSignIn.js +3 -2
- package/dist/components/SignUp/SignUpForm.js +0 -4
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
- package/dist/components/shared/IdDocumentField.js +18 -27
- package/dist/components/shared/SelfieField.d.ts +1 -3
- package/dist/components/shared/SelfieField.js +120 -123
- package/dist/constants/StorageKey.d.ts +1 -0
- package/dist/constants/StorageKey.js +1 -0
- package/dist/services/httpRequest.js +25 -4
- package/dist/services/queries.js +2527 -2527
- package/dist/styles/theme.css +694 -694
- 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/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 +88 -88
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- 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/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/utils/resizeImageSize.d.ts +1 -0
- package/dist/utils/resizeImageSize.js +5 -0
- package/package.json +165 -169
- package/dist/client/hooks/index.d.ts +0 -65
- package/dist/client/hooks/index.js +0 -65
- package/dist/client/services/index.d.ts +0 -4
- package/dist/client/services/index.js +0 -4
- package/dist/client/utils/index.d.ts +0 -3
- package/dist/client/utils/index.js +0 -3
- package/dist/components/CashbackBonus/CashbackBonus.client.d.ts +0 -2
- package/dist/components/CashbackBonus/CashbackBonus.client.js +0 -9
- package/dist/components/CashbackBonus/CashbackBonus.d.ts +0 -10
- package/dist/components/CashbackBonus/CashbackBonus.js +0 -5
- package/dist/components/CashbackBonus/index.d.ts +0 -1
- package/dist/components/CashbackBonus/index.js +0 -1
- package/dist/components/Empty.d.ts +0 -9
- package/dist/components/Empty.js +0 -7
- package/dist/components/Games/GameContext.d.ts +0 -2
- package/dist/components/Games/GameContext.js +0 -2
- package/dist/components/InfiniteScroll.d.ts +0 -10
- package/dist/components/InfiniteScroll.js +0 -25
- package/dist/components/JackpotCounter/JackpotCounter.client.d.ts +0 -2
- package/dist/components/JackpotCounter/JackpotCounter.client.js +0 -66
- package/dist/components/JackpotCounter/JackpotCounter.d.ts +0 -17
- package/dist/components/JackpotCounter/JackpotCounter.js +0 -21
- package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +0 -18
- package/dist/components/JackpotCounter/JackpotCounterItem.js +0 -109
- package/dist/components/JackpotCounter/JackpotCounterItem.module.css +0 -184
- package/dist/components/JackpotCounter/index.d.ts +0 -1
- package/dist/components/JackpotCounter/index.js +0 -1
- package/dist/components/Jackpots/JackpotDesktop.d.ts +0 -1
- package/dist/components/Jackpots/JackpotDesktop.js +0 -45
- package/dist/components/Jackpots/JackpotGameProviders.d.ts +0 -5
- package/dist/components/Jackpots/JackpotGameProviders.js +0 -41
- package/dist/components/Jackpots/JackpotItemDesktop.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemDesktop.js +0 -43
- package/dist/components/Jackpots/JackpotItemMobile.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemMobile.js +0 -44
- package/dist/components/Jackpots/JackpotMobile.d.ts +0 -1
- package/dist/components/Jackpots/JackpotMobile.js +0 -46
- package/dist/components/Jackpots/JackpotRules.d.ts +0 -5
- package/dist/components/Jackpots/JackpotRules.js +0 -11
- package/dist/components/Jackpots/Jackpots.client.d.ts +0 -2
- package/dist/components/Jackpots/Jackpots.client.js +0 -29
- package/dist/components/Jackpots/JackpotsContext.d.ts +0 -4
- package/dist/components/Jackpots/JackpotsContext.js +0 -3
- package/dist/components/Jackpots/useJackpotData.d.ts +0 -14
- package/dist/components/Jackpots/useJackpotData.js +0 -93
- package/dist/components/Jackpots/useJackpotItemData.d.ts +0 -20
- package/dist/components/Jackpots/useJackpotItemData.js +0 -87
- package/dist/components/KYC/Header.d.ts +0 -1
- package/dist/components/KYC/Header.js +0 -8
- package/dist/components/KYC/Step1.d.ts +0 -1
- package/dist/components/KYC/Step1.js +0 -13
- package/dist/components/KYC/Step2.d.ts +0 -1
- package/dist/components/KYC/Step2.js +0 -13
- package/dist/components/KYC/Step3.d.ts +0 -1
- package/dist/components/KYC/Step3.js +0 -13
- package/dist/components/KYC/Step4.d.ts +0 -1
- package/dist/components/KYC/Step4.js +0 -7
- package/dist/components/Messages/MessageItem.d.ts +0 -4
- package/dist/components/Messages/MessageItem.js +0 -34
- package/dist/components/Promo/PromoContent.d.ts +0 -2
- package/dist/components/Promo/PromoContent.js +0 -9
- package/dist/components/Promos/PromoCarousel.d.ts +0 -2
- package/dist/components/Promos/PromoCarousel.js +0 -41
- package/dist/components/Promos/PromoGrid.d.ts +0 -2
- package/dist/components/Promos/PromoGrid.js +0 -12
- package/dist/components/Promos/PromoItem.d.ts +0 -7
- package/dist/components/Promos/PromoItem.js +0 -10
- package/dist/components/TournamentCounter/TournamentCounter.client.d.ts +0 -2
- package/dist/components/TournamentCounter/TournamentCounter.client.js +0 -50
- package/dist/components/TournamentCounter/TournamentCounter.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounter.js +0 -21
- package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounterItem.js +0 -106
- package/dist/components/TournamentCounter/index.d.ts +0 -1
- package/dist/components/TournamentCounter/index.js +0 -1
- package/dist/components/Tournaments/TournamentDesktop.d.ts +0 -1
- package/dist/components/Tournaments/TournamentDesktop.js +0 -57
- package/dist/components/Tournaments/TournamentGameProviders.d.ts +0 -5
- package/dist/components/Tournaments/TournamentGameProviders.js +0 -38
- package/dist/components/Tournaments/TournamentItemDesktop.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemDesktop.js +0 -56
- package/dist/components/Tournaments/TournamentItemMobile.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemMobile.js +0 -54
- package/dist/components/Tournaments/TournamentMobile.d.ts +0 -1
- package/dist/components/Tournaments/TournamentMobile.js +0 -55
- package/dist/components/Tournaments/TournamentRules.d.ts +0 -5
- package/dist/components/Tournaments/TournamentRules.js +0 -11
- package/dist/components/Tournaments/Tournaments.client.d.ts +0 -2
- package/dist/components/Tournaments/Tournaments.client.js +0 -20
- package/dist/components/Tournaments/TournamentsContext.d.ts +0 -4
- package/dist/components/Tournaments/TournamentsContext.js +0 -3
- package/dist/components/Tournaments/useTournamentData.d.ts +0 -10
- package/dist/components/Tournaments/useTournamentData.js +0 -72
- package/dist/components/Tournaments/useTournamentItemData.d.ts +0 -16
- package/dist/components/Tournaments/useTournamentItemData.js +0 -64
- package/dist/components/index.d.ts +0 -33
- package/dist/components/index.js +0 -33
- package/dist/constants/endpoints.d.ts +0 -10
- package/dist/constants/endpoints.js +0 -41
- package/dist/constants/envVars.d.ts +0 -5
- package/dist/constants/envVars.js +0 -28
- package/dist/constants/gameProviders.d.ts +0 -76
- package/dist/constants/gameProviders.js +0 -361
- package/dist/constants/gameTypes.d.ts +0 -3
- package/dist/constants/gameTypes.js +0 -64
- package/dist/constants/headerKeys.d.ts +0 -2
- package/dist/constants/headerKeys.js +0 -2
- package/dist/constants/secretQuestions.d.ts +0 -3
- package/dist/constants/secretQuestions.js +0 -24
- package/dist/constants/storageKeys.d.ts +0 -2
- package/dist/constants/storageKeys.js +0 -2
- package/dist/icons/index.d.ts +0 -65
- package/dist/icons/index.js +0 -65
- package/dist/images/hacksaw-gaming.png +0 -0
- package/dist/server/services/index.d.ts +0 -4
- package/dist/server/services/index.js +0 -4
- package/dist/server/utils/index.d.ts +0 -29
- package/dist/server/utils/index.js +0 -29
- package/dist/ui/Presence.d.ts +0 -2
- package/dist/ui/Presence.js +0 -7
- package/dist/ui/Prose.d.ts +0 -2
- package/dist/ui/Prose.js +0 -5
- package/dist/ui/index.d.ts +0 -26
- package/dist/ui/index.js +0 -26
- package/dist/utils/createErrorFromCode.d.ts +0 -2
- package/dist/utils/createErrorFromCode.js +0 -11
- package/dist/utils/index.d.ts +0 -17
- package/dist/utils/index.js +0 -17
- package/dist/utils/isMobile.d.ts +0 -5
- package/dist/utils/isMobile.js +0 -9
|
@@ -7,6 +7,7 @@ export interface CameraError<T extends string = never> {
|
|
|
7
7
|
export interface CameraData {
|
|
8
8
|
url: string;
|
|
9
9
|
file: File;
|
|
10
|
+
image: HTMLImageElement;
|
|
10
11
|
}
|
|
11
12
|
export interface CameraCropPoints {
|
|
12
13
|
x: number;
|
|
@@ -29,11 +30,15 @@ export interface UseCameraReturn<T extends string = never> {
|
|
|
29
30
|
data: CameraData | null;
|
|
30
31
|
error: CameraError<T> | null;
|
|
31
32
|
loading: boolean;
|
|
33
|
+
snapping: boolean;
|
|
32
34
|
videoRef: React.RefObject<HTMLVideoElement | null>;
|
|
33
35
|
videoProps: ComponentPropsWithRef<'video'>;
|
|
34
36
|
}
|
|
37
|
+
export interface CameraTransformData extends CameraData {
|
|
38
|
+
canvas: HTMLCanvasElement;
|
|
39
|
+
}
|
|
35
40
|
export interface UseCameraOptions<T extends string = never> extends MediaStreamConstraints {
|
|
36
|
-
transform?(data:
|
|
41
|
+
transform?(data: CameraTransformData): CameraData | Promise<CameraData>;
|
|
37
42
|
validate?(data: CameraData): CameraError<T> | void | null | undefined | Promise<CameraError<T> | void | null | undefined>;
|
|
38
43
|
}
|
|
39
44
|
export declare function useCamera<T extends string = never>(options?: UseCameraOptions<T>): UseCameraReturn<T>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isBoolean, isFunction, isObject } from 'lodash-es';
|
|
2
2
|
import { useCallback, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
|
+
import { useMediaQuery } from 'usehooks-ts';
|
|
4
5
|
export function useCamera(options = {}) {
|
|
5
6
|
const { transform, validate, ...constraints } = options;
|
|
6
7
|
const videoRef = useRef(null);
|
|
@@ -8,6 +9,8 @@ export function useCamera(options = {}) {
|
|
|
8
9
|
const [data, setData] = useState(null);
|
|
9
10
|
const [error, setError] = useState(null);
|
|
10
11
|
const [loading, setLoading] = useState(false);
|
|
12
|
+
const [snapping, setSnapping] = useState(false);
|
|
13
|
+
const desktop = useMediaQuery('(min-width: 1024px)');
|
|
11
14
|
const [mirror, setMirror] = useState(false);
|
|
12
15
|
const open = useCallback(async () => {
|
|
13
16
|
setData(null);
|
|
@@ -31,10 +34,18 @@ export function useCamera(options = {}) {
|
|
|
31
34
|
video: {
|
|
32
35
|
facingMode: 'user',
|
|
33
36
|
noiseSuppression: true,
|
|
37
|
+
width: {
|
|
38
|
+
ideal: 9999,
|
|
39
|
+
},
|
|
40
|
+
height: {
|
|
41
|
+
ideal: 9999,
|
|
42
|
+
},
|
|
43
|
+
aspectRatio: {
|
|
44
|
+
exact: desktop ? 16 / 9 : 4 / 3,
|
|
45
|
+
},
|
|
34
46
|
frameRate: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ideal: 30,
|
|
47
|
+
max: 120,
|
|
48
|
+
ideal: 90,
|
|
38
49
|
},
|
|
39
50
|
...(isBoolean(constraints.video) ? {} : constraints.video),
|
|
40
51
|
},
|
|
@@ -74,10 +85,12 @@ export function useCamera(options = {}) {
|
|
|
74
85
|
finally {
|
|
75
86
|
setLoading(false);
|
|
76
87
|
}
|
|
77
|
-
}, [constraints,
|
|
88
|
+
}, [constraints, desktop]);
|
|
78
89
|
const close = useCallback(() => {
|
|
79
90
|
setData(null);
|
|
80
91
|
setError(null);
|
|
92
|
+
setLoading(false);
|
|
93
|
+
setSnapping(false);
|
|
81
94
|
return new Promise((resolve) => {
|
|
82
95
|
stream.current?.getTracks().forEach((track) => track.stop());
|
|
83
96
|
videoRef.current?.pause();
|
|
@@ -87,6 +100,7 @@ export function useCamera(options = {}) {
|
|
|
87
100
|
const snap = useCallback(async (opts = {}) => {
|
|
88
101
|
setData(null);
|
|
89
102
|
setError(null);
|
|
103
|
+
setSnapping(true);
|
|
90
104
|
const video = videoRef.current;
|
|
91
105
|
const canvas = document.createElement('canvas');
|
|
92
106
|
const context = canvas.getContext('2d');
|
|
@@ -98,12 +112,18 @@ export function useCamera(options = {}) {
|
|
|
98
112
|
const hdResolution = video.videoWidth >= 1280 && video.videoHeight >= 720;
|
|
99
113
|
const highResolution = video.videoWidth >= 1920 && video.videoHeight >= 1080;
|
|
100
114
|
const scaleFactor = lowResolution
|
|
101
|
-
? (opts.scale ?? 2)
|
|
115
|
+
? (opts.scale ?? (opts.crop ? 2.15 : 2))
|
|
102
116
|
: highResolution
|
|
103
|
-
?
|
|
117
|
+
? opts.crop
|
|
118
|
+
? 1.25
|
|
119
|
+
: 1.15
|
|
104
120
|
: hdResolution
|
|
105
|
-
?
|
|
106
|
-
|
|
121
|
+
? opts.crop
|
|
122
|
+
? 1.5
|
|
123
|
+
: 1.25
|
|
124
|
+
: opts.crop
|
|
125
|
+
? 1.5
|
|
126
|
+
: 2;
|
|
107
127
|
let x = 0;
|
|
108
128
|
let y = 0;
|
|
109
129
|
let w = video.videoWidth;
|
|
@@ -127,6 +147,7 @@ export function useCamera(options = {}) {
|
|
|
127
147
|
context.drawImage(video, x, y, w, h, 0, 0, w * scaleFactor, h * scaleFactor);
|
|
128
148
|
canvas.toBlob(async (blob) => {
|
|
129
149
|
if (!blob) {
|
|
150
|
+
setSnapping(false);
|
|
130
151
|
return setError({
|
|
131
152
|
name: 'CameraError',
|
|
132
153
|
message: "'canvas.toBlob' failed to create blob",
|
|
@@ -138,21 +159,46 @@ export function useCamera(options = {}) {
|
|
|
138
159
|
endings: 'native',
|
|
139
160
|
lastModified: Date.now(),
|
|
140
161
|
});
|
|
141
|
-
const
|
|
162
|
+
const image = new Image();
|
|
163
|
+
image.src = url;
|
|
164
|
+
image.alt = '';
|
|
165
|
+
image.width = canvas.width;
|
|
166
|
+
image.height = canvas.height;
|
|
167
|
+
if (!image.complete || image.naturalWidth === 0) {
|
|
168
|
+
await new Promise((resolve, reject) => {
|
|
169
|
+
image.onload = () => resolve();
|
|
170
|
+
image.onerror = () => reject();
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const data = isFunction(transform)
|
|
174
|
+
? await transform({
|
|
175
|
+
url,
|
|
176
|
+
file,
|
|
177
|
+
image,
|
|
178
|
+
canvas,
|
|
179
|
+
})
|
|
180
|
+
: {
|
|
181
|
+
url,
|
|
182
|
+
file,
|
|
183
|
+
image,
|
|
184
|
+
};
|
|
142
185
|
const error = await validate?.(data);
|
|
143
186
|
if (error)
|
|
144
187
|
setError(error);
|
|
145
188
|
else
|
|
146
|
-
setData(
|
|
189
|
+
setData(data);
|
|
190
|
+
setSnapping(false);
|
|
147
191
|
}, 'image/jpeg', 1);
|
|
148
192
|
}, [mirror, transform, validate]);
|
|
149
193
|
const reset = useCallback(() => {
|
|
150
194
|
setData(null);
|
|
151
195
|
setError(null);
|
|
152
196
|
setLoading(false);
|
|
197
|
+
setSnapping(false);
|
|
153
198
|
return Promise.resolve();
|
|
154
199
|
}, [setData, setError]);
|
|
155
200
|
const reopen = useCallback(async () => {
|
|
201
|
+
setSnapping(false);
|
|
156
202
|
setLoading(true);
|
|
157
203
|
close();
|
|
158
204
|
await sleep();
|
|
@@ -171,8 +217,6 @@ export function useCamera(options = {}) {
|
|
|
171
217
|
position: 'relative',
|
|
172
218
|
boxSizing: 'border-box',
|
|
173
219
|
background: 'transparent',
|
|
174
|
-
objectFit: 'cover',
|
|
175
|
-
objectPosition: 'center',
|
|
176
220
|
transform: mirror ? 'scaleX(-1)' : 'none',
|
|
177
221
|
},
|
|
178
222
|
}), [mirror]);
|
|
@@ -185,6 +229,7 @@ export function useCamera(options = {}) {
|
|
|
185
229
|
data,
|
|
186
230
|
error,
|
|
187
231
|
loading,
|
|
232
|
+
snapping,
|
|
188
233
|
videoRef,
|
|
189
234
|
videoProps,
|
|
190
235
|
};
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
export interface UseFeatureFlagReturn {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
enable(): Promise<void>;
|
|
4
|
+
disable(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useFeatureFlag(): UseFeatureFlagReturn;
|
|
7
|
+
interface FeatureFlagEventDetail {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
type FeatureFlagEvent = CustomEvent<FeatureFlagEventDetail>;
|
|
11
|
+
interface EventsMap {
|
|
12
|
+
'web-portal::feature-flag': FeatureFlagEvent;
|
|
13
|
+
}
|
|
14
|
+
type Listener<K extends keyof EventsMap> = (this: Window, event: EventsMap[K]) => void;
|
|
15
|
+
declare global {
|
|
16
|
+
interface Window {
|
|
17
|
+
addEventListener<T extends keyof EventsMap>(type: T, listener: Listener<T>): void;
|
|
18
|
+
removeEventListener<K extends keyof EventsMap>(type: K, listener: Listener<K>): void;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,16 +1,56 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { FEATURE_FLAG_LOCAL_STORAGE_KEY } from '../../constants/index.js';
|
|
4
|
+
const event = new CustomEvent('web-portal::feature-flag', {
|
|
5
|
+
detail: {
|
|
6
|
+
enabled: false,
|
|
7
|
+
},
|
|
8
|
+
bubbles: true,
|
|
9
|
+
cancelable: false,
|
|
10
|
+
});
|
|
11
|
+
export function useFeatureFlag() {
|
|
12
|
+
const [enabled, setEnabled] = useState(false);
|
|
13
|
+
function enable() {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
const event = new CustomEvent('web-portal::feature-flag', {
|
|
16
|
+
detail: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
},
|
|
19
|
+
bubbles: true,
|
|
20
|
+
cancelable: false,
|
|
21
|
+
});
|
|
22
|
+
window.dispatchEvent(event);
|
|
23
|
+
resolve();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function disable() {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
window.dispatchEvent(event);
|
|
29
|
+
resolve();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
6
32
|
useEffect(() => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
setFeatureFlagEnabled(storedFlag === 'true');
|
|
33
|
+
if (localStorage.getItem(FEATURE_FLAG_LOCAL_STORAGE_KEY) != null) {
|
|
34
|
+
setEnabled(true);
|
|
10
35
|
}
|
|
11
36
|
}, []);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const handle = (event) => {
|
|
39
|
+
if (event.detail.enabled) {
|
|
40
|
+
setEnabled(true);
|
|
41
|
+
localStorage.setItem(FEATURE_FLAG_LOCAL_STORAGE_KEY, '');
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
setEnabled(false);
|
|
45
|
+
localStorage.removeItem(FEATURE_FLAG_LOCAL_STORAGE_KEY);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
window.addEventListener('web-portal::feature-flag', handle);
|
|
49
|
+
return () => window.removeEventListener('web-portal::feature-flag', handle);
|
|
50
|
+
}, []);
|
|
12
51
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
52
|
+
enabled,
|
|
53
|
+
enable,
|
|
54
|
+
disable,
|
|
15
55
|
};
|
|
16
|
-
}
|
|
56
|
+
}
|
|
@@ -13,7 +13,7 @@ import piggyBank from '../../images/piggy-bank.png';
|
|
|
13
13
|
import { Badge } from '../../ui/Badge/index.js';
|
|
14
14
|
import { Collapsible } from '../../ui/Collapsible/index.js';
|
|
15
15
|
import { Progress } from '../../ui/Progress/index.js';
|
|
16
|
-
import { Prose } from '../../ui/Prose.js';
|
|
16
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
17
17
|
import { capitalize } from '../../utils/capitalize.js';
|
|
18
18
|
import { formatNumber } from '../../utils/formatNumber.js';
|
|
19
19
|
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
@@ -11,7 +11,7 @@ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
|
11
11
|
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
12
12
|
import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
|
|
13
13
|
import { Button } from '../../ui/Button/index.js';
|
|
14
|
-
import { Prose } from '../../ui/Prose.js';
|
|
14
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
15
15
|
export function Cashback__client(props) {
|
|
16
16
|
const availablePromosQuery = useAvailablePromosQuery();
|
|
17
17
|
const cashbackQuery = useCashbackQuery(props.id);
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import Image from 'next/image';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
|
|
6
|
-
import { Prose } from '../../ui/Prose.js';
|
|
6
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
7
7
|
import { stripTags } from '../../utils/stripTags.js';
|
|
8
8
|
export function CustomPromo(props) {
|
|
9
9
|
return (_jsxs(_Fragment, { children: [_jsx("meta", { name: "description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "og:title", content: props.promo.name }), _jsx("meta", { name: "og:description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "og:image", content: props.promo.banner }), _jsx("meta", { name: "twitter:title", content: props.promo.name }), _jsx("meta", { name: "twitter:description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "twitter:image", content: props.promo.banner }), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }), _jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), _jsx(Image, { src: props.promo.banner, alt: "", width: 1024, height: 600, priority: true, unoptimized: true, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" }), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: props.promo.name }), _jsx(Prose, { className: "mt-2xl lg:mt-6", dangerouslySetInnerHTML: {
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
3
|
+
view: "form" | "vca";
|
|
4
4
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
|
-
view: "
|
|
16
|
+
view: "form" | "vca";
|
|
17
17
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "form" | "vca";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
3
|
+
view: "form" | "qrCode";
|
|
4
4
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
view: "
|
|
16
|
+
view: "form" | "qrCode";
|
|
17
17
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "form" | "qrCode";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js
CHANGED
|
@@ -28,6 +28,7 @@ import { Select } from '../../../../ui/Select/index.js';
|
|
|
28
28
|
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
29
29
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
30
30
|
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
31
|
+
import { explainError } from '../../utils.js';
|
|
31
32
|
import { TransactionPasswordNotSet } from '../TransactionPasswordNotSet.js';
|
|
32
33
|
export function InstapayWithdrawal() {
|
|
33
34
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
@@ -148,7 +149,7 @@ export function InstapayWithdrawal() {
|
|
|
148
149
|
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
149
150
|
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
150
151
|
'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
|
|
151
|
-
|
|
152
|
+
explainError(createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
152
153
|
api.setOpen(false);
|
|
153
154
|
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
154
155
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { KnownDepositError, KnownWithdrawalError, WithdrawalError } from '../../types';
|
|
2
3
|
export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN", "VENTAJA", "PISO_PAY"]>;
|
|
3
4
|
export type PaymentMethod = z.infer<typeof PaymentMethodDefinition>;
|
|
5
|
+
export type DepositWithdrawalErrors = KnownDepositError | KnownWithdrawalError | WithdrawalError | string;
|
|
6
|
+
export declare function explainError(error?: DepositWithdrawalErrors): string;
|
|
@@ -10,3 +10,34 @@ export const PaymentMethodDefinition = z.enum([
|
|
|
10
10
|
'VENTAJA',
|
|
11
11
|
'PISO_PAY',
|
|
12
12
|
]);
|
|
13
|
+
const errorMap = {
|
|
14
|
+
DAILY_PURCHASE_OR_DEPOSIT_LIMIT_EXCEEDED: 'You have exceeded your daily purchase or deposit limit. Please try again tomorrow.',
|
|
15
|
+
INSUFFICIENT_BALANCE: 'You have insufficient balance for this transaction.',
|
|
16
|
+
DEPOSIT_CREATION_REQUEST_FAILED: 'Failed to create deposit request. Please try again later.',
|
|
17
|
+
DEPOSIT_EXECUTION_REQUEST_FAILED: 'Failed to execute deposit request. Please try again later.',
|
|
18
|
+
FAILED_TO_PROCESS_PAYMENT: 'Failed to process payment. Please try again later.',
|
|
19
|
+
MINIMUM_DEPOSIT_AMOUNT_NOT_MET: 'The minimum deposit amount is not met. Please enter a valid amount.',
|
|
20
|
+
REQUEST_SESSION_EXPIRED: 'Your session has expired. Please refresh the page and try again.',
|
|
21
|
+
REQUEST_TIMEOUT: 'The request timed out. Please try again later.',
|
|
22
|
+
SYSTEM_CANCELLATION: 'The transaction was cancelled by the system. Please try again later.',
|
|
23
|
+
UNEXPECTED_ERROR: 'An unexpected error occurred. Please try again later.',
|
|
24
|
+
UNTOUCHED: 'The transaction has not been touched yet. Please try again later.',
|
|
25
|
+
WITHDRAWAL_ACCOUNT_EMPTY: 'Your withdrawal account is empty. Please add a withdrawal account before proceeding.',
|
|
26
|
+
WITHDRAWAL_CREATION_REQUEST_FAILED: 'Failed to create withdrawal request. Please try again later.',
|
|
27
|
+
WITHDRAWAL_EXECUTION_REQUEST_FAILED: 'Failed to execute withdrawal request. Please try again later.',
|
|
28
|
+
AccountNotVerifiedError: 'Account not verified. Please complete the verification process.',
|
|
29
|
+
TransactionPasswordNotSetError: 'Transaction password not set. Please set your transaction password before proceeding.',
|
|
30
|
+
InvalidTransactionPasswordError: 'Invalid transaction password. Please try again.',
|
|
31
|
+
InvalidWithdrawalAmountError: 'Invalid withdrawal amount. Please enter a valid amount.',
|
|
32
|
+
MobileNumberNotVerifiedError: 'Mobile number not verified. Please verify your mobile number before proceeding.',
|
|
33
|
+
NotEnoughBalanceError: 'Not enough balance to complete the transaction. Please add funds to your account.',
|
|
34
|
+
ReCAPTCHAVerificationFailedError: 'reCAPTCHA verification failed. Please try again.',
|
|
35
|
+
WalletDoesNotExistError: 'Wallet does not exist. Please check your wallet settings or contact support.',
|
|
36
|
+
WithdrawalDailyLimitExceededError: 'You have exceeded your daily withdrawal limit. Please try again tomorrow.',
|
|
37
|
+
};
|
|
38
|
+
export function explainError(error) {
|
|
39
|
+
if (error && errorMap[error]) {
|
|
40
|
+
return errorMap[error];
|
|
41
|
+
}
|
|
42
|
+
return 'An unexpected error occurred. Please try again later.';
|
|
43
|
+
}
|
|
@@ -22,7 +22,7 @@ import { AlertDialog } from '../../ui/AlertDialog/index.js';
|
|
|
22
22
|
import { Button } from '../../ui/Button/index.js';
|
|
23
23
|
import { IconButton } from '../../ui/IconButton/index.js';
|
|
24
24
|
import { Portal } from '../../ui/Portal/index.js';
|
|
25
|
-
import { Presence } from '../../ui/Presence.js';
|
|
25
|
+
import { Presence } from '../../ui/Presence/index.js';
|
|
26
26
|
export function GameLaunch() {
|
|
27
27
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
28
28
|
gameLaunch: ctx.gameLaunch,
|
|
@@ -10,7 +10,7 @@ import { SearchLgIcon } from '../../icons/SearchLgIcon.js';
|
|
|
10
10
|
import { Button } from '../../ui/Button/index.js';
|
|
11
11
|
import { Combobox } from '../../ui/Combobox/index.js';
|
|
12
12
|
import { Portal } from '../../ui/Portal/index.js';
|
|
13
|
-
import { Presence } from '../../ui/Presence.js';
|
|
13
|
+
import { Presence } from '../../ui/Presence/index.js';
|
|
14
14
|
import { getGameImageUrl } from '../../utils/getGameImageUrl.js';
|
|
15
15
|
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
16
16
|
export function GamesSearch(props) {
|