ordering-ui-admin-external 1.7.2 → 1.7.4

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.
@@ -34,8 +34,8 @@ var CountryFilterUI = function CountryFilterUI(props) {
34
34
  searchValue = props.searchValue,
35
35
  _onSearch = props.onSearch,
36
36
  handleClickFilterButton = props.handleClickFilterButton,
37
- countryCode = props.countryCode,
38
- handleChangeCode = props.handleChangeCode;
37
+ code = props.code,
38
+ setCode = props.setCode;
39
39
  var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
40
40
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
41
41
  t = _useLanguage2[1];
@@ -105,9 +105,9 @@ var CountryFilterUI = function CountryFilterUI(props) {
105
105
  return /*#__PURE__*/_react.default.createElement(_styles2.CountryItem, {
106
106
  key: country === null || country === void 0 ? void 0 : country.id,
107
107
  onClick: function onClick() {
108
- return handleChangeCode(country === null || country === void 0 ? void 0 : country.code);
108
+ return setCode(country === null || country === void 0 ? void 0 : country.code);
109
109
  }
110
- }, countryCode === (country === null || country === void 0 ? void 0 : country.code) ? /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.RecordCircleFill, {
110
+ }, code === (country === null || country === void 0 ? void 0 : country.code) ? /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.RecordCircleFill, {
111
111
  className: "checked"
112
112
  }) : /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.Circle, null), /*#__PURE__*/_react.default.createElement("span", {
113
113
  className: "name"
@@ -9,53 +9,37 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _orderingComponentsAdminExternal = require("ordering-components-admin-external");
10
10
  var _Select = require("../../../styles/Select");
11
11
  var _styledComponents = require("styled-components");
12
- var _utils = require("../../../utils");
13
12
  var _styles = require("../../../styles");
14
13
  var _Shared = require("../../Shared");
15
- var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
16
14
  var _styles2 = require("./styles");
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
- 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; }
21
- 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; }
22
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
17
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
24
18
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
19
  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); }
26
20
  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; }
