ordering-ui-admin-external 1.40.8 → 1.41.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.
@@ -21,14 +21,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
21
21
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
23
  var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
24
- var _configState$configs, _configState$configs2, _theme$images;
24
+ var _Number, _configState$configs, _Number2, _configState$configs2, _configState$configs3, _configState$configs4, _theme$images;
25
25
  var locationList = props.locationList;
26
26
  var _useConfig = (0, _orderingComponentsAdminExternal.useConfig)(),
27
27
  _useConfig2 = _slicedToArray(_useConfig, 1),
28
28
  configState = _useConfig2[0];
29
- var _useSession = (0, _orderingComponentsAdminExternal.useSession)(),
30
- _useSession2 = _slicedToArray(_useSession, 1),
31
- user = _useSession2[0].user;
32
29
  var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
33
30
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
34
31
  t = _useLanguage2[1];
@@ -37,10 +34,9 @@ var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
37
34
  _useState2 = _slicedToArray(_useState, 2),
38
35
  isHeat = _useState2[0],
39
36
  setIsHeat = _useState2[1];
40
- // const defaultCenter = { lat: 37.775, lng: -122.434 }
41
37
  var defaultCenter = {
42
- lat: 40.77473399999999,
43
- lng: -73.9653844
38
+ lat: (_Number = Number((_configState$configs = configState.configs) === null || _configState$configs === void 0 || (_configState$configs = _configState$configs.location_default_latitude) === null || _configState$configs === void 0 ? void 0 : _configState$configs.value)) !== null && _Number !== void 0 ? _Number : 40.77473399999999,
39
+ lng: (_Number2 = Number((_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 || (_configState$configs2 = _configState$configs2.location_default_longitude) === null || _configState$configs2 === void 0 ? void 0 : _configState$configs2.value)) !== null && _Number2 !== void 0 ? _Number2 : -73.9653844
44
40
  };
45
41
  var googleMapsControls = {
46
42
  defaultZoom: 15,
@@ -59,9 +55,9 @@ var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
59
55
  }, [locationList]);
60
56
  return /*#__PURE__*/_react.default.createElement(_styles.Container, null, locationList !== null && locationList !== void 0 && locationList.loading ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
61
57
  height: 320
62
- }) : /*#__PURE__*/_react.default.createElement(_styles.WrapperMap, null, (configState === null || configState === void 0 || (_configState$configs = configState.configs) === null || _configState$configs === void 0 || (_configState$configs = _configState$configs.google_maps_api_key) === null || _configState$configs === void 0 ? void 0 : _configState$configs.value) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.GoogleMapsMap, {
63
- apiKey: configState === null || configState === void 0 || (_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 || (_configState$configs2 = _configState$configs2.google_maps_api_key) === null || _configState$configs2 === void 0 ? void 0 : _configState$configs2.value,
64
- location: (user === null || user === void 0 ? void 0 : user.location) || defaultCenter,
58
+ }) : /*#__PURE__*/_react.default.createElement(_styles.WrapperMap, null, (configState === null || configState === void 0 || (_configState$configs3 = configState.configs) === null || _configState$configs3 === void 0 || (_configState$configs3 = _configState$configs3.google_maps_api_key) === null || _configState$configs3 === void 0 ? void 0 : _configState$configs3.value) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.GoogleMapsMap, {
59
+ apiKey: configState === null || configState === void 0 || (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 || (_configState$configs4 = _configState$configs4.google_maps_api_key) === null || _configState$configs4 === void 0 ? void 0 : _configState$configs4.value,
60
+ location: defaultCenter,
65
61
  locations: locationList === null || locationList === void 0 ? void 0 : locationList.locations,
66
62
  mapControls: googleMapsControls,
67
63
  isHeatMap: true,
@@ -195,7 +195,7 @@ var DragTh = exports.DragTh = _styledComponents.default.th(_templateObject53 ||
195
195
  return props.theme.colors.primary;
196
196
  });
197
197
  });
198
- var InfoWrapper = exports.InfoWrapper = _styledComponents.default.div(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: relative;\n ", "\n .bold {\n max-width: 150px;\n font-weight: 600;\n margin: 0;\n }\n &:hover > div {\n visibility: visible;\n opacity: 1;\n }\n"])), function (props) {
198
+ var InfoWrapper = exports.InfoWrapper = _styledComponents.default.div(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n position: relative;\n ", "\n\n .bold {\n max-width: 150px;\n font-weight: 600;\n margin: 0;\n }\n\n &:hover > div {\n visibility: visible;\n opacity: 1;\n }\n"])), function (props) {
199
199
  var _props$theme8;
200
200
  return (_props$theme8 = props.theme) !== null && _props$theme8 !== void 0 && _props$theme8.rtl ? (0, _styledComponents.css)(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n margin-left: 4px;\n "]))) : (0, _styledComponents.css)(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n margin-right: 4px;\n "])));
