@bigbinary/neeto-custom-domains-frontend 3.1.13 → 3.1.14

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.
@@ -13,16 +13,17 @@ var axios = require('axios');
13
13
  var Alert = require('@bigbinary/neetoui/Alert');
14
14
  var reactI18next = require('react-i18next');
15
15
  var jsxRuntime = require('react/jsx-runtime');
16
+ var classNames = require('classnames');
16
17
  var constants = require('@bigbinary/neeto-commons-frontend/constants');
17
- var general = require('@bigbinary/neeto-commons-frontend/utils/general');
18
- var Redirection = require('@bigbinary/neeto-icons/Redirection');
18
+ var CustomDomain$1 = require('@bigbinary/neeto-icons/CustomDomain');
19
+ var ExternalLink = require('@bigbinary/neeto-icons/ExternalLink');
19
20
  var CardLayout = require('@bigbinary/neeto-molecules/CardLayout');
20
21
  var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
21
22
  var Button = require('@bigbinary/neetoui/Button');
22
23
  var Typography = require('@bigbinary/neetoui/Typography');
23
- var Tag = require('@bigbinary/neetoui/Tag');
24
- var NoData = require('@bigbinary/neetoui/NoData');
25
- var Tooltip = require('@bigbinary/neetoui/Tooltip');
24
+ var CheckCircle = require('@bigbinary/neeto-icons/CheckCircle');
25
+ var Warning2 = require('@bigbinary/neeto-icons/Warning2');
26
+ var CloseCircle = require('@bigbinary/neeto-icons/CloseCircle');
26
27
  var Pane = require('@bigbinary/neetoui/Pane');
27
28
  var Stepper = require('@bigbinary/neetoui/Stepper');
28
29
  var Callout = require('@bigbinary/neetoui/Callout');
@@ -31,6 +32,8 @@ var Input = require('@bigbinary/neetoui/formik/Input');
31
32
  var Form = require('@bigbinary/neetoui/formik/Form');
32
33
  var Radio = require('@bigbinary/neetoui/formik/Radio');
33
34
  var i18next = require('i18next');
35
+ var Tag = require('@bigbinary/neetoui/Tag');
36
+ var Tooltip = require('@bigbinary/neetoui/Tooltip');
34
37
  var psl = require('psl');
35
38
  var ramda = require('ramda');
36
39
  var Yup = require('yup');
@@ -163,13 +166,17 @@ var STATUS_TAG_STYLES = {
163
166
  pending: "warning",
164
167
  failed: "danger"
165
168
  };
169
+ var STATUS_ICON = {
170
+ active: CheckCircle,
171
+ pending: Warning2,
172
+ failed: CloseCircle
173
+ };
166
174
 
