@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.
Files changed (94) hide show
  1. package/abn.js +40 -45
  2. package/{billable-items-f8291b1e.js → billable-items-5e559447.js} +1 -1
  3. package/build-validation-schema.js +81 -123
  4. package/{businesses-2633ab9b.js → businesses-94ec0280.js} +1 -1
  5. package/chart.js +7 -14
  6. package/claim-payment-status-formatted.js +5 -2
  7. package/claim-payment-status-icons.js +13 -2
  8. package/claim-payment-status-text-classes.js +14 -2
  9. package/constants.js +82 -69
  10. package/countries.js +6 -8
  11. package/datetime.js +6 -13
  12. package/document-types-formatted.js +8 -3
  13. package/document-types-icons.js +4 -2
  14. package/document-types-text-classes.js +5 -2
  15. package/documents/workflow-state-formatted-text-classes.js +13 -4
  16. package/documents/workflow-state-formatted.js +13 -4
  17. package/documents/workflow-state-icons.js +11 -2
  18. package/form-applications/assign-values-to-sections.js +10 -16
  19. package/{forms-e1c51a53.js → forms-646810f2.js} +1 -1
  20. package/funders.js +21 -56
  21. package/get-env.js +38 -75
  22. package/get-select-options.js +21 -40
  23. package/get-staff-type-display-name.js +2 -4
  24. package/google-addresses.js +46 -91
  25. package/{health-fund-accounts-88eac93c.js → health-fund-accounts-8eda8621.js} +1 -1
  26. package/{health-fund-settings-e7a0f2ec.js → health-fund-settings-6d803913.js} +1 -1
  27. package/{health-funds-7fea63a0.js → health-funds-5e838942.js} +2 -2
  28. package/i18n/index.js +15 -18
  29. package/i18n/translations.js +1 -1
  30. package/index.js +1 -3
  31. package/intercom.js +24 -69
  32. package/{members-8eb8d8d0.js → members-e1797829.js} +1 -1
  33. package/{modalities-2dfbea63.js → modalities-d9979fa4.js} +1 -1
  34. package/package.json +4 -4
  35. package/parse-health-fund-card-fields.js +4 -6
  36. package/{patients-dd3709c1.js → patients-aba388c0.js} +1 -1
  37. package/{payment-methods-d36bc018.js → payment-methods-4010f9e5.js} +1 -1
  38. package/payment-options.js +11 -33
  39. package/{practices-d6c480f1.js → practices-17c06e6c.js} +3 -3
  40. package/{products-0a392564.js → products-7054c705.js} +2 -2
  41. package/products.js +5 -12
  42. package/{professional-categories-157d1767.js → professional-categories-0927144e.js} +1 -1
  43. package/redux-actions.js +69 -108
  44. package/redux-reducer.js +53 -69
  45. package/sanitise-url.js +1 -1
  46. package/scroll.js +1 -3
  47. package/sensitive-keys.js +2 -2
  48. package/sentry.js +35 -59
  49. package/service-items.js +70 -111
  50. package/{services-f8480eba.js → services-a81b505c.js} +3 -3
  51. package/{specialties-25fbb171.js → specialties-c29f2f67.js} +1 -1
  52. package/{staff-646053b7.js → staff-fedb5a08.js} +4 -4
  53. package/status-icons.js +12 -2
  54. package/status-text-classes.js +12 -2
  55. package/{subscriptions-aef302aa.js → subscriptions-25d86dab.js} +5 -5
  56. package/test-framework/fixtures/accounts.js +1 -1
  57. package/test-framework/fixtures/billable-items.js +1 -1
  58. package/test-framework/fixtures/businesses.js +1 -1
  59. package/test-framework/fixtures/documents.js +3 -3
  60. package/test-framework/fixtures/form-application-templates.js +1 -1
  61. package/test-framework/fixtures/form-applications.js +1 -1
  62. package/test-framework/fixtures/forms.js +1 -1
  63. package/test-framework/fixtures/health-fund-accounts.js +1 -1
  64. package/test-framework/fixtures/health-fund-settings.js +1 -1
  65. package/test-framework/fixtures/health-funds.js +1 -1
  66. package/test-framework/fixtures/index.js +18 -18
  67. package/test-framework/fixtures/members.js +1 -1
  68. package/test-framework/fixtures/message-mappings.js +1 -1
  69. package/test-framework/fixtures/modalities.js +1 -1
  70. package/test-framework/fixtures/patients.js +1 -1
  71. package/test-framework/fixtures/payment-methods.js +1 -1
  72. package/test-framework/fixtures/practices.js +1 -1
  73. package/test-framework/fixtures/products.js +1 -1
  74. package/test-framework/fixtures/professional-categories.js +1 -1
  75. package/test-framework/fixtures/services.js +1 -1
  76. package/test-framework/fixtures/specialties.js +1 -1
  77. package/test-framework/fixtures/staff.js +1 -1
  78. package/test-framework/fixtures/subscriptions.js +1 -1
  79. package/test-framework/fixtures/transaction-reports.js +6 -6
  80. package/test-framework/fixtures/transactions.js +1 -1
  81. package/test-framework/fixtures/workflow-exceptions.js +2 -2
  82. package/test-framework/react.js +10 -12
  83. package/transaction-details-by-funder.js +20 -21
  84. package/transaction-status-formatted.js +13 -3
  85. package/transaction-status-helpers.js +21 -27
  86. package/transaction-status-icons.js +9 -2
  87. package/transaction-status-text-classes.js +16 -2
  88. package/transaction-status.js +7 -15
  89. package/{transactions-4a08e450.js → transactions-de63fd15.js} +14 -14
  90. package/validate-form.js +79 -269
  91. package/validate.js +16 -28
  92. package/webpack-config.js +6 -13
  93. package/workflow-state-formatted-text-classes.js +12 -4
  94. 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(function (resources, region) {
19
- var _objectSpread3;
20
-
21
- return _objectSpread({}, resources, (_objectSpread3 = {}, _objectSpread3[region] = {
22
- translation: Object.entries(translations$1).reduce(function (currentTranslations, _ref) {
23
- var _objectSpread2;
24
-
25
- var key = _ref[0],
26
- value = _ref[1];
27
- return _objectSpread({}, currentTranslations, (_objectSpread2 = {}, _objectSpread2[key] = value[region], _objectSpread2));
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: function setup(_ref2) {
36
- var region = _ref2.region;
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
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var constants = require('../constants.js');
6
6
 
7
- var regionsList = Object.values(constants.REGIONS);
7
+ const regionsList = Object.values(constants.REGIONS);
8
8
  var translations = {
9
9
  $: {
10
10
  au: '$',
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
- var utils = {
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
- var bootIntercom = /*#__PURE__*/function () {
19
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
20
- return _regeneratorRuntime.wrap(function _callee$(_context) {
21
- while (1) {
22
- switch (_context.prev = _context.next) {
23
- case 0:
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
- return function bootIntercom(_x) {
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
- var trackEvent = function trackEvent(name, data) {
55
- return window.Intercom('trackEvent', name, data);
56
- }; // eslint-disable-line new-cap
57
-
58
- var trackCreateDVAInvoice = function trackCreateDVAInvoice(data) {
59
- return trackEvent('created-dva-invoice', data);
60
- };
61
- var trackCreateHICAPSInvoice = function trackCreateHICAPSInvoice(data) {
62
- return trackEvent('created-hicaps-invoice', data);
63
- };
64
- var trackCreateGarrisonInvoice = function trackCreateGarrisonInvoice(data) {
65
- return trackEvent('created-garrison-invoice', data);
66
- };
67
- var trackCreateMedicareInvoice = function trackCreateMedicareInvoice(data) {
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
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var defaultMember = {
3
+ const defaultMember = {
4
4
  _id: 'memberDefaultId',
5
5
  organisationId: 'organisationDefaultId',
6
6
  firstName: 'Bruce',
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var defaultModality = {
3
+ const defaultModality = {
4
4
  _id: 'modalityDefaultId',
5
5
  fullName: 'Chiropractic',
6
6
  displayName: 'mockDisplayName',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "11.73.2",
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": ">=17.0.0",
22
- "react-dom": ">=17.0.0"
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": "4cf04968069791ec3ee2472de6c486f3e36425fa"
54
+ "gitHead": "96282de8156eccff35ebe20525bf0f2201758221"
55
55
  }
@@ -2,11 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var parseHealthFundCardFields = (function (cardFields) {
6
- return cardFields.reduce(function (result, field) {
7
- result[field.id] = field;
8
- return result;
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;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var defaultPatient = {
3
+ const defaultPatient = {
4
4
  _id: 'patientDefaultId',
5
5
  organisationId: 'organisationDefaultId',
6
6
  businessId: 'businessDefaultId',
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var defaultPaymentMethod = {
3
+ const defaultPaymentMethod = {
4
4
  _id: 'paymentMethodDefaultId',
5
5
  organisationId: 'organisationDefaultId',
6
6
  accountId: 'consumerAccountDefaultId',
@@ -4,39 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var constants = require('./constants.js');
6
6
 
7
- var isPaymentAuthority = function isPaymentAuthority(paymentOption) {
8
- return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_AUTHORITY;
9
- };
10
- var isExistingPaymentCard = function isExistingPaymentCard(paymentOption) {
11
- return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD;
12
- };
13
- var isNewPaymentCard = function isNewPaymentCard(paymentOption) {
14
- return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
15
- };
16
- var isLink = function isLink(paymentOption) {
17
- return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.LINK;
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
- var defaultPractice = {
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
- var defaultPractice2 = {
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
- var practices = [defaultPractice, defaultPractice2];
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
- var productPro = {
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
- var productBasic = {
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
- var getProductType = function getProductType(product) {
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
- var isBusinessProduct = function isBusinessProduct(product) {
19
- return _get(product, 'fullName', '').includes('business:');
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;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var defaultProfessionalCategory = {
3
+ const defaultProfessionalCategory = {
4
4
  _id: 'professionalCategoryDefaultId',
5
5
  fullName: 'mockFullName',
6
6
  displayName: 'mockDisplayName',
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
- var REQUEST = 'REQUEST';
16
- var SUCCESS = 'SUCCESS';
17
- var FAILURE = 'FAILURE';
18
- var CLEAR_ALL_STATE = 'CLEAR_ALL_STATE';
19
- var CLEAR_VALUE = 'CLEAR_VALUE';
20
- var SET_VALUE = 'SET_VALUE';
21
- var action = function action(type, payload) {
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: type
23
+ type
28
24
  }, payload);
29
25
  };
30
- var clear = function clear(keys) {
31
- return {
32
- type: CLEAR_VALUE,
33
- keys: keys
34
- };
35
- };
36
- var set = function set(key, value) {
37
- return {
38
- type: SET_VALUE,
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(function (acc, type) {
45
- var a = acc;
46
- a[type] = base + "_" + type;
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: type,
58
- err: err
49
+ type,
50
+ err
59
51
  };
60
52
  }
61
53
  function receiveSuccess(type, data) {
62
54
  return {
63
- type: type,
64
- data: 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: type,
74
- endpoint: endpoint,
75
- data: data
64
+ type,
65
+ endpoint,
66
+ data
76
67
  };
77
68
  }
78
- var sdkActionCreator = function sdkActionCreator(sdkAction, actions, funcs) {
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
- return /*#__PURE__*/function () {
88
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch) {
89
- var data, errorData;
90
- return _regeneratorRuntime.wrap(function _callee$(_context) {
91
- while (1) {
92
- switch (_context.prev = _context.next) {
93
- case 0:
94
- // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.
95
- if (actions.request) {
96
- // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.
97
- dispatch(actions.request());
98
- }
99
-
100
- _context.prev = 1;
101
- _context.next = 4;
102
- return sdkAction();
103
-
104
- case 4:
105
- data = _context.sent;
106
-
107
- // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
108
- if (actions.success) {
109
- // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
110
- dispatch(actions.success(data));
111
- } // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
112
-
113
-
114
- if (funcs.success) {
115
- // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
116
- funcs.success(data);
117
- }
118
-
119
- return _context.abrupt("return", data);
120
-
121
- case 10:
122
- _context.prev = 10;
123
- _context.t0 = _context["catch"](1);
124
- errorData = _get(_context.t0, 'data', _context.t0 || 'An error occured!');
125
-
126
- if (errorData.statusCode === 403 && !errorData.message) {
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