@schematichq/schematic-react 1.2.1 → 1.2.2
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.
@@ -773,6 +773,7 @@ function contextString(context) {
|
|
773
773
|
}, {});
|
774
774
|
return JSON.stringify(sortedContext);
|
775
775
|
}
|
776
|
+
var version = "1.2.1";
|
776
777
|
var anonymousIdKey = "schematicId";
|
777
778
|
var Schematic = class {
|
778
779
|
additionalHeaders = {};
|
@@ -794,9 +795,10 @@ var Schematic = class {
|
|
794
795
|
this.apiKey = apiKey;
|
795
796
|
this.eventQueue = [];
|
796
797
|
this.useWebSocket = options?.useWebSocket ?? false;
|
797
|
-
|
798
|
-
|
799
|
-
|
798
|
+
this.additionalHeaders = {
|
799
|
+
"X-Schematic-Client-Version": `schematic-js@${version}`,
|
800
|
+
...options?.additionalHeaders ?? {}
|
801
|
+
};
|
800
802
|
if (options?.storage) {
|
801
803
|
this.storage = options.storage;
|
802
804
|
} else if (typeof localStorage !== "undefined") {
|
@@ -1065,7 +1067,7 @@ var Schematic = class {
|
|
1065
1067
|
// Open a websocket connection
|
1066
1068
|
wsConnect = () => {
|
1067
1069
|
return new Promise((resolve, reject) => {
|
1068
|
-
const wsUrl = `${this.webSocketUrl}/flags/bootstrap`;
|
1070
|
+
const wsUrl = `${this.webSocketUrl}/flags/bootstrap?apiKey=${this.apiKey}`;
|
1069
1071
|
const webSocket = new WebSocket(wsUrl);
|
1070
1072
|
webSocket.onopen = () => {
|
1071
1073
|
resolve(webSocket);
|
@@ -1109,6 +1111,7 @@ var Schematic = class {
|
|
1109
1111
|
socket.send(
|
1110
1112
|
JSON.stringify({
|
1111
1113
|
apiKey: this.apiKey,
|
1114
|
+
clientVersion: `schematic-js@${version}`,
|
1112
1115
|
data: context
|
1113
1116
|
})
|
1114
1117
|
);
|
@@ -1205,6 +1208,11 @@ var notifyFlagValueListener = (listener, value) => {
|
|
1205
1208
|
|
1206
1209
|
// src/context/schematic.tsx
|
1207
1210
|
var import_react = __toESM(require("react"));
|
1211
|
+
|
1212
|
+
// src/version.ts
|
1213
|
+
var version2 = "1.2.2";
|
1214
|
+
|
1215
|
+
// src/context/schematic.tsx
|
1208
1216
|
var import_jsx_runtime = require("react/jsx-runtime");
|
1209
1217
|
var SchematicContext = (0, import_react.createContext)(
|
1210
1218
|
null
|
@@ -1218,6 +1226,9 @@ var SchematicProvider = ({
|
|
1218
1226
|
const initialOptsRef = (0, import_react.useRef)({
|
1219
1227
|
publishableKey,
|
1220
1228
|
useWebSocket: clientOpts.useWebSocket ?? true,
|
1229
|
+
additionalHeaders: {
|
1230
|
+
"X-Schematic-Client-Version": `schematic-react@${version2}`
|
1231
|
+
},
|
1221
1232
|
...clientOpts
|
1222
1233
|
});
|
1223
1234
|
const client = (0, import_react.useMemo)(() => {
|
@@ -728,6 +728,7 @@ function contextString(context) {
|
|
728
728
|
}, {});
|
729
729
|
return JSON.stringify(sortedContext);
|
730
730
|
}
|
731
|
+
var version = "1.2.1";
|
731
732
|
var anonymousIdKey = "schematicId";
|
732
733
|
var Schematic = class {
|
733
734
|
additionalHeaders = {};
|
@@ -749,9 +750,10 @@ var Schematic = class {
|
|
749
750
|
this.apiKey = apiKey;
|
750
751
|
this.eventQueue = [];
|
751
752
|
this.useWebSocket = options?.useWebSocket ?? false;
|
752
|
-
|
753
|
-
|
754
|
-
|
753
|
+
this.additionalHeaders = {
|
754
|
+
"X-Schematic-Client-Version": `schematic-js@${version}`,
|
755
|
+
...options?.additionalHeaders ?? {}
|
756
|
+
};
|
755
757
|
if (options?.storage) {
|
756
758
|
this.storage = options.storage;
|
757
759
|
} else if (typeof localStorage !== "undefined") {
|
@@ -1020,7 +1022,7 @@ var Schematic = class {
|
|
1020
1022
|
// Open a websocket connection
|
1021
1023
|
wsConnect = () => {
|
1022
1024
|
return new Promise((resolve, reject) => {
|
1023
|
-
const wsUrl = `${this.webSocketUrl}/flags/bootstrap`;
|
1025
|
+
const wsUrl = `${this.webSocketUrl}/flags/bootstrap?apiKey=${this.apiKey}`;
|
1024
1026
|
const webSocket = new WebSocket(wsUrl);
|
1025
1027
|
webSocket.onopen = () => {
|
1026
1028
|
resolve(webSocket);
|
@@ -1064,6 +1066,7 @@ var Schematic = class {
|
|
1064
1066
|
socket.send(
|
1065
1067
|
JSON.stringify({
|
1066
1068
|
apiKey: this.apiKey,
|
1069
|
+
clientVersion: `schematic-js@${version}`,
|
1067
1070
|
data: context
|
1068
1071
|
})
|
1069
1072
|
);
|
@@ -1160,6 +1163,11 @@ var notifyFlagValueListener = (listener, value) => {
|
|
1160
1163
|
|
1161
1164
|
// src/context/schematic.tsx
|
1162
1165
|
import React, { createContext, useEffect, useMemo, useRef } from "react";
|
1166
|
+
|
1167
|
+
// src/version.ts
|
1168
|
+
var version2 = "1.2.2";
|
1169
|
+
|
1170
|
+
// src/context/schematic.tsx
|
1163
1171
|
import { jsx } from "react/jsx-runtime";
|
1164
1172
|
var SchematicContext = createContext(
|
1165
1173
|
null
|
@@ -1173,6 +1181,9 @@ var SchematicProvider = ({
|
|
1173
1181
|
const initialOptsRef = useRef({
|
1174
1182
|
publishableKey,
|
1175
1183
|
useWebSocket: clientOpts.useWebSocket ?? true,
|
1184
|
+
additionalHeaders: {
|
1185
|
+
"X-Schematic-Client-Version": `schematic-react@${version2}`
|
1186
|
+
},
|
1176
1187
|
...clientOpts
|
1177
1188
|
});
|
1178
1189
|
const client = useMemo(() => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@schematichq/schematic-react",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.2",
|
4
4
|
"main": "dist/schematic-react.cjs.js",
|
5
5
|
"module": "dist/schematic-react.esm.js",
|
6
6
|
"types": "dist/schematic-react.d.ts",
|
@@ -17,7 +17,7 @@
|
|
17
17
|
},
|
18
18
|
"scripts": {
|
19
19
|
"dev": "yarn tsc --watch",
|
20
|
-
"build": "yarn tsc && yarn format && yarn lint && yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
|
20
|
+
"build": "./version.sh && yarn tsc && yarn format && yarn lint && yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
|
21
21
|
"build:cjs": "npx esbuild src/index.ts --bundle --external:react --format=cjs --outfile=dist/schematic-react.cjs.js",
|
22
22
|
"build:esm": "npx esbuild src/index.ts --bundle --external:react --format=esm --outfile=dist/schematic-react.esm.js",
|
23
23
|
"build:types": "npx tsc && npx api-extractor run",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"tsc": "npx tsc"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@schematichq/schematic-js": "^1.2.
|
31
|
+
"@schematichq/schematic-js": "^1.2.1"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@microsoft/api-extractor": "^7.49.2",
|