167
175
  var Domain = function Domain(_ref) {
168
176
  var isCustomDomainAdded = _ref.isCustomDomainAdded,
169
177
  openPane = _ref.openPane,
170
178
  customDomains = _ref.customDomains,
171
179
  openDeleteAlert = _ref.openDeleteAlert,
172
- helpDocUrl = _ref.helpDocUrl,
173
180
  setSelectedCustomDomain = _ref.setSelectedCustomDomain;
174
181
  var _useTranslation = reactI18next.useTranslation(),
175
182
  t = _useTranslation.t;
@@ -182,101 +189,131 @@ var Domain = function Domain(_ref) {
182
189
  openDeleteAlert();
183
190
  };
184
191
  return isCustomDomainAdded ? /*#__PURE__*/jsxRuntime.jsx(CardLayout, {
185
- title: t("neetoCustomDomains.connectionTitle"),
186
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
187
- className: "space-y-1",
188
- children: [customDomains === null || customDomains === void 0 ? void 0 : customDomains.map(function (customDomain, index) {
189
- var _customDomain$redirec, _customDomain$redirec2;
192
+ actionBlock: /*#__PURE__*/jsxRuntime.jsx(Button, {
193
+ disabled: isCustomDomainAdded,
194
+ label: t("neetoCustomDomains.actions.add", {
195
+ what: t("neetoCustomDomains.customDomain", constants.SINGULAR)
196
+ }),
197
+ tooltipProps: {
198
+ content: t("neetoCustomDomains.tooltipContent")
199
+ },
200
+ onClick: openPane
201
+ }),
202
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
203
+ className: "flex flex-col gap-y-6 divide-y divide-gray-200",
204
+ children: customDomains === null || customDomains === void 0 ? void 0 : customDomains.map(function (customDomain, index) {
205
+ var _customDomain$redirec;
190
206
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
191
- className: "neeto-ui-border-gray-200 neeto-ui-rounded neeto-ui-bg-gray-50 flex items-center justify-between border p-2",
207
+ className: "flex items-center gap-x-3 pb-6 last:pb-0",
192
208
  "data-cy": "custom-domain-item",
193
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
194
- className: "flex items-center space-x-2",
195
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
196
- "data-cy": "custom-domain-host-name",
197
- style: "body2",
198
- children: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname
199
- }), /*#__PURE__*/jsxRuntime.jsx(Tag, {
200
- "data-cy": "".concat(general.hyphenize(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status), "-tag-container"),
201
- style: STATUS_TAG_STYLES[customDomain === null || customDomain === void 0 ? void 0 : customDomain.status],
202
- label: t("neetoCustomDomains.status.domain.".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status))
203
- })]
209
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
210
+ className: classNames("neeto-ui-rounded-lg flex items-center justify-center p-2", {
211
+ "neeto-ui-bg-success-100": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "active",
212
+ "neeto-ui-bg-warning-100": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "pending",
213
+ "neeto-ui-bg-error-100": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "failed"
214
+ }),
215
+ children: function () {
216
+ var IconComponent = STATUS_ICON[customDomain === null || customDomain === void 0 ? void 0 : customDomain.status] || CustomDomain$1;
217
+ return /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
218
+ size: 32,
219
+ className: classNames({
220
+ "neeto-ui-text-success-800": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "active",
221
+ "neeto-ui-text-warning-800": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "pending",
222
+ "neeto-ui-text-error-800": (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "failed"
223
+ })
224
+ });
225
+ }()
204
226
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
205
- className: "flex items-center gap-2",
206
- children: [(customDomain === null || customDomain === void 0 ? void 0 : customDomain.redirection) && /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
207
- content: t("neetoCustomDomains.redirectionTooltipDescription", {
208
- fromDomain: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
209
- toDomain: customDomain === null || customDomain === void 0 || (_customDomain$redirec = customDomain.redirection) === null || _customDomain$redirec === void 0 ? void 0 : _customDomain$redirec.toHostname
210
- }),
211
- children: /*#__PURE__*/jsxRuntime.jsx(Tag, {
212
- icon: Redirection,
213
- label: customDomain === null || customDomain === void 0 || (_customDomain$redirec2 = customDomain.redirection) === null || _customDomain$redirec2 === void 0 ? void 0 : _customDomain$redirec2.toHostname,
214
- style: "secondary"
215
- })
216
- }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
217
- dropdownButtonProps: {
218
- "data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id),
219
- "data-cy": "custom-domains-more-dropdown-button"
220
- },
221
- dropdownProps: {
222
- position: "bottom-end",
223
- strategy: "fixed",
224
- autoWidth: true
225
- },
226
- menuItems: [{
227
- label: t("neetoCustomDomains.actions.edit"),
227
+ className: "flex flex-col gap-y-1",
228
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
229
+ className: "flex items-center gap-x-3",
230
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
231
+ className: "hover:neeto-ui-text-accent-800 flex cursor-pointer items-center gap-x-2",
228
232
  onClick: function onClick() {
229
- return handleEditClick(customDomain);
233
+ return window.open("https://".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname), "_blank", "noopener,noreferrer");
230
234
  },
231
- key: "edit-custom-domain-button",
232
- "data-cy": "edit-custom-domain-button"
233
- }, {
234
- label: t("neetoCustomDomains.actions.delete"),
235
- onClick: function onClick() {
236
- return handleDeleteClick(customDomain);
235
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
236
+ className: "hover:neeto-ui-text-accent-800",
237
+ style: "h4",
238
+ weight: "medium",
239
+ children: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname
240
+ }), (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "active" && /*#__PURE__*/jsxRuntime.jsx(ExternalLink, {
241
+ size: 16
242
+ })]
243
+ }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
244
+ dropdownButtonProps: {
245
+ "data-testid": "nui-dropdown-icon-".concat(customDomain === null || customDomain === void 0 ? void 0 : customDomain.id),
246
+ "data-cy": "custom-domains-more-dropdown-button",
247
+ isRounded: true,
248
+ style: "tertiary",
249
+ size: "small"
250
+ },
251
+ dropdownProps: {
252
+ position: "bottom-end",
253
+ strategy: "fixed",
254
+ autoWidth: true
255
+ },
256
+ menuItems: [{
257
+ label: t("neetoCustomDomains.actions.edit"),
258
+ onClick: function onClick() {
259
+ return handleEditClick(customDomain);
260
+ },
261
+ key: "edit-custom-domain-button",
262
+ "data-cy": "edit-custom-domain-button"
263
+ }, {
264
+ label: t("neetoCustomDomains.actions.delete"),
265
+ onClick: function onClick() {
266
+ return handleDeleteClick(customDomain);
267
+ },
268
+ key: "delete-custom-domain",
269
+ "data-cy": "delete-custom-domain-button"
270
+ }]
271
+ })]
272
+ }), /*#__PURE__*/jsxRuntime.jsxs(Typography, {
273
+ className: "neeto-ui-text-gray-600",
274
+ style: "body2",
275
+ children: [(customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "active" && (customDomain === null || customDomain === void 0 ? void 0 : customDomain.redirection) && /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
276
+ components: {
277
+ b: /*#__PURE__*/jsxRuntime.jsx("b", {})
237
278
  },
238
- key: "delete-custom-domain",
239
- "data-cy": "delete-custom-domain-button"
240
- }]
279
+ i18nKey: "neetoCustomDomains.redirectionTooltipDescription",
280
+ values: {
281
+ fromDomain: customDomain === null || customDomain === void 0 ? void 0 : customDomain.hostname,
282
+ toDomain: customDomain === null || customDomain === void 0 || (_customDomain$redirec = customDomain.redirection) === null || _customDomain$redirec === void 0 ? void 0 : _customDomain$redirec.toHostname
283
+ }
284
+ }), (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "active" && !(customDomain !== null && customDomain !== void 0 && customDomain.redirection) && t("neetoCustomDomains.activeTooltipDescription"), (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "pending" && t("neetoCustomDomains.pendingTooltipDescription"), (customDomain === null || customDomain === void 0 ? void 0 : customDomain.status) === "failed" && t("neetoCustomDomains.failedTooltipDescription")]
241
285
  })]
