ordering-ui-admin-external 1.15.2 → 1.16.1

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 (35) hide show
  1. package/_bundles/{ordering-ui-admin.761f3d55438faf70811d.js → ordering-ui-admin.255bdf03e3a8ab56ad1c.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.761f3d55438faf70811d.js.LICENSE.txt → ordering-ui-admin.255bdf03e3a8ab56ad1c.js.LICENSE.txt} +8 -8
  3. package/_modules/components/Loyalty/RewardsPrograms/index.js +3 -6
  4. package/_modules/components/MyProducts/OrderingWidgets/index.js +77 -0
  5. package/_modules/components/MyProducts/OrderingWidgets/styles.js +29 -0
  6. package/_modules/components/MyProducts/index.js +8 -1
  7. package/_modules/components/Orders/GiftCardsListing/index.js +144 -0
  8. package/_modules/components/Orders/GiftCardsListing/styles.js +57 -0
  9. package/_modules/components/Orders/OrderBill/index.js +5 -3
  10. package/_modules/components/Orders/OrderDetails/index.js +11 -11
  11. package/_modules/components/Orders/index.js +7 -0
  12. package/_modules/components/Settings/SettingsList/index.js +2 -1
  13. package/_modules/components/SidebarMenu/index.js +5 -0
  14. package/_modules/components/Stores/PaymentOption/index.js +4 -4
  15. package/_modules/index.js +12 -0
  16. package/package.json +2 -2
  17. package/src/components/Loyalty/RewardsPrograms/index.js +1 -1
  18. package/src/components/MyProducts/OrderingWidgets/index.js +118 -0
  19. package/src/components/MyProducts/OrderingWidgets/styles.js +84 -0
  20. package/src/components/MyProducts/index.js +3 -1
  21. package/src/components/Orders/GiftCardsListing/index.js +178 -0
  22. package/src/components/Orders/GiftCardsListing/styles.js +116 -0
  23. package/src/components/Orders/OrderBill/index.js +5 -1
  24. package/src/components/Orders/OrderDetails/index.js +11 -11
  25. package/src/components/Orders/index.js +2 -0
  26. package/src/components/Settings/SettingsList/index.js +112 -108
  27. package/src/components/SidebarMenu/index.js +6 -0
  28. package/src/components/Stores/PaymentOption/index.js +1 -1
  29. package/src/index.js +5 -1
  30. package/template/app.js +8 -1
  31. package/template/components/ListenPageChanges/index.js +2 -0
  32. package/template/config.json +1 -1
  33. package/template/helmetdata.json +7 -0
  34. package/template/pages/GiftCardsList/index.js +12 -0
  35. package/template/pages/OrderingWidgets/index.js +12 -0
