@akinon/pz-masterpass 1.50.0 → 1.51.0
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 +2 -0
- package/package.json +1 -1
- package/src/views/card-registration/index.tsx +27 -16
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -41,16 +41,15 @@ export const MasterpassCardRegistration = ({
|
|
|
41
41
|
translations?: typeof defaultTranslations;
|
|
42
42
|
}) => {
|
|
43
43
|
const { preOrder } = useAppSelector((state: RootState) => state.checkout);
|
|
44
|
-
const { msisdn, token, language, otp, isDirectPurchase } =
|
|
45
|
-
(state) => state.masterpass
|
|
46
|
-
);
|
|
44
|
+
const { msisdn, token, language, otp, isDirectPurchase, accountStatus } =
|
|
45
|
+
useAppSelector((state) => state.masterpass);
|
|
47
46
|
|
|
48
47
|
const [isInfoModalOpen, setIsInfoModalOpen] = useState(false);
|
|
49
48
|
const [isAgreementChecked, setIsAgreementChecked] = useState(false);
|
|
50
49
|
const [accountAliasName, setAccountAliasName] = useState('');
|
|
51
50
|
const [formError, setFormError] = useState<string | null>(null);
|
|
52
51
|
const [isBusy, setIsBusy] = useState(false);
|
|
53
|
-
const { refreshCards } = useCards();
|
|
52
|
+
const { refreshCards, cards } = useCards();
|
|
54
53
|
|
|
55
54
|
const dispatch = useAppDispatch();
|
|
56
55
|
|
|
@@ -153,6 +152,14 @@ export const MasterpassCardRegistration = ({
|
|
|
153
152
|
}
|
|
154
153
|
}, [otp.response]);
|
|
155
154
|
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (cards && cards.length !== 0) {
|
|
157
|
+
dispatch(setAccountStatus(MasterpassStatus.ListCards));
|
|
158
|
+
} else {
|
|
159
|
+
dispatch(setAccountStatus(MasterpassStatus.NoAccount));
|
|
160
|
+
}
|
|
161
|
+
}, [cards]);
|
|
162
|
+
|
|
156
163
|
if (
|
|
157
164
|
preOrder.payment_option?.payment_type !== 'masterpass' ||
|
|
158
165
|
!isDirectPurchase ||
|
|
@@ -251,18 +258,22 @@ export const MasterpassCardRegistration = ({
|
|
|
251
258
|
</div>
|
|
252
259
|
</div>
|
|
253
260
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
{accountStatus !== MasterpassStatus.NoAccount &&
|
|
262
|
+
cards &&
|
|
263
|
+
cards.length !== 0 && (
|
|
264
|
+
<a
|
|
265
|
+
href="#"
|
|
266
|
+
className="block text-xs underline mt-5"
|
|
267
|
+
onClick={(e) => {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
dispatch(setIsDirectPurchase(false));
|
|
270
|
+
dispatch(setInstallmentOptions([]));
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
{translations?.pay_with_my_masterpass_card ??
|
|
274
|
+
defaultTranslations.pay_with_my_masterpass_card}
|
|
275
|
+
</a>
|
|
276
|
+
)}
|
|
266
277
|
</div>
|
|
267
278
|
);
|
|
268
279
|
};
|