@bigbinary/neeto-molecules 3.16.26 → 3.16.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NeetoWidget.js +11 -82
- package/dist/NeetoWidget.js.map +1 -1
- package/dist/ProductEmbed.js +112 -39
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/cjs/NeetoWidget.js +11 -82
- package/dist/cjs/NeetoWidget.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +112 -39
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +10 -7
package/dist/NeetoWidget.js
CHANGED
|
@@ -26,7 +26,7 @@ import MultiEmailInput from '@bigbinary/neetoui/formik/MultiEmailInput';
|
|
|
26
26
|
import axios from 'axios';
|
|
27
27
|
import * as yup from 'yup';
|
|
28
28
|
import useMutationWithInvalidation from '@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation';
|
|
29
|
-
import
|
|
29
|
+
import '@bigbinary/neetoui/Label';
|
|
30
30
|
import withT from '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
31
31
|
import Switch from '@bigbinary/neetoui/Switch';
|
|
32
32
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
@@ -54,7 +54,7 @@ var WIDGET_DESCRIPTIONS = {
|
|
|
54
54
|
chat: t("neetoMolecules.widget.email.body.values.embedCode.description.chat"),
|
|
55
55
|
replay: t("neetoMolecules.widget.email.body.values.embedCode.description.replay")
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
values(WIDGET_TYPES);
|
|
58
58
|
var QUERY_KEYS = {
|
|
59
59
|
apiKey: "neetoWidgetApiKey",
|
|
60
60
|
configuration: "neetoWidgetConfiguration"
|
|
@@ -2283,12 +2283,7 @@ var getWidgetApiKeyUrl = function getWidgetApiKeyUrl() {
|
|
|
2283
2283
|
return "api/widget/v1/api_keys/".concat(window.globalProps.organization.subdomain);
|
|
2284
2284
|
};
|
|
2285
2285
|
var shouldShowSwitches = function shouldShowSwitches() {
|
|
2286
|
-
|
|
2287
|
-
var email = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || "";
|
|
2288
|
-
if (window.globalProps.railsEnv === RAILS_ENV.production) {
|
|
2289
|
-
return email.toLowerCase().endsWith("@bigbinary.com");
|
|
2290
|
-
}
|
|
2291
|
-
return true;
|
|
2286
|
+
return false;
|
|
2292
2287
|
};
|
|
2293
2288
|
|
|
2294
2289
|
var queryWidgetApiKey = function queryWidgetApiKey() {
|
|
@@ -2460,7 +2455,7 @@ var useUpdateConfigurations = function useUpdateConfigurations() {
|
|
|
2460
2455
|
}, options));
|
|
2461
2456
|
};
|
|
2462
2457
|
|
|
2463
|
-
|
|
2458
|
+
withT(function (_ref) {
|
|
2464
2459
|
var t = _ref.t,
|
|
2465
2460
|
enabledClientApps = _ref.enabledClientApps,
|
|
2466
2461
|
widget = _ref.widget,
|
|
@@ -2482,43 +2477,6 @@ var TooltipSwitch = withT(function (_ref) {
|
|
|
2482
2477
|
});
|
|
2483
2478
|
});
|
|
2484
2479
|
|
|
2485
|
-
var SelectionSwitches = function SelectionSwitches(_ref) {
|
|
2486
|
-
var selectedWidgets = _ref.selectedWidgets,
|
|
2487
|
-
updateSelectedWidgets = _ref.updateSelectedWidgets,
|
|
2488
|
-
primaryApp = _ref.primaryApp,
|
|
2489
|
-
enabledClientApps = _ref.enabledClientApps;
|
|
2490
|
-
var primaryWidget = WIDGET_TYPES_VALUES.includes(primaryApp) ? primaryApp : "";
|
|
2491
|
-
return /*#__PURE__*/jsxs("div", {
|
|
2492
|
-
className: "mb-4 flex w-full flex-wrap items-center justify-between gap-6",
|
|
2493
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
2494
|
-
className: "flex items-center space-x-2",
|
|
2495
|
-
children: [isNotEmpty(primaryWidget) && /*#__PURE__*/jsx(TooltipSwitch, {
|
|
2496
|
-
enabledClientApps: enabledClientApps,
|
|
2497
|
-
selectedWidgets: selectedWidgets,
|
|
2498
|
-
updateSelectedWidgets: updateSelectedWidgets,
|
|
2499
|
-
widget: primaryWidget
|
|
2500
|
-
}), /*#__PURE__*/jsxs(Label, {
|
|
2501
|
-
children: ["Neeto", capitalize(primaryWidget)]
|
|
2502
|
-
})]
|
|
2503
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2504
|
-
className: "flex flex-wrap items-center gap-6 sm:justify-end",
|
|
2505
|
-
children: WIDGET_TYPES_VALUES.map(function (widget, index) {
|
|
2506
|
-
return primaryApp !== widget && /*#__PURE__*/jsxs("div", {
|
|
2507
|
-
className: "flex items-center space-x-2",
|
|
2508
|
-
children: [/*#__PURE__*/jsx(TooltipSwitch, {
|
|
2509
|
-
enabledClientApps: enabledClientApps,
|
|
2510
|
-
selectedWidgets: selectedWidgets,
|
|
2511
|
-
updateSelectedWidgets: updateSelectedWidgets,
|
|
2512
|
-
widget: widget
|
|
2513
|
-
}), /*#__PURE__*/jsxs(Label, {
|
|
2514
|
-
children: ["Neeto", capitalize(widget)]
|
|
2515
|
-
})]
|
|
2516
|
-
}, index);
|
|
2517
|
-
})
|
|
2518
|
-
})]
|
|
2519
|
-
});
|
|
2520
|
-
};
|
|
2521
|
-
|
|
2522
2480
|
function ownKeys$1(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; }
|
|
2523
2481
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2524
2482
|
var EmbedCode = function EmbedCode(_ref) {
|
|
@@ -2555,16 +2513,12 @@ var EmbedCode = function EmbedCode(_ref) {
|
|
|
2555
2513
|
_useFetchConfiguratio4 = _useFetchConfiguratio3.neetoWidgetTokens,
|
|
2556
2514
|
neetoWidgetTokens = _useFetchConfiguratio4 === void 0 ? [] : _useFetchConfiguratio4,
|
|
2557
2515
|
isLoadingConfigurations = _useFetchConfiguratio.isLoading;
|
|
2558
|
-
var _useUpdateConfigurati = useUpdateConfigurations()
|
|
2559
|
-
|
|
2516
|
+
var _useUpdateConfigurati = useUpdateConfigurations();
|
|
2517
|
+
_useUpdateConfigurati.mutate;
|
|
2560
2518
|
var previousEmailType = usePrevious(emailType);
|
|
2561
|
-
var selectedWidgets =
|
|
2562
|
-
return item.enabled && (shouldShowSwitches() || item.clientApplicationName.toLowerCase() === primaryApp);
|
|
2563
|
-
}).map(function (item) {
|
|
2564
|
-
return item.clientApplicationName.toLowerCase();
|
|
2565
|
-
});
|
|
2519
|
+
var selectedWidgets = [primaryApp];
|
|
2566
2520
|
var isOnlyChatWidgetSelected = selectedWidgets.length === 1 && selectedWidgets[0] === WIDGET_TYPES.chat;
|
|
2567
|
-
|
|
2521
|
+
neetoWidgetTokens.filter(prop("clientApplicationEnabled")).map(function (item) {
|
|
2568
2522
|
return item.clientApplicationName.toLowerCase();
|
|
2569
2523
|
});
|
|
2570
2524
|
var enabledWidgets = fromPairs(selectedWidgets.map(function (widget) {
|
|
@@ -2572,26 +2526,6 @@ var EmbedCode = function EmbedCode(_ref) {
|
|
|
2572
2526
|
}));
|
|
2573
2527
|
var shouldShowUserIdentity = showUserIdentity !== null && showUserIdentity !== void 0 ? showUserIdentity : enabledWidgets.chat || enabledWidgets.replay;
|
|
2574
2528
|
var shouldShowSessionContext = showSessionContext !== null && showSessionContext !== void 0 ? showSessionContext : enabledWidgets.replay;
|
|
2575
|
-
var updateSelectedWidgets = function updateSelectedWidgets(widget) {
|
|
2576
|
-
var widgetId = neetoWidgetTokens.find(function (item) {
|
|
2577
|
-
return item.clientApplicationName.toLowerCase() === widget;
|
|
2578
|
-
}).id;
|
|
2579
|
-
var isEnabled = !selectedWidgets.includes(widget);
|
|
2580
|
-
updateWidgetConfiguration({
|
|
2581
|
-
id: widgetId,
|
|
2582
|
-
payload: {
|
|
2583
|
-
enabled: isEnabled
|
|
2584
|
-
}
|
|
2585
|
-
}, {
|
|
2586
|
-
onSuccess: function onSuccess() {
|
|
2587
|
-
var productName = "neeto".concat(capitalize(widget));
|
|
2588
|
-
var response = isEnabled ? "neetoMolecules.widget.installation.enabled" : "neetoMolecules.widget.installation.disabled";
|
|
2589
|
-
Toastr.success(t(response, {
|
|
2590
|
-
productName: productName
|
|
2591
|
-
}));
|
|
2592
|
-
}
|
|
2593
|
-
});
|
|
2594
|
-
};
|
|
2595
2529
|
var getEmbedCodeString = function getEmbedCodeString() {
|
|
2596
2530
|
return isNotEmpty(widgetApiKey) ? sampleConsolidatedCodeString(enabledWidgets, widgetApiKey) : "";
|
|
2597
2531
|
};
|
|
@@ -2742,12 +2676,7 @@ var EmbedCode = function EmbedCode(_ref) {
|
|
|
2742
2676
|
className: "mx-auto mb-10 w-full flex-col items-center justify-start",
|
|
2743
2677
|
children: [/*#__PURE__*/jsxs("div", {
|
|
2744
2678
|
className: classnames("mx-auto", maxWidth),
|
|
2745
|
-
children: [shouldShowSwitches()
|
|
2746
|
-
enabledClientApps: enabledClientApps,
|
|
2747
|
-
primaryApp: primaryApp,
|
|
2748
|
-
selectedWidgets: selectedWidgets,
|
|
2749
|
-
updateSelectedWidgets: updateSelectedWidgets
|
|
2750
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
2679
|
+
children: [shouldShowSwitches(), /*#__PURE__*/jsxs("div", {
|
|
2751
2680
|
className: "mb-8 w-full flex-grow flex-col items-center justify-start",
|
|
2752
2681
|
children: [/*#__PURE__*/jsx("div", {
|
|
2753
2682
|
className: "mx-auto mb-2 w-full",
|
|
@@ -2789,7 +2718,6 @@ var EmbedCode = function EmbedCode(_ref) {
|
|
|
2789
2718
|
}
|
|
2790
2719
|
})
|
|
2791
2720
|
}), /*#__PURE__*/jsx(Trans, {
|
|
2792
|
-
i18nKey: "neetoMolecules.widget.installation.instructions.userIdentity",
|
|
2793
2721
|
components: {
|
|
2794
2722
|
p: /*#__PURE__*/jsx(Typography, {
|
|
2795
2723
|
style: "body2"
|
|
@@ -2800,7 +2728,8 @@ var EmbedCode = function EmbedCode(_ref) {
|
|
|
2800
2728
|
target: "_blank",
|
|
2801
2729
|
href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
|
|
2802
2730
|
})
|
|
2803
|
-
}
|
|
2731
|
+
},
|
|
2732
|
+
i18nKey: enabledWidgets.chat ? "neetoMolecules.widget.installation.instructions.userIdentity.chat" : "neetoMolecules.widget.installation.instructions.userIdentity.replay"
|
|
2804
2733
|
})]
|
|
2805
2734
|
}) : null, shouldShowSessionContext ? /*#__PURE__*/jsxs("div", {
|
|
2806
2735
|
className: "w-full flex-grow flex-col items-center justify-start",
|