@echoxyz/sonar-core 0.14.0 → 0.14.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @echoxyz/sonar-core
|
|
2
2
|
|
|
3
|
+
## 0.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e02745a: Switch to new "read-commitment-data" path
|
|
8
|
+
- 85f81dc: Add OUTSIDE_TIME_WINDOW to PrePurchaseFailureReason enum
|
|
9
|
+
|
|
10
|
+
## 0.14.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 7101949: All onUnauthorized to be passed into createClient
|
|
15
|
+
|
|
3
16
|
## 0.14.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -319,7 +319,7 @@ var SonarClient = class {
|
|
|
319
319
|
// Public API
|
|
320
320
|
async readCommitmentData(args) {
|
|
321
321
|
return this.postJSON(
|
|
322
|
-
"/
|
|
322
|
+
"/sonar/v1/public/read-commitment-data",
|
|
323
323
|
{
|
|
324
324
|
SaleUUID: args.saleUUID
|
|
325
325
|
},
|
|
@@ -427,6 +427,7 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
427
427
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
428
428
|
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
429
429
|
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
430
|
+
PrePurchaseFailureReason2["OUTSIDE_TIME_WINDOW"] = "outside-time-window";
|
|
430
431
|
return PrePurchaseFailureReason2;
|
|
431
432
|
})(PrePurchaseFailureReason || {});
|
|
432
433
|
var InvestingRegion = /* @__PURE__ */ ((InvestingRegion2) => {
|
|
@@ -448,9 +449,14 @@ function createClient(options) {
|
|
|
448
449
|
if (onTokenChange) {
|
|
449
450
|
authSession.onTokenChange(onTokenChange);
|
|
450
451
|
}
|
|
452
|
+
const onUnauthorized = () => {
|
|
453
|
+
var _a;
|
|
454
|
+
authSession.clear();
|
|
455
|
+
(_a = options == null ? void 0 : options.onUnauthorized) == null ? void 0 : _a.call(options);
|
|
456
|
+
};
|
|
451
457
|
return new SonarClient({
|
|
452
458
|
apiURL,
|
|
453
|
-
opts: { auth: authSession, fetch, onUnauthorized
|
|
459
|
+
opts: { auth: authSession, fetch, onUnauthorized }
|
|
454
460
|
});
|
|
455
461
|
}
|
|
456
462
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -98,7 +98,8 @@ declare enum PrePurchaseFailureReason {
|
|
|
98
98
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
99
99
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
100
100
|
SALE_NOT_ACTIVE = "sale-not-active",
|
|
101
|
-
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
101
|
+
WALLET_NOT_LINKED = "wallet-not-linked",
|
|
102
|
+
OUTSIDE_TIME_WINDOW = "outside-time-window"
|
|
102
103
|
}
|
|
103
104
|
declare enum InvestingRegion {
|
|
104
105
|
UNKNOWN = "unknown",
|
|
@@ -265,6 +266,7 @@ type CreateClientOptions = {
|
|
|
265
266
|
tokenKey?: string;
|
|
266
267
|
onExpire?: () => void;
|
|
267
268
|
onTokenChange?: (token?: string) => void;
|
|
269
|
+
onUnauthorized?: () => void;
|
|
268
270
|
};
|
|
269
271
|
declare function createClient(options?: CreateClientOptions): SonarClient;
|
|
270
272
|
|
package/dist/index.d.ts
CHANGED
|
@@ -98,7 +98,8 @@ declare enum PrePurchaseFailureReason {
|
|
|
98
98
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
99
99
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
100
100
|
SALE_NOT_ACTIVE = "sale-not-active",
|
|
101
|
-
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
101
|
+
WALLET_NOT_LINKED = "wallet-not-linked",
|
|
102
|
+
OUTSIDE_TIME_WINDOW = "outside-time-window"
|
|
102
103
|
}
|
|
103
104
|
declare enum InvestingRegion {
|
|
104
105
|
UNKNOWN = "unknown",
|
|
@@ -265,6 +266,7 @@ type CreateClientOptions = {
|
|
|
265
266
|
tokenKey?: string;
|
|
266
267
|
onExpire?: () => void;
|
|
267
268
|
onTokenChange?: (token?: string) => void;
|
|
269
|
+
onUnauthorized?: () => void;
|
|
268
270
|
};
|
|
269
271
|
declare function createClient(options?: CreateClientOptions): SonarClient;
|
|
270
272
|
|
package/dist/index.js
CHANGED
|
@@ -282,7 +282,7 @@ var SonarClient = class {
|
|
|
282
282
|
// Public API
|
|
283
283
|
async readCommitmentData(args) {
|
|
284
284
|
return this.postJSON(
|
|
285
|
-
"/
|
|
285
|
+
"/sonar/v1/public/read-commitment-data",
|
|
286
286
|
{
|
|
287
287
|
SaleUUID: args.saleUUID
|
|
288
288
|
},
|
|
@@ -390,6 +390,7 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
390
390
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
391
391
|
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
392
392
|
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
393
|
+
PrePurchaseFailureReason2["OUTSIDE_TIME_WINDOW"] = "outside-time-window";
|
|
393
394
|
return PrePurchaseFailureReason2;
|
|
394
395
|
})(PrePurchaseFailureReason || {});
|
|
395
396
|
var InvestingRegion = /* @__PURE__ */ ((InvestingRegion2) => {
|
|
@@ -411,9 +412,14 @@ function createClient(options) {
|
|
|
411
412
|
if (onTokenChange) {
|
|
412
413
|
authSession.onTokenChange(onTokenChange);
|
|
413
414
|
}
|
|
415
|
+
const onUnauthorized = () => {
|
|
416
|
+
var _a;
|
|
417
|
+
authSession.clear();
|
|
418
|
+
(_a = options == null ? void 0 : options.onUnauthorized) == null ? void 0 : _a.call(options);
|
|
419
|
+
};
|
|
414
420
|
return new SonarClient({
|
|
415
421
|
apiURL,
|
|
416
|
-
opts: { auth: authSession, fetch, onUnauthorized
|
|
422
|
+
opts: { auth: authSession, fetch, onUnauthorized }
|
|
417
423
|
});
|
|
418
424
|
}
|
|
419
425
|
export {
|