ordering-ui-admin-external 1.23.5 → 1.24.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.
- package/_bundles/{ordering-ui-admin.a1255b2c1a2d4b87080d.js → ordering-ui-admin.0c354f3e7da49f56465b.js} +2 -2
- package/_modules/components/CartRecovery/RecoveryActionAdd/index.js +325 -0
- package/_modules/components/CartRecovery/RecoveryGeneral/index.js +41 -17
- package/_modules/components/Delivery/DriversCompaniesList/styles.js +1 -1
- package/_modules/components/Delivery/DriversCompaniesListing/index.js +20 -2
- package/_modules/components/Delivery/DriversCompaniesListing/styles.js +2 -2
- package/_modules/components/Delivery/DriversCompanyAddForm/GeneralForm/index.js +122 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/GeneralForm/styles.js +21 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/ScheduleForm/index.js +27 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/ScheduleForm/styles.js +14 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/WebhooksForm/index.js +60 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/WebhooksForm/styles.js +16 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/index.js +114 -0
- package/_modules/components/Delivery/DriversCompanyAddForm/styles.js +18 -0
- package/_modules/components/MyProducts/AdvancedSettings/index.js +66 -82
- package/_modules/components/MyProducts/AdvancedSettings/styles.js +40 -44
- package/_modules/components/MyProducts/OrderingWebsite/SelectBusiness.js +59 -0
- package/_modules/components/MyProducts/OrderingWebsite/SelectFranchise.js +59 -0
- package/_modules/components/MyProducts/OrderingWebsite/index.js +21 -29
- package/_modules/components/MyProducts/OrderingWebsite/styles.js +1 -1
- package/_modules/components/MyProducts/UploadAudio/index.js +170 -0
- package/_modules/components/MyProducts/UploadAudio/styles.js +30 -0
- package/_modules/components/MyProducts/index.js +8 -1
- package/_modules/components/Orders/DeliveriesLocation/index.js +1 -0
- package/_modules/components/Orders/OrderBill/index.js +4 -3
- package/_modules/components/Orders/OrderContactInformation/index.js +14 -12
- package/_modules/components/Orders/OrderDetails/index.js +6 -131
- package/_modules/components/Orders/OrdersTable/index.js +2 -2
- package/_modules/components/Settings/NotificationSetting/index.js +1 -1
- package/_modules/components/Settings/SettingsList/index.js +1 -1
- package/_modules/components/Settings/SettingsList/styles.js +2 -2
- package/_modules/components/SidebarMenu/index.js +22 -22
- package/_modules/components/Stores/BusinessDetails/index.js +2 -1
- package/_modules/components/Stores/BusinessDeviceDetail/index.js +66 -16
- package/_modules/components/Stores/BusinessDeviceDetail/styles.js +7 -5
- package/_modules/components/Stores/BusinessSalesChannel/index.js +13 -4
- package/_modules/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
- package/_modules/components/Stores/BusinessSalesFacebook/index.js +2 -2
- package/_modules/components/Stores/BusinessSalesGoogle/index.js +2 -2
- package/_modules/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +3 -2
- package/_modules/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
- package/_modules/components/Stores/BusinessSalesInstagram/index.js +3 -5
- package/_modules/components/Users/CustomersListing/index.js +5 -3
- package/_modules/utils/index.js +203 -2
- package/index-template.js +1 -1
- package/index.html +1 -0
- package/package.json +2 -2
- package/public/push/onesignal/OneSignalSDKUpdaterWorker.js +1 -0
- package/public/push/onesignal/OneSignalSDKWorker.js +1 -0
- package/src/components/CartRecovery/RecoveryActionAdd/index.js +355 -0
- package/src/components/CartRecovery/RecoveryGeneral/index.js +23 -4
- package/src/components/Delivery/DriversCompaniesList/styles.js +1 -1
- package/src/components/Delivery/DriversCompaniesListing/index.js +29 -12
- package/src/components/Delivery/DriversCompaniesListing/styles.js +1 -1
- package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/index.js +120 -0
- package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/styles.js +32 -0
- package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/index.js +29 -0
- package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/styles.js +11 -0
- package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/index.js +69 -0
- package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/styles.js +24 -0
- package/src/components/Delivery/DriversCompanyAddForm/index.js +121 -0
- package/src/components/Delivery/DriversCompanyAddForm/styles.js +39 -0
- package/src/components/MyProducts/AdvancedSettings/index.js +35 -36
- package/src/components/MyProducts/AdvancedSettings/styles.js +3 -11
- package/src/components/MyProducts/OrderingWebsite/SelectBusiness.js +47 -0
- package/src/components/MyProducts/OrderingWebsite/SelectFranchise.js +47 -0
- package/src/components/MyProducts/OrderingWebsite/index.js +20 -30
- package/src/components/MyProducts/OrderingWebsite/styles.js +0 -4
- package/src/components/MyProducts/UploadAudio/index.js +168 -0
- package/src/components/MyProducts/UploadAudio/styles.js +120 -0
- package/src/components/MyProducts/index.js +3 -1
- package/src/components/Orders/DeliveriesLocation/index.js +1 -0
- package/src/components/Orders/OrderBill/index.js +9 -6
- package/src/components/Orders/OrderContactInformation/index.js +5 -1
- package/src/components/Orders/OrderDetails/index.js +7 -35
- package/src/components/Orders/OrdersTable/index.js +3 -1
- package/src/components/Settings/NotificationSetting/index.js +2 -0
- package/src/components/Settings/SettingsList/index.js +53 -53
- package/src/components/Settings/SettingsList/styles.js +2 -1
- package/src/components/Settings/SettingsSelectUI/index.js +1 -1
- package/src/components/SidebarMenu/index.js +1 -0
- package/src/components/Stores/BusinessDetails/index.js +1 -0
- package/src/components/Stores/BusinessDeviceDetail/index.js +46 -7
- package/src/components/Stores/BusinessDeviceDetail/styles.js +11 -0
- package/src/components/Stores/BusinessSalesChannel/index.js +12 -6
- package/src/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
- package/src/components/Stores/BusinessSalesFacebook/index.js +3 -3
- package/src/components/Stores/BusinessSalesGoogle/index.js +3 -3
- package/src/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +2 -2
- package/src/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
- package/src/components/Stores/BusinessSalesInstagram/index.js +3 -3
- package/src/components/Users/CustomersListing/index.js +2 -3
- package/src/utils/index.js +53 -0
- package/template/app.js +76 -3
- package/template/config.json +1 -0
- /package/_bundles/{ordering-ui-admin.a1255b2c1a2d4b87080d.js.LICENSE.txt → ordering-ui-admin.0c354f3e7da49f56465b.js.LICENSE.txt} +0 -0
package/_modules/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.widgetURL = exports.verifyDecimals = exports.stringToSlug = exports.sortInputFields = exports.shape = exports.setStorageItem = exports.scrollTo = exports.ribbonValues = exports.reviewCommentList = exports.removeStorageItem = exports.orderRejectCommentList = exports.optimizeImage = exports.getUniqueId = exports.getStorageItem = exports.getStarWidth = exports.getSeconds = exports.getMinutes = exports.getIconCard = exports.getHours = exports.getCurrentDiffDays = exports.getAgoMinutes = exports.formatUrlVideo = exports.formatSeconds = exports.firstLetterCapital = exports.findExitingCode = exports.fieldsToSort = exports.convertHoursToMinutes = exports.convertHMS = exports.checkValidUrlFormat = exports.checkSiteUrl = exports.checkPreSiteUrl = exports.capitalize = exports.bytesConverter = exports.DriverTipsOptions = void 0;
|
|
6
|
+
exports.widgetURL = exports.verifyDecimals = exports.stringToSlug = exports.sortInputFields = exports.shape = exports.setStorageItem = exports.scrollTo = exports.ribbonValues = exports.reviewCommentList = exports.removeStorageItem = exports.orderRejectCommentList = exports.optimizeImage = exports.getUniqueId = exports.getStorageItem = exports.getStarWidth = exports.getSeconds = exports.getOrderStatus = exports.getOrderStatuPickUp = exports.getMinutes = exports.getIconCard = exports.getHours = exports.getCurrentDiffDays = exports.getAgoMinutes = exports.formatUrlVideo = exports.formatSeconds = exports.firstLetterCapital = exports.findExitingCode = exports.fieldsToSort = exports.convertHoursToMinutes = exports.convertHMS = exports.checkValidUrlFormat = exports.checkSiteUrl = exports.checkPreSiteUrl = exports.capitalize = exports.bytesConverter = exports.DriverTipsOptions = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _FaCcMastercard = _interopRequireDefault(require("@meronex/icons/fa/FaCcMastercard"));
|
|
9
9
|
var _FaCcVisa = _interopRequireDefault(require("@meronex/icons/fa/FaCcVisa"));
|
|
@@ -545,13 +545,214 @@ var reviewCommentList = function reviewCommentList(type) {
|
|
|
545
545
|
};
|
|
546
546
|
return reviews[type];
|
|
547
547
|
};
|
|
548
|
+
exports.reviewCommentList = reviewCommentList;
|
|
549
|
+
var getOrderStatus = function getOrderStatus(status) {
|
|
550
|
+
var orderStatus = [{
|
|
551
|
+
key: 0,
|
|
552
|
+
value: 'Pending Order',
|
|
553
|
+
slug: 'PENDING_ORDER',
|
|
554
|
+
percentage: 10
|
|
555
|
+
}, {
|
|
556
|
+
key: 1,
|
|
557
|
+
value: 'Completed by admin',
|
|
558
|
+
slug: 'COMPLETED_BY_ADMIN',
|
|
559
|
+
percentage: 100
|
|
560
|
+
}, {
|
|
561
|
+
key: 2,
|
|
562
|
+
value: 'Reject by admin',
|
|
563
|
+
slug: 'REJECT_BY_ADMIN',
|
|
564
|
+
percentage: 0
|
|
565
|
+
}, {
|
|
566
|
+
key: 3,
|
|
567
|
+
value: 'Driver arrived by business',
|
|
568
|
+
slug: 'DRIVER_IN_BUSINESS',
|
|
569
|
+
percentage: 60
|
|
570
|
+
}, {
|
|
571
|
+
key: 4,
|
|
572
|
+
value: 'Preparation Completed',
|
|
573
|
+
slug: 'PREPARATION_COMPLETED',
|
|
574
|
+
percentage: 20
|
|
575
|
+
}, {
|
|
576
|
+
key: 5,
|
|
577
|
+
value: 'Reject by business',
|
|
578
|
+
slug: 'REJECT_BY_BUSINESS',
|
|
579
|
+
percentage: 0
|
|
580
|
+
}, {
|
|
581
|
+
key: 6,
|
|
582
|
+
value: 'Reject by driver',
|
|
583
|
+
slug: 'REJECT_BY_DRIVER',
|
|
584
|
+
percentage: 0
|
|
585
|
+
}, {
|
|
586
|
+
key: 7,
|
|
587
|
+
value: 'Accepted by business',
|
|
588
|
+
slug: 'ACCEPTED_BY_BUSINESS',
|
|
589
|
+
percentage: 15
|
|
590
|
+
}, {
|
|
591
|
+
key: 8,
|
|
592
|
+
value: 'Accepted by driver',
|
|
593
|
+
slug: 'ACCEPTED_BY_DRIVER',
|
|
594
|
+
percentage: 40
|
|
595
|
+
}, {
|
|
596
|
+
key: 9,
|
|
597
|
+
value: 'Pick up completed by driver',
|
|
598
|
+
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
599
|
+
percentage: 70
|
|
600
|
+
}, {
|
|
601
|
+
key: 10,
|
|
602
|
+
value: 'Pick up Failed by driver',
|
|
603
|
+
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
604
|
+
percentage: 0
|
|
605
|
+
}, {
|
|
606
|
+
key: 11,
|
|
607
|
+
value: 'Delivery completed by driver',
|
|
608
|
+
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
609
|
+
percentage: 100
|
|
610
|
+
}, {
|
|
611
|
+
key: 12,
|
|
612
|
+
value: 'Delivery Failed by driver',
|
|
613
|
+
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
614
|
+
percentage: 0
|
|
615
|
+
}, {
|
|
616
|
+
key: 13,
|
|
617
|
+
value: 'Preorder',
|
|
618
|
+
slug: 'PREORDER',
|
|
619
|
+
percentage: 0
|
|
620
|
+
}, {
|
|
621
|
+
key: 14,
|
|
622
|
+
value: 'Order not ready',
|
|
623
|
+
slug: 'ORDER_NOT_READY',
|
|
624
|
+
percentage: 15
|
|
625
|
+
}, {
|
|
626
|
+
key: 15,
|
|
627
|
+
value: 'Pickup completed by customer',
|
|
628
|
+
slug: 'PICKUP_COMPLETED_BY_CUSTOMER',
|
|
629
|
+
percentage: 100
|
|
630
|
+
}, {
|
|
631
|
+
key: 16,
|
|
632
|
+
value: 'Canceled by customer',
|
|
633
|
+
slug: 'CANCELED_BY_CUSTOMER',
|
|
634
|
+
percentage: 0
|
|
635
|
+
}, {
|
|
636
|
+
key: 17,
|
|
637
|
+
value: 'Not picked by customer',
|
|
638
|
+
slug: 'NOT_PICKED_BY_CUSTOMER',
|
|
639
|
+
percentage: 0
|
|
640
|
+
}, {
|
|
641
|
+
key: 18,
|
|
642
|
+
value: 'Driver almost arrived to business',
|
|
643
|
+
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
644
|
+
percentage: 50
|
|
645
|
+
}, {
|
|
646
|
+
key: 19,
|
|
647
|
+
value: 'Driver almost arrived to customer',
|
|
648
|
+
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
649
|
+
percentage: 90
|
|
650
|
+
}, {
|
|
651
|
+
key: 20,
|
|
652
|
+
value: 'Customer almost arrived to business',
|
|
653
|
+
slug: 'CUSTOMER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
654
|
+
percentage: 90
|
|
655
|
+
}, {
|
|
656
|
+
key: 21,
|
|
657
|
+
value: 'Customer arrived to business',
|
|
658
|
+
slug: 'CUSTOMER_ARRIVED_TO_BUSINESS',
|
|
659
|
+
percentage: 90
|
|
660
|
+
}, {
|
|
661
|
+
key: 22,
|
|
662
|
+
value: 'Looking for driver',
|
|
663
|
+
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
664
|
+
percentage: 30
|
|
665
|
+
}, {
|
|
666
|
+
key: 23,
|
|
667
|
+
value: 'Driver on way',
|
|
668
|
+
slug: 'ORDER_DRIVER_ON_WAY',
|
|
669
|
+
percentage: 80
|
|
670
|
+
}];
|
|
671
|
+
var objectStatus = orderStatus.find(function (o) {
|
|
672
|
+
return o.key === status;
|
|
673
|
+
});
|
|
674
|
+
return objectStatus && objectStatus;
|
|
675
|
+
};
|
|
676
|
+
exports.getOrderStatus = getOrderStatus;
|
|
677
|
+
var getOrderStatuPickUp = function getOrderStatuPickUp(status) {
|
|
678
|
+
var orderStatus = [{
|
|
679
|
+
key: 0,
|
|
680
|
+
value: 'Pending Order',
|
|
681
|
+
slug: 'PENDING_ORDER',
|
|
682
|
+
percentage: 10
|
|
683
|
+
}, {
|
|
684
|
+
key: 1,
|
|
685
|
+
value: 'Completed by admin',
|
|
686
|
+
slug: 'COMPLETED_BY_ADMIN',
|
|
687
|
+
percentage: 100
|
|
688
|
+
}, {
|
|
689
|
+
key: 2,
|
|
690
|
+
value: 'Reject by admin',
|
|
691
|
+
slug: 'REJECT_BY_ADMIN',
|
|
692
|
+
percentage: 0
|
|
693
|
+
}, {
|
|
694
|
+
key: 4,
|
|
695
|
+
value: 'Preparation Completed',
|
|
696
|
+
slug: 'PREPARATION_COMPLETED',
|
|
697
|
+
percentage: 50
|
|
698
|
+
}, {
|
|
699
|
+
key: 5,
|
|
700
|
+
value: 'Reject by business',
|
|
701
|
+
slug: 'REJECT_BY_BUSINESS',
|
|
702
|
+
percentage: 0
|
|
703
|
+
}, {
|
|
704
|
+
key: 7,
|
|
705
|
+
value: 'Accepted by business',
|
|
706
|
+
slug: 'ACCEPTED_BY_BUSINESS',
|
|
707
|
+
percentage: 30
|
|
708
|
+
}, {
|
|
709
|
+
key: 13,
|
|
710
|
+
value: 'Preorder',
|
|
711
|
+
slug: 'PREORDER',
|
|
712
|
+
percentage: 0
|
|
713
|
+
}, {
|
|
714
|
+
key: 14,
|
|
715
|
+
value: 'Order not ready',
|
|
716
|
+
slug: 'ORDER_NOT_READY',
|
|
717
|
+
percentage: 30
|
|
718
|
+
}, {
|
|
719
|
+
key: 15,
|
|
720
|
+
value: 'Pickup completed by customer',
|
|
721
|
+
slug: 'PICKUP_COMPLETED_BY_CUSTOMER',
|
|
722
|
+
percentage: 100
|
|
723
|
+
}, {
|
|
724
|
+
key: 16,
|
|
725
|
+
value: 'Canceled by customer',
|
|
726
|
+
slug: 'CANCELED_BY_CUSTOMER',
|
|
727
|
+
percentage: 0
|
|
728
|
+
}, {
|
|
729
|
+
key: 17,
|
|
730
|
+
value: 'Not picked by customer',
|
|
731
|
+
slug: 'NOT_PICKED_BY_CUSTOMER',
|
|
732
|
+
percentage: 0
|
|
733
|
+
}, {
|
|
734
|
+
key: 20,
|
|
735
|
+
value: 'Customer almost arrived to business',
|
|
736
|
+
slug: 'CUSTOMER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
737
|
+
percentage: 70
|
|
738
|
+
}, {
|
|
739
|
+
key: 21,
|
|
740
|
+
value: 'Customer arrived to business',
|
|
741
|
+
slug: 'CUSTOMER_ARRIVED_TO_BUSINESS',
|
|
742
|
+
percentage: 90
|
|
743
|
+
}];
|
|
744
|
+
var objectStatus = orderStatus.find(function (o) {
|
|
745
|
+
return o.key === status;
|
|
746
|
+
});
|
|
747
|
+
return objectStatus && objectStatus;
|
|
748
|
+
};
|
|
548
749
|
|
|
549
750
|
/**
|
|
550
751
|
* function to manage order reject comment list
|
|
551
752
|
* @param {string} param0 type of orders to return
|
|
552
753
|
* @returns object with orders dictionary
|
|
553
754
|
*/
|
|
554
|
-
exports.
|
|
755
|
+
exports.getOrderStatuPickUp = getOrderStatuPickUp;
|
|
555
756
|
var orderRejectCommentList = function orderRejectCommentList(status) {
|
|
556
757
|
var messages = {
|
|
557
758
|
6: [
|
package/index-template.js
CHANGED
|
@@ -292,7 +292,7 @@ if (!(window?.location?.hostname === 'localhost')) {
|
|
|
292
292
|
integrations: [
|
|
293
293
|
new Integrations.BrowserTracing()
|
|
294
294
|
],
|
|
295
|
-
release: 'ordering-ui-admin-release@' + process.env.npm_package_version,
|
|
295
|
+
release: process.env.npm_package_version ? 'ordering-ui-admin-release@' + process.env.npm_package_version : 'ordering-ui-admin-release@' + '1.0.0',
|
|
296
296
|
// Release health
|
|
297
297
|
autoSessionTracking: true,
|
|
298
298
|
ignoreErrors: [
|
package/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-admin-external",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.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.
|
|
86
|
+
"ordering-components-admin-external": "1.24.0",
|
|
87
87
|
"polished": "^3.6.7",
|
|
88
88
|
"prop-types": "^15.7.2",
|
|
89
89
|
"react-big-calendar": "^1.4.2",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
RecoveryActionDetail as RecoveryActionDetailController
|
|
5
|
+
} from 'ordering-components-admin-external'
|
|
6
|
+
import { useForm } from 'react-hook-form'
|
|
7
|
+
import {
|
|
8
|
+
Circle as UnCheckIcon,
|
|
9
|
+
RecordCircleFill as CheckIcon
|
|
10
|
+
} from 'react-bootstrap-icons'
|
|
11
|
+
import NumericInput from 'react-numeric-input'
|
|
12
|
+
import { Button, Input, TextArea } from '../../../styles'
|
|
13
|
+
import { Alert, HtmlEditor } from '../../Shared'
|
|
14
|
+
import { Select } from '../../../styles/Select'
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
RecoveryActionAddContainer,
|
|
18
|
+
CardContainer,
|
|
19
|
+
ButtonsContainer,
|
|
20
|
+
InputWrapper,
|
|
21
|
+
LastTimeWrapper,
|
|
22
|
+
TypeWrapper,
|
|
23
|
+
ParentCheckBoxWrapper,
|
|
24
|
+
TimeBlock,
|
|
25
|
+
TimeContent,
|
|
26
|
+
DaysContent,
|
|
27
|
+
Option
|
|
28
|
+
} from './styles'
|
|
29
|
+
|
|
30
|
+
export const RecoveryActionAddUI = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
onClose,
|
|
33
|
+
formState,
|
|
34
|
+
handleAddRecoveryAction,
|
|
35
|
+
handleChangeInput,
|
|
36
|
+
handleChangeItem,
|
|
37
|
+
actionState
|
|
38
|
+
} = props
|
|
39
|
+
|
|
40
|
+
const [, t] = useLanguage()
|
|
41
|
+
const { register, handleSubmit, errors } = useForm()
|
|
42
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
43
|
+
|
|
44
|
+
const [hours, setHours] = useState([])
|
|
45
|
+
const [minutes, setMinutes] = useState([])
|
|
46
|
+
const [seconds, setSeconds] = useState([])
|
|
47
|
+
const [curPreorderTime, setCurPreorderTime] = useState({ hour: '0', minute: '0', second: '0' })
|
|
48
|
+
const [curDayTime, setCurDayTime] = useState(0)
|
|
49
|
+
const [isTime, setIsTime] = useState(true)
|
|
50
|
+
|
|
51
|
+
const channelList = [
|
|
52
|
+
{ value: 'email', content: <Option>{t('EMAIL', 'Email')}</Option> },
|
|
53
|
+
{ value: 'sms', content: <Option>{t('SMS', 'SMS')}</Option> },
|
|
54
|
+
{ value: 'notification', content: <Option>{t('PUSH_NOTIFICATION', 'Push notification')}</Option> }
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const setTimeList = () => {
|
|
58
|
+
const _hours = []
|
|
59
|
+
const _minutes = []
|
|
60
|
+
const _seconds = []
|
|
61
|
+
for (let i = 0; i < 24; i++) {
|
|
62
|
+
const text = (i < 10 ? '0' : ' ') + i
|
|
63
|
+
_hours.push({
|
|
64
|
+
text: text,
|
|
65
|
+
hour: i
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < 60; i++) {
|
|
69
|
+
const text = (i < 10 ? '0' : '') + i
|
|
70
|
+
_minutes.push({
|
|
71
|
+
text: text,
|
|
72
|
+
minute: i
|
|
73
|
+
})
|
|
74
|
+
_seconds.push({
|
|
75
|
+
text: text,
|
|
76
|
+
second: i
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
setHours(_hours)
|
|
80
|
+
setMinutes(_minutes)
|
|
81
|
+
setSeconds(_seconds)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleChangePreorderTime = (evt) => {
|
|
85
|
+
const type = evt.target.name
|
|
86
|
+
const value = evt.target.value
|
|
87
|
+
setCurPreorderTime({
|
|
88
|
+
...curPreorderTime,
|
|
89
|
+
[type]: value
|
|
90
|
+
})
|
|
91
|
+
let preorderTime = 0
|
|
92
|
+
if (type === 'hour') preorderTime = parseInt(value) * 3600 + parseInt(curPreorderTime?.minute) * 60 + parseInt(curPreorderTime?.second)
|
|
93
|
+
else if (type === 'minute') preorderTime = parseInt(curPreorderTime?.hour) * 3600 + parseInt(value) * 60 + parseInt(curPreorderTime?.second)
|
|
94
|
+
else preorderTime = parseInt(curPreorderTime?.hour) * 3600 + parseInt(curPreorderTime?.minute) * 60 + parseInt(value)
|
|
95
|
+
handleChangeItem({ times: [preorderTime], launch_type: 'times' })
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const handleChangeDay = (value) => {
|
|
99
|
+
setCurDayTime(value)
|
|
100
|
+
handleChangeItem({ times: [value * 24 * 3600], launch_type: 'times' })
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const onSubmit = () => {
|
|
104
|
+
if (!formState.changes?.times?.[0]) {
|
|
105
|
+
setAlertState({
|
|
106
|
+
open: true,
|
|
107
|
+
content: [t(
|
|
108
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
109
|
+
'Name is required'
|
|
110
|
+
).replace('_attribute_', t('TIME', 'Time'))]
|
|
111
|
+
})
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
if (!formState.changes?.channel) {
|
|
115
|
+
setAlertState({
|
|
116
|
+
open: true,
|
|
117
|
+
content: [t(
|
|
118
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
119
|
+
'Name is required'
|
|
120
|
+
).replace('_attribute_', t('CHANNEL', 'Channel'))]
|
|
121
|
+
})
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
if (!formState.changes?.body) {
|
|
125
|
+
setAlertState({
|
|
126
|
+
open: true,
|
|
127
|
+
content: [t(
|
|
128
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
129
|
+
'Name is required'
|
|
130
|
+
).replace('_attribute_', t('MESSAGE', 'Message'))]
|
|
131
|
+
})
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
handleAddRecoveryAction()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const handleSwitchTime = () => {
|
|
138
|
+
setIsTime(prev => !prev)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
setTimeList()
|
|
143
|
+
}, [])
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (!actionState?.error || actionState.loading) return
|
|
147
|
+
setAlertState({
|
|
148
|
+
open: true,
|
|
149
|
+
content: actionState?.error
|
|
150
|
+
})
|
|
151
|
+
}, [actionState])
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (Object.keys(errors).length > 0) {
|
|
155
|
+
setAlertState({
|
|
156
|
+
open: true,
|
|
157
|
+
content: Object.values(errors).map(error => error.message)
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
}, [errors])
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<RecoveryActionAddContainer onSubmit={handleSubmit(onSubmit)}>
|
|
165
|
+
<CardContainer>
|
|
166
|
+
<h2>{t('GENERAL', 'General')}</h2>
|
|
167
|
+
<InputWrapper>
|
|
168
|
+
<label>{t('NAME', 'Name')}</label>
|
|
169
|
+
<Input
|
|
170
|
+
name='name'
|
|
171
|
+
type='text'
|
|
172
|
+
placeholder={t('NAME', 'name')}
|
|
173
|
+
value={formState?.changes?.name ?? ''}
|
|
174
|
+
ref={register({
|
|
175
|
+
required: t(
|
|
176
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
177
|
+
'Name is required'
|
|
178
|
+
).replace('_attribute_', t('NAME', 'Name'))
|
|
179
|
+
})}
|
|
180
|
+
onChange={handleChangeInput}
|
|
181
|
+
disabled={formState.loading}
|
|
182
|
+
autoComplete='off'
|
|
183
|
+
/>
|
|
184
|
+
</InputWrapper>
|
|
185
|
+
<InputWrapper>
|
|
186
|
+
<label>{t('DESCRIPTION', 'Description')}</label>
|
|
187
|
+
<TextArea
|
|
188
|
+
placeholder={t('WRITE_LITTLE_DESCRIPTION', 'Write a little description')}
|
|
189
|
+
name='description'
|
|
190
|
+
rows={3}
|
|
191
|
+
value={
|
|
192
|
+
formState?.changes?.description ?? ''
|
|
193
|
+
}
|
|
194
|
+
onChange={handleChangeInput}
|
|
195
|
+
disabled={formState.loading}
|
|
196
|
+
autoComplete='off'
|
|
197
|
+
/>
|
|
198
|
+
</InputWrapper>
|
|
199
|
+
<LastTimeWrapper>
|
|
200
|
+
<h3>{t('LAST_TIME_CART_WAS_OPENED', 'Last time the cart was opened')}</h3>
|
|
201
|
+
<TypeWrapper>
|
|
202
|
+
<ParentCheckBoxWrapper>
|
|
203
|
+
<div onClick={() => handleSwitchTime()}>
|
|
204
|
+
{isTime ? <CheckIcon className='checked-icon' /> : <UnCheckIcon />}
|
|
205
|
+
<span>{t('TIME', 'Time')}</span>
|
|
206
|
+
</div>
|
|
207
|
+
</ParentCheckBoxWrapper>
|
|
208
|
+
{isTime && (
|
|
209
|
+
<TimeContent>
|
|
210
|
+
<TimeBlock>
|
|
211
|
+
<select
|
|
212
|
+
value={curPreorderTime?.hour}
|
|
213
|
+
name='hour'
|
|
214
|
+
onChange={handleChangePreorderTime}
|
|
215
|
+
>
|
|
216
|
+
{
|
|
217
|
+
hours?.map((hour, i) => (
|
|
218
|
+
<option value={hour.hour} key={i}>{hour.text}</option>
|
|
219
|
+
))
|
|
220
|
+
}
|
|
221
|
+
</select>
|
|
222
|
+
<span>:</span>
|
|
223
|
+
<select
|
|
224
|
+
value={curPreorderTime?.minute}
|
|
225
|
+
name='minute'
|
|
226
|
+
onChange={handleChangePreorderTime}
|
|
227
|
+
>
|
|
228
|
+
{minutes?.map((minute, i) => (
|
|
229
|
+
<option value={minute.minute} key={i}>{minute.text}</option>
|
|
230
|
+
))}
|
|
231
|
+
</select>
|
|
232
|
+
<span>:</span>
|
|
233
|
+
<select
|
|
234
|
+
value={curPreorderTime?.second}
|
|
235
|
+
name='second'
|
|
236
|
+
onChange={handleChangePreorderTime}
|
|
237
|
+
>
|
|
238
|
+
{seconds?.map((second, i) => (
|
|
239
|
+
<option value={second.second} key={i}>{second.text}</option>
|
|
240
|
+
))}
|
|
241
|
+
</select>
|
|
242
|
+
</TimeBlock>
|
|
243
|
+
</TimeContent>
|
|
244
|
+
)}
|
|
245
|
+
</TypeWrapper>
|
|
246
|
+
<TypeWrapper>
|
|
247
|
+
<ParentCheckBoxWrapper>
|
|
248
|
+
<div onClick={() => handleSwitchTime()}>
|
|
249
|
+
{!isTime ? <CheckIcon className='checked-icon' /> : <UnCheckIcon />}
|
|
250
|
+
<span>{t('DAYS', 'Days')}</span>
|
|
251
|
+
</div>
|
|
252
|
+
</ParentCheckBoxWrapper>
|
|
253
|
+
{!isTime && (
|
|
254
|
+
<DaysContent>
|
|
255
|
+
<NumericInput
|
|
256
|
+
placeholder='00'
|
|
257
|
+
onKeyPress={(e) => {
|
|
258
|
+
if (!/^[0-9]$/.test(e.key)) {
|
|
259
|
+
e.preventDefault()
|
|
260
|
+
}
|
|
261
|
+
}}
|
|
262
|
+
value={curDayTime || ''}
|
|
263
|
+
onChange={(value) => handleChangeDay(value)}
|
|
264
|
+
min={0}
|
|
265
|
+
/>
|
|
266
|
+
</DaysContent>
|
|
267
|
+
)}
|
|
268
|
+
</TypeWrapper>
|
|
269
|
+
</LastTimeWrapper>
|
|
270
|
+
</CardContainer>
|
|
271
|
+
<CardContainer>
|
|
272
|
+
<h2>{t('NOTIFICATIONS', 'Notifications')}</h2>
|
|
273
|
+
<InputWrapper>
|
|
274
|
+
<label>{t('TITLE', 'Title')}</label>
|
|
275
|
+
<Input
|
|
276
|
+
name='title'
|
|
277
|
+
placeholder={t('TITLE', 'Title')}
|
|
278
|
+
defaultValue={formState?.changes?.title ?? ''}
|
|
279
|
+
onChange={handleChangeInput}
|
|
280
|
+
ref={register({
|
|
281
|
+
required: t(
|
|
282
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
283
|
+
'Name is required'
|
|
284
|
+
).replace('_attribute_', t('TITLE', 'Title'))
|
|
285
|
+
})}
|
|
286
|
+
/>
|
|
287
|
+
</InputWrapper>
|
|
288
|
+
<InputWrapper>
|
|
289
|
+
<label>{t('CHANNEL', 'Channel')}</label>
|
|
290
|
+
<Select
|
|
291
|
+
placeholder={<Option>{t('SELECT_CHANNEL', 'Select a channel')}</Option>}
|
|
292
|
+
defaultValue={formState?.changes?.channel ?? ''}
|
|
293
|
+
options={channelList}
|
|
294
|
+
onChange={val => handleChangeItem({ channel: val })}
|
|
295
|
+
/>
|
|
296
|
+
</InputWrapper>
|
|
297
|
+
<InputWrapper>
|
|
298
|
+
<label>{t('MESSAGE', 'Message')}</label>
|
|
299
|
+
{formState.changes?.channel === 'email' ? (
|
|
300
|
+
<HtmlEditor
|
|
301
|
+
handleChangeBody={val => handleChangeItem({ body: val })}
|
|
302
|
+
/>
|
|
303
|
+
) : (
|
|
304
|
+
<TextArea
|
|
305
|
+
name='body'
|
|
306
|
+
rows={3}
|
|
307
|
+
placeholder={t('WRITE_MESSAGE', 'Write a message')}
|
|
308
|
+
defaultValue={formState?.changes?.body ?? ''}
|
|
309
|
+
onChange={handleChangeInput}
|
|
310
|
+
ref={register({
|
|
311
|
+
required: t(
|
|
312
|
+
'VALIDATION_ERROR_REQUIRED',
|
|
313
|
+
'Name is required'
|
|
314
|
+
).replace('_attribute_', t('MESSAGE', 'Message'))
|
|
315
|
+
})}
|
|
316
|
+
/>
|
|
317
|
+
)}
|
|
318
|
+
</InputWrapper>
|
|
319
|
+
</CardContainer>
|
|
320
|
+
<ButtonsContainer>
|
|
321
|
+
<Button
|
|
322
|
+
color='secundary'
|
|
323
|
+
onClick={() => onClose()}
|
|
324
|
+
>
|
|
325
|
+
{t('CANCEL', 'Cancel')}
|
|
326
|
+
</Button>
|
|
327
|
+
<Button
|
|
328
|
+
color='primary'
|
|
329
|
+
type='submit'
|
|
330
|
+
disabled={Object.keys(formState.changes).length === 0 || formState.loading}
|
|
331
|
+
>
|
|
332
|
+
{t('SAVE', 'Save')}
|
|
333
|
+
</Button>
|
|
334
|
+
</ButtonsContainer>
|
|
335
|
+
</RecoveryActionAddContainer>
|
|
336
|
+
<Alert
|
|
337
|
+
title={t('RECOVERY_ACTIONS', 'Recovery actions')}
|
|
338
|
+
content={alertState.content}
|
|
339
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
340
|
+
open={alertState.open}
|
|
341
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
342
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
343
|
+
closeOnBackdrop={false}
|
|
344
|
+
/>
|
|
345
|
+
</>
|
|
346
|
+
)
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export const RecoveryActionAdd = (props) => {
|
|
350
|
+
const recoveryActionDetailProps = {
|
|
351
|
+
...props,
|
|
352
|
+
UIComponent: RecoveryActionAddUI
|
|
353
|
+
}
|
|
354
|
+
return <RecoveryActionDetailController {...recoveryActionDetailProps} />
|
|
355
|
+
}
|
|
@@ -42,13 +42,15 @@ export const RecoveryGeneral = (props) => {
|
|
|
42
42
|
|
|
43
43
|
const [hours, setHours] = useState([])
|
|
44
44
|
const [minutes, setMinutes] = useState([])
|
|
45
|
-
const [
|
|
45
|
+
const [seconds, setSeconds] = useState([])
|
|
46
|
+
const [curPreorderTime, setCurPreorderTime] = useState({ hour: '0', minute: '0', second: '0' })
|
|
46
47
|
const [curDayTime, setCurDayTime] = useState(0)
|
|
47
48
|
const [isTime, setIsTime] = useState(true)
|
|
48
49
|
|
|
49
50
|
const setTimeList = () => {
|
|
50
51
|
const _hours = []
|
|
51
52
|
const _minutes = []
|
|
53
|
+
const _seconds = []
|
|
52
54
|
for (let i = 0; i < 24; i++) {
|
|
53
55
|
const text = (i < 10 ? '0' : ' ') + i
|
|
54
56
|
_hours.push({
|
|
@@ -62,9 +64,14 @@ export const RecoveryGeneral = (props) => {
|
|
|
62
64
|
text: text,
|
|
63
65
|
minute: i
|
|
64
66
|
})
|
|
67
|
+
_seconds.push({
|
|
68
|
+
text: text,
|
|
69
|
+
second: i
|
|
70
|
+
})
|
|
65
71
|
}
|
|
66
72
|
setHours(_hours)
|
|
67
73
|
setMinutes(_minutes)
|
|
74
|
+
setSeconds(_seconds)
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
const handleChangePreorderTime = (evt) => {
|
|
@@ -75,8 +82,9 @@ export const RecoveryGeneral = (props) => {
|
|
|
75
82
|
[type]: value
|
|
76
83
|
})
|
|
77
84
|
let preorderTime = 0
|
|
78
|
-
if (type === 'hour') preorderTime = parseInt(value) * 3600 + parseInt(curPreorderTime?.minute) * 60
|
|
79
|
-
else preorderTime = parseInt(curPreorderTime?.hour) * 3600 + parseInt(value) * 60
|
|
85
|
+
if (type === 'hour') preorderTime = parseInt(value) * 3600 + parseInt(curPreorderTime?.minute) * 60 + parseInt(curPreorderTime?.second)
|
|
86
|
+
else if (type === 'minute') preorderTime = parseInt(curPreorderTime?.hour) * 3600 + parseInt(value) * 60 + parseInt(curPreorderTime?.second)
|
|
87
|
+
else preorderTime = parseInt(curPreorderTime?.hour) * 3600 + parseInt(curPreorderTime?.minute) * 60 + parseInt(value)
|
|
80
88
|
handleChangeItem({ times: [preorderTime], launch_type: 'times' })
|
|
81
89
|
}
|
|
82
90
|
|
|
@@ -103,7 +111,8 @@ export const RecoveryGeneral = (props) => {
|
|
|
103
111
|
setTimeList()
|
|
104
112
|
setCurPreorderTime({
|
|
105
113
|
hour: recoveryActionState?.action?.times ? (parseInt(recoveryActionState?.action?.times[0] / 3600)) : '0',
|
|
106
|
-
minute: recoveryActionState?.action?.times ? (recoveryActionState?.action?.times[0] % 3600 / 60) : '0'
|
|
114
|
+
minute: recoveryActionState?.action?.times ? (parseInt(recoveryActionState?.action?.times[0] % 3600 / 60)) : '0',
|
|
115
|
+
second: recoveryActionState?.action?.times ? (recoveryActionState?.action?.times[0] % 3600 % 60) : '0'
|
|
107
116
|
})
|
|
108
117
|
if (!recoveryActionState?.action?.times) return
|
|
109
118
|
|
|
@@ -231,6 +240,16 @@ export const RecoveryGeneral = (props) => {
|
|
|
231
240
|
<option value={minute.minute} key={i}>{minute.text}</option>
|
|
232
241
|
))}
|
|
233
242
|
</select>
|
|
243
|
+
<span>:</span>
|
|
244
|
+
<select
|
|
245
|
+
value={curPreorderTime?.second}
|
|
246
|
+
name='second'
|
|
247
|
+
onChange={handleChangePreorderTime}
|
|
248
|
+
>
|
|
249
|
+
{seconds?.map((second, i) => (
|
|
250
|
+
<option value={second.second} key={i}>{second.text}</option>
|
|
251
|
+
))}
|
|
252
|
+
</select>
|
|
234
253
|
</TimeBlock>
|
|
235
254
|
</TimeContent>
|
|
236
255
|
)}
|