@teamkeel/client-react 0.365.14 → 0.365.15-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamkeel/client-react",
3
- "version": "0.365.14",
3
+ "version": "0.365.15-28",
4
4
  "description": "React helpers for Keel clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/dist/index.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- interface KeelProviderProps<T extends new (...args: any[]) => any, U = Omit<ConstructorParameters<T>[0], "endpoint">> {
3
- /**
4
- * The base URL for the client.
5
- */
6
- baseUrl: string;
7
- /**
8
- * Additional config options for the client.
9
- */
10
- config?: U;
11
- children: React.ReactNode;
12
- }
13
- export declare const keel: <T extends new (...args: any[]) => any>(Client: T) => {
14
- KeelProvider: ({ baseUrl, config, children, }: KeelProviderProps<T, Omit<ConstructorParameters<T>[0], "endpoint">>) => JSX.Element;
15
- useKeel: () => InstanceType<T>;
16
- };
17
- export {};
package/dist/index.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.keel = void 0;
27
- const react_1 = __importStar(require("react"));
28
- const KeelContext = (0, react_1.createContext)({
29
- client: null,
30
- });
31
- const keel = (Client) => {
32
- function KeelProvider({ baseUrl, config, children, }) {
33
- if (typeof Client !== "function") {
34
- throw new Error("Client must be a Keel class");
35
- }
36
- const clientConstructor = Client;
37
- const clientArgs = { baseUrl, ...config };
38
- const clientRef = (0, react_1.useRef)(new clientConstructor(clientArgs));
39
- const client = clientRef.current;
40
- (0, react_1.useEffect)(() => {
41
- client.client.setBaseUrl(baseUrl);
42
- }, [baseUrl, client]);
43
- return (react_1.default.createElement(KeelContext.Provider, { value: { client } }, children));
44
- }
45
- return {
46
- KeelProvider: (KeelProvider),
47
- useKeel: (useKeel),
48
- };
49
- };
50
- exports.keel = keel;
51
- function useKeel() {
52
- const keelContext = (0, react_1.useContext)(KeelContext);
53
- if (!keelContext) {
54
- throw new Error("useKeel must be used within a KeelProvider");
55
- }
56
- return keelContext.client;
57
- }
58
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4E;AAM5E,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAuB;IACtD,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAiBI,MAAM,IAAI,GAAG,CAAwC,MAAS,EAAE,EAAE;IACvE,SAAS,YAAY,CAAwC,EAC3D,OAAO,EACP,MAAM,EACN,QAAQ,GACa;QACrB,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,MAAM,iBAAiB,GAAG,M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