@shipstatic/types 2.16.0-beta.1 → 2.17.0-beta.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/dist/index.d.ts +53 -26
- package/package.json +1 -1
- package/src/index.ts +49 -28
package/dist/index.d.ts
CHANGED
|
@@ -655,6 +655,20 @@ export interface Account {
|
|
|
655
655
|
* must never be sent to Checkout.
|
|
656
656
|
*/
|
|
657
657
|
readonly upgrade: AccountPlanType | null;
|
|
658
|
+
/**
|
|
659
|
+
* The live Subscription's billing interval — Stripe's
|
|
660
|
+
* `Price.recurring.interval`, mirrored — or `null` when no Subscription
|
|
661
|
+
* bills the account (free and granted plans). It is what lets the console
|
|
662
|
+
* offer the current plan's OTHER interval as a switch.
|
|
663
|
+
*/
|
|
664
|
+
readonly interval: BillingInterval | null;
|
|
665
|
+
/**
|
|
666
|
+
* The pending plan change, or `null`. *Up is now, down is at period end*:
|
|
667
|
+
* a downgrade is a Stripe Subscription Schedule that applies at `at`, and
|
|
668
|
+
* until then the account keeps everything it paid for. Reversible —
|
|
669
|
+
* `DELETE /billing/change` releases it.
|
|
670
|
+
*/
|
|
671
|
+
readonly scheduled: ScheduledChange | null;
|
|
658
672
|
}
|
|
659
673
|
/**
|
|
660
674
|
* Account as returned by `GET /account` — the entity plus how the request
|
|
@@ -1843,46 +1857,59 @@ export interface PlansResponse {
|
|
|
1843
1857
|
readonly plans: readonly Plan[];
|
|
1844
1858
|
}
|
|
1845
1859
|
/**
|
|
1846
|
-
* The body of `POST /billing/
|
|
1847
|
-
* required: with more than one billed plan there is no
|
|
1848
|
-
* the console always knows which card was clicked.
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1860
|
+
* The body of `POST /billing/change` — the one door for "get me onto this
|
|
1861
|
+
* plan". Both fields required: with more than one billed plan there is no
|
|
1862
|
+
* honest default, and the console always knows which card was clicked.
|
|
1863
|
+
*
|
|
1864
|
+
* The SERVER decides what the change means — the rule is *up is now, down is
|
|
1865
|
+
* at period end* — so the client holds no copy of the ladder: a free account
|
|
1866
|
+
* is sent to Stripe Checkout, a billed account moving up is sent to the
|
|
1867
|
+
* Portal's confirmation page (money moves now, so Stripe's page takes the
|
|
1868
|
+
* consent), and a billed account moving down gets a Stripe Subscription
|
|
1869
|
+
* Schedule that applies the change at period end. The answer says which
|
|
1870
|
+
* happened ({@link PlanChangeResponse}).
|
|
1852
1871
|
*/
|
|
1853
|
-
export interface
|
|
1872
|
+
export interface PlanChangeRequest {
|
|
1854
1873
|
readonly plan: AccountPlanType;
|
|
1855
1874
|
readonly interval: BillingInterval;
|
|
1856
1875
|
}
|
|
1857
1876
|
/**
|
|
1858
|
-
* The
|
|
1859
|
-
*
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
1862
|
-
* cancellation, and Stripe's own plan picker.
|
|
1877
|
+
* The pending plan change — a Stripe Subscription Schedule the platform
|
|
1878
|
+
* minted, mirrored onto the account. `at` is when it applies (the current
|
|
1879
|
+
* period's end, Unix seconds). Reversible until then: `DELETE
|
|
1880
|
+
* /billing/change` releases it.
|
|
1863
1881
|
*/
|
|
1864
|
-
export interface
|
|
1865
|
-
readonly plan
|
|
1866
|
-
readonly interval
|
|
1882
|
+
export interface ScheduledChange {
|
|
1883
|
+
readonly plan: AccountPlanType;
|
|
1884
|
+
readonly interval: BillingInterval;
|
|
1885
|
+
readonly at: number;
|
|
1867
1886
|
}
|
|
1868
1887
|
/**
|
|
1869
|
-
* The answer of `POST /billing/
|
|
1870
|
-
*
|
|
1888
|
+
* The answer of `POST /billing/change` — exactly one field is set, and the
|
|
1889
|
+
* UNION is what holds that: an answer carrying both, or neither, does not
|
|
1890
|
+
* compile, so "which door was taken" is structural rather than prose.
|
|
1871
1891
|
*
|
|
1872
|
-
*
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
1892
|
+
* `url` means GO: a Stripe page (Checkout, or the Portal's confirmation page)
|
|
1893
|
+
* finishes the change and the browser must be redirected to it. `scheduled`
|
|
1894
|
+
* means DONE: the downgrade is booked for period end, nothing to visit, and
|
|
1895
|
+
* the account's `scheduled` field now carries it.
|
|
1876
1896
|
*/
|
|
1877
|
-
export
|
|
1878
|
-
|
|
1897
|
+
export type PlanChangeResponse =
|
|
1898
|
+
/** GO: a Stripe page finishes the change. Absolute URL, single use, short-lived. */
|
|
1899
|
+
{
|
|
1879
1900
|
readonly url: string;
|
|
1901
|
+
readonly scheduled?: never;
|
|
1880
1902
|
}
|
|
1903
|
+
/** DONE: the downgrade is booked for period end; nothing to visit. */
|
|
1904
|
+
| {
|
|
1905
|
+
readonly url?: never;
|
|
1906
|
+
readonly scheduled: ScheduledChange;
|
|
1907
|
+
};
|
|
1881
1908
|
/**
|
|
1882
1909
|
* The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
|
|
1883
|
-
* projected the
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1910
|
+
* projected to the one field a client needs. The Portal home: cards,
|
|
1911
|
+
* invoices, cancellation. Plan changes have their own door
|
|
1912
|
+
* ({@link PlanChangeRequest}).
|
|
1886
1913
|
*/
|
|
1887
1914
|
export interface BillingPortalSession {
|
|
1888
1915
|
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -730,6 +730,20 @@ export interface Account {
|
|
|
730
730
|
* must never be sent to Checkout.
|
|
731
731
|
*/
|
|
732
732
|
readonly upgrade: AccountPlanType | null;
|
|
733
|
+
/**
|
|
734
|
+
* The live Subscription's billing interval — Stripe's
|
|
735
|
+
* `Price.recurring.interval`, mirrored — or `null` when no Subscription
|
|
736
|
+
* bills the account (free and granted plans). It is what lets the console
|
|
737
|
+
* offer the current plan's OTHER interval as a switch.
|
|
738
|
+
*/
|
|
739
|
+
readonly interval: BillingInterval | null;
|
|
740
|
+
/**
|
|
741
|
+
* The pending plan change, or `null`. *Up is now, down is at period end*:
|
|
742
|
+
* a downgrade is a Stripe Subscription Schedule that applies at `at`, and
|
|
743
|
+
* until then the account keeps everything it paid for. Reversible —
|
|
744
|
+
* `DELETE /billing/change` releases it.
|
|
745
|
+
*/
|
|
746
|
+
readonly scheduled: ScheduledChange | null;
|
|
733
747
|
}
|
|
734
748
|
|
|
735
749
|
/**
|
|
@@ -2706,49 +2720,56 @@ export interface PlansResponse {
|
|
|
2706
2720
|
}
|
|
2707
2721
|
|
|
2708
2722
|
/**
|
|
2709
|
-
* The body of `POST /billing/
|
|
2710
|
-
* required: with more than one billed plan there is no
|
|
2711
|
-
* the console always knows which card was clicked.
|
|
2712
|
-
*
|
|
2713
|
-
*
|
|
2714
|
-
*
|
|
2723
|
+
* The body of `POST /billing/change` — the one door for "get me onto this
|
|
2724
|
+
* plan". Both fields required: with more than one billed plan there is no
|
|
2725
|
+
* honest default, and the console always knows which card was clicked.
|
|
2726
|
+
*
|
|
2727
|
+
* The SERVER decides what the change means — the rule is *up is now, down is
|
|
2728
|
+
* at period end* — so the client holds no copy of the ladder: a free account
|
|
2729
|
+
* is sent to Stripe Checkout, a billed account moving up is sent to the
|
|
2730
|
+
* Portal's confirmation page (money moves now, so Stripe's page takes the
|
|
2731
|
+
* consent), and a billed account moving down gets a Stripe Subscription
|
|
2732
|
+
* Schedule that applies the change at period end. The answer says which
|
|
2733
|
+
* happened ({@link PlanChangeResponse}).
|
|
2715
2734
|
*/
|
|
2716
|
-
export interface
|
|
2735
|
+
export interface PlanChangeRequest {
|
|
2717
2736
|
readonly plan: AccountPlanType;
|
|
2718
2737
|
readonly interval: BillingInterval;
|
|
2719
2738
|
}
|
|
2720
2739
|
|
|
2721
2740
|
/**
|
|
2722
|
-
* The
|
|
2723
|
-
*
|
|
2724
|
-
*
|
|
2725
|
-
*
|
|
2726
|
-
* cancellation, and Stripe's own plan picker.
|
|
2741
|
+
* The pending plan change — a Stripe Subscription Schedule the platform
|
|
2742
|
+
* minted, mirrored onto the account. `at` is when it applies (the current
|
|
2743
|
+
* period's end, Unix seconds). Reversible until then: `DELETE
|
|
2744
|
+
* /billing/change` releases it.
|
|
2727
2745
|
*/
|
|
2728
|
-
export interface
|
|
2729
|
-
readonly plan
|
|
2730
|
-
readonly interval
|
|
2746
|
+
export interface ScheduledChange {
|
|
2747
|
+
readonly plan: AccountPlanType;
|
|
2748
|
+
readonly interval: BillingInterval;
|
|
2749
|
+
readonly at: number;
|
|
2731
2750
|
}
|
|
2732
2751
|
|
|
2733
2752
|
/**
|
|
2734
|
-
* The answer of `POST /billing/
|
|
2735
|
-
*
|
|
2753
|
+
* The answer of `POST /billing/change` — exactly one field is set, and the
|
|
2754
|
+
* UNION is what holds that: an answer carrying both, or neither, does not
|
|
2755
|
+
* compile, so "which door was taken" is structural rather than prose.
|
|
2736
2756
|
*
|
|
2737
|
-
*
|
|
2738
|
-
*
|
|
2739
|
-
*
|
|
2740
|
-
*
|
|
2757
|
+
* `url` means GO: a Stripe page (Checkout, or the Portal's confirmation page)
|
|
2758
|
+
* finishes the change and the browser must be redirected to it. `scheduled`
|
|
2759
|
+
* means DONE: the downgrade is booked for period end, nothing to visit, and
|
|
2760
|
+
* the account's `scheduled` field now carries it.
|
|
2741
2761
|
*/
|
|
2742
|
-
export
|
|
2743
|
-
/**
|
|
2744
|
-
readonly url: string;
|
|
2745
|
-
|
|
2762
|
+
export type PlanChangeResponse =
|
|
2763
|
+
/** GO: a Stripe page finishes the change. Absolute URL, single use, short-lived. */
|
|
2764
|
+
| { readonly url: string; readonly scheduled?: never }
|
|
2765
|
+
/** DONE: the downgrade is booked for period end; nothing to visit. */
|
|
2766
|
+
| { readonly url?: never; readonly scheduled: ScheduledChange };
|
|
2746
2767
|
|
|
2747
2768
|
/**
|
|
2748
2769
|
* The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
|
|
2749
|
-
* projected the
|
|
2750
|
-
*
|
|
2751
|
-
*
|
|
2770
|
+
* projected to the one field a client needs. The Portal home: cards,
|
|
2771
|
+
* invoices, cancellation. Plan changes have their own door
|
|
2772
|
+
* ({@link PlanChangeRequest}).
|
|
2752
2773
|
*/
|
|
2753
2774
|
export interface BillingPortalSession {
|
|
2754
2775
|
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|