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