@misiki/gocommerce-connector 0.2.0 → 0.3.1
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/README.md +65 -18
- package/dist/{index-CJ836ZI3.d.cts → index-D8lNRhqJ.d.cts} +1044 -6
- package/dist/{index-CJ836ZI3.d.ts → index-D8lNRhqJ.d.ts} +1044 -6
- package/dist/index.cjs +1203 -699
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1196 -700
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +601 -97
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +594 -98
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,14 @@ interface Credentials {
|
|
|
36
36
|
* listing belong to, when the store sells through more than one.
|
|
37
37
|
*/
|
|
38
38
|
channel?: string;
|
|
39
|
+
/**
|
|
40
|
+
* `PUBLIC_GOCOMMERCE_LANGUAGE` — the language to ask the engine for, `fr`. Sent
|
|
41
|
+
* as `?lang=` on every read, which wins over the browser's Accept-Language
|
|
42
|
+
* and needs no CORS preflight. Product titles and descriptions follow it when
|
|
43
|
+
* the store has a translator installed, and content pages always do. Unset,
|
|
44
|
+
* the engine answers in the store's default language.
|
|
45
|
+
*/
|
|
46
|
+
language?: string;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
/**
|
|
@@ -479,6 +487,20 @@ type SearchResult = {
|
|
|
479
487
|
limit: number;
|
|
480
488
|
offset: number;
|
|
481
489
|
};
|
|
490
|
+
/** One approved vendor's offer on a variant, from `GET /api/variants/{id}/offers`. Cheapest first. */
|
|
491
|
+
type Offer = {
|
|
492
|
+
vendor_id: number;
|
|
493
|
+
vendor: string;
|
|
494
|
+
vendor_slug: string;
|
|
495
|
+
price: Money;
|
|
496
|
+
in_stock: boolean;
|
|
497
|
+
variant_id: number;
|
|
498
|
+
};
|
|
499
|
+
/** A menu's name, from `GET /x/navigation/menus`. */
|
|
500
|
+
type MenuSummary = {
|
|
501
|
+
handle: string;
|
|
502
|
+
title: string;
|
|
503
|
+
};
|
|
482
504
|
|
|
483
505
|
/**
|
|
484
506
|
* The state this connector keeps in the shopper's browser, and only there.
|
|
@@ -678,6 +700,7 @@ declare function toProduct(p: Product, extra?: {
|
|
|
678
700
|
attributes: {
|
|
679
701
|
name: string;
|
|
680
702
|
value: string;
|
|
703
|
+
handle: string;
|
|
681
704
|
}[];
|
|
682
705
|
metadata: Record<string, unknown> | null;
|
|
683
706
|
createdAt: string;
|
|
@@ -1105,6 +1128,16 @@ type EngineRequest = {
|
|
|
1105
1128
|
/** Send the signed-in shopper's bearer token. Only ext/identity reads it. */
|
|
1106
1129
|
auth?: boolean;
|
|
1107
1130
|
};
|
|
1131
|
+
/**
|
|
1132
|
+
* A media URL the shopper's browser can load. The engine answers its own
|
|
1133
|
+
* uploads root-relative (`/media/ab12.png`), which a browser resolves against
|
|
1134
|
+
* the storefront's origin, where no such file is. Through the proxy path when
|
|
1135
|
+
* one is set — a root-relative path that reads the same in SSR and in the
|
|
1136
|
+
* browser, so hydration agrees — and otherwise from the engine's origin.
|
|
1137
|
+
* Absolute URLs, such as pictures the media library links rather than holds,
|
|
1138
|
+
* pass through untouched.
|
|
1139
|
+
*/
|
|
1140
|
+
declare function mediaUrl(url: string | null | undefined): string | null;
|
|
1108
1141
|
/**
|
|
1109
1142
|
* BaseService — the one place this connector talks to the engine.
|
|
1110
1143
|
*
|
|
@@ -1227,6 +1260,13 @@ type CatalogQuery = {
|
|
|
1227
1260
|
category?: string;
|
|
1228
1261
|
priceFrom?: number;
|
|
1229
1262
|
priceTo?: number;
|
|
1263
|
+
/**
|
|
1264
|
+
* Attribute answers, `{ color: ['Red', 'Blue'] }`: one handle's values OR-ed,
|
|
1265
|
+
* different handles AND-ed. The engine filters on them in the whole-shop
|
|
1266
|
+
* listing only — its category route takes none — so inside a category they
|
|
1267
|
+
* are not applied.
|
|
1268
|
+
*/
|
|
1269
|
+
attributes?: Record<string, string[]>;
|
|
1230
1270
|
};
|
|
1231
1271
|
type CatalogPage = {
|
|
1232
1272
|
data: ReturnType<typeof toProduct>[] | ReturnType<typeof fromSearchDoc>[];
|
|
@@ -1374,6 +1414,7 @@ declare class ProductService extends CatalogService {
|
|
|
1374
1414
|
attributes: {
|
|
1375
1415
|
name: string;
|
|
1376
1416
|
value: string;
|
|
1417
|
+
handle: string;
|
|
1377
1418
|
}[];
|
|
1378
1419
|
metadata: Record<string, unknown> | null;
|
|
1379
1420
|
createdAt: string;
|
|
@@ -1486,6 +1527,7 @@ declare class ProductService extends CatalogService {
|
|
|
1486
1527
|
attributes: {
|
|
1487
1528
|
name: string;
|
|
1488
1529
|
value: string;
|
|
1530
|
+
handle: string;
|
|
1489
1531
|
}[];
|
|
1490
1532
|
metadata: Record<string, unknown> | null;
|
|
1491
1533
|
createdAt: string;
|
|
@@ -1633,6 +1675,7 @@ declare class ProductService extends CatalogService {
|
|
|
1633
1675
|
attributes: {
|
|
1634
1676
|
name: string;
|
|
1635
1677
|
value: string;
|
|
1678
|
+
handle: string;
|
|
1636
1679
|
}[];
|
|
1637
1680
|
metadata: Record<string, unknown> | null;
|
|
1638
1681
|
createdAt: string;
|
|
@@ -1779,6 +1822,7 @@ declare class ProductService extends CatalogService {
|
|
|
1779
1822
|
attributes: {
|
|
1780
1823
|
name: string;
|
|
1781
1824
|
value: string;
|
|
1825
|
+
handle: string;
|
|
1782
1826
|
}[];
|
|
1783
1827
|
metadata: Record<string, unknown> | null;
|
|
1784
1828
|
createdAt: string;
|
|
@@ -1927,6 +1971,7 @@ declare class ProductService extends CatalogService {
|
|
|
1927
1971
|
attributes: {
|
|
1928
1972
|
name: string;
|
|
1929
1973
|
value: string;
|
|
1974
|
+
handle: string;
|
|
1930
1975
|
}[];
|
|
1931
1976
|
metadata: Record<string, unknown> | null;
|
|
1932
1977
|
createdAt: string;
|
|
@@ -2130,6 +2175,7 @@ declare class SearchService extends CatalogService {
|
|
|
2130
2175
|
attributes: {
|
|
2131
2176
|
name: string;
|
|
2132
2177
|
value: string;
|
|
2178
|
+
handle: string;
|
|
2133
2179
|
}[];
|
|
2134
2180
|
metadata: Record<string, unknown> | null;
|
|
2135
2181
|
createdAt: string;
|
|
@@ -2301,6 +2347,7 @@ declare class MeilisearchService extends CatalogService {
|
|
|
2301
2347
|
attributes: {
|
|
2302
2348
|
name: string;
|
|
2303
2349
|
value: string;
|
|
2350
|
+
handle: string;
|
|
2304
2351
|
}[];
|
|
2305
2352
|
metadata: Record<string, unknown> | null;
|
|
2306
2353
|
createdAt: string;
|
|
@@ -2487,6 +2534,7 @@ declare class MeilisearchService extends CatalogService {
|
|
|
2487
2534
|
attributes: {
|
|
2488
2535
|
name: string;
|
|
2489
2536
|
value: string;
|
|
2537
|
+
handle: string;
|
|
2490
2538
|
}[];
|
|
2491
2539
|
metadata: Record<string, unknown> | null;
|
|
2492
2540
|
createdAt: string;
|
|
@@ -2675,6 +2723,7 @@ declare class CollectionService extends BaseService {
|
|
|
2675
2723
|
attributes: {
|
|
2676
2724
|
name: string;
|
|
2677
2725
|
value: string;
|
|
2726
|
+
handle: string;
|
|
2678
2727
|
}[];
|
|
2679
2728
|
metadata: Record<string, unknown> | null;
|
|
2680
2729
|
createdAt: string;
|
|
@@ -2782,6 +2831,7 @@ declare class CollectionService extends BaseService {
|
|
|
2782
2831
|
attributes: {
|
|
2783
2832
|
name: string;
|
|
2784
2833
|
value: string;
|
|
2834
|
+
handle: string;
|
|
2785
2835
|
}[];
|
|
2786
2836
|
metadata: Record<string, unknown> | null;
|
|
2787
2837
|
createdAt: string;
|
|
@@ -3858,8 +3908,37 @@ declare class CheckoutService extends BaseService {
|
|
|
3858
3908
|
}>;
|
|
3859
3909
|
checkoutStripe(): Promise<never>;
|
|
3860
3910
|
checkoutStripeCapture(): Promise<never>;
|
|
3861
|
-
|
|
3862
|
-
|
|
3911
|
+
/**
|
|
3912
|
+
* The storefront's generic redirect flow, which it reaches through the code
|
|
3913
|
+
* `PAYPAL`. The engine has no PayPal gateway; paymentMethodService puts the
|
|
3914
|
+
* store's first hosted-page gateway — Adyen, Paddle, Lemon Squeezy, Creem,
|
|
3915
|
+
* Hyperswitch or RevenueCat — under that code, with its own name and a
|
|
3916
|
+
* neutral icon, because this is the one storefront flow that sends a shopper
|
|
3917
|
+
* to a URL and back. The shopper returns to the success page; the gateway's
|
|
3918
|
+
* webhook tells the engine the order is paid.
|
|
3919
|
+
*/
|
|
3920
|
+
checkoutPaypal({ cartId, origin }?: {
|
|
3921
|
+
cartId?: string;
|
|
3922
|
+
origin?: string;
|
|
3923
|
+
return_url?: string;
|
|
3924
|
+
}): Promise<{
|
|
3925
|
+
redirect_url: string;
|
|
3926
|
+
order_no: string;
|
|
3927
|
+
}>;
|
|
3928
|
+
/**
|
|
3929
|
+
* Nothing to capture: a hosted-page gateway confirms the payment to the
|
|
3930
|
+
* engine by webhook. Answering, rather than throwing, sends the storefront's
|
|
3931
|
+
* process page on to the success page instead of the failure page.
|
|
3932
|
+
*/
|
|
3933
|
+
capturePaypalPayment({ order_no, }?: {
|
|
3934
|
+
order_no?: string;
|
|
3935
|
+
token?: string;
|
|
3936
|
+
PayerID?: string;
|
|
3937
|
+
storeId?: string;
|
|
3938
|
+
}): Promise<{
|
|
3939
|
+
order_no: string | null;
|
|
3940
|
+
status: string;
|
|
3941
|
+
}>;
|
|
3863
3942
|
checkoutCashfree(): Promise<never>;
|
|
3864
3943
|
captureCashfreePayment(): Promise<never>;
|
|
3865
3944
|
checkoutPhonepe(): Promise<never>;
|
|
@@ -3867,6 +3946,142 @@ declare class CheckoutService extends BaseService {
|
|
|
3867
3946
|
confirmAffirmOrder(): Promise<never>;
|
|
3868
3947
|
cancelAffirmOrder(): Promise<never>;
|
|
3869
3948
|
checkoutPOS(): Promise<never>;
|
|
3949
|
+
/**
|
|
3950
|
+
* Any payment method the engine has switched on, by its engine code —
|
|
3951
|
+
* `cod`, `stripe`, `razorpay`, `adyen`, `paddle`, `helcim`… For a storefront
|
|
3952
|
+
* that drives the payment itself: the answer says what to do next.
|
|
3953
|
+
*
|
|
3954
|
+
* - `kind: 'none'` — nothing to pay now (cash on delivery).
|
|
3955
|
+
* - `kind: 'client_action'` — mount the gateway's own widget with
|
|
3956
|
+
* `clientData`: Stripe's Payment Element takes `clientSecret`, Razorpay's
|
|
3957
|
+
* modal `razorpay_order_id` and `key_id`, Helcim's `checkout_token`.
|
|
3958
|
+
* - `kind: 'redirect'` — send the shopper to `redirectUrl`; `returnUrl` is
|
|
3959
|
+
* where the gateway brings them back.
|
|
3960
|
+
*
|
|
3961
|
+
* Either way the gateway's webhook tells the engine when the money arrives;
|
|
3962
|
+
* read `orderService.getOrder(orderNo).paymentStatus` to see it.
|
|
3963
|
+
*/
|
|
3964
|
+
checkout(code: string, { cartId, returnUrl, paymentData, metadata, }?: {
|
|
3965
|
+
cartId?: string;
|
|
3966
|
+
returnUrl?: string;
|
|
3967
|
+
paymentData?: Record<string, string>;
|
|
3968
|
+
metadata?: Record<string, unknown>;
|
|
3969
|
+
}): Promise<{
|
|
3970
|
+
orderNo: string;
|
|
3971
|
+
order: {
|
|
3972
|
+
id: string;
|
|
3973
|
+
orderNo: string;
|
|
3974
|
+
orderNumber: string;
|
|
3975
|
+
number: string;
|
|
3976
|
+
parentOrderNo: string;
|
|
3977
|
+
status: string;
|
|
3978
|
+
engineStatus: string;
|
|
3979
|
+
paymentStatus: string;
|
|
3980
|
+
paymentMethod: string;
|
|
3981
|
+
currencyCode: string;
|
|
3982
|
+
subtotal: number;
|
|
3983
|
+
shippingCharges: number;
|
|
3984
|
+
discount: number;
|
|
3985
|
+
tax: number;
|
|
3986
|
+
taxIncluded: boolean;
|
|
3987
|
+
total: number;
|
|
3988
|
+
refunded: number;
|
|
3989
|
+
codCharges: number;
|
|
3990
|
+
coupon: {
|
|
3991
|
+
code: string;
|
|
3992
|
+
} | null;
|
|
3993
|
+
userEmail: string;
|
|
3994
|
+
email: string;
|
|
3995
|
+
phone: string | null;
|
|
3996
|
+
shippingAddress: {
|
|
3997
|
+
firstName: string;
|
|
3998
|
+
lastName: string;
|
|
3999
|
+
email: string | null;
|
|
4000
|
+
phone: string | null;
|
|
4001
|
+
address_1: string;
|
|
4002
|
+
address_2: string;
|
|
4003
|
+
city: string;
|
|
4004
|
+
state: string;
|
|
4005
|
+
zip: string;
|
|
4006
|
+
country: string;
|
|
4007
|
+
countryCode: string;
|
|
4008
|
+
} | null;
|
|
4009
|
+
billingAddress: {
|
|
4010
|
+
firstName: string;
|
|
4011
|
+
lastName: string;
|
|
4012
|
+
email: string | null;
|
|
4013
|
+
phone: string | null;
|
|
4014
|
+
address_1: string;
|
|
4015
|
+
address_2: string;
|
|
4016
|
+
city: string;
|
|
4017
|
+
state: string;
|
|
4018
|
+
zip: string;
|
|
4019
|
+
country: string;
|
|
4020
|
+
countryCode: string;
|
|
4021
|
+
} | null;
|
|
4022
|
+
shippingMethod: string | null;
|
|
4023
|
+
shippingRate: {
|
|
4024
|
+
name: string;
|
|
4025
|
+
} | null;
|
|
4026
|
+
lineItems: {
|
|
4027
|
+
id: string;
|
|
4028
|
+
productId: string;
|
|
4029
|
+
variantId: string;
|
|
4030
|
+
sku: string;
|
|
4031
|
+
title: string;
|
|
4032
|
+
name: string;
|
|
4033
|
+
slug: string;
|
|
4034
|
+
thumbnail: string | null;
|
|
4035
|
+
img: string | null;
|
|
4036
|
+
variantTitle: string;
|
|
4037
|
+
qty: number;
|
|
4038
|
+
shippedQty: number;
|
|
4039
|
+
price: number;
|
|
4040
|
+
mrp: number;
|
|
4041
|
+
subtotal: number;
|
|
4042
|
+
total: number;
|
|
4043
|
+
currencyCode: string;
|
|
4044
|
+
status: string;
|
|
4045
|
+
files: never[];
|
|
4046
|
+
usedOptions: never[];
|
|
4047
|
+
}[];
|
|
4048
|
+
fulfillments: {
|
|
4049
|
+
id: string;
|
|
4050
|
+
status: string;
|
|
4051
|
+
carrier: string;
|
|
4052
|
+
trackingNumber: string | null;
|
|
4053
|
+
trackingUrl: string | null;
|
|
4054
|
+
lineItems: {
|
|
4055
|
+
id: string;
|
|
4056
|
+
title: string;
|
|
4057
|
+
qty: number;
|
|
4058
|
+
}[];
|
|
4059
|
+
createdAt: string;
|
|
4060
|
+
}[];
|
|
4061
|
+
tracking: never[];
|
|
4062
|
+
orderHistory: never[];
|
|
4063
|
+
isReplaceOrReturn: boolean;
|
|
4064
|
+
createdAt: string;
|
|
4065
|
+
updatedAt: string;
|
|
4066
|
+
};
|
|
4067
|
+
payment: {
|
|
4068
|
+
kind: "none" | "client_action" | "redirect";
|
|
4069
|
+
provider: string;
|
|
4070
|
+
reference: string | null;
|
|
4071
|
+
clientSecret: string;
|
|
4072
|
+
redirectUrl: string;
|
|
4073
|
+
clientData: Record<string, string>;
|
|
4074
|
+
};
|
|
4075
|
+
}>;
|
|
4076
|
+
/** Every payment method the engine has switched on, by engine code and name — drivable here or not. */
|
|
4077
|
+
listMethods(): Promise<{
|
|
4078
|
+
methods: {
|
|
4079
|
+
code: string;
|
|
4080
|
+
name: string;
|
|
4081
|
+
}[];
|
|
4082
|
+
currency: string;
|
|
4083
|
+
}>;
|
|
4084
|
+
private redirectGateway;
|
|
3870
4085
|
/**
|
|
3871
4086
|
* One checkout attempt.
|
|
3872
4087
|
*
|
|
@@ -3879,6 +4094,8 @@ declare class CheckoutService extends BaseService {
|
|
|
3879
4094
|
*/
|
|
3880
4095
|
private place;
|
|
3881
4096
|
}
|
|
4097
|
+
/** The engine's gateways that take payment on their own hosted page. */
|
|
4098
|
+
declare const REDIRECT_GATEWAYS: Set<string>;
|
|
3882
4099
|
declare const checkoutService: CheckoutService;
|
|
3883
4100
|
|
|
3884
4101
|
declare class PaymentMethodService extends BaseService {
|
|
@@ -4381,6 +4598,137 @@ declare class UserService extends BaseService {
|
|
|
4381
4598
|
createdAt: string;
|
|
4382
4599
|
updatedAt: string;
|
|
4383
4600
|
}>;
|
|
4601
|
+
/**
|
|
4602
|
+
* Mails the signed-in shopper a link to confirm their address. The engine
|
|
4603
|
+
* sends none at signup, and a confirmed address is what customer-group
|
|
4604
|
+
* prices are keyed on. 409 once confirmed; 429 within a minute of the last.
|
|
4605
|
+
*/
|
|
4606
|
+
requestEmailVerification(): Promise<{
|
|
4607
|
+
accepted: boolean;
|
|
4608
|
+
}>;
|
|
4609
|
+
/** Extends the session another thirty days. The token stays the same. */
|
|
4610
|
+
refreshSession(): Promise<{
|
|
4611
|
+
id: string;
|
|
4612
|
+
userId: string;
|
|
4613
|
+
email: string;
|
|
4614
|
+
phone: string | null;
|
|
4615
|
+
firstName: string;
|
|
4616
|
+
lastName: string;
|
|
4617
|
+
name: string;
|
|
4618
|
+
fullName: string;
|
|
4619
|
+
avatar: null;
|
|
4620
|
+
role: string;
|
|
4621
|
+
emailVerified: boolean;
|
|
4622
|
+
storeId: null;
|
|
4623
|
+
}>;
|
|
4624
|
+
/**
|
|
4625
|
+
* Files a guest order under the signed-in account, so it appears in their
|
|
4626
|
+
* order history. The order's access token is the proof of ownership: pass
|
|
4627
|
+
* it, or leave it out for an order placed from this browser, whose token was
|
|
4628
|
+
* kept at checkout.
|
|
4629
|
+
*
|
|
4630
|
+
* Never done automatically at sign-in. On a shared computer that would file
|
|
4631
|
+
* one person's orders — address and all — under whoever signed in next.
|
|
4632
|
+
*/
|
|
4633
|
+
claimOrder({ number, token }: {
|
|
4634
|
+
number: string;
|
|
4635
|
+
token?: string;
|
|
4636
|
+
}): Promise<{
|
|
4637
|
+
id: string;
|
|
4638
|
+
orderNo: string;
|
|
4639
|
+
orderNumber: string;
|
|
4640
|
+
number: string;
|
|
4641
|
+
parentOrderNo: string;
|
|
4642
|
+
status: string;
|
|
4643
|
+
engineStatus: string;
|
|
4644
|
+
paymentStatus: string;
|
|
4645
|
+
paymentMethod: string;
|
|
4646
|
+
currencyCode: string;
|
|
4647
|
+
subtotal: number;
|
|
4648
|
+
shippingCharges: number;
|
|
4649
|
+
discount: number;
|
|
4650
|
+
tax: number;
|
|
4651
|
+
taxIncluded: boolean;
|
|
4652
|
+
total: number;
|
|
4653
|
+
refunded: number;
|
|
4654
|
+
codCharges: number;
|
|
4655
|
+
coupon: {
|
|
4656
|
+
code: string;
|
|
4657
|
+
} | null;
|
|
4658
|
+
userEmail: string;
|
|
4659
|
+
email: string;
|
|
4660
|
+
phone: string | null;
|
|
4661
|
+
shippingAddress: {
|
|
4662
|
+
firstName: string;
|
|
4663
|
+
lastName: string;
|
|
4664
|
+
email: string | null;
|
|
4665
|
+
phone: string | null;
|
|
4666
|
+
address_1: string;
|
|
4667
|
+
address_2: string;
|
|
4668
|
+
city: string;
|
|
4669
|
+
state: string;
|
|
4670
|
+
zip: string;
|
|
4671
|
+
country: string;
|
|
4672
|
+
countryCode: string;
|
|
4673
|
+
} | null;
|
|
4674
|
+
billingAddress: {
|
|
4675
|
+
firstName: string;
|
|
4676
|
+
lastName: string;
|
|
4677
|
+
email: string | null;
|
|
4678
|
+
phone: string | null;
|
|
4679
|
+
address_1: string;
|
|
4680
|
+
address_2: string;
|
|
4681
|
+
city: string;
|
|
4682
|
+
state: string;
|
|
4683
|
+
zip: string;
|
|
4684
|
+
country: string;
|
|
4685
|
+
countryCode: string;
|
|
4686
|
+
} | null;
|
|
4687
|
+
shippingMethod: string | null;
|
|
4688
|
+
shippingRate: {
|
|
4689
|
+
name: string;
|
|
4690
|
+
} | null;
|
|
4691
|
+
lineItems: {
|
|
4692
|
+
id: string;
|
|
4693
|
+
productId: string;
|
|
4694
|
+
variantId: string;
|
|
4695
|
+
sku: string;
|
|
4696
|
+
title: string;
|
|
4697
|
+
name: string;
|
|
4698
|
+
slug: string;
|
|
4699
|
+
thumbnail: string | null;
|
|
4700
|
+
img: string | null;
|
|
4701
|
+
variantTitle: string;
|
|
4702
|
+
qty: number;
|
|
4703
|
+
shippedQty: number;
|
|
4704
|
+
price: number;
|
|
4705
|
+
mrp: number;
|
|
4706
|
+
subtotal: number;
|
|
4707
|
+
total: number;
|
|
4708
|
+
currencyCode: string;
|
|
4709
|
+
status: string;
|
|
4710
|
+
files: never[];
|
|
4711
|
+
usedOptions: never[];
|
|
4712
|
+
}[];
|
|
4713
|
+
fulfillments: {
|
|
4714
|
+
id: string;
|
|
4715
|
+
status: string;
|
|
4716
|
+
carrier: string;
|
|
4717
|
+
trackingNumber: string | null;
|
|
4718
|
+
trackingUrl: string | null;
|
|
4719
|
+
lineItems: {
|
|
4720
|
+
id: string;
|
|
4721
|
+
title: string;
|
|
4722
|
+
qty: number;
|
|
4723
|
+
}[];
|
|
4724
|
+
createdAt: string;
|
|
4725
|
+
}[];
|
|
4726
|
+
tracking: never[];
|
|
4727
|
+
orderHistory: never[];
|
|
4728
|
+
isReplaceOrReturn: boolean;
|
|
4729
|
+
createdAt: string;
|
|
4730
|
+
updatedAt: string;
|
|
4731
|
+
}>;
|
|
4384
4732
|
deleteUser(): Promise<never>;
|
|
4385
4733
|
checkEmail(): Promise<never>;
|
|
4386
4734
|
joinAsVendor(): Promise<never>;
|
|
@@ -4698,6 +5046,7 @@ declare class WishlistService extends BaseService {
|
|
|
4698
5046
|
attributes: {
|
|
4699
5047
|
name: string;
|
|
4700
5048
|
value: string;
|
|
5049
|
+
handle: string;
|
|
4701
5050
|
}[];
|
|
4702
5051
|
metadata: Record<string, unknown> | null;
|
|
4703
5052
|
createdAt: string;
|
|
@@ -4730,9 +5079,16 @@ declare class WishlistService extends BaseService {
|
|
|
4730
5079
|
productId: string;
|
|
4731
5080
|
variantId?: string | null;
|
|
4732
5081
|
}[]>;
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
5082
|
+
/**
|
|
5083
|
+
* The address the store may write to when a saved product is back in stock
|
|
5084
|
+
* or on sale; `''` takes it off. A list that does not exist yet is made.
|
|
5085
|
+
*/
|
|
5086
|
+
setEmail(email: string): Promise<{
|
|
5087
|
+
email: string | null;
|
|
5088
|
+
}>;
|
|
5089
|
+
private current;
|
|
5090
|
+
private create;
|
|
5091
|
+
}
|
|
4736
5092
|
declare const wishlistService: WishlistService;
|
|
4737
5093
|
|
|
4738
5094
|
/**
|
|
@@ -4834,6 +5190,10 @@ type StorefrontMenuItem = {
|
|
|
4834
5190
|
declare class MenuService extends BaseService {
|
|
4835
5191
|
private readonly facts;
|
|
4836
5192
|
list(_args?: Record<string, unknown>): Promise<{} | null>;
|
|
5193
|
+
/** Every menu the store keeps, by handle — not only the header and footer. */
|
|
5194
|
+
listMenus(): Promise<MenuSummary[]>;
|
|
5195
|
+
/** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
|
|
5196
|
+
getMenu(handle: string): Promise<StorefrontMenu>;
|
|
4837
5197
|
/** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
|
|
4838
5198
|
engineMenus(): Promise<StorefrontMenu[] | null>;
|
|
4839
5199
|
}
|
|
@@ -4872,6 +5232,12 @@ declare class StoreService extends BaseService {
|
|
|
4872
5232
|
* clean 404 rather than a crash.
|
|
4873
5233
|
*/
|
|
4874
5234
|
get<T = any>(path: string): Promise<T>;
|
|
5235
|
+
/**
|
|
5236
|
+
* The storefront's newsletter box posts `{ email }` to Litekart's
|
|
5237
|
+
* `/api/newsletter/subscribe` through this verb; ext/newsletter is where
|
|
5238
|
+
* that list lives here.
|
|
5239
|
+
*/
|
|
5240
|
+
post<T = any>(path: string, data?: unknown): Promise<T>;
|
|
4875
5241
|
private live;
|
|
4876
5242
|
}
|
|
4877
5243
|
declare const storeService: StoreService;
|
|
@@ -5274,6 +5640,7 @@ declare class AutocompleteService extends MeilisearchService {
|
|
|
5274
5640
|
attributes: {
|
|
5275
5641
|
name: string;
|
|
5276
5642
|
value: string;
|
|
5643
|
+
handle: string;
|
|
5277
5644
|
}[];
|
|
5278
5645
|
metadata: Record<string, unknown> | null;
|
|
5279
5646
|
createdAt: string;
|
|
@@ -5421,4 +5788,675 @@ declare const varniCustomProductService: VarniCustomProductService;
|
|
|
5421
5788
|
declare const pluginsService: PluginService;
|
|
5422
5789
|
declare const settingsService: SettingService;
|
|
5423
5790
|
|
|
5424
|
-
|
|
5791
|
+
/**
|
|
5792
|
+
* Variants on their own, and the marketplace's offers on one.
|
|
5793
|
+
*
|
|
5794
|
+
* Svelte Commerce reads variants through their product, so this service is
|
|
5795
|
+
* for code written against GoCommerce: it answers the engine's own shapes —
|
|
5796
|
+
* numeric ids, money as `{ amount_minor, currency }` — with a major-unit
|
|
5797
|
+
* `amount` added beside each price so a template need not divide.
|
|
5798
|
+
*/
|
|
5799
|
+
declare class VariantService extends BaseService {
|
|
5800
|
+
/** A product's variants, inactive ones included (filter on `active`), in the merchant's order. */
|
|
5801
|
+
list(productId: string | number, { page, limit }?: {
|
|
5802
|
+
page?: number;
|
|
5803
|
+
limit?: number;
|
|
5804
|
+
}): Promise<{
|
|
5805
|
+
data: {
|
|
5806
|
+
price: {
|
|
5807
|
+
amount: number;
|
|
5808
|
+
amount_minor: number;
|
|
5809
|
+
currency: string;
|
|
5810
|
+
};
|
|
5811
|
+
compare_at_price: {
|
|
5812
|
+
amount: number;
|
|
5813
|
+
amount_minor: number;
|
|
5814
|
+
currency: string;
|
|
5815
|
+
} | undefined;
|
|
5816
|
+
id: number;
|
|
5817
|
+
product_id: number;
|
|
5818
|
+
sku: string;
|
|
5819
|
+
barcode?: string;
|
|
5820
|
+
taxable: boolean;
|
|
5821
|
+
requires_shipping: boolean;
|
|
5822
|
+
options: string[] | null;
|
|
5823
|
+
label: string;
|
|
5824
|
+
available: number;
|
|
5825
|
+
track_inventory: boolean;
|
|
5826
|
+
continue_selling: boolean;
|
|
5827
|
+
active: boolean;
|
|
5828
|
+
origin_country?: string;
|
|
5829
|
+
hs_code?: string;
|
|
5830
|
+
weight_grams?: number;
|
|
5831
|
+
dimensions?: {
|
|
5832
|
+
length_mm?: number;
|
|
5833
|
+
width_mm?: number;
|
|
5834
|
+
height_mm?: number;
|
|
5835
|
+
};
|
|
5836
|
+
images?: VariantImage[];
|
|
5837
|
+
image?: VariantImage;
|
|
5838
|
+
position: number;
|
|
5839
|
+
metadata?: Record<string, unknown>;
|
|
5840
|
+
}[];
|
|
5841
|
+
meta: ListMeta | undefined;
|
|
5842
|
+
}>;
|
|
5843
|
+
getOne(id: string | number): Promise<{
|
|
5844
|
+
price: {
|
|
5845
|
+
amount: number;
|
|
5846
|
+
amount_minor: number;
|
|
5847
|
+
currency: string;
|
|
5848
|
+
};
|
|
5849
|
+
compare_at_price: {
|
|
5850
|
+
amount: number;
|
|
5851
|
+
amount_minor: number;
|
|
5852
|
+
currency: string;
|
|
5853
|
+
} | undefined;
|
|
5854
|
+
id: number;
|
|
5855
|
+
product_id: number;
|
|
5856
|
+
sku: string;
|
|
5857
|
+
barcode?: string;
|
|
5858
|
+
taxable: boolean;
|
|
5859
|
+
requires_shipping: boolean;
|
|
5860
|
+
options: string[] | null;
|
|
5861
|
+
label: string;
|
|
5862
|
+
available: number;
|
|
5863
|
+
track_inventory: boolean;
|
|
5864
|
+
continue_selling: boolean;
|
|
5865
|
+
active: boolean;
|
|
5866
|
+
origin_country?: string;
|
|
5867
|
+
hs_code?: string;
|
|
5868
|
+
weight_grams?: number;
|
|
5869
|
+
dimensions?: {
|
|
5870
|
+
length_mm?: number;
|
|
5871
|
+
width_mm?: number;
|
|
5872
|
+
height_mm?: number;
|
|
5873
|
+
};
|
|
5874
|
+
images?: VariantImage[];
|
|
5875
|
+
image?: VariantImage;
|
|
5876
|
+
position: number;
|
|
5877
|
+
metadata?: Record<string, unknown>;
|
|
5878
|
+
}>;
|
|
5879
|
+
/**
|
|
5880
|
+
* What each approved seller asks for this variant, cheapest first. A cart
|
|
5881
|
+
* line takes a variant, not an offer, so this informs a shopper rather than
|
|
5882
|
+
* choosing who fulfils.
|
|
5883
|
+
*/
|
|
5884
|
+
offers(variantId: string | number): Promise<{
|
|
5885
|
+
price: {
|
|
5886
|
+
amount: number;
|
|
5887
|
+
amount_minor: number;
|
|
5888
|
+
currency: string;
|
|
5889
|
+
};
|
|
5890
|
+
vendor_id: number;
|
|
5891
|
+
vendor: string;
|
|
5892
|
+
vendor_slug: string;
|
|
5893
|
+
in_stock: boolean;
|
|
5894
|
+
variant_id: number;
|
|
5895
|
+
}[]>;
|
|
5896
|
+
}
|
|
5897
|
+
declare const variantService: VariantService;
|
|
5898
|
+
|
|
5899
|
+
/**
|
|
5900
|
+
* The signup box and its unsubscribe link (ext/newsletter). Subscribing twice
|
|
5901
|
+
* is not an error, and unsubscribing answers the same whether or not the token
|
|
5902
|
+
* matched, so neither call tells a stranger whether an address is on the list.
|
|
5903
|
+
*/
|
|
5904
|
+
declare class NewsletterService extends BaseService {
|
|
5905
|
+
subscribe({ email, name, source }: {
|
|
5906
|
+
email: string;
|
|
5907
|
+
name?: string;
|
|
5908
|
+
source?: string;
|
|
5909
|
+
}): Promise<{
|
|
5910
|
+
status: "subscribed";
|
|
5911
|
+
}>;
|
|
5912
|
+
/** The token from the unsubscribe link in a newsletter email. */
|
|
5913
|
+
unsubscribe(token: string): Promise<{
|
|
5914
|
+
status: "unsubscribed";
|
|
5915
|
+
}>;
|
|
5916
|
+
}
|
|
5917
|
+
declare const newsletterService: NewsletterService;
|
|
5918
|
+
|
|
5919
|
+
type B2bRole = 'admin' | 'approver' | 'buyer';
|
|
5920
|
+
type Company = {
|
|
5921
|
+
id: number;
|
|
5922
|
+
code: string;
|
|
5923
|
+
name: string;
|
|
5924
|
+
tax_id: string;
|
|
5925
|
+
status: 'active' | 'on_hold' | 'closed';
|
|
5926
|
+
group_id: number | null;
|
|
5927
|
+
/** `null`: no account with the store — the company pays up front. */
|
|
5928
|
+
credit_limit: Money | null;
|
|
5929
|
+
net_days: number;
|
|
5930
|
+
/** `null`: a buyer never needs approval. */
|
|
5931
|
+
approval_threshold: Money | null;
|
|
5932
|
+
require_po: boolean;
|
|
5933
|
+
member_count: number;
|
|
5934
|
+
/** More than 0: the company is a dealer, and receives leads. */
|
|
5935
|
+
territory_count: number;
|
|
5936
|
+
created_at: string;
|
|
5937
|
+
updated_at: string;
|
|
5938
|
+
};
|
|
5939
|
+
type Credit = {
|
|
5940
|
+
limit: Money | null;
|
|
5941
|
+
outstanding: Money;
|
|
5942
|
+
available: Money | null;
|
|
5943
|
+
overdue: Money;
|
|
5944
|
+
overdue_orders: number;
|
|
5945
|
+
net_days: number;
|
|
5946
|
+
};
|
|
5947
|
+
type Member = {
|
|
5948
|
+
company_id: number;
|
|
5949
|
+
customer_id: number;
|
|
5950
|
+
email: string;
|
|
5951
|
+
confirmed: boolean;
|
|
5952
|
+
name: string;
|
|
5953
|
+
role: B2bRole;
|
|
5954
|
+
created_at: string;
|
|
5955
|
+
};
|
|
5956
|
+
type Invitation = {
|
|
5957
|
+
id: number;
|
|
5958
|
+
company_id: number;
|
|
5959
|
+
email: string;
|
|
5960
|
+
role: B2bRole;
|
|
5961
|
+
invited_by: string;
|
|
5962
|
+
expires_at: string;
|
|
5963
|
+
accepted_at?: string;
|
|
5964
|
+
created_at: string;
|
|
5965
|
+
};
|
|
5966
|
+
type CompanyOrder = {
|
|
5967
|
+
order_id: number;
|
|
5968
|
+
number: string;
|
|
5969
|
+
status: string;
|
|
5970
|
+
payment_status: string;
|
|
5971
|
+
total: Money;
|
|
5972
|
+
po_number: string;
|
|
5973
|
+
placed_by: string;
|
|
5974
|
+
on_account: boolean;
|
|
5975
|
+
due_at?: string;
|
|
5976
|
+
overdue: boolean;
|
|
5977
|
+
company_id: number;
|
|
5978
|
+
company_name: string;
|
|
5979
|
+
approval_id?: number;
|
|
5980
|
+
quote_id?: number;
|
|
5981
|
+
created_at: string;
|
|
5982
|
+
};
|
|
5983
|
+
type Approval = {
|
|
5984
|
+
id: number;
|
|
5985
|
+
company_id: number;
|
|
5986
|
+
kind: 'cart' | 'quote';
|
|
5987
|
+
quote_id?: number;
|
|
5988
|
+
status: 'pending' | 'placing' | 'approved' | 'rejected' | 'cancelled';
|
|
5989
|
+
requested_by: number;
|
|
5990
|
+
requested_by_email: string;
|
|
5991
|
+
lines: {
|
|
5992
|
+
variant_id: number;
|
|
5993
|
+
sku: string;
|
|
5994
|
+
quantity: number;
|
|
5995
|
+
unit_price: Money;
|
|
5996
|
+
}[];
|
|
5997
|
+
subtotal: Money;
|
|
5998
|
+
total: Money;
|
|
5999
|
+
payment_method: string;
|
|
6000
|
+
po_number: string;
|
|
6001
|
+
decided_by?: number;
|
|
6002
|
+
decided_at?: string;
|
|
6003
|
+
reason?: string;
|
|
6004
|
+
last_error?: string;
|
|
6005
|
+
order_id?: number;
|
|
6006
|
+
order_number?: string;
|
|
6007
|
+
created_at: string;
|
|
6008
|
+
updated_at: string;
|
|
6009
|
+
};
|
|
6010
|
+
type Quote = {
|
|
6011
|
+
id: number;
|
|
6012
|
+
number: string;
|
|
6013
|
+
company_id: number;
|
|
6014
|
+
company_name: string;
|
|
6015
|
+
status: 'requested' | 'quoted' | 'awaiting_approval' | 'accepted' | 'declined' | 'expired';
|
|
6016
|
+
requested_by: number;
|
|
6017
|
+
requested_by_email: string;
|
|
6018
|
+
note: string;
|
|
6019
|
+
reply: string;
|
|
6020
|
+
declined_by?: string;
|
|
6021
|
+
lines: {
|
|
6022
|
+
variant_id: number;
|
|
6023
|
+
sku: string;
|
|
6024
|
+
title: string;
|
|
6025
|
+
quantity: number;
|
|
6026
|
+
unit_price: Money | null;
|
|
6027
|
+
}[];
|
|
6028
|
+
total: Money | null;
|
|
6029
|
+
expires_at?: string;
|
|
6030
|
+
quoted_at?: string;
|
|
6031
|
+
accepted_at?: string;
|
|
6032
|
+
order_id?: number;
|
|
6033
|
+
order_number?: string;
|
|
6034
|
+
created_at: string;
|
|
6035
|
+
updated_at: string;
|
|
6036
|
+
};
|
|
6037
|
+
type Lead = {
|
|
6038
|
+
id: number;
|
|
6039
|
+
name: string;
|
|
6040
|
+
email: string;
|
|
6041
|
+
phone: string;
|
|
6042
|
+
message: string;
|
|
6043
|
+
country: string;
|
|
6044
|
+
state: string;
|
|
6045
|
+
postal_code: string;
|
|
6046
|
+
variant_id: number | null;
|
|
6047
|
+
product_id: number | null;
|
|
6048
|
+
product_title?: string;
|
|
6049
|
+
variant_sku?: string;
|
|
6050
|
+
status: 'new' | 'contacted' | 'won' | 'lost';
|
|
6051
|
+
company_id: number | null;
|
|
6052
|
+
company_name?: string;
|
|
6053
|
+
routed_by: 'territory' | 'store' | 'unrouted';
|
|
6054
|
+
source: string;
|
|
6055
|
+
created_at: string;
|
|
6056
|
+
updated_at: string;
|
|
6057
|
+
};
|
|
6058
|
+
type RejectedLine = {
|
|
6059
|
+
sku: string;
|
|
6060
|
+
variant_id: number | null;
|
|
6061
|
+
quantity: number;
|
|
6062
|
+
reason: 'not_found' | 'inactive' | 'insufficient_stock' | 'invalid';
|
|
6063
|
+
message: string;
|
|
6064
|
+
};
|
|
6065
|
+
type Paged<T> = {
|
|
6066
|
+
data: T[];
|
|
6067
|
+
meta?: ListMeta;
|
|
6068
|
+
};
|
|
6069
|
+
type PlaceOptions = {
|
|
6070
|
+
/** An engine payment code; omitted, the company's account (`on_account`) when it has one. */
|
|
6071
|
+
paymentMethod?: string;
|
|
6072
|
+
/** Required when the company says so (`company.require_po`). */
|
|
6073
|
+
poNumber?: string;
|
|
6074
|
+
name?: string;
|
|
6075
|
+
phone?: string;
|
|
6076
|
+
/** Defaults to the address the checkout's address step kept for this cart. */
|
|
6077
|
+
address?: StorefrontAddress | Address;
|
|
6078
|
+
};
|
|
6079
|
+
/** A checkout or quote acceptance either placed an order or, for a buyer over the limit, asked for approval. */
|
|
6080
|
+
type B2bPlaced = {
|
|
6081
|
+
kind: 'order';
|
|
6082
|
+
orderNo: string;
|
|
6083
|
+
order: ReturnType<typeof toOrder>;
|
|
6084
|
+
payment: PaymentIntent;
|
|
6085
|
+
} | {
|
|
6086
|
+
kind: 'approval';
|
|
6087
|
+
approval: Approval;
|
|
6088
|
+
};
|
|
6089
|
+
/**
|
|
6090
|
+
* Buying for a business (ext/b2b): a company with buyers in roles, orders on
|
|
6091
|
+
* account against a credit limit, approvals, quotes, a quick order by SKU, a
|
|
6092
|
+
* repeat order, and a dealer's leads.
|
|
6093
|
+
*
|
|
6094
|
+
* Every call but `submitLead` needs a signed-in shopper (ext/identity) who is
|
|
6095
|
+
* a member of a company; a signed-in account that is not answers 403, so
|
|
6096
|
+
* `me()` is how a storefront tells a business account from a consumer one.
|
|
6097
|
+
* Answers are the engine's own shapes — numeric ids, money as
|
|
6098
|
+
* `{ amount_minor, currency }` — except carts, which come back as the
|
|
6099
|
+
* storefront's bag so a quick-order page can hand them straight to it.
|
|
6100
|
+
*/
|
|
6101
|
+
declare class B2bService extends BaseService {
|
|
6102
|
+
/** The company, the caller's role in it, and its credit: limit, outstanding, available, overdue. */
|
|
6103
|
+
me(): Promise<{
|
|
6104
|
+
company: Company;
|
|
6105
|
+
role: B2bRole;
|
|
6106
|
+
credit: Credit;
|
|
6107
|
+
}>;
|
|
6108
|
+
members(): Promise<Member[]>;
|
|
6109
|
+
/** Admin only. Demoting the last admin is refused (409). */
|
|
6110
|
+
setMemberRole(customerId: number | string, role: B2bRole): Promise<Member>;
|
|
6111
|
+
/** An admin removes anyone; any member may remove themselves. */
|
|
6112
|
+
removeMember(customerId: number | string): Promise<void>;
|
|
6113
|
+
/** Admin only. Open invitations: not accepted, not expired. */
|
|
6114
|
+
invitations(): Promise<Invitation[]>;
|
|
6115
|
+
/** Admin only. Emails a link; a second invitation to the same address replaces the first. */
|
|
6116
|
+
invite({ email, role }: {
|
|
6117
|
+
email: string;
|
|
6118
|
+
role: B2bRole;
|
|
6119
|
+
}): Promise<Invitation>;
|
|
6120
|
+
withdrawInvitation(invitationId: number | string): Promise<void>;
|
|
6121
|
+
/**
|
|
6122
|
+
* The token from the invitation email, accepted by the account it was sent
|
|
6123
|
+
* to — which also confirms that account's email address.
|
|
6124
|
+
*/
|
|
6125
|
+
acceptInvitation(token: string): Promise<Member>;
|
|
6126
|
+
/**
|
|
6127
|
+
* A quick order: up to 500 lines by SKU or variant id, into the bag (or a new
|
|
6128
|
+
* one), at the company's prices. A line that will not go in is reported in
|
|
6129
|
+
* `rejected` with its reason; the rest are added.
|
|
6130
|
+
*/
|
|
6131
|
+
addLines({ cartId, lines, }: {
|
|
6132
|
+
cartId?: string;
|
|
6133
|
+
lines: {
|
|
6134
|
+
sku?: string;
|
|
6135
|
+
variantId?: number | string;
|
|
6136
|
+
quantity: number;
|
|
6137
|
+
}[];
|
|
6138
|
+
}): Promise<{
|
|
6139
|
+
cart: {
|
|
6140
|
+
id: string;
|
|
6141
|
+
status: "open" | "converted" | "abandoned";
|
|
6142
|
+
email: string | null;
|
|
6143
|
+
phone: string | null;
|
|
6144
|
+
name: string | null;
|
|
6145
|
+
lineItems: {
|
|
6146
|
+
id: string;
|
|
6147
|
+
productId: string;
|
|
6148
|
+
variantId: string;
|
|
6149
|
+
sku: string;
|
|
6150
|
+
title: string;
|
|
6151
|
+
name: string;
|
|
6152
|
+
slug: string;
|
|
6153
|
+
thumbnail: string | null;
|
|
6154
|
+
variantTitle: string;
|
|
6155
|
+
qty: number;
|
|
6156
|
+
price: number;
|
|
6157
|
+
mrp: number;
|
|
6158
|
+
subtotal: number;
|
|
6159
|
+
total: number;
|
|
6160
|
+
inStock: boolean;
|
|
6161
|
+
priceChanged: boolean;
|
|
6162
|
+
currentPrice: number;
|
|
6163
|
+
isSelectedForCheckout: boolean;
|
|
6164
|
+
variant: {
|
|
6165
|
+
id: string;
|
|
6166
|
+
options: {
|
|
6167
|
+
option: {
|
|
6168
|
+
title: string;
|
|
6169
|
+
};
|
|
6170
|
+
value: string;
|
|
6171
|
+
}[];
|
|
6172
|
+
};
|
|
6173
|
+
product: {
|
|
6174
|
+
id: string;
|
|
6175
|
+
categories: unknown[];
|
|
6176
|
+
};
|
|
6177
|
+
}[];
|
|
6178
|
+
qty: number;
|
|
6179
|
+
currencyCode: string;
|
|
6180
|
+
currency: string;
|
|
6181
|
+
subtotal: number;
|
|
6182
|
+
discountAmount: number;
|
|
6183
|
+
savingAmount: number;
|
|
6184
|
+
couponCode: string | null;
|
|
6185
|
+
discount: AppliedDiscount | null;
|
|
6186
|
+
shippingCharges: number;
|
|
6187
|
+
shippingRateId: string | null;
|
|
6188
|
+
shippingMethod: string | null;
|
|
6189
|
+
tax: number;
|
|
6190
|
+
taxIncluded: boolean;
|
|
6191
|
+
codCharges: number;
|
|
6192
|
+
total: number;
|
|
6193
|
+
shippingAddress: StorefrontAddress | null;
|
|
6194
|
+
shippingAddressId: string | null;
|
|
6195
|
+
billingAddress: StorefrontAddress | null;
|
|
6196
|
+
billingAddressId: string | null;
|
|
6197
|
+
paymentMethod: null;
|
|
6198
|
+
needAddress: boolean;
|
|
6199
|
+
completedAt: string | null;
|
|
6200
|
+
createdAt: string;
|
|
6201
|
+
updatedAt: string;
|
|
6202
|
+
expiresAt: string;
|
|
6203
|
+
};
|
|
6204
|
+
rejected: RejectedLine[];
|
|
6205
|
+
}>;
|
|
6206
|
+
/** A past order's lines in a new bag, at today's prices. Nothing is placed. */
|
|
6207
|
+
reorder(orderId: number | string): Promise<{
|
|
6208
|
+
cart: {
|
|
6209
|
+
id: string;
|
|
6210
|
+
status: "open" | "converted" | "abandoned";
|
|
6211
|
+
email: string | null;
|
|
6212
|
+
phone: string | null;
|
|
6213
|
+
name: string | null;
|
|
6214
|
+
lineItems: {
|
|
6215
|
+
id: string;
|
|
6216
|
+
productId: string;
|
|
6217
|
+
variantId: string;
|
|
6218
|
+
sku: string;
|
|
6219
|
+
title: string;
|
|
6220
|
+
name: string;
|
|
6221
|
+
slug: string;
|
|
6222
|
+
thumbnail: string | null;
|
|
6223
|
+
variantTitle: string;
|
|
6224
|
+
qty: number;
|
|
6225
|
+
price: number;
|
|
6226
|
+
mrp: number;
|
|
6227
|
+
subtotal: number;
|
|
6228
|
+
total: number;
|
|
6229
|
+
inStock: boolean;
|
|
6230
|
+
priceChanged: boolean;
|
|
6231
|
+
currentPrice: number;
|
|
6232
|
+
isSelectedForCheckout: boolean;
|
|
6233
|
+
variant: {
|
|
6234
|
+
id: string;
|
|
6235
|
+
options: {
|
|
6236
|
+
option: {
|
|
6237
|
+
title: string;
|
|
6238
|
+
};
|
|
6239
|
+
value: string;
|
|
6240
|
+
}[];
|
|
6241
|
+
};
|
|
6242
|
+
product: {
|
|
6243
|
+
id: string;
|
|
6244
|
+
categories: unknown[];
|
|
6245
|
+
};
|
|
6246
|
+
}[];
|
|
6247
|
+
qty: number;
|
|
6248
|
+
currencyCode: string;
|
|
6249
|
+
currency: string;
|
|
6250
|
+
subtotal: number;
|
|
6251
|
+
discountAmount: number;
|
|
6252
|
+
savingAmount: number;
|
|
6253
|
+
couponCode: string | null;
|
|
6254
|
+
discount: AppliedDiscount | null;
|
|
6255
|
+
shippingCharges: number;
|
|
6256
|
+
shippingRateId: string | null;
|
|
6257
|
+
shippingMethod: string | null;
|
|
6258
|
+
tax: number;
|
|
6259
|
+
taxIncluded: boolean;
|
|
6260
|
+
codCharges: number;
|
|
6261
|
+
total: number;
|
|
6262
|
+
shippingAddress: StorefrontAddress | null;
|
|
6263
|
+
shippingAddressId: string | null;
|
|
6264
|
+
billingAddress: StorefrontAddress | null;
|
|
6265
|
+
billingAddressId: string | null;
|
|
6266
|
+
paymentMethod: null;
|
|
6267
|
+
needAddress: boolean;
|
|
6268
|
+
completedAt: string | null;
|
|
6269
|
+
createdAt: string;
|
|
6270
|
+
updatedAt: string;
|
|
6271
|
+
expiresAt: string;
|
|
6272
|
+
};
|
|
6273
|
+
rejected: RejectedLine[];
|
|
6274
|
+
}>;
|
|
6275
|
+
/**
|
|
6276
|
+
* Places the bag through the company: on account by default, with a PO
|
|
6277
|
+
* number, optionally only some lines (`lineIds`). A buyer over the company's
|
|
6278
|
+
* approval threshold gets `{ kind: 'approval' }` instead of an order — the
|
|
6279
|
+
* bag stays as it was, and an approver places it later.
|
|
6280
|
+
*
|
|
6281
|
+
* Over the credit limit is 403 `credit_limit_exceeded`; `me().credit` says
|
|
6282
|
+
* how much is available before the shopper tries.
|
|
6283
|
+
*/
|
|
6284
|
+
checkout({ cartId, lineIds, shippingRateId, returnUrl, paymentData, ...opts }?: PlaceOptions & {
|
|
6285
|
+
cartId?: string;
|
|
6286
|
+
lineIds?: (number | string)[];
|
|
6287
|
+
shippingRateId?: number | string;
|
|
6288
|
+
returnUrl?: string;
|
|
6289
|
+
paymentData?: Record<string, string>;
|
|
6290
|
+
}): Promise<B2bPlaced>;
|
|
6291
|
+
/** Admins and approvers see the company's; a buyer sees their own. `q` matches the number, PO or email. */
|
|
6292
|
+
orders({ page, limit, q, overdue, }?: {
|
|
6293
|
+
page?: number;
|
|
6294
|
+
limit?: number;
|
|
6295
|
+
q?: string;
|
|
6296
|
+
overdue?: boolean;
|
|
6297
|
+
}): Promise<Paged<CompanyOrder>>;
|
|
6298
|
+
approvals({ page, limit, status, }?: {
|
|
6299
|
+
page?: number;
|
|
6300
|
+
limit?: number;
|
|
6301
|
+
status?: Approval['status'];
|
|
6302
|
+
}): Promise<Paged<Approval>>;
|
|
6303
|
+
approval(approvalId: number | string): Promise<Approval>;
|
|
6304
|
+
/**
|
|
6305
|
+
* Admin or approver: places the requested order at the prices it was
|
|
6306
|
+
* requested at. Credit limits and holds still apply. The payment intent is
|
|
6307
|
+
* the approver's to act on — for an account order there is nothing to do.
|
|
6308
|
+
*/
|
|
6309
|
+
approve(approvalId: number | string): Promise<{
|
|
6310
|
+
approval: Approval;
|
|
6311
|
+
orderNo: string;
|
|
6312
|
+
order: {
|
|
6313
|
+
id: string;
|
|
6314
|
+
orderNo: string;
|
|
6315
|
+
orderNumber: string;
|
|
6316
|
+
number: string;
|
|
6317
|
+
parentOrderNo: string;
|
|
6318
|
+
status: string;
|
|
6319
|
+
engineStatus: string;
|
|
6320
|
+
paymentStatus: string;
|
|
6321
|
+
paymentMethod: string;
|
|
6322
|
+
currencyCode: string;
|
|
6323
|
+
subtotal: number;
|
|
6324
|
+
shippingCharges: number;
|
|
6325
|
+
discount: number;
|
|
6326
|
+
tax: number;
|
|
6327
|
+
taxIncluded: boolean;
|
|
6328
|
+
total: number;
|
|
6329
|
+
refunded: number;
|
|
6330
|
+
codCharges: number;
|
|
6331
|
+
coupon: {
|
|
6332
|
+
code: string;
|
|
6333
|
+
} | null;
|
|
6334
|
+
userEmail: string;
|
|
6335
|
+
email: string;
|
|
6336
|
+
phone: string | null;
|
|
6337
|
+
shippingAddress: {
|
|
6338
|
+
firstName: string;
|
|
6339
|
+
lastName: string;
|
|
6340
|
+
email: string | null;
|
|
6341
|
+
phone: string | null;
|
|
6342
|
+
address_1: string;
|
|
6343
|
+
address_2: string;
|
|
6344
|
+
city: string;
|
|
6345
|
+
state: string;
|
|
6346
|
+
zip: string;
|
|
6347
|
+
country: string;
|
|
6348
|
+
countryCode: string;
|
|
6349
|
+
} | null;
|
|
6350
|
+
billingAddress: {
|
|
6351
|
+
firstName: string;
|
|
6352
|
+
lastName: string;
|
|
6353
|
+
email: string | null;
|
|
6354
|
+
phone: string | null;
|
|
6355
|
+
address_1: string;
|
|
6356
|
+
address_2: string;
|
|
6357
|
+
city: string;
|
|
6358
|
+
state: string;
|
|
6359
|
+
zip: string;
|
|
6360
|
+
country: string;
|
|
6361
|
+
countryCode: string;
|
|
6362
|
+
} | null;
|
|
6363
|
+
shippingMethod: string | null;
|
|
6364
|
+
shippingRate: {
|
|
6365
|
+
name: string;
|
|
6366
|
+
} | null;
|
|
6367
|
+
lineItems: {
|
|
6368
|
+
id: string;
|
|
6369
|
+
productId: string;
|
|
6370
|
+
variantId: string;
|
|
6371
|
+
sku: string;
|
|
6372
|
+
title: string;
|
|
6373
|
+
name: string;
|
|
6374
|
+
slug: string;
|
|
6375
|
+
thumbnail: string | null;
|
|
6376
|
+
img: string | null;
|
|
6377
|
+
variantTitle: string;
|
|
6378
|
+
qty: number;
|
|
6379
|
+
shippedQty: number;
|
|
6380
|
+
price: number;
|
|
6381
|
+
mrp: number;
|
|
6382
|
+
subtotal: number;
|
|
6383
|
+
total: number;
|
|
6384
|
+
currencyCode: string;
|
|
6385
|
+
status: string;
|
|
6386
|
+
files: never[];
|
|
6387
|
+
usedOptions: never[];
|
|
6388
|
+
}[];
|
|
6389
|
+
fulfillments: {
|
|
6390
|
+
id: string;
|
|
6391
|
+
status: string;
|
|
6392
|
+
carrier: string;
|
|
6393
|
+
trackingNumber: string | null;
|
|
6394
|
+
trackingUrl: string | null;
|
|
6395
|
+
lineItems: {
|
|
6396
|
+
id: string;
|
|
6397
|
+
title: string;
|
|
6398
|
+
qty: number;
|
|
6399
|
+
}[];
|
|
6400
|
+
createdAt: string;
|
|
6401
|
+
}[];
|
|
6402
|
+
tracking: never[];
|
|
6403
|
+
orderHistory: never[];
|
|
6404
|
+
isReplaceOrReturn: boolean;
|
|
6405
|
+
createdAt: string;
|
|
6406
|
+
updatedAt: string;
|
|
6407
|
+
};
|
|
6408
|
+
payment: PaymentIntent;
|
|
6409
|
+
}>;
|
|
6410
|
+
reject(approvalId: number | string, reason?: string): Promise<Approval>;
|
|
6411
|
+
/** The buyer who asked withdraws the request. */
|
|
6412
|
+
cancelApproval(approvalId: number | string): Promise<Approval>;
|
|
6413
|
+
quotes({ page, limit, status }?: {
|
|
6414
|
+
page?: number;
|
|
6415
|
+
limit?: number;
|
|
6416
|
+
status?: Quote['status'];
|
|
6417
|
+
}): Promise<Paged<Quote>>;
|
|
6418
|
+
quote(quoteId: number | string): Promise<Quote>;
|
|
6419
|
+
/** Asks the store to price these lines. The store answers with unit prices and an expiry. */
|
|
6420
|
+
requestQuote({ lines, note }: {
|
|
6421
|
+
lines: {
|
|
6422
|
+
variantId: number | string;
|
|
6423
|
+
quantity: number;
|
|
6424
|
+
}[];
|
|
6425
|
+
note?: string;
|
|
6426
|
+
}): Promise<Quote>;
|
|
6427
|
+
/** Places the quote at its agreed prices — or, for a buyer over the threshold, asks for approval. */
|
|
6428
|
+
acceptQuote(quoteId: number | string, opts?: PlaceOptions): Promise<B2bPlaced>;
|
|
6429
|
+
declineQuote(quoteId: number | string): Promise<Quote>;
|
|
6430
|
+
/**
|
|
6431
|
+
* The public "find a dealer" form: no account needed. The engine routes it to
|
|
6432
|
+
* the dealer whose territory covers the address — or keeps it — and answers
|
|
6433
|
+
* the same either way, so the form never reveals who got it.
|
|
6434
|
+
*/
|
|
6435
|
+
submitLead(lead: {
|
|
6436
|
+
name?: string;
|
|
6437
|
+
email?: string;
|
|
6438
|
+
phone?: string;
|
|
6439
|
+
message?: string;
|
|
6440
|
+
country?: string;
|
|
6441
|
+
state?: string;
|
|
6442
|
+
postalCode?: string;
|
|
6443
|
+
productId?: number | string;
|
|
6444
|
+
variantId?: number | string;
|
|
6445
|
+
source?: string;
|
|
6446
|
+
}): Promise<{
|
|
6447
|
+
accepted: boolean;
|
|
6448
|
+
}>;
|
|
6449
|
+
/** A dealer's admins and approvers: the leads routed to their company. */
|
|
6450
|
+
leads({ page, limit, status }?: {
|
|
6451
|
+
page?: number;
|
|
6452
|
+
limit?: number;
|
|
6453
|
+
status?: Lead['status'];
|
|
6454
|
+
}): Promise<Paged<Lead>>;
|
|
6455
|
+
setLeadStatus(leadId: number | string, status: Lead['status']): Promise<Lead>;
|
|
6456
|
+
/** The fields checkout and quote acceptance share. Only declared ones: the engine refuses the rest. */
|
|
6457
|
+
private placeBody;
|
|
6458
|
+
private placed;
|
|
6459
|
+
}
|
|
6460
|
+
declare const b2bService: B2bService;
|
|
6461
|
+
|
|
6462
|
+
export { type Menu as $, type Address as A, type B2bPlaced as B, type Cart as C, CountryService as D, CouponService as E, type Credentials as F, type Credit as G, CurrencyService as H, type Customer as I, DealService as J, DemoRequestService as K, type EngineRequest as L, EnquiryService as M, type Envelope as N, type Faq as O, FaqService as P, FeedbackService as Q, type Fulfillment as R, GalleryService as S, HomeService as T, type IdentityAddress as U, InitService as V, type Invitation as W, type Lead as X, type ListMeta as Y, MeilisearchService as Z, type Member as _, AddressService as a, contactService as a$, type MenuItem as a0, MenuService as a1, type MenuSummary as a2, type Money as a3, NewsletterService as a4, type Offer as a5, type Order as a6, type OrderLine as a7, OrderService as a8, PageService as a9, type StorefrontMenu as aA, type StorefrontOrder as aB, type StorefrontProduct as aC, UploadService as aD, UserService as aE, type Variant as aF, type VariantImage as aG, VariantService as aH, VarniCustomDesignService as aI, VarniCustomProductService as aJ, type Vendor as aK, VendorService as aL, WarrantyService as aM, type Wishlist as aN, type WishlistItem as aO, WishlistService as aP, addressService as aQ, authService as aR, autocompleteService as aS, b2bService as aT, bannerService as aU, blogService as aV, cartService as aW, categoryService as aX, chatService as aY, checkoutService as aZ, collectionService as a_, type PaymentIntent as aa, PaymentMethodService as ab, type Plugin as ac, PluginService as ad, PopularSearchService as ae, PopularityService as af, type Product as ag, type ProductOption as ah, ProductService as ai, ProfileService as aj, type Quote as ak, REDIRECT_GATEWAYS as al, ReelsService as am, RegionService as an, type RejectedLine as ao, type Review as ap, type ReviewPage as aq, ReviewService as ar, type SearchDoc as as, type SearchResult as at, SearchService as au, SettingService as av, type ShippingRate as aw, StateService as ax, StoreService as ay, type StorefrontCategory as az, type AppliedDiscount as b, varniCustomProductService as b$, countryService as b0, couponService as b1, currencyExponent as b2, currencyService as b3, dealService as b4, demoRequestService as b5, emptyCart as b6, emptyPage as b7, enquiryService as b8, faqService as b9, reviewService as bA, searchService as bB, settingService as bC, settingsService as bD, stateService as bE, staticStore as bF, storeService as bG, toCart as bH, toCartLine as bI, toCategory as bJ, toCmsPage as bK, toCollection as bL, toEngineAddress as bM, toIdentityAddress as bN, toMajor as bO, toMinor as bP, toOrder as bQ, toPage as bR, toProduct as bS, toRating as bT, toUser as bU, toVariant as bV, toVendor as bW, uploadService as bX, userService as bY, variantService as bZ, varniCustomDesignService as b_, feedbackService as ba, fromEngineAddress as bb, fromIdentityAddress as bc, fromSearchDoc as bd, galleryService as be, homeService as bf, initService as bg, mediaUrl as bh, meilisearchService as bi, menuService as bj, minorToMajor as bk, newsletterService as bl, orderService as bm, pageService as bn, paymentMethodService as bo, pluginService as bp, pluginsService as bq, popularSearchService as br, popularityService as bs, priceOf as bt, productImages as bu, productService as bv, profileService as bw, qs as bx, reelsService as by, regionService as bz, type Approval as c, vendorService as c0, warrantyService as c1, wishlistService as c2, type AuthResponse as d, AuthService as e, AutocompleteService as f, type B2bRole as g, B2bService as h, BannerService as i, BaseService as j, BlogService as k, type CartLine as l, CartService as m, CatalogService as n, type Category as o, CategoryService as p, ChatService as q, type CheckoutOptions as r, type CheckoutResult as s, CheckoutService as t, type CmsPage as u, type Collection as v, CollectionService as w, type Company as x, type CompanyOrder as y, ContactService as z };
|