@bigbinary/neeto-integrations-frontend 2.7.1 → 2.8.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/dist/Twilio.js CHANGED
@@ -140,11 +140,11 @@ var QUERY_KEYS = {
140
140
  ZOOM_DETAILS: "zoom-details"
141
141
  };
142
142
 
143
- function ownKeys$3(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; }
144
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
143
+ function ownKeys$4(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; }
144
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
145
145
  var useCreateDaily = function useCreateDaily() {
146
146
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
147
- return useMutationWithInvalidation(dailiesApi.create, _objectSpread$3({
147
+ return useMutationWithInvalidation(dailiesApi.create, _objectSpread$4({
148
148
  keysToInvalidate: [QUERY_KEYS.DAILY_CO_DETAILS]
149
149
  }, options));
150
150
  };
@@ -661,8 +661,8 @@ var TWILIO_INTEGRATION_STEPS = [{
661
661
  isCompleted: false
662
662
  }];
663
663
 
664
- function ownKeys$2(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; }
665
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
664
+ function ownKeys$3(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; }
665
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
666
666
  var ConfigurationForm = function ConfigurationForm(_ref) {
667
667
  var _errors$twilioPhoneNu;
668
668
  var phoneNumberOptions = _ref.phoneNumberOptions,
@@ -711,7 +711,7 @@ var ConfigurationForm = function ConfigurationForm(_ref) {
711
711
  options: phoneNumberOptions,
712
712
  size: "large",
713
713
  onChange: function onChange(selected) {
714
- return setValues(_objectSpread$2(_objectSpread$2({}, values), {}, {
714
+ return setValues(_objectSpread$3(_objectSpread$3({}, values), {}, {
715
715
  twilioPhoneNumber: selected
716
716
  }));
717
717
  }
@@ -734,25 +734,36 @@ function _toConsumableArray(arr) {
734
734
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
735
735
  }
736
736
 
737
+ function ownKeys$2(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; }
738
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
739
+ var fetchTwilioSmsConfiguration = function fetchTwilioSmsConfiguration(integrable) {
740
+ return axios.get(TWILIO_CONFIGURATION_BASE_URL, {
741
+ params: integrable
742
+ });
743
+ };
744
+ var removeTwilioConfiguration = function removeTwilioConfiguration() {
745
+ return axios["delete"](TWILIO_CONFIGURATION_BASE_URL);
746
+ };
747
+ var getTwilioPhoneNumbers = function getTwilioPhoneNumbers(data) {
748
+ return axios.get("".concat(TWILIO_CONFIGURATION_BASE_URL, "/new"), {
749
+ params: data
750
+ });
751
+ };
752
+ var createTwilioConfiguration = function createTwilioConfiguration(payload, integrable) {
753
+ return axios.post(TWILIO_CONFIGURATION_BASE_URL, _objectSpread$2(_objectSpread$2({}, payload), integrable));
754
+ };
737
755
  var twilioApi = {
738
- fetchTwilioSmsConfiguration: function fetchTwilioSmsConfiguration() {
739
- return axios.get(TWILIO_CONFIGURATION_BASE_URL);
740
- },
741
- removeTwilioConfiguration: function removeTwilioConfiguration() {
742
- return axios["delete"](TWILIO_CONFIGURATION_BASE_URL);
743
- },
744
- getTwilioPhoneNumbers: function getTwilioPhoneNumbers(data) {
745
- return axios.get("".concat(TWILIO_CONFIGURATION_BASE_URL, "/new"), {
746
- params: data
747
- });
748
- },
749
- createTwilioConfiguration: function createTwilioConfiguration(payload) {
750
- return axios.post(TWILIO_CONFIGURATION_BASE_URL, payload);
751
- }
756
+ fetchTwilioSmsConfiguration: fetchTwilioSmsConfiguration,
757
+ removeTwilioConfiguration: removeTwilioConfiguration,
758
+ getTwilioPhoneNumbers: getTwilioPhoneNumbers,
759
+ createTwilioConfiguration: createTwilioConfiguration
752
760
  };
753
761
 
754
- var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
755
- return useQuery(QUERY_KEYS.TWILIO_SMS_CONFIGURATION, twilioApi.fetchTwilioSmsConfiguration, {
762
+ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration(_ref) {
763
+ var integrable = _ref.integrable;
764
+ return useQuery([QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId], function () {
765
+ return twilioApi.fetchTwilioSmsConfiguration(integrable);
766
+ }, {
756
767
  select: function select(response) {
757
768
  var _smsConfiguration$twi, _smsConfiguration$twi2, _smsConfiguration$twi3;
758
769
  var smsConfiguration = response.smsConfiguration;
@@ -764,10 +775,10 @@ var useFetchTwilioSmsConfiguration = function useFetchTwilioSmsConfiguration() {
764
775
  }
765
776
  });
766
777
  };
767
- var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref) {
778
+ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref2) {
768
779
  var _formRef$current, _formRef$current$valu, _formRef$current2, _formRef$current2$val;
769
- var credentials = _ref.credentials,
770
- formRef = _ref.formRef;
780
+ var credentials = _ref2.credentials,
781
+ formRef = _ref2.formRef;
771
782
  return useQuery([QUERY_KEYS.TWILIO_PHONE_NUMBERS, {
772
783
  credentials: credentials
773
784
  }], function () {
@@ -778,27 +789,31 @@ var useFetchTwilioPhoneNumbers = function useFetchTwilioPhoneNumbers(_ref) {
778
789
  retry: false
779
790
  });
780
791
  };
781
- var useCreateTwilioConfiguration = function useCreateTwilioConfiguration() {
782
- return useMutationWithInvalidation(twilioApi.createTwilioConfiguration, {
783
- keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION]
792
+ var useCreateTwilioConfiguration = function useCreateTwilioConfiguration(_ref3) {
793
+ var integrable = _ref3.integrable;
794
+ return useMutationWithInvalidation(function (payload) {
795
+ return twilioApi.createTwilioConfiguration(payload, integrable);
796
+ }, {
797
+ keysToInvalidate: [QUERY_KEYS.TWILIO_SMS_CONFIGURATION, integrable === null || integrable === void 0 ? void 0 : integrable.integrableId]
784
798
  });
785
799
  };
786
800
 
787
801
  function ownKeys$1(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; }
788
802
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
789
803
  var useTwilio = function useTwilio(_ref) {
790
- var _ref$onSave = _ref.onSave,
791
- onSave = _ref$onSave === void 0 ? noop : _ref$onSave,
792
- _ref$setSteps = _ref.setSteps,
804
+ var _ref$setSteps = _ref.setSteps,
793
805
  setSteps = _ref$setSteps === void 0 ? noop : _ref$setSteps,
794
806
  _ref$onConnect = _ref.onConnect,
795
807
  onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
796
808
  _ref$formRef = _ref.formRef,
797
- formRef = _ref$formRef === void 0 ? null : _ref$formRef;
798
- var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration(),
809
+ formRef = _ref$formRef === void 0 ? null : _ref$formRef,
810
+ _ref$integrable = _ref.integrable,
811
+ integrable = _ref$integrable === void 0 ? null : _ref$integrable;
812
+ var _useFetchTwilioSmsCon = useFetchTwilioSmsConfiguration({
813
+ integrable: integrable
814
+ }),
799
815
  configuration = _useFetchTwilioSmsCon.data,
800
- isConfigurationLoading = _useFetchTwilioSmsCon.isLoading,
801
- refetchTwilioSmsConfiguration = _useFetchTwilioSmsCon.refetch;
816
+ isConfigurationLoading = _useFetchTwilioSmsCon.isLoading;
802
817
  var _useStateWithDependen = useStateWithDependency(configuration),
803
818
  _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
804
819
  credentials = _useStateWithDependen2[0],
@@ -809,7 +824,9 @@ var useTwilio = function useTwilio(_ref) {
809
824
  }),
810
825
  phoneNumbers = _useFetchTwilioPhoneN.data,
811
826
  isPhoneNumbersLoading = _useFetchTwilioPhoneN.isLoading;
812
- var _useCreateTwilioConfi = useCreateTwilioConfiguration(),
827
+ var _useCreateTwilioConfi = useCreateTwilioConfiguration({
828
+ integrable: integrable
829
+ }),
813
830
  saveConfiguration = _useCreateTwilioConfi.mutate,
814
831
  isSubmitting = _useCreateTwilioConfi.isLoading;
815
832
  useEffect(function () {
@@ -834,11 +851,7 @@ var useTwilio = function useTwilio(_ref) {
834
851
  return;
835
852
  }
836
853
  saveConfiguration(payload, {
837
- onSuccess: function onSuccess() {
838
- onSave();
839
- refetchTwilioSmsConfiguration();
840
- onConnect === null || onConnect === void 0 ? void 0 : onConnect();
841
- }
854
+ onSuccess: onConnect
842
855
  });
843
856
  };
844
857
  return {
@@ -867,23 +880,23 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
867
880
  var TwilioConfiguration = function TwilioConfiguration(_ref) {
868
881
  var _ref$onCancel = _ref.onCancel,
869
882
  onCancel = _ref$onCancel === void 0 ? noop : _ref$onCancel,
870
- _ref$onSave = _ref.onSave,
871
- onSave = _ref$onSave === void 0 ? noop : _ref$onSave,
872
883
  _ref$setSteps = _ref.setSteps,
873
884
  setSteps = _ref$setSteps === void 0 ? noop : _ref$setSteps,
874
885
  _ref$onConnect = _ref.onConnect,
875
886
  onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
876
887
  _ref$isModal = _ref.isModal,
877
- isModal = _ref$isModal === void 0 ? false : _ref$isModal;
888
+ isModal = _ref$isModal === void 0 ? false : _ref$isModal,
889
+ _ref$integrable = _ref.integrable,
890
+ integrable = _ref$integrable === void 0 ? null : _ref$integrable;
878
891
  var _useTranslation = useTranslation(),
879
892
  t = _useTranslation.t;
880
893
  var initialFocusRef = useRef();
881
894
  var formRef = useRef();
882
895
  var _useTwilio = useTwilio({
883
- onSave: onSave,
884
896
  setSteps: setSteps,
885
897
  onConnect: onConnect,
886
- formRef: formRef
898
+ formRef: formRef,
899
+ integrable: integrable
887
900
  }),
888
901
  handleSubmit = _useTwilio.handleSubmit,
889
902
  phoneNumbers = _useTwilio.phoneNumbers,
@@ -954,7 +967,13 @@ var TwilioConfiguration = function TwilioConfiguration(_ref) {
954
967
  };
955
968
 
956
969
  var Twilio = function Twilio(_ref) {
957
- var _ref$onClose = _ref.onClose,
970
+ var _ref$integrable = _ref.integrable,
971
+ integrable = _ref$integrable === void 0 ? null : _ref$integrable,
972
+ _ref$isModal = _ref.isModal,
973
+ isModal = _ref$isModal === void 0 ? true : _ref$isModal,
974
+ _ref$isModalOpen = _ref.isModalOpen,
975
+ isModalOpen = _ref$isModalOpen === void 0 ? true : _ref$isModalOpen,
976
+ _ref$onClose = _ref.onClose,
958
977
  onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
959
978
  _ref$onConnect = _ref.onConnect,
960
979
  onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect;
@@ -963,11 +982,12 @@ var Twilio = function Twilio(_ref) {
963
982
  steps = _useState2[0],
964
983
  setSteps = _useState2[1];
965
984
  return /*#__PURE__*/React.createElement(Modal, {
966
- isOpen: true,
985
+ isOpen: isModalOpen,
967
986
  steps: steps,
968
987
  onClose: onClose
969
988
  }, /*#__PURE__*/React.createElement(TwilioConfiguration, {
970
- isModal: true,
989
+ integrable: integrable,
990
+ isModal: isModal,
971
991
  setSteps: setSteps,
972
992
  onCancel: onClose,
973
993
  onConnect: onConnect