@medipass/utils 11.79.2-chore-environment-variables.1 → 11.79.2

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.
@@ -57,7 +57,6 @@ var funderSections = Object.freeze({
57
57
  wcq: WCQ_SECTIONS,
58
58
  wsv: WSV_SECTIONS
59
59
  });
60
-
61
60
  /**
62
61
  * Returns whether the funder with the provided `funderCode` has a transaction details section
63
62
  * enabled. `section` must be one of the supported `INVOICE_SECTION` sections.
@@ -66,13 +65,14 @@ var funderSections = Object.freeze({
66
65
  * supported for all sections.
67
66
  */
68
67
  // @ts-expect-error TS(1016): A required parameter cannot follow an optional par... Remove this comment to see the full error message
68
+
69
69
  var isFunderSectionSupported = function isFunderSectionSupported(funderCode, section) {
70
70
  // @ts-expect-error
71
71
  if (!funderCode || !funderSections[funderCode]) {
72
72
  return PATIENT_SECTIONS.includes(section);
73
- }
73
+ } // @ts-expect-error
74
+
74
75
 
75
- // @ts-expect-error
76
76
  return funderSections[funderCode].includes(section);
77
77
  };
78
78
 
@@ -9,59 +9,68 @@ var _capitalize = _interopDefault(require('lodash/capitalize'));
9
9
  var claimPaymentStatusIcons = require('./claim-payment-status-icons.js');
10
10
  var claimPaymentStatusTextClasses = require('./claim-payment-status-text-classes.js');
11
11
 
12
- // @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message
13
12
  var getPaymentStatus = function getPaymentStatus(_ref) {
14
13
  var paymentStatus = _ref.paymentStatus,
15
- transactionStatus = _ref.transactionStatus,
16
- hasNoGap = _ref.hasNoGap,
17
- paidInPerson = _ref.paidInPerson;
14
+ transactionStatus = _ref.transactionStatus,
15
+ hasNoGap = _ref.hasNoGap,
16
+ paidInPerson = _ref.paidInPerson;
17
+
18
18
  if (transactionStatus === constants.TRANSACTION_STATUSES.CANCELLED) {
19
19
  return 'Voided';
20
20
  }
21
+
21
22
  if (hasNoGap) {
22
23
  return 'Not needed';
23
24
  }
25
+
24
26
  if (paidInPerson) {
25
27
  return 'Paid in person';
26
28
  }
29
+
27
30
  return paymentStatus ? _capitalize(paymentStatus) : 'Pending';
28
- };
29
- // @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message
31
+ }; // @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message
32
+
30
33
  var getPaymentTextClass = function getPaymentTextClass(_ref2) {
31
34
  var paymentStatus = _ref2.paymentStatus,
32
- transactionStatus = _ref2.transactionStatus,
33
- hasNoGap = _ref2.hasNoGap,
34
- paidInPerson = _ref2.paidInPerson;
35
+ transactionStatus = _ref2.transactionStatus,
36
+ hasNoGap = _ref2.hasNoGap,
37
+ paidInPerson = _ref2.paidInPerson;
38
+
35
39
  if (transactionStatus === constants.TRANSACTION_STATUSES.CANCELLED) {
36
40
  return 'danger';
37
41
  }
42
+
38
43
  if (hasNoGap) {
39
44
  return 'success';
40
45
  }
46
+
41
47
  if (paidInPerson) {
42
48
  return 'gray';
43
- }
49
+ } // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
50
+
44
51
 
45
- // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
46
52
  return claimPaymentStatusTextClasses.default[paymentStatus] || 'warning';
47
- };
48
- // @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message
53
+ }; // @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message
54
+
49
55
  var getPaymentIcon = function getPaymentIcon(_ref3) {
50
56
  var paymentStatus = _ref3.paymentStatus,
51
- transactionStatus = _ref3.transactionStatus,
52
- hasNoGap = _ref3.hasNoGap,
53
- paidInPerson = _ref3.paidInPerson;
57
+ transactionStatus = _ref3.transactionStatus,
58
+ hasNoGap = _ref3.hasNoGap,
59
+ paidInPerson = _ref3.paidInPerson;
60
+
54
61
  if (transactionStatus === constants.TRANSACTION_STATUSES.CANCELLED) {
55
62
  return 'fa-times-circle';
56
63
  }
64
+
57
65
  if (hasNoGap) {
58
66
  return 'fa-check-circle';
59
67
  }
68
+
60
69
  if (paidInPerson) {
61
70
  return '';
62
- }
71
+ } // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
72
+
63
73
 
