@quonfig/react-native 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1
4
+
5
+ - Initial release. Thin polyfill wrapper around `@quonfig/react` for React Native. Installs
6
+ `react-native-get-random-values` (needed by the `uuid` dependency inside `@quonfig/javascript`)
7
+ and the `base-64` `btoa` / `atob` shims (needed by the SDK's base64 helper which assumes
8
+ `window.btoa` when `typeof window !== "undefined"`, including under React Native).
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ ISC License
2
+
3
+ Copyright 2026 Reforge
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # @quonfig/react-native
2
+
3
+ React Native bindings for [Quonfig](https://quonfig.com).
4
+
5
+ This package is a thin polyfill wrapper around
6
+ [`@quonfig/react`](https://github.com/quonfig/sdk-react). It installs the two web APIs the
7
+ underlying JavaScript SDK assumes but React Native's JS runtime is missing (`crypto.getRandomValues`
8
+ and `btoa` / `atob`), then re-exports the entire `@quonfig/react` public API. If you need a feature
9
+ that the React SDK does not yet expose to React Native, open an issue.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @quonfig/react-native @quonfig/react base-64 react-native-get-random-values
15
+ # or
16
+ yarn add @quonfig/react-native @quonfig/react base-64 react-native-get-random-values
17
+ ```
18
+
19
+ TypeScript types are included.
20
+
21
+ ## Usage
22
+
23
+ Identical to [`@quonfig/react`](https://github.com/quonfig/sdk-react#usage) — wrap your component
24
+ tree in `QuonfigProvider` and read flags with `useQuonfig`:
25
+
26
+ ```tsx
27
+ import { QuonfigProvider, useQuonfig } from "@quonfig/react-native";
28
+
29
+ const App = () => (
30
+ <QuonfigProvider
31
+ sdkKey="YOUR_SDK_KEY"
32
+ contextAttributes={{ user: { email: "jeffrey@example.com" } }}
33
+ onError={(err) => console.error(err)}
34
+ >
35
+ <Logo />
36
+ </QuonfigProvider>
37
+ );
38
+
39
+ const Logo = () => {
40
+ const { isEnabled } = useQuonfig();
41
+ return isEnabled("new-logo") ? <NewLogo /> : <OldLogo />;
42
+ };
43
+ ```
44
+
45
+ See the [`@quonfig/react` README](https://github.com/quonfig/sdk-react#readme) for the full API
46
+ (`useQuonfig`, `useFlag`, `QuonfigTestProvider`, etc.) and provider prop reference.
47
+
48
+ ## How the polyfills work
49
+
50
+ The entry point is ten lines:
51
+
52
+ ```ts
53
+ import "react-native-get-random-values";
54
+ import { decode, encode } from "base-64";
55
+
56
+ if (typeof global.btoa === "undefined") {
57
+ global.btoa = encode;
58
+ }
59
+ if (typeof global.atob === "undefined") {
60
+ global.atob = decode;
61
+ }
62
+
63
+ export * from "@quonfig/react";
64
+ ```
65
+
66
+ - **`react-native-get-random-values`** polyfills `crypto.getRandomValues()`, which the `uuid`
67
+ package (used by `@quonfig/javascript` to generate the per-instance hash) requires.
68
+ - **`base-64`** provides `btoa` / `atob`. `@quonfig/javascript`'s base64 helper assumes `btoa` is
69
+ available whenever `typeof window !== "undefined"`, which is true under React Native — but RN's JS
70
+ runtime does not ship `btoa` natively.
71
+
72
+ ## License
73
+
74
+ ISC
package/dist/index.cjs ADDED
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ require('react-native-get-random-values');
4
+ var base64 = require('base-64');
5
+ var react = require('@quonfig/react');
6
+
7
+ // src/index.ts
8
+ if (typeof global.btoa === "undefined") {
9
+ global.btoa = base64.encode;
10
+ }
11
+ if (typeof global.atob === "undefined") {
12
+ global.atob = base64.decode;
13
+ }
14
+
15
+ Object.keys(react).forEach(function (k) {
16
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
17
+ enumerable: true,
18
+ get: function () { return react[k]; }
19
+ });
20
+ });
21
+ //# sourceMappingURL=index.cjs.map
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["encode","decode"],"mappings":";;;;;;;AAGA,IAAI,OAAO,MAAA,CAAO,IAAA,KAAS,WAAA,EAAa;AACtC,EAAA,MAAA,CAAO,IAAA,GAAOA,aAAA;AAChB;AACA,IAAI,OAAO,MAAA,CAAO,IAAA,KAAS,WAAA,EAAa;AACtC,EAAA,MAAA,CAAO,IAAA,GAAOC,aAAA;AAChB","file":"index.cjs","sourcesContent":["import \"react-native-get-random-values\";\nimport { decode, encode } from \"base-64\";\n\nif (typeof global.btoa === \"undefined\") {\n global.btoa = encode;\n}\nif (typeof global.atob === \"undefined\") {\n global.atob = decode;\n}\n\nexport * from \"@quonfig/react\";\n"]}
@@ -0,0 +1 @@
1
+ export * from '@quonfig/react';
@@ -0,0 +1 @@
1
+ export * from '@quonfig/react';
package/dist/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import 'react-native-get-random-values';
2
+ import { encode, decode } from 'base-64';
3
+ export * from '@quonfig/react';
4
+
5
+ // src/index.ts
6
+ if (typeof global.btoa === "undefined") {
7
+ global.btoa = encode;
8
+ }
9
+ if (typeof global.atob === "undefined") {
10
+ global.atob = decode;
11
+ }
12
+ //# sourceMappingURL=index.mjs.map
13
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAGA,IAAI,OAAO,MAAA,CAAO,IAAA,KAAS,WAAA,EAAa;AACtC,EAAA,MAAA,CAAO,IAAA,GAAO,MAAA;AAChB;AACA,IAAI,OAAO,MAAA,CAAO,IAAA,KAAS,WAAA,EAAa;AACtC,EAAA,MAAA,CAAO,IAAA,GAAO,MAAA;AAChB","file":"index.mjs","sourcesContent":["import \"react-native-get-random-values\";\nimport { decode, encode } from \"base-64\";\n\nif (typeof global.btoa === \"undefined\") {\n global.btoa = encode;\n}\nif (typeof global.atob === \"undefined\") {\n global.atob = decode;\n}\n\nexport * from \"@quonfig/react\";\n"]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "packageManager": "yarn@4.11.0",
3
+ "name": "@quonfig/react-native",
4
+ "version": "0.0.1",
5
+ "description": "React Native bindings for Quonfig — a thin polyfill wrapper around @quonfig/react",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/quonfig/sdk-react-native.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/quonfig/sdk-react-native/issues"
15
+ },
16
+ "homepage": "https://github.com/quonfig/sdk-react-native#readme",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.mjs",
21
+ "require": "./dist/index.cjs",
22
+ "default": "./dist/index.cjs"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist/",
27
+ "README.md",
28
+ "LICENSE",
29
+ "CHANGELOG.md"
30
+ ],
31
+ "engines": {
32
+ "node": ">=20.9.0"
33
+ },
34
+ "scripts": {
35
+ "build": "rm -rf dist/ && tsup",
36
+ "dev": "tsup --watch",
37
+ "lint": "tsc --noEmit",
38
+ "prettier": "prettier . -l",
39
+ "prettier:fix": "prettier --write .",
40
+ "prettier:check": "prettier . -l",
41
+ "version": "prettier --write CHANGELOG.md README.md && git add CHANGELOG.md README.md"
42
+ },
43
+ "author": "Jeffrey Chupp",
44
+ "license": "ISC",
45
+ "keywords": [
46
+ "feature-flags",
47
+ "config",
48
+ "react-native"
49
+ ],
50
+ "dependencies": {
51
+ "base-64": "^1.0.0",
52
+ "react-native-get-random-values": "^1.11.0"
53
+ },
54
+ "peerDependencies": {
55
+ "@quonfig/react": ">=0.0.13",
56
+ "react": "^18 || ^19",
57
+ "react-native": ">=0.70"
58
+ },
59
+ "devDependencies": {
60
+ "@quonfig/react": "portal:../sdk-react",
61
+ "@types/base-64": "^1.0.2",
62
+ "@types/node": "^18.6.5",
63
+ "prettier": "^3.0.0",
64
+ "tsup": "^8.4.0",
65
+ "typescript": "^5.4.0"
66
+ }
67
+ }