@medipass/utils 11.81.1 → 11.81.2-feature-pnpm-default-exports.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/abn.js +21 -26
- package/{billable-items-f8291b1e.js → billable-items-5e559447.js} +1 -1
- package/build-validation-schema.js +89 -128
- package/{businesses-e02c0f4b.js → businesses-073d1417.js} +1 -1
- package/chart.js +14 -19
- package/claim-payment-status-formatted.js +6 -3
- package/claim-payment-status-icons.js +13 -2
- package/claim-payment-status-text-classes.js +14 -2
- package/constants.js +76 -65
- package/countries.js +6 -8
- package/datetime.js +10 -13
- package/document-types-formatted.js +9 -4
- package/document-types-icons.js +4 -2
- package/document-types-text-classes.js +5 -2
- package/documents/workflow-state-formatted-text-classes.js +13 -4
- package/documents/workflow-state-formatted.js +13 -4
- package/documents/workflow-state-icons.js +11 -2
- package/form-applications/assign-values-to-sections.js +14 -19
- package/{forms-e1c51a53.js → forms-646810f2.js} +1 -1
- package/funders.js +19 -50
- package/get-env.js +48 -81
- package/get-select-options.js +24 -41
- package/get-staff-type-display-name.js +3 -5
- package/google-addresses.js +53 -99
- package/{health-fund-accounts-88eac93c.js → health-fund-accounts-8eda8621.js} +1 -1
- package/{health-fund-settings-e7a0f2ec.js → health-fund-settings-6d803913.js} +1 -1
- package/{health-funds-7fea63a0.js → health-funds-5e838942.js} +2 -2
- package/i18n/index.js +18 -19
- package/i18n/translations.js +2 -2
- package/index.js +1 -3
- package/intercom.js +31 -76
- package/masked.js +21 -34
- package/{members-8eb8d8d0.js → members-e1797829.js} +1 -1
- package/{modalities-2dfbea63.js → modalities-d9979fa4.js} +1 -1
- package/package.json +8 -8
- package/parse-health-fund-card-fields.js +6 -8
- package/{patients-dd3709c1.js → patients-aba388c0.js} +1 -1
- package/{payment-methods-d36bc018.js → payment-methods-4010f9e5.js} +1 -1
- package/payment-options.js +22 -43
- package/{practices-d6c480f1.js → practices-17c06e6c.js} +3 -3
- package/{products-0a392564.js → products-7054c705.js} +2 -2
- package/products.js +5 -12
- package/{professional-categories-157d1767.js → professional-categories-0927144e.js} +1 -1
- package/redux-actions.js +85 -125
- package/redux-reducer.js +67 -74
- package/sanitise-url.js +2 -2
- package/scroll.js +5 -5
- package/sensitive-keys.js +2 -2
- package/sentry.js +45 -64
- package/service-items.js +72 -111
- package/{services-f8480eba.js → services-a81b505c.js} +3 -3
- package/{specialties-25fbb171.js → specialties-c29f2f67.js} +1 -1
- package/{staff-646053b7.js → staff-fedb5a08.js} +4 -4
- package/status-icons.js +12 -2
- package/status-text-classes.js +12 -2
- package/{subscriptions-aef302aa.js → subscriptions-25d86dab.js} +5 -5
- package/test-framework/fixtures/accounts.js +1 -1
- package/test-framework/fixtures/billable-items.js +1 -1
- package/test-framework/fixtures/businesses.js +1 -1
- package/test-framework/fixtures/documents.js +3 -3
- package/test-framework/fixtures/form-application-templates.js +1 -1
- package/test-framework/fixtures/form-applications.js +1 -1
- package/test-framework/fixtures/forms.js +1 -1
- package/test-framework/fixtures/health-fund-accounts.js +1 -1
- package/test-framework/fixtures/health-fund-settings.js +1 -1
- package/test-framework/fixtures/health-funds.js +1 -1
- package/test-framework/fixtures/index.js +19 -19
- package/test-framework/fixtures/members.js +1 -1
- package/test-framework/fixtures/message-mappings.js +1 -1
- package/test-framework/fixtures/modalities.js +1 -1
- package/test-framework/fixtures/patients.js +1 -1
- package/test-framework/fixtures/payment-methods.js +1 -1
- package/test-framework/fixtures/practices.js +1 -1
- package/test-framework/fixtures/products.js +1 -1
- package/test-framework/fixtures/professional-categories.js +1 -1
- package/test-framework/fixtures/services.js +1 -1
- package/test-framework/fixtures/specialties.js +1 -1
- package/test-framework/fixtures/staff.js +1 -1
- package/test-framework/fixtures/subscriptions.js +1 -1
- package/test-framework/fixtures/transaction-reports.js +6 -6
- package/test-framework/fixtures/transactions.js +1 -1
- package/test-framework/fixtures/workflow-exceptions.js +2 -2
- package/transaction-details-by-funder.js +20 -20
- package/transaction-status-formatted.js +14 -4
- package/transaction-status-helpers.js +31 -34
- package/transaction-status-icons.js +9 -2
- package/transaction-status-text-classes.js +16 -2
- package/transaction-status.js +8 -15
- package/{transactions-de03f65c.js → transactions-92589d19.js} +13 -13
- package/validate-form.js +134 -312
- package/validate.js +26 -39
- package/webpack-config.js +10 -16
- package/workflow-state-formatted-text-classes.js +12 -4
- package/workflow-state-formatted.js +5 -2
package/abn.js
CHANGED
|
@@ -2,46 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const ABN_LENGTH = 11;
|
|
6
|
+
const normaliseAbn = abn => {
|
|
7
|
+
const trimmedABN = abn == null ? void 0 : abn.replace(/\s/g, '');
|
|
8
8
|
|
|
9
|
+
// The input is an ABN, in which case the format should be 99 999 999 999
|
|
9
10
|
if (trimmedABN.length === ABN_LENGTH) {
|
|
10
11
|
return trimmedABN.substring(0, 2) + ' ' + trimmedABN.substring(2, 5) + ' ' + trimmedABN.substring(5, 8) + ' ' + trimmedABN.substring(8);
|
|
11
12
|
}
|
|
12
|
-
|
|
13
13
|
return abn;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const isValidAbn = abn => {
|
|
16
|
+
const VALID_ABN_LENGTH = 11;
|
|
17
17
|
|
|
18
|
+
// strip whitespace from value
|
|
18
19
|
abn = String(abn).replace(/\s+/g, '');
|
|
19
|
-
|
|
20
20
|
if (abn.length === VALID_ABN_LENGTH) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (var i = 0; i < abn.length; i++) {
|
|
21
|
+
const weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];
|
|
22
|
+
const abnArray = [];
|
|
23
|
+
for (let i = 0; i < abn.length; i++) {
|
|
25
24
|
abnArray[i] = abn.charAt(i);
|
|
26
|
-
}
|
|
25
|
+
}
|
|
26
|
+
// subtract 1 from the left-most digit
|
|
27
27
|
// @ts-expect-error TS(2362): The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
for (var _i = 0; _i < abnArray.length; _i++) {
|
|
28
|
+
abnArray[0] -= 1;
|
|
29
|
+
// multiply each of the digits by its weighting factor
|
|
30
|
+
for (let i = 0; i < abnArray.length; i++) {
|
|
33
31
|
// @ts-expect-error TS(2362): The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
|
|
34
|
-
abnArray[
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (var _i2 = 0; _i2 < abnArray.length; _i2++) {
|
|
32
|
+
abnArray[i] *= weights[i];
|
|
33
|
+
}
|
|
34
|
+
// sum all the digits
|
|
35
|
+
let abnSum = 0;
|
|
36
|
+
for (let i = 0; i < abnArray.length; i++) {
|
|
41
37
|
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
|
|
42
|
-
abnSum += abnArray[
|
|
38
|
+
abnSum += abnArray[i];
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
return abnSum % 89 === 0;
|
|
46
41
|
} else {
|
|
47
42
|
return false;
|
|
@@ -924,9 +924,8 @@ var libExports = lib$1.exports;
|
|
|
924
924
|
var payment = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
925
925
|
|
|
926
926
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
927
|
-
|
|
928
927
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
929
|
-
|
|
928
|
+
const FIELD_VALIDATORS = {
|
|
930
929
|
firstName: {
|
|
931
930
|
type: 'string',
|
|
932
931
|
validators: [{
|
|
@@ -950,65 +949,55 @@ var FIELD_VALIDATORS = {
|
|
|
950
949
|
type: 'test',
|
|
951
950
|
message: 'Please enter a valid day between 01 and 31',
|
|
952
951
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
953
|
-
fn:
|
|
952
|
+
fn: value => {
|
|
954
953
|
if (!value) {
|
|
955
954
|
return;
|
|
956
955
|
}
|
|
957
|
-
|
|
958
|
-
var day = _get__default["default"](value.split('/'), '[0]', '').split(' ').join('');
|
|
959
|
-
|
|
956
|
+
const day = _get__default["default"](value.split('/'), '[0]', '').split(' ').join('');
|
|
960
957
|
return day ? /^0[1-9]|[12][0-9]|3[01]$/.test(day) : true;
|
|
961
958
|
}
|
|
962
959
|
}, {
|
|
963
960
|
type: 'test',
|
|
964
961
|
message: 'Please enter a valid month between 01 and 12',
|
|
965
962
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
966
|
-
fn:
|
|
963
|
+
fn: value => {
|
|
967
964
|
if (!value) {
|
|
968
965
|
return;
|
|
969
966
|
}
|
|
970
|
-
|
|
971
|
-
var month = _get__default["default"](value.split('/'), '[1]', '');
|
|
972
|
-
|
|
967
|
+
const month = _get__default["default"](value.split('/'), '[1]', '');
|
|
973
968
|
return month ? /^(0[1-9]|1[012])$/.test(month) : true;
|
|
974
969
|
}
|
|
975
970
|
}, {
|
|
976
971
|
type: 'test',
|
|
977
972
|
message: 'Please enter a valid year',
|
|
978
973
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
979
|
-
fn:
|
|
974
|
+
fn: value => {
|
|
980
975
|
if (!value) {
|
|
981
976
|
return;
|
|
982
977
|
}
|
|
983
|
-
|
|
984
|
-
var year = _get__default["default"](value.split('/'), '[2]', '');
|
|
985
|
-
|
|
978
|
+
const year = _get__default["default"](value.split('/'), '[2]', '');
|
|
986
979
|
return year ? /^[0-9]{4}$/.test(year) : true;
|
|
987
980
|
}
|
|
988
981
|
}, {
|
|
989
982
|
type: 'test',
|
|
990
983
|
message: 'Please enter a year greater than 1900',
|
|
991
984
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
992
|
-
fn:
|
|
985
|
+
fn: value => {
|
|
993
986
|
if (!value) {
|
|
994
987
|
return;
|
|
995
988
|
}
|
|
996
|
-
|
|
997
|
-
var year = _get__default["default"](value.split('/'), '[2]', '');
|
|
998
|
-
|
|
989
|
+
const year = _get__default["default"](value.split('/'), '[2]', '');
|
|
999
990
|
return year ? parseInt(year, 10) >= 1900 : true;
|
|
1000
991
|
}
|
|
1001
992
|
}, {
|
|
1002
993
|
type: 'test',
|
|
1003
|
-
message:
|
|
994
|
+
message: `Please enter a year before ${new Date().getFullYear() + 1}`,
|
|
1004
995
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1005
|
-
fn:
|
|
996
|
+
fn: value => {
|
|
1006
997
|
if (!value) {
|
|
1007
998
|
return;
|
|
1008
999
|
}
|
|
1009
|
-
|
|
1010
|
-
var year = _get__default["default"](value.split('/'), '[2]', '');
|
|
1011
|
-
|
|
1000
|
+
const year = _get__default["default"](value.split('/'), '[2]', '');
|
|
1012
1001
|
return year ? parseInt(year, 10) <= new Date().getFullYear() : true;
|
|
1013
1002
|
}
|
|
1014
1003
|
}]
|
|
@@ -1032,9 +1021,7 @@ var FIELD_VALIDATORS = {
|
|
|
1032
1021
|
type: 'test',
|
|
1033
1022
|
message: 'Please enter a valid Australian mobile number',
|
|
1034
1023
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1035
|
-
fn:
|
|
1036
|
-
return value ? validate.isMobileNumber(value, 'AU') : true;
|
|
1037
|
-
}
|
|
1024
|
+
fn: value => value ? validate.isMobileNumber(value, 'AU') : true
|
|
1038
1025
|
}]
|
|
1039
1026
|
},
|
|
1040
1027
|
password: {
|
|
@@ -1092,9 +1079,7 @@ var FIELD_VALIDATORS = {
|
|
|
1092
1079
|
type: 'test',
|
|
1093
1080
|
message: 'Please enter a valid card number',
|
|
1094
1081
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1095
|
-
fn:
|
|
1096
|
-
return payment.fns.validateCardNumber(value);
|
|
1097
|
-
}
|
|
1082
|
+
fn: value => payment.fns.validateCardNumber(value)
|
|
1098
1083
|
}]
|
|
1099
1084
|
},
|
|
1100
1085
|
expiry: {
|
|
@@ -1106,9 +1091,7 @@ var FIELD_VALIDATORS = {
|
|
|
1106
1091
|
type: 'test',
|
|
1107
1092
|
message: 'Please enter a valid expiry',
|
|
1108
1093
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1109
|
-
fn:
|
|
1110
|
-
return payment.fns.validateCardExpiry(value);
|
|
1111
|
-
}
|
|
1094
|
+
fn: value => payment.fns.validateCardExpiry(value)
|
|
1112
1095
|
}]
|
|
1113
1096
|
},
|
|
1114
1097
|
cvc: {
|
|
@@ -1120,21 +1103,19 @@ var FIELD_VALIDATORS = {
|
|
|
1120
1103
|
type: 'test',
|
|
1121
1104
|
message: 'Please enter a valid CVC',
|
|
1122
1105
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1123
|
-
fn:
|
|
1124
|
-
return payment.fns.validateCardCVC(value);
|
|
1125
|
-
}
|
|
1106
|
+
fn: value => payment.fns.validateCardCVC(value)
|
|
1126
1107
|
}]
|
|
1127
1108
|
}
|
|
1128
|
-
};
|
|
1129
|
-
|
|
1130
|
-
var getFieldSchema = function getFieldSchema(field) {
|
|
1131
|
-
var key = field.key || field.name; // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1132
|
-
|
|
1133
|
-
var defaultFieldExists = Boolean(FIELD_VALIDATORS[key]); // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1134
|
-
|
|
1135
|
-
var fieldAttributes = defaultFieldExists ? FIELD_VALIDATORS[key] : field;
|
|
1136
|
-
var schema = yup__namespace;
|
|
1109
|
+
};
|
|
1137
1110
|
|
|
1111
|
+
// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.
|
|
1112
|
+
const getFieldSchema = field => {
|
|
1113
|
+
const key = field.key || field.name;
|
|
1114
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1115
|
+
const defaultFieldExists = Boolean(FIELD_VALIDATORS[key]);
|
|
1116
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1117
|
+
const fieldAttributes = defaultFieldExists ? FIELD_VALIDATORS[key] : field;
|
|
1118
|
+
let schema = yup__namespace;
|
|
1138
1119
|
switch (fieldAttributes.type) {
|
|
1139
1120
|
case 'string':
|
|
1140
1121
|
{
|
|
@@ -1142,92 +1123,80 @@ var getFieldSchema = function getFieldSchema(field) {
|
|
|
1142
1123
|
schema = schema.string();
|
|
1143
1124
|
break;
|
|
1144
1125
|
}
|
|
1145
|
-
|
|
1146
1126
|
case 'object':
|
|
1147
1127
|
{
|
|
1148
1128
|
// @ts-expect-error TS(2740): Type 'OptionalObjectSchema<ObjectShape, Record<str... Remove this comment to see the full error message
|
|
1149
1129
|
schema = schema.object();
|
|
1150
1130
|
break;
|
|
1151
1131
|
}
|
|
1152
|
-
|
|
1153
1132
|
case 'array':
|
|
1154
1133
|
{
|
|
1155
1134
|
// @ts-expect-error TS(2740): Type 'OptionalArraySchema<AnySchema<any, any, any>... Remove this comment to see the full error message
|
|
1156
1135
|
schema = schema.array();
|
|
1157
1136
|
break;
|
|
1158
1137
|
}
|
|
1159
|
-
|
|
1160
1138
|
case 'boolean':
|
|
1161
1139
|
{
|
|
1162
1140
|
// @ts-expect-error TS(2740): Type 'BooleanSchema<boolean, Record<string, any>, ... Remove this comment to see the full error message
|
|
1163
1141
|
schema = schema.boolean();
|
|
1164
1142
|
break;
|
|
1165
1143
|
}
|
|
1166
|
-
|
|
1167
1144
|
case 'date':
|
|
1168
1145
|
{
|
|
1169
1146
|
// @ts-expect-error TS(2740): Type 'DateSchema<Date, Record<string, any>, Date>'... Remove this comment to see the full error message
|
|
1170
1147
|
schema = schema.date();
|
|
1171
1148
|
break;
|
|
1172
1149
|
}
|
|
1173
|
-
|
|
1174
1150
|
case 'number':
|
|
1175
1151
|
{
|
|
1176
1152
|
// @ts-expect-error TS(2740): Type 'NumberSchema<number, Record<string, any>, nu... Remove this comment to see the full error message
|
|
1177
1153
|
schema = schema.number();
|
|
1178
1154
|
break;
|
|
1179
1155
|
}
|
|
1180
|
-
|
|
1181
1156
|
default:
|
|
1182
1157
|
{
|
|
1183
1158
|
// @ts-expect-error TS(2322): Type 'StringSchema<string, Record<string, any>, st... Remove this comment to see the full error message
|
|
1184
1159
|
schema = schema.string();
|
|
1185
1160
|
}
|
|
1186
1161
|
}
|
|
1187
|
-
|
|
1188
1162
|
if (fieldAttributes.validators) {
|
|
1189
1163
|
// @ts-expect-error TS(7006): Parameter 'validator' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
1190
|
-
fieldAttributes.validators.forEach(
|
|
1164
|
+
fieldAttributes.validators.forEach(validator => {
|
|
1191
1165
|
switch (validator.type) {
|
|
1192
1166
|
case 'required':
|
|
1193
1167
|
{
|
|
1194
1168
|
if (defaultFieldExists && !field.required) {
|
|
1195
1169
|
return;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1170
|
+
}
|
|
1198
1171
|
|
|
1172
|
+
// @ts-expect-error TS(2339): Property 'required' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
1199
1173
|
schema = schema.required(validator.message);
|
|
1200
1174
|
break;
|
|
1201
1175
|
}
|
|
1202
|
-
|
|
1203
1176
|
case 'test':
|
|
1204
1177
|
{
|
|
1205
1178
|
// @ts-expect-error TS(2339): Property 'test' does not exist on type 'typeof imp... Remove this comment to see the full error message
|
|
1206
1179
|
schema = schema.test(field.name, validator.message, validator.fn);
|
|
1207
1180
|
break;
|
|
1208
1181
|
}
|
|
1209
|
-
|
|
1210
1182
|
case 'email':
|
|
1211
1183
|
{
|
|
1212
1184
|
// @ts-expect-error TS(2339): Property 'email' does not exist on type 'typeof im... Remove this comment to see the full error message
|
|
1213
1185
|
schema = schema.email(validator.message);
|
|
1214
1186
|
break;
|
|
1215
1187
|
}
|
|
1216
|
-
|
|
1217
1188
|
case 'min':
|
|
1218
1189
|
{
|
|
1219
1190
|
// @ts-expect-error TS(2339): Property 'min' does not exist on type 'typeof impo... Remove this comment to see the full error message
|
|
1220
1191
|
schema = schema.min(validator.length, validator.message);
|
|
1221
1192
|
break;
|
|
1222
1193
|
}
|
|
1223
|
-
|
|
1224
1194
|
case 'matches':
|
|
1225
1195
|
{
|
|
1226
1196
|
// @ts-expect-error TS(2339): Property 'matches' does not exist on type 'typeof ... Remove this comment to see the full error message
|
|
1227
1197
|
schema = schema.matches(validator.pattern, validator.message);
|
|
1228
1198
|
break;
|
|
1229
1199
|
}
|
|
1230
|
-
|
|
1231
1200
|
case 'oneOf':
|
|
1232
1201
|
{
|
|
1233
1202
|
// @ts-expect-error TS(2339): Property 'oneOf' does not exist on type 'typeof im... Remove this comment to see the full error message
|
|
@@ -1237,109 +1206,101 @@ var getFieldSchema = function getFieldSchema(field) {
|
|
|
1237
1206
|
}
|
|
1238
1207
|
});
|
|
1239
1208
|
}
|
|
1240
|
-
|
|
1241
1209
|
return schema;
|
|
1242
1210
|
};
|
|
1243
|
-
|
|
1244
|
-
var buildValidationSchema = function buildValidationSchema(fields, overrideSchema) {
|
|
1211
|
+
const buildValidationSchema = function (fields, overrideSchema) {
|
|
1245
1212
|
if (overrideSchema === void 0) {
|
|
1246
1213
|
overrideSchema = {};
|
|
1247
1214
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
fields.forEach(function (field) {
|
|
1215
|
+
const schema = {};
|
|
1216
|
+
fields.forEach(field => {
|
|
1251
1217
|
if (!field) {
|
|
1252
1218
|
return;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1219
|
+
}
|
|
1255
1220
|
|
|
1221
|
+
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
1256
1222
|
schema[field.name] = getFieldSchema(field);
|
|
1257
1223
|
});
|
|
1258
1224
|
return yup__namespace.object().shape(_objectSpread({}, schema, {}, overrideSchema));
|
|
1259
1225
|
};
|
|
1260
1226
|
/* ===== CUSTOM OVERRIDE SCHEMAS ===== */
|
|
1261
|
-
// @ts-expect-error TS(7006): Parameter 'schema' implicitly has an 'any' type.
|
|
1262
|
-
|
|
1263
|
-
var validateHealthFundDate = function validateHealthFundDate(schema, _ref) {
|
|
1264
|
-
var cardFields = _ref.cardFields,
|
|
1265
|
-
fieldKey = _ref.fieldKey,
|
|
1266
|
-
dayKey = _ref.dayKey,
|
|
1267
|
-
monthKey = _ref.monthKey,
|
|
1268
|
-
yearKey = _ref.yearKey;
|
|
1269
|
-
var newSchema = schema;
|
|
1270
1227
|
|
|
1228
|
+
// @ts-expect-error TS(7006): Parameter 'schema' implicitly has an 'any' type.
|
|
1229
|
+
const validateHealthFundDate = (schema, _ref) => {
|
|
1230
|
+
let {
|
|
1231
|
+
cardFields,
|
|
1232
|
+
fieldKey,
|
|
1233
|
+
dayKey,
|
|
1234
|
+
monthKey,
|
|
1235
|
+
yearKey
|
|
1236
|
+
} = _ref;
|
|
1237
|
+
let newSchema = schema;
|
|
1271
1238
|
if (cardFields[dayKey]) {
|
|
1272
1239
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1273
|
-
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, dayKey
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
return new RegExp(_get__default["default"](cardFields, dayKey
|
|
1240
|
+
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, `${dayKey}.validation.message`), value => {
|
|
1241
|
+
const dateArray = value ? value.split('/') : [];
|
|
1242
|
+
const day = dateArray[0];
|
|
1243
|
+
return new RegExp(_get__default["default"](cardFields, `${dayKey}.validation.regex`)).test(day);
|
|
1277
1244
|
});
|
|
1278
1245
|
}
|
|
1279
|
-
|
|
1280
1246
|
if (cardFields[monthKey]) {
|
|
1281
1247
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1282
|
-
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, monthKey
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
return new RegExp(_get__default["default"](cardFields, monthKey
|
|
1248
|
+
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, `${monthKey}.validation.message`), value => {
|
|
1249
|
+
const dateArray = value ? value.split('/') : [];
|
|
1250
|
+
const month = dateArray[dateArray.length - 2];
|
|
1251
|
+
return new RegExp(_get__default["default"](cardFields, `${monthKey}.validation.regex`)).test(month);
|
|
1286
1252
|
});
|
|
1287
1253
|
}
|
|
1288
|
-
|
|
1289
1254
|
if (cardFields[yearKey]) {
|
|
1290
1255
|
// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
|
|
1291
|
-
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, yearKey
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
return new RegExp(_get__default["default"](cardFields, yearKey
|
|
1256
|
+
newSchema = newSchema.test(fieldKey, _get__default["default"](cardFields, `${yearKey}.validation.message`), value => {
|
|
1257
|
+
const dateArray = value ? value.split('/') : [];
|
|
1258
|
+
const year = dateArray[dateArray.length - 1];
|
|
1259
|
+
return new RegExp(_get__default["default"](cardFields, `${yearKey}.validation.regex`)).test(year);
|
|
1295
1260
|
});
|
|
1296
1261
|
}
|
|
1297
|
-
|
|
1298
1262
|
return newSchema;
|
|
1299
1263
|
};
|
|
1300
|
-
|
|
1301
|
-
var paymentMethodValidationSchema = [{
|
|
1264
|
+
const paymentMethodValidationSchema = [{
|
|
1302
1265
|
name: 'cardNumber'
|
|
1303
1266
|
}, {
|
|
1304
1267
|
name: 'expiry'
|
|
1305
1268
|
}, {
|
|
1306
1269
|
name: 'cvc'
|
|
1307
1270
|
}];
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
} : {});
|
|
1342
|
-
};
|
|
1271
|
+
const getHealthFundAccountValidationSchema = cardFields => _objectSpread({}, cardFields.cardNumber ? {
|
|
1272
|
+
cardNumber: yup__namespace.string().matches(new RegExp(_get__default["default"](cardFields, 'cardNumber.validation.regex')), _get__default["default"](cardFields, 'cardNumber.validation.message')).required(`Please enter a ${_get__default["default"](cardFields, 'cardNumber.displayName', 'card number').toLowerCase()}`)
|
|
1273
|
+
} : {}, {}, cardFields.membershipNumber ? {
|
|
1274
|
+
membershipNumber: yup__namespace.string().min(_get__default["default"](cardFields, 'membershipNumber.minLength'), `${_get__default["default"](cardFields, 'membershipNumber.displayName', 'membership number')} must be at least ${_get__default["default"](cardFields, 'membershipNumber.minLength')} numbers`).max(_get__default["default"](cardFields, 'membershipNumber.maxLength', 99), `${_get__default["default"](cardFields, 'membershipNumber.displayName', 'membership number')} must be less than ${_get__default["default"](cardFields, 'membershipNumber.maxLength')} numbers`).matches(new RegExp(_get__default["default"](cardFields, 'membershipNumber.validation.regex')), _get__default["default"](cardFields, 'membershipNumber.validation.message')).required(`Please enter a ${_get__default["default"](cardFields, 'membershipNumber.displayName', 'membership number').toLowerCase()}`)
|
|
1275
|
+
} : {}, {}, cardFields.cardRank ? {
|
|
1276
|
+
cardRank: yup__namespace.string().min(_get__default["default"](cardFields, 'cardRank.minLength'), `${_get__default["default"](cardFields, 'cardRank.displayName', 'card rank')} must be at least ${_get__default["default"](cardFields, 'cardRank.minLength')} numbers`).max(_get__default["default"](cardFields, 'cardRank.maxLength', 99), `${_get__default["default"](cardFields, 'cardRank.displayName', 'card rank')} must be less than ${_get__default["default"](cardFields, 'cardRank.maxLength')} numbers`).matches(new RegExp(_get__default["default"](cardFields, 'cardRank.validation.regex')), _get__default["default"](cardFields, 'cardRank.validation.message')).required(`Please enter a ${_get__default["default"](cardFields, 'cardRank.displayName', 'card rank').toLowerCase()}`)
|
|
1277
|
+
} : {}, {}, cardFields.issueDay || cardFields.issueMonth || cardFields.issueYear ? (() => {
|
|
1278
|
+
let issueDateSchema = yup__namespace.string().required('Please enter an issue date');
|
|
1279
|
+
issueDateSchema = validateHealthFundDate(issueDateSchema, {
|
|
1280
|
+
cardFields,
|
|
1281
|
+
fieldKey: 'issueDate',
|
|
1282
|
+
dayKey: 'issueDay',
|
|
1283
|
+
monthKey: 'issueMonth',
|
|
1284
|
+
yearKey: 'issueYear'
|
|
1285
|
+
});
|
|
1286
|
+
return {
|
|
1287
|
+
issueDate: issueDateSchema
|
|
1288
|
+
};
|
|
1289
|
+
})() : {}, {}, cardFields.expiryDay || cardFields.expiryMonth || cardFields.expiryYear ? (() => {
|
|
1290
|
+
let expiryDateSchema = yup__namespace.string().required('Please enter an expiry date');
|
|
1291
|
+
expiryDateSchema = validateHealthFundDate(expiryDateSchema, {
|
|
1292
|
+
cardFields,
|
|
1293
|
+
fieldKey: 'expiryDate',
|
|
1294
|
+
dayKey: 'expiryDay',
|
|
1295
|
+
monthKey: 'expiryMonth',
|
|
1296
|
+
yearKey: 'expiryYear'
|
|
1297
|
+
});
|
|
1298
|
+
return {
|
|
1299
|
+
expiryDate: expiryDateSchema
|
|
1300
|
+
};
|
|
1301
|
+
})() : {}, {}, cardFields.cardIssueNumber ? {
|
|
1302
|
+
cardIssueNumber: yup__namespace.string().min(_get__default["default"](cardFields, 'cardIssueNumber.minLength'), `${_get__default["default"](cardFields, 'cardIssueNumber.displayName', 'issue number')} must be at least ${_get__default["default"](cardFields, 'cardIssueNumber.minLength')} numbers`).max(_get__default["default"](cardFields, 'cardIssueNumber.maxLength', 99), `${_get__default["default"](cardFields, 'cardIssueNumber.displayName', 'issue number')} must be less than ${_get__default["default"](cardFields, 'cardIssueNumber.maxLength')} numbers`).matches(new RegExp(_get__default["default"](cardFields, 'cardIssueNumber.validation.regex')), _get__default["default"](cardFields, 'cardIssueNumber.validation.message')).required(`Please enter a ${_get__default["default"](cardFields, 'cardIssueNumber.displayName', 'issue number').toLowerCase()}`)
|
|
1303
|
+
} : {});
|
|
1343
1304
|
|
|
1344
1305
|
exports.FIELD_VALIDATORS = FIELD_VALIDATORS;
|
|
1345
1306
|
exports["default"] = buildValidationSchema;
|
package/chart.js
CHANGED
|
@@ -12,41 +12,36 @@ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
|
12
12
|
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
13
13
|
var _capitalize__default = /*#__PURE__*/_interopDefaultLegacy(_capitalize);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// @ts-expect-error TS(7006): Parameter 'dataset' implicitly has an 'any' type.
|
|
16
|
+
const buildChartLabelsFromDataset = function (dataset, labelKey, opts) {
|
|
16
17
|
if (opts === void 0) {
|
|
17
18
|
opts = {};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
dataset.map(
|
|
20
|
+
return (
|
|
21
|
+
// @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
|
|
22
|
+
dataset.map(data => {
|
|
22
23
|
// @ts-expect-error TS(2339): Property 'format' does not exist on type '{}'.
|
|
23
24
|
if (opts.format) {
|
|
24
25
|
// @ts-expect-error TS(2339): Property 'format' does not exist on type '{}'.
|
|
25
26
|
return moment__default["default"](data[labelKey]).format(opts.format);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
28
|
return data[labelKey];
|
|
29
29
|
})
|
|
30
30
|
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
}; // @ts-expect-error TS(7006): Parameter 'period' implicitly has an 'any' type.
|
|
38
|
-
|
|
39
|
-
var humanizePeriod = function humanizePeriod(period) {
|
|
31
|
+
};
|
|
32
|
+
// @ts-expect-error TS(7006): Parameter 'dataset' implicitly has an 'any' type.
|
|
33
|
+
const buildDataPointsFromDataset = (dataset, dataKey) => dataset.map(data => _get__default["default"](data, dataKey));
|
|
34
|
+
// @ts-expect-error TS(7006): Parameter 'period' implicitly has an 'any' type.
|
|
35
|
+
const humanizePeriod = period => {
|
|
40
36
|
if (period && period.includes('--')) {
|
|
41
37
|
return '';
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
return _capitalize__default["default"](period);
|
|
45
40
|
};
|
|
46
|
-
|
|
47
|
-
buildChartLabelsFromDataset
|
|
48
|
-
buildDataPointsFromDataset
|
|
49
|
-
humanizePeriod
|
|
41
|
+
const chart = {
|
|
42
|
+
buildChartLabelsFromDataset,
|
|
43
|
+
buildDataPointsFromDataset,
|
|
44
|
+
humanizePeriod
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
exports.buildChartLabelsFromDataset = buildChartLabelsFromDataset;
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const claimPaymentStatusFormatted = {
|
|
8
|
+
PROVIDER: {
|
|
9
|
+
[constants.TRANSACTION_STATUSES.UNDER_REVIEW]: 'Under review',
|
|
10
|
+
[constants.TRANSACTION_STATUSES.PARTIALLY_REFUNDED]: 'Partial refund',
|
|
11
|
+
[constants.TRANSACTION_STATUSES.ERRORED]: 'Errored'
|
|
12
|
+
}
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
exports["default"] = claimPaymentStatusFormatted;
|
|
@@ -4,7 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const claimPaymentStatusIcons = {
|
|
8
|
+
[constants.TRANSACTION_STATUSES.ERRORED]: 'fa-times-circle',
|
|
9
|
+
[constants.TRANSACTION_STATUSES.REQUESTED]: 'fa-clock',
|
|
10
|
+
[constants.TRANSACTION_STATUSES.PENDING]: 'fa-clock',
|
|
11
|
+
[constants.TRANSACTION_STATUSES.ACCEPTED]: 'fa-check-circle',
|
|
12
|
+
[constants.TRANSACTION_STATUSES.APPROVED]: 'fa-check-circle',
|
|
13
|
+
[constants.TRANSACTION_STATUSES.REJECTED]: 'fa-times-circle',
|
|
14
|
+
[constants.TRANSACTION_STATUSES.REVERSED]: 'fa-times-circle',
|
|
15
|
+
[constants.TRANSACTION_STATUSES.VOIDED]: 'fa-times-circle',
|
|
16
|
+
[constants.TRANSACTION_STATUSES.SKIPPED]: 'fa-times-circle',
|
|
17
|
+
[constants.TRANSACTION_STATUSES.REFUNDED]: 'fa-undo',
|
|
18
|
+
[constants.TRANSACTION_STATUSES.UNDER_REVIEW]: 'fa-clock'
|
|
19
|
+
};
|
|
9
20
|
|
|
10
21
|
exports["default"] = claimPaymentStatusIcons;
|
|
@@ -4,7 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const claimPaymentStatusTextClasses = {
|
|
8
|
+
[constants.TRANSACTION_STATUSES.ERRORED]: 'danger',
|
|
9
|
+
[constants.TRANSACTION_STATUSES.REQUESTED]: 'warning',
|
|
10
|
+
[constants.TRANSACTION_STATUSES.ACCEPTED]: 'success',
|
|
11
|
+
[constants.TRANSACTION_STATUSES.APPROVED]: 'success',
|
|
12
|
+
[constants.TRANSACTION_STATUSES.REJECTED]: 'danger',
|
|
13
|
+
[constants.TRANSACTION_STATUSES.CANCELLED]: 'danger',
|
|
14
|
+
[constants.TRANSACTION_STATUSES.REVERSED]: 'danger',
|
|
15
|
+
[constants.TRANSACTION_STATUSES.VOIDED]: 'danger',
|
|
16
|
+
[constants.TRANSACTION_STATUSES.SKIPPED]: 'danger',
|
|
17
|
+
[constants.TRANSACTION_STATUSES.PENDING]: 'warning',
|
|
18
|
+
[constants.TRANSACTION_STATUSES.UNDER_REVIEW]: 'warning',
|
|
19
|
+
[constants.TRANSACTION_STATUSES.SUBMITTED]: 'warning'
|
|
20
|
+
};
|
|
9
21
|
|
|
10
22
|
exports["default"] = claimPaymentStatusTextClasses;
|