@bcrumbs.net/inbox 0.0.5 → 0.0.6

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/index.cjs.js CHANGED
@@ -48654,6 +48654,8 @@ const P="RadioGroup",[S$1]=createContextScope$7(P,[createRadioGroupScope]),l=cre
48654
48654
 
48655
48655
  const BLUR_CONTAINER = 'root';
48656
48656
  const LOADING_COLOR = bcUi.Color.PRIMARY;
48657
+ const FavIcon16 = "https://cdn.bcrumbs.net/bc-assets/icons/favicons/favicon-16x16.png";
48658
+ const FavIcon32 = "https://cdn.bcrumbs.net/bc-assets/icons/favicons/favicon-32x32.png";
48657
48659
 
48658
48660
  const themeContext = /*#__PURE__*/React$1.createContext(undefined);
48659
48661
  function useThemeContext() {
@@ -48663,6 +48665,49 @@ function useThemeContext() {
48663
48665
  }
48664
48666
  return context;
48665
48667
  }
48668
+ function ThemeProvider({
48669
+ children,
48670
+ config
48671
+ }) {
48672
+ const [rtl, setRtl] = React$1.useState(bcShared.LangService.getLang() === 'ar' ? true : false);
48673
+ const toggleLang = React$1.useCallback(() => {
48674
+ const lang = bcShared.LangService.getLang();
48675
+ setRtl(lang === 'ar' ? true : false);
48676
+ }, []);
48677
+ React$1.useEffect(() => {
48678
+ const link16 = document.querySelector("link[rel='icon'][sizes='16x16']");
48679
+ const link32 = document.querySelector("link[rel='icon'][sizes='32x32']");
48680
+ if (link16) {
48681
+ if (config === null || config === void 0 ? void 0 : config.favIcon16) {
48682
+ link16.href = config.favIcon16;
48683
+ } else {
48684
+ link16.href = FavIcon16;
48685
+ }
48686
+ }
48687
+ if (link32) {
48688
+ if (config === null || config === void 0 ? void 0 : config.favIcon32) {
48689
+ link32.href = config.favIcon32;
48690
+ } else {
48691
+ link32.href = FavIcon32;
48692
+ }
48693
+ }
48694
+ }, [config]);
48695
+ return jsx(themeContext.Provider, {
48696
+ value: config ? Object.assign({
48697
+ rtl,
48698
+ toggleLang
48699
+ }, config) : {
48700
+ rtl,
48701
+ toggleLang
48702
+ },
48703
+ children: jsx("div", {
48704
+ style: {
48705
+ direction: rtl ? 'rtl' : 'ltr'
48706
+ },
48707
+ children: children
48708
+ })
48709
+ });
48710
+ }
48666
48711
 
