@taphubhq/sdk-core 0.22.2 → 0.23.0

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/dist/index.cjs CHANGED
@@ -533,7 +533,10 @@ var BidModule = class {
533
533
  price2: input.price2,
534
534
  coefficient: input.coefficient,
535
535
  amount: input.amount,
536
- slippage: input.slippage
536
+ slippage: input.slippage,
537
+ // QA-only late-bid passthrough (bid-260610). Omitted entirely when absent
538
+ // so no `bidToken: null` is sent. sdk-react sets it from localStorage.
539
+ ...input.bidToken ? { bidToken: input.bidToken } : {}
537
540
  }
538
541
  };
539
542
  try {
@@ -860,7 +863,15 @@ function normaliseGameConfig(node) {
860
863
  constraints: normaliseConstraints(node.constraints),
861
864
  acceptableBids: node.acceptableBids,
862
865
  minBidAmount: node.minBidAmount,
863
- maxBidAmount: node.maxBidAmount
866
+ maxBidAmount: node.maxBidAmount,
867
+ // Effective cancel policy. Distinguish three states so consumers can apply
868
+ // the right default:
869
+ // undefined → server omitted the field (older server) → use platform default
870
+ // 0 → builder explicitly disabled cancel → keep 0 (cancel OFF)
871
+ // > 0 → builder/effective threshold
872
+ // (null from the wire becomes undefined, NOT 0, so "not sent" ≠ "disabled".)
873
+ bidCancelRefundRate: node.bidCancelRefundRate ?? void 0,
874
+ bidCancelMinSeconds: node.bidCancelMinSeconds ?? void 0
864
875
  };
865
876
  }
