@medipass/utils 11.66.7-feature-eclipse-reporting.0 → 11.68.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 (95) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +2 -2
  3. package/billable-items-01050ba2.js +0 -27
  4. package/build-validation-schema.js +0 -1282
  5. package/businesses-e3a20604.js +0 -53
  6. package/chart.js +0 -45
  7. package/claim-payment-status-formatted.js +0 -12
  8. package/claim-payment-status-icons.js +0 -10
  9. package/claim-payment-status-text-classes.js +0 -10
  10. package/constants.js +0 -460
  11. package/countries.js +0 -1011
  12. package/datetime.js +0 -36
  13. package/document-types-formatted.js +0 -13
  14. package/document-types-icons.js +0 -10
  15. package/document-types-text-classes.js +0 -10
  16. package/documents/workflow-state-formatted-text-classes.js +0 -12
  17. package/documents/workflow-state-formatted.js +0 -15
  18. package/documents/workflow-state-icons.js +0 -10
  19. package/form-applications/assign-values-to-sections.js +0 -29
  20. package/forms-f06ca97e.js +0 -51
  21. package/funders.js +0 -122
  22. package/get-env.js +0 -196
  23. package/get-select-options.js +0 -65
  24. package/get-staff-type-display-name.js +0 -12
  25. package/google-addresses.js +0 -127
  26. package/health-fund-accounts-3cd8650f.js +0 -20
  27. package/health-fund-settings-43327826.js +0 -22
  28. package/health-funds-300facef.js +0 -194
  29. package/i18n/index.js +0 -59
  30. package/i18n/translations.js +0 -36
  31. package/index.js +0 -56
  32. package/intercom.js +0 -101
  33. package/members-cb4f73a9.js +0 -53
  34. package/modalities-b360d521.js +0 -19
  35. package/normalise-abn.js +0 -22
  36. package/parse-health-fund-card-fields.js +0 -12
  37. package/patients-2083dd9c.js +0 -46
  38. package/payment-methods-4fa2d01f.js +0 -26
  39. package/payment-options.js +0 -52
  40. package/practices-3e703f22.js +0 -87
  41. package/products-bd313cb4.js +0 -83
  42. package/products.js +0 -31
  43. package/professional-categories-e2e5284b.js +0 -19
  44. package/redux-actions.js +0 -161
  45. package/redux-reducer.js +0 -112
  46. package/sanitise-url.js +0 -17
  47. package/scroll.js +0 -9
  48. package/sensitive-keys.js +0 -9
  49. package/sentry.js +0 -112
  50. package/service-items.js +0 -230
  51. package/services-2e25cdac.js +0 -127
  52. package/specialties-7640b7e3.js +0 -20
  53. package/staff-990794cd.js +0 -161
  54. package/status-icons.js +0 -10
  55. package/status-text-classes.js +0 -10
  56. package/subscriptions-45c1321a.js +0 -160
  57. package/test-framework/fixtures/accounts.js +0 -34
  58. package/test-framework/fixtures/billable-items.js +0 -9
  59. package/test-framework/fixtures/businesses.js +0 -9
  60. package/test-framework/fixtures/documents.js +0 -121
  61. package/test-framework/fixtures/form-application-templates.js +0 -74
  62. package/test-framework/fixtures/form-applications.js +0 -39
  63. package/test-framework/fixtures/forms.js +0 -9
  64. package/test-framework/fixtures/health-fund-accounts.js +0 -9
  65. package/test-framework/fixtures/health-fund-settings.js +0 -9
  66. package/test-framework/fixtures/health-funds.js +0 -10
  67. package/test-framework/fixtures/index.js +0 -45
  68. package/test-framework/fixtures/members.js +0 -9
  69. package/test-framework/fixtures/message-mappings.js +0 -61
  70. package/test-framework/fixtures/modalities.js +0 -9
  71. package/test-framework/fixtures/patients.js +0 -9
  72. package/test-framework/fixtures/payment-methods.js +0 -9
  73. package/test-framework/fixtures/practices.js +0 -11
  74. package/test-framework/fixtures/products.js +0 -10
  75. package/test-framework/fixtures/professional-categories.js +0 -9
  76. package/test-framework/fixtures/services.js +0 -11
  77. package/test-framework/fixtures/specialties.js +0 -9
  78. package/test-framework/fixtures/staff.js +0 -12
  79. package/test-framework/fixtures/subscriptions.js +0 -13
  80. package/test-framework/fixtures/transaction-reports.js +0 -203
  81. package/test-framework/fixtures/transactions.js +0 -22
  82. package/test-framework/fixtures/workflow-exceptions.js +0 -32
  83. package/test-framework/react.js +0 -38
  84. package/transaction-details-by-funder.js +0 -81
  85. package/transaction-status-formatted.js +0 -13
  86. package/transaction-status-helpers.js +0 -77
  87. package/transaction-status-icons.js +0 -10
  88. package/transaction-status-text-classes.js +0 -10
  89. package/transaction-status.js +0 -42
  90. package/transactions-6e5fd92d.js +0 -1883
  91. package/validate-form.js +0 -388
  92. package/validate.js +0 -37
  93. package/webpack-config.js +0 -27
  94. package/workflow-state-formatted-text-classes.js +0 -12
  95. package/workflow-state-formatted.js +0 -13
