@akinon/pz-masterpass 1.103.0 → 1.104.0-rc.83
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/CHANGELOG.md +18 -0
- package/README.md +55 -55
- package/package.json +1 -1
- package/src/hooks/use-delete-card.tsx +16 -5
- package/src/views/card-list/index.tsx +9 -1
- package/src/views/otp-modal/index.tsx +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @akinon/pz-masterpass
|
|
2
2
|
|
|
3
|
+
## 1.104.0-rc.83
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
8
|
+
- 16aff543: ZERO-3431: Add test script for redirect utility in package.json
|
|
9
|
+
- 64699d3ff: ZERO-2761: Fix invalid import for plugin module
|
|
10
|
+
- e974d8e8: ZERO-3406: Fix rc build
|
|
11
|
+
- 7eb51ca9: ZERO-3424 :Update package versions
|
|
12
|
+
- 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
|
|
13
|
+
- 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
14
|
+
- 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
|
|
15
|
+
- 08c3caec: ZERO-3607 :Enhance the DeleteButton component with additional features and improve the OTP modal functionality by adding minutes and seconds
|
|
16
|
+
- 33d4d0c: ZERO-3615: remove custom not found
|
|
17
|
+
- e9af4e24: ZERO-3607 :Enhance the DeleteButton component with additional features and improve the OTP modal functionality by adding minutes and seconds
|
|
18
|
+
|
|
3
19
|
## 1.103.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -39,6 +55,8 @@
|
|
|
39
55
|
|
|
40
56
|
## 1.91.0
|
|
41
57
|
|
|
58
|
+
> > > > > > > origin/ZERO-3418
|
|
59
|
+
|
|
42
60
|
## 1.90.0
|
|
43
61
|
|
|
44
62
|
## 1.89.0
|
package/README.md
CHANGED
|
@@ -188,77 +188,73 @@ npx @akinon/projectzero@latest --plugins
|
|
|
188
188
|
resendSms,
|
|
189
189
|
resendSmsFetching,
|
|
190
190
|
targetDate,
|
|
191
|
-
otpRef
|
|
191
|
+
otpRef,
|
|
192
|
+
minutes,
|
|
193
|
+
seconds,
|
|
194
|
+
control,
|
|
195
|
+
formError
|
|
192
196
|
}) => {
|
|
193
197
|
const [code, setCode] = useState('');
|
|
194
|
-
const [remainingSeconds, setRemainingSeconds] = useState(
|
|
195
|
-
Math.ceil((targetDate - Date.now()) / 1000)
|
|
196
|
-
);
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
if (!targetDate) return;
|
|
199
|
-
const interval = setInterval(() => {
|
|
200
|
-
const secondsLeft = Math.ceil((targetDate - Date.now()) / 1000);
|
|
201
|
-
setRemainingSeconds(secondsLeft);
|
|
202
|
-
if (secondsLeft <= 0) {
|
|
203
|
-
clearInterval(interval);
|
|
204
|
-
}
|
|
205
|
-
}, 1000);
|
|
206
|
-
return () => clearInterval(interval);
|
|
207
|
-
}, [targetDate]);
|
|
208
198
|
return (
|
|
209
199
|
<Modal
|
|
200
|
+
portalId="otp-masterpass"
|
|
210
201
|
open={open}
|
|
211
202
|
setOpen={setOpen}
|
|
212
|
-
className="w-
|
|
213
|
-
|
|
203
|
+
className="w-[330px] bottom-auto top-1/4 mx-auto px-0 pb-0 md:pb-0 md:rounded-none md:pt-0 md:px-0 md:bottom-auto"
|
|
204
|
+
iconSize={20}
|
|
214
205
|
>
|
|
215
|
-
<div className="px-
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
</
|
|
206
|
+
<div className="py-4 px-14 pt-12 pb-9 flex flex-col justify-center items-center">
|
|
207
|
+
<div className="text-lg leading-5 font-semibold text-secondary text-center pb-7">
|
|
208
|
+
Telefon doğrulama kodunu gir
|
|
209
|
+
</div>
|
|
219
210
|
<form
|
|
220
211
|
onSubmit={(e) => {
|
|
221
212
|
e.preventDefault();
|
|
222
213
|
onSubmit({ otp_code: code });
|
|
223
214
|
}}
|
|
224
|
-
className="flex flex-col items-center mt-4"
|
|
225
215
|
>
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
216
|
+
<div className="mt-2 flex flex-col items-center justify-between">
|
|
217
|
+
<div>
|
|
218
|
+
<label className="text-xs leading-[14px] font-normal text-secondary">
|
|
219
|
+
SMS kodu
|
|
220
|
+
</label>
|
|
221
|
+
<Input
|
|
222
|
+
id="otp_code"
|
|
223
|
+
autoComplete="off"
|
|
224
|
+
minLength={6}
|
|
225
|
+
maxLength={6}
|
|
226
|
+
max="999999"
|
|
227
|
+
min="000000"
|
|
228
|
+
control={control}
|
|
229
|
+
className="h-9 rounded-full border-gray-620 mt-2"
|
|
230
|
+
onChange={(e) =>
|
|
231
|
+
setCode((e.target as HTMLInputElement).value)
|
|
232
|
+
}
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
<Button className="w-full capitalize bg-secondary rounded-full text-base h-auto py-1.5 mt-2 border-none">
|
|
236
|
+
Doğrula
|
|
237
|
+
</Button>
|
|
238
|
+
{formError && (
|
|
239
|
+
<p className="mt-2 text-error text-xs text-center">
|
|
240
|
+
{formError}
|
|
241
|
+
</p>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
247
244
|
</form>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
245
|
+
{minutes + seconds > 0 ? (
|
|
246
|
+
<div className="flex mt-2 flex justify-center">
|
|
247
|
+
{`0${minutes}`} :{' '}
|
|
248
|
+
{`${seconds < 10 ? '0' : ''}${seconds}`}
|
|
249
|
+
</div>
|
|
250
|
+
) : (
|
|
254
251
|
<Button
|
|
255
|
-
onClick={resendSms}
|
|
256
|
-
|
|
257
|
-
className="mt-4 text-sm underline text-secondary-500"
|
|
252
|
+
onClick={() => resendSms()}
|
|
253
|
+
className="w-full capitalize bg-secondary rounded-full text-base h-auto py-1.5 mt-2 border-none text-white"
|
|
258
254
|
>
|
|
259
|
-
{resendSmsFetching ? '
|
|
255
|
+
{!resendSmsFetching ? 'resend code' : <LoaderSpinner />}
|
|
260
256
|
</Button>
|
|
261
|
-
|
|
257
|
+
)}
|
|
262
258
|
</div>
|
|
263
259
|
</Modal>
|
|
264
260
|
);
|
|
@@ -437,7 +433,11 @@ npx @akinon/projectzero@latest --plugins
|
|
|
437
433
|
<p className="text-xs text-gray-500">{card.Value1}</p>
|
|
438
434
|
</div>
|
|
439
435
|
</div>
|
|
440
|
-
<DeleteButton
|
|
436
|
+
<DeleteButton
|
|
437
|
+
cardAliasName={card.Name}
|
|
438
|
+
content={<Icon name="close" size={12} />}
|
|
439
|
+
className="mb-8"
|
|
440
|
+
/>
|
|
441
441
|
</div>
|
|
442
442
|
</li>
|
|
443
443
|
),
|
package/package.json
CHANGED
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
4
4
|
import { Icon } from 'components';
|
|
5
5
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import {
|
|
7
8
|
setDeletionCardAliasName,
|
|
8
9
|
setDeletionModalVisible
|
|
9
10
|
} from '../redux/reducer';
|
|
10
|
-
import { CheckMasterpassResponse } from '../types';
|
|
11
11
|
import { formCreator } from '../utils';
|
|
12
12
|
import { useCards } from './use-cards';
|
|
13
13
|
|
|
14
|
+
export type DeleteButtonProps = {
|
|
15
|
+
cardAliasName: string;
|
|
16
|
+
content?: JSX.Element;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
14
20
|
export const useDeleteCard = () => {
|
|
15
21
|
const { msisdn, token, language, deletion } = useAppSelector(
|
|
16
22
|
(state: any) => state.masterpass
|
|
@@ -67,22 +73,27 @@ export const useDeleteCard = () => {
|
|
|
67
73
|
|
|
68
74
|
const DeleteButton = useMemo(
|
|
69
75
|
() =>
|
|
70
|
-
({ cardAliasName
|
|
76
|
+
({ cardAliasName, content, className }: DeleteButtonProps) => {
|
|
71
77
|
return (
|
|
72
78
|
<span
|
|
73
|
-
className=
|
|
79
|
+
className={twMerge('cursor-pointer p-1', className)}
|
|
74
80
|
onClick={(event: React.MouseEvent<HTMLElement>) => {
|
|
75
81
|
event.stopPropagation();
|
|
76
82
|
dispatch(setDeletionModalVisible(true));
|
|
77
83
|
dispatch(setDeletionCardAliasName(cardAliasName));
|
|
78
84
|
}}
|
|
79
85
|
>
|
|
80
|
-
<Icon name="close" size={12} />
|
|
86
|
+
{content ?? <Icon name="close" size={12} />}
|
|
81
87
|
</span>
|
|
82
88
|
);
|
|
83
89
|
},
|
|
84
90
|
[]
|
|
85
91
|
);
|
|
86
92
|
|
|
87
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
DeleteButton,
|
|
95
|
+
deleteCard,
|
|
96
|
+
isLoading,
|
|
97
|
+
error
|
|
98
|
+
};
|
|
88
99
|
};
|
|
@@ -54,7 +54,12 @@ interface RendererProps {
|
|
|
54
54
|
card: any;
|
|
55
55
|
selectedCard: any;
|
|
56
56
|
onSelect: (card: any) => Promise<void>;
|
|
57
|
-
DeleteButton?: React.FC<{
|
|
57
|
+
DeleteButton?: React.FC<{
|
|
58
|
+
cardAliasName: string;
|
|
59
|
+
onDelete: () => void;
|
|
60
|
+
className?: string;
|
|
61
|
+
content?: JSX.Element;
|
|
62
|
+
}>;
|
|
58
63
|
}) => JSX.Element;
|
|
59
64
|
Loader?: () => JSX.Element;
|
|
60
65
|
ErrorFallback?: (params: {
|
|
@@ -246,12 +251,14 @@ export const MasterpassCardList = ({
|
|
|
246
251
|
className="mr-2"
|
|
247
252
|
onChange={(e) => e.preventDefault()}
|
|
248
253
|
/>
|
|
254
|
+
|
|
249
255
|
<label
|
|
250
256
|
htmlFor={card.UniqueId}
|
|
251
257
|
className="flex flex-col w-full cursor-pointer md:flex-row md:items-center md:justify-between"
|
|
252
258
|
>
|
|
253
259
|
<p className="w-full lg:w-1/3">{card.Name}</p>
|
|
254
260
|
<p className="w-full text-[10px] lg:w-1/3">{card.Value1}</p>
|
|
261
|
+
|
|
255
262
|
<Image
|
|
256
263
|
className="w-8 h-6 object-contain flex items-center justify-center mr-4"
|
|
257
264
|
width={50}
|
|
@@ -260,6 +267,7 @@ export const MasterpassCardList = ({
|
|
|
260
267
|
alt={card.Name}
|
|
261
268
|
/>
|
|
262
269
|
</label>
|
|
270
|
+
|
|
263
271
|
<DeleteButton cardAliasName={card.Name} />
|
|
264
272
|
</div>
|
|
265
273
|
{cvcField}
|
|
@@ -12,6 +12,7 @@ import { OtpForm, OtpFormProps, defaultTranslations } from './otp-form';
|
|
|
12
12
|
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
13
13
|
import { setOtpModalVisible, setOtpResponse } from '../../redux/reducer';
|
|
14
14
|
import { Image } from '@akinon/next/components/image';
|
|
15
|
+
import { useCountdown } from '../../hooks/use-countdown';
|
|
15
16
|
|
|
16
17
|
export interface MasterpassOtpModalProps {
|
|
17
18
|
translations?: {
|
|
@@ -28,6 +29,8 @@ export interface MasterpassOtpModalProps {
|
|
|
28
29
|
resendSmsFetching: boolean;
|
|
29
30
|
targetDate: number;
|
|
30
31
|
otpRef: string | null;
|
|
32
|
+
minutes?: number;
|
|
33
|
+
seconds?: number;
|
|
31
34
|
}) => JSX.Element;
|
|
32
35
|
};
|
|
33
36
|
}
|
|
@@ -126,6 +129,8 @@ export const MasterpassOtpModal = ({
|
|
|
126
129
|
}, [isModalOpen]);
|
|
127
130
|
|
|
128
131
|
if (renderer.Content) {
|
|
132
|
+
const [minutes, seconds] = useCountdown(new Date(otpTime));
|
|
133
|
+
|
|
129
134
|
return (
|
|
130
135
|
<renderer.Content
|
|
131
136
|
open={isModalOpen}
|
|
@@ -137,6 +142,8 @@ export const MasterpassOtpModal = ({
|
|
|
137
142
|
resendSmsFetching={isBusy}
|
|
138
143
|
targetDate={otpTime}
|
|
139
144
|
otpRef={otpRef}
|
|
145
|
+
minutes={minutes}
|
|
146
|
+
seconds={seconds}
|
|
140
147
|
/>
|
|
141
148
|
);
|
|
142
149
|
}
|