@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/get-env.js CHANGED
@@ -5,12 +5,18 @@ 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 env = require('./env.js');
9
8
  var _get = _interopDefault(require('lodash/get'));
10
9
  var _isEmpty = _interopDefault(require('lodash/isEmpty'));
11
10
  var _omitBy = _interopDefault(require('lodash/omitBy'));
12
11
 
12
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+
16
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
17
+
13
18
  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; }
19
+
14
20
  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
21
  var REQUIRED_VARIABLES = ['APP_URL'];
16
22
  var ENV_NAMES = {
@@ -21,9 +27,10 @@ var ENV_NAMES = {
21
27
  PREPROD: 'pre-prod',
22
28
  PROD: 'prod'
23
29
  };
24
- var getEnv = function getEnv(env$1) {
30
+
31
+ var getEnv = function getEnv(env) {
25
32
  var LOCAL = {
26
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'local', {}), {
33
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'local', {}), {
27
34
  ENV_NAME: ENV_NAMES.LOCAL,
28
35
  FUNDER_URL: 'https://dev-funder.medipass.io',
29
36
  CONNECT_URL: 'https://dev-connect.medipass.io',
@@ -34,7 +41,7 @@ var getEnv = function getEnv(env$1) {
34
41
  })
35
42
  };
36
43
  var DEV = {
37
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'dev', {}), {
44
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'dev', {}), {
38
45
  ENV_NAME: ENV_NAMES.DEV,
39
46
  FUNDER_URL: 'https://dev-funder.medipass.io',
40
47
  CONNECT_URL: 'https://dev-connect.medipass.io',
@@ -45,7 +52,7 @@ var getEnv = function getEnv(env$1) {
45
52
  })
46
53
  };
47
54
  var STAGING = {
48
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'staging', {}), {
55
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'staging', {}), {
49
56
  ENV_NAME: ENV_NAMES.STG,
50
57
  FUNDER_URL: 'https://stg-funder.medipass.io',
51
58
  CONNECT_URL: 'https://stg-connect.medipass.io',
@@ -56,7 +63,7 @@ var getEnv = function getEnv(env$1) {
56
63
  })
57
64
  };
58
65
  var PERF = {
59
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'perf', {}), {
66
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'perf', {}), {
60
67
  ENV_NAME: ENV_NAMES.PERF,
61
68
  FUNDER_URL: 'https://perf-funder.medipass.io',
62
69
  CONNECT_URL: 'https://perf-connect.medipass.io',
@@ -67,7 +74,7 @@ var getEnv = function getEnv(env$1) {
67
74
  })
68
75
  };
69
76
  var PREPROD = {
70
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'preprod', {}), {
77
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'preprod', {}), {
71
78
  ENV_NAME: ENV_NAMES.PREPROD,
72
79
  FUNDER_URL: 'https://funder-blue.medipass.io',
73
80
  CONNECT_URL: 'https://connect-blue.medipass.io',
@@ -78,7 +85,7 @@ var getEnv = function getEnv(env$1) {
78
85
  })
79
86
  };
