ordering-components-external 13.2.22 → 13.2.24

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.
Files changed (20) hide show
  1. package/_bundles/{7.ordering-component.708e27a828acb42dafde.js → 7.ordering-component.0599c79450fa3a01dd9f.js} +1 -1
  2. package/_bundles/{ordering-component.708e27a828acb42dafde.js → ordering-component.0599c79450fa3a01dd9f.js} +2 -2
  3. package/_modules/components/GoogleAutocompleteInput/index.js +6 -4
  4. package/_modules/components/GoogleMaps/index.js +6 -4
  5. package/_modules/components/GpsButton/index.js +7 -4
  6. package/_modules/components/PaymentOptionStripeLink/index.js +10 -1
  7. package/package.json +1 -1
  8. package/src/components/GoogleAutocompleteInput/index.js +4 -4
  9. package/src/components/GoogleMaps/index.js +4 -4
  10. package/src/components/GpsButton/index.js +5 -4
  11. package/src/components/PaymentOptionStripeLink/index.js +10 -1
  12. /package/_bundles/{0.ordering-component.708e27a828acb42dafde.js → 0.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  13. /package/_bundles/{1.ordering-component.708e27a828acb42dafde.js → 1.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  14. /package/_bundles/{2.ordering-component.708e27a828acb42dafde.js → 2.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  15. /package/_bundles/{4.ordering-component.708e27a828acb42dafde.js → 4.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  16. /package/_bundles/{5.ordering-component.708e27a828acb42dafde.js → 5.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  17. /package/_bundles/{6.ordering-component.708e27a828acb42dafde.js → 6.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  18. /package/_bundles/{7.ordering-component.708e27a828acb42dafde.js.LICENSE.txt → 7.ordering-component.0599c79450fa3a01dd9f.js.LICENSE.txt} +0 -0
  19. /package/_bundles/{8.ordering-component.708e27a828acb42dafde.js → 8.ordering-component.0599c79450fa3a01dd9f.js} +0 -0
  20. /package/_bundles/{ordering-component.708e27a828acb42dafde.js.LICENSE.txt → ordering-component.0599c79450fa3a01dd9f.js.LICENSE.txt} +0 -0
@@ -59,6 +59,9 @@ var AutocompleteInput = function AutocompleteInput(props) {
59
59
  autocomplete.addListener('place_changed', function () {
60
60
  var place = autocomplete.getPlace();
61
61
  var addressObj = {};
62
+ var cityFallback = place === null || place === void 0 ? void 0 : place.address_components.find(function (component) {
63
+ return component.types.includes('administrative_area_level_2');
64
+ });
62
65
  if (place !== null && place !== void 0 && place.address_components) {
63
66
  var _iterator = _createForOfIteratorHelper(place.address_components),
64
67
  _step;
@@ -77,9 +80,10 @@ var AutocompleteInput = function AutocompleteInput(props) {
77
80
  addressObj.neighborhood = component.long_name;
78
81
  }
79
82
  if (addressType === 'route') {
80
- addressObj.route = component.short_name;
83
+ addressObj.route = component.long_name;
81
84
  }
82
85
  if (addressType === 'locality') {
86
+ addressObj.city = component.long_name || cityFallback.long_name;
83
87
  addressObj.locality = component.long_name;
84
88
  }
85
89
  if ((_component$types = component.types) !== null && _component$types !== void 0 && _component$types.includes('sublocality')) {
@@ -91,9 +95,7 @@ var AutocompleteInput = function AutocompleteInput(props) {
91
95
  }
92
96
  if (addressType === 'administrative_area_level_1') {
93
97
  addressObj.state = component.long_name;
94
- }
95
- if (addressType === 'administrative_area_level_2') {
96
- addressObj.city = component.long_name;
98
+ addressObj.state_code = component.short_name;
97
99
  }
98
100
  }
99
101
  } catch (err) {
@@ -192,6 +192,9 @@ var GoogleMaps = exports.GoogleMaps = function GoogleMaps(props) {
192
192
  if (results && results.length > 0 && results !== null && results !== void 0 && (_results$ = results[0]) !== null && _results$ !== void 0 && _results$.address_components) {
193
193
  var _address$location, _address$location2;
194
194
  var addressObj = {};
195
+ var cityFallback = results[0].address_components.find(function (component) {
196
+ return component.types.includes('administrative_area_level_2');
197
+ });
195
198
  var _iterator2 = _createForOfIteratorHelper(results[0].address_components),
196
199
  _step2;
197
200
  try {
@@ -209,9 +212,10 @@ var GoogleMaps = exports.GoogleMaps = function GoogleMaps(props) {
209
212
  addressObj.neighborhood = component.long_name;
210
213
  }
211
214
  if (addressType === 'route') {
212
- addressObj.route = component.short_name;
215
+ addressObj.route = component.long_name;
213
216
  }
214
217
  if (addressType === 'locality') {
218
+ addressObj.city = component.long_name || cityFallback.long_name;
215
219
  addressObj.locality = component.long_name;
216
220
  }
217
221
  if ((_component$types = component.types) !== null && _component$types !== void 0 && _component$types.includes('sublocality')) {
@@ -223,9 +227,7 @@ var GoogleMaps = exports.GoogleMaps = function GoogleMaps(props) {
223
227
  }
224
228
  if (addressType === 'administrative_area_level_1') {
225
229
  addressObj.state = component.long_name;
226
- }
227
- if (addressType === 'administrative_area_level_2') {
228
- addressObj.city = component.long_name;
230
+ addressObj.state_code = component.short_name;
229
231
  }
230
232
  }
231
233
  } catch (err) {
@@ -66,6 +66,9 @@ var GpsButton = exports.GpsButton = function GpsButton(props) {
66
66
  setIsLoading(false);
67
67
  var postalCode = null;
68
68
  var addressObj = {};
69
+ var cityFallback = results[0].address_components.find(function (component) {
70
+ return component.types.includes('administrative_area_level_2');
71
+ });
69
72
  if (results !== null && results !== void 0 && (_results$ = results[0]) !== null && _results$ !== void 0 && _results$.address_components) {
70
73
  var _iterator = _createForOfIteratorHelper(results[0].address_components),
71
74
  _step;
@@ -75,6 +78,7 @@ var GpsButton = exports.GpsButton = function GpsButton(props) {
75
78
  var component = _step.value;
76
79
  var addressType = component.types[0];
77
80
  if (addressType === 'postal_code') {
81
+ addressObj.zipcode = component.short_name;
78
82
  postalCode = component.short_name;
79
83
  }
80
84
  if (addressType === 'street_number') {
@@ -84,9 +88,10 @@ var GpsButton = exports.GpsButton = function GpsButton(props) {
84
88
  addressObj.neighborhood = component.long_name;
85
89
  }
86
90
  if (addressType === 'route') {
87
- addressObj.route = component.short_name;
91
+ addressObj.route = component.long_name;
88
92
  }
89
93
  if (addressType === 'locality') {
94
+ addressObj.city = component.long_name || cityFallback.long_name;
90
95
  addressObj.locality = component.long_name;
91
96
  }
92
97
  if ((_component$types = component.types) !== null && _component$types !== void 0 && _component$types.includes('sublocality')) {
@@ -98,9 +103,7 @@ var GpsButton = exports.GpsButton = function GpsButton(props) {
98
103
  }
99
104
  if (addressType === 'administrative_area_level_1') {
100
105
  addressObj.state = component.long_name;
101
- }
102
- if (addressType === 'administrative_area_level_2') {
103
- addressObj.city = component.long_name;
106
+ addressObj.state_code = component.short_name;
104
107
  }
105
108
  }
106
109
  } catch (err) {
@@ -34,7 +34,8 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
34
34
  */
35
35
  var PaymentOptionStripeLink = exports.PaymentOptionStripeLink = function PaymentOptionStripeLink(props) {
36
36
  var UIComponent = props.UIComponent,
37
- paymentURL = props.paymentURL;
37
+ paymentURL = props.paymentURL,
38
+ cartTotal = props.cartTotal;
38
39
  var _useApi = (0, _ApiContext.useApi)(),
39
40
  _useApi2 = _slicedToArray(_useApi, 1),
40
41
  ordering = _useApi2[0];
@@ -78,6 +79,14 @@ var PaymentOptionStripeLink = exports.PaymentOptionStripeLink = function Payment
78
79
  provider: customProviders.includes(ordering === null || ordering === void 0 ? void 0 : ordering.project) ? 'custom' : 'twilio',
79
80
  country_phone_code: userInfo.country_phone_code,
80
81
  cellphone: userInfo.cellphone,
82
+ payment_url: paymentURL,
83
+ user: {
84
+ name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name,
85
+ lastname: userInfo === null || userInfo === void 0 ? void 0 : userInfo.lastname
86
+ },
87
+ cart: {
88
+ total: cartTotal !== null && cartTotal !== void 0 ? cartTotal : 0
89
+ },
81
90
  message: t('LINK_TO_PAY_MESSAGE', 'Hello there _name_ _lastname_, click on the following link to complete the payment: _link_').replace('_name_', userInfo === null || userInfo === void 0 ? void 0 : userInfo.name).replace('_lastname_', userInfo === null || userInfo === void 0 ? void 0 : userInfo.lastname).replace('_link_', paymentURL)
82
91
  };
83
92
  _context.next = 6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-components-external",
3
- "version": "13.2.22",
3
+ "version": "13.2.24",
4
4
  "description": "Ordering Internal Dashboard",
5
5
  "main": "./_modules/index.js",
6
6
  "scripts": {
@@ -43,6 +43,7 @@ const AutocompleteInput = (props) => {
43
43
  autocomplete.addListener('place_changed', () => {
44
44
  const place = autocomplete.getPlace()
45
45
  const addressObj = {}
46
+ const cityFallback = place?.address_components.find(component => component.types.includes('administrative_area_level_2'))
46
47
  if (place?.address_components) {
47
48
  for (const component of place.address_components) {
48
49
  const addressType = component.types[0]
@@ -56,9 +57,10 @@ const AutocompleteInput = (props) => {
56
57
  addressObj.neighborhood = component.long_name
57
58
  }
58
59
  if (addressType === 'route') {
59
- addressObj.route = component.short_name
60
+ addressObj.route = component.long_name
60
61
  }
61
62
  if (addressType === 'locality') {
63
+ addressObj.city = component.long_name || cityFallback.long_name
62
64
  addressObj.locality = component.long_name
63
65
  }
64
66
  if (component.types?.includes('sublocality')) {
@@ -70,9 +72,7 @@ const AutocompleteInput = (props) => {
70
72
  }
71
73
  if (addressType === 'administrative_area_level_1') {
72
74
  addressObj.state = component.long_name
73
- }
74
- if (addressType === 'administrative_area_level_2') {
75
- addressObj.city = component.long_name
75
+ addressObj.state_code = component.short_name
76
76
  }
77
77
  }
78
78
  const address = {
@@ -132,6 +132,7 @@ export const GoogleMaps = (props) => {
132
132
  geocoder.geocode({ latLng: pos }, (results) => {
133
133
  if (results && results.length > 0 && results?.[0]?.address_components) {
134
134
  const addressObj = {}
135
+ const cityFallback = results[0].address_components.find(component => component.types.includes('administrative_area_level_2'))
135
136
  for (const component of results[0].address_components) {
136
137
  const addressType = component.types[0]
137
138
  if (addressType === 'postal_code') {
@@ -144,9 +145,10 @@ export const GoogleMaps = (props) => {
144
145
  addressObj.neighborhood = component.long_name
145
146
  }
146
147
  if (addressType === 'route') {
147
- addressObj.route = component.short_name
148
+ addressObj.route = component.long_name
148
149
  }
149
150
  if (addressType === 'locality') {
151
+ addressObj.city = component.long_name || cityFallback.long_name
150
152
  addressObj.locality = component.long_name
151
153
  }
152
154
  if (component.types?.includes('sublocality')) {
@@ -158,9 +160,7 @@ export const GoogleMaps = (props) => {
158
160
  }
159
161
  if (addressType === 'administrative_area_level_1') {
160
162
  addressObj.state = component.long_name
161
- }
162
- if (addressType === 'administrative_area_level_2') {
163
- addressObj.city = component.long_name
163
+ addressObj.state_code = component.short_name
164
164
  }
165
165
  }
166
166
  const address = {
@@ -39,10 +39,12 @@ export const GpsButton = (props) => {
39
39
  setIsLoading(false)
40
40
  let postalCode = null
41
41
  const addressObj = {}
42
+ const cityFallback = results[0].address_components.find(component => component.types.includes('administrative_area_level_2'))
42
43
  if (results?.[0]?.address_components) {
43
44
  for (const component of results[0].address_components) {
44
45
  const addressType = component.types[0]
45
46
  if (addressType === 'postal_code') {
47
+ addressObj.zipcode = component.short_name
46
48
  postalCode = component.short_name
47
49
  }
48
50
  if (addressType === 'street_number') {
@@ -52,9 +54,10 @@ export const GpsButton = (props) => {
52
54
  addressObj.neighborhood = component.long_name
53
55
  }
54
56
  if (addressType === 'route') {
55
- addressObj.route = component.short_name
57
+ addressObj.route = component.long_name
56
58
  }
57
59
  if (addressType === 'locality') {
60
+ addressObj.city = component.long_name || cityFallback.long_name
58
61
  addressObj.locality = component.long_name
59
62
  }
60
63
  if (component.types?.includes('sublocality')) {
@@ -66,9 +69,7 @@ export const GpsButton = (props) => {
66
69
  }
67
70
  if (addressType === 'administrative_area_level_1') {
68
71
  addressObj.state = component.long_name
69
- }
70
- if (addressType === 'administrative_area_level_2') {
71
- addressObj.city = component.long_name
72
+ addressObj.state_code = component.short_name
72
73
  }
73
74
  }
74
75
  if (status === 'OK') {
@@ -11,7 +11,8 @@ import { useSession } from '../../contexts/SessionContext'
11
11
  export const PaymentOptionStripeLink = (props) => {
12
12
  const {
13
13
  UIComponent,
14
- paymentURL
14
+ paymentURL,
15
+ cartTotal
15
16
  } = props
16
17
 
17
18
  const [ordering] = useApi()
@@ -35,6 +36,14 @@ export const PaymentOptionStripeLink = (props) => {
35
36
  provider: customProviders.includes(ordering?.project) ? 'custom' : 'twilio',
36
37
  country_phone_code: userInfo.country_phone_code,
37
38
  cellphone: userInfo.cellphone,
39
+ payment_url: paymentURL,
40
+ user: {
41
+ name: userInfo?.name,
42
+ lastname: userInfo?.lastname
43
+ },
44
+ cart: {
45
+ total: cartTotal ?? 0
46
+ },
38
47
  message: t('LINK_TO_PAY_MESSAGE',
39
48
  'Hello there _name_ _lastname_, click on the following link to complete the payment: _link_')
40
49
  .replace('_name_', userInfo?.name)