package/normalise-abn.js DELETED
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var ABN_LENGTH = 11;
6
- var ACN_LENGTH = 9;
7
- var normaliseAbn = (function (abn) {
8
- var trimmedABN = abn && abn.replace(/\s/g, ''); // The input is an ABN, in which case the format should be 99 999 999 999
9
-
10
- if (trimmedABN.length === ABN_LENGTH) {
11
- return trimmedABN.substring(0, 2) + ' ' + trimmedABN.substring(2, 5) + ' ' + trimmedABN.substring(5, 8) + ' ' + trimmedABN.substring(8);
12
- } //The input is an ACN, in which case the format should be 999 999 999
13
-
14
-
15
- if (trimmedABN.length === ACN_LENGTH) {
16
- return trimmedABN.substring(0, 3) + ' ' + trimmedABN.substring(3, 6) + ' ' + trimmedABN.substring(6);
17
- }
18
-
19
- return abn;
20
- });
21
-
22
- exports.default = normaliseAbn;
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var parseHealthFundCardFields = (function (cardFields) {
6
- return cardFields.reduce(function (result, field) {
7
- result[field.id] = field;
8
- return result;
9
- }, {});
10
- });
11
-
12
- exports.default = parseHealthFundCardFields;
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- var defaultPatient = {
4
- _id: 'patientDefaultId',
5
- organisationId: 'organisationDefaultId',
6
- businessId: 'businessDefaultId',
7
- memberId: 'memberDefaultId',
8
- title: 'Mr',
9
- firstName: 'Teddy',
10
- middleName: 'The',
11
- lastName: 'Groodle',
12
- gender: 'M',
13
- email: 'mockaccountpatientemail@localz.co',
14
- mobile: '0412345678',
15
- mobileE164: '+61412345678',
16
- searchWords: ['teddy', 'teddy groodle', 'groodle', 'groodle teddy', '0412345678', '+61412345678', 'mockaccountemail@localz.co'],
17
- dob: new Date('1984-02-19T14:00:00.000Z'),
18
- dobString: '1984-02-20',
19
- address: '412 Collins St',
20
- postcode: '3000',
21
- city: 'Melbourne',
22
- state: 'Victoria',
23
- country: 'Australia',
24
- countryCode: 'au',
25
- lnglat: [0, 0],
26
- refId: 'patientDefaultRefId',
27
- refSource: 'patientDefaultRefSource',
28
- modified: new Date('2015-01-01T00:00:00'),
29
- created: new Date('2015-01-02T00:00:00Z'),
30
- emergencyContact: {
31
- firstName: 'emerFirstName',
32
- lastName: 'emerLastName',
33
- mobile: '+61422000333',
34
- landline: '+61390003344',
35
- relationship: 'Mother'
36
- },
37
- status: 'NEW'
38
- };
39
-
40
- var patients = /*#__PURE__*/Object.freeze({
41
- __proto__: null,
42
- defaultPatient: defaultPatient
43
- });
44
-
45
- exports.defaultPatient = defaultPatient;
46
- exports.patients = patients;
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var defaultPaymentMethod = {
4
- _id: 'paymentMethodDefaultId',
5
- organisationId: 'organisationDefaultId',
6
- accountId: 'consumerAccountDefaultId',
7
- token: 'kq7dv2',
8
- source: 'braintree',
9
- methodType: 'creditCard',
10
- cardType: 'MasterCard',
11
- lastFour: '8776',
12
- expiryMonth: '12',
13
- expiryYear: '2030',
14
- isDebit: false,
15
- isDefault: true,
16
- created: new Date('2015-01-01T00:00:00'),
17
- modified: new Date('2015-01-02T00:00:00Z')
18
- };
19
-
20
- var paymentMethods = /*#__PURE__*/Object.freeze({
21
- __proto__: null,
22
- defaultPaymentMethod: defaultPaymentMethod
23
- });
24
-
25
- exports.defaultPaymentMethod = defaultPaymentMethod;
26
- exports.paymentMethods = paymentMethods;
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var constants = require('./constants.js');
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
- };
40
-
41
- exports.PAYMENT_OPTIONS = constants.TRANSACTION_PAYMENT_OPTIONS;
42
- exports.isExistingPaymentCard = isExistingPaymentCard;
43
- exports.isInstalmentPlan = isInstalmentPlan;
44
- exports.isLink = isLink;
45
- exports.isNewPaymentCard = isNewPaymentCard;
46
- exports.isPayInPerson = isPayInPerson;
47
- exports.isPaymentAuthority = isPaymentAuthority;
48
- exports.isPaymentCard = isPaymentCard;
49
- exports.isPaymentHold = isPaymentHold;
50
- exports.isProcessOutsideMedipass = isProcessOutsideMedipass;
51
- exports.isSendToPhone = isSendToPhone;
52
- exports.isTerminal = isTerminal;
@@ -1,87 +0,0 @@
1
- 'use strict';
2
-
3
- var defaultPractice = {
4
- _id: 'practiceDefaultId',
5
- organisationId: 'organisationDefaultId',
6
- businessId: 'businessDefaultId',
7
- displayName: 'Practice 1',
8
- fullName: 'Practice 1',
9
- description: 'This is a description.\nIt can span many lines.',
10
- practiceTypeIds: ['practiceTypeDefaultId'],
11
- merchantId: 'merchant1',
12
- abn: 'mockAbn',
13
- staffIds: ['staffPractitionerDefaultId'],
14
- address: '1 Main Street',
15
- postcode: '3163',
16
- city: 'Carnegie',
17
- state: 'Victoria',
18
- country: 'Australia',
19
- countryCode: 'au',
20
- tz: 'Australia/Brisbane',
21
- lnglat: [145.057504, -37.888507],
22
- mobile: '0400 000 000',
23
- mobileE164: '+61400000000',
24
- landline: '+6195553333',
25
- email: 'practice1@localz.co',
26
- status: 'ACTIVE',
27
- searchWords: ['practice 1', 'practice 1'],
28
- bookingsUrl: 'http://mockExample.com/mockPath',
29
- logoUrl: 'http://mockLogoUrl/mockPath',
30
- websiteUrl: 'mockWebsiteUrl',
31
- settings: {
32
- appointments: {
33
- memberAppointmentsEnabled: true,
34
- pushReminderEnabled: true
35
- }
36
- },
37
- refId: 'practice1RefId',
38
- refSource: 'groupMockRefSource1',
39
- created: new Date('2015-01-01T00:00:00'),
40
- modified: new Date('2015-01-02T00:00:00Z')
41
- };
42
- var defaultPractice2 = {
43
- _id: 'practice2DefaultId',
44
- organisationId: 'organisationDefaultId',
45
- businessId: 'businessDefaultId',
46
- displayName: 'Practice 2',
47
- fullName: 'Practice 2',
48
- description: 'This is a description.\nIt can span many lines.',
49
- practiceTypeIds: ['practiceTypeDefaultId'],
50
- merchantId: 'merchant1',
51
- abn: 'mockAbn',
52
- staffIds: ['staffPractitionerDefaultId'],
53
- address: '1 Main Street',
54
- postcode: '3163',
55
- city: 'Carnegie',
56
- state: 'Victoria',
57
- country: 'Australia',
58
- countryCode: 'au',
59
- tz: 'Australia/Brisbane',
60
- lnglat: [145.057504, -37.888507],
61
- mobile: '0400 000 000',
62
- mobileE164: '+61400000000',
63
- landline: '+6195553333',
64
- email: 'practice1@localz.co',
65
- status: 'ACTIVE',
66
- searchWords: ['practice 2', 'practice 2'],
67
- bookingsUrl: 'http://mockExample.com/mockPath',
68
- logoUrl: 'mockLogoUrl',
69
- websiteUrl: 'mockWebsiteUrl',
70
- refId: 'practice2RefId',
71
- refSource: 'groupMockRefSource2',
72
- created: new Date('2015-01-01T00:00:00'),
73
- modified: new Date('2015-01-02T00:00:00Z')
74
- };
75
- var practices = [defaultPractice, defaultPractice2];
76
-
77
- var practices$1 = /*#__PURE__*/Object.freeze({
78
- __proto__: null,
79
- defaultPractice: defaultPractice,
80
- defaultPractice2: defaultPractice2,
81
- practices: practices
82
- });
83
-
84
- exports.defaultPractice = defaultPractice;
85
- exports.defaultPractice2 = defaultPractice2;
86
- exports.practices = practices;
87
- exports.practices$1 = practices$1;
@@ -1,83 +0,0 @@
1
- 'use strict';
2
-
3
- var productPro = {
4
- _id: 'productProId',
5
- organisationId: 'organisationDefaultId',
6
- fullName: 'business:pro',
7
- displayName: 'mockDisplayName',
8
- description: 'mockDescription',
9
- logoUrl: 'mockLogoUrl',
10
- defaultBilling: {
11
- currencyCode: 'AUD',
12
- frequency: 'monthly',
13
- amountFee: 1000,
14
- amountCharged: 1000,
15
- strategy: 'perprovider'
16
- },
17
- features: [{
18
- fullName: 'mockFeature1',
19
- displayName: 'mockFeature1Display',
20
- description: 'mockFeature1Description',
21
- isLive: true
22
- }, {
23
- fullName: 'mockFeature2',
24
- displayName: 'mockFeature2Display',
25
- description: 'mockFeature2Description',
26
- isLive: true
27
- }, {
28
- fullName: 'mockFeature3',
29
- displayName: 'mockFeature3Display',
30
- description: 'mockFeature3Description',
31
- isLive: true
32
- }, {
33
- fullName: 'mockFeature4',
34
- displayName: 'mockFeature4Display',
35
- description: 'mockFeature4Description',
36
- isLive: false
37
- }, {
38
- fullName: 'mockFeature5',
39
- displayName: 'mockFeature5Display',
40
- description: 'mockFeature5Description',
41
- isLive: true
42
- }],
43
- created: new Date('2015-01-01T00:00:00Z'),
44
- modified: new Date('2015-01-02T00:00:00Z')
45
- };
46
- var productBasic = {
47
- _id: 'productBasicId',
48
- organisationId: 'organisationDefaultId',
49
- fullName: 'business:basic',
50
- displayName: 'mockDisplayName',
51
- description: 'mockDescription',
52
- logoUrl: 'mockLogoUrl',
53
- defaultBilling: {
54
- currencyCode: 'AUD',
55
- frequency: 'monthly',
56
- amountFee: 0,
57
- amountCharged: 0,
58
- strategy: 'perprovider'
59
- },
60
- features: [{
61
- fullName: 'mockFeature1',
62
- displayName: 'mockFeature1Display',
63
- description: 'mockFeature1Description',
64
- isLive: true
65
- }, {
66
- fullName: 'mockFeature2',
67
- displayName: 'mockFeature2Display',
68
- description: 'mockFeature2Description',
69
- isLive: true
70
- }],
71
- created: new Date('2015-01-01T00:00:00Z'),
72
- modified: new Date('2015-01-02T00:00:00Z')
73
- };
74
-
75
- var products = /*#__PURE__*/Object.freeze({
76
- __proto__: null,
77
- productPro: productPro,
78
- productBasic: productBasic
79
- });
80
-
81
- exports.productBasic = productBasic;
82
- exports.productPro = productPro;
83
- exports.products = products;
package/products.js DELETED
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var constants = require('./constants.js');
8
- var _get = _interopDefault(require('lodash/get'));
9
-
10
- var getProductType = function getProductType(product) {
11
- if (!product.fullName) {
12
- return;
13
- }
14
-
15
- var productType = product.fullName.split(':')[1];
16
- return productType;
17
- };
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
- };
27
-
28
- exports.getProductType = getProductType;
29
- exports.isBasic = isBasic;
30
- exports.isBusinessProduct = isBusinessProduct;
31
- exports.isPro = isPro;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- var defaultProfessionalCategory = {
4
- _id: 'professionalCategoryDefaultId',
5
- fullName: 'mockFullName',
6
- displayName: 'mockDisplayName',
7
- description: 'mockDescription',
8
- searchWords: ['mockfullname', 'mockdisplayname'],
9
- created: new Date('2015-01-01T00:00:00Z'),
10
- modified: new Date('2015-01-02T00:00:00Z')
11
- };
12
-
13
- var professionalCategories = /*#__PURE__*/Object.freeze({
14
- __proto__: null,
15
- defaultProfessionalCategory: defaultProfessionalCategory
16
- });
17
-
18
- exports.defaultProfessionalCategory = defaultProfessionalCategory;
19
- exports.professionalCategories = professionalCategories;
package/redux-actions.js DELETED
@@ -1,161 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
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
- var _get = _interopDefault(require('lodash/get'));
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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) {
22
- if (payload === void 0) {
23
- payload = {};
24
- }
25
-
26
- return _objectSpread({
27
- type: type
28
- }, payload);
29
- };
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
- };
43
- var createRequestTypes = function createRequestTypes(base) {
44
- return [REQUEST, SUCCESS, FAILURE].reduce(function (acc, type) {
45
- var a = acc;
46
- a[type] = base + "_" + type;
47
- return a;
48
- }, {});
49
- };
50
- function clearAllState() {
51
- return {
52
- type: CLEAR_ALL_STATE
53
- };
54
- }
55
- function receiveError(type, err) {
56
- return {
57
- type: type,
58
- err: err
59
- };
60
- }
61
- function receiveSuccess(type, data) {
62
- return {
63
- type: type,
64
- data: data
65
- };
66
- }
67
- function request(type, endpoint, data) {
68
- if (data === void 0) {
69
- data = null;
70
- }
71
-
72
- return {
73
- type: type,
74
- endpoint: endpoint,
75
- data: data
76
- };
77
- }
78
- var sdkActionCreator = function sdkActionCreator(sdkAction, actions, funcs) {
79
- if (actions === void 0) {
80
- actions = {};
81
- }
82
-
83
- if (funcs === void 0) {
84
- funcs = {};
85
- }
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
- if (actions.request) {
95
- dispatch(actions.request());
96
- }
97
-
98
- _context.prev = 1;
99
- _context.next = 4;
100
- return sdkAction();
101
-
102
- case 4:
103
- data = _context.sent;
104
-
105
- if (actions.success) {
106
- dispatch(actions.success(data));
107
- }
108
-
109
- if (funcs.success) {
110
- funcs.success(data);
111
- }
112
-
113
- return _context.abrupt("return", data);
114
-
115
- case 10:
116
- _context.prev = 10;
117
- _context.t0 = _context["catch"](1);
118
- errorData = _get(_context.t0, 'data', _context.t0 || 'An error occured!');
119
-
120
- if (errorData.statusCode === 403 && !errorData.message) {
121
- errorData.message = 'You are forbidden to view this resource.';
122
- }
123
-
124
- if (actions.failure) {
125
- dispatch(actions.failure(errorData));
126
- }
127
-
128
- if (funcs.failure) {
129
- funcs.failure(errorData);
130
- }
131
-
132
- throw _context.t0;
133
-
134
- case 17:
135
- case "end":
136
- return _context.stop();
137
- }
138
- }
139
- }, _callee, null, [[1, 10]]);
140
- }));
141
-
142
- return function (_x) {
143
- return _ref.apply(this, arguments);
144
- };
145
- }();
146
- };
147
- var reduxActions = {};
148
-
149
- exports.CLEAR_ALL_STATE = CLEAR_ALL_STATE;
150
- exports.CLEAR_VALUE = CLEAR_VALUE;
151
- exports.SET_VALUE = SET_VALUE;
152
- exports.action = action;
153
- exports.clear = clear;
154
- exports.clearAllState = clearAllState;
155
- exports.createRequestTypes = createRequestTypes;
156
- exports.default = reduxActions;
157
- exports.receiveError = receiveError;
158
- exports.receiveSuccess = receiveSuccess;
159
- exports.request = request;
160
- exports.sdkActionCreator = sdkActionCreator;
161
- exports.set = set;
package/redux-reducer.js DELETED
@@ -1,112 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
8
- require('@babel/runtime/regenerator');
9
- require('@babel/runtime/helpers/asyncToGenerator');
10
- require('lodash/get');
11
- var _set = _interopDefault(require('lodash/set'));
12
- var _pick = _interopDefault(require('lodash/pick'));
13
- var reduxActions = require('./redux-actions.js');
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
- var request = function request(state, _temp) {
19
- var _objectSpread2;
20
-
21
- var _ref = _temp === void 0 ? {} : _temp,
22
- _ref$isFetchingKey = _ref.isFetchingKey,
23
- isFetchingKey = _ref$isFetchingKey === void 0 ? 'isFetching' : _ref$isFetchingKey,
24
- _ref$hasFetchedKey = _ref.hasFetchedKey,
25
- hasFetchedKey = _ref$hasFetchedKey === void 0 ? 'hasFetched' : _ref$hasFetchedKey,
26
- _ref$persistState = _ref.persistState,
27
- persistState = _ref$persistState === void 0 ? true : _ref$persistState;
28
-
29
- return _objectSpread({}, persistState ? state : {}, (_objectSpread2 = {}, _objectSpread2[isFetchingKey] = true, _objectSpread2[hasFetchedKey] = false, _objectSpread2));
30
- };
31
- var oneSuccess = function oneSuccess(state, action, _temp2) {
32
- var _objectSpread3;
33
-
34
- var _ref2 = _temp2 === void 0 ? {} : _temp2,
35
- _ref2$isFetchingKey = _ref2.isFetchingKey,
36
- isFetchingKey = _ref2$isFetchingKey === void 0 ? 'isFetching' : _ref2$isFetchingKey,
37
- _ref2$hasFetchedKey = _ref2.hasFetchedKey,
38
- hasFetchedKey = _ref2$hasFetchedKey === void 0 ? 'hasFetched' : _ref2$hasFetchedKey,
39
- _ref2$persistState = _ref2.persistState,
40
- persistState = _ref2$persistState === void 0 ? false : _ref2$persistState;
41
-
42
- return _objectSpread({}, persistState ? state : {}, (_objectSpread3 = {}, _objectSpread3[isFetchingKey] = false, _objectSpread3[hasFetchedKey] = true, _objectSpread3.data = action.payload, _objectSpread3));
43
- };
44
- var paginatedListSuccess = function paginatedListSuccess(state, action, _temp3) {
45
- var _objectSpread4;
46
-
47
- var _ref3 = _temp3 === void 0 ? {} : _temp3,
48
- _ref3$isFetchingKey = _ref3.isFetchingKey,
49
- isFetchingKey = _ref3$isFetchingKey === void 0 ? 'isFetching' : _ref3$isFetchingKey,
50
- _ref3$hasFetchedKey = _ref3.hasFetchedKey,
51
- hasFetchedKey = _ref3$hasFetchedKey === void 0 ? 'hasFetched' : _ref3$hasFetchedKey;
52
-
53
- var payload = _objectSpread({}, action.payload);
54
-
55
- if (payload.meta) {
56
- payload.meta = _objectSpread({}, payload.meta, {
57
- currentPage: action.currentPage || 1
58
- });
59
- }
60
-
61
- return _objectSpread({}, payload, (_objectSpread4 = {}, _objectSpread4[isFetchingKey] = false, _objectSpread4[hasFetchedKey] = true, _objectSpread4));
62
- };
63
- var failure = function failure(state, action, _temp4) {
64
- var _objectSpread5;
65
-
66
- var _ref4 = _temp4 === void 0 ? {} : _temp4,
67
- _ref4$isFetchingKey = _ref4.isFetchingKey,
68
- isFetchingKey = _ref4$isFetchingKey === void 0 ? 'isFetching' : _ref4$isFetchingKey,
69
- _ref4$hasFetchedKey = _ref4.hasFetchedKey,
70
- hasFetchedKey = _ref4$hasFetchedKey === void 0 ? 'hasFetched' : _ref4$hasFetchedKey,
71
- _ref4$persistState = _ref4.persistState,
72
- persistState = _ref4$persistState === void 0 ? false : _ref4$persistState;
73
-
74
- return _objectSpread({}, persistState ? state : {}, (_objectSpread5 = {}, _objectSpread5[isFetchingKey] = false, _objectSpread5[hasFetchedKey] = false, _objectSpread5.error = action.payload, _objectSpread5));
75
- };
76
- var getRootReducer = function getRootReducer(appReducer, _temp5) {
77
- var _ref5 = _temp5 === void 0 ? {
78
- persistKeys: {}
79
- } : _temp5,
80
- persistKeys = _ref5.persistKeys;
81
-
82
- return function (state, action) {
83
- var newState = _objectSpread({}, state);
84
-
85
- if (action.type === reduxActions.CLEAR_ALL_STATE) {
86
- newState = _objectSpread({}, _pick(state, persistKeys));
87
- }
88
-
89
- if (action.type === reduxActions.CLEAR_VALUE) {
90
- action.keys.forEach(function (key) {
91
- return _set(newState, key, {});
92
- });
93
- newState = _objectSpread({}, state, {}, newState);
94
- }
95
-
96
- if (action.type === reduxActions.SET_VALUE) {
97
- var _objectSpread6;
98
-
99
- newState = _objectSpread({}, newState, (_objectSpread6 = {}, _objectSpread6[action.key] = action.value, _objectSpread6));
100
- }
101
-
102
- return appReducer(newState, action);
103
- };
104
- };
105
- var reduxReducer = {};
106
-
107
- exports.default = reduxReducer;
108
- exports.failure = failure;
109
- exports.getRootReducer = getRootReducer;
110
- exports.oneSuccess = oneSuccess;
111
- exports.paginatedListSuccess = paginatedListSuccess;
112
- exports.request = request;
package/sanitise-url.js DELETED
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var escape = _interopDefault(require('escape-html'));
8
-
9
- function sanitiseUrl(url) {
10
- var escapedUrl = escape(url);
11
- return {
12
- hasChanged: url !== escapedUrl,
13
- url: escapedUrl
14
- };
15
- }
16
-
17
- exports.default = sanitiseUrl;
package/scroll.js DELETED
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var scroll = (function (options) {
6
- return document.getElementById('main-content') && document.getElementById('main-content').scroll && document.getElementById('main-content').scroll(options);
7
- });
8
-
9
- exports.default = scroll;