201
201
  });
@@ -33,7 +33,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
33
33
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
34
34
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
35
  var BusinessSummary = exports.BusinessSummary = function BusinessSummary(props) {
36
- var _configs$white_label_, _businessState$busine5, _businessState$busine6, _businessState$busine7, _businessState$busine8, _theme$images, _businessState$busine9;
36
+ var _configs$white_label_, _sessionState$user, _sessionState$user2, _configs$allow_busine, _businessState$busine5, _businessState$busine6, _businessState$busine7, _businessState$busine8, _theme$images, _businessState$busine9;
37
37
  var isAdmin = props.isAdmin,
38
38
  businessState = props.businessState,
39
39
  actionSidebar = props.actionSidebar,
@@ -73,6 +73,9 @@ var BusinessSummary = exports.BusinessSummary = function BusinessSummary(props)
73
73
  _useState4 = _slicedToArray(_useState3, 2),
74
74
  selectedView = _useState4[0],
75
75
  setSelectedView = _useState4[1];
76
+ var _useSession = (0, _orderingComponentsAdminExternal.useSession)(),
77
+ _useSession2 = _slicedToArray(_useSession, 1),
78
+ sessionState = _useSession2[0];
76
79
  var _useState5 = (0, _react.useState)({
77
80
  open: false,
78
81
  content: null,
@@ -82,6 +85,7 @@ var BusinessSummary = exports.BusinessSummary = function BusinessSummary(props)
82
85
  confirm = _useState6[0],
83
86
  setConfirm = _useState6[1];
84
87
  var isEnabledWhiteLabelModule = configs === null || configs === void 0 || (_configs$white_label_ = configs.white_label_module) === null || _configs$white_label_ === void 0 ? void 0 : _configs$white_label_.value;
88
+ var isAllowRegisteredBusiness = (sessionState === null || sessionState === void 0 || (_sessionState$user = sessionState.user) === null || _sessionState$user === void 0 ? void 0 : _sessionState$user.level) === 0 || (sessionState === null || sessionState === void 0 || (_sessionState$user2 = sessionState.user) === null || _sessionState$user2 === void 0 ? void 0 : _sessionState$user2.level) === 2 && (configs === null || configs === void 0 || (_configs$allow_busine = configs.allow_business_owner_register_business) === null || _configs$allow_busine === void 0 ? void 0 : _configs$allow_busine.value) === '1';
85
89
  var handleOpenCategory = function handleOpenCategory() {
86
90
  var _businessState$busine;
87
91
  events.emit('go_to_page', {
@@ -197,7 +201,7 @@ var BusinessSummary = exports.BusinessSummary = function BusinessSummary(props)
197
201
  onClick: function onClick() {
198
202
  return setIsBusinessPreview(true);
199
203
  }
200
- }, t('PREVIEW', 'Preview')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
204
+ }, t('PREVIEW', 'Preview')), isAllowRegisteredBusiness && /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
201
205
  onClick: function onClick() {
202
206
  return handleDuplicateBusiness();
203
207
  }
package/index-template.js CHANGED
@@ -298,7 +298,7 @@ if (!(window?.location?.hostname === 'localhost')) {
298
298
  integrations: [
299
299
  new Integrations.BrowserTracing()
300
300
  ],
301
- release: process.env.npm_package_version ? 'ordering-ui-admin-release@' + process.env.npm_package_version : 'ordering-ui-admin-release@' + '1.1.3',
301
+ release: process.env.npm_package_version ? 'ordering-ui-admin-release@' + process.env.npm_package_version : 'ordering-ui-admin-release@' + '1.2.0',
302
302
  // Release health
303
303
  autoSessionTracking: true,
304
304
  ignoreErrors: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.40.8",
3
+ "version": "1.41.0",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.40.4",
86
+ "ordering-components-admin-external": "1.41.0",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useConfig, useSession, useLanguage, GoogleMapsMap } from 'ordering-components-admin-external'
2
+ import { useConfig, useLanguage, GoogleMapsMap } from 'ordering-components-admin-external'
3
3
  import { useTheme } from 'styled-components'
4
4
  import {
5
5
  Container,
@@ -13,12 +13,14 @@ export const AnalyticsMap = (props) => {
13
13
  locationList
14
14
  } = props
15
15
  const [configState] = useConfig()
16
- const [{ user }] = useSession()
17
16
  const [, t] = useLanguage()
18
17
  const theme = useTheme()
19
18
  const [isHeat, setIsHeat] = useState(false)
20
- // const defaultCenter = { lat: 37.775, lng: -122.434 }
21
- const defaultCenter = { lat: 40.77473399999999, lng: -73.9653844 }
19
+
20
+ const defaultCenter = {
21
+ lat: Number(configState.configs?.location_default_latitude?.value) ?? 40.77473399999999,
22
+ lng: Number(configState.configs?.location_default_longitude?.value) ?? -73.9653844
23
+ }
22
24
 
23
25
  const googleMapsControls = {
24
26
  defaultZoom: 15,
@@ -47,7 +49,7 @@ export const AnalyticsMap = (props) => {
47
49
  <>
48
50
  <GoogleMapsMap
49
51
  apiKey={configState?.configs?.google_maps_api_key?.value}
50
- location={user?.location || defaultCenter}
52
+ location={defaultCenter}
51
53
  locations={locationList?.locations}
52
54
  mapControls={googleMapsControls}
53
55
  isHeatMap
@@ -133,4 +133,4 @@ export const InvoiceBusinessManager = (props) => {
133
133
  UIComponent: InvoiceBusinessManagerUI
134
134
  }
135
135
  return <InvoiceBusinessManagerController {...invoiceBusinessManagerProps} />
136
- }
136
+ }
@@ -95,4 +95,4 @@ export const InvoiceOrderType = (props) => {
95
95
  </ActionBtnWrapper>
96
96
  </InvoiceOrderTypeContainer>
97
97
  )
98
- }
98
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { useLocation } from 'react-router-dom'
3
3
  import { useLanguage, UsersList as UsersListController } from 'ordering-components-admin-external'
4
- import { getStorageItem, removeStorageItem, setStorageItem, addQueryToUrl } from '../../../utils'
4
+ import { getStorageItem, removeStorageItem, setStorageItem, addQueryToUrl } from '../../../utils'
5
5
 
6
6
  import { UsersListingHeader } from '../UsersListingHeader'
7
7
  import { UserTypeFilter } from '../UserTypeFilter'
@@ -418,11 +418,13 @@ export const InfoWrapper = styled.div`
418
418
  ` : css`
419
419
  margin-right: 4px;
420
420
  `}
421
+
421
422
  .bold {
422
423
  max-width: 150px;
423
424
  font-weight: 600;
424
425
  margin: 0;
425
426
  }
427
+
426
428
  &:hover > div {
427
429
  visibility: visible;
428
430
  opacity: 1;
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
- import { useLanguage, useUtils, useEvent, useApi, useConfig } from 'ordering-components-admin-external'
3
+ import { useLanguage, useUtils, useEvent, useApi, useConfig, useSession } from 'ordering-components-admin-external'
4
4
  import BsChevronRight from '@meronex/icons/bs/BsChevronRight'
5
5
  import { useTheme } from 'styled-components'
6
6
  import { Dropdown, DropdownButton } from 'react-bootstrap'
@@ -53,9 +53,11 @@ export const BusinessSummary = (props) => {
53
53
  const { width } = useWindowSize()
54
54
  const [isBusinessPreview, setIsBusinessPreview] = useState(false)
55
55
  const [selectedView, setSelectedView] = useState('desktop')
56
+ const [sessionState] = useSession()
56
57
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
57
58
 
58
59
  const isEnabledWhiteLabelModule = configs?.white_label_module?.value
60
+ const isAllowRegisteredBusiness = ((sessionState?.user?.level === 0) || (sessionState?.user?.level === 2 && configs?.allow_business_owner_register_business?.value === '1'))
59
61
 
60
62
  const handleOpenCategory = () => {
61
63
  events.emit('go_to_page', { page: 'store', params: { store: businessState?.business?.slug } })
@@ -216,11 +218,13 @@ export const BusinessSummary = (props) => {
216
218
  >
217
219
  {t('PREVIEW', 'Preview')}
218
220
  </Dropdown.Item>
221
+ {isAllowRegisteredBusiness &&
219
222
  <Dropdown.Item
220
223
  onClick={() => handleDuplicateBusiness()}
221
224
  >
222
225
  {t('DUPLICATE', 'Duplicate')}
223
226
  </Dropdown.Item>
227
+ }
224
228
  {!isEnabledWhiteLabelModule && (
225
229
  <Dropdown.Item
226
230
  onClick={() => handleSelectedItem('personalization')}
@@ -352,4 +356,4 @@ export const BusinessSummary = (props) => {
352
356
  </Modal>
353
357
  </>
354
358
  )
355
- }
359
+ }