@compilot/react-sdk 2.2.7-dev → 2.3.2-dev

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.
@@ -222,6 +222,7 @@ var ComPilotContext = /*#__PURE__*/react.createContext(null);
222
222
  * @example
223
223
  *
224
224
  * Basic
225
+ *
225
226
  * ```tsx
226
227
  * import { ComPilotProvider } from "@compilot/react-sdk";
227
228
  * import { config } from "./config";
@@ -236,6 +237,7 @@ var ComPilotContext = /*#__PURE__*/react.createContext(null);
236
237
  * ```
237
238
  *
238
239
  * With AutoLoader disabled
240
+ *
239
241
  * ```tsx
240
242
  * import { ComPilotProvider } from "@compilot/react-sdk";
241
243
  * import { config } from "./config";
@@ -788,7 +790,8 @@ var useOpenWidget = function useOpenWidget(loginParams) {
788
790
  *
789
791
  * @example
790
792
  *
791
- * ### EIP-155 Transaction Wagmi Example
793
+ * ##### EIP-155 Transaction Wagmi Example
794
+ *
792
795
  * ```tsx
793
796
  * import { useGetTxAuthDataSignature } from "@compilot/react-sdk";
794
797
  * import { waitForTransactionReceipt } from "viem/actions";
@@ -1104,14 +1107,17 @@ var useAsyncQueryState = function useAsyncQueryState(_ref) {
1104
1107
  * ```
1105
1108
  *
1106
1109
  * Output:
1110
+ *
1107
1111
  * ```tsx
1108
1112
  * <div>User is verified: true</div>
1109
1113
  * ```
1110
1114
  */
1111
1115
  var useCustomerStatus = function useCustomerStatus() {
1112
1116
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1117
+ refreshOnMount: true,
1113
1118
  refreshInterval: 10000
1114
1119
  },
1120
+ refreshOnMount = _ref.refreshOnMount,
1115
1121
  refreshInterval = _ref.refreshInterval;
1116
1122
  var config = useComPilotConfig();
1117
1123
  var _useAsyncQueryState = useAsyncQueryState({
@@ -1132,18 +1138,47 @@ var useCustomerStatus = function useCustomerStatus() {
1132
1138
  };
1133
1139
  }, [config._internal.externalEventEmitter, config._internal.identifier]);
1134
1140
  react.useEffect(function () {
1135
- startLoading();
1141
+ var updateStatus = /*#__PURE__*/function () {
1142
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1143
+ var status;
1144
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1145
+ while (1) switch (_context.prev = _context.next) {
1146
+ case 0:
1147
+ _context.prev = 0;
1148
+ _context.next = 3;
1149
+ return webSdk.getCustomerStatus(config);
1150
+ case 3:
1151
+ status = _context.sent;
1152
+ setResult(status);
1153
+ _context.next = 10;
1154
+ break;
1155
+ case 7:
1156
+ _context.prev = 7;
1157
+ _context.t0 = _context["catch"](0);
1158
+ setError(_context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0)));
1159
+ case 10:
1160
+ case "end":
1161
+ return _context.stop();
1162
+ }
1163
+ }, _callee, null, [[0, 7]]);
1164
+ }));
1165
+ return function updateStatus() {
1166
+ return _ref2.apply(this, arguments);
1167
+ };
1168
+ }();
1169
+ if (refreshOnMount) {
1170
+ if (state.data === undefined) {
1171
+ startLoading();
1172
+ void updateStatus();
1173
+ }
1174
+ }
1136
1175
  var interval = setInterval(function () {
1137
- webSdk.getCustomerStatus(config).then(function (status) {
1138
- setResult(status);
1139
- })["catch"](function (error) {
1140
- setError(error instanceof Error ? error : new Error(String(error)));
1141
- });
1176
+ return void updateStatus();
1142
1177
  }, refreshInterval);
1143
1178
  return function () {
1144
1179
  clearInterval(interval);
1145
1180
  };
1146
- }, [config._internal.identifier, refreshInterval, config, setError, setResult, startLoading]);
1181
+ }, [config._internal.identifier, refreshInterval, state.data, config, setError, setResult, startLoading]);
1147
1182
  return state;
1148
1183
  };
1149
1184
 
@@ -222,6 +222,7 @@ var ComPilotContext = /*#__PURE__*/react.createContext(null);
222
222
  * @example
223
223
  *
224
224
  * Basic
225
+ *
225
226
  * ```tsx
226
227
  * import { ComPilotProvider } from "@compilot/react-sdk";
227
228
  * import { config } from "./config";
@@ -236,6 +237,7 @@ var ComPilotContext = /*#__PURE__*/react.createContext(null);
236
237
  * ```
237
238
  *
238
239
  * With AutoLoader disabled
240
+ *
239
241
  * ```tsx
240
242
  * import { ComPilotProvider } from "@compilot/react-sdk";
241
243
  * import { config } from "./config";
@@ -788,7 +790,8 @@ var useOpenWidget = function useOpenWidget(loginParams) {
788
790
  *
789
791
  * @example
790
792
  *
791
- * ### EIP-155 Transaction Wagmi Example
793
+ * ##### EIP-155 Transaction Wagmi Example
794
+ *
792
795
  * ```tsx
793
796
  * import { useGetTxAuthDataSignature } from "@compilot/react-sdk";
794
797
  * import { waitForTransactionReceipt } from "viem/actions";
@@ -1104,14 +1107,17 @@ var useAsyncQueryState = function useAsyncQueryState(_ref) {
1104
1107
  * ```
1105
1108
  *
1106
1109
  * Output:
1110
+ *
1107
1111
  * ```tsx
1108
1112
  * <div>User is verified: true</div>
1109
1113
  * ```
1110
1114
  */
1111
1115
  var useCustomerStatus = function useCustomerStatus() {
1112
1116
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1117
+ refreshOnMount: true,
1113
1118
  refreshInterval: 10000
1114
1119
  },
1120
+ refreshOnMount = _ref.refreshOnMount,
1115
1121
  refreshInterval = _ref.refreshInterval;
1116
1122
  var config = useComPilotConfig();
1117
1123
  var _useAsyncQueryState = useAsyncQueryState({
@@ -1132,18 +1138,47 @@ var useCustomerStatus = function useCustomerStatus() {
1132
1138
  };
1133
1139
  }, [config._internal.externalEventEmitter, config._internal.identifier]);
1134
1140
  react.useEffect(function () {
1135
- startLoading();
1141
+ var updateStatus = /*#__PURE__*/function () {
1142
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1143
+ var status;
1144
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1145
+ while (1) switch (_context.prev = _context.next) {
1146
+ case 0:
1147
+ _context.prev = 0;
1148
+ _context.next = 3;
1149
+ return webSdk.getCustomerStatus(config);
1150
+ case 3:
1151
+ status = _context.sent;
1152
+ setResult(status);
1153
+ _context.next = 10;
1154
+ break;
1155
+ case 7:
1156
+ _context.prev = 7;
1157
+ _context.t0 = _context["catch"](0);
1158
+ setError(_context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0)));
1159
+ case 10:
1160
+ case "end":
1161
+ return _context.stop();
1162
+ }
1163
+ }, _callee, null, [[0, 7]]);
1164
+ }));
1165
+ return function updateStatus() {
1166
+ return _ref2.apply(this, arguments);
1167
+ };
1168
+ }();
1169
+ if (refreshOnMount) {
1170
+ if (state.data === undefined) {
1171
+ startLoading();
1172
+ void updateStatus();
1173
+ }
1174
+ }
1136
1175
  var interval = setInterval(function () {
1137
- webSdk.getCustomerStatus(config).then(function (status) {
1138
- setResult(status);
1139
- })["catch"](function (error) {
1140
- setError(error instanceof Error ? error : new Error(String(error)));
1141
- });
1176
+ return void updateStatus();
1142
1177
  }, refreshInterval);