866
877
  function normaliseGridConfig(node) {
@@ -922,6 +933,7 @@ var PAIR_QUERY = `query AgencyPair($pairId: ID!) {
922
933
  gridConfig { cellSizeTime cellSizeValue candleSize baseline baselineTime }
923
934
  constraints { minBetTime maxBetTime slippage priceMinRange priceMaxRange coefMults maxCoef }
924
935
  acceptableBids minBidAmount maxBidAmount
936
+ bidCancelRefundRate bidCancelMinSeconds
925
937
  }
926
938
  }
927
939
  }`;
package/dist/index.d.mts CHANGED
@@ -243,6 +243,13 @@ interface PlaceBidInput {
243
243
  coefficient: string;
244
244
  amount: string;
245
245
  slippage: number;
246
+ /**
247
+ * QA-only late-bid token (dev/local). Forwarded verbatim to grid-api, which
248
+ * honours it only when it matches its env secret on a dev/local stage. sdk-core
249
+ * is environment-agnostic and never reads it from storage — the browser-only
250
+ * sdk-react reads `localStorage["bidToken"]` and injects it. Omit when absent.
251
+ */
252
+ bidToken?: string;
246
253
  }
247
254
 
248
255
  declare const isPending: (bid: Bid) => boolean;
@@ -493,6 +500,19 @@ interface GameConfig {
493
500
  acceptableBids: number[];
494
501
  minBidAmount: number;
495
502
  maxBidAmount: number;
503
+ /**
504
+ * Effective cancel policy — the values the server's cancel engine actually
505
+ * enforces (per-game config, falling back to platform defaults). Use these
506
+ * to drive the Cancel button: a bid is cancellable while
507
+ * `time2 - now > bidCancelMinSeconds`; on cancel the player is refunded
508
+ * `amount * bidCancelRefundRate`.
509
+ *
510
+ * Optional for backward compatibility: a server (or a manually-constructed
511
+ * config) that predates this field omits it. normalisePair fills 0 from the
512
+ * wire; consumers should treat `undefined`/`0` as "use the platform default".
513
+ */
514
+ bidCancelRefundRate?: number;
515
+ bidCancelMinSeconds?: number;
496
516
  }
497
517
  interface GridConfig {
498
518
  cellSizeTime: number;
package/dist/index.d.ts CHANGED
@@ -243,6 +243,13 @@ interface PlaceBidInput {
243
243
  coefficient: string;
244
244
  amount: string;
245
245
  slippage: number;
246
+ /**
247
+ * QA-only late-bid token (dev/local). Forwarded verbatim to grid-api, which
248
+ * honours it only when it matches its env secret on a dev/local stage. sdk-core
249
+ * is environment-agnostic and never reads it from storage — the browser-only
250
+ * sdk-react reads `localStorage["bidToken"]` and injects it. Omit when absent.
251
+ */
252
+ bidToken?: string;
246
253
  }
247
254
 
248
255
  declare const isPending: (bid: Bid) => boolean;
@@ -493,6 +500,19 @@ interface GameConfig {
493
500
  acceptableBids: number[];
494
501
  minBidAmount: number;
495
502
  maxBidAmount: number;
503
+ /**
504
+ * Effective cancel policy — the values the server's cancel engine actually
505
+ * enforces (per-game config, falling back to platform defaults). Use these
506
+ * to drive the Cancel button: a bid is cancellable while
507
+ * `time2 - now > bidCancelMinSeconds`; on cancel the player is refunded
508
+ * `amount * bidCancelRefundRate`.
509
+ *
510
+ * Optional for backward compatibility: a server (or a manually-constructed
511
+ * config) that predates this field omits it. normalisePair fills 0 from the
512
+ * wire; consumers should treat `undefined`/`0` as "use the platform default".
513
+ */
514
+ bidCancelRefundRate?: number;
515
+ bidCancelMinSeconds?: number;
496
516
  }
497
517
  interface GridConfig {
498
518
  cellSizeTime: number;
package/dist/index.js CHANGED
@@ -468,7 +468,10 @@ var BidModule = class {
468
468
  price2: input.price2,
469
469
  coefficient: input.coefficient,
470
470
  amount: input.amount,
471
- slippage: input.slippage
471
+ slippage: input.slippage,
472
+ // QA-only late-bid passthrough (bid-260610). Omitted entirely when absent
473
+ // so no `bidToken: null` is sent. sdk-react sets it from localStorage.
474
+ ...input.bidToken ? { bidToken: input.bidToken } : {}
472
475
  }
473
476
  };
474
477
  try {
@@ -795,7 +798,15 @@ function normaliseGameConfig(node) {
795
798
  constraints: normaliseConstraints(node.constraints),
796
799
  acceptableBids: node.acceptableBids,
797
800
  minBidAmount: node.minBidAmount,
798
- maxBidAmount: node.maxBidAmount
801
+ maxBidAmount: node.maxBidAmount,
802
+ // Effective cancel policy. Distinguish three states so consumers can apply
803
+ // the right default:
804
+ // undefined → server omitted the field (older server) → use platform default
805
+ // 0 → builder explicitly disabled cancel → keep 0 (cancel OFF)
806
+ // > 0 → builder/effective threshold
807
+ // (null from the wire becomes undefined, NOT 0, so "not sent" ≠ "disabled".)
808
+ bidCancelRefundRate: node.bidCancelRefundRate ?? void 0,
809
+ bidCancelMinSeconds: node.bidCancelMinSeconds ?? void 0
799
810
  };
800
811
  }
801
812
  function normaliseGridConfig(node) {
@@ -857,6 +868,7 @@ var PAIR_QUERY = `query AgencyPair($pairId: ID!) {
857
868
  gridConfig { cellSizeTime cellSizeValue candleSize baseline baselineTime }
858
869
  constraints { minBetTime maxBetTime slippage priceMinRange priceMaxRange coefMults maxCoef }
859
870
  acceptableBids minBidAmount maxBidAmount
871
+ bidCancelRefundRate bidCancelMinSeconds
860
872
  }
861
873
  }
862
874
  }`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taphubhq/sdk-core",
3
- "version": "0.22.2",
3
+ "version": "0.23.0",
4
4
  "description": "Core SDK for building on the TabHub platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",