27
21
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
28
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
- var BusinessWidgetsUI = function BusinessWidgetsUI(props) {
30
- var _sitesListState$sites, _sitesListState$sites2;
31
- var business = props.business,
32
- sitesListState = props.sitesListState;
23
+ var BusinessWidgets = function BusinessWidgets(props) {
24
+ var business = props.business;
33
25
  var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
34
26
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
35
27
  t = _useLanguage2[1];
36
28
  var theme = (0, _styledComponents.useTheme)();
37
- var _useEvent = (0, _orderingComponentsAdminExternal.useEvent)(),
38
- _useEvent2 = _slicedToArray(_useEvent, 1),
39
- events = _useEvent2[0];
29
+ var _useApi = (0, _orderingComponentsAdminExternal.useApi)(),
30
+ _useApi2 = _slicedToArray(_useApi, 1),
31
+ ordering = _useApi2[0];
40
32
  var _useState = (0, _react.useState)('modal'),
41
33
  _useState2 = _slicedToArray(_useState, 2),
42
34
  selectedType = _useState2[0],
43
35
  setSelectedType = _useState2[1];
44
- var _useState3 = (0, _react.useState)(null),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- siteList = _useState4[0],
47
- setSiteList = _useState4[1];
48
- var _useState5 = (0, _react.useState)(''),
49
- _useState6 = _slicedToArray(_useState5, 2),
50
- siteId = _useState6[0],
51
- setSiteId = _useState6[1];
52
- var _useState7 = (0, _react.useState)({
36
+ var _useState3 = (0, _react.useState)({
53
37
  open: false,
54
38
  content: []
55
39
  }),
56
- _useState8 = _slicedToArray(_useState7, 2),
57
- alertState = _useState8[0],
58
- setAlertState = _useState8[1];
40
+ _useState4 = _slicedToArray(_useState3, 2),
41
+ alertState = _useState4[0],
42
+ setAlertState = _useState4[1];
59
43
  var modalTypes = [{
60
44
  value: 'modal',
61
45
  content: t('TYPE_MODAL_POPUP', 'Button with modal style')
@@ -63,60 +47,12 @@ var BusinessWidgetsUI = function BusinessWidgetsUI(props) {
63
47
  value: 'chat',
64
48
  content: t('TYPE_MODAL_CHAT', 'Chat style integration')
65
49
  }];
66
- var getBusinessURL = function getBusinessURL(businessURL, slug) {
67
- if (!businessURL || businessURL === '/store/:business_slug') return "store/".concat(slug);else if (businessURL === '/:business_slug') return slug;else return "store/".concat(businessURL.split('?')[1].replace(':business_slug', '')).concat(business.slug);
68
- };
69
- var businessURL = getBusinessURL((_sitesListState$sites = sitesListState.sites.find(function (site) {
70
- return (site === null || site === void 0 ? void 0 : site.id) === siteId;
71
- })) === null || _sitesListState$sites === void 0 ? void 0 : _sitesListState$sites.business_url_template, business === null || business === void 0 ? void 0 : business.slug);
72
- var url = "".concat((0, _utils.checkSiteUrl)(sitesListState === null || sitesListState === void 0 ? void 0 : (_sitesListState$sites2 = sitesListState.sites.find(function (site) {
73
- return (site === null || site === void 0 ? void 0 : site.id) === siteId;
74
- })) === null || _sitesListState$sites2 === void 0 ? void 0 : _sitesListState$sites2.url)).concat(businessURL);
50
+ var url = "https://".concat(ordering.project, ".tryordering.com/store/").concat(business === null || business === void 0 ? void 0 : business.slug);
75
51
  var color = theme.colors.primary;
76
52
  var widgetPopup = '<script type="text/javascript">window.onload=function(){function e(e,t){return!0===e||!1===e?e:t}function t(){return!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))}"undefined"==typeof orderingSettings&&(orderingSettings={});var i=orderingSettings,o=e(i.openOnMobile,!1),n=e(i.openOnDesktop,!1),s=!1,l=document.createElement("div");l.id="ordering_bot",l.style.height=0,l.style.width=0,l.style.position="fixed",l.style.right="20%",l.style.left="20%",l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px",l.style.overflow="hidden",l.style.zIndex=99999,l.style.maxheight=window.innerHeight+"px",l.style["-webkit-transition"]="height 0.5s, width 0.5s",l.style["-moz-transition"]="height 0.5s, width 0.5s",l.style["-ms-transition"]="height 0.5s, width 0.5s",l.style["-o-transition"]="height 0.5s, width 0.5s",l.style.transition="height 0.5s, width 0.5s",l.style["-webkit-overflow-scrolling"]="touch",l.style["overflow-y"]="scroll",l.style.boxShadow="0 0 20px 0 #999";var r={insideIframe:!1};document.addEventListener("scroll",function(e){r.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var d=document.createElement("div");d.style.height="40px",d.style.background="#ccc",d.style.width="100%",d.style.position="absolute";var a=document.createElement("div");a.style.height="40px",a.style.width="40px",a.style.float="right",a.style.fontSize="28px",a.style.lineHeight="25px",a.style.padding="5px",a.style.textAlign="center",a.style.boxSizing="border-box",a.style.color="#666",a.style.borderLeft="1px solid #bbb",a.style.cursor="pointer",a.innerHTML="&times;",d.appendChild(a);var h=document.createElement("iframe");function y(){s?(l.style.height="auto",l.style.width="auto",window.innerWidth<=480?(l.style.right=0,l.style.left=0,l.style.top=0,l.style.bottom=0,l.style.borderRadius=0):(window.innerWidth>480&&window.innerWidth<600?(l.style.left="10%",l.style.right="10%"):(l.style.left="20%",l.style.right="20%"),l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px")):(l.style.height="0px",l.style.width="0px")}h.id="ordering_iframe",h.src="' + url + '",h.style.border=0,h.style.height="100%",h.style.width="100%",h.style.maxWidth="none",h.style.paddingTop="40px",h.style.boxSizing="border-box",h.style["-webkit-overflow-scrolling"]="touch",l.appendChild(d),l.appendChild(h),document.getElementsByTagName("body")[0].appendChild(l),window.toggleOrderingWidget=function(){(s=!s)?(t()&&(r.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),r.insideIframe=!0,r.scrollX=window.scrollX,r.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")):(t()&&(r.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),r.insideIframe=!1,t()||(document.body.style.overflow="auto")),y()},y(),window.onresize=y,(t()&&o&&!(navigator.userAgent.match(/iPad/i)||(navigator.userAgent.match(/iPhone/i)||void 0))||!t()&&n)&&toggleOrderingWidget(),a.addEventListener("click",toggleOrderingWidget)};</script>';
77
53
  var widgetBot = '<script type="text/javascript">window.onload=function(){function e(e,t){return e===!0||e===!1||void 0!=e||null!=e?e:t}function t(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)?!0:!1}function n(){return navigator.userAgent.match(/iPad/i)?"iPad":navigator.userAgent.match(/iPhone/i)?"iPhone":void 0}function i(){h=!h,h?(t()&&(w.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),g.innerHTML=p.outerHTML):(t()&&(w.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),g.innerHTML=c.outerHTML),o(m)}function o(e){e.style.height=s(),e.style.width=r(),window.innerWidth<=480&&(e.style.top=0,e.style.left=0,e.style.right=0,e.style.bottom=0)}function s(){if(h){if(window.innerWidth<=480)return"100%";var e=window.innerHeight-70-10-20;return (e>570&&y.type=="chat")?"570px":e+"px"}return"0px"}function r(){return h?window.innerWidth<=480?"100%":"chat"==y.type?"370px":window.innerWidth-40+"px":"0px"}function l(){console.log("onresize"),window.innerWidth<=480?(m.style.position="fixed",m.style.bottom=0,m.style.right=0,m.style.borderRadius=0,f.style.display="block"):(m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",f.style.display="none"),m.style.height=s(),m.style.width=r()}var d="' + url + '";"undefined"==typeof orderingSettings&&(orderingSettings={});var a=orderingSettings,y={openOnMobile:e(a.openOnMobile,!1),openOnDesktop:e(a.openOnDesktop,!1),type:e(a.type,"chat")},h=!1,g=document.createElement("div"),c=document.createElement("img");c.src="https://orderingweb.ordering.co/templates/web/img/icon.png",c.style.width="30px",c.style.marginTop="9px",c.style.maxWidth="none";var p=document.createElement("div");p.innerHTML="&times;",p.style.display="block",p.style.color="#fff",p.style.font="Arial",p.style.fontSize="30px",p.style.margin="0 5px",p.style.borderRadius="50px",p.style.width="40px",p.style.height="40px",p.style.lineHeight="47px",p.style.fontWeight="400",g.style.position="fixed",g.style.bottom="20px",g.style.right="20px",g.style.width="50px",g.style.height="50px",g.style.background="' + color + '",g.style.borderRadius="50px",g.style.textAlign="center",g.style.cursor="pointer",g.style.outline="none",g.style.border=0,g.style.zIndex=99999,g.appendChild(c);var m=document.createElement("div");m.id="ordering_bot",m.style.height=0,m.style.width=0,m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",m.style.overflow="hidden",m.style.zIndex=99999,m.style.maxheight=window.innerHeight+"px",m.style["-webkit-transition"]="height 0.5s, width 0.5s",m.style["-moz-transition"]="height 0.5s, width 0.5s",m.style["-ms-transition"]="height 0.5s, width 0.5s",m.style["-o-transition"]="height 0.5s, width 0.5s",m.style.transition="height 0.5s, width 0.5s";var u=document.createElement("iframe");u.id="ordering_bot_iframe",u.src=d,u.setAttribute("allow", "geolocation"),u.style.border=0,u.style.height="125%",u.style.width="125%",u.style.maxWidth="none",u.style["-ms-zoom"]="0.8",u.style["-moz-transform"]="scale(0.8)",u.style["-moz-transform-origin"]="0 0",u.style["-o-transform"]="scale(0.8)",u.style["-o-transform-origin"]="0 0",u.style["-webkit-transform"]="scale(0.8)",u.style["-webkit-transform-origin"]="0 0";var w={insideIframe:!1};m.addEventListener("mouseenter",function(){w.insideIframe=!0,w.scrollX=window.scrollX,w.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")}),m.addEventListener("mouseleave",function(){w.insideIframe=!1,t()||(document.body.style.overflow="auto")}),document.addEventListener("scroll",function(e){w.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var f=document.createElement("div");f.style.position="absolute",f.style.width="35px",f.style.height="35px",f.style.bottom="45px",f.style.left="50%",f.style.lineHeight="36px",f.style.background="transparent",f.style.borderColor="transparent";var x=document.createElement("div");x.innerHTML="&times;",x.style.position="relative",x.style.left="-50%",x.style.zIndex="999",x.style.width="40px",x.style.height="40px",x.style.background="rgba(0,0,0,0.2)",x.style.textAlign="center",x.style.border=0,x.style.borderRadius="35px",x.style.color="#fff",x.style.fontSize="30px",x.style.outline="none",x.style.cursor="pointer",f.appendChild(x),m.appendChild(f),m.appendChild(u),document.getElementsByTagName("body")[0].appendChild(g),document.getElementsByTagName("body")[0].appendChild(m),window.toggleOrderingWidget=i,g.onclick=i,f.onclick=i,l(),window.onresize=l,(t()&&y.openOnMobile&&!n()||!t()&&y.openOnDesktop)&&i(),setInterval(function(){n()&&window.innerHeight<m.clientHeight&&(u.style.height=.7*window.innerHeight+"px"),n()&&window.innerHeight==m.clientHeight&&(m.style.bottom=0,u.style.height="125%")},2e3)};</script>';
78
54
  var widgetInline = '<script type="text/javascript">var orderingInlineSettings = {baseUrl: "/"};</script><script type="text/javascript">window.onload=function(){var i={baseUrl:orderingInlineSettings&&orderingInlineSettings.baseUrl?orderingInlineSettings.baseUrl:"/inline/"},l=location.href.split(i.baseUrl)[0],e=location.href.split(i.baseUrl)[1],a="' + url + '",r=document.createElement("iframe");r.id="ordering_iframe",r.src=(a+"/"+e).replace(/([^:]\\/)\\/+/g,"$1"),r.style.border=0,r.style.height="100%",r.style.width="100%",r.style.maxWidth="none",r.allow="geolocation";var d=document.getElementById("ordering_iframe_inline");d.appendChild(r),r.addEventListener("load",function(){t(),setInterval(function(){var e=JSON.stringify({event:"body",data:{}});r.contentWindow.postMessage(e,a)},100)});function t(){var e=document.documentElement,t=window.innerwidth||e.clientWidth,n=window.innerHeight||e.clientHeight,o=(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),i=(window.pageYOffset||e.scrollTop)-(e.clientTop||0),l=JSON.stringify({event:"scroll",data:{top:i,left:o,width:t,height:n,offsetTop:s(r).top}});r.contentWindow.postMessage(l,a)}function s(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}window.addEventListener("message",function(e){var t=e.data;if("body"==t.event)d.style.height=t.data.height+"px";else if("scroll"==t.event)t.data.enable?document.getElementsByTagName("body")[0].style.overflowY="auto":document.getElementsByTagName("body")[0].style.overflowY="hidden";else if("url"==t.event){var n=document.createElement("a");n.href=t.data;var o=((l?l+"/":"")+i.baseUrl+"/"+n.pathname).replace(/([^:]\\/)\\/+/g,"$1");window.history.pushState("","",o),"http://localhost/"!=t.data&&window.scrollTo(0,s(r).top)}},!1),window.onscroll=function(e){t()}};</script><div style="height: 1000px;" id="ordering_iframe_inline"></div>';
79
- (0, _react.useEffect)(function () {
80
- var _sitesListState$sites3;
81
- if (sitesListState !== null && sitesListState !== void 0 && sitesListState.loading) return;
82
- if ((sitesListState === null || sitesListState === void 0 ? void 0 : (_sitesListState$sites3 = sitesListState.sites) === null || _sitesListState$sites3 === void 0 ? void 0 : _sitesListState$sites3.length) > 0) {
83
- var _siteList = sitesListState.sites.map(function (site) {
84
- return {
85
- value: site === null || site === void 0 ? void 0 : site.id,
86
- content: site === null || site === void 0 ? void 0 : site.name,
87
- disabled: !(site !== null && site !== void 0 && site.url)
88
- };
89
- });
90
- setSiteList(_siteList);
91
- } else {
92
- setSiteList([]);
93
- }
94
- }, [sitesListState]);
95
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.Container, null, (sitesListState === null || sitesListState === void 0 ? void 0 : sitesListState.loading) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
96
- width: 100,
97
- height: 15,
98
- style: {
99
- marginBottom: 10
100
- }
101
- }), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
102
- height: 44
103
- })), !(sitesListState !== null && sitesListState !== void 0 && sitesListState.loading) && (siteList === null || siteList === void 0 ? void 0 : siteList.length) > 0 && /*#__PURE__*/_react.default.createElement(_styles2.FormGroup, null, /*#__PURE__*/_react.default.createElement("label", null, t('SELECT_SITE', 'Select site')), /*#__PURE__*/_react.default.createElement(_styles2.SelectWrapper, null, /*#__PURE__*/_react.default.createElement(_Select.Select, {
104
- isSecondIcon: true,
105
- notAsync: true,
106
- placeholder: t('SELECT_SITE', 'Select site'),
107
- defaultValue: siteId,
108
- options: siteList,
109
- onChange: function onChange(val) {
110
- return setSiteId(val);
111
- }
112
- }))), !(sitesListState !== null && sitesListState !== void 0 && sitesListState.loading) && (siteList === null || siteList === void 0 ? void 0 : siteList.length) === 0 && /*#__PURE__*/_react.default.createElement(_styles2.ConfigMessage, null, t('FIRST_CONFIG_ORDERING_PRODUCTS', 'First Configure ordering products'), /*#__PURE__*/_react.default.createElement("span", {
113
- onClick: function onClick() {
114
- return events.emit('go_to_page', {
115
- page: 'ordering_products',
116
- replace: true
117
- });
118
- }
119
- }, t('ORDERING_PRODUCTS', 'Ordering products'))), siteId && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.PopupContainer, null, /*#__PURE__*/_react.default.createElement("h2", null, t('INTEGRATION_WEBSITE', 'Integration on your website'), ": ", t('POPUP', 'Popup')), /*#__PURE__*/_react.default.createElement(_styles2.FormGroup, null, /*#__PURE__*/_react.default.createElement("label", null, t('TYPE_MODAL', 'Modal style')), /*#__PURE__*/_react.default.createElement(_styles2.SelectWrapper, null, /*#__PURE__*/_react.default.createElement(_Select.Select, {
55
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.Container, null, /*#__PURE__*/_react.default.createElement(_styles2.PopupContainer, null, /*#__PURE__*/_react.default.createElement("h2", null, t('INTEGRATION_WEBSITE', 'Integration on your website'), ": ", t('POPUP', 'Popup')), /*#__PURE__*/_react.default.createElement(_styles2.FormGroup, null, /*#__PURE__*/_react.default.createElement("label", null, t('TYPE_MODAL', 'Modal style')), /*#__PURE__*/_react.default.createElement(_styles2.SelectWrapper, null, /*#__PURE__*/_react.default.createElement(_Select.Select, {
120
56
  isSecondIcon: true,
121
57
  notAsync: true,
122
58
  placeholder: t('SELECT_TYPE', 'Select Type'),
@@ -155,7 +91,7 @@ var BusinessWidgetsUI = function BusinessWidgetsUI(props) {
155
91
  onClick: function onClick() {
156
92
  return window.open('https://support.ordering.co/hc/en-us/articles/360043529971-Widget-Integration', '_blank');
157
93
  }
158
- }, t('LEARN_HOW_TO_DO_IT', 'Learn how to do it'))))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
94
+ }, t('LEARN_HOW_TO_DO_IT', 'Learn how to do it')))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
159
95
  title: t('WEB_APPNAME', 'Ordering'),
160
96
  content: alertState.content,
161
97
  acceptText: t('ACCEPT', 'Accept'),
@@ -175,10 +111,4 @@ var BusinessWidgetsUI = function BusinessWidgetsUI(props) {
175
111
  closeOnBackdrop: false
176
112
  }));
177
113
  };
