@comet/brevo-admin 2.0.0-canary-20240809121915 → 2.0.0-canary-20240820071220

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BrevoContactsGrid.d.ts","sourceRoot":"","sources":["../../src/brevoContacts/BrevoContactsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkC,MAAM,gBAAgB,CAAC;AAiB9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAY,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA2D/B,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,4BAA4B,EAC5B,oBAAyB,GAC5B,EAAE;IACC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,4BAA4B,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IACxE,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC;CACvC,GAAG,KAAK,CAAC,YAAY,CAwIrB"}
1
+ {"version":3,"file":"BrevoContactsGrid.d.ts","sourceRoot":"","sources":["../../src/brevoContacts/BrevoContactsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkC,MAAM,gBAAgB,CAAC;AAiB9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAY,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwE/B,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,4BAA4B,EAC5B,oBAAyB,GAC5B,EAAE;IACC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,4BAA4B,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IACxE,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC;CACvC,GAAG,KAAK,CAAC,YAAY,CAyIrB"}
@@ -12,6 +12,9 @@ var _material = require("@mui/material");
12
12
  var _xDataGrid = require("@mui/x-data-grid");
13
13
  var React = _interopRequireWildcard(require("react"));
14
14
  var _reactIntl = require("react-intl");
15
+ var _useContactImportFromCsv = require("../common/contactImport/useContactImportFromCsv");
16
+ var _CrudMoreActionsMenu = require("../temp/CrudMoreActionsMenu");
17
+ var _BrevoContactsGrid = require("./BrevoContactsGrid.generated");
15
18
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
16
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
@@ -21,22 +24,34 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
21
24
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
22
25
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
26
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
- 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); }
25
27
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
26
28
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
- 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; }
28
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
31
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
32
33
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
+ 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."); }
36
+ 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); }
37
+ 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; }
38
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
39
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
40
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
34
41
  var brevoContactsFragment = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fragment BrevoContactsList on BrevoContact {\n id\n createdAt\n modifiedAt\n email\n emailBlacklisted\n smsBlacklisted\n }\n"])));
35
42
  var deleteBrevoContactMutation = (0, _client.gql)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n mutation DeleteBrevoContact($id: Int!, $scope: EmailCampaignContentScopeInput!) {\n deleteBrevoContact(id: $id, scope: $scope)\n }\n"])));
36
43
  var updateBrevoContactMutation = (0, _client.gql)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n mutation UpdateBrevoContact($id: Int!, $input: BrevoContactUpdateInput!, $scope: EmailCampaignContentScopeInput!) {\n updateBrevoContact(id: $id, input: $input, scope: $scope) {\n id\n }\n }\n"])));
37
44
  function BrevoContactsGridToolbar(_ref) {
38
- var intl = _ref.intl;
39
- return /*#__PURE__*/React.createElement(_admin.Toolbar, null, /*#__PURE__*/React.createElement(_admin.ToolbarTitleItem, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
45
+ var intl = _ref.intl,
46
+ scope = _ref.scope;
47
+ var _useContactImportFrom = (0, _useContactImportFromCsv.useContactImportFromCsv)({
48
+ scope: scope,
49
+ refetchQueries: [_BrevoContactsGrid.namedOperations.Query.BrevoContactsGrid]
50
+ }),
51
+ _useContactImportFrom2 = _slicedToArray(_useContactImportFrom, 2),
52
+ moreActionsMenuItem = _useContactImportFrom2[0],
53
+ contactImportComponent = _useContactImportFrom2[1];
54
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_admin.Toolbar, null, /*#__PURE__*/React.createElement(_admin.ToolbarTitleItem, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
40
55
  id: "cometBrevoModule.brevoContact.title",
41
56
  defaultMessage: "Contacts"
42
57
  })), /*#__PURE__*/React.createElement(_admin.ToolbarItem, null, /*#__PURE__*/React.createElement(_xDataGrid.GridToolbarQuickFilter, {
@@ -44,7 +59,9 @@ function BrevoContactsGridToolbar(_ref) {
44
59
  id: "cometBrevoModule.brevoContact.searchEmail",
45
60
  defaultMessage: "Search email address"
46
61
  })
47
- })), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(_material.Button, {
62
+ })), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(_CrudMoreActionsMenu.CrudMoreActionsMenu, {
63
+ overallItems: [moreActionsMenuItem]
64
+ }), /*#__PURE__*/React.createElement(_material.Button, {
48
65
  startIcon: /*#__PURE__*/React.createElement(_adminIcons.Add, null),
49
66
  component: _admin.StackLink,
50
67
  pageName: "add",
@@ -54,7 +71,7 @@ function BrevoContactsGridToolbar(_ref) {
54
71
  }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
55
72
  id: "cometBrevoModule.brevoContact.newContact",
56
73
  defaultMessage: "New contact"
57
- }))));
74
+ })))), contactImportComponent);
58
75
  }
