ordering-ui-external 14.1.55 → 14.1.56

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.
@@ -173,7 +173,7 @@ var lightenDarkenColor = exports.lightenDarkenColor = function lightenDarkenColo
173
173
  b = color[3];
174
174
  } else {
175
175
  // If RGB --> Convert it to HEX
176
- color = +("0x" + color.slice(1).replace(color.length < 5 && /./g, '$&$&'));
176
+ color = +('0x' + color.slice(1).replace(color.length < 5 && /./g, '$&$&'));
177
177
  r = color >> 16;
178
178
  g = color >> 8 & 255;
179
179
  b = color & 255;
@@ -184,7 +184,7 @@ var lightenDarkenColor = exports.lightenDarkenColor = function lightenDarkenColo
184
184
 
185
185
  // Using the HSP value, determine whether the color is light or dark
186
186
  if (hsp > 197) {
187
- return true; //is light color
187
+ return true; // is light color
188
188
  } else {
189
189
  return false;
190
190
  }
@@ -1128,36 +1128,30 @@ var calendarLanguages = exports.calendarLanguages = {
1128
1128
  }
1129
1129
  };
1130
1130
  var getCateringValues = exports.getCateringValues = function getCateringValues(cateringTypeString, configs) {
1131
- var splitCateringValue;
1132
- if (configs !== null && configs !== void 0 && configs.preorder_slot_interval) {
1133
- splitCateringValue = function splitCateringValue(configName) {
1134
- var _configs$configName;
1135
- return (_configs$configName = configs[configName]) === null || _configs$configName === void 0 || (_configs$configName = _configs$configName.value) === null || _configs$configName === void 0 || (_configs$configName = _configs$configName.split('|')) === null || _configs$configName === void 0 || (_configs$configName = _configs$configName.find(function (val) {
1131
+ var getValue = function getValue(configName) {
1132
+ var config = configs === null || configs === void 0 ? void 0 : configs[configName];
1133
+ if (config && config.value) {
1134
+ var _config$value$split$f;
1135
+ var value = (_config$value$split$f = config.value.split('|').find(function (val) {
1136
1136
  return val.includes(cateringTypeString);
1137
- })) === null || _configs$configName === void 0 ? void 0 : _configs$configName.split(',')[1];
1138
- };
1139
- } else {
1140
- splitCateringValue = function splitCateringValue(configName) {
1141
- var _Object$values;
1142
- return (_Object$values = Object.values(configs || {})) === null || _Object$values === void 0 || (_Object$values = _Object$values.find(function (config) {
1143
- return (config === null || config === void 0 ? void 0 : config.key) === configName;
1144
- })) === null || _Object$values === void 0 || (_Object$values = _Object$values.value) === null || _Object$values === void 0 || (_Object$values = _Object$values.split('|')) === null || _Object$values === void 0 || (_Object$values = _Object$values.find(function (val) {
1145
- return val.includes(cateringTypeString);
1146
- })) === null || _Object$values === void 0 ? void 0 : _Object$values.split(',')[1];
1147
- };
1148
- }
1149
- var preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'));
1150
- var preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'));
1151
- var preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'));
1152
- var preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'));
1153
- var preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'));
1154
- return {
1155
- preorderSlotInterval: preorderSlotInterval,
1156
- preorderLeadTime: preorderLeadTime,
1157
- preorderTimeRange: preorderTimeRange,
1158
- preorderMaximumDays: preorderMaximumDays,
1159
- preorderMinimumDays: preorderMinimumDays
1137
+ })) === null || _config$value$split$f === void 0 ? void 0 : _config$value$split$f.split(',')[1];
1138
+ return isNaN(value) ? null : parseInt(value);
1139
+ }
1140
+ return null;
1141
+ };
1142
+ var values = {
1143
+ preorderSlotInterval: getValue('preorder_slot_interval'),
1144
+ preorderLeadTime: getValue('preorder_lead_time'),
1145
+ preorderTimeRange: getValue('preorder_time_range'),
1146
+ preorderMaximumDays: getValue('preorder_maximum_days'),
1147
+ preorderMinimumDays: getValue('preorder_minimum_days')
1160
1148
  };
1149
+ return Object.fromEntries(Object.entries(values).filter(function (_ref3) {
1150
+ var _ref4 = _slicedToArray(_ref3, 2),
1151
+ _ = _ref4[0],
1152
+ v = _ref4[1];
1153
+ return v !== null;
1154
+ }));
1161
1155
  };
1162
1156
  var getCurrenySymbol = exports.getCurrenySymbol = function getCurrenySymbol(code) {
1163
1157
  var _CURRENCY$code$symbol, _CURRENCY$code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.55",
3
+ "version": "14.1.56",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -118,7 +118,7 @@ export const getTraduction = key => {
118
118
  ERROR_PLACE_PAY_WITH_PAYPAL_CAPTURE: 'An error occurred while trying to pay by PayPal',
119
119
  ERROR_ADD_PRODUCT_VERY_FAR_FOR_DELIVERY: 'Error adding product, very far for delivery',
120
120
  ERROR_INVALID_OFFER: 'The offer doesn\'t exist',
121
- ERROR_CASH_WALLET_FEATURE_DISABLED: 'Cash wallet feature is disabled',
121
+ ERROR_CASH_WALLET_FEATURE_DISABLED: 'Cash wallet feature is disabled'
122
122
  }
123
123
 
124
124
  return keyList[key] ? t(key, keyList[key]) : t(key)
@@ -136,7 +136,6 @@ export const bytesConverter = bytes => {
136
136
  * Function to get brightness of color.
137
137
  */
138
138
  export const lightenDarkenColor = (color) => {
139
-
140
139
  let r, g, b, hsp
141
140
  if (color.match(/^rgb/)) {
142
141
  // If HEX --> store the red, green, blue values in separate variables
@@ -147,7 +146,7 @@ export const lightenDarkenColor = (color) => {
147
146
  b = color[3]
148
147
  } else {
149
148
  // If RGB --> Convert it to HEX
150
- color = +("0x" + color.slice(1).replace(color.length < 5 && /./g, '$&$&'))
149
+ color = +('0x' + color.slice(1).replace(color.length < 5 && /./g, '$&$&'))
151
150
 
152
151
  r = color >> 16
153
152
  g = color >> 8 & 255
@@ -163,7 +162,7 @@ export const lightenDarkenColor = (color) => {
163
162
 
164
163
  // Using the HSP value, determine whether the color is light or dark
165
164
  if (hsp > 197) {
166
- return true //is light color
165
+ return true // is light color
167
166
  } else {
168
167
  return false
169
168
  }
@@ -678,7 +677,7 @@ export const getOrderStatuPickUp = (s) => {
678
677
  { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer'), slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER', percentage: 0 },
679
678
  { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0 },
680
679
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 70 },
681
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 90 },
680
+ { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 90 }
682
681
  ]
683
682
  const objectStatus = orderStatus.find((o) => o.key === status)
684
683
  return objectStatus && objectStatus
@@ -711,30 +710,24 @@ export const calendarLanguages = {
711
710
  }
712
711
 
713
712
  export const getCateringValues = (cateringTypeString, configs) => {
714
- let splitCateringValue
715
- if (configs?.preorder_slot_interval) {
716
- splitCateringValue = (configName) => configs[configName]
717
- ?.value?.split('|')
718
- ?.find(val => val.includes(cateringTypeString))?.split(',')[1]
719
- } else {
720
- splitCateringValue = (configName) => Object.values(configs || {})
721
- ?.find(config => config?.key === configName)
722
- ?.value?.split('|')
723
- ?.find(val => val.includes(cateringTypeString))?.split(',')[1]
713
+ const getValue = (configName) => {
714
+ const config = configs?.[configName]
715
+ if (config && config.value) {
716
+ const value = config.value.split('|').find(val => val.includes(cateringTypeString))?.split(',')[1]
717
+ return isNaN(value) ? null : parseInt(value)
718
+ }
719
+ return null
724
720
  }
725
- const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
726
- const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
727
- const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
728
- const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
729
- const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
730
-
731
- return {
732
- preorderSlotInterval,
733
- preorderLeadTime,
734
- preorderTimeRange,
735
- preorderMaximumDays,
736
- preorderMinimumDays
721
+
722
+ const values = {
723
+ preorderSlotInterval: getValue('preorder_slot_interval'),
724
+ preorderLeadTime: getValue('preorder_lead_time'),
725
+ preorderTimeRange: getValue('preorder_time_range'),
726
+ preorderMaximumDays: getValue('preorder_maximum_days'),
727
+ preorderMinimumDays: getValue('preorder_minimum_days')
737
728
  }
729
+
730
+ return Object.fromEntries(Object.entries(values).filter(([_, v]) => v !== null))
738
731
  }
739
732
 
740
733
  export const getCurrenySymbol = (code) => {