@takeshape/util 9.71.2 → 9.73.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/billing.d.ts +14 -18
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +21 -1
- package/es/billing.js +11 -1
- package/package.json +5 -4
package/dist/billing.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface BillingInfo {
|
|
|
49
49
|
email?: string;
|
|
50
50
|
taxId?: TaxId;
|
|
51
51
|
address?: string;
|
|
52
|
+
annualPlan?: boolean;
|
|
52
53
|
}
|
|
53
54
|
export interface PaymentMethodDetails {
|
|
54
55
|
type: 'card' | 'bank_account' | 'other';
|
|
@@ -85,25 +86,20 @@ export interface Discount {
|
|
|
85
86
|
amountOff: number | null;
|
|
86
87
|
duration: string | null;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export interface
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
product: string;
|
|
99
|
-
}
|
|
100
|
-
export interface TInvoiceLineItem extends Stripe.InvoiceLineItem {
|
|
101
|
-
plan: TInvoicePlan;
|
|
102
|
-
}
|
|
103
|
-
export interface TInvoice extends Stripe.Invoice {
|
|
104
|
-
charge: Stripe.Charge;
|
|
105
|
-
lines: Stripe.ApiList<TInvoiceLineItem>;
|
|
89
|
+
/**
|
|
90
|
+
* Stripe is replacing plans with prices. The Stripe API still returns a plan property on subscriptions
|
|
91
|
+
* but it has already been removed from the types. This interface should only be used in the specific places
|
|
92
|
+
* where we use plans so they can be easily found and migrated in the future.
|
|
93
|
+
* More info https://stripe.com/docs/billing/migration/migrating-prices
|
|
94
|
+
*/
|
|
95
|
+
export interface SubscriptionWithPlan extends Stripe.Subscription {
|
|
96
|
+
plan: {
|
|
97
|
+
id: string;
|
|
98
|
+
};
|
|
106
99
|
}
|
|
100
|
+
export declare function isStripeProductObject(product: string | Stripe.Product | Stripe.DeletedProduct | null): product is Stripe.Product;
|
|
101
|
+
export declare function getStripeProductObject(product: string | Stripe.Product | Stripe.DeletedProduct | null): Stripe.Product;
|
|
102
|
+
export declare function isStripeChargeObject(charge: string | Stripe.Charge | null): charge is Stripe.Charge;
|
|
107
103
|
export type ProductsMapping = Record<string, Stripe.Product>;
|
|
108
104
|
export interface PaymentAmount {
|
|
109
105
|
total: number;
|
package/dist/billing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/billing.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/billing.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KA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CAEnG;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;IAC1E,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/billing.js
CHANGED
|
@@ -2,4 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.getStripeProductObject = getStripeProductObject;
|
|
7
|
+
exports.isStripeChargeObject = isStripeChargeObject;
|
|
8
|
+
exports.isStripeProductObject = isStripeProductObject;
|
|
9
|
+
|
|
10
|
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function isStripeProductObject(product) {
|
|
15
|
+
return Boolean(product && typeof product !== 'string' && product.object === 'product' && !product.deleted);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getStripeProductObject(product) {
|
|
19
|
+
(0, _tinyInvariant.default)(isStripeProductObject(product));
|
|
20
|
+
return product;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isStripeChargeObject(charge) {
|
|
24
|
+
return typeof charge !== 'string';
|
|
25
|
+
}
|
package/es/billing.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import invariant from 'tiny-invariant';
|
|
2
|
+
export function isStripeProductObject(product) {
|
|
3
|
+
return Boolean(product && typeof product !== 'string' && product.object === 'product' && !product.deleted);
|
|
4
|
+
}
|
|
5
|
+
export function getStripeProductObject(product) {
|
|
6
|
+
invariant(isStripeProductObject(product));
|
|
7
|
+
return product;
|
|
8
|
+
}
|
|
9
|
+
export function isStripeChargeObject(charge) {
|
|
10
|
+
return typeof charge !== 'string';
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/util",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.73.0",
|
|
4
4
|
"description": "Shared utilities",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
"pify": "^5.0.0",
|
|
32
32
|
"prismjs": "^1.25.0",
|
|
33
33
|
"shortid": "^2.2.16",
|
|
34
|
+
"tiny-invariant": "^1.2.0",
|
|
34
35
|
"url-parse": "^1.5.3",
|
|
35
|
-
"@takeshape/routing": "9.
|
|
36
|
+
"@takeshape/routing": "9.73.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/classnames": "^2.2.9",
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
"@types/pify": "^3.0.2",
|
|
45
46
|
"@types/prismjs": "^1.16.2",
|
|
46
47
|
"@types/shortid": "^0.0.29",
|
|
47
|
-
"stripe": "8.
|
|
48
|
-
"@takeshape/typescript-jest-junit-reporter": "9.
|
|
48
|
+
"stripe": "13.8.0",
|
|
49
|
+
"@takeshape/typescript-jest-junit-reporter": "9.73.0"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": ">=16"
|