@misiki/gocommerce-connector 0.2.0 → 0.3.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/README.md +65 -18
- package/dist/{index-CJ836ZI3.d.cts → index-BfbB3jQb.d.cts} +1032 -4
- package/dist/{index-CJ836ZI3.d.ts → index-BfbB3jQb.d.ts} +1032 -4
- package/dist/index.cjs +582 -86
- 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 +576 -87
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +582 -86
- 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 +576 -87
- 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;
|
|
@@ -1227,6 +1250,13 @@ type CatalogQuery = {
|
|
|
1227
1250
|
category?: string;
|
|
1228
1251
|
priceFrom?: number;
|
|
1229
1252
|
priceTo?: number;
|
|
1253
|
+
/**
|
|
1254
|
+
* Attribute answers, `{ color: ['Red', 'Blue'] }`: one handle's values OR-ed,
|
|
1255
|
+
* different handles AND-ed. The engine filters on them in the whole-shop
|
|
1256
|
+
* listing only — its category route takes none — so inside a category they
|
|
1257
|
+
* are not applied.
|
|
1258
|
+
*/
|
|
1259
|
+
attributes?: Record<string, string[]>;
|
|
1230
1260
|
};
|
|
1231
1261
|
type CatalogPage = {
|
|
1232
1262
|
data: ReturnType<typeof toProduct>[] | ReturnType<typeof fromSearchDoc>[];
|
|
@@ -1374,6 +1404,7 @@ declare class ProductService extends CatalogService {
|
|
|
1374
1404
|
attributes: {
|
|
1375
1405
|
name: string;
|
|
1376
1406
|
value: string;
|
|
1407
|
+
handle: string;
|
|
1377
1408
|
}[];
|
|
1378
1409
|
metadata: Record<string, unknown> | null;
|
|
1379
1410
|
createdAt: string;
|
|
@@ -1486,6 +1517,7 @@ declare class ProductService extends CatalogService {
|
|
|
1486
1517
|
attributes: {
|
|
1487
1518
|
name: string;
|
|
1488
1519
|
value: string;
|
|
1520
|
+
handle: string;
|
|
1489
1521
|
}[];
|
|
1490
1522
|
metadata: Record<string, unknown> | null;
|
|
1491
1523
|
createdAt: string;
|
|
@@ -1633,6 +1665,7 @@ declare class ProductService extends CatalogService {
|
|
|
1633
1665
|
attributes: {
|
|
1634
1666
|
name: string;
|
|
1635
1667
|
value: string;
|
|
1668
|
+
handle: string;
|
|
1636
1669
|
}[];
|
|
1637
1670
|
metadata: Record<string, unknown> | null;
|
|
1638
1671
|
createdAt: string;
|
|
@@ -1779,6 +1812,7 @@ declare class ProductService extends CatalogService {
|
|
|
1779
1812
|
attributes: {
|
|
1780
1813
|
name: string;
|
|
1781
1814
|
value: string;
|
|
1815
|
+
handle: string;
|
|
1782
1816
|
}[];
|
|
1783
1817
|
metadata: Record<string, unknown> | null;
|
|
1784
1818
|
createdAt: string;
|
|
@@ -1927,6 +1961,7 @@ declare class ProductService extends CatalogService {
|
|
|
1927
1961
|
attributes: {
|
|
1928
1962
|
name: string;
|
|
1929
1963
|
value: string;
|
|
1964
|
+
handle: string;
|
|
1930
1965
|
}[];
|
|
1931
1966
|
metadata: Record<string, unknown> | null;
|
|
1932
1967
|
createdAt: string;
|
|
@@ -2130,6 +2165,7 @@ declare class SearchService extends CatalogService {
|
|
|
2130
2165
|
attributes: {
|
|
2131
2166
|
name: string;
|
|
2132
2167
|
value: string;
|
|
2168
|
+
handle: string;
|
|
2133
2169
|
}[];
|
|
2134
2170
|
metadata: Record<string, unknown> | null;
|
|
2135
2171
|
createdAt: string;
|
|
@@ -2301,6 +2337,7 @@ declare class MeilisearchService extends CatalogService {
|
|
|
2301
2337
|
attributes: {
|
|
2302
2338
|
name: string;
|
|
2303
2339
|
value: string;
|
|
2340
|
+
handle: string;
|
|
2304
2341
|
}[];
|
|
2305
2342
|
metadata: Record<string, unknown> | null;
|
|
2306
2343
|
createdAt: string;
|
|
@@ -2487,6 +2524,7 @@ declare class MeilisearchService extends CatalogService {
|
|
|
2487
2524
|
attributes: {
|
|
2488
2525
|
name: string;
|
|
2489
2526
|
value: string;
|
|
2527
|
+
handle: string;
|
|
2490
2528
|
}[];
|
|
2491
2529
|
metadata: Record<string, unknown> | null;
|
|
2492
2530
|
createdAt: string;
|
|
@@ -2675,6 +2713,7 @@ declare class CollectionService extends BaseService {
|
|
|
2675
2713
|
attributes: {
|
|
2676
2714
|
name: string;
|
|
2677
2715
|
value: string;
|
|
2716
|
+
handle: string;
|
|
2678
2717
|
}[];
|
|
2679
2718
|
metadata: Record<string, unknown> | null;
|
|
2680
2719
|
createdAt: string;
|
|
@@ -2782,6 +2821,7 @@ declare class CollectionService extends BaseService {
|
|
|
2782
2821
|
attributes: {
|
|
2783
2822
|
name: string;
|
|
2784
2823
|
value: string;
|
|
2824
|
+
handle: string;
|
|
2785
2825
|
}[];
|
|
2786
2826
|
metadata: Record<string, unknown> | null;
|
|
2787
2827
|
createdAt: string;
|
|
@@ -3858,8 +3898,37 @@ declare class CheckoutService extends BaseService {
|
|
|
3858
3898
|
}>;
|
|
3859
3899
|
checkoutStripe(): Promise<never>;
|
|
3860
3900
|
checkoutStripeCapture(): Promise<never>;
|
|
3861
|
-
|
|
3862
|
-
|
|
3901
|
+
/**
|
|
3902
|
+
* The storefront's generic redirect flow, which it reaches through the code
|
|
3903
|
+
* `PAYPAL`. The engine has no PayPal gateway; paymentMethodService puts the
|
|
3904
|
+
* store's first hosted-page gateway — Adyen, Paddle, Lemon Squeezy, Creem,
|
|
3905
|
+
* Hyperswitch or RevenueCat — under that code, with its own name and a
|
|
3906
|
+
* neutral icon, because this is the one storefront flow that sends a shopper
|
|
3907
|
+
* to a URL and back. The shopper returns to the success page; the gateway's
|
|
3908
|
+
* webhook tells the engine the order is paid.
|
|
3909
|
+
*/
|
|
3910
|
+
checkoutPaypal({ cartId, origin }?: {
|
|
3911
|
+
cartId?: string;
|
|
3912
|
+
origin?: string;
|
|
3913
|
+
return_url?: string;
|
|
3914
|
+
}): Promise<{
|
|
3915
|
+
redirect_url: string;
|
|
3916
|
+
order_no: string;
|
|
3917
|
+
}>;
|
|
3918
|
+
/**
|
|
3919
|
+
* Nothing to capture: a hosted-page gateway confirms the payment to the
|
|
3920
|
+
* engine by webhook. Answering, rather than throwing, sends the storefront's
|
|
3921
|
+
* process page on to the success page instead of the failure page.
|
|
3922
|
+
*/
|
|
3923
|
+
capturePaypalPayment({ order_no, }?: {
|
|
3924
|
+
order_no?: string;
|
|
3925
|
+
token?: string;
|
|
3926
|
+
PayerID?: string;
|
|
3927
|
+
storeId?: string;
|
|
3928
|
+
}): Promise<{
|
|
3929
|
+
order_no: string | null;
|
|
3930
|
+
status: string;
|
|
3931
|
+
}>;
|
|
3863
3932
|
checkoutCashfree(): Promise<never>;
|
|
3864
3933
|
captureCashfreePayment(): Promise<never>;
|
|
3865
3934
|
checkoutPhonepe(): Promise<never>;
|
|
@@ -3867,6 +3936,142 @@ declare class CheckoutService extends BaseService {
|
|
|
3867
3936
|
confirmAffirmOrder(): Promise<never>;
|
|
3868
3937
|
cancelAffirmOrder(): Promise<never>;
|
|
3869
3938
|
checkoutPOS(): Promise<never>;
|
|
3939
|
+
/**
|
|
3940
|
+
* Any payment method the engine has switched on, by its engine code —
|
|
3941
|
+
* `cod`, `stripe`, `razorpay`, `adyen`, `paddle`, `helcim`… For a storefront
|
|
3942
|
+
* that drives the payment itself: the answer says what to do next.
|
|
3943
|
+
*
|
|
3944
|
+
* - `kind: 'none'` — nothing to pay now (cash on delivery).
|
|
3945
|
+
* - `kind: 'client_action'` — mount the gateway's own widget with
|
|
3946
|
+
* `clientData`: Stripe's Payment Element takes `clientSecret`, Razorpay's
|
|
3947
|
+
* modal `razorpay_order_id` and `key_id`, Helcim's `checkout_token`.
|
|
3948
|
+
* - `kind: 'redirect'` — send the shopper to `redirectUrl`; `returnUrl` is
|
|
3949
|
+
* where the gateway brings them back.
|
|
3950
|
+
*
|
|
3951
|
+
* Either way the gateway's webhook tells the engine when the money arrives;
|
|
3952
|
+
* read `orderService.getOrder(orderNo).paymentStatus` to see it.
|
|
3953
|
+
*/
|
|
3954
|
+
checkout(code: string, { cartId, returnUrl, paymentData, metadata, }?: {
|
|
3955
|
+
cartId?: string;
|
|
3956
|
+
returnUrl?: string;
|
|
3957
|
+
paymentData?: Record<string, string>;
|
|
3958
|
+
metadata?: Record<string, unknown>;
|
|
3959
|
+
}): Promise<{
|
|
3960
|
+
orderNo: string;
|
|
3961
|
+
order: {
|
|
3962
|
+
id: string;
|
|
3963
|
+
orderNo: string;
|
|
3964
|
+
orderNumber: string;
|
|
3965
|
+
number: string;
|
|
3966
|
+
parentOrderNo: string;
|
|
3967
|
+
status: string;
|
|
3968
|
+
engineStatus: string;
|
|
3969
|
+
paymentStatus: string;
|
|
3970
|
+
paymentMethod: string;
|
|
3971
|
+
currencyCode: string;
|
|
3972
|
+
subtotal: number;
|
|
3973
|
+
shippingCharges: number;
|
|
3974
|
+
discount: number;
|
|
3975
|
+
tax: number;
|
|
3976
|
+
taxIncluded: boolean;
|
|
3977
|
+
total: number;
|
|
3978
|
+
refunded: number;
|
|
3979
|
+
codCharges: number;
|
|
3980
|
+
coupon: {
|
|
3981
|
+
code: string;
|
|
3982
|
+
} | null;
|
|
3983
|
+
userEmail: string;
|
|
3984
|
+
email: string;
|
|
3985
|
+
phone: string | null;
|
|
3986
|
+
shippingAddress: {
|
|
3987
|
+
firstName: string;
|
|
3988
|
+
lastName: string;
|
|
3989
|
+
email: string | null;
|
|
3990
|
+
phone: string | null;
|
|
3991
|
+
address_1: string;
|
|
3992
|
+
address_2: string;
|
|
3993
|
+
city: string;
|
|
3994
|
+
state: string;
|
|
3995
|
+
zip: string;
|
|
3996
|
+
country: string;
|
|
3997
|
+
countryCode: string;
|
|
3998
|
+
} | null;
|
|
3999
|
+
billingAddress: {
|
|
4000
|
+
firstName: string;
|
|
4001
|
+
lastName: string;
|
|
4002
|
+
email: string | null;
|
|
4003
|
+
phone: string | null;
|
|
4004
|
+
address_1: string;
|
|
4005
|
+
address_2: string;
|
|
4006
|
+
city: string;
|
|
4007
|
+
state: string;
|
|
4008
|
+
zip: string;
|
|
4009
|
+
country: string;
|
|
4010
|
+
countryCode: string;
|
|
4011
|
+
} | null;
|
|
4012
|
+
shippingMethod: string | null;
|
|
4013
|
+
shippingRate: {
|
|
4014
|
+
name: string;
|
|
4015
|
+
} | null;
|
|
4016
|
+
lineItems: {
|
|
4017
|
+
id: string;
|
|
4018
|
+
productId: string;
|
|
4019
|
+
variantId: string;
|
|
4020
|
+
sku: string;
|
|
4021
|
+
title: string;
|
|
4022
|
+
name: string;
|
|
4023
|
+
slug: string;
|
|
4024
|
+
thumbnail: string | null;
|
|
4025
|
+
img: string | null;
|
|
4026
|
+
variantTitle: string;
|
|
4027
|
+
qty: number;
|
|
4028
|
+
shippedQty: number;
|
|
4029
|
+
price: number;
|
|
4030
|
+
mrp: number;
|
|
4031
|
+
subtotal: number;
|
|
4032
|
+
total: number;
|
|
4033
|
+
currencyCode: string;
|
|
4034
|
+
status: string;
|
|
4035
|
+
files: never[];
|
|
4036
|
+
usedOptions: never[];
|
|
4037
|
+
}[];
|
|
4038
|
+
fulfillments: {
|
|
4039
|
+
id: string;
|
|
4040
|
+
status: string;
|
|
4041
|
+
carrier: string;
|
|
4042
|
+
trackingNumber: string | null;
|
|
4043
|
+
trackingUrl: string | null;
|
|
4044
|
+
lineItems: {
|
|
4045
|
+
id: string;
|
|
4046
|
+
title: string;
|
|
4047
|
+
qty: number;
|
|
4048
|
+
}[];
|
|
4049
|
+
createdAt: string;
|
|
4050
|
+
}[];
|
|
4051
|
+
tracking: never[];
|
|
4052
|
+
orderHistory: never[];
|
|
4053
|
+
isReplaceOrReturn: boolean;
|
|
4054
|
+
createdAt: string;
|
|
4055
|
+
updatedAt: string;
|
|
4056
|
+
};
|
|
4057
|
+
payment: {
|
|
4058
|
+
kind: "none" | "client_action" | "redirect";
|
|
4059
|
+
provider: string;
|
|
4060
|
+
reference: string | null;
|
|
4061
|
+
clientSecret: string;
|
|
4062
|
+
redirectUrl: string;
|
|
4063
|
+
clientData: Record<string, string>;
|
|
4064
|
+
};
|
|
4065
|
+
}>;
|
|
4066
|
+
/** Every payment method the engine has switched on, by engine code and name — drivable here or not. */
|
|
4067
|
+
listMethods(): Promise<{
|
|
4068
|
+
methods: {
|
|
4069
|
+
code: string;
|
|
4070
|
+
name: string;
|
|
4071
|
+
}[];
|
|
4072
|
+
currency: string;
|
|
4073
|
+
}>;
|
|
4074
|
+
private redirectGateway;
|
|
3870
4075
|
/**
|
|
3871
4076
|
* One checkout attempt.
|
|
3872
4077
|
*
|
|
@@ -3879,6 +4084,8 @@ declare class CheckoutService extends BaseService {
|
|
|
3879
4084
|
*/
|
|
3880
4085
|
private place;
|
|
3881
4086
|
}
|
|
4087
|
+
/** The engine's gateways that take payment on their own hosted page. */
|
|
4088
|
+
declare const REDIRECT_GATEWAYS: Set<string>;
|
|
3882
4089
|
declare const checkoutService: CheckoutService;
|
|
3883
4090
|
|
|
3884
4091
|
declare class PaymentMethodService extends BaseService {
|
|
@@ -4381,6 +4588,137 @@ declare class UserService extends BaseService {
|
|
|
4381
4588
|
createdAt: string;
|
|
4382
4589
|
updatedAt: string;
|
|
4383
4590
|
}>;
|
|
4591
|
+
/**
|
|
4592
|
+
* Mails the signed-in shopper a link to confirm their address. The engine
|
|
4593
|
+
* sends none at signup, and a confirmed address is what customer-group
|
|
4594
|
+
* prices are keyed on. 409 once confirmed; 429 within a minute of the last.
|
|
4595
|
+
*/
|
|
4596
|
+
requestEmailVerification(): Promise<{
|
|
4597
|
+
accepted: boolean;
|
|
4598
|
+
}>;
|
|
4599
|
+
/** Extends the session another thirty days. The token stays the same. */
|
|
4600
|
+
refreshSession(): Promise<{
|
|
4601
|
+
id: string;
|
|
4602
|
+
userId: string;
|
|
4603
|
+
email: string;
|
|
4604
|
+
phone: string | null;
|
|
4605
|
+
firstName: string;
|
|
4606
|
+
lastName: string;
|
|
4607
|
+
name: string;
|
|
4608
|
+
fullName: string;
|
|
4609
|
+
avatar: null;
|
|
4610
|
+
role: string;
|
|
4611
|
+
emailVerified: boolean;
|
|
4612
|
+
storeId: null;
|
|
4613
|
+
}>;
|
|
4614
|
+
/**
|
|
4615
|
+
* Files a guest order under the signed-in account, so it appears in their
|
|
4616
|
+
* order history. The order's access token is the proof of ownership: pass
|
|
4617
|
+
* it, or leave it out for an order placed from this browser, whose token was
|
|
4618
|
+
* kept at checkout.
|
|
4619
|
+
*
|
|
4620
|
+
* Never done automatically at sign-in. On a shared computer that would file
|
|
4621
|
+
* one person's orders — address and all — under whoever signed in next.
|
|
4622
|
+
*/
|
|
4623
|
+
claimOrder({ number, token }: {
|
|
4624
|
+
number: string;
|
|
4625
|
+
token?: string;
|
|
4626
|
+
}): Promise<{
|
|
4627
|
+
id: string;
|
|
4628
|
+
orderNo: string;
|
|
4629
|
+
orderNumber: string;
|
|
4630
|
+
number: string;
|
|
4631
|
+
parentOrderNo: string;
|
|
4632
|
+
status: string;
|
|
4633
|
+
engineStatus: string;
|
|
4634
|
+
paymentStatus: string;
|
|
4635
|
+
paymentMethod: string;
|
|
4636
|
+
currencyCode: string;
|
|
4637
|
+
subtotal: number;
|
|
4638
|
+
shippingCharges: number;
|
|
4639
|
+
discount: number;
|
|
4640
|
+
tax: number;
|
|
4641
|
+
taxIncluded: boolean;
|
|
4642
|
+
total: number;
|
|
4643
|
+
refunded: number;
|
|
4644
|
+
codCharges: number;
|
|
4645
|
+
coupon: {
|
|
4646
|
+
code: string;
|
|
4647
|
+
} | null;
|
|
4648
|
+
userEmail: string;
|
|
4649
|
+
email: string;
|
|
4650
|
+
phone: string | null;
|
|
4651
|
+
shippingAddress: {
|
|
4652
|
+
firstName: string;
|
|
4653
|
+
lastName: string;
|
|
4654
|
+
email: string | null;
|
|
4655
|
+
phone: string | null;
|
|
4656
|
+
address_1: string;
|
|
4657
|
+
address_2: string;
|
|
4658
|
+
city: string;
|
|
4659
|
+
state: string;
|
|
4660
|
+
zip: string;
|
|
4661
|
+
country: string;
|
|
4662
|
+
countryCode: string;
|
|
4663
|
+
} | null;
|
|
4664
|
+
billingAddress: {
|
|
4665
|
+
firstName: string;
|
|
4666
|
+
lastName: string;
|
|
4667
|
+
email: string | null;
|
|
4668
|
+
phone: string | null;
|
|
4669
|
+
address_1: string;
|
|
4670
|
+
address_2: string;
|
|
4671
|
+
city: string;
|
|
4672
|
+
state: string;
|
|
4673
|
+
zip: string;
|
|
4674
|
+
country: string;
|
|
4675
|
+
countryCode: string;
|
|
4676
|
+
} | null;
|
|
4677
|
+
shippingMethod: string | null;
|
|
4678
|
+
shippingRate: {
|
|
4679
|
+
name: string;
|
|
4680
|
+
} | null;
|
|
4681
|
+
lineItems: {
|
|
4682
|
+
id: string;
|
|
4683
|
+
productId: string;
|
|
4684
|
+
variantId: string;
|
|
4685
|
+
sku: string;
|
|
4686
|
+
title: string;
|
|
4687
|
+
name: string;
|
|
4688
|
+
slug: string;
|
|
4689
|
+
thumbnail: string | null;
|
|
4690
|
+
img: string | null;
|
|
4691
|
+
variantTitle: string;
|
|
4692
|
+
qty: number;
|
|
4693
|
+
shippedQty: number;
|
|
4694
|
+
price: number;
|
|
4695
|
+
mrp: number;
|
|
4696
|
+
subtotal: number;
|
|
4697
|
+
total: number;
|
|
4698
|
+
currencyCode: string;
|
|
4699
|
+
status: string;
|
|
4700
|
+
files: never[];
|
|
4701
|
+
usedOptions: never[];
|
|
4702
|
+
}[];
|
|
4703
|
+
fulfillments: {
|
|
4704
|
+
id: string;
|
|
4705
|
+
status: string;
|
|
4706
|
+
carrier: string;
|
|
4707
|
+
trackingNumber: string | null;
|
|
4708
|
+
trackingUrl: string | null;
|
|
4709
|
+
lineItems: {
|
|
4710
|
+
id: string;
|
|
4711
|
+
title: string;
|
|
4712
|
+
qty: number;
|
|
4713
|
+
}[];
|
|
4714
|
+
createdAt: string;
|
|
4715
|
+
}[];
|
|
4716
|
+
tracking: never[];
|
|
4717
|
+
orderHistory: never[];
|
|
4718
|
+
isReplaceOrReturn: boolean;
|
|
4719
|
+
createdAt: string;
|
|
4720
|
+
updatedAt: string;
|
|
4721
|
+
}>;
|
|
4384
4722
|
deleteUser(): Promise<never>;
|
|
4385
4723
|
checkEmail(): Promise<never>;
|
|
4386
4724
|
joinAsVendor(): Promise<never>;
|
|
@@ -4698,6 +5036,7 @@ declare class WishlistService extends BaseService {
|
|
|
4698
5036
|
attributes: {
|
|
4699
5037
|
name: string;
|
|
4700
5038
|
value: string;
|
|
5039
|
+
handle: string;
|
|
4701
5040
|
}[];
|
|
4702
5041
|
metadata: Record<string, unknown> | null;
|
|
4703
5042
|
createdAt: string;
|
|
@@ -4730,6 +5069,13 @@ declare class WishlistService extends BaseService {
|
|
|
4730
5069
|
productId: string;
|
|
4731
5070
|
variantId?: string | null;
|
|
4732
5071
|
}[]>;
|
|
5072
|
+
/**
|
|
5073
|
+
* The address the store may write to when a saved product is back in stock
|
|
5074
|
+
* or on sale; `''` takes it off. A list that does not exist yet is made.
|
|
5075
|
+
*/
|
|
5076
|
+
setEmail(email: string): Promise<{
|
|
5077
|
+
email: string | null;
|
|
5078
|
+
}>;
|
|
4733
5079
|
private current;
|
|
4734
5080
|
private create;
|
|
4735
5081
|
}
|
|
@@ -4834,6 +5180,10 @@ type StorefrontMenuItem = {
|
|
|
4834
5180
|
declare class MenuService extends BaseService {
|
|
4835
5181
|
private readonly facts;
|
|
4836
5182
|
list(_args?: Record<string, unknown>): Promise<{} | null>;
|
|
5183
|
+
/** Every menu the store keeps, by handle — not only the header and footer. */
|
|
5184
|
+
listMenus(): Promise<MenuSummary[]>;
|
|
5185
|
+
/** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
|
|
5186
|
+
getMenu(handle: string): Promise<StorefrontMenu>;
|
|
4837
5187
|
/** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
|
|
4838
5188
|
engineMenus(): Promise<StorefrontMenu[] | null>;
|
|
4839
5189
|
}
|
|
@@ -4872,7 +5222,13 @@ declare class StoreService extends BaseService {
|
|
|
4872
5222
|
* clean 404 rather than a crash.
|
|
4873
5223
|
*/
|
|
4874
5224
|
get<T = any>(path: string): Promise<T>;
|
|
4875
|
-
|
|
5225
|
+
/**
|
|
5226
|
+
* The storefront's newsletter box posts `{ email }` to Litekart's
|
|
5227
|
+
* `/api/newsletter/subscribe` through this verb; ext/newsletter is where
|
|
5228
|
+
* that list lives here.
|
|
5229
|
+
*/
|
|
5230
|
+
post<T = any>(path: string, data?: unknown): Promise<T>;
|
|
5231
|
+
private live;
|
|
4876
5232
|
}
|
|
4877
5233
|
declare const storeService: StoreService;
|
|
4878
5234
|
|
|
@@ -5274,6 +5630,7 @@ declare class AutocompleteService extends MeilisearchService {
|
|
|
5274
5630
|
attributes: {
|
|
5275
5631
|
name: string;
|
|
5276
5632
|
value: string;
|
|
5633
|
+
handle: string;
|
|
5277
5634
|
}[];
|
|
5278
5635
|
metadata: Record<string, unknown> | null;
|
|
5279
5636
|
createdAt: string;
|
|
@@ -5421,4 +5778,675 @@ declare const varniCustomProductService: VarniCustomProductService;
|
|
|
5421
5778
|
declare const pluginsService: PluginService;
|
|
5422
5779
|
declare const settingsService: SettingService;
|
|
5423
5780
|
|
|
5424
|
-
|
|
5781
|
+
/**
|
|
5782
|
+
* Variants on their own, and the marketplace's offers on one.
|
|
5783
|
+
*
|
|
5784
|
+
* Svelte Commerce reads variants through their product, so this service is
|
|
5785
|
+
* for code written against GoCommerce: it answers the engine's own shapes —
|
|
5786
|
+
* numeric ids, money as `{ amount_minor, currency }` — with a major-unit
|
|
5787
|
+
* `amount` added beside each price so a template need not divide.
|
|
5788
|
+
*/
|
|
5789
|
+
declare class VariantService extends BaseService {
|
|
5790
|
+
/** A product's variants, inactive ones included (filter on `active`), in the merchant's order. */
|
|
5791
|
+
list(productId: string | number, { page, limit }?: {
|
|
5792
|
+
page?: number;
|
|
5793
|
+
limit?: number;
|
|
5794
|
+
}): Promise<{
|
|
5795
|
+
data: {
|
|
5796
|
+
price: {
|
|
5797
|
+
amount: number;
|
|
5798
|
+
amount_minor: number;
|
|
5799
|
+
currency: string;
|
|
5800
|
+
};
|
|
5801
|
+
compare_at_price: {
|
|
5802
|
+
amount: number;
|
|
5803
|
+
amount_minor: number;
|
|
5804
|
+
currency: string;
|
|
5805
|
+
} | undefined;
|
|
5806
|
+
id: number;
|
|
5807
|
+
product_id: number;
|
|
5808
|
+
sku: string;
|
|
5809
|
+
barcode?: string;
|
|
5810
|
+
taxable: boolean;
|
|
5811
|
+
requires_shipping: boolean;
|
|
5812
|
+
options: string[] | null;
|
|
5813
|
+
label: string;
|
|
5814
|
+
available: number;
|
|
5815
|
+
track_inventory: boolean;
|
|
5816
|
+
continue_selling: boolean;
|
|
5817
|
+
active: boolean;
|
|
5818
|
+
origin_country?: string;
|
|
5819
|
+
hs_code?: string;
|
|
5820
|
+
weight_grams?: number;
|
|
5821
|
+
dimensions?: {
|
|
5822
|
+
length_mm?: number;
|
|
5823
|
+
width_mm?: number;
|
|
5824
|
+
height_mm?: number;
|
|
5825
|
+
};
|
|
5826
|
+
images?: VariantImage[];
|
|
5827
|
+
image?: VariantImage;
|
|
5828
|
+
position: number;
|
|
5829
|
+
metadata?: Record<string, unknown>;
|
|
5830
|
+
}[];
|
|
5831
|
+
meta: ListMeta | undefined;
|
|
5832
|
+
}>;
|
|
5833
|
+
getOne(id: string | number): Promise<{
|
|
5834
|
+
price: {
|
|
5835
|
+
amount: number;
|
|
5836
|
+
amount_minor: number;
|
|
5837
|
+
currency: string;
|
|
5838
|
+
};
|
|
5839
|
+
compare_at_price: {
|
|
5840
|
+
amount: number;
|
|
5841
|
+
amount_minor: number;
|
|
5842
|
+
currency: string;
|
|
5843
|
+
} | undefined;
|
|
5844
|
+
id: number;
|
|
5845
|
+
product_id: number;
|
|
5846
|
+
sku: string;
|
|
5847
|
+
barcode?: string;
|
|
5848
|
+
taxable: boolean;
|
|
5849
|
+
requires_shipping: boolean;
|
|
5850
|
+
options: string[] | null;
|
|
5851
|
+
label: string;
|
|
5852
|
+
available: number;
|
|
5853
|
+
track_inventory: boolean;
|
|
5854
|
+
continue_selling: boolean;
|
|
5855
|
+
active: boolean;
|
|
5856
|
+
origin_country?: string;
|
|
5857
|
+
hs_code?: string;
|
|
5858
|
+
weight_grams?: number;
|
|
5859
|
+
dimensions?: {
|
|
5860
|
+
length_mm?: number;
|
|
5861
|
+
width_mm?: number;
|
|
5862
|
+
height_mm?: number;
|
|
5863
|
+
};
|
|
5864
|
+
images?: VariantImage[];
|
|
5865
|
+
image?: VariantImage;
|
|
5866
|
+
position: number;
|
|
5867
|
+
metadata?: Record<string, unknown>;
|
|
5868
|
+
}>;
|
|
5869
|
+
/**
|
|
5870
|
+
* What each approved seller asks for this variant, cheapest first. A cart
|
|
5871
|
+
* line takes a variant, not an offer, so this informs a shopper rather than
|
|
5872
|
+
* choosing who fulfils.
|
|
5873
|
+
*/
|
|
5874
|
+
offers(variantId: string | number): Promise<{
|
|
5875
|
+
price: {
|
|
5876
|
+
amount: number;
|
|
5877
|
+
amount_minor: number;
|
|
5878
|
+
currency: string;
|
|
5879
|
+
};
|
|
5880
|
+
vendor_id: number;
|
|
5881
|
+
vendor: string;
|
|
5882
|
+
vendor_slug: string;
|
|
5883
|
+
in_stock: boolean;
|
|
5884
|
+
variant_id: number;
|
|
5885
|
+
}[]>;
|
|
5886
|
+
}
|
|
5887
|
+
declare const variantService: VariantService;
|
|
5888
|
+
|
|
5889
|
+
/**
|
|
5890
|
+
* The signup box and its unsubscribe link (ext/newsletter). Subscribing twice
|
|
5891
|
+
* is not an error, and unsubscribing answers the same whether or not the token
|
|
5892
|
+
* matched, so neither call tells a stranger whether an address is on the list.
|
|
5893
|
+
*/
|
|
5894
|
+
declare class NewsletterService extends BaseService {
|
|
5895
|
+
subscribe({ email, name, source }: {
|
|
5896
|
+
email: string;
|
|
5897
|
+
name?: string;
|
|
5898
|
+
source?: string;
|
|
5899
|
+
}): Promise<{
|
|
5900
|
+
status: "subscribed";
|
|
5901
|
+
}>;
|
|
5902
|
+
/** The token from the unsubscribe link in a newsletter email. */
|
|
5903
|
+
unsubscribe(token: string): Promise<{
|
|
5904
|
+
status: "unsubscribed";
|
|
5905
|
+
}>;
|
|
5906
|
+
}
|
|
5907
|
+
declare const newsletterService: NewsletterService;
|
|
5908
|
+
|
|
5909
|
+
type B2bRole = 'admin' | 'approver' | 'buyer';
|
|
5910
|
+
type Company = {
|
|
5911
|
+
id: number;
|
|
5912
|
+
code: string;
|
|
5913
|
+
name: string;
|
|
5914
|
+
tax_id: string;
|
|
5915
|
+
status: 'active' | 'on_hold' | 'closed';
|
|
5916
|
+
group_id: number | null;
|
|
5917
|
+
/** `null`: no account with the store — the company pays up front. */
|
|
5918
|
+
credit_limit: Money | null;
|
|
5919
|
+
net_days: number;
|
|
5920
|
+
/** `null`: a buyer never needs approval. */
|
|
5921
|
+
approval_threshold: Money | null;
|
|
5922
|
+
require_po: boolean;
|
|
5923
|
+
member_count: number;
|
|
5924
|
+
/** More than 0: the company is a dealer, and receives leads. */
|
|
5925
|
+
territory_count: number;
|
|
5926
|
+
created_at: string;
|
|
5927
|
+
updated_at: string;
|
|
5928
|
+
};
|
|
5929
|
+
type Credit = {
|
|
5930
|
+
limit: Money | null;
|
|
5931
|
+
outstanding: Money;
|
|
5932
|
+
available: Money | null;
|
|
5933
|
+
overdue: Money;
|
|
5934
|
+
overdue_orders: number;
|
|
5935
|
+
net_days: number;
|
|
5936
|
+
};
|
|
5937
|
+
type Member = {
|
|
5938
|
+
company_id: number;
|
|
5939
|
+
customer_id: number;
|
|
5940
|
+
email: string;
|
|
5941
|
+
confirmed: boolean;
|
|
5942
|
+
name: string;
|
|
5943
|
+
role: B2bRole;
|
|
5944
|
+
created_at: string;
|
|
5945
|
+
};
|
|
5946
|
+
type Invitation = {
|
|
5947
|
+
id: number;
|
|
5948
|
+
company_id: number;
|
|
5949
|
+
email: string;
|
|
5950
|
+
role: B2bRole;
|
|
5951
|
+
invited_by: string;
|
|
5952
|
+
expires_at: string;
|
|
5953
|
+
accepted_at?: string;
|
|
5954
|
+
created_at: string;
|
|
5955
|
+
};
|
|
5956
|
+
type CompanyOrder = {
|
|
5957
|
+
order_id: number;
|
|
5958
|
+
number: string;
|
|
5959
|
+
status: string;
|
|
5960
|
+
payment_status: string;
|
|
5961
|
+
total: Money;
|
|
5962
|
+
po_number: string;
|
|
5963
|
+
placed_by: string;
|
|
5964
|
+
on_account: boolean;
|
|
5965
|
+
due_at?: string;
|
|
5966
|
+
overdue: boolean;
|
|
5967
|
+
company_id: number;
|
|
5968
|
+
company_name: string;
|
|
5969
|
+
approval_id?: number;
|
|
5970
|
+
quote_id?: number;
|
|
5971
|
+
created_at: string;
|
|
5972
|
+
};
|
|
5973
|
+
type Approval = {
|
|
5974
|
+
id: number;
|
|
5975
|
+
company_id: number;
|
|
5976
|
+
kind: 'cart' | 'quote';
|
|
5977
|
+
quote_id?: number;
|
|
5978
|
+
status: 'pending' | 'placing' | 'approved' | 'rejected' | 'cancelled';
|
|
5979
|
+
requested_by: number;
|
|
5980
|
+
requested_by_email: string;
|
|
5981
|
+
lines: {
|
|
5982
|
+
variant_id: number;
|
|
5983
|
+
sku: string;
|
|
5984
|
+
quantity: number;
|
|
5985
|
+
unit_price: Money;
|
|
5986
|
+
}[];
|
|
5987
|
+
subtotal: Money;
|
|
5988
|
+
total: Money;
|
|
5989
|
+
payment_method: string;
|
|
5990
|
+
po_number: string;
|
|
5991
|
+
decided_by?: number;
|
|
5992
|
+
decided_at?: string;
|
|
5993
|
+
reason?: string;
|
|
5994
|
+
last_error?: string;
|
|
5995
|
+
order_id?: number;
|
|
5996
|
+
order_number?: string;
|
|
5997
|
+
created_at: string;
|
|
5998
|
+
updated_at: string;
|
|
5999
|
+
};
|
|
6000
|
+
type Quote = {
|
|
6001
|
+
id: number;
|
|
6002
|
+
number: string;
|
|
6003
|
+
company_id: number;
|
|
6004
|
+
company_name: string;
|
|
6005
|
+
status: 'requested' | 'quoted' | 'awaiting_approval' | 'accepted' | 'declined' | 'expired';
|
|
6006
|
+
requested_by: number;
|
|
6007
|
+
requested_by_email: string;
|
|
6008
|
+
note: string;
|
|
6009
|
+
reply: string;
|
|
6010
|
+
declined_by?: string;
|
|
6011
|
+
lines: {
|
|
6012
|
+
variant_id: number;
|
|
6013
|
+
sku: string;
|
|
6014
|
+
title: string;
|
|
6015
|
+
quantity: number;
|
|
6016
|
+
unit_price: Money | null;
|
|
6017
|
+
}[];
|
|
6018
|
+
total: Money | null;
|
|
6019
|
+
expires_at?: string;
|
|
6020
|
+
quoted_at?: string;
|
|
6021
|
+
accepted_at?: string;
|
|
6022
|
+
order_id?: number;
|
|
6023
|
+
order_number?: string;
|
|
6024
|
+
created_at: string;
|
|
6025
|
+
updated_at: string;
|
|
6026
|
+
};
|
|
6027
|
+
type Lead = {
|
|
6028
|
+
id: number;
|
|
6029
|
+
name: string;
|
|
6030
|
+
email: string;
|
|
6031
|
+
phone: string;
|
|
6032
|
+
message: string;
|
|
6033
|
+
country: string;
|
|
6034
|
+
state: string;
|
|
6035
|
+
postal_code: string;
|
|
6036
|
+
variant_id: number | null;
|
|
6037
|
+
product_id: number | null;
|
|
6038
|
+
product_title?: string;
|
|
6039
|
+
variant_sku?: string;
|
|
6040
|
+
status: 'new' | 'contacted' | 'won' | 'lost';
|
|
6041
|
+
company_id: number | null;
|
|
6042
|
+
company_name?: string;
|
|
6043
|
+
routed_by: 'territory' | 'store' | 'unrouted';
|
|
6044
|
+
source: string;
|
|
6045
|
+
created_at: string;
|
|
6046
|
+
updated_at: string;
|
|
6047
|
+
};
|
|
6048
|
+
type RejectedLine = {
|
|
6049
|
+
sku: string;
|
|
6050
|
+
variant_id: number | null;
|
|
6051
|
+
quantity: number;
|
|
6052
|
+
reason: 'not_found' | 'inactive' | 'insufficient_stock' | 'invalid';
|
|
6053
|
+
message: string;
|
|
6054
|
+
};
|
|
6055
|
+
type Paged<T> = {
|
|
6056
|
+
data: T[];
|
|
6057
|
+
meta?: ListMeta;
|
|
6058
|
+
};
|
|
6059
|
+
type PlaceOptions = {
|
|
6060
|
+
/** An engine payment code; omitted, the company's account (`on_account`) when it has one. */
|
|
6061
|
+
paymentMethod?: string;
|
|
6062
|
+
/** Required when the company says so (`company.require_po`). */
|
|
6063
|
+
poNumber?: string;
|
|
6064
|
+
name?: string;
|
|
6065
|
+
phone?: string;
|
|
6066
|
+
/** Defaults to the address the checkout's address step kept for this cart. */
|
|
6067
|
+
address?: StorefrontAddress | Address;
|
|
6068
|
+
};
|
|
6069
|
+
/** A checkout or quote acceptance either placed an order or, for a buyer over the limit, asked for approval. */
|
|
6070
|
+
type B2bPlaced = {
|
|
6071
|
+
kind: 'order';
|
|
6072
|
+
orderNo: string;
|
|
6073
|
+
order: ReturnType<typeof toOrder>;
|
|
6074
|
+
payment: PaymentIntent;
|
|
6075
|
+
} | {
|
|
6076
|
+
kind: 'approval';
|
|
6077
|
+
approval: Approval;
|
|
6078
|
+
};
|
|
6079
|
+
/**
|
|
6080
|
+
* Buying for a business (ext/b2b): a company with buyers in roles, orders on
|
|
6081
|
+
* account against a credit limit, approvals, quotes, a quick order by SKU, a
|
|
6082
|
+
* repeat order, and a dealer's leads.
|
|
6083
|
+
*
|
|
6084
|
+
* Every call but `submitLead` needs a signed-in shopper (ext/identity) who is
|
|
6085
|
+
* a member of a company; a signed-in account that is not answers 403, so
|
|
6086
|
+
* `me()` is how a storefront tells a business account from a consumer one.
|
|
6087
|
+
* Answers are the engine's own shapes — numeric ids, money as
|
|
6088
|
+
* `{ amount_minor, currency }` — except carts, which come back as the
|
|
6089
|
+
* storefront's bag so a quick-order page can hand them straight to it.
|
|
6090
|
+
*/
|
|
6091
|
+
declare class B2bService extends BaseService {
|
|
6092
|
+
/** The company, the caller's role in it, and its credit: limit, outstanding, available, overdue. */
|
|
6093
|
+
me(): Promise<{
|
|
6094
|
+
company: Company;
|
|
6095
|
+
role: B2bRole;
|
|
6096
|
+
credit: Credit;
|
|
6097
|
+
}>;
|
|
6098
|
+
members(): Promise<Member[]>;
|
|
6099
|
+
/** Admin only. Demoting the last admin is refused (409). */
|
|
6100
|
+
setMemberRole(customerId: number | string, role: B2bRole): Promise<Member>;
|
|
6101
|
+
/** An admin removes anyone; any member may remove themselves. */
|
|
6102
|
+
removeMember(customerId: number | string): Promise<void>;
|
|
6103
|
+
/** Admin only. Open invitations: not accepted, not expired. */
|
|
6104
|
+
invitations(): Promise<Invitation[]>;
|
|
6105
|
+
/** Admin only. Emails a link; a second invitation to the same address replaces the first. */
|
|
6106
|
+
invite({ email, role }: {
|
|
6107
|
+
email: string;
|
|
6108
|
+
role: B2bRole;
|
|
6109
|
+
}): Promise<Invitation>;
|
|
6110
|
+
withdrawInvitation(invitationId: number | string): Promise<void>;
|
|
6111
|
+
/**
|
|
6112
|
+
* The token from the invitation email, accepted by the account it was sent
|
|
6113
|
+
* to — which also confirms that account's email address.
|
|
6114
|
+
*/
|
|
6115
|
+
acceptInvitation(token: string): Promise<Member>;
|
|
6116
|
+
/**
|
|
6117
|
+
* A quick order: up to 500 lines by SKU or variant id, into the bag (or a new
|
|
6118
|
+
* one), at the company's prices. A line that will not go in is reported in
|
|
6119
|
+
* `rejected` with its reason; the rest are added.
|
|
6120
|
+
*/
|
|
6121
|
+
addLines({ cartId, lines, }: {
|
|
6122
|
+
cartId?: string;
|
|
6123
|
+
lines: {
|
|
6124
|
+
sku?: string;
|
|
6125
|
+
variantId?: number | string;
|
|
6126
|
+
quantity: number;
|
|
6127
|
+
}[];
|
|
6128
|
+
}): Promise<{
|
|
6129
|
+
cart: {
|
|
6130
|
+
id: string;
|
|
6131
|
+
status: "open" | "converted" | "abandoned";
|
|
6132
|
+
email: string | null;
|
|
6133
|
+
phone: string | null;
|
|
6134
|
+
name: string | null;
|
|
6135
|
+
lineItems: {
|
|
6136
|
+
id: string;
|
|
6137
|
+
productId: string;
|
|
6138
|
+
variantId: string;
|
|
6139
|
+
sku: string;
|
|
6140
|
+
title: string;
|
|
6141
|
+
name: string;
|
|
6142
|
+
slug: string;
|
|
6143
|
+
thumbnail: string | null;
|
|
6144
|
+
variantTitle: string;
|
|
6145
|
+
qty: number;
|
|
6146
|
+
price: number;
|
|
6147
|
+
mrp: number;
|
|
6148
|
+
subtotal: number;
|
|
6149
|
+
total: number;
|
|
6150
|
+
inStock: boolean;
|
|
6151
|
+
priceChanged: boolean;
|
|
6152
|
+
currentPrice: number;
|
|
6153
|
+
isSelectedForCheckout: boolean;
|
|
6154
|
+
variant: {
|
|
6155
|
+
id: string;
|
|
6156
|
+
options: {
|
|
6157
|
+
option: {
|
|
6158
|
+
title: string;
|
|
6159
|
+
};
|
|
6160
|
+
value: string;
|
|
6161
|
+
}[];
|
|
6162
|
+
};
|
|
6163
|
+
product: {
|
|
6164
|
+
id: string;
|
|
6165
|
+
categories: unknown[];
|
|
6166
|
+
};
|
|
6167
|
+
}[];
|
|
6168
|
+
qty: number;
|
|
6169
|
+
currencyCode: string;
|
|
6170
|
+
currency: string;
|
|
6171
|
+
subtotal: number;
|
|
6172
|
+
discountAmount: number;
|
|
6173
|
+
savingAmount: number;
|
|
6174
|
+
couponCode: string | null;
|
|
6175
|
+
discount: AppliedDiscount | null;
|
|
6176
|
+
shippingCharges: number;
|
|
6177
|
+
shippingRateId: string | null;
|
|
6178
|
+
shippingMethod: string | null;
|
|
6179
|
+
tax: number;
|
|
6180
|
+
taxIncluded: boolean;
|
|
6181
|
+
codCharges: number;
|
|
6182
|
+
total: number;
|
|
6183
|
+
shippingAddress: StorefrontAddress | null;
|
|
6184
|
+
shippingAddressId: string | null;
|
|
6185
|
+
billingAddress: StorefrontAddress | null;
|
|
6186
|
+
billingAddressId: string | null;
|
|
6187
|
+
paymentMethod: null;
|
|
6188
|
+
needAddress: boolean;
|
|
6189
|
+
completedAt: string | null;
|
|
6190
|
+
createdAt: string;
|
|
6191
|
+
updatedAt: string;
|
|
6192
|
+
expiresAt: string;
|
|
6193
|
+
};
|
|
6194
|
+
rejected: RejectedLine[];
|
|
6195
|
+
}>;
|
|
6196
|
+
/** A past order's lines in a new bag, at today's prices. Nothing is placed. */
|
|
6197
|
+
reorder(orderId: number | string): Promise<{
|
|
6198
|
+
cart: {
|
|
6199
|
+
id: string;
|
|
6200
|
+
status: "open" | "converted" | "abandoned";
|
|
6201
|
+
email: string | null;
|
|
6202
|
+
phone: string | null;
|
|
6203
|
+
name: string | null;
|
|
6204
|
+
lineItems: {
|
|
6205
|
+
id: string;
|
|
6206
|
+
productId: string;
|
|
6207
|
+
variantId: string;
|
|
6208
|
+
sku: string;
|
|
6209
|
+
title: string;
|
|
6210
|
+
name: string;
|
|
6211
|
+
slug: string;
|
|
6212
|
+
thumbnail: string | null;
|
|
6213
|
+
variantTitle: string;
|
|
6214
|
+
qty: number;
|
|
6215
|
+
price: number;
|
|
6216
|
+
mrp: number;
|
|
6217
|
+
subtotal: number;
|
|
6218
|
+
total: number;
|
|
6219
|
+
inStock: boolean;
|
|
6220
|
+
priceChanged: boolean;
|
|
6221
|
+
currentPrice: number;
|
|
6222
|
+
isSelectedForCheckout: boolean;
|
|
6223
|
+
variant: {
|
|
6224
|
+
id: string;
|
|
6225
|
+
options: {
|
|
6226
|
+
option: {
|
|
6227
|
+
title: string;
|
|
6228
|
+
};
|
|
6229
|
+
value: string;
|
|
6230
|
+
}[];
|
|
6231
|
+
};
|
|
6232
|
+
product: {
|
|
6233
|
+
id: string;
|
|
6234
|
+
categories: unknown[];
|
|
6235
|
+
};
|
|
6236
|
+
}[];
|
|
6237
|
+
qty: number;
|
|
6238
|
+
currencyCode: string;
|
|
6239
|
+
currency: string;
|
|
6240
|
+
subtotal: number;
|
|
6241
|
+
discountAmount: number;
|
|
6242
|
+
savingAmount: number;
|
|
6243
|
+
couponCode: string | null;
|
|
6244
|
+
discount: AppliedDiscount | null;
|
|
6245
|
+
shippingCharges: number;
|
|
6246
|
+
shippingRateId: string | null;
|
|
6247
|
+
shippingMethod: string | null;
|
|
6248
|
+
tax: number;
|
|
6249
|
+
taxIncluded: boolean;
|
|
6250
|
+
codCharges: number;
|
|
6251
|
+
total: number;
|
|
6252
|
+
shippingAddress: StorefrontAddress | null;
|
|
6253
|
+
shippingAddressId: string | null;
|
|
6254
|
+
billingAddress: StorefrontAddress | null;
|
|
6255
|
+
billingAddressId: string | null;
|
|
6256
|
+
paymentMethod: null;
|
|
6257
|
+
needAddress: boolean;
|
|
6258
|
+
completedAt: string | null;
|
|
6259
|
+
createdAt: string;
|
|
6260
|
+
updatedAt: string;
|
|
6261
|
+
expiresAt: string;
|
|
6262
|
+
};
|
|
6263
|
+
rejected: RejectedLine[];
|
|
6264
|
+
}>;
|
|
6265
|
+
/**
|
|
6266
|
+
* Places the bag through the company: on account by default, with a PO
|
|
6267
|
+
* number, optionally only some lines (`lineIds`). A buyer over the company's
|
|
6268
|
+
* approval threshold gets `{ kind: 'approval' }` instead of an order — the
|
|
6269
|
+
* bag stays as it was, and an approver places it later.
|
|
6270
|
+
*
|
|
6271
|
+
* Over the credit limit is 403 `credit_limit_exceeded`; `me().credit` says
|
|
6272
|
+
* how much is available before the shopper tries.
|
|
6273
|
+
*/
|
|
6274
|
+
checkout({ cartId, lineIds, shippingRateId, returnUrl, paymentData, ...opts }?: PlaceOptions & {
|
|
6275
|
+
cartId?: string;
|
|
6276
|
+
lineIds?: (number | string)[];
|
|
6277
|
+
shippingRateId?: number | string;
|
|
6278
|
+
returnUrl?: string;
|
|
6279
|
+
paymentData?: Record<string, string>;
|
|
6280
|
+
}): Promise<B2bPlaced>;
|
|
6281
|
+
/** Admins and approvers see the company's; a buyer sees their own. `q` matches the number, PO or email. */
|
|
6282
|
+
orders({ page, limit, q, overdue, }?: {
|
|
6283
|
+
page?: number;
|
|
6284
|
+
limit?: number;
|
|
6285
|
+
q?: string;
|
|
6286
|
+
overdue?: boolean;
|
|
6287
|
+
}): Promise<Paged<CompanyOrder>>;
|
|
6288
|
+
approvals({ page, limit, status, }?: {
|
|
6289
|
+
page?: number;
|
|
6290
|
+
limit?: number;
|
|
6291
|
+
status?: Approval['status'];
|
|
6292
|
+
}): Promise<Paged<Approval>>;
|
|
6293
|
+
approval(approvalId: number | string): Promise<Approval>;
|
|
6294
|
+
/**
|
|
6295
|
+
* Admin or approver: places the requested order at the prices it was
|
|
6296
|
+
* requested at. Credit limits and holds still apply. The payment intent is
|
|
6297
|
+
* the approver's to act on — for an account order there is nothing to do.
|
|
6298
|
+
*/
|
|
6299
|
+
approve(approvalId: number | string): Promise<{
|
|
6300
|
+
approval: Approval;
|
|
6301
|
+
orderNo: string;
|
|
6302
|
+
order: {
|
|
6303
|
+
id: string;
|
|
6304
|
+
orderNo: string;
|
|
6305
|
+
orderNumber: string;
|
|
6306
|
+
number: string;
|
|
6307
|
+
parentOrderNo: string;
|
|
6308
|
+
status: string;
|
|
6309
|
+
engineStatus: string;
|
|
6310
|
+
paymentStatus: string;
|
|
6311
|
+
paymentMethod: string;
|
|
6312
|
+
currencyCode: string;
|
|
6313
|
+
subtotal: number;
|
|
6314
|
+
shippingCharges: number;
|
|
6315
|
+
discount: number;
|
|
6316
|
+
tax: number;
|
|
6317
|
+
taxIncluded: boolean;
|
|
6318
|
+
total: number;
|
|
6319
|
+
refunded: number;
|
|
6320
|
+
codCharges: number;
|
|
6321
|
+
coupon: {
|
|
6322
|
+
code: string;
|
|
6323
|
+
} | null;
|
|
6324
|
+
userEmail: string;
|
|
6325
|
+
email: string;
|
|
6326
|
+
phone: string | null;
|
|
6327
|
+
shippingAddress: {
|
|
6328
|
+
firstName: string;
|
|
6329
|
+
lastName: string;
|
|
6330
|
+
email: string | null;
|
|
6331
|
+
phone: string | null;
|
|
6332
|
+
address_1: string;
|
|
6333
|
+
address_2: string;
|
|
6334
|
+
city: string;
|
|
6335
|
+
state: string;
|
|
6336
|
+
zip: string;
|
|
6337
|
+
country: string;
|
|
6338
|
+
countryCode: string;
|
|
6339
|
+
} | null;
|
|
6340
|
+
billingAddress: {
|
|
6341
|
+
firstName: string;
|
|
6342
|
+
lastName: string;
|
|
6343
|
+
email: string | null;
|
|
6344
|
+
phone: string | null;
|
|
6345
|
+
address_1: string;
|
|
6346
|
+
address_2: string;
|
|
6347
|
+
city: string;
|
|
6348
|
+
state: string;
|
|
6349
|
+
zip: string;
|
|
6350
|
+
country: string;
|
|
6351
|
+
countryCode: string;
|
|
6352
|
+
} | null;
|
|
6353
|
+
shippingMethod: string | null;
|
|
6354
|
+
shippingRate: {
|
|
6355
|
+
name: string;
|
|
6356
|
+
} | null;
|
|
6357
|
+
lineItems: {
|
|
6358
|
+
id: string;
|
|
6359
|
+
productId: string;
|
|
6360
|
+
variantId: string;
|
|
6361
|
+
sku: string;
|
|
6362
|
+
title: string;
|
|
6363
|
+
name: string;
|
|
6364
|
+
slug: string;
|
|
6365
|
+
thumbnail: string | null;
|
|
6366
|
+
img: string | null;
|
|
6367
|
+
variantTitle: string;
|
|
6368
|
+
qty: number;
|
|
6369
|
+
shippedQty: number;
|
|
6370
|
+
price: number;
|
|
6371
|
+
mrp: number;
|
|
6372
|
+
subtotal: number;
|
|
6373
|
+
total: number;
|
|
6374
|
+
currencyCode: string;
|
|
6375
|
+
status: string;
|
|
6376
|
+
files: never[];
|
|
6377
|
+
usedOptions: never[];
|
|
6378
|
+
}[];
|
|
6379
|
+
fulfillments: {
|
|
6380
|
+
id: string;
|
|
6381
|
+
status: string;
|
|
6382
|
+
carrier: string;
|
|
6383
|
+
trackingNumber: string | null;
|
|
6384
|
+
trackingUrl: string | null;
|
|
6385
|
+
lineItems: {
|
|
6386
|
+
id: string;
|
|
6387
|
+
title: string;
|
|
6388
|
+
qty: number;
|
|
6389
|
+
}[];
|
|
6390
|
+
createdAt: string;
|
|
6391
|
+
}[];
|
|
6392
|
+
tracking: never[];
|
|
6393
|
+
orderHistory: never[];
|
|
6394
|
+
isReplaceOrReturn: boolean;
|
|
6395
|
+
createdAt: string;
|
|
6396
|
+
updatedAt: string;
|
|
6397
|
+
};
|
|
6398
|
+
payment: PaymentIntent;
|
|
6399
|
+
}>;
|
|
6400
|
+
reject(approvalId: number | string, reason?: string): Promise<Approval>;
|
|
6401
|
+
/** The buyer who asked withdraws the request. */
|
|
6402
|
+
cancelApproval(approvalId: number | string): Promise<Approval>;
|
|
6403
|
+
quotes({ page, limit, status }?: {
|
|
6404
|
+
page?: number;
|
|
6405
|
+
limit?: number;
|
|
6406
|
+
status?: Quote['status'];
|
|
6407
|
+
}): Promise<Paged<Quote>>;
|
|
6408
|
+
quote(quoteId: number | string): Promise<Quote>;
|
|
6409
|
+
/** Asks the store to price these lines. The store answers with unit prices and an expiry. */
|
|
6410
|
+
requestQuote({ lines, note }: {
|
|
6411
|
+
lines: {
|
|
6412
|
+
variantId: number | string;
|
|
6413
|
+
quantity: number;
|
|
6414
|
+
}[];
|
|
6415
|
+
note?: string;
|
|
6416
|
+
}): Promise<Quote>;
|
|
6417
|
+
/** Places the quote at its agreed prices — or, for a buyer over the threshold, asks for approval. */
|
|
6418
|
+
acceptQuote(quoteId: number | string, opts?: PlaceOptions): Promise<B2bPlaced>;
|
|
6419
|
+
declineQuote(quoteId: number | string): Promise<Quote>;
|
|
6420
|
+
/**
|
|
6421
|
+
* The public "find a dealer" form: no account needed. The engine routes it to
|
|
6422
|
+
* the dealer whose territory covers the address — or keeps it — and answers
|
|
6423
|
+
* the same either way, so the form never reveals who got it.
|
|
6424
|
+
*/
|
|
6425
|
+
submitLead(lead: {
|
|
6426
|
+
name?: string;
|
|
6427
|
+
email?: string;
|
|
6428
|
+
phone?: string;
|
|
6429
|
+
message?: string;
|
|
6430
|
+
country?: string;
|
|
6431
|
+
state?: string;
|
|
6432
|
+
postalCode?: string;
|
|
6433
|
+
productId?: number | string;
|
|
6434
|
+
variantId?: number | string;
|
|
6435
|
+
source?: string;
|
|
6436
|
+
}): Promise<{
|
|
6437
|
+
accepted: boolean;
|
|
6438
|
+
}>;
|
|
6439
|
+
/** A dealer's admins and approvers: the leads routed to their company. */
|
|
6440
|
+
leads({ page, limit, status }?: {
|
|
6441
|
+
page?: number;
|
|
6442
|
+
limit?: number;
|
|
6443
|
+
status?: Lead['status'];
|
|
6444
|
+
}): Promise<Paged<Lead>>;
|
|
6445
|
+
setLeadStatus(leadId: number | string, status: Lead['status']): Promise<Lead>;
|
|
6446
|
+
/** The fields checkout and quote acceptance share. Only declared ones: the engine refuses the rest. */
|
|
6447
|
+
private placeBody;
|
|
6448
|
+
private placed;
|
|
6449
|
+
}
|
|
6450
|
+
declare const b2bService: B2bService;
|
|
6451
|
+
|
|
6452
|
+
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, vendorService 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, searchService as bA, settingService as bB, settingsService as bC, stateService as bD, staticStore as bE, storeService as bF, toCart as bG, toCartLine as bH, toCategory as bI, toCmsPage as bJ, toCollection as bK, toEngineAddress as bL, toIdentityAddress as bM, toMajor as bN, toMinor as bO, toOrder as bP, toPage as bQ, toProduct as bR, toRating as bS, toUser as bT, toVariant as bU, toVendor as bV, uploadService as bW, userService as bX, variantService as bY, varniCustomDesignService as bZ, varniCustomProductService as b_, feedbackService as ba, fromEngineAddress as bb, fromIdentityAddress as bc, fromSearchDoc as bd, galleryService as be, homeService as bf, initService as bg, meilisearchService as bh, menuService as bi, minorToMajor as bj, newsletterService as bk, orderService as bl, pageService as bm, paymentMethodService as bn, pluginService as bo, pluginsService as bp, popularSearchService as bq, popularityService as br, priceOf as bs, productImages as bt, productService as bu, profileService as bv, qs as bw, reelsService as bx, regionService as by, reviewService as bz, type Approval as c, warrantyService as c0, wishlistService as c1, 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 };
|