@medipass/utils 11.73.2 → 11.73.3-chore-update-react-18.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 +40 -45
- package/{billable-items-f8291b1e.js → billable-items-5e559447.js} +1 -1
- package/build-validation-schema.js +81 -123
- package/{businesses-2633ab9b.js → businesses-94ec0280.js} +1 -1
- package/chart.js +7 -14
- package/claim-payment-status-formatted.js +5 -2
- package/claim-payment-status-icons.js +13 -2
- package/claim-payment-status-text-classes.js +14 -2
- package/constants.js +82 -69
- package/countries.js +6 -8
- package/datetime.js +6 -13
- package/document-types-formatted.js +8 -3
- 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 +10 -16
- package/{forms-e1c51a53.js → forms-646810f2.js} +1 -1
- package/funders.js +21 -56
- package/get-env.js +38 -75
- package/get-select-options.js +21 -40
- package/get-staff-type-display-name.js +2 -4
- package/google-addresses.js +46 -91
- 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 +15 -18
- package/i18n/translations.js +1 -1
- package/index.js +1 -3
- package/intercom.js +24 -69
- package/{members-8eb8d8d0.js → members-e1797829.js} +1 -1
- package/{modalities-2dfbea63.js → modalities-d9979fa4.js} +1 -1
- package/package.json +4 -4
- package/parse-health-fund-card-fields.js +4 -6
- package/{patients-dd3709c1.js → patients-aba388c0.js} +1 -1
- package/{payment-methods-d36bc018.js → payment-methods-4010f9e5.js} +1 -1
- package/payment-options.js +11 -33
- 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 +69 -108
- package/redux-reducer.js +53 -69
- package/sanitise-url.js +1 -1
- package/scroll.js +1 -3
- package/sensitive-keys.js +2 -2
- package/sentry.js +35 -59
- package/service-items.js +70 -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 +18 -18
- 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/test-framework/react.js +10 -12
- package/transaction-details-by-funder.js +20 -21
- package/transaction-status-formatted.js +13 -3
- package/transaction-status-helpers.js +21 -27
- package/transaction-status-icons.js +9 -2
- package/transaction-status-text-classes.js +16 -2
- package/transaction-status.js +7 -15
- package/{transactions-4a08e450.js → transactions-de63fd15.js} +14 -14
- package/validate-form.js +79 -269
- package/validate.js +16 -28
- package/webpack-config.js +6 -13
- package/workflow-state-formatted-text-classes.js +12 -4
- package/workflow-state-formatted.js +11 -2
package/i18n/index.js
CHANGED
|
@@ -11,29 +11,27 @@ var i18n = _interopDefault(require('i18next'));
|
|
|
11
11
|
var reactI18next = require('react-i18next');
|
|
12
12
|
|
|
13
13
|
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; }
|
|
14
|
-
|
|
15
14
|
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(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; }
|
|
16
|
-
|
|
17
15
|
function getResources(translations$1) {
|
|
18
|
-
return translations.regionsList.reduce(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, _objectSpread3));
|
|
16
|
+
return translations.regionsList.reduce((resources, region) => {
|
|
17
|
+
return _objectSpread({}, resources, {
|
|
18
|
+
[region]: {
|
|
19
|
+
translation: Object.entries(translations$1).reduce((currentTranslations, _ref) => {
|
|
20
|
+
let [key, value] = _ref;
|
|
21
|
+
return _objectSpread({}, currentTranslations, {
|
|
22
|
+
[key]: value[region]
|
|
23
|
+
});
|
|
24
|
+
}, {})
|
|
25
|
+
}
|
|
26
|
+
});
|
|
30
27
|
}, {});
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
var index = {
|
|
34
30
|
i18n: {},
|
|
35
|
-
setup
|
|
36
|
-
|
|
31
|
+
setup(_ref2) {
|
|
32
|
+
let {
|
|
33
|
+
region
|
|
34
|
+
} = _ref2;
|
|
37
35
|
this.i18n = i18n.use(reactI18next.initReactI18next).init({
|
|
38
36
|
resources: getResources(translations.default),
|
|
39
37
|
lng: region,
|
|
@@ -42,7 +40,6 @@ var index = {
|
|
|
42
40
|
// we do not use keys in form messages.welcome
|
|
43
41
|
interpolation: {
|
|
44
42
|
escapeValue: false // react already safes from xss
|
|
45
|
-
|
|
46
43
|
}
|
|
47
44
|
});
|
|
48
45
|
}
|
package/i18n/translations.js
CHANGED
package/index.js
CHANGED
|
@@ -10,8 +10,6 @@ require('core-js/es6/promise');
|
|
|
10
10
|
require('core-js/es6/set');
|
|
11
11
|
require('google-libphonenumber');
|
|
12
12
|
var validate = require('./validate.js');
|
|
13
|
-
require('@babel/runtime/regenerator');
|
|
14
|
-
require('@babel/runtime/helpers/asyncToGenerator');
|
|
15
13
|
require('lodash/get');
|
|
16
14
|
var transactionStatusTextClasses = require('./transaction-status-text-classes.js');
|
|
17
15
|
var claimPaymentStatusIcons = require('./claim-payment-status-icons.js');
|
|
@@ -36,7 +34,7 @@ var chart = require('./chart.js');
|
|
|
36
34
|
var getSelectOptions = require('./get-select-options.js');
|
|
37
35
|
var getStaffTypeDisplayName = require('./get-staff-type-display-name.js');
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
const utils = {
|
|
40
38
|
chart: chart.default,
|
|
41
39
|
claimPaymentStatusIcons: claimPaymentStatusIcons.default,
|
|
42
40
|
claimPaymentStatusTextClasses: claimPaymentStatusTextClasses.default,
|
package/intercom.js
CHANGED
|
@@ -5,87 +5,42 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
8
|
-
var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator'));
|
|
9
|
-
var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator'));
|
|
10
8
|
require('lodash/get');
|
|
11
9
|
require('lodash/isEmpty');
|
|
12
10
|
require('lodash/omitBy');
|
|
13
11
|
var getEnv = require('./get-env.js');
|
|
14
12
|
|
|
15
13
|
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; }
|
|
16
|
-
|
|
17
14
|
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(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; }
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return _context.abrupt("return", window.Intercom('boot', _objectSpread({}, data, {
|
|
25
|
-
app_id: getEnv.default.INTERCOM_APP_ID,
|
|
26
|
-
// eslint-disable-line camelcase
|
|
27
|
-
user_hash: data.intercomHash
|
|
28
|
-
})));
|
|
29
|
-
|
|
30
|
-
case 1:
|
|
31
|
-
case "end":
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, _callee);
|
|
15
|
+
const bootIntercom = async data => {
|
|
16
|
+
// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
17
|
+
return window.Intercom('boot', _objectSpread({}, data, {
|
|
18
|
+
app_id: getEnv.default.INTERCOM_APP_ID,
|
|
19
|
+
// eslint-disable-line camelcase
|
|
20
|
+
user_hash: data.intercomHash
|
|
36
21
|
}));
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return _ref.apply(this, arguments);
|
|
40
|
-
};
|
|
41
|
-
}();
|
|
42
|
-
var showNewMessage = function showNewMessage(message) {
|
|
43
|
-
return (// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
44
|
-
window.Intercom('showNewMessage', typeof message === 'string' ? message : '')
|
|
45
|
-
);
|
|
46
|
-
}; // eslint-disable-line new-cap
|
|
22
|
+
};
|
|
23
|
+
const showNewMessage = message =>
|
|
47
24
|
// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
25
|
+
window.Intercom('showNewMessage', typeof message === 'string' ? message : ''); // eslint-disable-line new-cap
|
|
48
26
|
|
|
49
|
-
var shutdownIntercom = function shutdownIntercom() {
|
|
50
|
-
return window.Intercom('shutdown');
|
|
51
|
-
}; // eslint-disable-line new-cap
|
|
52
27
|
// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
28
|
+
const shutdownIntercom = () => window.Intercom('shutdown'); // eslint-disable-line new-cap
|
|
53
29
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return trackEvent('created-medicare-invoice', data);
|
|
69
|
-
};
|
|
70
|
-
var trackCreatePatientFundedInvoice = function trackCreatePatientFundedInvoice(data) {
|
|
71
|
-
return trackEvent('created-patient-funded-invoice', data);
|
|
72
|
-
};
|
|
73
|
-
var trackCreateNDISInvoice = function trackCreateNDISInvoice(data) {
|
|
74
|
-
return trackEvent('created-ndis-invoice', data);
|
|
75
|
-
};
|
|
76
|
-
var trackCreateOHCInvoice = function trackCreateOHCInvoice(data) {
|
|
77
|
-
return trackEvent('created-ohc-invoice', data);
|
|
78
|
-
};
|
|
79
|
-
var trackCreateVirtualTerminalInvoice = function trackCreateVirtualTerminalInvoice(data) {
|
|
80
|
-
return trackEvent('created-virtual-terminal-invoice', data);
|
|
81
|
-
};
|
|
82
|
-
var trackCreateQuote = function trackCreateQuote(data) {
|
|
83
|
-
return trackEvent('created-quote', data);
|
|
84
|
-
}; // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
85
|
-
|
|
86
|
-
var updateIntercom = function updateIntercom(data) {
|
|
87
|
-
return window.Intercom('update', data);
|
|
88
|
-
}; // eslint-disable-line new-cap
|
|
30
|
+
// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
31
|
+
const trackEvent = (name, data) => window.Intercom('trackEvent', name, data); // eslint-disable-line new-cap
|
|
32
|
+
|
|
33
|
+
const trackCreateDVAInvoice = data => trackEvent('created-dva-invoice', data);
|
|
34
|
+
const trackCreateHICAPSInvoice = data => trackEvent('created-hicaps-invoice', data);
|
|
35
|
+
const trackCreateGarrisonInvoice = data => trackEvent('created-garrison-invoice', data);
|
|
36
|
+
const trackCreateMedicareInvoice = data => trackEvent('created-medicare-invoice', data);
|
|
37
|
+
const trackCreatePatientFundedInvoice = data => trackEvent('created-patient-funded-invoice', data);
|
|
38
|
+
const trackCreateNDISInvoice = data => trackEvent('created-ndis-invoice', data);
|
|
39
|
+
const trackCreateOHCInvoice = data => trackEvent('created-ohc-invoice', data);
|
|
40
|
+
const trackCreateVirtualTerminalInvoice = data => trackEvent('created-virtual-terminal-invoice', data);
|
|
41
|
+
const trackCreateQuote = data => trackEvent('created-quote', data);
|
|
42
|
+
// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
|
|
43
|
+
const updateIntercom = data => window.Intercom('update', data); // eslint-disable-line new-cap
|
|
89
44
|
|
|
90
45
|
var intercom = {};
|
|
91
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.73.
|
|
3
|
+
"version": "11.73.3-chore-update-react-18.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"author": "Jake Moxey",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"react": ">=
|
|
22
|
-
"react-dom": ">=
|
|
21
|
+
"react": ">=18.0.0",
|
|
22
|
+
"react-dom": ">=18.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/runtime": "7.8.4",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"rimraf": "^2.6.2",
|
|
52
52
|
"typescript": "4.8.4"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "96282de8156eccff35ebe20525bf0f2201758221"
|
|
55
55
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var parseHealthFundCardFields = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, {});
|
|
10
|
-
});
|
|
5
|
+
var parseHealthFundCardFields = (cardFields => cardFields.reduce((result, field) => {
|
|
6
|
+
result[field.id] = field;
|
|
7
|
+
return result;
|
|
8
|
+
}, {}));
|
|
11
9
|
|
|
12
10
|
exports.default = parseHealthFundCardFields;
|
package/payment-options.js
CHANGED
|
@@ -4,39 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
var isPaymentCard = function isPaymentCard(paymentOption) {
|
|
20
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
|
|
21
|
-
};
|
|
22
|
-
var isPayInPerson = function isPayInPerson(paymentOption) {
|
|
23
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAY_IN_PERSON;
|
|
24
|
-
};
|
|
25
|
-
var isProcessOutsideMedipass = function isProcessOutsideMedipass(paymentOption) {
|
|
26
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PROCESS_OUTSIDE_MEDIPASS;
|
|
27
|
-
};
|
|
28
|
-
var isSendToPhone = function isSendToPhone(paymentOption) {
|
|
29
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PHONE;
|
|
30
|
-
};
|
|
31
|
-
var isPaymentHold = function isPaymentHold(paymentOption) {
|
|
32
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.HOLD;
|
|
33
|
-
};
|
|
34
|
-
var isInstalmentPlan = function isInstalmentPlan(paymentOption) {
|
|
35
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.INSTALMENT_PLAN;
|
|
36
|
-
};
|
|
37
|
-
var isTerminal = function isTerminal(paymentOption) {
|
|
38
|
-
return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.TERMINAL;
|
|
39
|
-
};
|
|
7
|
+
const isPaymentAuthority = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_AUTHORITY;
|
|
8
|
+
const isExistingPaymentCard = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD;
|
|
9
|
+
const isNewPaymentCard = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
|
|
10
|
+
const isLink = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.LINK;
|
|
11
|
+
const isPaymentCard = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
|
|
12
|
+
const isPayInPerson = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAY_IN_PERSON;
|
|
13
|
+
const isProcessOutsideMedipass = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PROCESS_OUTSIDE_MEDIPASS;
|
|
14
|
+
const isSendToPhone = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PHONE;
|
|
15
|
+
const isPaymentHold = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.HOLD;
|
|
16
|
+
const isInstalmentPlan = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.INSTALMENT_PLAN;
|
|
17
|
+
const isTerminal = paymentOption => paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.TERMINAL;
|
|
40
18
|
|
|
41
19
|
exports.PAYMENT_OPTIONS = constants.TRANSACTION_PAYMENT_OPTIONS;
|
|
42
20
|
exports.isExistingPaymentCard = isExistingPaymentCard;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const defaultPractice = {
|
|
4
4
|
_id: 'practiceDefaultId',
|
|
5
5
|
organisationId: 'organisationDefaultId',
|
|
6
6
|
businessId: 'businessDefaultId',
|
|
@@ -39,7 +39,7 @@ var defaultPractice = {
|
|
|
39
39
|
created: new Date('2015-01-01T00:00:00'),
|
|
40
40
|
modified: new Date('2015-01-02T00:00:00Z')
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
const defaultPractice2 = {
|
|
43
43
|
_id: 'practice2DefaultId',
|
|
44
44
|
organisationId: 'organisationDefaultId',
|
|
45
45
|
businessId: 'businessDefaultId',
|
|
@@ -72,7 +72,7 @@ var defaultPractice2 = {
|
|
|
72
72
|
created: new Date('2015-01-01T00:00:00'),
|
|
73
73
|
modified: new Date('2015-01-02T00:00:00Z')
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
const practices = [defaultPractice, defaultPractice2];
|
|
76
76
|
|
|
77
77
|
var practices$1 = /*#__PURE__*/Object.freeze({
|
|
78
78
|
__proto__: null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const productPro = {
|
|
4
4
|
_id: 'productProId',
|
|
5
5
|
organisationId: 'organisationDefaultId',
|
|
6
6
|
fullName: 'business:pro',
|
|
@@ -43,7 +43,7 @@ var productPro = {
|
|
|
43
43
|
created: new Date('2015-01-01T00:00:00Z'),
|
|
44
44
|
modified: new Date('2015-01-02T00:00:00Z')
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const productBasic = {
|
|
47
47
|
_id: 'productBasicId',
|
|
48
48
|
organisationId: 'organisationDefaultId',
|
|
49
49
|
fullName: 'business:basic',
|
package/products.js
CHANGED
|
@@ -7,23 +7,16 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var constants = require('./constants.js');
|
|
8
8
|
var _get = _interopDefault(require('lodash/get'));
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const getProductType = product => {
|
|
11
11
|
if (!product.fullName) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
var productType = product.fullName.split(':')[1];
|
|
14
|
+
const productType = product.fullName.split(':')[1];
|
|
16
15
|
return productType;
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var isBasic = function isBasic(product) {
|
|
22
|
-
return _get(product, 'fullName', '').includes(constants.PRODUCTS.BASIC);
|
|
23
|
-
};
|
|
24
|
-
var isPro = function isPro(product) {
|
|
25
|
-
return _get(product, 'fullName', '').includes(constants.PRODUCTS.PRO);
|
|
26
|
-
};
|
|
17
|
+
const isBusinessProduct = product => _get(product, 'fullName', '').includes('business:');
|
|
18
|
+
const isBasic = product => _get(product, 'fullName', '').includes(constants.PRODUCTS.BASIC);
|
|
19
|
+
const isPro = product => _get(product, 'fullName', '').includes(constants.PRODUCTS.PRO);
|
|
27
20
|
|
|
28
21
|
exports.getProductType = getProductType;
|
|
29
22
|
exports.isBasic = isBasic;
|
package/redux-actions.js
CHANGED
|
@@ -5,45 +5,37 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
8
|
-
var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator'));
|
|
9
|
-
var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator'));
|
|
10
8
|
var _get = _interopDefault(require('lodash/get'));
|
|
11
9
|
|
|
12
10
|
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; }
|
|
13
|
-
|
|
14
11
|
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(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; }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const REQUEST = 'REQUEST';
|
|
13
|
+
const SUCCESS = 'SUCCESS';
|
|
14
|
+
const FAILURE = 'FAILURE';
|
|
15
|
+
const CLEAR_ALL_STATE = 'CLEAR_ALL_STATE';
|
|
16
|
+
const CLEAR_VALUE = 'CLEAR_VALUE';
|
|
17
|
+
const SET_VALUE = 'SET_VALUE';
|
|
18
|
+
const action = function (type, payload) {
|
|
22
19
|
if (payload === void 0) {
|
|
23
20
|
payload = {};
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
return _objectSpread({
|
|
27
|
-
type
|
|
23
|
+
type
|
|
28
24
|
}, payload);
|
|
29
25
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
key: key,
|
|
40
|
-
value: value
|
|
41
|
-
};
|
|
42
|
-
};
|
|
26
|
+
const clear = keys => ({
|
|
27
|
+
type: CLEAR_VALUE,
|
|
28
|
+
keys
|
|
29
|
+
});
|
|
30
|
+
const set = (key, value) => ({
|
|
31
|
+
type: SET_VALUE,
|
|
32
|
+
key,
|
|
33
|
+
value
|
|
34
|
+
});
|
|
43
35
|
function createRequestTypes(base) {
|
|
44
|
-
return [REQUEST, SUCCESS, FAILURE].reduce(
|
|
45
|
-
|
|
46
|
-
a[type] = base
|
|
36
|
+
return [REQUEST, SUCCESS, FAILURE].reduce((acc, type) => {
|
|
37
|
+
const a = acc;
|
|
38
|
+
a[type] = `${base}_${type}`;
|
|
47
39
|
return a;
|
|
48
40
|
}, {});
|
|
49
41
|
}
|
|
@@ -54,105 +46,74 @@ function clearAllState() {
|
|
|
54
46
|
}
|
|
55
47
|
function receiveError(type, err) {
|
|
56
48
|
return {
|
|
57
|
-
type
|
|
58
|
-
err
|
|
49
|
+
type,
|
|
50
|
+
err
|
|
59
51
|
};
|
|
60
52
|
}
|
|
61
53
|
function receiveSuccess(type, data) {
|
|
62
54
|
return {
|
|
63
|
-
type
|
|
64
|
-
data
|
|
55
|
+
type,
|
|
56
|
+
data
|
|
65
57
|
};
|
|
66
58
|
}
|
|
67
59
|
function request(type, endpoint, data) {
|
|
68
60
|
if (data === void 0) {
|
|
69
61
|
data = null;
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
return {
|
|
73
|
-
type
|
|
74
|
-
endpoint
|
|
75
|
-
data
|
|
64
|
+
type,
|
|
65
|
+
endpoint,
|
|
66
|
+
data
|
|
76
67
|
};
|
|
77
68
|
}
|
|
78
|
-
|
|
69
|
+
const sdkActionCreator = function (sdkAction, actions, funcs) {
|
|
79
70
|
if (actions === void 0) {
|
|
80
71
|
actions = {};
|
|
81
72
|
}
|
|
82
|
-
|
|
83
73
|
if (funcs === void 0) {
|
|
84
74
|
funcs = {};
|
|
85
75
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
errorData.message = 'You are forbidden to view this resource.';
|
|
128
|
-
} // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (actions.failure) {
|
|
132
|
-
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
133
|
-
dispatch(actions.failure(errorData));
|
|
134
|
-
} // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (funcs.failure) {
|
|
138
|
-
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
139
|
-
funcs.failure(errorData);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
throw _context.t0;
|
|
143
|
-
|
|
144
|
-
case 17:
|
|
145
|
-
case "end":
|
|
146
|
-
return _context.stop();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, _callee, null, [[1, 10]]);
|
|
150
|
-
}));
|
|
151
|
-
|
|
152
|
-
return function (_x) {
|
|
153
|
-
return _ref.apply(this, arguments);
|
|
154
|
-
};
|
|
155
|
-
}();
|
|
76
|
+
return async dispatch => {
|
|
77
|
+
// @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.
|
|
78
|
+
if (actions.request) {
|
|
79
|
+
// @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.
|
|
80
|
+
dispatch(actions.request());
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const data = await sdkAction();
|
|
84
|
+
|
|
85
|
+
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
86
|
+
if (actions.success) {
|
|
87
|
+
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
88
|
+
dispatch(actions.success(data));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
92
|
+
if (funcs.success) {
|
|
93
|
+
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
94
|
+
funcs.success(data);
|
|
95
|
+
}
|
|
96
|
+
return data;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
const errorData = _get(err, 'data', err || 'An error occured!');
|
|
99
|
+
if (errorData.statusCode === 403 && !errorData.message) {
|
|
100
|
+
errorData.message = 'You are forbidden to view this resource.';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
104
|
+
if (actions.failure) {
|
|
105
|
+
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
106
|
+
dispatch(actions.failure(errorData));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
110
|
+
if (funcs.failure) {
|
|
111
|
+
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
112
|
+
funcs.failure(errorData);
|
|
113
|
+
}
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
156
117
|
};
|
|
157
118
|
var reduxActions = {};
|
|
158
119
|
|