commerceforai 0.1.0 → 0.1.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 +83 -1
- package/dist/index.js +12 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -200,6 +200,53 @@ declare class Discounts extends Resource {
|
|
|
200
200
|
}>>;
|
|
201
201
|
}
|
|
202
202
|
declare class Reports extends Resource {
|
|
203
|
+
/** Every order with its tax, for an accountant. Dates are YYYY-MM-DD (default: the last 365 days). */
|
|
204
|
+
taxOrders(params?: {
|
|
205
|
+
from?: string;
|
|
206
|
+
to?: string;
|
|
207
|
+
}): Promise<Result<{
|
|
208
|
+
object: "list";
|
|
209
|
+
truncated: boolean;
|
|
210
|
+
data: {
|
|
211
|
+
order_number: number;
|
|
212
|
+
date: string;
|
|
213
|
+
status: string;
|
|
214
|
+
city: string | null;
|
|
215
|
+
state: string | null;
|
|
216
|
+
postal_code: string | null;
|
|
217
|
+
country: string | null;
|
|
218
|
+
subtotal: number;
|
|
219
|
+
discount: number;
|
|
220
|
+
shipping: number;
|
|
221
|
+
tax: number;
|
|
222
|
+
total: number;
|
|
223
|
+
refunded: number;
|
|
224
|
+
currency: string;
|
|
225
|
+
}[];
|
|
226
|
+
}>>;
|
|
227
|
+
/** Sales and tax by state over the last `days` (default 365). `watch` flags US states near common registration thresholds. */
|
|
228
|
+
tax(params?: {
|
|
229
|
+
days?: number;
|
|
230
|
+
}): Promise<Result<{
|
|
231
|
+
object: "tax_report";
|
|
232
|
+
days: number;
|
|
233
|
+
currency: string;
|
|
234
|
+
note: string;
|
|
235
|
+
totals: {
|
|
236
|
+
sales: number;
|
|
237
|
+
tax_collected: number;
|
|
238
|
+
orders: number;
|
|
239
|
+
};
|
|
240
|
+
data: {
|
|
241
|
+
country: string;
|
|
242
|
+
state: string | null;
|
|
243
|
+
orders: number;
|
|
244
|
+
sales: number;
|
|
245
|
+
tax_collected: number;
|
|
246
|
+
registered: boolean;
|
|
247
|
+
watch: boolean;
|
|
248
|
+
}[];
|
|
249
|
+
}>>;
|
|
203
250
|
/** Sales over the last `days` (default 30, max 366): totals vs the previous period, a time series and top products. */
|
|
204
251
|
sales(params?: {
|
|
205
252
|
days?: number;
|
|
@@ -547,6 +594,39 @@ declare class StoreResource extends Resource {
|
|
|
547
594
|
* Note on `tax_enabled`: Stripe only collects tax in jurisdictions where you have an active
|
|
548
595
|
* tax registration in Stripe Tax. Turning this on without registrations collects $0 tax.
|
|
549
596
|
*/
|
|
597
|
+
/** Sales tax readiness: Stripe Tax status, registrations, what to do next, and the tax categories to choose from. */
|
|
598
|
+
tax(): Promise<Result<{
|
|
599
|
+
object: "tax_overview";
|
|
600
|
+
enabled: boolean;
|
|
601
|
+
default_tax_code: string | null;
|
|
602
|
+
prices_include_tax: boolean;
|
|
603
|
+
links: {
|
|
604
|
+
registrations: string;
|
|
605
|
+
thresholds: string;
|
|
606
|
+
filing: string;
|
|
607
|
+
transactions: string;
|
|
608
|
+
} | null;
|
|
609
|
+
collecting: boolean;
|
|
610
|
+
next_step: string | null;
|
|
611
|
+
fix_url: string | null;
|
|
612
|
+
note: string;
|
|
613
|
+
stripe: {
|
|
614
|
+
status: string;
|
|
615
|
+
missing_fields: string[];
|
|
616
|
+
registrations: {
|
|
617
|
+
country: string;
|
|
618
|
+
state: string | null;
|
|
619
|
+
}[];
|
|
620
|
+
};
|
|
621
|
+
last_error: {
|
|
622
|
+
message: string;
|
|
623
|
+
at: string;
|
|
624
|
+
} | null;
|
|
625
|
+
categories: {
|
|
626
|
+
code: string;
|
|
627
|
+
name: string;
|
|
628
|
+
}[];
|
|
629
|
+
}>>;
|
|
550
630
|
/**
|
|
551
631
|
* Preview a sync from this store's other version (test or live) into this store. Nothing changes.
|
|
552
632
|
* Syncs cover products, prices, images, collections, discounts and shipping/email settings; never orders, keys, Stripe, site URLs or stock counts.
|
|
@@ -569,7 +649,9 @@ declare class StoreResource extends Resource {
|
|
|
569
649
|
}>>;
|
|
570
650
|
update(params: {
|
|
571
651
|
name?: string;
|
|
572
|
-
tax_enabled?: boolean;
|
|
652
|
+
tax_enabled?: boolean; /** Stripe tax code for products without their own, e.g. "txcd_30011000" (clothing). */
|
|
653
|
+
default_tax_code?: string | null;
|
|
654
|
+
/** Your prices already include tax (common outside the US). */ prices_include_tax?: boolean;
|
|
573
655
|
default_success_url?: string | null;
|
|
574
656
|
default_cancel_url?: string | null;
|
|
575
657
|
builtin_emails?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -240,6 +240,14 @@ class Discounts extends Resource {
|
|
|
240
240
|
delete(idOrCode) { return this.client.request("DELETE", `/v1/discounts/${encodeURIComponent(idOrCode)}`); }
|
|
241
241
|
}
|
|
242
242
|
class Reports extends Resource {
|
|
243
|
+
/** Every order with its tax, for an accountant. Dates are YYYY-MM-DD (default: the last 365 days). */
|
|
244
|
+
taxOrders(params = {}) {
|
|
245
|
+
return this.client.request("GET", "/v1/reports/tax/orders", { query: params });
|
|
246
|
+
}
|
|
247
|
+
/** Sales and tax by state over the last `days` (default 365). `watch` flags US states near common registration thresholds. */
|
|
248
|
+
tax(params = {}) {
|
|
249
|
+
return this.client.request("GET", "/v1/reports/tax", { query: params });
|
|
250
|
+
}
|
|
243
251
|
/** Sales over the last `days` (default 30, max 366): totals vs the previous period, a time series and top products. */
|
|
244
252
|
sales(params = {}) { return this.client.request("GET", "/v1/reports/sales", { query: params }); }
|
|
245
253
|
}
|
|
@@ -362,6 +370,10 @@ class StoreResource extends Resource {
|
|
|
362
370
|
* Note on `tax_enabled`: Stripe only collects tax in jurisdictions where you have an active
|
|
363
371
|
* tax registration in Stripe Tax. Turning this on without registrations collects $0 tax.
|
|
364
372
|
*/
|
|
373
|
+
/** Sales tax readiness: Stripe Tax status, registrations, what to do next, and the tax categories to choose from. */
|
|
374
|
+
tax() {
|
|
375
|
+
return this.client.request("GET", "/v1/store/tax");
|
|
376
|
+
}
|
|
365
377
|
/**
|
|
366
378
|
* Preview a sync from this store's other version (test or live) into this store. Nothing changes.
|
|
367
379
|
* Syncs cover products, prices, images, collections, discounts and shipping/email settings; never orders, keys, Stripe, site URLs or stock counts.
|
package/dist/types.d.ts
CHANGED
|
@@ -89,6 +89,8 @@ export interface VariantFulfillment {
|
|
|
89
89
|
}
|
|
90
90
|
export type ProductCreateParams = {
|
|
91
91
|
name: string;
|
|
92
|
+
/** Stripe Tax category, e.g. "txcd_30011000" (clothing). Defaults to the store's default_tax_code. */
|
|
93
|
+
tax_code?: string | null;
|
|
92
94
|
/** Default artwork for every variant — artwork is usually per design, not per size. */
|
|
93
95
|
print_files?: PrintFile[];
|
|
94
96
|
description?: string;
|
|
@@ -107,6 +109,8 @@ export type ProductCreateParams = {
|
|
|
107
109
|
variants?: never;
|
|
108
110
|
});
|
|
109
111
|
export interface ProductUpdateParams {
|
|
112
|
+
/** Stripe Tax category; null falls back to the store's default_tax_code. */
|
|
113
|
+
tax_code?: string | null;
|
|
110
114
|
name?: string;
|
|
111
115
|
print_files?: PrintFile[] | null;
|
|
112
116
|
description?: string | null;
|
package/package.json
CHANGED