178
- var BusinessWidgets = function BusinessWidgets(props) {
179
- var businessWidgetsProps = _objectSpread(_objectSpread({}, props), {}, {
180
- UIComponent: BusinessWidgetsUI
181
- });
182
- return /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.SitesList, businessWidgetsProps);
183
- };
184
114
  exports.BusinessWidgets = BusinessWidgets;
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SelectWrapper = exports.PopupContainer = exports.InlineContainer = exports.GuideLink = exports.FormGroup = exports.Container = exports.ConfigMessage = void 0;
6
+ exports.SelectWrapper = exports.PopupContainer = exports.InlineContainer = exports.GuideLink = exports.FormGroup = exports.Container = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
8
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
11
  var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
@@ -21,8 +21,4 @@ exports.SelectWrapper = SelectWrapper;
21
21
  var InlineContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n h2 {\n font-weight: 600;\n font-size: 16px;\n line-height: 24px;\n margin-top: 0px;\n margin-bottom: 20px;\n }\n"])));
22
22
  exports.InlineContainer = InlineContainer;
23
23
  var GuideLink = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n button {\n border-radius: 8px;\n height: 44px;\n }\n"])));
24
- exports.GuideLink = GuideLink;
25
- var ConfigMessage = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 14px;\n span {\n color: ", ";\n text-decoration: underline;\n cursor: pointer;\n display: block;\n }\n"])), function (props) {
26
- return props.theme.colors.primary;
27
- });
28
- exports.ConfigMessage = ConfigMessage;
24
+ exports.GuideLink = GuideLink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
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.7.1",
86
+ "ordering-components-admin-external": "1.7.2",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -19,8 +19,8 @@ const CountryFilterUI = (props) => {
19
19
  searchValue,
20
20
  onSearch,
21
21
  handleClickFilterButton,
22
- countryCode,
23
- handleChangeCode
22
+ code,
23
+ setCode
24
24
  } = props