64
- // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
65
74
  return claimPaymentStatusIcons.default[paymentStatus] || 'fa-clock';
66
75
  };
67
76
  var transactionStatusHelper = {};
@@ -8,27 +8,34 @@ var constants = require('./constants.js');
8
8
  var _get = _interopDefault(require('lodash/get'));
9
9
  var funders = require('./funders.js');
10
10
 
11
- // @ts-expect-error TS(7006): Parameter 'transaction' implicitly has an 'any' ty... Remove this comment to see the full error message
12
11
  function getOverrideStatus(transaction, defaultStatus) {
13
12
  var status = defaultStatus;
13
+
14
14
  if (funders.isMedicare(_get(transaction, 'claims[0].funder.code'))) {
15
15
  var isClaimRejected = _get(transaction, 'claims[0].status') === constants.TRANSACTION_STATUSES.REJECTED;
16
16
  var isTransactionCompleted = transaction.status === constants.TRANSACTION_STATUSES.COMPLETED;
17
+
17
18
  var hasMedicareErrored = _get(transaction, 'medicare.hasFatalError');
19
+
18
20
  if (isClaimRejected && isTransactionCompleted && !hasMedicareErrored) {
19
21
  status = constants.TRANSACTION_STATUSES.UNDER_REVIEW;
20
22
  }
23
+
21
24
  var isClaimPending = _get(transaction, 'claims[0].status') === constants.TRANSACTION_STATUSES.PENDING && transaction.status !== constants.TRANSACTION_STATUSES.CANCELLED;
25
+
22
26
  if (isClaimPending) {
23
27
  status = constants.TRANSACTION_STATUSES.PENDING;
24
28
  }
25
29
  }
30
+
26
31
  if (funders.isIcare(_get(transaction, 'claims[0].funder.code')) && _get(transaction, '_schemaVersion') === '2') {
27
32
  var _isClaimPending = _get(transaction, 'status') === constants.TRANSACTION_STATUSES.PENDING;
33
+
28
34
  if (_isClaimPending) {
29
35
  status = constants.TRANSACTION_STATUSES.SUBMITTED;
30
36
  }
31
37
  }
38
+
32
39
  return status;
33
40
  }
34
41
 
@@ -1,3 +1,6 @@
1
+ export declare const IS_VALID_BANK_ACCOUNT_NAME_REGEX: RegExp;
2
+ export declare const IS_VALID_NUMBER_REGEX: RegExp;
3
+ export declare const IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX: RegExp;
1
4
  export declare const isRequired: (value: any) => "This field is required" | undefined;
2
5
  export declare const isNumber: (value: any) => "This field must only contain numbers" | undefined;
3
6
  export declare const isEqualTo: (target: any, message?: string) => (value: any) => string | undefined;
package/validate-form.js CHANGED
@@ -20,117 +20,114 @@ var isValid = _interopDefault(require('date-fns/isValid'));
20
20
  var parse = _interopDefault(require('date-fns/parse'));
21
21
  var abn = require('./abn.js');
22
22
 
