@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.
@@ -28,7 +28,7 @@ var MultiEmailInput = require('@bigbinary/neetoui/formik/MultiEmailInput');
28
28
  var axios = require('axios');
29
29
  var yup = require('yup');
30
30
  var useMutationWithInvalidation = require('@bigbinary/neeto-commons-frontend/react-utils/useMutationWithInvalidation');
31
- var Label = require('@bigbinary/neetoui/Label');
31
+ require('@bigbinary/neetoui/Label');
32
32
  var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
33
33
  var Switch = require('@bigbinary/neetoui/Switch');
34
34
  var Tooltip = require('@bigbinary/neetoui/Tooltip');
@@ -75,7 +75,7 @@ var WIDGET_DESCRIPTIONS = {
75
75
  chat: i18next.t("neetoMolecules.widget.email.body.values.embedCode.description.chat"),
76
76
  replay: i18next.t("neetoMolecules.widget.email.body.values.embedCode.description.replay")
77
77
  };
78
- var WIDGET_TYPES_VALUES = ramda.values(WIDGET_TYPES);
78
+ ramda.values(WIDGET_TYPES);
79
79
  var QUERY_KEYS = {
80
80
  apiKey: "neetoWidgetApiKey",
81
81
  configuration: "neetoWidgetConfiguration"
@@ -2304,12 +2304,7 @@ var getWidgetApiKeyUrl = function getWidgetApiKeyUrl() {
2304
2304
  return "api/widget/v1/api_keys/".concat(window.globalProps.organization.subdomain);
2305
2305
  };
2306
2306
  var shouldShowSwitches = function shouldShowSwitches() {
2307
- var _globalProps$user;
2308
- var email = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || "";
2309
- if (window.globalProps.railsEnv === RAILS_ENV.production) {
2310
- return email.toLowerCase().endsWith("@bigbinary.com");
2311
- }
2312
- return true;
2307
+ return false;
2313
2308
  };
2314
2309
 
2315
2310
  var queryWidgetApiKey = function queryWidgetApiKey() {
@@ -2481,7 +2476,7 @@ var useUpdateConfigurations = function useUpdateConfigurations() {
2481
2476
  }, options));
2482
2477
  };
2483
2478
 
2484
- var TooltipSwitch = withT(function (_ref) {
2479
+ withT(function (_ref) {
2485
2480
  var t = _ref.t,
2486
2481
  enabledClientApps = _ref.enabledClientApps,
2487
2482
  widget = _ref.widget,
@@ -2503,43 +2498,6 @@ var TooltipSwitch = withT(function (_ref) {
2503
2498
  });
2504
2499
  });
2505
2500
 
2506
- var SelectionSwitches = function SelectionSwitches(_ref) {
2507
- var selectedWidgets = _ref.selectedWidgets,
2508
- updateSelectedWidgets = _ref.updateSelectedWidgets,
2509
- primaryApp = _ref.primaryApp,
2510
- enabledClientApps = _ref.enabledClientApps;
2511
- var primaryWidget = WIDGET_TYPES_VALUES.includes(primaryApp) ? primaryApp : "";
2512
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
2513
- className: "mb-4 flex w-full flex-wrap items-center justify-between gap-6",
2514
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2515
- className: "flex items-center space-x-2",
2516
- children: [neetoCist.isNotEmpty(primaryWidget) && /*#__PURE__*/jsxRuntime.jsx(TooltipSwitch, {
2517
- enabledClientApps: enabledClientApps,
2518
- selectedWidgets: selectedWidgets,
2519
- updateSelectedWidgets: updateSelectedWidgets,
2520
- widget: primaryWidget
2521
- }), /*#__PURE__*/jsxRuntime.jsxs(Label, {
2522
- children: ["Neeto", neetoCist.capitalize(primaryWidget)]
2523
- })]
2524
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2525
- className: "flex flex-wrap items-center gap-6 sm:justify-end",
2526
- children: WIDGET_TYPES_VALUES.map(function (widget, index) {
2527
- return primaryApp !== widget && /*#__PURE__*/jsxRuntime.jsxs("div", {
2528
- className: "flex items-center space-x-2",
2529
- children: [/*#__PURE__*/jsxRuntime.jsx(TooltipSwitch, {
2530
- enabledClientApps: enabledClientApps,
2531
- selectedWidgets: selectedWidgets,
2532
- updateSelectedWidgets: updateSelectedWidgets,
2533
- widget: widget
2534
- }), /*#__PURE__*/jsxRuntime.jsxs(Label, {
2535
- children: ["Neeto", neetoCist.capitalize(widget)]
2536
- })]
2537
- }, index);
2538
- })
2539
- })]
2540
- });
2541
- };
2542
-
2543
2501
  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; }
2544
2502
  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; }