25
25
 
26
26
  const [, t] = useLanguage()
@@ -84,8 +84,8 @@ const CountryFilterUI = (props) => {
84
84
  ) : (
85
85
  <>
86
86
  {currentPages?.map(country => (
87
- <CountryItem key={country?.id} onClick={() => handleChangeCode(country?.code)}>
88
- {countryCode === country?.code ? <RecordCircleFill className='checked' /> : <Circle />}
87
+ <CountryItem key={country?.id} onClick={() => setCode(country?.code)}>
88
+ {code === country?.code ? <RecordCircleFill className='checked' /> : <Circle />}
89
89
  <span className='name'>{country?.name}</span>
90
90
  </CountryItem>
91
91
  ))}
@@ -1,31 +1,26 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { useLanguage, useEvent, SitesList } from 'ordering-components-admin-external'
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useApi } from 'ordering-components-admin-external'
3
3
  import { Select } from '../../../styles/Select'
4
4
  import { useTheme } from 'styled-components'
5
- import { checkSiteUrl } from '../../../utils'
6
5
  import { Button, Input, TextArea } from '../../../styles'
7
6
  import { Alert } from '../../Shared'
8
- import Skeleton from 'react-loading-skeleton'
9
7
  import {
10
8
  Container,
11
9
  PopupContainer,
12
10
  FormGroup,
13
11
  SelectWrapper,
14
12
  InlineContainer,
15
- GuideLink,
16
- ConfigMessage
13
+ GuideLink
17
14
  } from './styles'