23
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
23
+ var IS_VALID_BANK_ACCOUNT_NAME_REGEX = new RegExp(/^[A-Za-z0-9^_[\]',?;:=#/.*()&%!$ @+-]+$/);
24
+ var IS_VALID_NUMBER_REGEX = new RegExp(/^\d+$/);
25
+ var IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/); // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
26
+
24
27
  var isRequired = function isRequired(value) {
25
28
  return !value || value.trim && !value.trim() || _isArray(value) && value.length === 0 ? 'This field is required' : undefined;
26
- };
27
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
29
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
30
+
28
31
  var isNumber = function isNumber(value) {
29
32
  return value && value.match(/[^0-9]/) ? 'This field must only contain numbers' : undefined;
30
33
  };
31
- var isEqualTo =
32
- // @ts-expect-error TS(7006): Parameter 'target' implicitly has an 'any' type.
33
-
34
+ var isEqualTo = // @ts-expect-error TS(7006): Parameter 'target' implicitly has an 'any' type.
34
35
  function isEqualTo(target, message) {
35
36
  if (message === void 0) {
36
37
  message = "This field must be equal to " + target;
37
38
  }
38
- return (
39
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
39
+
40
+ return (// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
40
41
  function (value) {
41
42
  return target === value ? undefined : message;
42
43
  }
43
44
  );
44
45
  };
45
- var isSameValueAsField =
46
- // @ts-expect-error TS(7006): Parameter 'targetField' implicitly has an 'any' ty... Remove this comment to see the full error message
47
-
46
+ var isSameValueAsField = // @ts-expect-error TS(7006): Parameter 'targetField' implicitly has an 'any' ty... Remove this comment to see the full error message
48
47
  function isSameValueAsField(targetField, message) {
49
48
  if (message === void 0) {
50
49
  message = 'Fields must be the same';
51
50
  }
52
- return (
53
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
51
+
52
+ return (// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
54
53
  function (value, values) {
55
54
  return value === values[targetField] ? undefined : message;
56
55
  }
57
56
  );
58
57
  };
59
- var isLengthEqualTo =
60
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
61
-
58
+ var isLengthEqualTo = // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
62
59
  function isLengthEqualTo(length, message) {
63
60
  if (message === void 0) {
64
61
  message = "Field must contain " + length + " characters";
65
62
  }
66
- return (
67
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
63
+
64
+ return (// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
68
65
  function (value) {
69
66
  return !value || value.length === length ? undefined : message;
70
67
  }
71
68
  );
72
- };
73
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
69
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
70
+
74
71
  var isLengthGreaterThanOrEqualTo = function isLengthGreaterThanOrEqualTo(length) {
75
72
  return function (value) {
76
73
  return !value || value.split(' ').join('').length >= length ? undefined : "Must be greater than or equal to " + length + " characters";
77
74
  };
78
- };
79
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
75
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
76
+
80
77
  var isLengthLessThanOrEqualTo = function isLengthLessThanOrEqualTo(length) {
81
78
  return function (value) {
82
79
  return !value || value.split(' ').join('').length <= length ? undefined : "Must be less than or equal to " + length + " characters";
83
80
  };
84
- };
85
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
81
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
82
+
86
83
  var isLengthWithSpacesLessThanOrEqualTo = function isLengthWithSpacesLessThanOrEqualTo(length) {
87
84
  return function (value) {
88
85
  return !value || value.length <= length ? undefined : "Must be less than or equal to " + length + " characters";
89
86
  };
90
- };
91
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
87
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
88
+
92
89
  var isLengthWithSpacesGreaterThanOrEqualTo = function isLengthWithSpacesGreaterThanOrEqualTo(length) {
93
90
  return function (value) {
94
91
  return !value || value.length >= length ? undefined : "Must be greater than or equal to " + length + " characters";
95
92
  };
96
- };
97
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
93
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
94
+
98
95
  var isGreaterThanOrEqualTo = function isGreaterThanOrEqualTo(length) {
99
96
  return function (value) {
100
97
  return !value || parseFloat(value) >= length ? undefined : "Must be greater than or equal to " + length;
101
98
  };
102
- };
103
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
99
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
100
+
104
101
  var isGreaterThan = function isGreaterThan(length) {
105
102
  return function (value) {
106
103
  return !value || parseFloat(value) > length ? undefined : "Must be greater than " + length;
107
104
  };
108
- };
109
- // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
105
+ }; // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.
106
+
110
107
  var isLessThanOrEqualTo = function isLessThanOrEqualTo(length) {
111
108
  return function (value) {
112
109
  return !value || parseFloat(value) <= length ? undefined : "Must be less than or equal to " + length;
113
110
  };
114
- };
115
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
111
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
112
+
116
113
  var hasUppercaseLetter = function hasUppercaseLetter(value) {
117
114
  return /[A-Z]/.test(value) ? undefined : 'Field must contain an uppercase letter';
118
- };
119
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
115
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
116
+
120
117
  var hasNumber = function hasNumber(value) {
121
118
  return /[0-9]/.test(value) ? undefined : 'Field must contain a number';
122
- };
123
- // Adheres to the 'BECS EBCDIC' character set.
119
+ }; // Adheres to the 'BECS EBCDIC' character set.
124
120
  // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
121
+
125
122
  var isValidBankAccountName = function isValidBankAccountName(value) {
126
- return /^[A-Za-z0-9^_[\]',?;:=#/.*()&%!$ @+-]+$/.test(value) ? undefined : 'Bank account name must not contain any special characters';
127
- };
128
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
123
+ return IS_VALID_BANK_ACCOUNT_NAME_REGEX.test(value) ? undefined : 'Bank account name must not contain any special characters';
124
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
125
+
129
126
  var hasSpecialChar = function hasSpecialChar(value) {
130
127
  return /[!@?#$%^&*)(+=._-]/.test(value) ? undefined : 'Field must contain a special character (e.g. !@#)';
131
- };
132
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
128
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
133
129
  // eslint-disable-line no-useless-escape
130
+
134
131
  var isValidEmailAsync = /*#__PURE__*/function () {
135
132
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
136
133
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -138,26 +135,34 @@ var isValidEmailAsync = /*#__PURE__*/function () {
138
135
  switch (_context.prev = _context.next) {
139
136
  case 0:
140
137
  _context.t0 = !value;
138
+
141
139
  if (_context.t0) {
142
140
  _context.next = 5;
143
141
  break;
144
142
  }
143
+
145
144
  _context.next = 4;
146
145
  return validate.isEmail(value);
146
+
147
147
  case 4:
148
148
  _context.t0 = _context.sent;
149
+
149
150
  case 5:
150
151
  if (!_context.t0) {
151
152
  _context.next = 9;
152
153
  break;
153
154
  }
155
+
154
156
  _context.t1 = undefined;
155
157
  _context.next = 10;
156
158
  break;
159
+
157
160
  case 9:
158
161
  _context.t1 = 'Please enter a valid email';
162
+
159
163
  case 10:
160
164
  return _context.abrupt("return", _context.t1);
165
+
161
166
  case 11:
162
167
  case "end":
163
168
  return _context.stop();
@@ -165,55 +170,66 @@ var isValidEmailAsync = /*#__PURE__*/function () {
165
170
  }
166
171
  }, _callee);
167
172
  }));
173
+
168
174
  return function isValidEmailAsync(_x) {
169
175
  return _ref.apply(this, arguments);
170
176
  };
171
- }();
172
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
177
+ }(); // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
178
+
173
179
  var isValidEmail = function isValidEmail(value) {
174
180
  return !value || /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]+$/i.test(value) ? undefined : 'Please enter a valid email';