2545
2503
  var EmbedCode = function EmbedCode(_ref) {
@@ -2576,16 +2534,12 @@ var EmbedCode = function EmbedCode(_ref) {
2576
2534
  _useFetchConfiguratio4 = _useFetchConfiguratio3.neetoWidgetTokens,
2577
2535
  neetoWidgetTokens = _useFetchConfiguratio4 === void 0 ? [] : _useFetchConfiguratio4,
2578
2536
  isLoadingConfigurations = _useFetchConfiguratio.isLoading;
2579
- var _useUpdateConfigurati = useUpdateConfigurations(),
2580
- updateWidgetConfiguration = _useUpdateConfigurati.mutate;
2537
+ var _useUpdateConfigurati = useUpdateConfigurations();
2538
+ _useUpdateConfigurati.mutate;
2581
2539
  var previousEmailType = usePrevious(emailType);
2582
- var selectedWidgets = neetoWidgetTokens.filter(function (item) {
2583
- return item.enabled && (shouldShowSwitches() || item.clientApplicationName.toLowerCase() === primaryApp);
2584
- }).map(function (item) {
2585
- return item.clientApplicationName.toLowerCase();
2586
- });
2540
+ var selectedWidgets = [primaryApp];
2587
2541
  var isOnlyChatWidgetSelected = selectedWidgets.length === 1 && selectedWidgets[0] === WIDGET_TYPES.chat;
2588
- var enabledClientApps = neetoWidgetTokens.filter(ramda.prop("clientApplicationEnabled")).map(function (item) {
2542
+ neetoWidgetTokens.filter(ramda.prop("clientApplicationEnabled")).map(function (item) {
2589
2543
  return item.clientApplicationName.toLowerCase();
2590
2544
  });
2591
2545
  var enabledWidgets = ramda.fromPairs(selectedWidgets.map(function (widget) {
@@ -2593,26 +2547,6 @@ var EmbedCode = function EmbedCode(_ref) {
2593
2547
  }));
2594
2548
  var shouldShowUserIdentity = showUserIdentity !== null && showUserIdentity !== void 0 ? showUserIdentity : enabledWidgets.chat || enabledWidgets.replay;
2595
2549
  var shouldShowSessionContext = showSessionContext !== null && showSessionContext !== void 0 ? showSessionContext : enabledWidgets.replay;
2596
- var updateSelectedWidgets = function updateSelectedWidgets(widget) {
2597
- var widgetId = neetoWidgetTokens.find(function (item) {
2598
- return item.clientApplicationName.toLowerCase() === widget;
2599
- }).id;
2600
- var isEnabled = !selectedWidgets.includes(widget);
2601
- updateWidgetConfiguration({
2602
- id: widgetId,
2603
- payload: {
2604
- enabled: isEnabled
2605
- }
2606
- }, {
2607
- onSuccess: function onSuccess() {
2608
- var productName = "neeto".concat(neetoCist.capitalize(widget));
2609
- var response = isEnabled ? "neetoMolecules.widget.installation.enabled" : "neetoMolecules.widget.installation.disabled";
2610
- Toastr.success(t(response, {
2611
- productName: productName
2612
- }));
2613
- }
2614
- });
2615
- };
2616
2550
  var getEmbedCodeString = function getEmbedCodeString() {
2617
2551
  return neetoCist.isNotEmpty(widgetApiKey) ? sampleConsolidatedCodeString(enabledWidgets, widgetApiKey) : "";
2618
2552
  };
@@ -2763,12 +2697,7 @@ var EmbedCode = function EmbedCode(_ref) {
2763
2697
  className: "mx-auto mb-10 w-full flex-col items-center justify-start",
2764
2698
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
2765
2699
  className: classnames("mx-auto", maxWidth),
2766
- children: [shouldShowSwitches() && /*#__PURE__*/jsxRuntime.jsx(SelectionSwitches, {
2767
- enabledClientApps: enabledClientApps,
2768
- primaryApp: primaryApp,
2769
- selectedWidgets: selectedWidgets,
2770
- updateSelectedWidgets: updateSelectedWidgets
2771
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2700
+ children: [shouldShowSwitches(), /*#__PURE__*/jsxRuntime.jsxs("div", {
2772
2701
  className: "mb-8 w-full flex-grow flex-col items-center justify-start",
2773
2702
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2774
2703
  className: "mx-auto mb-2 w-full",
@@ -2810,7 +2739,6 @@ var EmbedCode = function EmbedCode(_ref) {
2810
2739
  }
2811
2740
  })
2812
2741
  }), /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
2813
- i18nKey: "neetoMolecules.widget.installation.instructions.userIdentity",
2814
2742
  components: {
2815
2743
  p: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2816
2744
  style: "body2"
@@ -2821,7 +2749,8 @@ var EmbedCode = function EmbedCode(_ref) {
2821
2749
  target: "_blank",
2822
2750
  href: enabledWidgets.chat ? NEETO_CHAT_USER_IDENTITY_URL : NEETO_REPLAY_CONFIGURE_URL
2823
2751
  })
2824
- }
2752
+ },
2753
+ i18nKey: enabledWidgets.chat ? "neetoMolecules.widget.installation.instructions.userIdentity.chat" : "neetoMolecules.widget.installation.instructions.userIdentity.replay"
2825
2754
  })]
2826
2755
  }) : null, shouldShowSessionContext ? /*#__PURE__*/jsxRuntime.jsxs("div", {
2827
2756
  className: "w-full flex-grow flex-col items-center justify-start",