1143
1178
  return function () {
1144
1179
  clearInterval(interval);
1145
1180
  };
1146
- }, [config._internal.identifier, refreshInterval, config, setError, setResult, startLoading]);
1181
+ }, [config._internal.identifier, refreshInterval, state.data, config, setError, setResult, startLoading]);
1147
1182
  return state;
1148
1183
  };
1149
1184
 
@@ -219,6 +219,7 @@ var ComPilotContext = /*#__PURE__*/createContext(null);
219
219
  * @example
220
220
  *
221
221
  * Basic
222
+ *
222
223
  * ```tsx
223
224
  * import { ComPilotProvider } from "@compilot/react-sdk";
224
225
  * import { config } from "./config";
@@ -233,6 +234,7 @@ var ComPilotContext = /*#__PURE__*/createContext(null);
233
234
  * ```
234
235
  *
235
236
  * With AutoLoader disabled
237
+ *
236
238
  * ```tsx
237
239
  * import { ComPilotProvider } from "@compilot/react-sdk";
238
240
  * import { config } from "./config";
@@ -785,7 +787,8 @@ var useOpenWidget = function useOpenWidget(loginParams) {
785
787
  *
786
788
  * @example
787
789
  *
788
- * ### EIP-155 Transaction Wagmi Example
790
+ * ##### EIP-155 Transaction Wagmi Example
791
+ *
789
792
  * ```tsx
