@medipass/utils 11.57.1-fix-select-options-undefined.0 → 11.58.2-fix-prod-issues.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/get-select-options.js +2 -2
- package/package.json +2 -2
- package/service-items.js +17 -51
- package/validate-form.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.58.1](https://github.com/medipass/web/compare/@medipass/utils@11.58.0...@medipass/utils@11.58.1) (2021-12-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* calculate item totals and gst ([#600](https://github.com/medipass/web/issues/600)) ([af48c3a](https://github.com/medipass/web/commit/af48c3a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [11.58.0](https://github.com/medipass/web-medicules/compare/@medipass/utils@11.57.0...@medipass/utils@11.58.0) (2021-12-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* validation for service text dva and medicare ([#598](https://github.com/medipass/web-medicules/issues/598)) ([963f9a6](https://github.com/medipass/web-medicules/commit/963f9a6))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [11.57.0](https://github.com/medipass/web/compare/@medipass/utils@11.56.1...@medipass/utils@11.57.0) (2021-11-16)
|
|
7
29
|
|
|
8
30
|
|
package/get-select-options.js
CHANGED
|
@@ -28,13 +28,13 @@ var getSelectOptions = function getSelectOptions(values, labelKey, valueKey, opt
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
var getNameMobileEmail = function getNameMobileEmail(value) {
|
|
31
|
-
return _get(value, 'firstName'
|
|
31
|
+
return _get(value, 'firstName') + " " + _get(value, 'lastName') + " " + _get(value, 'mobile', '') + " " + _get(value, 'email', '');
|
|
32
32
|
};
|
|
33
33
|
var getDisplayNameAndICDCode = function getDisplayNameAndICDCode(value) {
|
|
34
34
|
return _get(value, 'icdCode') + " - " + _get(value, 'displayName');
|
|
35
35
|
};
|
|
36
36
|
var getFullName = function getFullName(value) {
|
|
37
|
-
return _get(value, 'firstName'
|
|
37
|
+
return _get(value, 'firstName') + " " + _get(value, 'lastName');
|
|
38
38
|
};
|
|
39
39
|
var getSelectOptionsWithNameMobileEmail = function getSelectOptionsWithNameMobileEmail(data) {
|
|
40
40
|
return getSelectOptions(data, null, null, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.58.2-fix-prod-issues.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"redux-thunk": "^2.2.0",
|
|
48
48
|
"rimraf": "^2.6.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "bf8ffaaa47a36e0a4dd4f6b263102828925e37f4"
|
|
51
51
|
}
|
package/service-items.js
CHANGED
|
@@ -33,11 +33,9 @@ var calculateTotalAmount = function calculateTotalAmount(serviceItems, opts) {
|
|
|
33
33
|
includeQuantity = false;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var prices =
|
|
36
|
+
var prices = calculateAmounts({
|
|
37
37
|
isTaxable: Boolean(opts.includeGST && item.isTaxable),
|
|
38
|
-
|
|
39
|
-
initialFeeAmount: (item == null ? void 0 : item.initialFeeAmount) ? parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0) : parseFloat((item == null ? void 0 : item.feeAmount) || 0),
|
|
40
|
-
isExtendedPrice: item == null ? void 0 : item.isExtendedPrice,
|
|
38
|
+
initialFeeAmount: (item == null ? void 0 : item.feeAmount) ? parseFloat((item == null ? void 0 : item.feeAmount) || 0) : parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0),
|
|
41
39
|
quantity: includeQuantity ? item.quantity : 1
|
|
42
40
|
});
|
|
43
41
|
var itemTotal = undefined;
|
|
@@ -74,11 +72,9 @@ var calculateTotalGSTAmount = function calculateTotalGSTAmount(serviceItems, opt
|
|
|
74
72
|
includeQuantity = false;
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
var prices =
|
|
75
|
+
var prices = calculateAmounts({
|
|
78
76
|
isTaxable: item.isTaxable,
|
|
79
|
-
|
|
80
|
-
initialFeeAmount: (item == null ? void 0 : item.initialFeeAmount) ? parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0) : parseFloat((item == null ? void 0 : item.feeAmount) || 0),
|
|
81
|
-
isExtendedPrice: item == null ? void 0 : item.isExtendedPrice,
|
|
77
|
+
initialFeeAmount: (item == null ? void 0 : item.feeAmount) ? parseFloat((item == null ? void 0 : item.feeAmount) || 0) : parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0),
|
|
82
78
|
quantity: includeQuantity ? item.quantity : 1
|
|
83
79
|
});
|
|
84
80
|
var gstAmount = prices == null ? void 0 : prices.taxAmount;
|
|
@@ -196,64 +192,34 @@ function mapItemsToClaimItems(transaction) {
|
|
|
196
192
|
});
|
|
197
193
|
return newItems;
|
|
198
194
|
}
|
|
199
|
-
|
|
200
|
-
var round2DecimalPlaces = function round2DecimalPlaces(num) {
|
|
201
|
-
return Math.round((num + Number.EPSILON) * 100) / 100;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
var calculatePrices = function calculatePrices(_ref3) {
|
|
195
|
+
var calculateAmounts = function calculateAmounts(_ref3) {
|
|
205
196
|
var isTaxable = _ref3.isTaxable,
|
|
206
|
-
isGross = _ref3.isGross,
|
|
207
197
|
initialFeeAmount = _ref3.initialFeeAmount,
|
|
208
198
|
isExtendedPrice = _ref3.isExtendedPrice,
|
|
209
|
-
_ref3$quantity = _ref3.quantity
|
|
210
|
-
quantity = _ref3$quantity === void 0 ? 1 : _ref3$quantity;
|
|
211
|
-
|
|
212
|
-
function getTotalsWithQuantity(_ref4) {
|
|
213
|
-
var taxAmount = _ref4.taxAmount,
|
|
214
|
-
feeAmount = _ref4.feeAmount,
|
|
215
|
-
grossAmount = _ref4.grossAmount;
|
|
216
|
-
if (isExtendedPrice) return {
|
|
217
|
-
taxAmount: taxAmount,
|
|
218
|
-
feeAmount: feeAmount,
|
|
219
|
-
grossAmount: grossAmount
|
|
220
|
-
};
|
|
221
|
-
return {
|
|
222
|
-
grossAmount: grossAmount * quantity,
|
|
223
|
-
feeAmount: feeAmount * quantity,
|
|
224
|
-
taxAmount: taxAmount * quantity
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
199
|
+
_ref3$quantity = _ref3.quantity;
|
|
228
200
|
var grossAmount = parseFloat(initialFeeAmount || 0);
|
|
229
201
|
var feeAmount = parseFloat(initialFeeAmount || 0);
|
|
230
202
|
var taxAmount = 0;
|
|
231
203
|
|
|
232
204
|
if (!isTaxable) {
|
|
233
|
-
return
|
|
234
|
-
|
|
205
|
+
return {
|
|
206
|
+
taxAmount: taxAmount,
|
|
235
207
|
feeAmount: feeAmount,
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (isGross) {
|
|
241
|
-
taxAmount = parseFloat(round2DecimalPlaces(grossAmount / 11).toFixed(2) || 0);
|
|
242
|
-
feeAmount = grossAmount - taxAmount;
|
|
243
|
-
} else {
|
|
244
|
-
taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;
|
|
245
|
-
grossAmount = feeAmount + taxAmount;
|
|
208
|
+
grossAmount: grossAmount
|
|
209
|
+
};
|
|
246
210
|
}
|
|
247
211
|
|
|
248
|
-
|
|
249
|
-
|
|
212
|
+
taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;
|
|
213
|
+
grossAmount = feeAmount + taxAmount;
|
|
214
|
+
return {
|
|
215
|
+
taxAmount: taxAmount,
|
|
250
216
|
feeAmount: feeAmount,
|
|
251
|
-
|
|
252
|
-
}
|
|
217
|
+
grossAmount: grossAmount
|
|
218
|
+
};
|
|
253
219
|
};
|
|
254
220
|
|
|
255
221
|
exports.applyDiscountToServiceItems = applyDiscountToServiceItems;
|
|
256
|
-
exports.
|
|
222
|
+
exports.calculateAmounts = calculateAmounts;
|
|
257
223
|
exports.calculateTotalAmount = calculateTotalAmount;
|
|
258
224
|
exports.calculateTotalDiscountAmount = calculateTotalDiscountAmount;
|
|
259
225
|
exports.calculateTotalGSTAmount = calculateTotalGSTAmount;
|
package/validate-form.js
CHANGED
|
@@ -309,6 +309,12 @@ var hasInvalidCharacters = function hasInvalidCharacters(value) {
|
|
|
309
309
|
var hasStrictInvalidCharacters = function hasStrictInvalidCharacters(value) {
|
|
310
310
|
return value && /[^A-Za-z0-9-' ]/.test(value) ? 'This field cannot contain any special characters except for space, hyphen and apostrophe under certain conditions' : undefined;
|
|
311
311
|
};
|
|
312
|
+
var hasDoubleSpaces = function hasDoubleSpaces(value) {
|
|
313
|
+
return value && /\s\s+/g.test(value) ? 'There can be no double spaces in the supplied value' : undefined;
|
|
314
|
+
};
|
|
315
|
+
var hasWhitespaceAtStartOrEnd = function hasWhitespaceAtStartOrEnd(value) {
|
|
316
|
+
return value && /(^\s+)|(\s+$)/.test(value) ? 'There can be no spaces at the start or end of the supplied value' : undefined;
|
|
317
|
+
};
|
|
312
318
|
var hasSpaceAfterHyphen = function hasSpaceAfterHyphen(value) {
|
|
313
319
|
return value && /([-]\s)/.test(value) ? 'Name cannot have a space after a hyphen (-)' : undefined;
|
|
314
320
|
};
|
|
@@ -340,6 +346,7 @@ var validateForm = (function () {
|
|
|
340
346
|
});
|
|
341
347
|
|
|
342
348
|
exports.default = validateForm;
|
|
349
|
+
exports.hasDoubleSpaces = hasDoubleSpaces;
|
|
343
350
|
exports.hasInvalidCharacters = hasInvalidCharacters;
|
|
344
351
|
exports.hasNumber = hasNumber;
|
|
345
352
|
exports.hasSpaceAfterApostrophe = hasSpaceAfterApostrophe;
|
|
@@ -349,6 +356,7 @@ exports.hasSpaceBeforeHyphen = hasSpaceBeforeHyphen;
|
|
|
349
356
|
exports.hasSpecialChar = hasSpecialChar;
|
|
350
357
|
exports.hasStrictInvalidCharacters = hasStrictInvalidCharacters;
|
|
351
358
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
359
|
+
exports.hasWhitespaceAtStartOrEnd = hasWhitespaceAtStartOrEnd;
|
|
352
360
|
exports.isEqualTo = isEqualTo;
|
|
353
361
|
exports.isFutureDate = isFutureDate;
|
|
354
362
|
exports.isGreaterThan = isGreaterThan;
|