80
87
  var PROD = {
81
- ENV: _objectSpread({}, _get(env$1, '_global', {}), {}, _get(env$1, 'prod', {}), {
88
+ ENV: _objectSpread({}, _get(env, '_global', {}), {}, _get(env, 'prod', {}), {
82
89
  ENV_NAME: ENV_NAMES.PROD,
83
90
  FUNDER_URL: 'https://funder.medipass.io',
84
91
  CONNECT_URL: 'https://connect.medipass.io',
@@ -88,50 +95,62 @@ var getEnv = function getEnv(env$1) {
88
95
  CHECKOUT_URL: 'https://checkout.medipass.io'
89
96
  })
90
97
  };
98
+
91
99
  var fabSettings = _get(window, 'FAB_SETTINGS', {});
100
+
92
101
  var origin = window.location.origin;
93
- if (env.REACT_APP_ENV === 'dev' || fabSettings.REACT_APP_ENV === 'dev' || _get(DEV, 'ENV.APP_URL', '') === origin) {
102
+
103
+ if (process.env.REACT_APP_ENV === 'dev' || fabSettings.REACT_APP_ENV === 'dev' || _get(DEV, 'ENV.APP_URL', '') === origin) {
94
104
  return DEV.ENV;
95
- } else if (env.REACT_APP_ENV === 'staging' || fabSettings.REACT_APP_ENV === 'staging' || _get(STAGING, 'ENV.APP_URL', '') === origin) {
105
+ } else if (process.env.REACT_APP_ENV === 'staging' || fabSettings.REACT_APP_ENV === 'staging' || _get(STAGING, 'ENV.APP_URL', '') === origin) {
96
106
  return STAGING.ENV;
97
- } else if (env.REACT_APP_ENV === 'perf' || fabSettings.REACT_APP_ENV === 'perf' || _get(PERF, 'ENV.APP_URL', '') === origin) {
107
+ } else if (process.env.REACT_APP_ENV === 'perf' || fabSettings.REACT_APP_ENV === 'perf' || _get(PERF, 'ENV.APP_URL', '') === origin) {
98
108
  return PERF.ENV;
99
- } else if (env.REACT_APP_ENV === 'pre-prod' || _get(PREPROD, 'ENV.APP_URL', '') === origin) {
109
+ } else if (process.env.REACT_APP_ENV === 'pre-prod' || _get(PREPROD, 'ENV.APP_URL', '') === origin) {
100
110
  return PREPROD.ENV;
101
- } else if (env.REACT_APP_ENV === 'local') {
111
+ } else if (process.env.REACT_APP_ENV === 'local') {
102
112
  return LOCAL.ENV;
103
- } else if (env.REACT_APP_ENV === 'prod' || _get(PROD, 'ENV.APP_URL', '') === origin) {
113
+ } else if (process.env.REACT_APP_ENV === 'prod' || _get(PROD, 'ENV.APP_URL', '') === origin) {
104
114
  return PROD.ENV;
105
115
  }
116
+
106
117
  return DEV.ENV;
107
118
  };
119
+
108
120
  var getEnvironmentsMissingVariables = function getEnvironmentsMissingVariables(envVariables) {
109
121
  // @ts-expect-error TS(7034): Variable 'environmentsMissingVariables' implicitly... Remove this comment to see the full error message
110
122
  var environmentsMissingVariables = [];
111
- for (var _i = 0, _REQUIRED_VARIABLES = REQUIRED_VARIABLES; _i < _REQUIRED_VARIABLES.length; _i++) {
112
- var requiredVariable = _REQUIRED_VARIABLES[_i];
123
+
124
+ for (var _iterator = _createForOfIteratorHelperLoose(REQUIRED_VARIABLES), _step; !(_step = _iterator()).done;) {
125
+ var requiredVariable = _step.value;
126
+
113
127
  if (!envVariables[requiredVariable]) {
114
128
  // @ts-expect-error TS(7005): Variable 'environmentsMissingVariables' implicitly... Remove this comment to see the full error message
115
129
  environmentsMissingVariables = [].concat(environmentsMissingVariables, [requiredVariable]);
116
130
  }
117
- }
131
+ } // @ts-expect-error TS(7005): Variable 'environmentsMissingVariables' implicitly... Remove this comment to see the full error message
132
+
118
133
 
119
- // @ts-expect-error TS(7005): Variable 'environmentsMissingVariables' implicitly... Remove this comment to see the full error message
120
134
  return environmentsMissingVariables;
121
135
  };
136
+
122
137
  var getRequiredEnvironmentVariables = function getRequiredEnvironmentVariables(env) {
123
138
  var missingVariables = {};
139
+
124
140
  for (var key in env) {
125
141
  if (key.includes('_')) {
126
142
  continue;
127
143
  }
144
+
128
145
  if (Object.prototype.hasOwnProperty.call(env, key)) {
129
146
  // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
130
147
  missingVariables[key] = getEnvironmentsMissingVariables(env[key]);
131
148
  }
132
149
  }
150
+
133
151
  return _omitBy(missingVariables, _isEmpty);
134
152
  };
153
+
135
154
  var logWarningForMissingRequiredEnvironmentVariables = function logWarningForMissingRequiredEnvironmentVariables(missingRequiredEnvironmentVariables) {
136
155
  for (var key in missingRequiredEnvironmentVariables) {
137
156
  if (Object.prototype.hasOwnProperty.call(missingRequiredEnvironmentVariables, key)) {
@@ -139,22 +158,32 @@ var logWarningForMissingRequiredEnvironmentVariables = function logWarningForMis
139
158
  }
140
159
  }
141
160
  };
161
+
142
162
  var Env = /*#__PURE__*/function () {
143
163
  function Env() {
144
164
  _defineProperty(this, "ENV_NAME", void 0);
165
+
145
166
  _defineProperty(this, "FUNDER_URL", void 0);
167
+
146
168
  _defineProperty(this, "CONNECT_URL", void 0);
169
+
147
170
  _defineProperty(this, "CONSUMER_URL", void 0);
171
+
148
172
  _defineProperty(this, "ACCOUNTS_URL", void 0);
173
+
149
174
  _defineProperty(this, "QUOTES_URL", void 0);
175
+
150
176
  _defineProperty(this, "CHECKOUT_URL", void 0);
151
177
  }
178
+
152
179
  var _proto = Env.prototype;
180
+
153
181
  _proto.setup = function setup(env) {
154
182
  this.clear();
155
183
  var missingRequiredEnvironmentVariables = getRequiredEnvironmentVariables(env);
156
184
  logWarningForMissingRequiredEnvironmentVariables(missingRequiredEnvironmentVariables);
157
185
  var newEnv = getEnv(env);
186
+
158
187
  for (var key in newEnv) {
159
188
  if (Object.prototype.hasOwnProperty.call(newEnv, key)) {
160
189
  // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
@@ -162,6 +191,7 @@ var Env = /*#__PURE__*/function () {
162
191
  }
163
192
  }
164
193
  };
194
+
165
195
  _proto.clear = function clear() {
166
196
  for (var key in this) {
167
197
  if (Object.prototype.hasOwnProperty.call(this, key)) {
@@ -169,15 +199,17 @@ var Env = /*#__PURE__*/function () {
169
199
  }
170
200
  }
171
201
  };
202
+
172
203
  return Env;
173
204
  }();
205
+
174
206
  var getEnv$1 = new Env();
175
- var ERROR_MESSAGE__INTERNET_ERROR = env.REACT_APP_ERROR_MESSAGE__INTERNET_ERROR || 'We are unable to establish an internet connection. We will take you back once you are connected to the internet.';
176
- var ERROR_MESSAGE__NETWORK_ERROR = env.REACT_APP_ERROR_MESSAGE__NETWORK_ERROR || 'There are issues connecting to the Medipass platform. Please refresh the page and try again.';
177
- var ERROR_MESSAGE__SERVER_ERROR = env.REACT_APP_ERROR_MESSAGE__SERVER_ERROR || 'There are issues connecting to the Medipass platform. Please refresh the page and try again.';
178
- var ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR = env.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR || 'There are issues connecting to the payment gateway. Please refresh the page and try again.';
179
- var ERROR_MESSAGE__PAYMENT_ERROR = env.REACT_APP_ERROR_MESSAGE__PAYMENT_ERROR || 'An error occurred when processing the payment. Please try again. The card was not charged.';
180
- var ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS = env.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS || 'The payment card details you entered were invalid, please review the payment card credentials and try again.';
207
+ var ERROR_MESSAGE__INTERNET_ERROR = process.env.REACT_APP_ERROR_MESSAGE__INTERNET_ERROR || 'We are unable to establish an internet connection. We will take you back once you are connected to the internet.';
208
+ var ERROR_MESSAGE__NETWORK_ERROR = process.env.REACT_APP_ERROR_MESSAGE__NETWORK_ERROR || 'There are issues connecting to the Medipass platform. Please refresh the page and try again.';
209
+ var ERROR_MESSAGE__SERVER_ERROR = process.env.REACT_APP_ERROR_MESSAGE__SERVER_ERROR || 'There are issues connecting to the Medipass platform. Please refresh the page and try again.';
210
+ var ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR = process.env.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR || 'There are issues connecting to the payment gateway. Please refresh the page and try again.';
211
+ var ERROR_MESSAGE__PAYMENT_ERROR = process.env.REACT_APP_ERROR_MESSAGE__PAYMENT_ERROR || 'An error occurred when processing the payment. Please try again. The card was not charged.';
212
+ var ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS = process.env.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS || 'The payment card details you entered were invalid, please review the payment card credentials and try again.';
181
213
 
182
214
  exports.ERROR_MESSAGE__INTERNET_ERROR = ERROR_MESSAGE__INTERNET_ERROR;
183
215
  exports.ERROR_MESSAGE__NETWORK_ERROR = ERROR_MESSAGE__NETWORK_ERROR;
@@ -6,19 +6,20 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var _get = _interopDefault(require('lodash/get'));
8
8
 
9
- // @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
10
9
  var getSelectOptions = function getSelectOptions(values, labelKey, valueKey, opts) {
11
10
  if (valueKey === void 0) {
12
11
  valueKey = null;
13
12
  }
13
+
14
14
  if (opts === void 0) {
15
15
  opts = {};
16
16
  }
17
+
17
18
  if (!values) {
18
19
  return [];
19
- }
20
+ } // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
21
+
20
22
 
21
- // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.
22
23
  return values.map(function (value, i) {
23
24
  return {
24
25
  key: _get(value, '_id', i),
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var staffTypeDisplayNames = {
6
6
  receptionist: 'practice manager'
7
- };
8
- // @ts-expect-error TS(7006): Parameter 'staffType' implicitly has an 'any' type... Remove this comment to see the full error message
7
+ }; // @ts-expect-error TS(7006): Parameter 'staffType' implicitly has an 'any' type... Remove this comment to see the full error message
8
+
9
9
  var getStaffTypeDisplayName = function getStaffTypeDisplayName(staffType) {
10
10
  return staffTypeDisplayNames[staffType] || staffType;
11
11
  };
@@ -18,8 +18,8 @@ var ADDRESS_COMPONENT_MAPPINGS = {
18
18
  state: 'administrative_area_level_1',
19
19
  city: 'locality',
20
20
  postcode: 'postal_code'
21
- };
22
- // @ts-expect-error TS(7006): Parameter 'address' implicitly has an 'any' type.
21
+ }; // @ts-expect-error TS(7006): Parameter 'address' implicitly has an 'any' type.
22
+
23
23
  function geocodeAddress(address) {
24
24
  return new Promise( /*#__PURE__*/function () {
25
25
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(res, rej) {
@@ -31,10 +31,12 @@ function geocodeAddress(address) {
31
31
  _context2.prev = 0;
32
32
  _context2.next = 3;
33
33
  return reactPlacesAutocomplete.geocodeByAddress(address);
34
+
34
35
  case 3:
35
36
  results = _context2.sent;
36
37
  _context2.next = 6;
37
38
  return reactPlacesAutocomplete.getLatLng(results[0]);
39
+
38
40
  case 6:
39
41
  latLng = _context2.sent;
40
42
  res({
@@ -43,9 +45,11 @@ function geocodeAddress(address) {
43
45
  });
44
46
  _context2.next = 13;
45
47
  break;
48
+
46
49
  case 10:
47
50
  _context2.prev = 10;
48
51
  _context2.t0 = _context2["catch"](0);
52
+
49
53
  if (_context2.t0 === 'OVER_QUERY_LIMIT') {
50
54
  setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
51
55
  var result;
@@ -55,6 +59,7 @@ function geocodeAddress(address) {
55
59
  case 0:
56
60
  result = geocodeAddress(address);
57
61
  res(result);
62
+
58
63
  case 2:
59
64
  case "end":
60
65
  return _context.stop();
@@ -65,6 +70,7 @@ function geocodeAddress(address) {
65
70
  } else {
66
71
  rej(_context2.t0);
67
72
  }
73
+
68
74
  case 13:
69
75
  case "end":
70
76
  return _context2.stop();
@@ -72,14 +78,16 @@ function geocodeAddress(address) {
72
78
  }
73
79
  }, _callee2, null, [[0, 10]]);
74
80
  }));
81
+
75
82
  return function (_x, _x2) {
76
83
  return _ref.apply(this, arguments);
77
84
  };
78
85
  }());
79
- }
80
- // @ts-expect-error TS(7006): Parameter 'addressComponents' implicitly has an 'a... Remove this comment to see the full error message
86
+ } // @ts-expect-error TS(7006): Parameter 'addressComponents' implicitly has an 'a... Remove this comment to see the full error message
87
+
81
88
  var mapAddressComponents = function mapAddressComponents(addressComponents) {
82
89
  var components = {};
90
+
83
91
  _forEach(addressComponents, function (component) {
84
92
  _forOwn(ADDRESS_COMPONENT_MAPPINGS, function (mapping, key) {
85
93
  if (component.types[0] === mapping) {
@@ -91,39 +99,40 @@ var mapAddressComponents = function mapAddressComponents(addressComponents) {
91
99
  }
92
100
  });
93
101
  });
102
+
94
103
  return components;
95
- };
96
- // @ts-expect-error TS(7006): Parameter 'addressComponents' implicitly has an 'a... Remove this comment to see the full error message
104
+ }; // @ts-expect-error TS(7006): Parameter 'addressComponents' implicitly has an 'a... Remove this comment to see the full error message
105
+
97
106
  var parseAddress = function parseAddress(addressComponents) {
98
107
  var requestData = {};
108
+
99
109
  if (addressComponents) {
100
- var address = mapAddressComponents(addressComponents);
110
+ var address = mapAddressComponents(addressComponents); // @ts-expect-error TS(2339): Property 'route' does not exist on type '{}'.
101
111
 
102
- // @ts-expect-error TS(2339): Property 'route' does not exist on type '{}'.
103
112
  if (address.route) {
104
113
  // @ts-expect-error TS(2339): Property 'address' does not exist on type '{}'.
105
- requestData.address =
106
- // @ts-expect-error
114
+ requestData.address = // @ts-expect-error
107
115
  "" + (address.subpremise ? address.subpremise.longName + "/" : '') + ( // @ts-expect-error
108
116
  (address.streetNumber ? address.streetNumber.longName : '') + " ") + ( // @ts-expect-error
109
117
  "" + address.route.longName);
110
- }
118
+ } // @ts-expect-error TS(2339): Property 'country' does not exist on type '{}'.
119
+
111
120
 
112
- // @ts-expect-error TS(2339): Property 'country' does not exist on type '{}'.
113
121
  if (address.country) {
114
122
  // @ts-expect-error TS(2339): Property 'countryCode' does not exist on type '{}'... Remove this comment to see the full error message
115
- requestData.countryCode = address.country.shortName;
116
- // @ts-expect-error TS(2339): Property 'country' does not exist on type '{}'.
123
+ requestData.countryCode = address.country.shortName; // @ts-expect-error TS(2339): Property 'country' does not exist on type '{}'.
124
+
117
125
  requestData.country = address.country.longName;
118
- }
126
+ } // @ts-expect-error TS(2339): Property 'state' does not exist on type '{}'.
127
+
128
+
129
+ requestData.state = address.state ? address.state.longName : null; // @ts-expect-error TS(2339): Property 'city' does not exist on type '{}'.
130
+
131
+ requestData.city = address.city ? address.city.longName : null; // @ts-expect-error TS(2339): Property 'postcode' does not exist on type '{}'.
119
132
 
120
- // @ts-expect-error TS(2339): Property 'state' does not exist on type '{}'.
121
- requestData.state = address.state ? address.state.longName : null;
122
- // @ts-expect-error TS(2339): Property 'city' does not exist on type '{}'.
123
- requestData.city = address.city ? address.city.longName : null;
124
- // @ts-expect-error TS(2339): Property 'postcode' does not exist on type '{}'.
125
133
  requestData.postcode = address.postcode ? address.postcode.longName : null;
126
134
  }
135
+
127
136
  return requestData;
128
137
  };
129
138
 
package/i18n/index.js CHANGED
@@ -11,23 +11,26 @@ 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
+
14
15
  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
16
 
16
- // @ts-expect-error TS(7006): Parameter 'translations' implicitly has an 'any' t... Remove this comment to see the full error message
17
17
  function getResources(translations$1) {
18
18
  return translations.regionsList.reduce(function (resources, region) {
19
19
  var _objectSpread3;
20
+
20
21
  return _objectSpread({}, resources, (_objectSpread3 = {}, _objectSpread3[region] = {
21
22
  translation: Object.entries(translations$1).reduce(function (currentTranslations, _ref) {
22
23
  var _objectSpread2;
24
+
23
25
  var key = _ref[0],
24
- value = _ref[1];
26
+ value = _ref[1];
25
27
  // @ts-expect-error TS(2571): Object is of type 'unknown'.
26
28
  return _objectSpread({}, currentTranslations, (_objectSpread2 = {}, _objectSpread2[key] = value[region], _objectSpread2));
27
29
  }, {})
28
30
  }, _objectSpread3));
29
31
  }, {});
30
32
  }
33
+
31
34
  var index = {
32
35
  i18n: {},
33
36
  // @ts-expect-error TS(7031): Binding element 'region' implicitly has an 'any' t... Remove this comment to see the full error message
@@ -41,6 +44,7 @@ var index = {
41
44
  // we do not use keys in form messages.welcome
42
45
  interpolation: {
43
46
  escapeValue: false // react already safes from xss
47
+
44
48
  }
45
49
  });
46
50
  }
package/index.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  require('./constants.js');
6
6
  require('lodash/capitalize');
7
7
  require('@babel/runtime/helpers/defineProperty');
8
- require('./env.js');
9
8
  require('yup');
10
9
  require('core-js/es6/promise');
11
10
  require('core-js/es6/set');
package/intercom.js CHANGED
@@ -5,7 +5,6 @@ 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
- require('./env.js');
9
8
  var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator'));
10
9
  var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator'));
11
10
  require('lodash/get');
@@ -14,8 +13,9 @@ require('lodash/omitBy');
14
13
  var getEnv = require('./get-env.js');
15
14
 
16
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
+
17
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; }
18
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
18
+
19
19
  var bootIntercom = /*#__PURE__*/function () {
20
20
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
21
21
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -27,6 +27,7 @@ var bootIntercom = /*#__PURE__*/function () {
27
27
  // eslint-disable-line camelcase
28
28
  user_hash: data.intercomHash
29
29
  })));
