@medipass/utils 11.81.0 → 11.81.2-feature-pnpm-take-2.1
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/babel.config.js +2 -2
- package/{billable-items-f8291b1e.js → billable-items-5e559447.js} +1 -1
- package/build-validation-schema.js +369 -376
- package/{businesses-e02c0f4b.js → businesses-073d1417.js} +1 -1
- package/chart.js +25 -26
- package/claim-payment-status-formatted.js +7 -4
- package/claim-payment-status-icons.js +14 -3
- package/claim-payment-status-text-classes.js +15 -3
- package/constants.js +76 -65
- package/countries.js +6 -8
- package/datetime.js +18 -17
- package/document-types-formatted.js +10 -5
- package/document-types-icons.js +5 -3
- package/document-types-text-classes.js +6 -3
- package/documents/workflow-state-formatted-text-classes.js +14 -5
- package/documents/workflow-state-formatted.js +19 -8
- package/documents/workflow-state-icons.js +12 -3
- package/form-applications/assign-values-to-sections.js +20 -23
- package/{forms-e1c51a53.js → forms-646810f2.js} +1 -1
- package/funders.js +25 -54
- package/get-env.js +60 -102
- package/get-select-options.js +30 -45
- package/get-staff-type-display-name.js +4 -6
- package/google-addresses.js +60 -101
- 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 +34 -34
- package/i18n/translations.js +3 -3
- package/index.js +40 -42
- package/intercom.js +39 -80
- package/masked.js +32 -41
- package/{members-8eb8d8d0.js → members-e1797829.js} +1 -1
- package/{modalities-2dfbea63.js → modalities-d9979fa4.js} +1 -1
- package/package.json +10 -11
- package/parse-health-fund-card-fields.js +7 -9
- 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} +5 -5
- package/{products-0a392564.js → products-7054c705.js} +2 -2
- package/products.js +10 -15
- package/{professional-categories-157d1767.js → professional-categories-0927144e.js} +1 -1
- package/redux-actions.js +93 -128
- package/redux-reducer.js +80 -83
- package/sanitise-url.js +7 -5
- package/scroll.js +6 -6
- package/sensitive-keys.js +3 -3
- package/sentry.js +82 -78
- package/service-items.js +91 -125
- 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 +13 -3
- package/status-text-classes.js +13 -3
- package/{subscriptions-aef302aa.js → subscriptions-25d86dab.js} +5 -5
- package/test-framework/fixtures/accounts.js +1 -1
- package/test-framework/fixtures/billable-items.js +2 -2
- package/test-framework/fixtures/businesses.js +2 -2
- 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 +2 -2
- package/test-framework/fixtures/health-fund-accounts.js +2 -2
- package/test-framework/fixtures/health-fund-settings.js +2 -2
- package/test-framework/fixtures/health-funds.js +3 -3
- package/test-framework/fixtures/index.js +38 -38
- package/test-framework/fixtures/members.js +2 -2
- package/test-framework/fixtures/message-mappings.js +1 -1
- package/test-framework/fixtures/modalities.js +2 -2
- package/test-framework/fixtures/patients.js +2 -2
- package/test-framework/fixtures/payment-methods.js +2 -2
- package/test-framework/fixtures/practices.js +4 -4
- package/test-framework/fixtures/products.js +3 -3
- package/test-framework/fixtures/professional-categories.js +2 -2
- package/test-framework/fixtures/services.js +4 -4
- package/test-framework/fixtures/specialties.js +2 -2
- package/test-framework/fixtures/staff.js +5 -5
- package/test-framework/fixtures/subscriptions.js +6 -6
- package/test-framework/fixtures/transaction-reports.js +6 -6
- package/test-framework/fixtures/transactions.js +14 -14
- package/test-framework/fixtures/workflow-exceptions.js +2 -2
- package/transaction-details-by-funder.js +20 -20
- package/transaction-status-formatted.js +15 -5
- package/transaction-status-helpers.js +39 -40
- package/transaction-status-icons.js +10 -3
- package/transaction-status-text-classes.js +17 -3
- package/transaction-status.js +14 -19
- package/{transactions-de03f65c.js → transactions-92589d19.js} +13 -13
- package/tsconfig.json +1 -1
- package/validate-form.js +156 -324
- package/validate.js +48 -40
- package/webpack-config.js +15 -19
- package/workflow-state-formatted-text-classes.js +13 -5
- package/workflow-state-formatted.js +11 -6
- package/test-framework/react.d.ts +0 -8
- package/test-framework/react.js +0 -39
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;
|
package/babel.config.js
CHANGED