175
- };
176
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
181
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
182
+
177
183
  var isValidMobile = function isValidMobile(value) {
178
184
  return !value || validate.isMobileNumber(value, 'AU') ? undefined : 'Please enter a valid mobile number';
179
185
  };
180
186
  var isValidDatePatterns = function isValidDatePatterns(_ref2) {
181
187
  var day = _ref2.day,
182
- month = _ref2.month,
183
- year = _ref2.year;
188
+ month = _ref2.month,
189
+ year = _ref2.year;
184
190
  return function (value) {
185
191
  if (!value) {
186
192
  return undefined;
187
193
  }
194
+
188
195
  if (day) {
189
196
  var valueArray = value.split('/');
197
+
190
198
  var dayValue = _get(valueArray, "[" + day.index + "]", '').split(' ').join('');
199
+
191
200
  if (!new RegExp(day.regex).test(dayValue)) {
192
201
  return day.message;
193
202
  }
194
203
  }
204
+
195
205
  if (month) {
196
206
  var _valueArray = value.split('/');
207
+
197
208
  var monthValue = _get(_valueArray, "[" + month.index + "]", '').split(' ').join('');
209
+
198
210
  if (!new RegExp(month.regex).test(monthValue)) {
199
211
  return month.message;
200
212
  }
201
213
  }
214
+
202
215
  if (year) {
203
216
  var _valueArray2 = value.split('/');
217
+
204
218
  var yearValue = _get(_valueArray2, "[" + year.index + "]", '').split(' ').join('');
219
+
205
220
  if (!new RegExp(year.regex).test(yearValue)) {
206
221
  return year.message;
207
222
  }
208
223
  }
224
+
209
225
  return undefined;
210
226
  };
211
- };
212
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
227
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
228
+
213
229
  var isValidDate = function isValidDate(value) {
214
230
  return value && !isValid(parse(value, 'dd/MM/yyyy', new Date())) ? 'Date is invalid' : undefined;
215
- };
216
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
231
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
232
+
217
233
  var isValidUrlAsync = /*#__PURE__*/function () {
218
234
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(value) {
219
235
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -221,26 +237,34 @@ var isValidUrlAsync = /*#__PURE__*/function () {
221
237
  switch (_context2.prev = _context2.next) {
222
238
  case 0:
223
239
  _context2.t0 = !value;
240
+
224
241
  if (_context2.t0) {
225
242
  _context2.next = 5;
226
243
  break;
227
244
  }
245
+
228
246
  _context2.next = 4;
229
247
  return validate.isUrl(value);
248
+
230
249
  case 4:
231
250
  _context2.t0 = _context2.sent;
251
+
232
252
  case 5:
233
253
  if (!_context2.t0) {
234
254
  _context2.next = 9;
235
255
  break;
236
256
  }
257
+
237
258
  _context2.t1 = undefined;
238
259
  _context2.next = 10;
239
260
  break;
261
+
240
262
  case 9:
241
263
  _context2.t1 = 'Please enter a valid URL (starting with http:// or https://).';
264
+
242
265
  case 10:
243
266
  return _context2.abrupt("return", _context2.t1);
267
+
244
268
  case 11:
245
269
  case "end":
246
270
  return _context2.stop();
@@ -248,105 +272,117 @@ var isValidUrlAsync = /*#__PURE__*/function () {
248
272
  }
249
273
  }, _callee2);
250
274
  }));