59
76
  function BrevoContactsGrid(_ref2) {
60
77
  var _additionalAttributes, _dataGridProps$filter, _dataGridProps$filter2, _data$brevoContacts$n;
@@ -206,7 +223,8 @@ function BrevoContactsGrid(_ref2) {
206
223
  },
207
224
  componentsProps: {
208
225
  toolbar: {
209
- intl: intl
226
+ intl: intl,
227
+ scope: scope
210
228
  }
211
229
  }
212
230
  })));
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ export interface BrevoConfig {
3
+ apiUrl: string;
4
+ }
5
+ interface BrevoConfigProviderProps {
6
+ value: BrevoConfig;
7
+ }
8
+ export declare const BrevoConfigProvider: ({ children, value }: React.PropsWithChildren<BrevoConfigProviderProps>) => React.JSX.Element;
9
+ export declare const useBrevoConfig: () => BrevoConfig;
10
+ export {};
11
+ //# sourceMappingURL=BrevoConfigProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrevoConfigProvider.d.ts","sourceRoot":"","sources":["../../src/common/BrevoConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;CAClB;AAID,UAAU,wBAAwB;IAC9B,KAAK,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,wBAAyB,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,sBAEzG,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WAMjC,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useBrevoConfig = exports.BrevoConfigProvider = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ var BrevoConfigContext = /*#__PURE__*/_react["default"].createContext(undefined);
10
+ var BrevoConfigProvider = exports.BrevoConfigProvider = function BrevoConfigProvider(_ref) {
11
+ var children = _ref.children,
12
+ value = _ref.value;
13
+ return /*#__PURE__*/_react["default"].createElement(BrevoConfigContext.Provider, {
14
+ value: value
15
+ }, children);
16
+ };
17
+ var useBrevoConfig = exports.useBrevoConfig = function useBrevoConfig() {
18
+ var context = _react["default"].useContext(BrevoConfigContext);
19
+ if (context === undefined) {
20
+ throw new Error("useBrevoConfig must be used within a BrevoConfigProvider");
21
+ }
22
+ return context;
23
+ };
@@ -0,0 +1,12 @@
1
+ import { RefetchQueriesInclude } from "@apollo/client/core/types";
2
+ import * as React from "react";
3
+ import { GQLEmailCampaignContentScopeInput } from "../../graphql.generated";
4
+ import { CrudMoreActionsItem } from "../../temp/CrudMoreActionsMenu";
5
+ interface UseContactImportProps {
6
+ scope: GQLEmailCampaignContentScopeInput;
7
+ targetGroupId?: string;
8
+ refetchQueries?: RefetchQueriesInclude;
9
+ }
10
+ export declare const useContactImportFromCsv: ({ scope, targetGroupId, refetchQueries }: UseContactImportProps) => [CrudMoreActionsItem, React.ReactNode];
11
+ export {};
12
+ //# sourceMappingURL=useContactImportFromCsv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContactImportFromCsv.d.ts","sourceRoot":"","sources":["../../../src/common/contactImport/useContactImportFromCsv.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAIlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,UAAU,qBAAqB;IAC3B,KAAK,EAAE,iCAAiC,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAED,eAAO,MAAM,uBAAuB,6CAA8C,qBAAqB,KAAG,CAAC,mBAAmB,EAAE,MAAM,SAAS,CA0B9I,CAAC"}
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useContactImportFromCsv = void 0;
8
+ var _client = require("@apollo/client");
9
+ var _admin = require("@comet/admin");
10
+ var _adminIcons = require("@comet/admin-icons");
11
+ var _material = require("@mui/material");
12
+ var React = _interopRequireWildcard(require("react"));
13
+ var _reactDropzone = require("react-dropzone");
14
+ var _reactIntl = require("react-intl");
15
+ var _BrevoConfigProvider = require("../BrevoConfigProvider");
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
18
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
20
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
21
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
22
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
+ 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."); }
24
+ 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); }
25
+ 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; }
26
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
27
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
+ var useContactImportFromCsv = exports.useContactImportFromCsv = function useContactImportFromCsv(_ref) {
29
+ var scope = _ref.scope,
30
+ targetGroupId = _ref.targetGroupId,
31
+ refetchQueries = _ref.refetchQueries;
32
+ var fileInputRef = React.useRef(null);
33
+ var moreActionsMenuItem = React.useMemo(function () {
34
+ return {
35
+ type: "action",
36
+ label: /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
37
+ id: "cometBrevoModule.targetGroup.assignedContacts.actions.importFromCsv",
38
+ defaultMessage: "Import contacts from CSV"
39
+ }),
40
+ startAdornment: /*#__PURE__*/React.createElement(_adminIcons.Upload, null),
41
+ onClick: function onClick() {
42
+ var _fileInputRef$current;
43
+ (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 || _fileInputRef$current.click();
44
+ }
45
+ };
46
+ }, []);
47
+ var component = React.useMemo(function () {
48
+ return /*#__PURE__*/React.createElement(ContactImportComponent, {
49
+ scope: scope,
50
+ targetGroupId: targetGroupId,
51
+ fileInputRef: fileInputRef,
52
+ refetchQueries: refetchQueries
53
+ });
54
+ }, [refetchQueries, scope, targetGroupId]);
55
+ return [moreActionsMenuItem, component];
56
+ };
57
+ var ContactImportComponent = function ContactImportComponent(_ref2) {
58
+ var scope = _ref2.scope,
59
+ targetGroupId = _ref2.targetGroupId,
60
+ fileInputRef = _ref2.fileInputRef,
61
+ refetchQueries = _ref2.refetchQueries;
62
+ var apolloClient = (0, _client.useApolloClient)();
63
+ var _React$useState = React.useState(false),
64
+ _React$useState2 = _slicedToArray(_React$useState, 2),
65
+ importingCsv = _React$useState2[0],
66
+ setImportingCsv = _React$useState2[1];
67
+ var _React$useState3 = React.useState(false),
68
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
69
+ importSuccessful = _React$useState4[0],
70
+ setImportSuccessful = _React$useState4[1];
71
+ var dialogOpen = importingCsv || importSuccessful;
72
+ var errorDialog = (0, _admin.useErrorDialog)();
73
+ var config = (0, _BrevoConfigProvider.useBrevoConfig)();
74
+ function upload(file, scope, listIds) {
75
+ var formData = new FormData();
76
+ formData.append("file", file);
77
+ formData.append("scope", JSON.stringify(scope));
78
+ if (listIds) formData.append("listIds", JSON.stringify(listIds));
79
+ return fetch("".concat(config.apiUrl, "/brevo-contacts-csv/upload"), {
80
+ method: "POST",
81
+ body: formData
82
+ });
83
+ }
84
+ var _useDropzone = (0, _reactDropzone.useDropzone)({
85
+ accept: {
86
+ "text/csv": []
87
+ },
88
+ multiple: false,
89
+ onDrop: function () {
90
+ var _onDrop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(acceptedFiles) {
91
+ var file, response, errorResponse, userMessage;
92
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
93
+ while (1) switch (_context.prev = _context.next) {
94
+ case 0:
95
+ setImportingCsv(true);
96
+ _context.prev = 1;
97
+ file = acceptedFiles[0];
98
+ _context.next = 5;
99
+ return upload(file, scope, targetGroupId ? [targetGroupId] : []);
100
+ case 5:
101
+ response = _context.sent;
102
+ apolloClient.refetchQueries({
103
+ include: refetchQueries
104
+ });
105
+ if (!response.ok) {
106
+ _context.next = 12;
107
+ break;
108
+ }
109
+ setImportingCsv(false);
110
+ setImportSuccessful(true);
111
+ _context.next = 16;
112
+ break;
113
+ case 12:
114
+ _context.next = 14;
115
+ return response.json();
116
+ case 14:
117
+ errorResponse = _context.sent;
118
+ throw new Error(JSON.stringify(errorResponse));
119
+ case 16:
120
+ _context.next = 24;
121
+ break;
122
+ case 18:
123
+ _context.prev = 18;
124
+ _context.t0 = _context["catch"](1);
125
+ setImportingCsv(false);
126
+ userMessage = /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
127
+ id: "cometBrevoModule.useContactImport.error.defaultMessage",
128
+ defaultMessage: "An error occured during the import. Please try again in a while or contact your administrator if the error persists."
129
+ });
130
+ if (_context.t0 !== null && _context.t0 !== void 0 && _context.t0.message && typeof _context.t0.message === "string" && _context.t0.message.includes("Too many contacts")) {
131
+ userMessage = /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
132
+ id: "cometBrevoModule.useContactImport.error.tooManyContactsMessage",
133
+ defaultMessage: "Too many contacts in file. Currently we only support 100 contacts at once."
134
+ });
135
+ }
136
+ errorDialog === null || errorDialog === void 0 || errorDialog.showError({
137
+ title: /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _admin.messages.error),
138
+ userMessage: userMessage,
139
+ error: String(_context.t0)
140
+ });
141
+ case 24:
142
+ case "end":
143
+ return _context.stop();
144
+ }
145
+ }, _callee, null, [[1, 18]]);
146
+ }));
147
+ function onDrop(_x) {
148
+ return _onDrop.apply(this, arguments);
149
+ }
150
+ return onDrop;
151
+ }()
152
+ }),
153
+ getInputProps = _useDropzone.getInputProps;
154
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({
155
+ type: "file",
156
+ hidden: true
157
+ }, getInputProps(), {
158
+ ref: fileInputRef
159
+ })), /*#__PURE__*/React.createElement(_material.Dialog, {
160
+ open: dialogOpen
161
+ }, /*#__PURE__*/React.createElement(_material.DialogTitle, null, importingCsv && /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
162
+ id: "cometBrevoModule.useContactImport.importing.title",
163
+ defaultMessage: "Importing contacts from CSV..."
164
+ }), importSuccessful && /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
165
+ id: "cometBrevoModule.useContactImport.importSuccessful.title",
166
+ defaultMessage: "Import successful"
167
+ })), /*#__PURE__*/React.createElement(_material.DialogContent, null, importingCsv && /*#__PURE__*/React.createElement(_admin.Loading, null), importSuccessful && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
168
+ id: "cometBrevoModule.useContactImport.importSuccessful.message",
169
+ defaultMessage: "The contacts have been imported successfully"
170
+ }), /*#__PURE__*/React.createElement(_material.Box, {
171
+ mt: 2
172
+ }, /*#__PURE__*/React.createElement(_admin.Alert, {
173
+ severity: "warning"
174
+ }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
175
+ id: "cometBrevoModule.useContactImport.importSuccessful.doiNotice",
176
+ defaultMessage: "Contacts who have not yet confirmed their subscription will receive a double opt-in email to complete the process. These contacts will not appear in this list until they confirm their subscription. Once confirmed, they will automatically be added to the appropriate target group(s)."
177
+ }))))), /*#__PURE__*/React.createElement(_material.DialogActions, null, importSuccessful && /*#__PURE__*/React.createElement(_material.Button, {
178
+ onClick: function onClick() {
179
+ return setImportSuccessful(false);
180
+ },
181
+ variant: "contained"
182
+ }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _admin.messages.ok)))));
183
+ };
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createBrevoContactsPage } from "./brevoContacts/BrevoContactsPage";
2
2
  export { EditBrevoContactFormValues } from "./brevoContacts/form/BrevoContactForm";
