@trycourier/react-provider 6.2.1-internal.a46dd24.0 → 6.2.2-internal.85dadd6.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.
package/dist/index.js CHANGED
@@ -41,8 +41,6 @@ var _deepExtend = _interopRequireDefault(require("deep-extend"));
41
41
 
42
42
  var _theme2 = require("./theme");
43
43
 
44
- var _styledComponents = require("styled-components");
45
-
46
44
  var _useIsOnline = require("./hooks/use-is-online");
47
45
 
48
46
  var _useListenForTransport = require("./hooks/use-listen-for-transport");
@@ -76,20 +74,25 @@ var registerReducer = _reducer.registerReducer;
76
74
  exports.registerReducer = registerReducer;
77
75
  var registerMiddleware = _middleware.registerMiddleware;
78
76
  exports.registerMiddleware = registerMiddleware;
79
- var GlobalThemeVariables = (0, _styledComponents.createGlobalStyle)(function (_ref) {
80
- var _theme$variables, _theme$variables2, _theme$variables3, _theme$variables4, _theme$variables5;
81
-
82
- var theme = _ref.theme;
83
- return {
84
- ":root": {
85
- "--ci-background": theme === null || theme === void 0 ? void 0 : (_theme$variables = theme.variables) === null || _theme$variables === void 0 ? void 0 : _theme$variables.background,
86
- "--ci-text-color": theme === null || theme === void 0 ? void 0 : (_theme$variables2 = theme.variables) === null || _theme$variables2 === void 0 ? void 0 : _theme$variables2.textColor,
87
- "--ci-title-color": theme === null || theme === void 0 ? void 0 : (_theme$variables3 = theme.variables) === null || _theme$variables3 === void 0 ? void 0 : _theme$variables3.titleColor,
88
- "--ci-structure": theme === null || theme === void 0 ? void 0 : (_theme$variables4 = theme.variables) === null || _theme$variables4 === void 0 ? void 0 : _theme$variables4.structure,
89
- "--ci-icon": theme === null || theme === void 0 ? void 0 : (_theme$variables5 = theme.variables) === null || _theme$variables5 === void 0 ? void 0 : _theme$variables5.icon
90
- }
91
- };
92
- });
77
+
78
+ var GlobalThemeVariables = function GlobalThemeVariables(_ref) {
79
+ var variables = _ref.variables;
80
+ (0, _react.useEffect)(function () {
81
+ var setGlobalThemeVariables = function setGlobalThemeVariables(variables) {
82
+ var _variables$background, _variables$textColor, _variables$titleColor, _variables$structure, _variables$icon;
83
+
84
+ var root = document.documentElement;
85
+ root.style.setProperty("--ci-background", (_variables$background = variables === null || variables === void 0 ? void 0 : variables.background) !== null && _variables$background !== void 0 ? _variables$background : null);
86
+ root.style.setProperty("--ci-text-color", (_variables$textColor = variables === null || variables === void 0 ? void 0 : variables.textColor) !== null && _variables$textColor !== void 0 ? _variables$textColor : null);
87
+ root.style.setProperty("--ci-title-color", (_variables$titleColor = variables === null || variables === void 0 ? void 0 : variables.titleColor) !== null && _variables$titleColor !== void 0 ? _variables$titleColor : null);
88
+ root.style.setProperty("--ci-structure", (_variables$structure = variables === null || variables === void 0 ? void 0 : variables.structure) !== null && _variables$structure !== void 0 ? _variables$structure : null);
89
+ root.style.setProperty("--ci-icon", (_variables$icon = variables === null || variables === void 0 ? void 0 : variables.icon) !== null && _variables$icon !== void 0 ? _variables$icon : null);
90
+ };
91
+
92
+ setGlobalThemeVariables(variables);
93
+ }, [variables]);
94
+ return null;
95
+ };
93
96
 
94
97
  var CourierContext = /*#__PURE__*/_react["default"].createContext(undefined);
95
98
 