48667
48712
  const useCanContribute = ({
48668
48713
  agents,
@@ -63509,3 +63554,5 @@ Object.defineProperty(exports, "auth", {
63509
63554
  get: function () { return bcShared.auth; }
63510
63555
  });
63511
63556
  exports.Inbox = Inbox;
63557
+ exports.ThemeProvider = ThemeProvider;
63558
+ exports.useThemeContext = useThemeContext;
package/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { Fragment as Fragment$1, jsx as jsx$1, jsxs as jsxs$1 } from 'react/jsx-
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { forwardRef, useContext as useContext$1, createContext, useState, useRef, useEffect, useMemo, useLayoutEffect, useCallback, useDebugValue, createElement, Component, useReducer } from 'react';
6
6
  import { coreClient, botClient, ModelFieldsTypes, companyUsersQuery, dconfigClient } from '@bcrumbs.net/bc-api';
7
- import { auth, BCRoutes, LangService } from '@bcrumbs.net/bc-shared';
7
+ import { auth, LangService, BCRoutes } from '@bcrumbs.net/bc-shared';
8
8
  export { auth } from '@bcrumbs.net/bc-shared';
9
9
  import { usePolling, Color, BCText, TextSize, TextWeight, BCButton, ButtonSize, BCPopup, BCHorizontalLayout, FlexAlignItems, FlexJustifyContent, triggerErrorToast, BCDropList, BCLoading, BCValidationTypes, useBCForm, BCVerticalLayout, BCTextbox, BCSkeleton, TextAlign, BCIcons, BCInputWithSuggestions, BCTooltip, BCScrollArea, ScrollAreaSize } from '@bcrumbs.net/bc-ui';
10
10
  import { BlobServiceClient, AnonymousCredential } from '@azure/storage-blob';
@@ -48635,6 +48635,8 @@ const P="RadioGroup",[S$1]=createContextScope$7(P,[createRadioGroupScope]),l=cre
48635
48635
 
48636
48636
  const BLUR_CONTAINER = 'root';
48637
48637
  const LOADING_COLOR = Color.PRIMARY;
48638
+ const FavIcon16 = "https://cdn.bcrumbs.net/bc-assets/icons/favicons/favicon-16x16.png";
48639
+ const FavIcon32 = "https://cdn.bcrumbs.net/bc-assets/icons/favicons/favicon-32x32.png";
48638
48640
 
48639
48641
  const themeContext = /*#__PURE__*/createContext(undefined);
48640
48642
  function useThemeContext() {
@@ -48644,6 +48646,49 @@ function useThemeContext() {
48644
48646
  }
48645
48647
  return context;
48646
48648
  }
48649
+ function ThemeProvider({
48650
+ children,
48651
+ config
48652
+ }) {
48653
+ const [rtl, setRtl] = useState(LangService.getLang() === 'ar' ? true : false);
48654
+ const toggleLang = useCallback(() => {
48655
+ const lang = LangService.getLang();
48656
+ setRtl(lang === 'ar' ? true : false);
48657
+ }, []);
48658
+ useEffect(() => {
48659
+ const link16 = document.querySelector("link[rel='icon'][sizes='16x16']");
48660
+ const link32 = document.querySelector("link[rel='icon'][sizes='32x32']");
48661
+ if (link16) {
48662
+ if (config === null || config === void 0 ? void 0 : config.favIcon16) {
48663
+ link16.href = config.favIcon16;
48664
+ } else {
48665
+ link16.href = FavIcon16;
48666
+ }
48667
+ }
48668
+ if (link32) {
48669
+ if (config === null || config === void 0 ? void 0 : config.favIcon32) {
48670
+ link32.href = config.favIcon32;
48671
+ } else {
48672
+ link32.href = FavIcon32;
48673
+ }
48674
+ }
48675
+ }, [config]);
48676
+ return jsx(themeContext.Provider, {
48677
+ value: config ? Object.assign({
48678
+ rtl,
48679
+ toggleLang
48680
+ }, config) : {
48681
+ rtl,
48682
+ toggleLang
48683
+ },
48684
+ children: jsx("div", {
48685
+ style: {
48686
+ direction: rtl ? 'rtl' : 'ltr'
48687
+ },
48688
+ children: children
48689
+ })
48690
+ });
48691
+ }
48647
48692
 
48648
48693
  const useCanContribute = ({
48649
48694
  agents,
@@ -63485,4 +63530,4 @@ const Inbox = ({
63485
63530
  });
63486
63531
  };
63487
63532
 
63488
- export { Inbox };
63533
+ export { Inbox, ThemeProvider, useThemeContext };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/inbox",
3
3
  "description": "Inbox widget for Bread Crumbs portals",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "keyword": [
6
6
  "bcrumbs",
7
7
  "bc-ui",
@@ -1,2 +1,3 @@
1
1
  export { Inbox } from './inbox';
2
2
  export { auth } from '@bcrumbs.net/bc-shared';
3
+ export { ThemeProvider, useThemeContext } from '../context/themeContext';