30
+
30
31
  case 1:
31
32
  case "end":
32
33
  return _context.stop();
@@ -34,60 +35,60 @@ var bootIntercom = /*#__PURE__*/function () {
34
35
  }
35
36
  }, _callee);
36
37
  }));
38
+
37
39
  return function bootIntercom(_x) {
38
40
  return _ref.apply(this, arguments);
39
41
  };
40
42
  }();
41
43
  var showNewMessage = function showNewMessage(message) {
42
- return (
43
- // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
44
+ return (// @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
44
45
  window.Intercom('showNewMessage', typeof message === 'string' ? message : '')
45
46
  );
46
47
  }; // eslint-disable-line new-cap
47
-
48
48
  // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
49
+
49
50
  var shutdownIntercom = function shutdownIntercom() {
50
51
  return window.Intercom('shutdown');
51
52
  }; // eslint-disable-line new-cap
52
-
53
53
  // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
54
+
54
55
  var trackEvent = function trackEvent(name, data) {
55
56
  return window.Intercom('trackEvent', name, data);
56
57
  }; // eslint-disable-line new-cap
57
-
58
58
  // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
59
+
59
60
  var trackCreateDVAInvoice = function trackCreateDVAInvoice(data) {
60
61
  return trackEvent('created-dva-invoice', data);
61
- };
62
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
62
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
63
+
63
64
  var trackCreateHICAPSInvoice = function trackCreateHICAPSInvoice(data) {
64
65
  return trackEvent('created-hicaps-invoice', data);
65
- };
66
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
66
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
67
+
67
68
  var trackCreateMedicareInvoice = function trackCreateMedicareInvoice(data) {
68
69
  return trackEvent('created-medicare-invoice', data);
69
- };
70
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
70
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
71
+
71
72
  var trackCreatePatientFundedInvoice = function trackCreatePatientFundedInvoice(data) {
72
73
  return trackEvent('created-patient-funded-invoice', data);
73
- };
74
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
74
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
75
+
75
76
  var trackCreateNDISInvoice = function trackCreateNDISInvoice(data) {
76
77
  return trackEvent('created-ndis-invoice', data);
77
- };
78
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
78
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
79
+
79
80
  var trackCreateOHCInvoice = function trackCreateOHCInvoice(data) {
80
81
  return trackEvent('created-ohc-invoice', data);
81
- };
82
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
82
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
83
+
83
84
  var trackCreateVirtualTerminalInvoice = function trackCreateVirtualTerminalInvoice(data) {
84
85
  return trackEvent('created-virtual-terminal-invoice', data);
85
- };
86
- // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
86
+ }; // @ts-expect-error TS(7006): Parameter 'data' implicitly has an 'any' type.
87
+
87
88
  var trackCreateQuote = function trackCreateQuote(data) {
88
89
  return trackEvent('created-quote', data);
89
- };
90
- // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
90
+ }; // @ts-expect-error TS(2339): Property 'Intercom' does not exist on type 'Window... Remove this comment to see the full error message
91
+
91
92
  var updateIntercom = function updateIntercom(data) {
92
93
  return window.Intercom('update', data);
93
94
  }; // eslint-disable-line new-cap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "11.79.2-chore-environment-variables.1",
