@medipass/utils 11.88.1-fix-object-pollution.0 → 11.89.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/constants.d.ts CHANGED
@@ -72,6 +72,7 @@ export declare const FUNDERS: {
72
72
  readonly HICAPS: "nab";
73
73
  readonly ICARE: "icare";
74
74
  readonly MEDICARE: "medicare";
75
+ readonly EASYCLAIM: "easyclaim";
75
76
  readonly NIB: "nib";
76
77
  readonly NDIS: "ndis";
77
78
  readonly OHC: "ohc";
@@ -89,6 +90,7 @@ export declare const FUNDERS_FORMATTED: {
89
90
  readonly nab: "HICAPS";
90
91
  readonly icare: "icare";
91
92
  readonly medicare: "Medicare";
93
+ readonly easyclaim: "Medicare Easyclaim";
92
94
  readonly dva: "DVA";
93
95
  readonly ndis: "NDIS";
94
96
  readonly nib: "NIB";
package/constants.js CHANGED
@@ -96,6 +96,7 @@ var FUNDERS = {
96
96
  HICAPS: 'nab',
97
97
  ICARE: 'icare',
98
98
  MEDICARE: 'medicare',
99
+ EASYCLAIM: 'easyclaim',
99
100
  NIB: 'nib',
100
101
  NDIS: 'ndis',
101
102
  OHC: 'ohc',
@@ -105,7 +106,7 @@ var FUNDERS = {
105
106
  WSV: 'wsv',
106
107
  AGED_CARE: 'aged-care'
107
108
  };
108
- var FUNDERS_FORMATTED = (_FUNDERS_FORMATTED = {}, _FUNDERS_FORMATTED[FUNDERS.COMCARE] = 'Comcare', _FUNDERS_FORMATTED[FUNDERS.ECLIPSE] = 'ECLIPSE', _FUNDERS_FORMATTED[FUNDERS.HBF] = 'HBF', _FUNDERS_FORMATTED[FUNDERS.HEALTHPOINT] = 'HEALTHPOINT', _FUNDERS_FORMATTED[FUNDERS.HICAPS] = 'HICAPS', _FUNDERS_FORMATTED[FUNDERS.ICARE] = 'icare', _FUNDERS_FORMATTED[FUNDERS.MEDICARE] = 'Medicare', _FUNDERS_FORMATTED[FUNDERS.DVA] = 'DVA', _FUNDERS_FORMATTED[FUNDERS.NDIS] = 'NDIS', _FUNDERS_FORMATTED[FUNDERS.NIB] = 'NIB', _FUNDERS_FORMATTED[FUNDERS.OHC] = 'Overseas health cover', _FUNDERS_FORMATTED[FUNDERS.PATIENT] = 'Patient funded', _FUNDERS_FORMATTED[FUNDERS.QBE] = 'QBE', _FUNDERS_FORMATTED[FUNDERS.WCQ] = 'Workcover Queensland', _FUNDERS_FORMATTED[FUNDERS.WSV] = 'WorkSafe Victoria', _FUNDERS_FORMATTED[FUNDERS.AGED_CARE] = 'Aged Care', _FUNDERS_FORMATTED);
109
+ var FUNDERS_FORMATTED = (_FUNDERS_FORMATTED = {}, _FUNDERS_FORMATTED[FUNDERS.COMCARE] = 'Comcare', _FUNDERS_FORMATTED[FUNDERS.ECLIPSE] = 'ECLIPSE', _FUNDERS_FORMATTED[FUNDERS.HBF] = 'HBF', _FUNDERS_FORMATTED[FUNDERS.HEALTHPOINT] = 'HEALTHPOINT', _FUNDERS_FORMATTED[FUNDERS.HICAPS] = 'HICAPS', _FUNDERS_FORMATTED[FUNDERS.ICARE] = 'icare', _FUNDERS_FORMATTED[FUNDERS.MEDICARE] = 'Medicare', _FUNDERS_FORMATTED[FUNDERS.EASYCLAIM] = 'Medicare Easyclaim', _FUNDERS_FORMATTED[FUNDERS.DVA] = 'DVA', _FUNDERS_FORMATTED[FUNDERS.NDIS] = 'NDIS', _FUNDERS_FORMATTED[FUNDERS.NIB] = 'NIB', _FUNDERS_FORMATTED[FUNDERS.OHC] = 'Overseas health cover', _FUNDERS_FORMATTED[FUNDERS.PATIENT] = 'Patient funded', _FUNDERS_FORMATTED[FUNDERS.QBE] = 'QBE', _FUNDERS_FORMATTED[FUNDERS.WCQ] = 'Workcover Queensland', _FUNDERS_FORMATTED[FUNDERS.WSV] = 'WorkSafe Victoria', _FUNDERS_FORMATTED[FUNDERS.AGED_CARE] = 'Aged Care', _FUNDERS_FORMATTED);
109
110
  /* ====== END: FUNDERS ======= */
110
111
 
111
112
  /* ====== START: FUTURES ======= */
package/funders.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export declare const FUNDERS_WITH_ONBOARDING: readonly ["nab", "medicare", "icare", "wcq", "comcare", "wsv", "nib", "qbe", "aged-care"];
2
- export declare const CLAIMABLE_FUNDERS: readonly ["comcare", "dva", "eclipse", "healthpoint", "nab", "icare", "medicare", "nib", "ohc", "qbe", "wcq", "wsv", "aged-care"];
3
- export declare const getFunderCodeFromTransaction: (transaction: Record<string, any>, funderCode?: string) => "comcare" | "dva" | "eclipse" | "hbf" | "healthpoint" | "nab" | "icare" | "medicare" | "nib" | "ndis" | "ohc" | "patient-funded" | "qbe" | "wcq" | "wsv" | "aged-care";
1
+ export declare const FUNDERS_WITH_ONBOARDING: readonly ["nab", "medicare", "easyclaim", "icare", "wcq", "comcare", "wsv", "nib", "qbe", "aged-care"];
2
+ export declare const CLAIMABLE_FUNDERS: readonly ["comcare", "dva", "eclipse", "healthpoint", "nab", "icare", "medicare", "easyclaim", "nib", "ohc", "qbe", "wcq", "wsv", "aged-care"];
3
+ export declare const getFunderCodeFromTransaction: (transaction: Record<string, any>, funderCode?: string) => "comcare" | "dva" | "eclipse" | "hbf" | "healthpoint" | "nab" | "icare" | "medicare" | "easyclaim" | "nib" | "ndis" | "ohc" | "patient-funded" | "qbe" | "wcq" | "wsv" | "aged-care";
4
4
  export declare const isComcare: (funderCode: string) => boolean;
5
5
  export declare const isDVA: (funderCode: string) => boolean;
6
6
  export declare const isEclipse: (funderCode: string) => boolean;
@@ -9,6 +9,7 @@ export declare const isHICAPS: (funderCode: string) => boolean;
9
9
  export declare const isIcare: (funderCode: string) => boolean;
10
10
  export declare const isHealthPoint: (funderCode: string) => boolean;
11
11
  export declare const isMedicare: (funderCode: string) => boolean;
12
+ export declare const isEasyClaim: (funderCode: string) => boolean;
12
13
  export declare const isNDIS: (funderCode: string) => boolean;
13
14
  export declare const isNib: (funderCode: string) => boolean;
14
15
  export declare const isOHC: (funderCode: string) => boolean;
package/funders.js CHANGED
@@ -9,8 +9,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
 
10
10
  var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
11
11
 
12
- var FUNDERS_WITH_ONBOARDING = [constants.FUNDERS.HICAPS, constants.FUNDERS.MEDICARE, constants.FUNDERS.ICARE, constants.FUNDERS.WCQ, constants.FUNDERS.COMCARE, constants.FUNDERS.WSV, constants.FUNDERS.NIB, constants.FUNDERS.QBE, constants.FUNDERS.AGED_CARE];
13
- var CLAIMABLE_FUNDERS = [constants.FUNDERS.COMCARE, constants.FUNDERS.DVA, constants.FUNDERS.ECLIPSE, constants.FUNDERS.HEALTHPOINT, constants.FUNDERS.HICAPS, constants.FUNDERS.ICARE, constants.FUNDERS.MEDICARE, constants.FUNDERS.NIB, constants.FUNDERS.OHC, constants.FUNDERS.QBE, constants.FUNDERS.WCQ, constants.FUNDERS.WSV, constants.FUNDERS.AGED_CARE];
12
+ var FUNDERS_WITH_ONBOARDING = [constants.FUNDERS.HICAPS, constants.FUNDERS.MEDICARE, constants.FUNDERS.EASYCLAIM, constants.FUNDERS.ICARE, constants.FUNDERS.WCQ, constants.FUNDERS.COMCARE, constants.FUNDERS.WSV, constants.FUNDERS.NIB, constants.FUNDERS.QBE, constants.FUNDERS.AGED_CARE];
13
+ var CLAIMABLE_FUNDERS = [constants.FUNDERS.COMCARE, constants.FUNDERS.DVA, constants.FUNDERS.ECLIPSE, constants.FUNDERS.HEALTHPOINT, constants.FUNDERS.HICAPS, constants.FUNDERS.ICARE, constants.FUNDERS.MEDICARE, constants.FUNDERS.EASYCLAIM, constants.FUNDERS.NIB, constants.FUNDERS.OHC, constants.FUNDERS.QBE, constants.FUNDERS.WCQ, constants.FUNDERS.WSV, constants.FUNDERS.AGED_CARE];
14
14
  var getFunderCodeFromTransaction = function getFunderCodeFromTransaction(transaction, funderCode) {
15
15
  if (transaction.isPatientFunded || _get__default["default"](transaction, 'claims[0].isPatientFunded')) {
16
16
  return constants.FUNDERS.PATIENT;
@@ -20,6 +20,8 @@ var getFunderCodeFromTransaction = function getFunderCodeFromTransaction(transac
20
20
  return constants.FUNDERS.PATIENT;
21
21
  } else if (funderCode === constants.FUNDERS.MEDICARE) {
22
22
  return constants.FUNDERS.MEDICARE;
23
+ } else if (funderCode === constants.FUNDERS.EASYCLAIM) {
24
+ return constants.FUNDERS.EASYCLAIM;
23
25
  } else if (funderCode === constants.FUNDERS.HBF) {
24
26
  return constants.FUNDERS.HBF;
25
27
  } else if (funderCode === constants.FUNDERS.ICARE) {
@@ -74,6 +76,9 @@ var isHealthPoint = function isHealthPoint(funderCode) {
74
76
  var isMedicare = function isMedicare(funderCode) {
75
77
  return funderCode === constants.FUNDERS.MEDICARE;
76
78
  };
79
+ var isEasyClaim = function isEasyClaim(funderCode) {
80
+ return funderCode === constants.FUNDERS.EASYCLAIM;
81
+ };
77
82
  var isNDIS = function isNDIS(funderCode) {
78
83
  return funderCode === constants.FUNDERS.NDIS;
79
84
  };
@@ -109,6 +114,7 @@ exports.getFunderCodeFromTransaction = getFunderCodeFromTransaction;
109
114
  exports.isAgedCare = isAgedCare;
110
115
  exports.isComcare = isComcare;
111
116
  exports.isDVA = isDVA;
117
+ exports.isEasyClaim = isEasyClaim;
112
118
  exports.isEclipse = isEclipse;
113
119
  exports.isFunderClaimable = isFunderClaimable;
114
120
  exports.isHBF = isHBF;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "11.88.1-fix-object-pollution.0",
3
+ "version": "11.89.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "rimraf": "^2.6.2",
48
48
  "typescript": "4.8.4"
49
49
  },
50
- "gitHead": "72269493c1e9a4bf37eeb1e2722a6d861ade316a"
50
+ "gitHead": "59d096ba4cc291d7626a98d71f2cd28698302ff0"
51
51
  }
@@ -1,5 +1,4 @@
1
1
  export declare function round(value: number, step: number): number;
2
- export declare function deepClone<T>(obj: T): T;
3
2
  export declare const calculateTotalAmount: (serviceItems: Array<Record<string, any>>, opts?: {
4
3
  includeDiscount?: boolean;
5
4
  includeQuantity?: boolean;
package/service-items.js CHANGED
@@ -20,25 +20,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
20
20
  function round(value, step) {
21
21
  var inv = 1.0 / step;
22
22
  return Math.round(value * inv) / inv;
23
- } // Perform a deep clone to avoid accidental shared references/aliasing
24
-
25
- function deepClone(obj) {
26
- if (obj === null || obj === undefined) return obj;
27
-
28
- try {
29
- return JSON.parse(JSON.stringify(obj));
30
- } catch (_err) {
31
- // Fallback to shallow copy if JSON cloning fails (e.g., circular refs)
32
- if (Array.isArray(obj)) {
33
- return [].concat(obj);
34
- }
35
-
36
- if (typeof obj === 'object') {
37
- return _objectSpread({}, obj);
38
- }
39
-
40
- return obj;
41
- }
42
23
  }
43
24
  var calculateTotalAmount = function calculateTotalAmount(serviceItems, opts) {
44
25
  if (opts === void 0) {
@@ -137,28 +118,23 @@ var getTotalAmount = function getTotalAmount(serviceItems) {
137
118
  var getItemValue = function getItemValue(item, opts) {
138
119
  var _ref2 = opts || {},
139
120
  _ref2$useBenefitAsPri = _ref2.useBenefitAsPrice,
140
- useBenefitAsPrice = _ref2$useBenefitAsPri === void 0 ? false : _ref2$useBenefitAsPri; // Clone the incoming item to prevent downstream mutations from affecting
141
- // the original SDK response or other holders of the same reference
142
-
143
-
144
- var clonedItem = deepClone(item || {});
121
+ useBenefitAsPrice = _ref2$useBenefitAsPri === void 0 ? false : _ref2$useBenefitAsPri;
145
122
 
146
- var benefit = _get__default["default"](clonedItem, 'benefit', 0);
123
+ var benefit = _get__default["default"](item, 'benefit', 0);
147
124
 
148
125
  var benefitAmount = (benefit / 100).toFixed(2);
149
126
 
150
- var price = _get__default["default"](clonedItem, 'price');
127
+ var price = _get__default["default"](item, 'price');
151
128
 
152
129
  var feeAmount = (price / 100).toFixed(2);
153
130
  var option = {
154
- label: clonedItem.displayName,
155
- // Also clone here to ensure select option value is isolated
156
- value: deepClone(clonedItem)
131
+ label: item.displayName,
132
+ value: item
157
133
  };
158
134
  return _objectSpread({
159
135
  service: option,
160
136
  quantity: 1
161
- }, clonedItem, {
137
+ }, item, {
162
138
  benefitAmount: benefitAmount,
163
139
  hasSeenPatientToday: 'no'
164
140
  }, price ? {
@@ -251,7 +227,6 @@ exports.calculateAmounts = calculateAmounts;
251
227
  exports.calculateTotalAmount = calculateTotalAmount;
252
228
  exports.calculateTotalDiscountAmount = calculateTotalDiscountAmount;
253
229
  exports.calculateTotalGSTAmount = calculateTotalGSTAmount;
254
- exports.deepClone = deepClone;
255
230
  exports.getChargeAmount = getChargeAmount;
256
231
  exports.getDiscountAmount = getDiscountAmount;
257
232
  exports.getEarliestServiceDate = getEarliestServiceDate;