242
286
  })]
243
287
  }, index);
244
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
245
- style: "body2",
246
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
247
- i18nKey: "neetoCustomDomains.readHelpArticle",
248
- components: {
249
- Link: /*#__PURE__*/jsxRuntime.jsx(Button, {
250
- href: helpDocUrl,
251
- rel: "noreferrer",
252
- style: "link",
253
- target: "_blank"
254
- })
255
- }
256
- })
257
- })]
288
+ })
258
289
  })
259
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
260
- className: "flex h-full w-full items-center justify-center",
261
- children: /*#__PURE__*/jsxRuntime.jsx(NoData, {
262
- className: "w-full",
263
- title: t("neetoCustomDomains.noData.title"),
264
- helpText: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
265
- i18nKey: "neetoCustomDomains.noData.helpText",
266
- components: {
267
- helpLink: /*#__PURE__*/jsxRuntime.jsx(Button, {
268
- href: helpDocUrl,
269
- style: "link",
270
- target: "_blank"
271
- })
272
- }
290
+ }) : /*#__PURE__*/jsxRuntime.jsx(CardLayout, {
291
+ actionBlock: /*#__PURE__*/jsxRuntime.jsx(Button, {
292
+ label: t("neetoCustomDomains.actions.add", {
293
+ what: t("neetoCustomDomains.customDomain", constants.SINGULAR)
273
294
  }),
274
- primaryButtonProps: {
275
- label: t("neetoCustomDomains.actions.add", {
276
- what: t("neetoCustomDomains.customDomain", constants.SINGULAR)
277
- }),
278
- onClick: openPane
279
- }
295
+ onClick: openPane
296
+ }),
297
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
298
+ className: "flex h-full w-full items-center gap-x-3",
299
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
300
+ className: "neeto-ui-bg-gray-100 neeto-ui-rounded-lg flex items-center justify-center p-2",
301
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomDomain$1, {
302
+ className: "neeto-ui-text-gray-600",
303
+ size: 32
304
+ })
305
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
306
+ className: "flex flex-col gap-y-1",
307
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
308
+ style: "h4",
309
+ weight: "medium",
310
+ children: t("neetoCustomDomains.noData.title")
311
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
312
+ className: "neeto-ui-text-gray-600",
313
+ style: "body2",
314
+ children: t("neetoCustomDomains.noData.helpText")
315
+ })]
316
+ })]
280
317
  })
