@medipass/utils 11.79.2-chore-environment-variables.1 → 11.79.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abn.js +27 -22
- package/build-validation-schema.js +46 -15
- package/chart.js +8 -7
- package/constants.js +22 -20
- package/datetime.js +6 -5
- package/form-applications/assign-values-to-sections.js +4 -3
- package/funders.js +3 -2
- package/get-env.js +56 -24
- package/get-select-options.js +4 -3
- package/get-staff-type-display-name.js +2 -2
- package/google-addresses.js +29 -20
- package/i18n/index.js +6 -2
- package/index.js +0 -1
- package/intercom.js +24 -23
- package/package.json +2 -2
- package/parse-health-fund-card-fields.js +1 -2
- package/payment-options.js +20 -21
- package/products.js +1 -0
- package/redux-actions.js +37 -25
- package/redux-reducer.js +51 -43
- package/sanitise-url.js +1 -1
- package/scroll.js +2 -4
- package/sentry.js +26 -16
- package/service-items.js +34 -11
- package/test-framework/fixtures/transaction-reports.js +2 -2
- package/test-framework/react.js +4 -2
- package/transaction-details-by-funder.js +3 -3
- package/transaction-status-helpers.js +27 -18
- package/transaction-status.js +8 -1
- package/validate-form.d.ts +3 -0
- package/validate-form.js +125 -83
- package/validate.js +10 -9
- package/webpack-config.js +7 -6
- package/env.d.ts +0 -9
- package/env.js +0 -40
package/redux-actions.js
CHANGED
|
@@ -10,42 +10,44 @@ var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToG
|
|
|
10
10
|
var _get = _interopDefault(require('lodash/get'));
|
|
11
11
|
|
|
12
12
|
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
|
+
|
|
13
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; }
|
|
14
15
|
var REQUEST = 'REQUEST';
|
|
15
16
|
var SUCCESS = 'SUCCESS';
|
|
16
17
|
var FAILURE = 'FAILURE';
|
|
17
18
|
var CLEAR_ALL_STATE = 'CLEAR_ALL_STATE';
|
|
18
19
|
var CLEAR_VALUE = 'CLEAR_VALUE';
|
|
19
|
-
var SET_VALUE = 'SET_VALUE';
|
|
20
|
-
|
|
20
|
+
var SET_VALUE = 'SET_VALUE'; // @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.
|
|
21
|
+
|
|
21
22
|
var action = function action(type, payload) {
|
|
22
23
|
if (payload === void 0) {
|
|
23
24
|
payload = {};
|
|
24
25
|
}
|
|
26
|
+
|
|
25
27
|
return _objectSpread({
|
|
26
28
|
type: type
|
|
27
29
|
}, payload);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
+
}; // @ts-expect-error TS(7006): Parameter 'keys' implicitly has an 'any' type.
|
|
31
|
+
|
|
30
32
|
var clear = function clear(keys) {
|
|
31
33
|
return {
|
|
32
34
|
type: CLEAR_VALUE,
|
|
33
35
|
keys: keys
|
|
34
36
|
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
+
}; // @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.
|
|
38
|
+
|
|
37
39
|
var set = function set(key, value) {
|
|
38
40
|
return {
|
|
39
41
|
type: SET_VALUE,
|
|
40
42
|
key: key,
|
|
41
43
|
value: value
|
|
42
44
|
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
+
}; // @ts-expect-error TS(7006): Parameter 'base' implicitly has an 'any' type.
|
|
46
|
+
|
|
45
47
|
function createRequestTypes(base) {
|
|
46
48
|
return [REQUEST, SUCCESS, FAILURE].reduce(function (acc, type) {
|
|
47
|
-
var a = acc;
|
|
48
|
-
|
|
49
|
+
var a = acc; // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
|
|
50
|
+
|
|
49
51
|
a[type] = base + "_" + type;
|
|
50
52
|
return a;
|
|
51
53
|
}, {});
|
|
@@ -54,42 +56,43 @@ function clearAllState() {
|
|
|
54
56
|
return {
|
|
55
57
|
type: CLEAR_ALL_STATE
|
|
56
58
|
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
+
} // @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.
|
|
60
|
+
|
|
59
61
|
function receiveError(type, err) {
|
|
60
62
|
return {
|
|
61
63
|
type: type,
|
|
62
64
|
err: err
|
|
63
65
|
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
+
} // @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.
|
|
67
|
+
|
|
66
68
|
function receiveSuccess(type, data) {
|
|
67
69
|
return {
|
|
68
70
|
type: type,
|
|
69
71
|
data: data
|
|
70
72
|
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
+
} // @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.
|
|
74
|
+
|
|
73
75
|
function request(type, endpoint, data) {
|
|
74
76
|
if (data === void 0) {
|
|
75
77
|
data = null;
|
|
76
78
|
}
|
|
79
|
+
|
|
77
80
|
return {
|
|
78
81
|
type: type,
|
|
79
82
|
endpoint: endpoint,
|
|
80
83
|
data: data
|
|
81
84
|
};
|
|
82
85
|
}
|
|
83
|
-
var sdkActionCreator =
|
|
84
|
-
// @ts-expect-error TS(7006): Parameter 'sdkAction' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
85
|
-
|
|
86
|
+
var sdkActionCreator = // @ts-expect-error TS(7006): Parameter 'sdkAction' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
86
87
|
function sdkActionCreator(sdkAction, actions, funcs) {
|
|
87
88
|
if (actions === void 0) {
|
|
88
89
|
actions = {};
|
|
89
90
|
}
|
|
91
|
+
|
|
90
92
|
if (funcs === void 0) {
|
|
91
93
|
funcs = {};
|
|
92
94
|
}
|
|
95
|
+
|
|
93
96
|
return (
|
|
94
97
|
/*#__PURE__*/
|
|
95
98
|
// @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.
|
|
@@ -105,43 +108,51 @@ function sdkActionCreator(sdkAction, actions, funcs) {
|
|
|
105
108
|
// @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.
|
|
106
109
|
dispatch(actions.request());
|
|
107
110
|
}
|
|
111
|
+
|
|
108
112
|
_context.prev = 1;
|
|
109
113
|
_context.next = 4;
|
|
110
114
|
return sdkAction();
|
|
115
|
+
|
|
111
116
|
case 4:
|
|
112
117
|
data = _context.sent;
|
|
118
|
+
|
|
113
119
|
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
114
120
|
if (actions.success) {
|
|
115
121
|
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
116
122
|
dispatch(actions.success(data));
|
|
117
|
-
}
|
|
123
|
+
} // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
124
|
+
|
|
118
125
|
|
|
119
|
-
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
120
126
|
if (funcs.success) {
|
|
121
127
|
// @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.
|
|
122
128
|
funcs.success(data);
|
|
123
129
|
}
|
|
130
|
+
|
|
124
131
|
return _context.abrupt("return", data);
|
|
132
|
+
|
|
125
133
|
case 10:
|
|
126
134
|
_context.prev = 10;
|
|
127
135
|
_context.t0 = _context["catch"](1);
|
|
128
136
|
errorData = _get(_context.t0, 'data', _context.t0 || 'An error occured!');
|
|
137
|
+
|
|
129
138
|
if (errorData.statusCode === 403 && !errorData.message) {
|
|
130
139
|
errorData.message = 'You are forbidden to view this resource.';
|
|
131
|
-
}
|
|
140
|
+
} // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
141
|
+
|
|
132
142
|
|
|
133
|
-
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
134
143
|
if (actions.failure) {
|
|
135
144
|
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
136
145
|
dispatch(actions.failure(errorData));
|
|
137
|
-
}
|
|
146
|
+
} // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
147
|
+
|
|
138
148
|
|
|
139
|
-
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
140
149
|
if (funcs.failure) {
|
|
141
150
|
// @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.
|
|
142
151
|
funcs.failure(errorData);
|
|
143
152
|
}
|
|
153
|
+
|
|
144
154
|
throw _context.t0;
|
|
155
|
+
|
|
145
156
|
case 17:
|
|
146
157
|
case "end":
|
|
147
158
|
return _context.stop();
|
|
@@ -149,6 +160,7 @@ function sdkActionCreator(sdkAction, actions, funcs) {
|
|
|
149
160
|
}
|
|
150
161
|
}, _callee, null, [[1, 10]]);
|
|
151
162
|
}));
|
|
163
|
+
|
|
152
164
|
return function (_x) {
|
|
153
165
|
return _ref.apply(this, arguments);
|
|
154
166
|
};
|
package/redux-reducer.js
CHANGED
|
@@ -13,84 +13,89 @@ var _pick = _interopDefault(require('lodash/pick'));
|
|
|
13
13
|
var reduxActions = require('./redux-actions.js');
|
|
14
14
|
|
|
15
15
|
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
|
+
|
|
16
17
|
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; }
|
|
17
|
-
var request = function request(
|
|
18
|
-
// @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
18
|
+
var request = function request( // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
19
19
|
state, _temp) {
|
|
20
20
|
var _objectSpread2;
|
|
21
|
+
|
|
21
22
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
_ref$isFetchingKey = _ref.isFetchingKey,
|
|
24
|
+
isFetchingKey = _ref$isFetchingKey === void 0 ? 'isFetching' : _ref$isFetchingKey,
|
|
25
|
+
_ref$hasFetchedKey = _ref.hasFetchedKey,
|
|
26
|
+
hasFetchedKey = _ref$hasFetchedKey === void 0 ? 'hasFetched' : _ref$hasFetchedKey,
|
|
27
|
+
_ref$persistState = _ref.persistState,
|
|
28
|
+
persistState = _ref$persistState === void 0 ? true : _ref$persistState;
|
|
29
|
+
|
|
28
30
|
return _objectSpread({}, persistState ? state : {}, (_objectSpread2 = {}, _objectSpread2[isFetchingKey] = true, _objectSpread2[hasFetchedKey] = false, _objectSpread2));
|
|
29
31
|
};
|
|
30
|
-
var oneSuccess = function oneSuccess(
|
|
31
|
-
// @ts-expect-error TS(7006): Parameter '
|
|
32
|
-
state,
|
|
33
|
-
// @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
32
|
+
var oneSuccess = function oneSuccess( // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
33
|
+
state, // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
34
34
|
action, _temp2) {
|
|
35
35
|
var _objectSpread3;
|
|
36
|
+
|
|
36
37
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
_ref2$isFetchingKey = _ref2.isFetchingKey,
|
|
39
|
+
isFetchingKey = _ref2$isFetchingKey === void 0 ? 'isFetching' : _ref2$isFetchingKey,
|
|
40
|
+
_ref2$hasFetchedKey = _ref2.hasFetchedKey,
|
|
41
|
+
hasFetchedKey = _ref2$hasFetchedKey === void 0 ? 'hasFetched' : _ref2$hasFetchedKey,
|
|
42
|
+
_ref2$persistState = _ref2.persistState,
|
|
43
|
+
persistState = _ref2$persistState === void 0 ? false : _ref2$persistState;
|
|
44
|
+
|
|
43
45
|
return _objectSpread({}, persistState ? state : {}, (_objectSpread3 = {}, _objectSpread3[isFetchingKey] = false, _objectSpread3[hasFetchedKey] = true, _objectSpread3.data = action.payload, _objectSpread3));
|
|
44
46
|
};
|
|
45
|
-
var paginatedListSuccess = function paginatedListSuccess(
|
|
46
|
-
// @ts-expect-error TS(7006): Parameter '
|
|
47
|
-
state,
|
|
48
|
-
// @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
47
|
+
var paginatedListSuccess = function paginatedListSuccess( // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
48
|
+
state, // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
49
49
|
action, _temp3) {
|
|
50
50
|
var _objectSpread4;
|
|
51
|
+
|
|
51
52
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
_ref3$isFetchingKey = _ref3.isFetchingKey,
|
|
54
|
+
isFetchingKey = _ref3$isFetchingKey === void 0 ? 'isFetching' : _ref3$isFetchingKey,
|
|
55
|
+
_ref3$hasFetchedKey = _ref3.hasFetchedKey,
|
|
56
|
+
hasFetchedKey = _ref3$hasFetchedKey === void 0 ? 'hasFetched' : _ref3$hasFetchedKey;
|
|
57
|
+
|
|
56
58
|
var payload = _objectSpread({}, action.payload);
|
|
59
|
+
|
|
57
60
|
if (payload.meta) {
|
|
58
61
|
payload.meta = _objectSpread({}, payload.meta, {
|
|
59
62
|
currentPage: action.currentPage || 1
|
|
60
63
|
});
|
|
61
64
|
}
|
|
65
|
+
|
|
62
66
|
return _objectSpread({}, payload, (_objectSpread4 = {}, _objectSpread4[isFetchingKey] = false, _objectSpread4[hasFetchedKey] = true, _objectSpread4));
|
|
63
67
|
};
|
|
64
|
-
var failure = function failure(
|
|
65
|
-
// @ts-expect-error TS(7006): Parameter '
|
|
66
|
-
state,
|
|
67
|
-
// @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
68
|
+
var failure = function failure( // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
69
|
+
state, // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.
|
|
68
70
|
action, _temp4) {
|
|
69
71
|
var _objectSpread5;
|
|
72
|
+
|
|
70
73
|
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
_ref4$isFetchingKey = _ref4.isFetchingKey,
|
|
75
|
+
isFetchingKey = _ref4$isFetchingKey === void 0 ? 'isFetching' : _ref4$isFetchingKey,
|
|
76
|
+
_ref4$hasFetchedKey = _ref4.hasFetchedKey,
|
|
77
|
+
hasFetchedKey = _ref4$hasFetchedKey === void 0 ? 'hasFetched' : _ref4$hasFetchedKey,
|
|
78
|
+
_ref4$persistState = _ref4.persistState,
|
|
79
|
+
persistState = _ref4$persistState === void 0 ? false : _ref4$persistState;
|
|
80
|
+
|
|
77
81
|
return _objectSpread({}, persistState ? state : {}, (_objectSpread5 = {}, _objectSpread5[isFetchingKey] = false, _objectSpread5[hasFetchedKey] = false, _objectSpread5.error = action.payload, _objectSpread5));
|
|
78
82
|
};
|
|
79
|
-
var getRootReducer = function getRootReducer(
|
|
80
|
-
// @ts-expect-error TS(7006): Parameter 'appReducer' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
83
|
+
var getRootReducer = function getRootReducer( // @ts-expect-error TS(7006): Parameter 'appReducer' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
81
84
|
appReducer, _temp5) {
|
|
82
85
|
var _ref5 = _temp5 === void 0 ? {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
persistKeys: {}
|
|
87
|
+
} : _temp5,
|
|
88
|
+
persistKeys = _ref5.persistKeys;
|
|
89
|
+
|
|
90
|
+
return (// @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
|
|
88
91
|
function (state, action) {
|
|
89
92
|
var newState = _objectSpread({}, state);
|
|
93
|
+
|
|
90
94
|
if (action.type === reduxActions.CLEAR_ALL_STATE) {
|
|
91
95
|
// @ts-expect-error TS(2769): No overload matches this call.
|
|
92
96
|
newState = _objectSpread({}, _pick(state, persistKeys));
|
|
93
97
|
}
|
|
98
|
+
|
|
94
99
|
if (action.type === reduxActions.CLEAR_VALUE) {
|
|
95
100
|
// @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.
|
|
96
101
|
action.keys.forEach(function (key) {
|
|
@@ -98,10 +103,13 @@ appReducer, _temp5) {
|
|
|
98
103
|
});
|
|
99
104
|
newState = _objectSpread({}, state, {}, newState);
|
|
100
105
|
}
|
|
106
|
+
|
|
101
107
|
if (action.type === reduxActions.SET_VALUE) {
|
|
102
108
|
var _objectSpread6;
|
|
109
|
+
|
|
103
110
|
newState = _objectSpread({}, newState, (_objectSpread6 = {}, _objectSpread6[action.key] = action.value, _objectSpread6));
|
|
104
111
|
}
|
|
112
|
+
|
|
105
113
|
return appReducer(newState, action);
|
|
106
114
|
}
|
|
107
115
|
);
|
package/sanitise-url.js
CHANGED
|
@@ -7,7 +7,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var escape = _interopDefault(require('escape-html'));
|
|
8
8
|
|
|
9
9
|
// @ts-expect-error TS(7016): Could not find a declaration file for module 'esca... Remove this comment to see the full error message
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
function sanitiseUrl(url) {
|
|
12
12
|
var escapedUrl = escape(url);
|
|
13
13
|
return {
|
package/scroll.js
CHANGED
|
@@ -4,10 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
// @ts-expect-error TS(7006): Parameter 'options' implicitly has an 'any' type.
|
|
6
6
|
var scroll = function scroll(options) {
|
|
7
|
-
return document.getElementById('main-content') &&
|
|
8
|
-
// @ts-expect-error TS(2531): Object is possibly 'null'.
|
|
9
|
-
document.getElementById('main-content').scroll &&
|
|
10
|
-
// @ts-expect-error TS(2531): Object is possibly 'null'.
|
|
7
|
+
return document.getElementById('main-content') && // @ts-expect-error TS(2531): Object is possibly 'null'.
|
|
8
|
+
document.getElementById('main-content').scroll && // @ts-expect-error TS(2531): Object is possibly 'null'.
|
|
11
9
|
document.getElementById('main-content').scroll(options);
|
|
12
10
|
};
|
|
13
11
|
|
package/sentry.js
CHANGED
|
@@ -20,14 +20,13 @@ var ERROR_MESSAGES = {
|
|
|
20
20
|
var STATUS_CODES = {
|
|
21
21
|
UNAUTHORIZED: 401,
|
|
22
22
|
SERVER_ERROR: 500
|
|
23
|
-
};
|
|
23
|
+
}; // @ts-expect-error TS(7006): Parameter 'error' implicitly has an 'any' type.
|
|
24
24
|
|
|
25
|
-
// @ts-expect-error TS(7006): Parameter 'error' implicitly has an 'any' type.
|
|
26
25
|
var _ignore = function _ignore(error) {
|
|
27
26
|
return process.env.NODE_ENV === 'test' || error.message === ERROR_MESSAGES.NETWORK_ERROR || _get(error, 'data.statusCode') === STATUS_CODES.UNAUTHORIZED || _get(error, 'data.statusCode') >= STATUS_CODES.SERVER_ERROR || _get(error, 'data.errorCode') === ERROR_CODES.INVALID_AUTHENTICATION;
|
|
28
|
-
};
|
|
27
|
+
}; // @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
|
|
28
|
+
|
|
29
29
|
|
|
30
|
-
// @ts-expect-error TS(2554): Expected 1 arguments, but got 0.
|
|
31
30
|
var clearUserContext = function clearUserContext() {
|
|
32
31
|
return Sentry.setUser();
|
|
33
32
|
};
|
|
@@ -43,46 +42,57 @@ var createReduxMiddleware = function createReduxMiddleware() {
|
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
};
|
|
46
|
-
var logError = function logError(
|
|
47
|
-
// @ts-expect-error TS(7006): Parameter '_error' implicitly has an 'any' type.
|
|
45
|
+
var logError = function logError( // @ts-expect-error TS(7006): Parameter '_error' implicitly has an 'any' type.
|
|
48
46
|
_error, _temp) {
|
|
49
47
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
name = _ref.name,
|
|
49
|
+
data = _ref.data;
|
|
50
|
+
|
|
52
51
|
var error = _error;
|
|
52
|
+
|
|
53
53
|
if (error instanceof Error) {
|
|
54
54
|
var _error2, _error2$config;
|
|
55
|
+
|
|
55
56
|
// @ts-expect-error TS(2339): Property 'config' does not exist on type 'Error'.
|
|
56
57
|
var errorHeaders = (_error2 = error) == null ? void 0 : (_error2$config = _error2.config) == null ? void 0 : _error2$config.headers;
|
|
57
58
|
var maskedErrorHeaders = masked(errorHeaders, ['Authorization']);
|
|
58
59
|
error = _set(error, 'config.headers', maskedErrorHeaders);
|
|
60
|
+
|
|
59
61
|
try {
|
|
60
62
|
var _error3, _error3$config;
|
|
63
|
+
|
|
61
64
|
var errorData = (_error3 = error) == null ? void 0 : (_error3$config = _error3.config) == null ? void 0 : _error3$config.data;
|
|
62
65
|
var maskedErrorData = masked(JSON.parse(errorData), sensitiveKeys.default);
|
|
63
66
|
error = _set(error, 'config.data', JSON.stringify(maskedErrorData));
|
|
64
67
|
} catch (err) {}
|
|
65
68
|
}
|
|
69
|
+
|
|
66
70
|
if (_ignore(error)) {
|
|
67
71
|
return null;
|
|
68
72
|
}
|
|
73
|
+
|
|
69
74
|
Sentry.withScope(function (scope) {
|
|
70
75
|
scope.setExtra('error', error);
|
|
71
76
|
scope.setExtra('data', masked(data, sensitiveKeys.default));
|
|
77
|
+
|
|
72
78
|
var message = _get(error, 'data.message', error.message);
|
|
79
|
+
|
|
73
80
|
var sentryError = error instanceof Error ? error : new Error(message);
|
|
81
|
+
|
|
74
82
|
if (name) {
|
|
75
83
|
sentryError.name = name || message;
|
|
76
84
|
}
|
|
85
|
+
|
|
77
86
|
Sentry.captureException(sentryError);
|
|
78
87
|
});
|
|
79
88
|
console.error(error);
|
|
80
|
-
};
|
|
81
|
-
|
|
89
|
+
}; // @ts-expect-error TS(7031): Binding element 'environment' implicitly has an 'a... Remove this comment to see the full error message
|
|
90
|
+
|
|
82
91
|
var setup = function setup(_ref2) {
|
|
83
92
|
var environment = _ref2.environment,
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
url = _ref2.url,
|
|
94
|
+
version = _ref2.version;
|
|
95
|
+
|
|
86
96
|
if (window.location.hostname !== 'localhost') {
|
|
87
97
|
Sentry.init({
|
|
88
98
|
dsn: url,
|
|
@@ -90,12 +100,12 @@ var setup = function setup(_ref2) {
|
|
|
90
100
|
release: version
|
|
91
101
|
});
|
|
92
102
|
}
|
|
93
|
-
};
|
|
94
|
-
|
|
103
|
+
}; // @ts-expect-error TS(7006): Parameter 'user' implicitly has an 'any' type.
|
|
104
|
+
|
|
95
105
|
var setUserContext = function setUserContext(user) {
|
|
96
106
|
return Sentry.setUser(masked(user, sensitiveKeys.default));
|
|
97
|
-
};
|
|
98
|
-
|
|
107
|
+
}; // @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.
|
|
108
|
+
|
|
99
109
|
var setTag = function setTag(key, value) {
|
|
100
110
|
return Sentry.setTag(key, value);
|
|
101
111
|
};
|
package/service-items.js
CHANGED
|
@@ -10,6 +10,7 @@ var _isEmpty = _interopDefault(require('lodash/isEmpty'));
|
|
|
10
10
|
var _difference = _interopDefault(require('lodash/difference'));
|
|
11
11
|
|
|
12
12
|
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
|
+
|
|
13
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; }
|
|
14
15
|
function round(value, step) {
|
|
15
16
|
var inv = 1.0 / step;
|
|
@@ -19,21 +20,26 @@ var calculateTotalAmount = function calculateTotalAmount(serviceItems, opts) {
|
|
|
19
20
|
if (opts === void 0) {
|
|
20
21
|
opts = {};
|
|
21
22
|
}
|
|
23
|
+
|
|
22
24
|
if (_isEmpty(serviceItems)) {
|
|
23
25
|
return 0;
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
var total = serviceItems.reduce(function (total, item) {
|
|
26
29
|
var prices = calculateAmounts(item != null && item.grossAmount ? parseFloat((item == null ? void 0 : item.grossAmount) || 0) : parseFloat((item == null ? void 0 : item.feeAmount) || 0), Boolean(opts.includeGST && item.isTaxable));
|
|
27
30
|
var itemTotal = undefined;
|
|
31
|
+
|
|
28
32
|
if (opts.isSubTotal) {
|
|
29
33
|
itemTotal = prices == null ? void 0 : prices.feeAmount;
|
|
30
34
|
} else {
|
|
31
35
|
itemTotal = prices == null ? void 0 : prices.grossAmount;
|
|
32
36
|
}
|
|
37
|
+
|
|
33
38
|
if (opts.includeDiscount && item.discountAmount) {
|
|
34
39
|
var discountAmount = parseFloat(_get(item, 'discountAmount', '0'));
|
|
35
40
|
itemTotal -= discountAmount;
|
|
36
41
|
}
|
|
42
|
+
|
|
37
43
|
return total + itemTotal;
|
|
38
44
|
}, 0);
|
|
39
45
|
return total;
|
|
@@ -44,6 +50,7 @@ var calculateTotalDiscountAmount = function calculateTotalDiscountAmount(service
|
|
|
44
50
|
}, 0);
|
|
45
51
|
};
|
|
46
52
|
var calculateTotalGSTAmount = function calculateTotalGSTAmount(serviceItems, opts) {
|
|
53
|
+
|
|
47
54
|
return serviceItems.reduce(function (total, item) {
|
|
48
55
|
var prices = calculateAmounts(parseFloat((item == null ? void 0 : item.grossAmount) || 0), item.isTaxable);
|
|
49
56
|
var gstAmount = prices == null ? void 0 : prices.taxAmount;
|
|
@@ -52,32 +59,39 @@ var calculateTotalGSTAmount = function calculateTotalGSTAmount(serviceItems, opt
|
|
|
52
59
|
};
|
|
53
60
|
var applyDiscountToServiceItems = function applyDiscountToServiceItems(serviceItems, _ref) {
|
|
54
61
|
var discount = _ref.discount,
|
|
55
|
-
|
|
62
|
+
discountType = _ref.discountType;
|
|
63
|
+
|
|
56
64
|
if (serviceItems && discount) {
|
|
57
65
|
var totalAmount = calculateTotalAmount(serviceItems);
|
|
58
66
|
var percentage = parseFloat(discount) / totalAmount;
|
|
67
|
+
|
|
59
68
|
if (discountType === 'percentage') {
|
|
60
69
|
percentage = parseFloat(discount) / 100;
|
|
61
70
|
}
|
|
71
|
+
|
|
62
72
|
return serviceItems.map(function (serviceItem) {
|
|
63
73
|
return _objectSpread({}, serviceItem, {
|
|
64
74
|
discountAmount: (serviceItem.feeAmount * percentage).toFixed(2)
|
|
65
75
|
});
|
|
66
76
|
});
|
|
67
77
|
}
|
|
78
|
+
|
|
68
79
|
return serviceItems;
|
|
69
80
|
};
|
|
70
81
|
var getEarliestServiceDate = function getEarliestServiceDate(serviceItems, dateKey) {
|
|
71
82
|
if (dateKey === void 0) {
|
|
72
83
|
dateKey = 'serviceDateString';
|
|
73
84
|
}
|
|
85
|
+
|
|
74
86
|
return serviceItems.reduce(function (currentEarliestDate, serviceItem) {
|
|
75
87
|
if (!currentEarliestDate) {
|
|
76
88
|
return serviceItem[dateKey];
|
|
77
89
|
}
|
|
90
|
+
|
|
78
91
|
if (Date.parse(serviceItem[dateKey]) < Date.parse(currentEarliestDate)) {
|
|
79
92
|
return serviceItem[dateKey];
|
|
80
93
|
}
|
|
94
|
+
|
|
81
95
|
return currentEarliestDate;
|
|
82
96
|
}, '');
|
|
83
97
|
};
|
|
@@ -98,11 +112,15 @@ var getTotalAmount = function getTotalAmount(serviceItems) {
|
|
|
98
112
|
};
|
|
99
113
|
var getItemValue = function getItemValue(item, opts) {
|
|
100
114
|
var _ref2 = opts || {},
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
_ref2$useBenefitAsPri = _ref2.useBenefitAsPrice,
|
|
116
|
+
useBenefitAsPrice = _ref2$useBenefitAsPri === void 0 ? false : _ref2$useBenefitAsPri;
|
|
117
|
+
|
|
103
118
|
var benefit = _get(item, 'benefit', 0);
|
|
119
|
+
|
|
104
120
|
var benefitAmount = (benefit / 100).toFixed(2);
|
|
121
|
+
|
|
105
122
|
var price = _get(item, 'price');
|
|
123
|
+
|
|
106
124
|
var feeAmount = (price / 100).toFixed(2);
|
|
107
125
|
var option = {
|
|
108
126
|
label: item.displayName,
|
|
@@ -124,18 +142,22 @@ var getItemValue = function getItemValue(item, opts) {
|
|
|
124
142
|
};
|
|
125
143
|
function mapItemsToClaimItems(transaction) {
|
|
126
144
|
var claimItems = _get(transaction, 'claims[0].claimItems', []);
|
|
145
|
+
|
|
127
146
|
var items = _get(transaction, 'items', []);
|
|
147
|
+
|
|
128
148
|
if (items.length === 0) {
|
|
129
149
|
return claimItems;
|
|
130
|
-
}
|
|
150
|
+
} // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.
|
|
151
|
+
|
|
131
152
|
|
|
132
|
-
// @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.
|
|
133
153
|
var newItems = items.map(function (item) {
|
|
134
154
|
// @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
135
155
|
var claimItem = claimItems.find(function (claimItem) {
|
|
136
156
|
return claimItem.itemId === item.itemId;
|
|
137
157
|
}) || {};
|
|
158
|
+
|
|
138
159
|
var isNonClaimable = _isEmpty(claimItem);
|
|
160
|
+
|
|
139
161
|
return _objectSpread({}, item, {}, claimItem, {
|
|
140
162
|
displayName: _get(item, 'displayName') || _get(claimItem, 'displayName'),
|
|
141
163
|
itemCode: _get(claimItem, 'icare.itemCode') || _get(claimItem, 'itemCode'),
|
|
@@ -144,13 +166,12 @@ function mapItemsToClaimItems(transaction) {
|
|
|
144
166
|
serviceDateString: (item == null ? void 0 : item.serviceDateString) || item.serviceDate,
|
|
145
167
|
isNonClaimable: isNonClaimable
|
|
146
168
|
});
|
|
147
|
-
});
|
|
169
|
+
}); // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
148
170
|
|
|
149
|
-
// @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
150
171
|
var claimItemIds = claimItems.map(function (claimItem) {
|
|
151
172
|
return claimItem.claimItemId;
|
|
152
|
-
});
|
|
153
|
-
|
|
173
|
+
}); // @ts-expect-error TS(7006): Parameter 'newItem' implicitly has an 'any' type.
|
|
174
|
+
|
|
154
175
|
var newItemIds = newItems.map(function (newItem) {
|
|
155
176
|
return newItem.claimItemId;
|
|
156
177
|
});
|
|
@@ -159,8 +180,8 @@ function mapItemsToClaimItems(transaction) {
|
|
|
159
180
|
// @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
160
181
|
var claimItem = claimItems.find(function (claimItem) {
|
|
161
182
|
return claimItem.claimItemId === extraItemId;
|
|
162
|
-
});
|
|
163
|
-
|
|
183
|
+
}); // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.
|
|
184
|
+
|
|
164
185
|
var item = items.find(function (item) {
|
|
165
186
|
return item.itemId === claimItem.itemId;
|
|
166
187
|
});
|
|
@@ -178,6 +199,7 @@ function mapItemsToClaimItems(transaction) {
|
|
|
178
199
|
var calculateAmounts = function calculateAmounts(grossAmount, isTaxable) {
|
|
179
200
|
var feeAmount = grossAmount;
|
|
180
201
|
var taxAmount = 0;
|
|
202
|
+
|
|
181
203
|
if (!isTaxable) {
|
|
182
204
|
return {
|
|
183
205
|
taxAmount: taxAmount,
|
|
@@ -185,6 +207,7 @@ var calculateAmounts = function calculateAmounts(grossAmount, isTaxable) {
|
|
|
185
207
|
grossAmount: grossAmount
|
|
186
208
|
};
|
|
187
209
|
}
|
|
210
|
+
|
|
188
211
|
feeAmount = feeAmount - feeAmount / 11;
|
|
189
212
|
taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;
|
|
190
213
|
return {
|
|
@@ -63,8 +63,8 @@ var paymentReportDefault = {
|
|
|
63
63
|
amountBenefitPaidString: '$43.50',
|
|
64
64
|
amountDepositedString: '$12.50'
|
|
65
65
|
}]
|
|
66
|
-
};
|
|
67
|
-
|
|
66
|
+
}; // Eclipse
|
|
67
|
+
|
|
68
68
|
var processingReportEclipseDefault = {
|
|
69
69
|
transactionId: 'PAO00000J4aw564Wtde1UeJe',
|
|
70
70
|
status: 'SUCCESS',
|
package/test-framework/react.js
CHANGED
|
@@ -14,14 +14,16 @@ var setupTestEnvironment = function setupTestEnvironment() {
|
|
|
14
14
|
enzyme.configure({
|
|
15
15
|
adapter: new Adapter()
|
|
16
16
|
});
|
|
17
|
-
};
|
|
18
|
-
// Setup component using Enzyme
|
|
17
|
+
}; // Setup component using Enzyme
|
|
19
18
|
// @ts-expect-error TS(7006): Parameter 'component' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
19
|
+
|
|
20
20
|
var setupComponent = function setupComponent(component, initialProps, initialState) {
|
|
21
21
|
var wrapper = enzyme.shallow(React.createElement(component, initialProps));
|
|
22
|
+
|
|
22
23
|
if (!_isEmpty(initialState)) {
|
|
23
24
|
wrapper.setState(initialState);
|
|
24
25
|
}
|
|
26
|
+
|
|
25
27
|
var wrapperJSON = toJSON(wrapper);
|
|
26
28
|
var wrapperInstance = wrapper.instance();
|
|
27
29
|
return {
|