3
+ export { BrevoConfig, BrevoConfigProvider, useBrevoConfig } from "./common/BrevoConfigProvider";
3
4
  export { createEmailCampaignsPage } from "./emailCampaigns/EmailCampaignsPage";
4
5
  export { EditTargetGroupFinalFormValues } from "./targetGroups/TargetGroupForm";
5
6
  export { createTargetGroupsPage } from "./targetGroups/TargetGroupsPage";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC"}
package/lib/index.js CHANGED
@@ -3,6 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "BrevoConfig", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _BrevoConfigProvider.BrevoConfig;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BrevoConfigProvider", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _BrevoConfigProvider.BrevoConfigProvider;
16
+ }
17
+ });
6
18
  Object.defineProperty(exports, "EditBrevoContactFormValues", {
7
19
  enumerable: true,
8
20
  get: function get() {
@@ -33,8 +45,15 @@ Object.defineProperty(exports, "createTargetGroupsPage", {
33
45
  return _TargetGroupsPage.createTargetGroupsPage;
34
46
  }
35
47
  });
48
+ Object.defineProperty(exports, "useBrevoConfig", {
49
+ enumerable: true,
50
+ get: function get() {
51
+ return _BrevoConfigProvider.useBrevoConfig;
52
+ }
53
+ });
36
54
  var _BrevoContactsPage = require("./brevoContacts/BrevoContactsPage");
37
55
  var _BrevoContactForm = require("./brevoContacts/form/BrevoContactForm");
56
+ var _BrevoConfigProvider = require("./common/BrevoConfigProvider");
38
57
  var _EmailCampaignsPage = require("./emailCampaigns/EmailCampaignsPage");
39
58
  var _TargetGroupForm = require("./targetGroups/TargetGroupForm");
40
59
  var _TargetGroupsPage = require("./targetGroups/TargetGroupsPage");
@@ -1 +1 @@
1
- {"version":3,"file":"AddContactsGridSelect.d.ts","sourceRoot":"","sources":["../../../src/targetGroups/addContacts/AddContactsGridSelect.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6F/B,UAAU,0BAA0B;IAChC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,kCAAkC,EAAE,EAAE,0BAA0B,GAAG,KAAK,CAAC,YAAY,CA4LvI"}
1
+ {"version":3,"file":"AddContactsGridSelect.d.ts","sourceRoot":"","sources":["../../../src/targetGroups/addContacts/AddContactsGridSelect.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkH/B,UAAU,0BAA0B;IAChC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,kCAAkC,EAAE,EAAE,0BAA0B,GAAG,KAAK,CAAC,YAAY,CA8LvI"}
@@ -14,6 +14,8 @@ var _xDataGrid = require("@mui/x-data-grid");
14
14
  var React = _interopRequireWildcard(require("react"));
15
15
  var _reactIntl = require("react-intl");
16
16
  var _reactRouter = require("react-router");
17
+ var _useContactImportFromCsv = require("../../common/contactImport/useContactImportFromCsv");
18
+ var _CrudMoreActionsMenu = require("../../temp/CrudMoreActionsMenu");
17
19
  var _TargetGroupForm = require("../TargetGroupForm");
18
20
  var _AddContactsGridSelect = require("./AddContactsGridSelect.gql");
19
21
  var _AddContactsGridSelectGql = require("./AddContactsGridSelect.gql.generated");
@@ -35,9 +37,19 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
35
37
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
36
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
39
  var AssignedContactsGridToolbar = function AssignedContactsGridToolbar(_ref) {
38
- var onOpenDialog = _ref.onOpenDialog;
40
+ var onOpenDialog = _ref.onOpenDialog,
41
+ scope = _ref.scope,
42
+ targetGroupId = _ref.targetGroupId;
39
43
  var intl = (0, _reactIntl.useIntl)();
40
- return /*#__PURE__*/React.createElement(_admin.Toolbar, null, /*#__PURE__*/React.createElement(_admin.ToolbarTitleItem, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
44
+ var _useContactImportFrom = (0, _useContactImportFromCsv.useContactImportFromCsv)({
45
+ scope: scope,
46
+ targetGroupId: targetGroupId,
47
+ refetchQueries: [_AddContactsGridSelectGql.namedOperations.Query.ManuallyAssignedBrevoContactsGrid]
48
+ }),
49
+ _useContactImportFrom2 = _slicedToArray(_useContactImportFrom, 2),
50
+ moreActionsMenuItem = _useContactImportFrom2[0],
51
+ component = _useContactImportFrom2[1];
52
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_admin.Toolbar, null, /*#__PURE__*/React.createElement(_admin.ToolbarTitleItem, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
41
53
  id: "cometBrevoModule.targetGroup.assignedContacts.title",
42
54
  defaultMessage: "Manually assigned contacts"
43
55
  })), /*#__PURE__*/React.createElement(_admin.ToolbarItem, null, /*#__PURE__*/React.createElement(_xDataGrid.GridToolbarQuickFilter, {
@@ -45,7 +57,9 @@ var AssignedContactsGridToolbar = function AssignedContactsGridToolbar(_ref) {
45
57
  id: "cometBrevoModule.targetGroup.assignedContacts.searchEmail",
46
58
  defaultMessage: "Search email address"
47
59
  })
48
- })), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(_material.Button, {
60
+ })), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(_CrudMoreActionsMenu.CrudMoreActionsMenu, {
61
+ overallItems: [moreActionsMenuItem]
62
+ }), /*#__PURE__*/React.createElement(_material.Button, {
49
63
  startIcon: /*#__PURE__*/React.createElement(_adminIcons.Add, null),
50
64
  variant: "contained",
51
65
  color: "primary",
@@ -53,7 +67,7 @@ var AssignedContactsGridToolbar = function AssignedContactsGridToolbar(_ref) {
53
67
  }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
54
68
  id: "cometBrevoModule.targetGroup.assignedContacts.addContact",
55
69
  defaultMessage: "Add contacts"
56
- }))));
70
+ })))), component);
57
71
  };
