@soba-so/react 0.0.28 → 0.0.29

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/styles.css CHANGED
@@ -4465,3 +4465,20 @@ li.sc-plan-row.sc-plan-current {
4465
4465
  transform: none;
4466
4466
  }
4467
4467
  }
4468
+
4469
+ .sc-redeem {
4470
+ display: flex;
4471
+ gap: 8px;
4472
+ align-items: stretch;
4473
+ }
4474
+ .sc-redeem .sc-input {
4475
+ flex: 1;
4476
+ min-width: 0;
4477
+ }
4478
+ .sc-redeem .sc-btn {
4479
+ flex: none;
4480
+ }
4481
+ .sc-redeem + .sc-error,
4482
+ .sc-redeem + .sc-note {
4483
+ margin-top: 8px;
4484
+ }
package/dist/types.d.ts CHANGED
@@ -296,6 +296,10 @@ export interface Plan {
296
296
  /** Runs a month on the user's own AI, counted apart from `included_units`.
297
297
  * Null is unlimited. Optional so an older server that omits it parses. */
298
298
  own_included_units?: number | null;
299
+ /** What `own_included_units` counts: `unit` unless the plan splits —
300
+ * "200 runs on your own AI, 2,000 credits on ours". Optional for older
301
+ * servers, which mean `unit`. */
302
+ own_unit?: string;
299
303
  /** What happens past the allowance: `stop` or `meter`. The difference
300
304
  * between a wall and a bill, and not guessable from the price. */
301
305
  overage: string;
@@ -362,6 +366,8 @@ export interface CurrentPlan {
362
366
  units_used: number;
363
367
  remaining: number | null;
364
368
  own_included_units: number | null;
369
+ /** What the own_* figures count. Optional for older servers: `unit`. */
370
+ own_unit?: string;
365
371
  own_units_used: number;
366
372
  own_remaining: number | null;
367
373
  resets_at: string | null;
@@ -0,0 +1,24 @@
1
+ /** What a redeemed code gave. Declared here so the published types never
2
+ * name @soba-so/connect-ui. */
3
+ export interface RedeemedReward {
4
+ id: string;
5
+ name: string;
6
+ kind: "discount" | "grant" | "plan";
7
+ }
8
+ export interface RedeemCodeView {
9
+ /** Redeem what your user typed. Resolves with the reward, or null when the
10
+ * code was refused — the reason is in `error`. */
11
+ redeem: (code: string) => Promise<RedeemedReward | null>;
12
+ busy: boolean;
13
+ /** "That code has been used up.", ready to show. Cleared on the next try. */
14
+ error: string | null;
15
+ /** The last reward this hook redeemed. */
16
+ reward: RedeemedReward | null;
17
+ }
18
+ /**
19
+ * A PROMO CODE FIELD'S BEHAVIOUR. What the code gives applies at once — AI
20
+ * usage on top of their plan, or a plan for its days — so the plan state is
21
+ * re-read after, and `usePlans()` shows the new allowance without a reload.
22
+ * A discount is applied at their next checkout.
23
+ */
24
+ export declare function useRedeemCode(): RedeemCodeView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soba-so/react",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Connect the AI your users already pay for, from your own React app.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://soba.so/docs/components",