275
+
251
276
  return function isValidUrlAsync(_x2) {
252
277
  return _ref3.apply(this, arguments);
253
278
  };
254
279
  }();
255
280
  var isYearInRange = function isYearInRange(_ref4) {
256
281
  var index = _ref4.index,
257
- isShortYearFormat = _ref4.isShortYearFormat,
258
- lessThanCurrentYear = _ref4.lessThanCurrentYear;
282
+ isShortYearFormat = _ref4.isShortYearFormat,
283
+ lessThanCurrentYear = _ref4.lessThanCurrentYear;
259
284
  return function (value) {
260
285
  if (value === void 0) {
261
286
  value = '';
262
287
  }
288
+
263
289
  var year = value.split('/')[index];
264
290
  var currentYear = format(new Date(), isShortYearFormat ? 'yy' : 'yyyy');
291
+
265
292
  if (!lessThanCurrentYear && (parseInt(year, 10) < parseInt(currentYear, 10) || parseInt(year, 10) > parseInt(currentYear, 10) + 15)) {
266
293
  if (parseInt(year, 10) < parseInt(currentYear, 10)) {
267
294
  return "Year must be a year equal or greater than " + parseInt(currentYear, 10);
268
295
  }
296
+
269
297
  if (parseInt(year, 10) > parseInt(currentYear, 10) + 15) {
270
298
  return "Year must be a year less than " + (parseInt(currentYear, 10) + 15);
271
299
  }
300
+
272
301
  return 'Please enter a valid year';
273
302
  }
303
+
274
304
  if (lessThanCurrentYear && parseInt(year, 10) > parseInt(currentYear, 10)) {
275
305
  return "Year must be a year equal or less than " + parseInt(currentYear, 10);
276
306
  }
307
+
277
308
  return undefined;
278
309
  };
279
- };
280
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
310
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
311
+
281
312
  var isValidDOB = function isValidDOB(value) {
282
313
  var invalidDate = isValidDate(value);
283
314
  if (invalidDate) return invalidDate;
284
315
  var year = value.split('/')[2];
285
316
  var currentYear = format(new Date(), 'yyyy');
317
+
286
318
  if (parseInt(year, 10) > parseInt(currentYear, 10)) {
287
319
  return 'Year must be before current year.';
288
320
  }
321
+
289
322
  if (parseInt(year, 10) < 1900) {
290
323
  return 'Year must be greater than 1900';
291
324
  }
325
+
292
326
  return undefined;
293
- };
294
- // @ts-expect-error TS(7006): Parameter 'pattern' implicitly has an 'any' type.
327
+ }; // @ts-expect-error TS(7006): Parameter 'pattern' implicitly has an 'any' type.
328
+
295
329
  var matchesRegex = function matchesRegex(pattern, message) {
296
330
  return function (value) {
297
331
  return !value || new RegExp(pattern).test(value) ? undefined : message;
298
332
  };
299
- };
300
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
333
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
334
+
301
335
  var isFutureDate = function isFutureDate(value) {
302
336
  var date = value && new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);
303
337
  return isFuture(date) ? 'Date must not be in the future.' : undefined;
304
- };
305
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
338
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
339
+
306
340
  var isMoreThanThreeYears = function isMoreThanThreeYears(value) {
307
341
  var dateToValidate = new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);
308
342
  var dateThreeYearsAgo = new Date(new Date().getFullYear() - 3, new Date().getMonth(), new Date().getDate() - 1);
309
343
  return isBefore(dateToValidate, dateThreeYearsAgo) ? 'Date must not be more than 3 years ago.' : undefined;