58
72
  var AssignableContactsGridToolbar = function AssignableContactsGridToolbar() {
59
73
  var intl = (0, _reactIntl.useIntl)();
@@ -224,7 +238,9 @@ function AddContactsGridSelect(_ref3) {
224
238
  toolbar: {
225
239
  onOpenDialog: function onOpenDialog() {
226
240
  return setIsDialogOpen(true);
227
- }
241
+ },
242
+ scope: scope,
243
+ targetGroupId: id
228
244
  }
229
245
  }
230
246
  })), /*#__PURE__*/React.createElement(_admin.FinalForm, {
@@ -1 +1 @@
1
- {"version":3,"file":"AllAssignedContactsGrid.d.ts","sourceRoot":"","sources":["../../../src/targetGroups/allAssignedContacts/AllAssignedContactsGrid.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B,UAAU,4BAA4B;IAClC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,4BAA4B,GAAG,KAAK,CAAC,YAAY,CA4EhH"}
1
+ {"version":3,"file":"AllAssignedContactsGrid.d.ts","sourceRoot":"","sources":["../../../src/targetGroups/allAssignedContacts/AllAssignedContactsGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,UAAU,4BAA4B;IAClC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,4BAA4B,GAAG,KAAK,CAAC,YAAY,CA0EhH"}
@@ -19,8 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
21
21
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
- var AssignedContactsGridToolbar = function AssignedContactsGridToolbar(_ref) {
23
- var onOpenDialog = _ref.onOpenDialog;
22
+ var AssignedContactsGridToolbar = function AssignedContactsGridToolbar() {
24
23
  var intl = (0, _reactIntl.useIntl)();
25
24
  return /*#__PURE__*/React.createElement(_admin.Toolbar, null, /*#__PURE__*/React.createElement(_admin.ToolbarTitleItem, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
26
25
  id: "cometBrevoModule.targetGroup.assignedContacts.title",
@@ -30,13 +29,13 @@ var AssignedContactsGridToolbar = function AssignedContactsGridToolbar(_ref) {
30
29
  id: "cometBrevoModule.targetGroup.assignedContacts.searchEmail",
31
30
  defaultMessage: "Search email address"
32
31
  })
33
- })), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null));
32
+ })));
34
33
  };
