@deepfrog/pangents-widget 2.1.5 → 2.2.0

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 __privateWrapper = (obj, member, setter, getter) => ({
28
28
  var _provider, _providerCalled, _a, _focused, _cleanup, _setup, _b, _online, _cleanup2, _setup2, _c, _gcTimeout, _d, _initialState, _revertState, _cache, _client, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, dispatch_fn, _e, _client2, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _f, _client3, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _g, _mutations, _scopes, _mutationId, _h, _client4, _currentResult2, _currentMutation, _mutateOptions, _MutationObserver_instances, updateResult_fn, notify_fn2, _i, _queries, _j, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _k;
29
29
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
30
30
  import * as React from "react";
31
- import React__default, { useReducer, useRef, useEffect, createContext, useContext, useLayoutEffect, useId, useInsertionEffect, useMemo, useCallback, Children, isValidElement, useState, Fragment as Fragment$1, createElement, forwardRef, Component } from "react";
31
+ import React__default, { createContext, useContext, useReducer, useRef, useEffect, useLayoutEffect, useId, useInsertionEffect, useMemo, useCallback, Children, isValidElement, useState, Fragment as Fragment$1, createElement, forwardRef, Component } from "react";
32
32
  import ReactDOM from "react-dom";
33
33
  var Subscribable = class {
34
34
  constructor() {
@@ -17839,7 +17839,7 @@ const useEmailLeadsStore = create()(
17839
17839
  }
17840
17840
  }))
17841
17841
  );
17842
- function WidgetBubble({ position = "bottom-right", margin }) {
17842
+ function WidgetBubble({ position = "bottom-right", margin, zIndex }) {
17843
17843
  const { openWidget, theme, isOpen, isAuthenticated } = useChatContext();
17844
17844
  const { hasNewLeads, newLeadsCount, startPolling, stopPolling, clearNewLeadsNotification } = useEmailLeadsStore();
17845
17845
  useEffect(() => {
@@ -17868,7 +17868,7 @@ function WidgetBubble({ position = "bottom-right", margin }) {
17868
17868
  return "fixed bottom-6 right-6 z-50";
17869
17869
  }
17870
17870
  };
17871
- return /* @__PURE__ */ jsx("div", { className: getPositionClasses(), style: { margin: margin || void 0 }, children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
17871
+ return /* @__PURE__ */ jsx("div", { className: getPositionClasses(), style: { margin: margin || void 0, zIndex: zIndex || void 0 }, children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
17872
17872
  /* @__PURE__ */ jsxs(
17873
17873
  Button,
17874
17874
  {
@@ -29380,7 +29380,7 @@ function WidgetContent() {
29380
29380
  /* @__PURE__ */ jsx(PoweredByFooter, {})
29381
29381
  ] });
29382
29382
  }
29383
- function WidgetPopup({ position = "bottom-right" }) {
29383
+ function WidgetPopup({ position = "bottom-right", zIndex }) {
29384
29384
  const { isOpen, theme, closeWidget, isAuthenticated } = useChatContext();
29385
29385
  const isLeftPosition = position === "bottom-left" || position === "top-left";
29386
29386
  const containerRef = useRef(null);
@@ -29504,6 +29504,7 @@ function WidgetPopup({ position = "bottom-right" }) {
29504
29504
  motion.div,
29505
29505
  {
29506
29506
  className: "fixed inset-0 z-50",
29507
+ style: { zIndex: zIndex ?? 50 },
29507
29508
  initial: { opacity: 0 },
29508
29509
  animate: { opacity: 1 },
29509
29510
  exit: { opacity: 0 },
@@ -29673,10 +29674,22 @@ function WidgetPopup({ position = "bottom-right" }) {
29673
29674
  }
29674
29675
  ) });
29675
29676
  }
29676
- function Widget({ theme, className, position, margin, pangentsApiKey, tenantId, email }) {
29677
+ function Widget({ theme, className, position, margin, pangentsApiKey, tenantId, email, zIndex }) {
29678
+ useEffect(() => {
29679
+ try {
29680
+ const css = window.__PANGENTS_WIDGET_CSS;
29681
+ if (css && !document.getElementById("pangents-widget-styles")) {
29682
+ const style = document.createElement("style");
29683
+ style.id = "pangents-widget-styles";
29684
+ style.textContent = css;
29685
+ document.head.appendChild(style);
29686
+ }
29687
+ } catch {
29688
+ }
29689
+ }, []);
29677
29690
  return /* @__PURE__ */ jsx("div", { className: className ? `pg-widget-root ${className}` : "pg-widget-root", children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs(ChatProvider, { initialTheme: theme, apiKey: pangentsApiKey, tenantId, email, children: [
29678
- /* @__PURE__ */ jsx(WidgetBubble, { position, margin }),
29679
- /* @__PURE__ */ jsx(WidgetPopup, { position })
29691
+ /* @__PURE__ */ jsx(WidgetBubble, { position, margin, zIndex }),
29692
+ /* @__PURE__ */ jsx(WidgetPopup, { position, zIndex })
29680
29693
  ] }) }) });
29681
29694
  }
29682
29695
  var client = {};
@@ -29820,4 +29833,4 @@ export {
29820
29833
  Chatbot as C,
29821
29834
  Widget as W
29822
29835
  };
29823
- //# sourceMappingURL=widget-embed-LzSoeVtX.es.js.map
29836
+ //# sourceMappingURL=widget-embed-CtD27t5y.es.js.map