281
318
  });
282
319
  };
@@ -1076,21 +1113,21 @@ var Validation = function Validation(_ref) {
1076
1113
  var _dnsHelpDocs$dnsProvi, _dnsHelpDocs$dnsProvi2, _dnsHelpDocs$unknown;
1077
1114
  var children = _ref3.children;
1078
1115
  return /*#__PURE__*/jsxRuntime.jsx(Button, {
1116
+ label: children,
1079
1117
  rel: "noreferrer",
1080
1118
  style: "link",
1081
1119
  target: "_blank",
1082
- href: (_dnsHelpDocs$dnsProvi = (_dnsHelpDocs$dnsProvi2 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi2 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi2[domainType]) !== null && _dnsHelpDocs$dnsProvi !== void 0 ? _dnsHelpDocs$dnsProvi : (_dnsHelpDocs$unknown = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown === void 0 ? void 0 : _dnsHelpDocs$unknown[domainType],
1083
- label: children
1120
+ href: (_dnsHelpDocs$dnsProvi = (_dnsHelpDocs$dnsProvi2 = dnsHelpDocs[dnsProvider]) === null || _dnsHelpDocs$dnsProvi2 === void 0 ? void 0 : _dnsHelpDocs$dnsProvi2[domainType]) !== null && _dnsHelpDocs$dnsProvi !== void 0 ? _dnsHelpDocs$dnsProvi : (_dnsHelpDocs$unknown = dnsHelpDocs.unknown) === null || _dnsHelpDocs$unknown === void 0 ? void 0 : _dnsHelpDocs$unknown[domainType]
1084
1121
  });
1085
1122
  };
1086
1123
  var LoginLink = function LoginLink(_ref4) {
1087
1124
  var children = _ref4.children;
1088
1125
  return /*#__PURE__*/jsxRuntime.jsx(Button, {
1089
1126
  href: dnsProviderInfo === null || dnsProviderInfo === void 0 ? void 0 : dnsProviderInfo.loginUrl,
1127
+ label: children,
1090
1128
  rel: "noreferrer",
1091
1129
  style: "link",
1092
- target: "_blank",
1093
- label: children
1130
+ target: "_blank"
1094
1131
  });
1095
1132
  };
1096
1133
  var components = {
@@ -1101,21 +1138,25 @@ var Validation = function Validation(_ref) {
1101
1138
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
1102
1139
  children: [/*#__PURE__*/jsxRuntime.jsxs(Pane.Body, {
1103
1140
  className: "space-y-4",
1104
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1141
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1105
1142
  className: "space-y-2",
1106
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
1143
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1144
+ style: "h4",
1145
+ weight: "medium",
1146
+ children: t("neetoCustomDomains.domainValidationTitle")
1147
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
1107
1148
  style: "body2",
1108
1149
  children: dnsProvider !== "unknown" ? /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
1150
+ components: components,
1109
1151
  i18nKey: "neetoCustomDomains.dnsProviderCnameRecordInfo",
1110
1152
  values: {
1111
1153
  dnsProvider: dnsProviderInfo === null || dnsProviderInfo === void 0 ? void 0 : dnsProviderInfo.name
1112
- },
1113
- components: components
1154
+ }
1114
1155
  }) : /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
1115
- i18nKey: "neetoCustomDomains.cnameRecordInfo",
1116
- components: components
1156
+ components: components,
1157
+ i18nKey: "neetoCustomDomains.cnameRecordInfo"
1117
1158
  })
1118
- })
1159
+ })]
1119
1160
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
1120
1161
  className: "space-y-1",
