@tap-payments/auth-jsconnect 2.5.14-test → 2.5.16-test

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.
@@ -61,6 +61,7 @@ var Individual = function (_a) {
61
61
  var contact = (otpData.responseBody || {}).contact;
62
62
  var responseBody = individualData.responseBody, defaultValues = __rest(individualData, ["responseBody"]);
63
63
  var is_available = (responseBody || {}).is_available;
64
+ console.log('Individual start');
64
65
  var methods = useForm({
65
66
  resolver: yupResolver(isMobile ? IndividualValidation : IndividualMobileValidation),
66
67
  defaultValues: individualData,
@@ -75,8 +76,10 @@ var Individual = function (_a) {
75
76
  });
76
77
  }, []);
77
78
  React.useEffect(function () {
78
- if (defaultValues.countryCode.iso2 !== methods.getValues('countryCode.iso2'))
79
+ if (defaultValues.countryCode.iso2 !== methods.getValues('countryCode.iso2')) {
80
+ console.log('individual country setValue');
79
81
  methods.setValue('countryCode', defaultValues.countryCode);
82
+ }
80
83
  }, [defaultValues.countryCode]);
81
84
  var onSubmit = function (formData) {
82
85
  dispatch(updateLeadIndividual(formData));
@@ -41,6 +41,7 @@ var Merchant = function (_a) {
41
41
  var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels;
42
42
  var brandList = (responseBody || {}).brand_list;
43
43
  var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
44
+ console.log('Merchant start');
44
45
  React.useEffect(function () {
45
46
  sendCustomEventToGTM({
46
47
  event: 'Send Event',
@@ -82,11 +82,11 @@ var Mobile = function (_a) {
82
82
  var _e = data.mobileData, mobile = _e.mobile, countryCode = _e.countryCode, termAndConditionChecked = _e.termAndConditionChecked;
83
83
  var methods = useForm({
84
84
  resolver: yupResolver(PhoneValidationSchema),
85
- defaultValues: {
85
+ defaultValues: __assign({
86
86
  mobile: mobile,
87
87
  countryCode: countryCode,
88
88
  termAndConditionChecked: termAndConditionChecked
89
- },
89
+ }),
90
90
  mode: 'onChange'
91
91
  });
92
92
  useSetFromDefaultValues(methods, data.mobileData);
@@ -104,7 +104,7 @@ var Mobile = function (_a) {
104
104
  }, [methods.formState.isValid]);
105
105
  var onSubmit = function (formData) {
106
106
  debugger;
107
- dispatch(createMobileAuth(formData));
107
+ dispatch(createMobileAuth(__assign({}, formData)));
108
108
  console.log('createMobileAuth done');
109
109
  dispatch(resetNIDScreen());
110
110
  console.log('resetNIDScreen done');
@@ -54,12 +54,16 @@ var OTP = function () {
54
54
  var otp = data.otpData.otp;
55
55
  var methods = useForm({
56
56
  resolver: yupResolver(OTPValidation),
57
- defaultValues: {
57
+ defaultValues: __assign({
58
58
  otp: otp
59
- },
59
+ }),
60
60
  mode: 'onChange'
61
61
  });
62
+ console.log('OTP start');
63
+ debugger;
62
64
  useSetFromDefaultValues(methods, data.otpData);
65
+ debugger;
66
+ console.log('OTP end');
63
67
  var t = useTranslation().t;
64
68
  var isAr = useLanguage().isAr;
65
69
  var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
@@ -78,7 +82,7 @@ var OTP = function () {
78
82
  };
79
83
  }, [methods.formState.isValid]);
80
84
  var onSubmit = function (formData) {
81
- dispatch(verifyAuth(formData));
85
+ dispatch(verifyAuth(__assign({}, formData)));
82
86
  };
83
87
  var onBack = function () {
84
88
  dispatch(handlePrevScreenStep(startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { useEffect } from 'react';
2
13
  var isValidValue = function (value) {
3
14
  if (Array.isArray(value))
@@ -8,13 +19,18 @@ var isValidValue = function (value) {
8
19
  };
9
20
  export var useSetFromDefaultValues = function (method, defaultValues, shouldValidate) {
10
21
  if (shouldValidate === void 0) { shouldValidate = false; }
22
+ var values = __assign({}, defaultValues);
11
23
  console.log('useSetFromDefaultValues start');
24
+ console.log('defaultValues', values);
12
25
  var setFromDefaultValues = function () {
13
- for (var key in defaultValues) {
14
- if (Object.prototype.hasOwnProperty.call(defaultValues, key)) {
26
+ console.log('setFromDefaultValues', values);
27
+ for (var key in values) {
28
+ console.log('key', key);
29
+ console.log('values[key]', values[key]);
30
+ if (Object.prototype.hasOwnProperty.call(values, key)) {
15
31
  if (key === 'responseBody')
16
32
  continue;
17
- var value = defaultValues[key];
33
+ var value = values[key];
18
34
  if (!isValidValue(method.getValues(key)) && isValidValue(value)) {
19
35
  console.log('useSetFromDefaultValues setValue');
20
36
  debugger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.5.14-test",
3
+ "version": "2.5.16-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",