@@ -149,10 +152,10 @@ var CourierProviderInner = function CourierProviderInner(_ref2) {
149
152
  wsOptions: wsOptions
150
153
  });
151
154
  var theme = (0, _react.useMemo)(function () {
152
- var _theme$variables6;
155
+ var _theme$variables;
153
156
 
154
157
  return _objectSpread(_objectSpread({}, _theme), {}, {
155
- variables: (0, _deepExtend["default"])({}, (_theme === null || _theme === void 0 ? void 0 : _theme.colorMode) === "dark" ? _theme2.darkVariables : _theme2.lightVariables, (_theme$variables6 = _theme === null || _theme === void 0 ? void 0 : _theme.variables) !== null && _theme$variables6 !== void 0 ? _theme$variables6 : {})
158
+ variables: (0, _deepExtend["default"])({}, (_theme === null || _theme === void 0 ? void 0 : _theme.colorMode) === "dark" ? _theme2.darkVariables : _theme2.lightVariables, (_theme$variables = _theme === null || _theme === void 0 ? void 0 : _theme.variables) !== null && _theme$variables !== void 0 ? _theme$variables : {})
156
159
  });
157
160
  }, [_theme]);
158
161
 
@@ -271,7 +274,7 @@ var CourierProviderInner = function CourierProviderInner(_ref2) {
271
274
  clientSourceId: clientSourceId
272
275
  })
273
276
  }, /*#__PURE__*/_react["default"].createElement(GlobalThemeVariables, {
274
- theme: theme
277
+ variables: theme.variables
275
278
  }), children);
276
279
  };
277
280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/react-provider",
3
- "version": "6.2.1-internal.a46dd24.0+a46dd24",
3
+ "version": "6.2.2-internal.85dadd6.0+85dadd6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "typings/index.d.ts",
@@ -15,10 +15,10 @@
15
15
  },
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@trycourier/client-graphql": "^6.2.1-internal.a46dd24.0+a46dd24",
19
- "@trycourier/core": "^6.2.1-internal.a46dd24.0+a46dd24",
18
+ "@trycourier/client-graphql": "^6.2.2-internal.85dadd6.0+85dadd6",
19
+ "@trycourier/core": "^6.2.2-internal.85dadd6.0+85dadd6",
20
20
  "@trycourier/courier-js": "^1.4.2",
21
- "@trycourier/transport": "^6.2.1-internal.a46dd24.0+a46dd24",
21
+ "@trycourier/transport": "^6.2.2-internal.85dadd6.0+85dadd6",
22
22
  "buffer": "^6.0.3",
23
23
  "jwt-decode": "^3.1.2",
24
24
  "react-use": "^17.2.1",
@@ -34,5 +34,5 @@
34
34
  "dist/",
35
35
  "typings/"
36
36
  ],
37
- "gitHead": "a46dd24c1ce08bd085cf47527366eefa9e03e5b5"
37
+ "gitHead": "85dadd6dbd1b261c95b2c6d302660d367a96816b"
38
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAIZ,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,OAAO,EACP,aAAa,EAEd,MAAM,SAAS,CAAC;AAMjB,OAA0B,EACxB,UAAU,EAEX,MAAM,cAAc,CAAC;AAUtB,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB,8CAAsB,CAAC;AAEtD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;AAkBpE,eAAO,MAAM,cAAc,4CACkC,CAAC;AAsO9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACnD,iBAAiB,CAAC,qBAAqB,CAAC,CAQzC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAIZ,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,OAAO,EACP,aAAa,EAEd,MAAM,SAAS,CAAC;AAMjB,OAA0B,EACxB,UAAU,EAEX,MAAM,cAAc,CAAC;AAStB,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,eAAe,oCAAmB,CAAC;AAChD,eAAO,MAAM,kBAAkB,8CAAsB,CAAC;AAEtD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;AAqBpE,eAAO,MAAM,cAAc,4CACkC,CAAC;AAsO9D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACnD,iBAAiB,CAAC,qBAAqB,CAAC,CAQzC,CAAC"}