@@ -37,7 +37,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
37
37
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
38
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
39
  var PaymentOption = function PaymentOption(props) {
40
- var _sitesState$sites, _localState$sites, _businessPaymethod$pa2, _sitesState$sites4, _sitesState$sites5;
40
+ var _sitesState$sites, _localState$sites, _businessPaymethod$si, _businessPaymethod$pa2, _sitesState$sites4, _sitesState$sites5;
41
41
  var open = props.open,
42
42
  onClose = props.onClose,
43
43
  orderTypes = props.orderTypes,
@@ -80,7 +80,7 @@ var PaymentOption = function PaymentOption(props) {
80
80
  _useState8 = _slicedToArray(_useState7, 2),
81
81
  localState = _useState8[0],
82
82
  setLocalState = _useState8[1];
83
- var filteredOptions = (_localState$sites = localState === null || localState === void 0 ? void 0 : localState.sites) !== null && _localState$sites !== void 0 ? _localState$sites : businessPaymethod === null || businessPaymethod === void 0 ? void 0 : businessPaymethod.sites.filter(function (a) {
83
+ var filteredOptions = (_localState$sites = localState === null || localState === void 0 ? void 0 : localState.sites) !== null && _localState$sites !== void 0 ? _localState$sites : businessPaymethod === null || businessPaymethod === void 0 ? void 0 : (_businessPaymethod$si = businessPaymethod.sites) === null || _businessPaymethod$si === void 0 ? void 0 : _businessPaymethod$si.filter(function (a) {
84
84
  var _sitesState$sites2;
85
85
  return sitesState === null || sitesState === void 0 ? void 0 : (_sitesState$sites2 = sitesState.sites) === null || _sitesState$sites2 === void 0 ? void 0 : _sitesState$sites2.find(function (b) {
86
86
  return a.id === b.id;
@@ -212,7 +212,7 @@ var PaymentOption = function PaymentOption(props) {
212
212
  }, all ? /*#__PURE__*/_react.default.createElement(_RiCheckboxFill.default, {
213
213
  className: "fill"
214
214
  }) : /*#__PURE__*/_react.default.createElement(_RiCheckboxBlankLine.default, null), /*#__PURE__*/_react.default.createElement(_styles3.TabOptionName, null, t('ALL', 'All'))), !all && (sitesState === null || sitesState === void 0 ? void 0 : sitesState.sites.map(function (site) {
215
- var _ref2, _localState$sites2, _businessPaymethod$si;
215
+ var _ref2, _localState$sites2, _businessPaymethod$si2;
216
216
  return /*#__PURE__*/_react.default.createElement(_styles3.TabOption, {
217
217
  key: site.id,
218
218
  onClick: function onClick() {
@@ -221,7 +221,7 @@ var PaymentOption = function PaymentOption(props) {
221
221
  value: site.id
222
222
  });
223
223
  }
224
- }, (_ref2 = (_localState$sites2 = localState === null || localState === void 0 ? void 0 : localState.sites) !== null && _localState$sites2 !== void 0 ? _localState$sites2 : businessPaymethod === null || businessPaymethod === void 0 ? void 0 : (_businessPaymethod$si = businessPaymethod.sites) === null || _businessPaymethod$si === void 0 ? void 0 : _businessPaymethod$si.map(function (s) {
224
+ }, (_ref2 = (_localState$sites2 = localState === null || localState === void 0 ? void 0 : localState.sites) !== null && _localState$sites2 !== void 0 ? _localState$sites2 : businessPaymethod === null || businessPaymethod === void 0 ? void 0 : (_businessPaymethod$si2 = businessPaymethod.sites) === null || _businessPaymethod$si2 === void 0 ? void 0 : _businessPaymethod$si2.map(function (s) {
225
225
  return s.id;
226
226
  })) !== null && _ref2 !== void 0 && _ref2.includes(site.id) ? /*#__PURE__*/_react.default.createElement(_RiCheckboxFill.default, {
227
227
  className: "fill"
package/_modules/index.js CHANGED
@@ -1119,6 +1119,12 @@ Object.defineProperty(exports, "FreeProductsList", {
1119
1119
  return _Downloads.FreeProductsList;
1120
1120
  }
1121
1121
  });
1122
+ Object.defineProperty(exports, "GiftCardsListing", {
1123
+ enumerable: true,
1124
+ get: function get() {
1125
+ return _Orders.GiftCardsListing;
1126
+ }
1127
+ });
1122
1128
  Object.defineProperty(exports, "GoogleGpsButton", {
1123
1129
  enumerable: true,
1124
1130
  get: function get() {
@@ -1479,6 +1485,12 @@ Object.defineProperty(exports, "OrderingWebsite", {
1479
1485
  return _MyProducts.OrderingWebsite;
1480
1486
  }
1481
1487
  });
1488
+ Object.defineProperty(exports, "OrderingWidgets", {
1489
+ enumerable: true,
1490
+ get: function get() {
1491
+ return _MyProducts.OrderingWidgets;
1492
+ }
1493
+ });
1482
1494
  Object.defineProperty(exports, "OrdersCards", {
1483
1495
  enumerable: true,
1484
1496
  get: function get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.15.2",
3
+ "version": "1.16.1",
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.15.1",
86
+ "ordering-components-admin-external": "1.16.0",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -34,7 +34,7 @@ export const RewardsPrograms = () => {
34
34
  const walletList = [
35
35
  { key: 'credit_point', name: t('POINTS_WALLET', 'Points wallet'), description: t('POINTS_WALLET_DESCRIPTION', 'Points wallet general and per business setup.'), icon: <Cash /> },
36
36
  { key: 'levels', name: t('LEVELS', 'Levels'), description: t('LEVELS_DESCRIPTION', 'Setup different loyalty levels for your users.'), icon: <BarChartSteps /> },
37
- { key: 'gift_card', name: t('GIFT_CARD', 'Gift Card'), description: t('GIFT_CARD_DESCRIPTION', 'Setup different gift cards for your customers.'), icon: <Gift /> },
37
+ // { key: 'gift_card', name: t('GIFT_CARD', 'Gift Card'), description: t('GIFT_CARD_DESCRIPTION', 'Setup different gift cards for your customers.'), icon: <Gift /> },
38
38
  { key: 'cashback', name: t('CASH_WALLET', 'Cash wallet'), description: t('CASH_WALLET_DESCRIPTION', 'Cash wallet general and per business setup.'), icon: <Cash /> }
39
39
  ]
40
40
 
@@ -0,0 +1,118 @@
1
+ import React from 'react'
2
+ import { useLanguage, useApi } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { useInfoShare } from '../../../contexts/InfoShareContext'
5
+ import { IconButton, Input, TextArea } from '../../../styles'
6
+ import { List as MenuIcon } from 'react-bootstrap-icons'
7
+ import {
8
+ Container,
9
+ HeaderTitleContainer,
10
+ Content,
11
+ PopupContainer,
12
+ FormGroup,
13
+ InlineContainer
14
+ } from './styles'
15
+
16
+ export const OrderingWidgets = () => {
17
+ const [, t] = useLanguage()
18
+ const theme = useTheme()
19
+ const [ordering] = useApi()
20
+ const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
21
+
22
+ const url = `https://${ordering.project}.tryordering.com`
23
+ const color = theme.colors.primary
24
+ 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>'
25
+ 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>'
26
+ 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>'
27
+
28
+ return (
29
+ <Container>
30
+ <HeaderTitleContainer>
31
+ {isCollapse && (
32
+ <IconButton
33
+ color='black'
34
+ onClick={() => handleMenuCollapse(false)}
35
+ >
36
+ <MenuIcon />
37
+ </IconButton>
38
+ )}
39
+ <h1>{t('ORDERING_WIDGETS', 'Ordering Widgets')}</h1>
40
+ </HeaderTitleContainer>
41
+ <Content>
42
+ <PopupContainer>
43
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('POPUP', 'Popup')}</h2>
44
+ <h3>{t('BUTTON_WITH_MODAL_STYLE', 'Button with modal style')}</h3>
45
+ <FormGroup>
46
+ <label>1* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
47
+ <Input
48
+ placeholder={t('CODE', 'Code')}
49
+ defaultValue={`<button onclick="toggleOrderingWidget()">${t('Online_Ordering', 'Online Ordering')}</button>`}
50
+ disabled
51
+ />
52
+ </FormGroup>
53
+ <FormGroup>
54
+ <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>
55
+ <Input
56
+ placeholder={t('CODE', 'Code')}
57
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
58
+ disabled
59
+ />
60
+ </FormGroup>
61
+ <FormGroup>
62
+ <label>3* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
63
+ <TextArea
64
+ placeholder={t('CODE', 'Code')}
65
+ value={widgetPopup}
66
+ disabled
67
+ />
68
+ </FormGroup>
69
+ <h3>{t('CHAT_STYLE_INTEGRATION', 'Chat style integration')}</h3>
70
+ <FormGroup>
71
+ <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>
72
+ <Input
73
+ placeholder={t('CODE', 'Code')}
74
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
75
+ disabled
76
+ />
77
+ </FormGroup>
78
+ <FormGroup>
79
+ <label>2* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
80
+ <TextArea
81
+ placeholder={t('CODE', 'Code')}
82
+ value={widgetBot}
83
+ disabled
84
+ />
85
+ </FormGroup>
86
+ </PopupContainer>
87
+ <InlineContainer>
88
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('INLINE', 'Inline')}</h2>
89
+ <FormGroup>
90
+ <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>
91
+ <Input
92
+ placeholder={t('CODE', 'Code')}
93
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
94
+ disabled
95
+ />
96
+ </FormGroup>
97
+ <FormGroup>
98
+ <label>2* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
99
+ <TextArea
100
+ placeholder={t('CODE', 'Code')}
101
+ defaultValue={widgetInline}
102
+ disabled
103
+ />
104
+ </FormGroup>
105
+ <FormGroup>
106
+ <label>3* .htaccess</label>
107
+ <TextArea
108
+ placeholder={t('CODE', 'Code')}
109
+ defaultValue='RewriteEngine On
110
+ RewriteRule ^inline/(.+)$ /inline/ [NC,L] #where inline is the folder'
111
+ disabled
112
+ />
113
+ </FormGroup>
114
+ </InlineContainer>
115
+ </Content>
116
+ </Container>
117
+ )
118
+ }
@@ -0,0 +1,84 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ flex: 1;
5
+ padding: 25px 20px;
6
+ box-sizing: border-box;
7
+ transition: all 0.5s;
8
+ max-height: 100vh;
9
+ overflow: auto;
10
+ `
11
+
12
+ export const HeaderTitleContainer = styled.div`
13
+ display: flex;
14
+ align-items: center;
15
+ margin-bottom: 35px;
16
+
17
+ > h1 {
18
+ font-weight: 700;
19
+ font-size: 20px;
20
+ color: ${props => props.theme.colors.headingColor};
21
+ margin: 0px;
22
+ line-height: 32px;
23
+ }
24
+
25
+ > button {
26
+ ${props => props.theme?.rtl ? css`
27
+ margin-left: 8px;
28
+ margin-right: -8px;
29
+ ` : css`
30
+ margin-right: 8px;
31
+ margin-left: -8px;
32
+ `}
33
+
34
+ svg {
35
+ width: 25px;
36
+ height: 25px;
37
+ }
38
+ }
39
+ `
40
+
41
+ export const Content = styled.div``
42
+
43
+ export const FormGroup = styled.div`
44
+ margin-bottom: 30px;
45
+ label {
46
+ display: block;
47
+ font-weight: 400;
48
+ font-size: 14px;
49
+ line-height: 24px;
50
+ margin-bottom: 11px;
51
+ }
52
+ input, textarea {
53
+ width: 100%;
54
+ }
55
+ textarea {
56
+ height: 200px;
57
+ }
58
+ `
59
+
60
+ export const PopupContainer = styled.div`
61
+ h2 {
62
+ font-weight: 600;
63
+ font-size: 16px;
64
+ line-height: 24px;
65
+ margin-top: 0px;
66
+ margin-bottom: 20px;
67
+ }
68
+ h3 {
69
+ font-weight: 600;
70
+ font-size: 14px;
71
+ line-height: 21px;
72
+ margin-bottom: 25px;
73
+ }
74
+ `
75
+
76
+ export const InlineContainer = styled.div`
77
+ h2 {
78
+ font-weight: 600;
79
+ font-size: 16px;
80
+ line-height: 24px;
81
+ margin-top: 0px;
82
+ margin-bottom: 20px;
83
+ }
84
+ `
@@ -6,6 +6,7 @@ import { PosApp } from './PosApp'
6
6
  import { CallCenterApp } from './CallCenterApp'
7
7
  import { KioskApp } from './KioskApp'
8
8
  import { CustomProject } from './CustomProject'
9
+ import { OrderingWidgets } from './OrderingWidgets'
9
10
 
10
11
  export {
11
12
  OrderingWebsite,
@@ -15,5 +16,6 @@ export {
15
16
  PosApp,
16
17
  CallCenterApp,
17
18
  KioskApp,
18
- CustomProject
19
+ CustomProject,
20
+ OrderingWidgets
19
21
  }
@@ -0,0 +1,178 @@
1
+ import React from 'react'
2
+ import { useLanguage, GiftCardsList as GiftCardsListController } from 'ordering-components-admin-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { useInfoShare } from '../../../contexts/InfoShareContext'
5
+ import { List as MenuIcon } from 'react-bootstrap-icons'
6
+ import { IconButton } from '../../../styles'
7
+ import { Pagination, SearchBar } from '../../Shared'
8
+
9
+ import {
10
+ Container,
11
+ HeaderContainer,
12
+ HeaderTitle,
13
+ TabsWrapper,
14
+ Tab,
15
+ GiftCardsTableWrapper,
16
+ GiftCardRow,
17
+ UserInfoContainer,
18
+ PaginationWarpper,
19
+ ActionsWrapper
20
+ } from './styles'
21
+
22
+ const GiftCardsListingUI = (props) => {
23
+ const {
24
+ giftCards,
25
+ paginationProps,
26
+ activeStatus,
27
+ setActiveStatus,
28
+ getGiftCards,
29
+ searchValue,
30
+ onSearch
31
+ } = props
32
+
33
+ const [, t] = useLanguage()
34
+ const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
35
+
36
+ const handleChangePage = (page) => {
37
+ getGiftCards(page, paginationProps.pageSize)
38
+ }
39
+
40
+ const handleChangePageSize = (pageSize) => {
41
+ const expectedPage = Math.ceil(paginationProps.from / pageSize)
42
+ getGiftCards(expectedPage, pageSize)
43
+ }
44
+
45
+ return (
46
+ <Container>
47
+ <HeaderContainer>
48
+ <HeaderTitle>
49
+ {isCollapse && (
50
+ <IconButton
51
+ color='black'
52
+ onClick={() => handleMenuCollapse(false)}
53
+ >
54
+ <MenuIcon />
55
+ </IconButton>
56
+ )}
57
+ <h1>{t('GIFT_CARD_MANAGER', 'Gift card manager')}</h1>
58
+ </HeaderTitle>
59
+ <ActionsWrapper>
60
+ <SearchBar
61
+ isCustomLayout
62
+ lazyLoad
63
+ onSearch={onSearch}
64
+ search={searchValue}
65
+ placeholder={t('SEARCH', 'Search')}
66
+ />
67
+ </ActionsWrapper>
68
+ </HeaderContainer>
69
+ <TabsWrapper>
70
+ <Tab
71
+ active={activeStatus === 'pending'}
72
+ onClick={() => setActiveStatus('pending')}
73
+ >
74
+ {t('ORDER_PENDING', 'Pending')}
75
+ </Tab>
76
+ <Tab
77
+ active={activeStatus === 'activated'}
78
+ onClick={() => setActiveStatus('activated')}
79
+ >
80
+ {t('REDEEMED', 'Redeemed')}
81
+ </Tab>
82
+ </TabsWrapper>
83
+ <GiftCardsTableWrapper>
84
+ <table>
85
+ <thead>
86
+ <tr>
87
+ <th>{t('ID', 'ID')}</th>
88
+ <th>{t('PURCHASED_BY', 'Purchased by')}</th>
89
+ <th>{t('REDEEMED_BY', 'Redeemed by')}</th>
90
+ <th>{t('PURCHASED_DATE', 'Purchased date')}</th>
91
+ <th>{t('REDEEMED_DATE', 'Redeemed date')}</th>
92
+ </tr>
93
+ </thead>
94
+ {giftCards.loading ? (
95
+ [...Array(10).keys()].map(i => (
96
+ <GiftCardRow key={i}>
97
+ <tr>
98
+ <td><Skeleton width={20} /></td>
99
+ <td>
100
+ <UserInfoContainer>
101
+ <Skeleton width={38} height={38} />
102
+ <div>
103
+ <p className='name'><Skeleton width={100} /></p>
104
+ <p className='phone'><Skeleton width={80} /></p>
105
+ </div>
106
+ </UserInfoContainer>
107
+ </td>
108
+ <td>
109
+ <UserInfoContainer>
110
+ <Skeleton width={38} height={38} />
111
+ <div>
112
+ <p className='name'><Skeleton width={100} /></p>
113
+ <p className='phone'><Skeleton width={80} /></p>
114
+ </div>
115
+ </UserInfoContainer>
116
+ </td>
117
+ <td><Skeleton width={100} /></td>
118
+ <td><Skeleton width={100} /></td>
119
+ </tr>
120
+ </GiftCardRow>
121
+ ))
122
+ ) : (
123
+ giftCards.list.map(card => (
124
+ <GiftCardRow key={card.id}>
125
+ <tr>
126
+ <td>{card.id}</td>
127
+ <td>
128
+ <UserInfoContainer>
129
+ <img src={card.author?.photo} alt='' />
130
+ <div>
131
+ <p className='name'>{card.author?.name} {card.author?.lastname}</p>
132
+ <p className='phone'>{card.author?.cellphone}</p>
133
+ </div>
134
+ </UserInfoContainer>
135
+ </td>
136
+ <td>
137
+ {card.activater && (
138
+ <UserInfoContainer>
139
+ <img src={card.activater?.photo} alt='' />
140
+ <div>
141
+ <p className='name'>{card.activater?.name} {card.activater?.lastname}</p>
142
+ <p className='phone'>{card.activater?.cellphone}</p>
143
+ </div>
144
+ </UserInfoContainer>
145
+ )}
146
+ </td>
147
+ <td>{card.created_at}</td>
148
+ <td>{card.activated_at}</td>
149
+ </tr>
150
+ </GiftCardRow>
151
+ ))
152
+ )}
153
+ </table>
154
+ </GiftCardsTableWrapper>
155
+ <PaginationWarpper>
156
+ <Pagination
157
+ currentPage={paginationProps.currentPage}
158
+ totalPages={paginationProps.totalPages}
159
+ handleChangePage={handleChangePage}
160
+ defaultPageSize={paginationProps.pageSize}
161
+ handleChangePageSize={handleChangePageSize}
162
+ />
163
+ </PaginationWarpper>
164
+ </Container>
165
+ )
166
+ }
167
+
168
+ export const GiftCardsListing = (props) => {
169
+ const giftCardsProps = {
170
+ ...props,
171
+ UIComponent: GiftCardsListingUI,
172
+ isSearchById: true,
173
+ isSearchByAuthorName: true,
174
+ isSearchByAuthorEmail: true,
175
+ isSearchByAuthorPhone: true
176
+ }
177
+ return <GiftCardsListController {...giftCardsProps} />
178
+ }
@@ -0,0 +1,116 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ flex: 1;
5
+ padding: 20px;
6
+ box-sizing: border-box;
7
+ transition: all 0.5s;
8
+ overflow: hidden;
9
+ `
10
+ export const HeaderContainer = styled.div`
11
+ display: flex;
12
+ flex-direction: column;
13
+
14
+ @media (min-width: 768px) {
15
+ flex-direction: row;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ }
19
+ `
20
+ export const HeaderTitle = styled.div`
21
+ display: flex;
22
+ align-items: center;
23
+
24
+ h1 {
25
+ font-size: 20px;
26
+ font-weight: 700;
27
+ margin: 0;
28
+ }
29
+ `
30
+ export const ActionsWrapper = styled.div`
31
+ margin-top: 15px;
32
+ @media (min-width: 768px) {
33
+ margin-top: 0;
34
+ }
35
+ `
36
+ export const TabsWrapper = styled.div`
37
+ display: flex;
38
+ align-items: center;
39
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
40
+ margin: 20px 0 10px 0;
41
+ `
42
+ export const Tab = styled.div`
43
+ padding: 10px 0px;
44
+ cursor: pointer;
45
+ color: ${props => props.theme.colors?.headingColor};
46
+ white-space: nowrap;
47
+ font-size: 14px;
48
+
49
+ ${props => props.theme?.rtl ? css`
50
+ margin-left: 30px;
51
+ ` : css`
52
+ margin-right: 30px;
53
+ `}
54
+
55
+ ${({ active }) => active && css`
56
+ border-bottom: 2px solid;
57
+ font-weight: 500;
58
+ `}
59
+
60
+ ${({ active }) => !active && css`
61
+ color: ${props => props.theme.colors.lightGray};
62
+ `}
63
+ `
64
+ export const GiftCardsTableWrapper = styled.div`
65
+ table {
66
+ width: 100%;
67
+ border-collapse: collapse;
68
+ td, th {
69
+ padding: 10px 0;
70
+ font-size: 14px;
71
+ }
72
+ thead {
73
+ border-bottom: 1px solid ${props => props.theme.colors.disabled};
74
+ }
75
+ }
76
+ `
77
+ export const GiftCardRow = styled.tbody`
78
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
79
+ `
80
+ export const UserInfoContainer = styled.div`
81
+ display: flex;
82
+ align-items: center;
83
+
84
+ img {
85
+ width: 38px;
86
+ height: 38px;
87
+ border-radius: 8px;
88
+ object-fit: cover;
89
+ box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);
90
+ }
91
+
92
+ div {
93
+ ${props => props.theme?.rtl ? css`
94
+ margin-right: 9px;
95
+ ` : css`
96
+ margin-left: 9px;
97
+ `}
98
+ p.name {
99
+ margin: 0;
100
+ font-weight: 500;
101
+ font-size: 14px;
102
+ line-height: 21px;
103
+ }
104
+ p.phone {
105
+ margin: 0;
106
+ font-size: 10px;
107
+ line-height: 15px;
108
+ color: ${props => props.theme.colors.lightGray};
109
+ }
110
+ }
111
+ `
112
+ export const PaginationWarpper = styled.div`
113
+ display: flex;
114
+ justify-content: flex-end;
115
+ margin: 20px 0;
116
+ `
@@ -246,7 +246,11 @@ export const OrderBill = (props) => {
246
246
  ? walletName[event?.wallet_event?.wallet?.type]?.name
247
247
  : t(event?.paymethod?.name?.toUpperCase()?.replaceAll(' ', '_'), event?.paymethod?.name)}
248
248
  </td>
249
- <td>-{parsePrice(event?.amount, { currency: order?.currency })}</td>
249
+ <td>
250
+ {event?.paymethod?.gateway === 'cash' && order?.cash
251
+ ? parsePrice(order?.cash, { currency: order?.currency })
252
+ : `-${parsePrice(event?.amount, { currency: order?.currency })}`}
253
+ </td>
250
254
  </tr>
251
255
  ))}
252
256
  </tbody>