1121
1162
  children: /*#__PURE__*/jsxRuntime.jsx(Table, {
@@ -1138,17 +1179,17 @@ var Validation = function Validation(_ref) {
1138
1179
  children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
1139
1180
  style: "body2",
1140
1181
  children: dnsProvider !== "unknown" ? /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
1182
+ components: components,
1141
1183
  i18nKey: "neetoCustomDomains.domainValidationFailedForKnownProvider",
1142
1184
  values: {
1143
1185
  dnsProvider: dnsProviderInfo.name
1144
- },
1145
- components: components
1186
+ }
1146
1187
  }) : /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
1188
+ components: components,
1147
1189
  i18nKey: "neetoCustomDomains.domainValidationFailedForUnknownProvider",
1148
1190
  values: {
1149
1191
  dnsProvider: dnsProviderInfo.name
1150
- },
1151
- components: components
1192
+ }
1152
1193
  })
1153
1194
  })
1154
1195
  }), neetoCist.isNotEmpty(errorKey) && status === "pending" && /*#__PURE__*/jsxRuntime.jsx(Callout, {
@@ -1171,8 +1212,8 @@ var Validation = function Validation(_ref) {
1171
1212
  label: t("neetoCustomDomains.validation.buttonLabel.iHaveAddedTheRecords"),
1172
1213
  onClick: validateDomain
1173
1214
  }), /*#__PURE__*/jsxRuntime.jsx(Button, {
1174
- label: t("neetoCustomDomains.actions.cancel"),
1175
1215
  "data-cy": "cancel-button",
1216
+ label: t("neetoCustomDomains.actions.cancel"),
1176
1217
  style: "text",
1177
1218
  onClick: onClose
1178
1219
  })]
@@ -1230,18 +1271,12 @@ var DomainPane = function DomainPane(_ref) {
1230
1271
  style: "h2",
1231
1272
  children: t("neetoCustomDomains.addNew")
1232
1273
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
1233
- className: "-ml-2 neeto_custom_domain_stepper",
1274
+ className: "neeto_custom_domain_stepper -ml-2",
1234
1275
  children: /*#__PURE__*/jsxRuntime.jsx(Stepper, {
1235
1276
  activeIndex: CURRENT_STEP[getCurrentStep(primaryDomain)],
1236
1277
  setActiveIndex: neetoCist.noop,
1237
1278
  steps: STEPS
1238
1279
  })
1239
- }), primaryDomain && /*#__PURE__*/jsxRuntime.jsx(Typography, {
1240
- style: "h4",
1241
- weight: "medium",
1242
- children: t("neetoCustomDomains.cnameRecordTitle", {
1243
- domainName: primaryDomain.hostname
1244
- })
1245
1280
  })]
1246
1281
  }), function (_primaryDomain$hostna) {
1247
1282
  var currentStep = getCurrentStep(primaryDomain);
@@ -1250,7 +1285,7 @@ var DomainPane = function DomainPane(_ref) {
1250
1285
  var shouldShowLoader = isLoading || isStrategyStep && isSubdomain;
1251
1286
  if (shouldShowLoader) {
1252
1287
  return /*#__PURE__*/jsxRuntime.jsx("div", {
1253
- className: "flex justify-center items-center grow w-full",
1288
+ className: "flex w-full grow items-center justify-center",
1254
1289
  children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
1255
1290
  });
1256
1291
  }