@comet/brevo-admin 2.2.0-canary-20250115095924 → 2.2.0-canary-20250115112240
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/lib/brevoTestContacts/BrevoTestContactsGrid.d.ts.map +1 -1
- package/lib/brevoTestContacts/BrevoTestContactsGrid.js +16 -5
- package/lib/emailCampaigns/form/TestEmailCampaignForm.d.ts.map +1 -1
- package/lib/emailCampaigns/form/TestEmailCampaignForm.generated.d.ts +33 -0
- package/lib/emailCampaigns/form/TestEmailCampaignForm.generated.d.ts.map +1 -0
- package/lib/emailCampaigns/form/TestEmailCampaignForm.generated.js +14 -0
- package/lib/emailCampaigns/form/TestEmailCampaignForm.js +42 -27
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrevoTestContactsGrid.d.ts","sourceRoot":"","sources":["../../src/brevoTestContacts/BrevoTestContactsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"BrevoTestContactsGrid.d.ts","sourceRoot":"","sources":["../../src/brevoTestContacts/BrevoTestContactsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkC,MAAM,gBAAgB,CAAC;AAmB9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAY,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgF/B,wBAAgB,qBAAqB,CAAC,EAClC,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,CA0HrB"}
|
|
@@ -35,7 +35,13 @@ var brevoContactsFragment = (0, _client.gql)(_templateObject || (_templateObject
|
|
|
35
35
|
var deleteBrevoTestContactMutation = (0, _client.gql)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n mutation DeleteBrevoTestContact($id: Int!, $scope: EmailCampaignContentScopeInput!) {\n deleteBrevoTestContact(id: $id, scope: $scope)\n }\n"])));
|
|
36
36
|
function BrevoTestContactsGridToolbar(_ref) {
|
|
37
37
|
var intl = _ref.intl,
|
|
38
|
-
scope = _ref.scope
|
|
38
|
+
scope = _ref.scope,
|
|
39
|
+
totalCount = _ref.totalCount;
|
|
40
|
+
var disableButton = totalCount >= 100;
|
|
41
|
+
var tooltipMessage = intl.formatMessage({
|
|
42
|
+
id: "cometBrevoModule.brevoTestContact.contactLimitReached",
|
|
43
|
+
defaultMessage: "Contact limit of 100 reached. You cannot add more contacts."
|
|
44
|
+
});
|
|
39
45
|
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
46
|
id: "cometBrevoModule.brevoTestContact.title",
|
|
41
47
|
defaultMessage: "Test contacts"
|
|
@@ -44,17 +50,20 @@ function BrevoTestContactsGridToolbar(_ref) {
|
|
|
44
50
|
id: "cometBrevoModule.brevoTestContact.searchEmail",
|
|
45
51
|
defaultMessage: "Search email address"
|
|
46
52
|
})
|
|
47
|
-
})), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(
|
|
53
|
+
})), /*#__PURE__*/React.createElement(_admin.ToolbarFillSpace, null), /*#__PURE__*/React.createElement(_admin.ToolbarActions, null, /*#__PURE__*/React.createElement(_admin.Tooltip, {
|
|
54
|
+
title: disableButton ? tooltipMessage : ""
|
|
55
|
+
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(_material.Button, {
|
|
48
56
|
startIcon: /*#__PURE__*/React.createElement(_adminIcons.Add, null),
|
|
49
57
|
component: _admin.StackLink,
|
|
50
58
|
pageName: "add",
|
|
51
59
|
payload: "add",
|
|
52
60
|
variant: "contained",
|
|
53
|
-
color: "primary"
|
|
61
|
+
color: "primary",
|
|
62
|
+
disabled: disableButton
|
|
54
63
|
}, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, {
|
|
55
64
|
id: "cometBrevoModule.brevoTestContact.newContact",
|
|
56
65
|
defaultMessage: "New test contact"
|
|
57
|
-
})))));
|
|
66
|
+
})))))));
|
|
58
67
|
}
|
|
59
68
|
function BrevoTestContactsGrid(_ref2) {
|
|
60
69
|
var _additionalAttributes, _dataGridProps$filter, _dataGridProps$filter2, _data$brevoTestContac;
|
|
@@ -153,6 +162,7 @@ function BrevoTestContactsGrid(_ref2) {
|
|
|
153
162
|
var rowCount = (0, _admin.useBufferedRowCount)(data === null || data === void 0 ? void 0 : data.brevoTestContacts.totalCount);
|
|
154
163
|
if (error) throw error;
|
|
155
164
|
var rows = (_data$brevoTestContac = data === null || data === void 0 ? void 0 : data.brevoTestContacts.nodes) !== null && _data$brevoTestContac !== void 0 ? _data$brevoTestContac : [];
|
|
165
|
+
var totalCount = (data === null || data === void 0 ? void 0 : data.brevoTestContacts.totalCount) || 0;
|
|
156
166
|
return /*#__PURE__*/React.createElement(_admin.MainContent, {
|
|
157
167
|
fullHeight: true
|
|
158
168
|
}, /*#__PURE__*/React.createElement(_material.Box, {
|
|
@@ -176,7 +186,8 @@ function BrevoTestContactsGrid(_ref2) {
|
|
|
176
186
|
componentsProps: {
|
|
177
187
|
toolbar: {
|
|
178
188
|
intl: intl,
|
|
179
|
-
scope: scope
|
|
189
|
+
scope: scope,
|
|
190
|
+
totalCount: totalCount
|
|
180
191
|
}
|
|
181
192
|
}
|
|
182
193
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestEmailCampaignForm.d.ts","sourceRoot":"","sources":["../../../src/emailCampaigns/form/TestEmailCampaignForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TestEmailCampaignForm.d.ts","sourceRoot":"","sources":["../../../src/emailCampaigns/form/TestEmailCampaignForm.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,UAAU,0BAA0B;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAqBD,eAAO,MAAM,qBAAqB,uBAAgC,0BAA0B,sBAsF3F,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as Types from '../../graphql.generated';
|
|
2
|
+
export declare const namedOperations: {
|
|
3
|
+
Query: {
|
|
4
|
+
BrevoTestContactsGridSelect: string;
|
|
5
|
+
};
|
|
6
|
+
Fragment: {
|
|
7
|
+
BrevoTestContactsSelectList: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type GQLBrevoTestContactsSelectListFragment = {
|
|
11
|
+
__typename?: 'BrevoContact';
|
|
12
|
+
id: number;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
export type GQLBrevoTestContactsGridSelectQueryVariables = Types.Exact<{
|
|
16
|
+
offset?: Types.InputMaybe<Types.Scalars['Int']>;
|
|
17
|
+
limit?: Types.InputMaybe<Types.Scalars['Int']>;
|
|
18
|
+
email?: Types.InputMaybe<Types.Scalars['String']>;
|
|
19
|
+
scope: Types.GQLEmailCampaignContentScopeInput;
|
|
20
|
+
}>;
|
|
21
|
+
export type GQLBrevoTestContactsGridSelectQuery = {
|
|
22
|
+
__typename?: 'Query';
|
|
23
|
+
brevoTestContacts: {
|
|
24
|
+
__typename?: 'PaginatedBrevoContacts';
|
|
25
|
+
totalCount: number;
|
|
26
|
+
nodes: Array<{
|
|
27
|
+
__typename?: 'BrevoContact';
|
|
28
|
+
id: number;
|
|
29
|
+
email: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=TestEmailCampaignForm.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestEmailCampaignForm.generated.d.ts","sourceRoot":"","sources":["../../../src/emailCampaigns/form/TestEmailCampaignForm.generated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,yBAAyB,CAAC;AAEjD,eAAO,MAAM,eAAe;;;;;;;CAO3B,CAAA;AACD,MAAM,MAAM,sCAAsC,GAAG;IAAE,UAAU,CAAC,EAAE,cAAc,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhH,MAAM,MAAM,4CAA4C,GAAG,KAAK,CAAC,KAAK,CAAC;IACrE,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,KAAK,EAAE,KAAK,CAAC,iCAAiC,CAAC;CAChD,CAAC,CAAC;AAGH,MAAM,MAAM,mCAAmC,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE;QAAE,UAAU,CAAC,EAAE,wBAAwB,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;YAAE,UAAU,CAAC,EAAE,cAAc,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.namedOperations = void 0;
|
|
7
|
+
var namedOperations = exports.namedOperations = {
|
|
8
|
+
Query: {
|
|
9
|
+
BrevoTestContactsGridSelect: 'BrevoTestContactsGridSelect'
|
|
10
|
+
},
|
|
11
|
+
Fragment: {
|
|
12
|
+
BrevoTestContactsSelectList: 'BrevoTestContactsSelectList'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -9,49 +9,67 @@ var _client = require("@apollo/client");
|
|
|
9
9
|
var _admin = require("@comet/admin");
|
|
10
10
|
var _adminIcons = require("@comet/admin-icons");
|
|
11
11
|
var _blocksAdmin = require("@comet/blocks-admin");
|
|
12
|
+
var _cmsAdmin = require("@comet/cms-admin");
|
|
12
13
|
var _material = require("@mui/material");
|
|
13
14
|
var _react = _interopRequireDefault(require("react"));
|
|
14
15
|
var _reactIntl = require("react-intl");
|
|
15
16
|
var _TestEmailCampaignForm = require("./TestEmailCampaignForm.gql");
|
|
17
|
+
var _templateObject, _templateObject2;
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
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; }
|
|
18
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); } }
|
|
19
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 _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
23
|
+
var brevoTestContactsSelectFragment = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fragment BrevoTestContactsSelectList on BrevoContact {\n id\n email\n }\n"])));
|
|
24
|
+
var brevoTestContactsSelectQuery = (0, _client.gql)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n query BrevoTestContactsGridSelect($offset: Int, $limit: Int, $email: String, $scope: EmailCampaignContentScopeInput!) {\n brevoTestContacts(offset: $offset, limit: $limit, email: $email, scope: $scope) {\n nodes {\n ...BrevoTestContactsSelectList\n }\n totalCount\n }\n }\n ", "\n"])), brevoTestContactsSelectFragment);
|
|
20
25
|
var TestEmailCampaignForm = exports.TestEmailCampaignForm = function TestEmailCampaignForm(_ref) {
|
|
26
|
+
var _data$brevoTestContac;
|
|
21
27
|
var id = _ref.id,
|
|
22
28
|
_ref$isSendable = _ref.isSendable,
|
|
23
29
|
isSendable = _ref$isSendable === void 0 ? false : _ref$isSendable;
|
|
24
30
|
var client = (0, _client.useApolloClient)();
|
|
31
|
+
var scope = (0, _cmsAdmin.useContentScope)();
|
|
32
|
+
|
|
33
|
+
// Contact creation is limited to 100 at a time. Therefore, 100 contacts are queried without using pagination.
|
|
34
|
+
var _useQuery = (0, _client.useQuery)(brevoTestContactsSelectQuery, {
|
|
35
|
+
variables: {
|
|
36
|
+
offset: 0,
|
|
37
|
+
limit: 100,
|
|
38
|
+
scope: scope
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
data = _useQuery.data,
|
|
42
|
+
loading = _useQuery.loading,
|
|
43
|
+
error = _useQuery.error;
|
|
25
44
|
function submitTestEmails(_x) {
|
|
26
45
|
return _submitTestEmails.apply(this, arguments);
|
|
27
46
|
}
|
|
28
47
|
function _submitTestEmails() {
|
|
29
48
|
_submitTestEmails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
30
|
-
var testEmails,
|
|
49
|
+
var testEmails, _yield$client$mutate, _data;
|
|
31
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
32
51
|
while (1) switch (_context.prev = _context.next) {
|
|
33
52
|
case 0:
|
|
34
53
|
testEmails = _ref2.testEmails;
|
|
35
|
-
emailsArray = testEmails.trim().split("\n");
|
|
36
54
|
if (!id) {
|
|
37
|
-
_context.next =
|
|
55
|
+
_context.next = 7;
|
|
38
56
|
break;
|
|
39
57
|
}
|
|
40
|
-
_context.next =
|
|
58
|
+
_context.next = 4;
|
|
41
59
|
return client.mutate({
|
|
42
60
|
mutation: _TestEmailCampaignForm.SendEmailCampaignToTestEmailsMutation,
|
|
43
61
|
variables: {
|
|
44
62
|
id: id,
|
|
45
63
|
data: {
|
|
46
|
-
emails:
|
|
64
|
+
emails: testEmails
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
});
|
|
50
|
-
case
|
|
68
|
+
case 4:
|
|
51
69
|
_yield$client$mutate = _context.sent;
|
|
52
|
-
|
|
53
|
-
return _context.abrupt("return",
|
|
54
|
-
case
|
|
70
|
+
_data = _yield$client$mutate.data;
|
|
71
|
+
return _context.abrupt("return", _data === null || _data === void 0 ? void 0 : _data.sendEmailCampaignToTestEmails);
|
|
72
|
+
case 7:
|
|
55
73
|
case "end":
|
|
56
74
|
return _context.stop();
|
|
57
75
|
}
|
|
@@ -59,6 +77,9 @@ var TestEmailCampaignForm = exports.TestEmailCampaignForm = function TestEmailCa
|
|
|
59
77
|
}));
|
|
60
78
|
return _submitTestEmails.apply(this, arguments);
|
|
61
79
|
}
|
|
80
|
+
var emailOptions = (data === null || data === void 0 || (_data$brevoTestContac = data.brevoTestContacts) === null || _data$brevoTestContac === void 0 || (_data$brevoTestContac = _data$brevoTestContac.nodes) === null || _data$brevoTestContac === void 0 ? void 0 : _data$brevoTestContac.map(function (contact) {
|
|
81
|
+
return contact.email;
|
|
82
|
+
})) || [];
|
|
62
83
|
return /*#__PURE__*/_react["default"].createElement(_material.Card, {
|
|
63
84
|
sx: {
|
|
64
85
|
mt: 4
|
|
@@ -70,36 +91,30 @@ var TestEmailCampaignForm = exports.TestEmailCampaignForm = function TestEmailCa
|
|
|
70
91
|
})
|
|
71
92
|
}, /*#__PURE__*/_react["default"].createElement(_admin.FinalForm, {
|
|
72
93
|
mode: "edit",
|
|
73
|
-
onSubmit: submitTestEmails
|
|
94
|
+
onSubmit: submitTestEmails,
|
|
95
|
+
initialValues: {
|
|
96
|
+
testEmails: []
|
|
97
|
+
}
|
|
74
98
|
}, function (_ref3) {
|
|
75
99
|
var handleSubmit = _ref3.handleSubmit,
|
|
76
100
|
submitting = _ref3.submitting,
|
|
77
101
|
values = _ref3.values;
|
|
78
102
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_admin.Field, {
|
|
103
|
+
component: _admin.FinalFormSelect,
|
|
79
104
|
name: "testEmails",
|
|
80
105
|
label: /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
81
106
|
id: "cometBrevoModule.emailCampaigns.testEmailCampaign.testEmails",
|
|
82
107
|
defaultMessage: "Email addresses"
|
|
83
108
|
}),
|
|
84
|
-
component: _admin.FinalFormInput,
|
|
85
|
-
multiline: true,
|
|
86
|
-
placeholder: ["First test email address", "Second test email address"].join("\n"),
|
|
87
109
|
fullWidth: true,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
110
|
+
options: emailOptions,
|
|
111
|
+
isLoading: loading,
|
|
112
|
+
error: !!error,
|
|
113
|
+
value: values.testEmails || [],
|
|
114
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
115
|
+
return option;
|
|
93
116
|
}
|
|
94
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
95
|
-
sx: {
|
|
96
|
-
display: "flex",
|
|
97
|
-
alignItems: "center"
|
|
98
|
-
}
|
|
99
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
100
|
-
id: "cometBrevoModule.emailCampaigns.testEmailCampaign.oneEmailAddressEachLine",
|
|
101
|
-
defaultMessage: "One email address each line"
|
|
102
|
-
})), /*#__PURE__*/_react["default"].createElement(_material.Typography, null)), /*#__PURE__*/_react["default"].createElement(_admin.SaveButton, {
|
|
117
|
+
}), /*#__PURE__*/_react["default"].createElement(_admin.SaveButton, {
|
|
103
118
|
disabled: !values.testEmails || !isSendable || !id,
|
|
104
119
|
saveIcon: /*#__PURE__*/_react["default"].createElement(_adminIcons.Newsletter, null),
|
|
105
120
|
onClick: handleSubmit,
|