790
793
  * import { useGetTxAuthDataSignature } from "@compilot/react-sdk";
791
794
  * import { waitForTransactionReceipt } from "viem/actions";
@@ -1101,14 +1104,17 @@ var useAsyncQueryState = function useAsyncQueryState(_ref) {
1101
1104
  * ```
1102
1105
  *
1103
1106
  * Output:
1107
+ *
1104
1108
  * ```tsx
1105
1109
  * <div>User is verified: true</div>
1106
1110
  * ```
1107
1111
  */
1108
1112
  var useCustomerStatus = function useCustomerStatus() {
1109
1113
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1114
+ refreshOnMount: true,
1110
1115
  refreshInterval: 10000
1111
1116
  },
1117
+ refreshOnMount = _ref.refreshOnMount,
1112
1118
  refreshInterval = _ref.refreshInterval;
1113
1119
  var config = useComPilotConfig();
1114
1120
  var _useAsyncQueryState = useAsyncQueryState({
@@ -1129,18 +1135,47 @@ var useCustomerStatus = function useCustomerStatus() {
1129
1135
  };
1130
1136
  }, [config._internal.externalEventEmitter, config._internal.identifier]);
1131
1137
  useEffect(function () {
1132
- startLoading();
1138
+ var updateStatus = /*#__PURE__*/function () {
1139
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1140
+ var status;
1141
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1142
+ while (1) switch (_context.prev = _context.next) {
1143
+ case 0:
1144
+ _context.prev = 0;
1145
+ _context.next = 3;
1146
+ return getCustomerStatus(config);
1147
+ case 3:
1148
+ status = _context.sent;
1149
+ setResult(status);
1150
+ _context.next = 10;
1151
+ break;
1152
+ case 7:
1153
+ _context.prev = 7;
1154
+ _context.t0 = _context["catch"](0);
1155
+ setError(_context.t0 instanceof Error ? _context.t0 : new Error(String(_context.t0)));
1156
+ case 10:
1157
+ case "end":
1158
+ return _context.stop();
1159
+ }
1160
+ }, _callee, null, [[0, 7]]);
1161
+ }));
1162
+ return function updateStatus() {
1163
+ return _ref2.apply(this, arguments);
1164
+ };
1165
+ }();
1166
+ if (refreshOnMount) {
1167
+ if (state.data === undefined) {
1168
+ startLoading();
1169
+ void updateStatus();
1170
+ }
1171
+ }
1133
1172
  var interval = setInterval(function () {
1134
- getCustomerStatus(config).then(function (status) {
1135
- setResult(status);
1136
- })["catch"](function (error) {
1137
- setError(error instanceof Error ? error : new Error(String(error)));
1138
- });
1173
+ return void updateStatus();
1139
1174
  }, refreshInterval);
1140
1175
  return function () {
1141
1176
  clearInterval(interval);
1142
1177
  };
1143
- }, [config._internal.identifier, refreshInterval, config, setError, setResult, startLoading]);
1178
+ }, [config._internal.identifier, refreshInterval, state.data, config, setError, setResult, startLoading]);
1144
1179
  return state;
1145
1180
  };
1146
1181
 
@@ -31,6 +31,7 @@ export type ComPilotProviderProps = {
31
31
  * @example
32
32
  *
33
33
  * Basic
34
+ *
34
35
  * ```tsx
35
36
  * import { ComPilotProvider } from "@compilot/react-sdk";
36
37
  * import { config } from "./config";
@@ -45,6 +46,7 @@ export type ComPilotProviderProps = {
45
46
  * ```
46
47
  *
47
48
  * With AutoLoader disabled
49
+ *
48
50
  * ```tsx
49
51
  * import { ComPilotProvider } from "@compilot/react-sdk";
50
52
  * import { config } from "./config";
@@ -1 +1 @@
1
- {"version":3,"file":"ComPilotProvider.d.ts","sourceRoot":"../../../../src/configuration","sources":["ComPilotProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,gBAAgB,8CAI1B,qBAAqB,sBAQvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAMpC,CAAC"}
1
+ {"version":3,"file":"ComPilotProvider.d.ts","sourceRoot":"../../../../src/configuration","sources":["ComPilotProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,gBAAgB,8CAI1B,qBAAqB,sBAQvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAMpC,CAAC"}
@@ -6,6 +6,11 @@ import type { AsyncQueryState } from "../utils/useAsyncQueryState.js";
6
6
  * @category Parameter Types
7
7
  */
8
8
  export type UseCustomerStatusParams = {
9
+ /**
10
+ * Whether to refresh the customer status on mount.
11
+ * @default true
12
+ */
13
+ refreshOnMount: boolean;
9
14
  /**
10
15
  * The interval in milliseconds to refresh the customer status.
11
16
  * @default 10000
@@ -34,9 +39,10 @@ export type UseCustomerStatusParams = {
34
39
  * ```
35
40
  *
36
41
  * Output:
42
+ *
37
43
  * ```tsx
38
44
  * <div>User is verified: true</div>
39
45
  * ```
40
46
  */
41
- export declare const useCustomerStatus: ({ refreshInterval }?: UseCustomerStatusParams) => AsyncQueryState<CustomerStatus | null>;
47
+ export declare const useCustomerStatus: ({ refreshOnMount, refreshInterval }?: UseCustomerStatusParams) => AsyncQueryState<CustomerStatus | null>;
42
48
  //# sourceMappingURL=useCustomerStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomerStatus.d.ts","sourceRoot":"../../../../src/hooks","sources":["useCustomerStatus.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAoC;AAGnE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iBAAiB,yBACP,uBAAuB,KAG3C,eAAe,CAAC,cAAc,GAAG,IAAI,CA6CvC,CAAC"}
1
+ {"version":3,"file":"useCustomerStatus.d.ts","sourceRoot":"../../../../src/hooks","sources":["useCustomerStatus.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAoC;AAGnE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,iBAAiB,yCACS,uBAAuB,KAI3D,eAAe,CAAC,cAAc,GAAG,IAAI,CAoDvC,CAAC"}
@@ -23,7 +23,8 @@ export type TxAuthDataSignatureCallback = {
23
23
  *
24
24
  * @example
25
25
  *
26
- * ### EIP-155 Transaction Wagmi Example
26
+ * ##### EIP-155 Transaction Wagmi Example
27
+ *
27
28
  * ```tsx
28
29
  * import { useGetTxAuthDataSignature } from "@compilot/react-sdk";
29
30
  * import { waitForTransactionReceipt } from "viem/actions";
@@ -1 +1 @@
1
- {"version":3,"file":"useGetTxAuthDataSignature.d.ts","sourceRoot":"../../../../src/hooks","sources":["useGetTxAuthDataSignature.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wCAAwC,EACxC,wBAAwB,EACxB,mCAAmC,EACnC,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC3E;;OAEG;IACH,CACE,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wCAAwC,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoJG;AACH,eAAO,MAAM,yBAAyB,6HAgBrC,CAAC"}
1
+ {"version":3,"file":"useGetTxAuthDataSignature.d.ts","sourceRoot":"../../../../src/hooks","sources":["useGetTxAuthDataSignature.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wCAAwC,EACxC,wBAAwB,EACxB,mCAAmC,EACnC,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAC3E;;OAEG;IACH,CACE,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wCAAwC,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqJG;AACH,eAAO,MAAM,yBAAyB,6HAgBrC,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilot/react-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.3.2",
4
4
  "description": "ComPilot React SDK",
5
5
  "keywords": [],
6
6
  "license": "ISC",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilot/react-sdk",
3
- "version": "2.2.7-dev",
3
+ "version": "2.3.2-dev",
4
4
  "description": "ComPilot React SDK",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -26,10 +26,10 @@
26
26
  "dependencies": {
27
27
  "pino": "^9.4.0",
28
28
  "zod": "^3.23.8",
29
- "@compilot/web-sdk": "2.2.6-dev",
30
- "@nexeraid/identity-api-client": "2.2.6-dev",
31
- "@nexeraid/identity-schemas": "2.2.6-dev",
32
- "@nexeraid/logger": "2.2.6-dev"
29
+ "@compilot/web-sdk": "2.3.2-dev",
30
+ "@nexeraid/identity-schemas": "2.3.2-dev",
31
+ "@nexeraid/identity-api-client": "2.3.0-dev",
32
+ "@nexeraid/logger": "2.3.0-dev"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=17.0.0 <20.0.0"