310
- };
311
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
344
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
345
+
312
346
  var hasInvalidCharacters = function hasInvalidCharacters(value) {
313
347
  return value && /[()]/.test(value) ? 'This field cannot contain ( or )' : undefined;
314
- };
315
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
348
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
349
+
316
350
  var hasStrictInvalidCharacters = function hasStrictInvalidCharacters(value) {
317
351
  return value && /[^A-Za-z0-9-' ]/.test(value) ? 'This field cannot contain any special characters except for space, hyphen and apostrophe under certain conditions' : undefined;
318
- };
319
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
352
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
353
+
320
354
  var hasDoubleSpaces = function hasDoubleSpaces(value) {
321
355
  return value && /\s\s+/g.test(value) ? 'There can be no double spaces in the supplied value' : undefined;
322
- };
323
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
356
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
357
+
324
358
  var hasWhitespaceAtStartOrEnd = function hasWhitespaceAtStartOrEnd(value) {
325
359
  return value && /(^\s+)|(\s+$)/.test(value) ? 'There can be no spaces at the start or end of the supplied value' : undefined;
326
- };
327
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
360
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
361
+
328
362
  var hasSpaceAfterHyphen = function hasSpaceAfterHyphen(value) {
329
363
  return value && /([-]\s)/.test(value) ? 'Name cannot have a space after a hyphen (-)' : undefined;
330
- };
331
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
364
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
365
+
332
366
  var hasSpaceBeforeHyphen = function hasSpaceBeforeHyphen(value) {
333
367
  return value && /(\s[-])/.test(value) ? 'Name cannot have a space before a hyphen (-)' : undefined;
334
- };
335
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
368
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
369
+
336
370
  var hasSpaceAfterApostrophe = function hasSpaceAfterApostrophe(value) {
337
371
  return value && /([']\s)/.test(value) ? "Name cannot have a space after an apostrophe (')" : undefined;
338
- };
339
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
372
+ }; // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
373
+
340
374
  var hasSpaceBeforeApostrophe = function hasSpaceBeforeApostrophe(value) {
341
375
  return value && /(\s['])/.test(value) ? "Name cannot have a space before an apostrophe (')" : undefined;
342
376
  };
343
377
  var isValidAbn = function isValidAbn(value) {
344
378
  var isValid = abn.isValidAbn(value);
379
+
345
380
  if (isValid) return undefined;
346
381
  return 'Invalid ABN';
347
382
  };
348
383
  var isValidAcn = function isValidAcn(value) {
349
384
  var isValid = abn.isValidAcn(value);
385
+
350
386
  if (isValid) return undefined;
351
387
  return 'Invalid ACN';
352
388
  };
@@ -354,32 +390,38 @@ var isValidAbnOrAcn = function isValidAbnOrAcn(value) {
354
390
  if (abn.isValidAbn(value)) {
355
391
  return undefined;
356
392
  }
393
+
357
394
  if (abn.isValidAcn(value)) {
358
395
  return undefined;
359
396
  }
397
+
360
398
  return 'Invalid ABN or ACN';
361
399
  };
362
- var combineValidators =
363
- // @ts-expect-error TS(7019): Rest parameter 'fns' implicitly has an 'any[]' typ... Remove this comment to see the full error message
364
400
 
401
+ var combineValidators = // @ts-expect-error TS(7019): Rest parameter 'fns' implicitly has an 'any[]' typ... Remove this comment to see the full error message
365
402
  function combineValidators() {
366
403
  for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
367
404
  fns[_key] = arguments[_key];
368
405
  }
369
- return (
370
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
406
+
407
+ return (// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
371
408
  function (value) {
372
409
  var validator = fns.find(function (fn) {
373
410
  return fn(value);
374
411
  });
412
+
375
413
  if (validator) {
376
414
  return validator(value);
377
415
  }
416
+
378
417
  return undefined;
379
418
  }
380
419
  );
381
420
  };
382
421
 
422
+ exports.IS_VALID_BANK_ACCOUNT_NAME_REGEX = IS_VALID_BANK_ACCOUNT_NAME_REGEX;
423
+ exports.IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX;
424
+ exports.IS_VALID_NUMBER_REGEX = IS_VALID_NUMBER_REGEX;
383
425
  exports.default = combineValidators;
384
426
  exports.hasDoubleSpaces = hasDoubleSpaces;
385
427
  exports.hasInvalidCharacters = hasInvalidCharacters;