3
+ "version": "11.79.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "rimraf": "^2.6.2",
53
53
  "typescript": "4.8.4"
54
54
  },
55
- "gitHead": "6ee753ef55841be398f09092241aa308fd0e9310"
55
+ "gitHead": "cd7ca3071ae5d6500cc0e9dc354ecca92928cb85"
56
56
  }
@@ -4,8 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  // @ts-expect-error TS(7006): Parameter 'cardFields' implicitly has an 'any' typ... Remove this comment to see the full error message
6
6
  var parseHealthFundCardFields = function parseHealthFundCardFields(cardFields) {
7
- return (
8
- // @ts-expect-error TS(7006): Parameter 'result' implicitly has an 'any' type.
7
+ return (// @ts-expect-error TS(7006): Parameter 'result' implicitly has an 'any' type.
9
8
  cardFields.reduce(function (result, field) {
10
9
  result[field.id] = field;
11
10
  return result;
@@ -4,47 +4,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var constants = require('./constants.js');
6
6
 
7
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
8
7
  var isPaymentAuthority = function isPaymentAuthority(paymentOption) {
9
8
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_AUTHORITY;
10
- };
11
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
9
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
10
+
12
11
  var isExistingPaymentCard = function isExistingPaymentCard(paymentOption) {
13
12
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD;
14
- };
15
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
13
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
14
+
16
15
  var isNewPaymentCard = function isNewPaymentCard(paymentOption) {
17
16
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
18
- };
19
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
17
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
18
+
20
19
  var isLink = function isLink(paymentOption) {
21
20
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.LINK;
22
- };
23
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
21
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
22
+
24
23
  var isPaymentCard = function isPaymentCard(paymentOption) {
25
24
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.EXISTING_PAYMENT_CARD || paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.NEW_PAYMENT_CARD;
26
- };
27
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
25
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
26
+
28
27
  var isPayInPerson = function isPayInPerson(paymentOption) {
29
28
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PAY_IN_PERSON;
30
- };
31
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
29
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
30
+
32
31
  var isProcessOutsideMedipass = function isProcessOutsideMedipass(paymentOption) {
33
32
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PROCESS_OUTSIDE_MEDIPASS;
34
- };
35
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
33
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
34
+
36
35
  var isSendToPhone = function isSendToPhone(paymentOption) {
37
36
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.PHONE;
38
- };
39
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
37
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
38
+
40
39
  var isPaymentHold = function isPaymentHold(paymentOption) {
41
40
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.HOLD;
42
- };
43
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
41
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
42
+
44
43
  var isInstalmentPlan = function isInstalmentPlan(paymentOption) {
45
44
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.INSTALMENT_PLAN;
46
- };
47
- // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
45
+ }; // @ts-expect-error TS(7006): Parameter 'paymentOption' implicitly has an 'any' ... Remove this comment to see the full error message
46
+
48
47
  var isTerminal = function isTerminal(paymentOption) {
49
48
  return paymentOption === constants.TRANSACTION_PAYMENT_OPTIONS.TERMINAL;
50
49
  };
package/products.js CHANGED
@@ -11,6 +11,7 @@ var getProductType = function getProductType(product) {
11
11
  if (!product.fullName) {
12
12
  return;
13
13
  }
14
+
14
15
  var productType = product.fullName.split(':')[1];
15
16
  return productType;
16
17
  };