35
- function AllAssignedContactsGrid(_ref2) {
34
+ function AllAssignedContactsGrid(_ref) {
36
35
  var _dataGridAllAssignedC, _dataGridAllAssignedC2, _allAssignedContactsD;
37
- var id = _ref2.id,
38
- scope = _ref2.scope,
39
- brevoId = _ref2.brevoId;
36
+ var id = _ref.id,
37
+ scope = _ref.scope,
38
+ brevoId = _ref.brevoId;
40
39
  var intl = (0, _reactIntl.useIntl)();
41
40
  var dataGridAllAssignedContactsProps = _objectSpread(_objectSpread({}, (0, _admin.useDataGridRemote)()), (0, _admin.usePersistentColumnState)("TargetGroupAssignedBrevoContactsGrid"));
42
41
  var _useQuery = (0, _client.useQuery)(_AllAssignedContactsGrid.allAssignedBrevoContactsGridQuery, {
@@ -61,8 +60,8 @@ function AllAssignedContactsGrid(_ref2) {
61
60
  filterable: false,
62
61
  sortable: false,
63
62
  width: 150,
64
- renderCell: function renderCell(_ref3) {
65
- var row = _ref3.row;
63
+ renderCell: function renderCell(_ref2) {
64
+ var row = _ref2.row;
66
65
  return intl.formatDate(new Date(row.createdAt));
67
66
  }
68
67
  }, {
@@ -74,8 +73,8 @@ function AllAssignedContactsGrid(_ref2) {
74
73
  filterable: false,
75
74
  sortable: false,
76
75
  width: 150,
77
- renderCell: function renderCell(_ref4) {
78
- var row = _ref4.row;
76
+ renderCell: function renderCell(_ref3) {
77
+ var row = _ref3.row;
79
78
  return intl.formatDate(new Date(row.modifiedAt));
80
79
  }
81
80
  }, {
@@ -101,7 +100,7 @@ function AllAssignedContactsGrid(_ref2) {
101
100
  }];
102
101
  var allAssignedContactsRowCount = (0, _admin.useBufferedRowCount)(allAssignedContactsData === null || allAssignedContactsData === void 0 ? void 0 : allAssignedContactsData.brevoContacts.totalCount);
103
102
  if (allAssignedContactsError) throw allAssignedContactsError;
104
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_xDataGrid.DataGrid, _extends({}, dataGridAllAssignedContactsProps, {
103
+ return /*#__PURE__*/React.createElement(_xDataGrid.DataGrid, _extends({}, dataGridAllAssignedContactsProps, {
105
104
  disableSelectionOnClick: true,
106
105
  rows: (_allAssignedContactsD = allAssignedContactsData === null || allAssignedContactsData === void 0 ? void 0 : allAssignedContactsData.brevoContacts.nodes) !== null && _allAssignedContactsD !== void 0 ? _allAssignedContactsD : [],
107
106
  rowCount: allAssignedContactsRowCount,
@@ -111,5 +110,5 @@ function AllAssignedContactsGrid(_ref2) {
111
110
  components: {
112
111
  Toolbar: AssignedContactsGridToolbar
113
112
  }
114
- })));
113
+ }));
115
114
  }
@@ -0,0 +1,23 @@
1
+ import { Button, ChipProps, Divider, MenuItem, MenuProps, TypographyProps } from "@mui/material";
2
+ import { Maybe } from "graphql/jsutils/Maybe";
3
+ import * as React from "react";
4
+ export interface ActionItem extends React.ComponentProps<typeof MenuItem> {
5
+ type: "action";
6
+ label: React.ReactNode;
7
+ startAdornment?: React.ReactNode;
8
+ }
9
+ export interface DividerItem extends React.ComponentProps<typeof Divider> {
10
+ type: "divider";
11
+ }
12
+ export type CrudMoreActionsItem = ActionItem | DividerItem;
13
+ export interface CrudMoreActionsMenuProps {
14
+ selectionSize?: number;
15
+ buttonProps?: React.ComponentProps<typeof Button>;
16
+ menuProps?: Partial<MenuProps>;
17
+ chipProps?: Partial<ChipProps>;
18
+ groupTypographyProps?: Partial<TypographyProps>;
19
+ overallItems?: Maybe<CrudMoreActionsItem>[];
20
+ selectiveItems?: Maybe<CrudMoreActionsItem>[];
21
+ }
22
+ export declare function CrudMoreActionsMenu({ overallItems, selectiveItems, buttonProps, menuProps, chipProps, groupTypographyProps, selectionSize, }: CrudMoreActionsMenuProps): React.JSX.Element;
23
+ //# sourceMappingURL=CrudMoreActionsMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrudMoreActionsMenu.d.ts","sourceRoot":"","sources":["../../src/temp/CrudMoreActionsMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,EACH,MAAM,EAEN,SAAS,EACT,OAAO,EAKP,QAAQ,EAGR,SAAS,EAET,eAAe,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC;IACrE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC;IACrE,IAAI,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,wBAAwB;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;IAC5C,cAAc,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;CACjD;AAcD,wBAAgB,mBAAmB,CAAC,EAChC,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,aAAa,GAChB,EAAE,wBAAwB,qBA0G1B"}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CrudMoreActionsMenu = CrudMoreActionsMenu;
8
+ var _adminIcons = require("@comet/admin-icons");
9
+ var _material = require("@mui/material");
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _reactIntl = require("react-intl");
12
+ var _excluded = ["label"],
13
+ _excluded2 = ["label", "startAdornment", "onClick"],
14
+ _excluded3 = ["label", "startAdornment", "onClick"];
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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; }
21
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
24
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } // temporary copy from https://github.com/vivid-planet/comet/pull/2115/files
26
+ // remove as soon as it's available in COMET
27
+ function CrudMoreActionsDivider(props) {
28
+ return /*#__PURE__*/React.createElement(_material.Divider, _extends({
29
+ sx: {
30
+ margin: "8px 10px",
31
+ borderColor: function borderColor(theme) {
32
+ return theme.palette.grey[50];
33
+ }
34
+ }
35
+ }, props));
36
+ }
37
+ function CrudMoreActionsGroup(_ref) {
38
+ var groupTitle = _ref.groupTitle,
39
+ children = _ref.children,
40
+ menuListProps = _ref.menuListProps,
41
+ typographyProps = _ref.typographyProps;
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_material.Typography, _extends({
43
+ variant: "subtitle2",
44
+ color: function color(theme) {
45
+ return theme.palette.grey[500];
46
+ },
47
+ fontWeight: "bold",
48
+ pt: "20px",
49
+ px: "15px"
50
+ }, typographyProps), groupTitle), /*#__PURE__*/React.createElement(_material.MenuList, menuListProps, children));
51
+ }
52
+ function SelectedItemsChip(_ref2) {
53
+ var label = _ref2.label,
54
+ restProps = _objectWithoutProperties(_ref2, _excluded);
55
+ return /*#__PURE__*/React.createElement(_material.Chip, _extends({
56
+ size: "small",
57
+ color: "primary",
58
+ sx: {
59
+ width: 20,
60
+ height: 20,
61
+ flexShrink: 0,
62
+ borderRadius: 20,
63
+ marginLeft: 1
64
+ }
65
+ }, restProps, {
66
+ label: label
67
+ }));
68
+ }
69
+ function CrudMoreActionsMenu(_ref3) {
70
+ var overallItems = _ref3.overallItems,
71
+ selectiveItems = _ref3.selectiveItems,
72
+ buttonProps = _ref3.buttonProps,
73
+ menuProps = _ref3.menuProps,
74
+ chipProps = _ref3.chipProps,
75
+ groupTypographyProps = _ref3.groupTypographyProps,
76
+ selectionSize = _ref3.selectionSize;
77
+ var _React$useState = React.useState(null),
78
+ _React$useState2 = _slicedToArray(_React$useState, 2),
79
+ anchorEl = _React$useState2[0],
80
+ setAnchorEl = _React$useState2[1];
81
+ var handleClick = function handleClick(event) {
82
+ return setAnchorEl(event.currentTarget);
83
+ };
84
+ var handleClose = function handleClose() {
85
+ return setAnchorEl(null);
86
+ };
87
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_material.Button, _extends({
88
+ variant: "text",
89
+ color: "inherit",
90
+ endIcon: /*#__PURE__*/React.createElement(_adminIcons.MoreVertical, null),
91
+ sx: {
92
+ mx: 2
93
+ }
94
+ }, buttonProps, {
95
+ onClick: function onClick(event) {
96
+ var _buttonProps$onClick;
97
+ handleClick(event);
98
+ buttonProps === null || buttonProps === void 0 || (_buttonProps$onClick = buttonProps.onClick) === null || _buttonProps$onClick === void 0 || _buttonProps$onClick.call(buttonProps, event);
99
+ }
100
+ }), /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
101
+ id: "comet.pages.dam.moreActions",
102
+ defaultMessage: "More actions"
103
+ }), !!selectionSize && /*#__PURE__*/React.createElement(SelectedItemsChip, _extends({}, chipProps, {
104
+ label: selectionSize
105
+ }))), /*#__PURE__*/React.createElement(_material.Menu, _extends({
106
+ keepMounted: false,
107
+ PaperProps: {
108
+ sx: {
109
+ minWidth: 220,
110
+ borderRadius: "4px"
111
+ }
112
+ },
113
+ open: Boolean(anchorEl),
114
+ anchorEl: anchorEl
115
+ }, menuProps, {
116
+ onClose: function onClose(event, reason) {
117
+ var _menuProps$onClose;
118
+ handleClose();
119
+ menuProps === null || menuProps === void 0 || (_menuProps$onClose = menuProps.onClose) === null || _menuProps$onClose === void 0 || _menuProps$onClose.call(menuProps, event, reason);
120
+ }
121
+ }), !!(overallItems !== null && overallItems !== void 0 && overallItems.length) && /*#__PURE__*/React.createElement(CrudMoreActionsGroup, {
122
+ groupTitle: /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
123
+ id: "comet.dam.moreActions.overallActions",
124
+ defaultMessage: "Overall actions"
125
+ }),
126
+ typographyProps: groupTypographyProps,
127
+ menuListProps: menuProps === null || menuProps === void 0 ? void 0 : menuProps.MenuListProps
128
+ }, overallItems.map(function (item, index) {
129
+ if (!item) return null;
130
+ var type = item.type;
131
+ if (type === "action") {
132
+ var label = item.label,
133
+ startAdornment = item.startAdornment,
134
+ _onClick = item.onClick,
135
+ rest = _objectWithoutProperties(item, _excluded2);
136
+ return /*#__PURE__*/React.createElement(_material.MenuItem, _extends({
137
+ key: index,
138
+ disabled: !!selectionSize
139
+ }, rest, {
140
+ onClick: function onClick(e) {
141
+ _onClick === null || _onClick === void 0 || _onClick(e);
142
+ handleClose();
143
+ }
144
+ }), !!startAdornment && /*#__PURE__*/React.createElement(_material.ListItemIcon, null, startAdornment), /*#__PURE__*/React.createElement(_material.ListItemText, {
145
+ primary: label
146
+ }));
147
+ } else if (type === "divider") {
148
+ return /*#__PURE__*/React.createElement(CrudMoreActionsDivider, _extends({}, item, {
149
+ key: index
150
+ }));
151
+ }
152
+ })), !!(overallItems !== null && overallItems !== void 0 && overallItems.length) && !!(selectiveItems !== null && selectiveItems !== void 0 && selectiveItems.length) && /*#__PURE__*/React.createElement(CrudMoreActionsDivider, null), !!(selectiveItems !== null && selectiveItems !== void 0 && selectiveItems.length) && /*#__PURE__*/React.createElement(CrudMoreActionsGroup, {
153
+ groupTitle: /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
154
+ id: "comet.dam.moreActions.selectiveActions",
155
+ defaultMessage: "Selective actions"
156
+ }),
157
+ typographyProps: groupTypographyProps,
158
+ menuListProps: menuProps === null || menuProps === void 0 ? void 0 : menuProps.MenuListProps
159
+ }, selectiveItems.map(function (item, index) {
160
+ if (!item) return;
161
+ var type = item.type;
162
+ if (type === "action") {
163
+ var label = item.label,
164
+ startAdornment = item.startAdornment,
165
+ _onClick2 = item.onClick,
166
+ rest = _objectWithoutProperties(item, _excluded3);
167
+ return /*#__PURE__*/React.createElement(_material.MenuItem, _extends({
168
+ key: index,
169
+ disabled: !selectionSize
170
+ }, rest, {
171
+ onClick: function onClick(e) {
172
+ _onClick2 === null || _onClick2 === void 0 || _onClick2(e);
173
+ handleClose();
174
+ }
175
+ }), !!startAdornment && /*#__PURE__*/React.createElement(_material.ListItemIcon, null, startAdornment), /*#__PURE__*/React.createElement(_material.ListItemText, {
176
+ primary: label
177
+ }), !!selectionSize && /*#__PURE__*/React.createElement(SelectedItemsChip, _extends({}, chipProps, {
178
+ label: selectionSize
179
+ })));
180
+ } else if (item.type === "divider") {
181
+ return /*#__PURE__*/React.createElement(CrudMoreActionsDivider, _extends({}, item, {
182
+ key: index
183
+ }));
184
+ }
185
+ }))));
186
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/brevo-admin",
3
- "version": "2.0.0-canary-20240809121915",
3
+ "version": "2.0.0-canary-20240820071220",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/vivid-planet/comet-brevo-module/",
@@ -15,7 +15,8 @@
15
15
  "dependencies": {
16
16
  "date-fns": "^2.28.0",
17
17
  "file-saver": "^2.0.5",
18
- "lodash.isequal": "^4.0.0"
18
+ "lodash.isequal": "^4.0.0",
19
+ "react-dropzone": "^14.2.3"
19
20
  },
20
21
  "devDependencies": {
21
22
  "@apollo/client": "^3.2.5",