18
15
 
19
- const BusinessWidgetsUI = (props) => {
20
- const { business, sitesListState } = props
16
+ export const BusinessWidgets = (props) => {
17
+ const { business } = props
21
18
 
22
19
  const [, t] = useLanguage()
23
20
  const theme = useTheme()
24
- const [events] = useEvent()
21
+ const [ordering] = useApi()
25
22
 
26
23
  const [selectedType, setSelectedType] = useState('modal')
27
- const [siteList, setSiteList] = useState(null)
28
- const [siteId, setSiteId] = useState('')
29
24
  const [alertState, setAlertState] = useState({ open: false, content: [] })
30
25
 
31
26
  const modalTypes = [
@@ -33,146 +28,92 @@ const BusinessWidgetsUI = (props) => {
33
28
  { value: 'chat', content: t('TYPE_MODAL_CHAT', 'Chat style integration') }
34
29
  ]
35
30
 
36
- const getBusinessURL = (businessURL, slug) => {
37
- if (!businessURL || (businessURL === '/store/:business_slug')) return `store/${slug}`
38
- else if (businessURL === '/:business_slug') return slug
39
- else return `store/${businessURL.split('?')[1].replace(':business_slug', '')}${business.slug}`
40
- }
41
-
42
- const businessURL = getBusinessURL(sitesListState.sites.find(site => site?.id === siteId)?.business_url_template, business?.slug)
43
- const url = `${checkSiteUrl(sitesListState?.sites.find(site => site?.id === siteId)?.url)}${businessURL}`
31
+ const url = `https://${ordering.project}.tryordering.com/store/${business?.slug}`
44
32
  const color = theme.colors.primary
45
33
  const widgetPopup = '<script type="text/javascript">window.onload=function(){function e(e,t){return!0===e||!1===e?e:t}function t(){return!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))}"undefined"==typeof orderingSettings&&(orderingSettings={});var i=orderingSettings,o=e(i.openOnMobile,!1),n=e(i.openOnDesktop,!1),s=!1,l=document.createElement("div");l.id="ordering_bot",l.style.height=0,l.style.width=0,l.style.position="fixed",l.style.right="20%",l.style.left="20%",l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px",l.style.overflow="hidden",l.style.zIndex=99999,l.style.maxheight=window.innerHeight+"px",l.style["-webkit-transition"]="height 0.5s, width 0.5s",l.style["-moz-transition"]="height 0.5s, width 0.5s",l.style["-ms-transition"]="height 0.5s, width 0.5s",l.style["-o-transition"]="height 0.5s, width 0.5s",l.style.transition="height 0.5s, width 0.5s",l.style["-webkit-overflow-scrolling"]="touch",l.style["overflow-y"]="scroll",l.style.boxShadow="0 0 20px 0 #999";var r={insideIframe:!1};document.addEventListener("scroll",function(e){r.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var d=document.createElement("div");d.style.height="40px",d.style.background="#ccc",d.style.width="100%",d.style.position="absolute";var a=document.createElement("div");a.style.height="40px",a.style.width="40px",a.style.float="right",a.style.fontSize="28px",a.style.lineHeight="25px",a.style.padding="5px",a.style.textAlign="center",a.style.boxSizing="border-box",a.style.color="#666",a.style.borderLeft="1px solid #bbb",a.style.cursor="pointer",a.innerHTML="&times;",d.appendChild(a);var h=document.createElement("iframe");function y(){s?(l.style.height="auto",l.style.width="auto",window.innerWidth<=480?(l.style.right=0,l.style.left=0,l.style.top=0,l.style.bottom=0,l.style.borderRadius=0):(window.innerWidth>480&&window.innerWidth<600?(l.style.left="10%",l.style.right="10%"):(l.style.left="20%",l.style.right="20%"),l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px")):(l.style.height="0px",l.style.width="0px")}h.id="ordering_iframe",h.src="' + url + '",h.style.border=0,h.style.height="100%",h.style.width="100%",h.style.maxWidth="none",h.style.paddingTop="40px",h.style.boxSizing="border-box",h.style["-webkit-overflow-scrolling"]="touch",l.appendChild(d),l.appendChild(h),document.getElementsByTagName("body")[0].appendChild(l),window.toggleOrderingWidget=function(){(s=!s)?(t()&&(r.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),r.insideIframe=!0,r.scrollX=window.scrollX,r.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")):(t()&&(r.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),r.insideIframe=!1,t()||(document.body.style.overflow="auto")),y()},y(),window.onresize=y,(t()&&o&&!(navigator.userAgent.match(/iPad/i)||(navigator.userAgent.match(/iPhone/i)||void 0))||!t()&&n)&&toggleOrderingWidget(),a.addEventListener("click",toggleOrderingWidget)};</script>'
46
34
  const widgetBot = '<script type="text/javascript">window.onload=function(){function e(e,t){return e===!0||e===!1||void 0!=e||null!=e?e:t}function t(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)?!0:!1}function n(){return navigator.userAgent.match(/iPad/i)?"iPad":navigator.userAgent.match(/iPhone/i)?"iPhone":void 0}function i(){h=!h,h?(t()&&(w.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),g.innerHTML=p.outerHTML):(t()&&(w.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),g.innerHTML=c.outerHTML),o(m)}function o(e){e.style.height=s(),e.style.width=r(),window.innerWidth<=480&&(e.style.top=0,e.style.left=0,e.style.right=0,e.style.bottom=0)}function s(){if(h){if(window.innerWidth<=480)return"100%";var e=window.innerHeight-70-10-20;return (e>570&&y.type=="chat")?"570px":e+"px"}return"0px"}function r(){return h?window.innerWidth<=480?"100%":"chat"==y.type?"370px":window.innerWidth-40+"px":"0px"}function l(){console.log("onresize"),window.innerWidth<=480?(m.style.position="fixed",m.style.bottom=0,m.style.right=0,m.style.borderRadius=0,f.style.display="block"):(m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",f.style.display="none"),m.style.height=s(),m.style.width=r()}var d="' + url + '";"undefined"==typeof orderingSettings&&(orderingSettings={});var a=orderingSettings,y={openOnMobile:e(a.openOnMobile,!1),openOnDesktop:e(a.openOnDesktop,!1),type:e(a.type,"chat")},h=!1,g=document.createElement("div"),c=document.createElement("img");c.src="https://orderingweb.ordering.co/templates/web/img/icon.png",c.style.width="30px",c.style.marginTop="9px",c.style.maxWidth="none";var p=document.createElement("div");p.innerHTML="&times;",p.style.display="block",p.style.color="#fff",p.style.font="Arial",p.style.fontSize="30px",p.style.margin="0 5px",p.style.borderRadius="50px",p.style.width="40px",p.style.height="40px",p.style.lineHeight="47px",p.style.fontWeight="400",g.style.position="fixed",g.style.bottom="20px",g.style.right="20px",g.style.width="50px",g.style.height="50px",g.style.background="' + color + '",g.style.borderRadius="50px",g.style.textAlign="center",g.style.cursor="pointer",g.style.outline="none",g.style.border=0,g.style.zIndex=99999,g.appendChild(c);var m=document.createElement("div");m.id="ordering_bot",m.style.height=0,m.style.width=0,m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",m.style.overflow="hidden",m.style.zIndex=99999,m.style.maxheight=window.innerHeight+"px",m.style["-webkit-transition"]="height 0.5s, width 0.5s",m.style["-moz-transition"]="height 0.5s, width 0.5s",m.style["-ms-transition"]="height 0.5s, width 0.5s",m.style["-o-transition"]="height 0.5s, width 0.5s",m.style.transition="height 0.5s, width 0.5s";var u=document.createElement("iframe");u.id="ordering_bot_iframe",u.src=d,u.setAttribute("allow", "geolocation"),u.style.border=0,u.style.height="125%",u.style.width="125%",u.style.maxWidth="none",u.style["-ms-zoom"]="0.8",u.style["-moz-transform"]="scale(0.8)",u.style["-moz-transform-origin"]="0 0",u.style["-o-transform"]="scale(0.8)",u.style["-o-transform-origin"]="0 0",u.style["-webkit-transform"]="scale(0.8)",u.style["-webkit-transform-origin"]="0 0";var w={insideIframe:!1};m.addEventListener("mouseenter",function(){w.insideIframe=!0,w.scrollX=window.scrollX,w.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")}),m.addEventListener("mouseleave",function(){w.insideIframe=!1,t()||(document.body.style.overflow="auto")}),document.addEventListener("scroll",function(e){w.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var f=document.createElement("div");f.style.position="absolute",f.style.width="35px",f.style.height="35px",f.style.bottom="45px",f.style.left="50%",f.style.lineHeight="36px",f.style.background="transparent",f.style.borderColor="transparent";var x=document.createElement("div");x.innerHTML="&times;",x.style.position="relative",x.style.left="-50%",x.style.zIndex="999",x.style.width="40px",x.style.height="40px",x.style.background="rgba(0,0,0,0.2)",x.style.textAlign="center",x.style.border=0,x.style.borderRadius="35px",x.style.color="#fff",x.style.fontSize="30px",x.style.outline="none",x.style.cursor="pointer",f.appendChild(x),m.appendChild(f),m.appendChild(u),document.getElementsByTagName("body")[0].appendChild(g),document.getElementsByTagName("body")[0].appendChild(m),window.toggleOrderingWidget=i,g.onclick=i,f.onclick=i,l(),window.onresize=l,(t()&&y.openOnMobile&&!n()||!t()&&y.openOnDesktop)&&i(),setInterval(function(){n()&&window.innerHeight<m.clientHeight&&(u.style.height=.7*window.innerHeight+"px"),n()&&window.innerHeight==m.clientHeight&&(m.style.bottom=0,u.style.height="125%")},2e3)};</script>'
47
35
  const widgetInline = '<script type="text/javascript">var orderingInlineSettings = {baseUrl: "/"};</script><script type="text/javascript">window.onload=function(){var i={baseUrl:orderingInlineSettings&&orderingInlineSettings.baseUrl?orderingInlineSettings.baseUrl:"/inline/"},l=location.href.split(i.baseUrl)[0],e=location.href.split(i.baseUrl)[1],a="' + url + '",r=document.createElement("iframe");r.id="ordering_iframe",r.src=(a+"/"+e).replace(/([^:]\\/)\\/+/g,"$1"),r.style.border=0,r.style.height="100%",r.style.width="100%",r.style.maxWidth="none",r.allow="geolocation";var d=document.getElementById("ordering_iframe_inline");d.appendChild(r),r.addEventListener("load",function(){t(),setInterval(function(){var e=JSON.stringify({event:"body",data:{}});r.contentWindow.postMessage(e,a)},100)});function t(){var e=document.documentElement,t=window.innerwidth||e.clientWidth,n=window.innerHeight||e.clientHeight,o=(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),i=(window.pageYOffset||e.scrollTop)-(e.clientTop||0),l=JSON.stringify({event:"scroll",data:{top:i,left:o,width:t,height:n,offsetTop:s(r).top}});r.contentWindow.postMessage(l,a)}function s(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}window.addEventListener("message",function(e){var t=e.data;if("body"==t.event)d.style.height=t.data.height+"px";else if("scroll"==t.event)t.data.enable?document.getElementsByTagName("body")[0].style.overflowY="auto":document.getElementsByTagName("body")[0].style.overflowY="hidden";else if("url"==t.event){var n=document.createElement("a");n.href=t.data;var o=((l?l+"/":"")+i.baseUrl+"/"+n.pathname).replace(/([^:]\\/)\\/+/g,"$1");window.history.pushState("","",o),"http://localhost/"!=t.data&&window.scrollTo(0,s(r).top)}},!1),window.onscroll=function(e){t()}};</script><div style="height: 1000px;" id="ordering_iframe_inline"></div>'
48
36
 
49
- useEffect(() => {
50
- if (sitesListState?.loading) return
51
- if (sitesListState?.sites?.length > 0) {
52
- const _siteList = sitesListState.sites.map(site => {
53
- return {
54
- value: site?.id,
55
- content: site?.name,
56
- disabled: !site?.url
57
- }
58
- })
59
- setSiteList(_siteList)
60
- } else {
61
- setSiteList([])
62
- }
63
- }, [sitesListState])
64
-
65
37
  return (
66
38
  <>
67
39
  <Container>
68
- {sitesListState?.loading && (
69
- <>
70
- <Skeleton width={100} height={15} style={{ marginBottom: 10 }} />
71
- <Skeleton height={44} />
72
- </>
73
- )}
74
- {!sitesListState?.loading && siteList?.length > 0 && (
40
+ <PopupContainer>
41
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('POPUP', 'Popup')}</h2>
75
42
  <FormGroup>
76
- <label>{t('SELECT_SITE', 'Select site')}</label>
43
+ <label>{t('TYPE_MODAL', 'Modal style')}</label>
77
44
  <SelectWrapper>
78
45
  <Select
79
46
  isSecondIcon
80
47
  notAsync
81
- placeholder={t('SELECT_SITE', 'Select site')}
82
- defaultValue={siteId}
83
- options={siteList}
84
- onChange={val => setSiteId(val)}
48
+ placeholder={t('SELECT_TYPE', 'Select Type')}
49
+ defaultValue={selectedType}
50
+ options={modalTypes}
51
+ onChange={val => setSelectedType(val)}
85
52
  />
86
53
  </SelectWrapper>
87
54
  </FormGroup>
88
- )}
89
- {!sitesListState?.loading && siteList?.length === 0 && (
90
- <ConfigMessage>
91
- {t('FIRST_CONFIG_ORDERING_PRODUCTS', 'First Configure ordering products')}
92
- <span onClick={() => events.emit('go_to_page', { page: 'ordering_products', replace: true })}>{t('ORDERING_PRODUCTS', 'Ordering products')}</span>
93
- </ConfigMessage>
94
- )}
95
- {siteId && (
96
- <>
97
- <PopupContainer>
98
- <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('POPUP', 'Popup')}</h2>
99
- <FormGroup>
100
- <label>{t('TYPE_MODAL', 'Modal style')}</label>
101
- <SelectWrapper>
102
- <Select
103
- isSecondIcon
104
- notAsync
105
- placeholder={t('SELECT_TYPE', 'Select Type')}
106
- defaultValue={selectedType}
107
- options={modalTypes}
108
- onChange={val => setSelectedType(val)}
109
- />
110
- </SelectWrapper>
111
- </FormGroup>
112
- <FormGroup>
113
- <label>1* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
114
- <Input
115
- placeholder={t('CODE', 'Code')}
116
- defaultValue={`<button onclick="toggleOrderingWidget()">${t('Online_Ordering', 'Online Ordering')}</button>`}
117
- disabled
118
- />
119
- </FormGroup>
120
- <FormGroup>
121
- <label>2* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
122
- <Input
123
- placeholder={t('CODE', 'Code')}
124
- defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
125
- disabled
126
- />
127
- </FormGroup>
128
- <FormGroup>
129
- <label>3* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
130
- <TextArea
131
- placeholder={t('CODE', 'Code')}
132
- value={selectedType === 'modal' ? widgetPopup : widgetBot}
133
- disabled
134
- />
135
- </FormGroup>
136
- </PopupContainer>
137
- <InlineContainer>
138
- <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('INLINE', 'Inline')}</h2>
139
- <FormGroup>
140
- <label>1* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
141
- <Input
142
- placeholder={t('CODE', 'Code')}
143
- defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
144
- disabled
145
- />
146
- </FormGroup>
147
- <FormGroup>
148
- <label>2* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
149
- <TextArea
150
- placeholder={t('CODE', 'Code')}
151
- defaultValue={widgetInline}
152
- disabled
153
- />
154
- </FormGroup>
155
- <FormGroup>
156
- <label>3* .htaccess</label>
157
- <TextArea
158
- placeholder={t('CODE', 'Code')}
159
- defaultValue='RewriteEngine On
160
- RewriteRule ^inline/(.+)$ /inline/ [NC,L] #where inline is the folder'
161
- disabled
162
- />
163
- </FormGroup>
164
- </InlineContainer>
165
- <GuideLink>
166
- <Button
167
- outline
168
- color='primary'
169
- onClick={() => window.open('https://support.ordering.co/hc/en-us/articles/360043529971-Widget-Integration', '_blank')}
170
- >
171
- {t('LEARN_HOW_TO_DO_IT', 'Learn how to do it')}
172
- </Button>
173
- </GuideLink>
174
- </>
175
- )}
55
+ <FormGroup>
56
+ <label>1* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
57
+ <Input
58
+ placeholder={t('CODE', 'Code')}
59
+ defaultValue={`<button onclick="toggleOrderingWidget()">${t('Online_Ordering', 'Online Ordering')}</button>`}
60
+ disabled
61
+ />
62
+ </FormGroup>
63
+ <FormGroup>
64
+ <label>2* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
65
+ <Input
66
+ placeholder={t('CODE', 'Code')}
67
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
68
+ disabled
69
+ />
70
+ </FormGroup>
71
+ <FormGroup>
72
+ <label>3* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
73
+ <TextArea
74
+ placeholder={t('CODE', 'Code')}
75
+ value={selectedType === 'modal' ? widgetPopup : widgetBot}
76
+ disabled
77
+ />
78
+ </FormGroup>
79
+ </PopupContainer>
80
+ <InlineContainer>
81
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('INLINE', 'Inline')}</h2>
82
+ <FormGroup>
83
+ <label>1* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
84
+ <Input
85
+ placeholder={t('CODE', 'Code')}
86
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
87
+ disabled
88
+ />
89
+ </FormGroup>
90
+ <FormGroup>
91
+ <label>2* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
92
+ <TextArea
93
+ placeholder={t('CODE', 'Code')}
94
+ defaultValue={widgetInline}
95
+ disabled
96
+ />
97
+ </FormGroup>
98
+ <FormGroup>
99
+ <label>3* .htaccess</label>
100
+ <TextArea
101
+ placeholder={t('CODE', 'Code')}
102
+ defaultValue='RewriteEngine On
103
+ RewriteRule ^inline/(.+)$ /inline/ [NC,L] #where inline is the folder'
104
+ disabled
105
+ />
106
+ </FormGroup>
107
+ </InlineContainer>
108
+ <GuideLink>
109
+ <Button
110
+ outline
111
+ color='primary'
112
+ onClick={() => window.open('https://support.ordering.co/hc/en-us/articles/360043529971-Widget-Integration', '_blank')}
113
+ >
114
+ {t('LEARN_HOW_TO_DO_IT', 'Learn how to do it')}
115
+ </Button>
116
+ </GuideLink>
176
117
  </Container>
177
118
  <Alert
178
119
  title={t('WEB_APPNAME', 'Ordering')}
@@ -186,11 +127,3 @@ const BusinessWidgetsUI = (props) => {
186
127
  </>
187
128
  )
188
129
  }
189
-
190
- export const BusinessWidgets = (props) => {
191
- const businessWidgetsProps = {
192
- ...props,
193
- UIComponent: BusinessWidgetsUI
194
- }
195
- return <SitesList {...businessWidgetsProps} />
196
- }
@@ -51,13 +51,3 @@ export const GuideLink = styled.div`
51
51
  height: 44px;
52
52
  }
53
53
  `
54
-
55
- export const ConfigMessage = styled.div`
56
- font-size: 14px;
57
- span {
58
- color: ${props => props.theme.colors.primary};
59
- text-decoration: underline;
60
- cursor: pointer;
61
- display: block;
62
- }
63
- `