@misiki/gocommerce-connector 0.28.0 → 0.30.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 +6 -0
- package/dist/{index-BaFtBtaA.d.cts → index-BdXhbm20.d.cts} +145 -24
- package/dist/{index-BaFtBtaA.d.ts → index-BdXhbm20.d.ts} +145 -24
- package/dist/index.cjs +204 -26
- 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 +204 -27
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +202 -26
- 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 +202 -26
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -297,6 +297,8 @@ type CartOffer = {
|
|
|
297
297
|
free_shipping?: boolean;
|
|
298
298
|
remaining?: Money;
|
|
299
299
|
reason?: string;
|
|
300
|
+
/** Checkout applies it by itself when no code is typed (D179); absent on an engine before it. */
|
|
301
|
+
auto_apply?: boolean;
|
|
300
302
|
};
|
|
301
303
|
/** How far a basket is from free delivery (D133). */
|
|
302
304
|
type FreeShipping = {
|
|
@@ -423,6 +425,24 @@ type CheckoutOptions = {
|
|
|
423
425
|
}[];
|
|
424
426
|
currency: string;
|
|
425
427
|
};
|
|
428
|
+
/** What checkout would charge for a cart now, placing nothing (D185). */
|
|
429
|
+
type CheckoutQuote = {
|
|
430
|
+
subtotal: Money;
|
|
431
|
+
shipping: Money;
|
|
432
|
+
shipping_method?: string;
|
|
433
|
+
/** The code checkout took off; `auto_applied` when the shopper typed none and checkout chose it (D179). */
|
|
434
|
+
discount: {
|
|
435
|
+
code: string;
|
|
436
|
+
title: string;
|
|
437
|
+
auto_applied: boolean;
|
|
438
|
+
amount: Money;
|
|
439
|
+
free_shipping?: boolean;
|
|
440
|
+
} | null;
|
|
441
|
+
tax: Money;
|
|
442
|
+
tax_inclusive: boolean;
|
|
443
|
+
payment_fee: Money;
|
|
444
|
+
total: Money;
|
|
445
|
+
};
|
|
426
446
|
type ShippingRate = {
|
|
427
447
|
rate_id: number;
|
|
428
448
|
name: string;
|
|
@@ -594,6 +614,11 @@ type OpeningHours = {
|
|
|
594
614
|
opens: string;
|
|
595
615
|
closes: string;
|
|
596
616
|
};
|
|
617
|
+
/** `POST /api/store/password` (D170): a closed store's pass, from its password or a pass still good. */
|
|
618
|
+
type StorePassAnswer = {
|
|
619
|
+
token: string;
|
|
620
|
+
expires_at: string;
|
|
621
|
+
};
|
|
597
622
|
type Vendor = {
|
|
598
623
|
id: number;
|
|
599
624
|
slug: string;
|
|
@@ -1453,6 +1478,27 @@ declare function toCartOffer(o: CartOffer, currency: string): {
|
|
|
1453
1478
|
amount: number | null;
|
|
1454
1479
|
remaining: number | null;
|
|
1455
1480
|
reason: string;
|
|
1481
|
+
autoApply: boolean;
|
|
1482
|
+
};
|
|
1483
|
+
/**
|
|
1484
|
+
* A checkout quote under the names `toOrder` gives the order it becomes, so a
|
|
1485
|
+
* page shows the two the same way.
|
|
1486
|
+
*/
|
|
1487
|
+
declare function toCheckoutQuote(q: CheckoutQuote): {
|
|
1488
|
+
subtotal: number;
|
|
1489
|
+
shippingCharges: number;
|
|
1490
|
+
shippingMethod: string | null;
|
|
1491
|
+
discount: number;
|
|
1492
|
+
coupon: {
|
|
1493
|
+
code: string;
|
|
1494
|
+
title: string;
|
|
1495
|
+
autoApplied: boolean;
|
|
1496
|
+
freeShipping: boolean;
|
|
1497
|
+
} | null;
|
|
1498
|
+
tax: number;
|
|
1499
|
+
taxIncluded: boolean;
|
|
1500
|
+
codCharges: number;
|
|
1501
|
+
total: number;
|
|
1456
1502
|
};
|
|
1457
1503
|
declare function toFreeShipping(f: FreeShipping): {
|
|
1458
1504
|
qualifies: boolean;
|
|
@@ -2469,13 +2515,19 @@ declare class ProductService extends CatalogService {
|
|
|
2469
2515
|
}
|
|
2470
2516
|
declare const productService: ProductService;
|
|
2471
2517
|
|
|
2518
|
+
type RailCategory = {
|
|
2519
|
+
name: string;
|
|
2520
|
+
slug: string;
|
|
2521
|
+
count: number;
|
|
2522
|
+
depth: number;
|
|
2523
|
+
};
|
|
2472
2524
|
/**
|
|
2473
2525
|
* The engine's counts in the shape the storefront's filter rail reads. Each
|
|
2474
2526
|
* `allFilters` key is also the URL parameter the rail writes when a value is
|
|
2475
2527
|
* ticked, and `searchWithUrl` reads it back: `vendor`, `product_type` and
|
|
2476
2528
|
* `attributes.<handle>`. Tags go to the rail's own tag group, written as `tags`.
|
|
2477
2529
|
*/
|
|
2478
|
-
declare function toStorefrontFacets(f?: ProductFacets | null): {
|
|
2530
|
+
declare function toStorefrontFacets(f?: ProductFacets | null, tree?: Category[]): {
|
|
2479
2531
|
priceStat: {
|
|
2480
2532
|
min: number;
|
|
2481
2533
|
max: number;
|
|
@@ -2483,11 +2535,7 @@ declare function toStorefrontFacets(f?: ProductFacets | null): {
|
|
|
2483
2535
|
min?: undefined;
|
|
2484
2536
|
max?: undefined;
|
|
2485
2537
|
};
|
|
2486
|
-
categories:
|
|
2487
|
-
name: string;
|
|
2488
|
-
slug: string;
|
|
2489
|
-
count: number;
|
|
2490
|
-
}[];
|
|
2538
|
+
categories: RailCategory[];
|
|
2491
2539
|
tags: {
|
|
2492
2540
|
name: string;
|
|
2493
2541
|
count: number;
|
|
@@ -2520,11 +2568,7 @@ declare class SearchService extends CatalogService {
|
|
|
2520
2568
|
min?: undefined;
|
|
2521
2569
|
max?: undefined;
|
|
2522
2570
|
};
|
|
2523
|
-
categories:
|
|
2524
|
-
name: string;
|
|
2525
|
-
slug: string;
|
|
2526
|
-
count: number;
|
|
2527
|
-
}[];
|
|
2571
|
+
categories: RailCategory[];
|
|
2528
2572
|
tags: {
|
|
2529
2573
|
name: string;
|
|
2530
2574
|
count: number;
|
|
@@ -2548,11 +2592,7 @@ declare class SearchService extends CatalogService {
|
|
|
2548
2592
|
min?: undefined;
|
|
2549
2593
|
max?: undefined;
|
|
2550
2594
|
};
|
|
2551
|
-
categories:
|
|
2552
|
-
name: string;
|
|
2553
|
-
slug: string;
|
|
2554
|
-
count: number;
|
|
2555
|
-
}[];
|
|
2595
|
+
categories: RailCategory[];
|
|
2556
2596
|
tags: {
|
|
2557
2597
|
name: string;
|
|
2558
2598
|
count: number;
|
|
@@ -2719,11 +2759,7 @@ declare class SearchService extends CatalogService {
|
|
|
2719
2759
|
min?: undefined;
|
|
2720
2760
|
max?: undefined;
|
|
2721
2761
|
};
|
|
2722
|
-
categories:
|
|
2723
|
-
name: string;
|
|
2724
|
-
slug: string;
|
|
2725
|
-
count: number;
|
|
2726
|
-
}[];
|
|
2762
|
+
categories: RailCategory[];
|
|
2727
2763
|
tags: {
|
|
2728
2764
|
name: string;
|
|
2729
2765
|
count: number;
|
|
@@ -3866,6 +3902,7 @@ declare class CartService extends BaseService {
|
|
|
3866
3902
|
amount: number | null;
|
|
3867
3903
|
remaining: number | null;
|
|
3868
3904
|
reason: string;
|
|
3905
|
+
autoApply: boolean;
|
|
3869
3906
|
}[]>;
|
|
3870
3907
|
/**
|
|
3871
3908
|
* How far the bag is from free delivery (D133), read from the store's own
|
|
@@ -4628,6 +4665,7 @@ declare const customizerService: CustomizerService;
|
|
|
4628
4665
|
* the order page shows `payment_status` once the webhook has landed.
|
|
4629
4666
|
*/
|
|
4630
4667
|
declare class CheckoutService extends BaseService {
|
|
4668
|
+
private expected;
|
|
4631
4669
|
/** Delivery options for the address on the cart: `{ data: [{ id, name, base_rate }] }`. */
|
|
4632
4670
|
getShippingRates({ cartId }?: {
|
|
4633
4671
|
cartId?: string;
|
|
@@ -4854,6 +4892,45 @@ declare class CheckoutService extends BaseService {
|
|
|
4854
4892
|
}[];
|
|
4855
4893
|
currency: string;
|
|
4856
4894
|
}>;
|
|
4895
|
+
/**
|
|
4896
|
+
* What checkout would charge for the cart now, by the storefront's method
|
|
4897
|
+
* code (`COD`, `RAZORPAY`, `PAYPAL`) or none yet (D185). Null until the
|
|
4898
|
+
* address step has stored an address, and null from an engine before D185.
|
|
4899
|
+
*
|
|
4900
|
+
* A refusal is checkout's own: the same GoCommerceError, with the same
|
|
4901
|
+
* message, that placing the order would raise now.
|
|
4902
|
+
*/
|
|
4903
|
+
getQuote({ cartId, method }?: {
|
|
4904
|
+
cartId?: string;
|
|
4905
|
+
method?: string;
|
|
4906
|
+
}): Promise<{
|
|
4907
|
+
subtotal: number;
|
|
4908
|
+
shippingCharges: number;
|
|
4909
|
+
shippingMethod: string | null;
|
|
4910
|
+
discount: number;
|
|
4911
|
+
coupon: {
|
|
4912
|
+
code: string;
|
|
4913
|
+
title: string;
|
|
4914
|
+
autoApplied: boolean;
|
|
4915
|
+
freeShipping: boolean;
|
|
4916
|
+
} | null;
|
|
4917
|
+
tax: number;
|
|
4918
|
+
taxIncluded: boolean;
|
|
4919
|
+
codCharges: number;
|
|
4920
|
+
total: number;
|
|
4921
|
+
} | null>;
|
|
4922
|
+
/**
|
|
4923
|
+
* The total on screen as the shopper confirms, from getQuote, or null when nothing was quoted
|
|
4924
|
+
* (D185). Every order placed for the cart then carries it, and checkout refuses one whose own
|
|
4925
|
+
* total differs instead of charging it: `onChange` gets checkout's figures now and the sentence
|
|
4926
|
+
* the placing call fails with.
|
|
4927
|
+
*/
|
|
4928
|
+
expectTotal({ cartId, total, onChange, }: {
|
|
4929
|
+
cartId?: string;
|
|
4930
|
+
total?: number | null;
|
|
4931
|
+
onChange?: Expected['onChange'];
|
|
4932
|
+
}): void;
|
|
4933
|
+
private storedCheckout;
|
|
4857
4934
|
private redirectGateway;
|
|
4858
4935
|
/**
|
|
4859
4936
|
* One checkout attempt.
|
|
@@ -4869,6 +4946,10 @@ declare class CheckoutService extends BaseService {
|
|
|
4869
4946
|
}
|
|
4870
4947
|
/** The engine's gateways that take payment on their own hosted page. */
|
|
4871
4948
|
declare const REDIRECT_GATEWAYS: Set<string>;
|
|
4949
|
+
type Expected = {
|
|
4950
|
+
total: number;
|
|
4951
|
+
onChange?: (quote: ReturnType<typeof toCheckoutQuote>, message: string) => void;
|
|
4952
|
+
};
|
|
4872
4953
|
declare const checkoutService: CheckoutService;
|
|
4873
4954
|
|
|
4874
4955
|
declare class PaymentMethodService extends BaseService {
|
|
@@ -4903,8 +4984,9 @@ declare const paymentMethodService: PaymentMethodService;
|
|
|
4903
4984
|
* `cartService.applyCoupon`.
|
|
4904
4985
|
*
|
|
4905
4986
|
* The drawer's shape: `amount` is the percentage or the amount,
|
|
4906
|
-
* `minAmount` the bag it needs,
|
|
4907
|
-
* still missing
|
|
4987
|
+
* `minAmount` the bag it needs, `description` says what is
|
|
4988
|
+
* still missing, and `autoApply` marks a code checkout applies by
|
|
4989
|
+
* itself (D179).
|
|
4908
4990
|
*/
|
|
4909
4991
|
declare class CouponService extends BaseService {
|
|
4910
4992
|
listCoupons(_args?: Record<string, unknown>): Promise<{
|
|
@@ -4918,6 +5000,7 @@ declare class CouponService extends BaseService {
|
|
|
4918
5000
|
description: string;
|
|
4919
5001
|
applies: boolean;
|
|
4920
5002
|
remaining: number | null;
|
|
5003
|
+
autoApply: boolean;
|
|
4921
5004
|
}[];
|
|
4922
5005
|
count: number;
|
|
4923
5006
|
pageSize: number;
|
|
@@ -6559,9 +6642,11 @@ declare class StoreService extends BaseService {
|
|
|
6559
6642
|
storeId?: string;
|
|
6560
6643
|
domain?: string;
|
|
6561
6644
|
}): Promise<{
|
|
6645
|
+
closed: StoreClosed | undefined;
|
|
6562
6646
|
id: any;
|
|
6563
6647
|
}>;
|
|
6564
6648
|
getStore(storeId?: string): Promise<{
|
|
6649
|
+
closed: StoreClosed | undefined;
|
|
6565
6650
|
id: any;
|
|
6566
6651
|
}>;
|
|
6567
6652
|
/**
|
|
@@ -6578,9 +6663,39 @@ declare class StoreService extends BaseService {
|
|
|
6578
6663
|
* that list lives here.
|
|
6579
6664
|
*/
|
|
6580
6665
|
post<T = any>(path: string, data?: unknown): Promise<T>;
|
|
6666
|
+
/**
|
|
6667
|
+
* A closed store's password (D170), traded for a pass. Never throws. The
|
|
6668
|
+
* engine allows 20 tries an hour per client, and sees this server as the
|
|
6669
|
+
* client unless `clientAddress`, the shopper's, travels as `X-Forwarded-For`.
|
|
6670
|
+
*/
|
|
6671
|
+
unlockStore(password: string, { clientAddress }?: {
|
|
6672
|
+
clientAddress?: string;
|
|
6673
|
+
}): Promise<StoreUnlock>;
|
|
6674
|
+
/**
|
|
6675
|
+
* A pass checked without spending a try: the pass, or null when it is wrong,
|
|
6676
|
+
* expired, ended by a new password, or the store takes none now. Throws when
|
|
6677
|
+
* the engine cannot say.
|
|
6678
|
+
*/
|
|
6679
|
+
checkStorePass(token: string): Promise<StorePass | null>;
|
|
6680
|
+
private storePass;
|
|
6581
6681
|
private live;
|
|
6582
6682
|
}
|
|
6583
6683
|
declare const storeService: StoreService;
|
|
6684
|
+
/** A store its owner closed (D170): the message to show, and whether a password lets a visitor in. */
|
|
6685
|
+
type StoreClosed = {
|
|
6686
|
+
message: string;
|
|
6687
|
+
password: boolean;
|
|
6688
|
+
};
|
|
6689
|
+
type StorePass = {
|
|
6690
|
+
token: string;
|
|
6691
|
+
expiresAt: Date;
|
|
6692
|
+
};
|
|
6693
|
+
type StoreUnlock = {
|
|
6694
|
+
outcome: 'unlocked';
|
|
6695
|
+
pass: StorePass;
|
|
6696
|
+
} | {
|
|
6697
|
+
outcome: 'wrong' | 'throttled' | 'open' | 'unavailable';
|
|
6698
|
+
};
|
|
6584
6699
|
|
|
6585
6700
|
/**
|
|
6586
6701
|
* Content pages from ext/cms, in the shopper's language with the store's
|
|
@@ -6673,6 +6788,7 @@ type LayoutCollection = {
|
|
|
6673
6788
|
slug: string;
|
|
6674
6789
|
link: string;
|
|
6675
6790
|
image: string | null;
|
|
6791
|
+
description: string | null;
|
|
6676
6792
|
};
|
|
6677
6793
|
/**
|
|
6678
6794
|
* One section of a composed page. `settings` is the merchant's, as validated
|
|
@@ -6918,21 +7034,26 @@ declare class PluginService extends BaseService {
|
|
|
6918
7034
|
/** The store record again, for the callers that ask for it as "settings" or "init". */
|
|
6919
7035
|
declare class SettingService extends BaseService {
|
|
6920
7036
|
fetchSettings(_args?: Record<string, unknown>): Promise<{
|
|
7037
|
+
closed: StoreClosed | undefined;
|
|
6921
7038
|
id: any;
|
|
6922
7039
|
}>;
|
|
6923
7040
|
list(args?: Record<string, unknown>): Promise<{
|
|
7041
|
+
closed: StoreClosed | undefined;
|
|
6924
7042
|
id: any;
|
|
6925
7043
|
}>;
|
|
6926
7044
|
}
|
|
6927
7045
|
declare class InitService extends SettingService {
|
|
6928
7046
|
fetchInit(_args?: Record<string, unknown>): Promise<{
|
|
6929
7047
|
storeOne: {
|
|
7048
|
+
closed: StoreClosed | undefined;
|
|
6930
7049
|
id: any;
|
|
6931
7050
|
};
|
|
6932
7051
|
store: {
|
|
7052
|
+
closed: StoreClosed | undefined;
|
|
6933
7053
|
id: any;
|
|
6934
7054
|
};
|
|
6935
7055
|
settings: {
|
|
7056
|
+
closed: StoreClosed | undefined;
|
|
6936
7057
|
id: any;
|
|
6937
7058
|
};
|
|
6938
7059
|
}>;
|
|
@@ -8009,4 +8130,4 @@ declare class B2bService extends BaseService {
|
|
|
8009
8130
|
}
|
|
8010
8131
|
declare const b2bService: B2bService;
|
|
8011
8132
|
|
|
8012
|
-
export {
|
|
8133
|
+
export { type Faq as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type Company as D, type CompanyOrder as E, ContactService as F, CountryService as G, CouponService as H, type Credentials as I, type Credit as J, CurrencyService as K, type Customer as L, type CustomizerDesign as M, type CustomizerDocument as N, type CustomizerEditor as O, type CustomizerFile as P, type CustomizerLayer as Q, type CustomizerSavedDesign as R, CustomizerService as S, type CustomizerSetup as T, type CustomizerUpload as U, DealService as V, DemoRequestService as W, type EngineRequest as X, EnquiryService as Y, type Envelope as Z, type FacetValue as _, type Address as a, type SiteChrome as a$, FaqService as a0, FeedbackService as a1, type FooterSettings as a2, type FreeShipping as a3, type Fulfillment as a4, GalleryService as a5, type GooglePlace as a6, type GoogleReview as a7, GoogleReviewService as a8, type GoogleReviews as a9, type PageLayout as aA, PageService as aB, type PaymentIntent as aC, PaymentMethodService as aD, type Plugin as aE, PluginService as aF, PopularSearchService as aG, PopularityService as aH, type Postcode as aI, type Product as aJ, type ProductFacets as aK, type ProductOption as aL, ProductService as aM, ProfileService as aN, type Quote as aO, REDIRECT_GATEWAYS as aP, ReelsService as aQ, RegionService as aR, type RejectedLine as aS, type Review as aT, type ReviewPage as aU, ReviewService as aV, type SearchDoc as aW, type SearchResult as aX, SearchService as aY, SettingService as aZ, type ShippingRate as a_, type GoogleSurvey as aa, type HeaderSettings as ab, type HomeLayout as ac, type HomeLayoutSection as ad, HomeService as ae, type IdentityAddress as af, InitService as ag, type Invitation as ah, type LayoutCollection as ai, type LayoutPage as aj, LayoutService as ak, type Lead as al, type ListMeta as am, MeilisearchService as an, type Member as ao, type Menu as ap, type MenuItem as aq, MenuService as ar, type MenuSummary as as, type Money as at, NewsletterService as au, type Offer as av, type OpeningHours as aw, type Order as ax, type OrderLine as ay, OrderService as az, AddressService as b, layoutService as b$, type SiteFooter as b0, type SiteHeader as b1, type SocialLink as b2, StateService as b3, type StoreClosed as b4, type StorePass as b5, type StorePassAnswer as b6, type StoreProfile as b7, StoreService as b8, type StoreUnlock as b9, bannerService as bA, blogService as bB, cartService as bC, categoryService as bD, chatService as bE, checkoutService as bF, collectionService as bG, contactService as bH, countryService as bI, couponService as bJ, currencyExponent as bK, currencyService as bL, customizerService as bM, dealService as bN, demoRequestService as bO, emptyCart as bP, emptyPage as bQ, enquiryService as bR, faqService as bS, feedbackService as bT, fromEngineAddress as bU, fromIdentityAddress as bV, fromSearchDoc as bW, galleryService as bX, googleReviewService as bY, homeService as bZ, initService as b_, type StorefrontCategory as ba, type StorefrontMenu as bb, type StorefrontOrder as bc, type StorefrontProduct as bd, type ThemeSettings as be, type ThemeSettingsResult as bf, UploadService as bg, UserService as bh, type Variant as bi, type VariantImage as bj, VariantService as bk, VarniCustomDesignService as bl, VarniCustomProductService as bm, type Vendor as bn, VendorService as bo, WarrantyService as bp, type WhatsappConsent as bq, type WhatsappConsentOffer as br, WhatsappService as bs, type Wishlist as bt, type WishlistItem as bu, WishlistService as bv, addressService as bw, authService as bx, autocompleteService as by, b2bService as bz, type AppliedDiscount as c, mediaUrl as c0, meilisearchService as c1, menuService as c2, minorToMajor as c3, newsletterService as c4, orderService as c5, ownDomain as c6, pageService as c7, paymentMethodService as c8, pluginService as c9, toCmsPage as cA, toCollection as cB, toEngineAddress as cC, toFreeShipping as cD, toIdentityAddress as cE, toMajor as cF, toMinor as cG, toOrder as cH, toPage as cI, toProduct as cJ, toRating as cK, toStorefrontFacets as cL, toUser as cM, toVariant as cN, toVendor as cO, uploadService as cP, userService as cQ, variantService as cR, varniCustomDesignService as cS, varniCustomProductService as cT, vendorService as cU, warrantyService as cV, whatsappService as cW, wishlistService as cX, pluginsService as ca, popularSearchService as cb, popularityService as cc, priceOf as cd, productImages as ce, productService as cf, productVideos as cg, profileService as ch, qs as ci, reelsService as cj, regionService as ck, reviewService as cl, searchService as cm, setRequestHost as cn, settingService as co, settingsService as cp, stateService as cq, staticStore as cr, storeForHost as cs, storeService as ct, toAddOn as cu, toCart as cv, toCartLine as cw, toCartOffer as cx, toCategory as cy, toCheckoutQuote as cz, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutQuote as u, type CheckoutResult as v, CheckoutService as w, type CmsPage as x, type Collection as y, CollectionService as z };
|