@misiki/gocommerce-connector 0.12.0 → 0.13.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 +4 -2
- package/dist/{index-Bu4bVBBm.d.cts → index-DHKyh3CU.d.cts} +89 -4
- package/dist/{index-Bu4bVBBm.d.ts → index-DHKyh3CU.d.ts} +89 -4
- package/dist/index.cjs +48 -2
- 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 +48 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +47 -2
- 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 +47 -2
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a0 as IdentityAddress, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a7 as ListMeta, a8 as MeilisearchService, a9 as Member, aa as Menu, ab as MenuItem, ac as MenuService, ad as MenuSummary, ae as Money, af as NewsletterService, ag as Offer, ah as Order, ai as OrderLine, aj as OrderService, ak as PageLayout, al as PageService, am as PaymentIntent, an as PaymentMethodService, ao as Plugin, ap as PluginService, ap as PluginsService, aq as PopularSearchService, ar as PopularityService, as as
|
|
1
|
+
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a0 as IdentityAddress, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a7 as ListMeta, a8 as MeilisearchService, a9 as Member, aa as Menu, ab as MenuItem, ac as MenuService, ad as MenuSummary, ae as Money, af as NewsletterService, ag as Offer, ah as Order, ai as OrderLine, aj as OrderService, ak as PageLayout, al as PageService, am as PaymentIntent, an as PaymentMethodService, ao as Plugin, ap as PluginService, ap as PluginsService, aq as PopularSearchService, ar as PopularityService, as as Postcode, at as Product, au as ProductFacets, av as ProductOption, aw as ProductService, ax as ProfileService, ay as Quote, az as REDIRECT_GATEWAYS, aA as ReelsService, aB as RegionService, aC as RejectedLine, aD as Review, aE as ReviewPage, aF as ReviewService, aG as SearchDoc, aH as SearchResult, aI as SearchService, aJ as SettingService, aJ as SettingsService, aK as ShippingRate, aL as SiteChrome, aM as SiteFooter, aN as SiteHeader, aO as SocialLink, aP as StateService, aQ as StoreProfile, aR as StoreService, aS as StorefrontCategory, aT as StorefrontMenu, aU as StorefrontOrder, aV as StorefrontProduct, aW as ThemeSettings, aX as ThemeSettingsResult, aY as UploadService, aZ as UserService, a_ as Variant, a$ as VariantImage, b0 as VariantService, b1 as VarniCustomDesignService, b2 as VarniCustomProductService, b3 as Vendor, b4 as VendorService, b5 as WarrantyService, b6 as Wishlist, b7 as WishlistItem, b8 as WishlistService, b9 as addressService, ba as authService, bb as autocompleteService, bc as b2bService, bd as bannerService, be as blogService, bf as cartService, bg as categoryService, bh as chatService, bi as checkoutService, bj as collectionService, bk as contactService, bl as countryService, bm as couponService, bn as currencyExponent, bo as currencyService, bp as dealService, bq as demoRequestService, br as emptyCart, bs as emptyPage, bt as enquiryService, bu as faqService, bv as feedbackService, bw as fromEngineAddress, bx as fromIdentityAddress, by as fromSearchDoc, bz as galleryService, bA as homeService, bB as initService, bC as layoutService, bD as mediaUrl, bE as meilisearchService, bF as menuService, bG as minorToMajor, bH as newsletterService, bI as orderService, bJ as ownDomain, bK as pageService, bL as paymentMethodService, bM as pluginService, bN as pluginsService, bO as popularSearchService, bP as popularityService, bQ as priceOf, bR as productImages, bS as productService, bT as productVideos, bU as profileService, bV as qs, bW as reelsService, bX as regionService, bY as reviewService, bZ as searchService, b_ as setRequestHost, b$ as settingService, c0 as settingsService, c1 as stateService, c2 as staticStore, c3 as storeForHost, c4 as storeService, c5 as toAddOn, c6 as toCart, c7 as toCartLine, c8 as toCartOffer, c9 as toCategory, ca as toCmsPage, cb as toCollection, cc as toEngineAddress, cd as toFreeShipping, ce as toIdentityAddress, cf as toMajor, cg as toMinor, ch as toOrder, ci as toPage, cj as toProduct, ck as toRating, cl as toStorefrontFacets, cm as toUser, cn as toVariant, co as toVendor, cp as uploadService, cq as userService, cr as variantService, cs as varniCustomDesignService, ct as varniCustomProductService, cu as vendorService, cv as warrantyService, cw as wishlistService } from './index-DHKyh3CU.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a0 as IdentityAddress, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a7 as ListMeta, a8 as MeilisearchService, a9 as Member, aa as Menu, ab as MenuItem, ac as MenuService, ad as MenuSummary, ae as Money, af as NewsletterService, ag as Offer, ah as Order, ai as OrderLine, aj as OrderService, ak as PageLayout, al as PageService, am as PaymentIntent, an as PaymentMethodService, ao as Plugin, ap as PluginService, ap as PluginsService, aq as PopularSearchService, ar as PopularityService, as as
|
|
1
|
+
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a0 as IdentityAddress, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a7 as ListMeta, a8 as MeilisearchService, a9 as Member, aa as Menu, ab as MenuItem, ac as MenuService, ad as MenuSummary, ae as Money, af as NewsletterService, ag as Offer, ah as Order, ai as OrderLine, aj as OrderService, ak as PageLayout, al as PageService, am as PaymentIntent, an as PaymentMethodService, ao as Plugin, ap as PluginService, ap as PluginsService, aq as PopularSearchService, ar as PopularityService, as as Postcode, at as Product, au as ProductFacets, av as ProductOption, aw as ProductService, ax as ProfileService, ay as Quote, az as REDIRECT_GATEWAYS, aA as ReelsService, aB as RegionService, aC as RejectedLine, aD as Review, aE as ReviewPage, aF as ReviewService, aG as SearchDoc, aH as SearchResult, aI as SearchService, aJ as SettingService, aJ as SettingsService, aK as ShippingRate, aL as SiteChrome, aM as SiteFooter, aN as SiteHeader, aO as SocialLink, aP as StateService, aQ as StoreProfile, aR as StoreService, aS as StorefrontCategory, aT as StorefrontMenu, aU as StorefrontOrder, aV as StorefrontProduct, aW as ThemeSettings, aX as ThemeSettingsResult, aY as UploadService, aZ as UserService, a_ as Variant, a$ as VariantImage, b0 as VariantService, b1 as VarniCustomDesignService, b2 as VarniCustomProductService, b3 as Vendor, b4 as VendorService, b5 as WarrantyService, b6 as Wishlist, b7 as WishlistItem, b8 as WishlistService, b9 as addressService, ba as authService, bb as autocompleteService, bc as b2bService, bd as bannerService, be as blogService, bf as cartService, bg as categoryService, bh as chatService, bi as checkoutService, bj as collectionService, bk as contactService, bl as countryService, bm as couponService, bn as currencyExponent, bo as currencyService, bp as dealService, bq as demoRequestService, br as emptyCart, bs as emptyPage, bt as enquiryService, bu as faqService, bv as feedbackService, bw as fromEngineAddress, bx as fromIdentityAddress, by as fromSearchDoc, bz as galleryService, bA as homeService, bB as initService, bC as layoutService, bD as mediaUrl, bE as meilisearchService, bF as menuService, bG as minorToMajor, bH as newsletterService, bI as orderService, bJ as ownDomain, bK as pageService, bL as paymentMethodService, bM as pluginService, bN as pluginsService, bO as popularSearchService, bP as popularityService, bQ as priceOf, bR as productImages, bS as productService, bT as productVideos, bU as profileService, bV as qs, bW as reelsService, bX as regionService, bY as reviewService, bZ as searchService, b_ as setRequestHost, b$ as settingService, c0 as settingsService, c1 as stateService, c2 as staticStore, c3 as storeForHost, c4 as storeService, c5 as toAddOn, c6 as toCart, c7 as toCartLine, c8 as toCartOffer, c9 as toCategory, ca as toCmsPage, cb as toCollection, cc as toEngineAddress, cd as toFreeShipping, ce as toIdentityAddress, cf as toMajor, cg as toMinor, ch as toOrder, ci as toPage, cj as toProduct, ck as toRating, cl as toStorefrontFacets, cm as toUser, cn as toVariant, co as toVendor, cp as uploadService, cq as userService, cr as variantService, cs as varniCustomDesignService, ct as varniCustomProductService, cu as vendorService, cv as warrantyService, cw as wishlistService } from './index-DHKyh3CU.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.js
CHANGED
|
@@ -496,9 +496,27 @@ function productImages(p) {
|
|
|
496
496
|
if (url && !out.includes(url)) out.push(url);
|
|
497
497
|
};
|
|
498
498
|
push(mediaUrl(p.image_url));
|
|
499
|
+
for (const m of arr(p.media)) if (m.kind === "image") push(mediaUrl(m.url));
|
|
499
500
|
for (const v of arr(p.variants)) for (const url of variantImages(v)) push(url);
|
|
500
501
|
return out;
|
|
501
502
|
}
|
|
503
|
+
function productVideos(p) {
|
|
504
|
+
const out = [];
|
|
505
|
+
for (const m of arr(p.media)) {
|
|
506
|
+
const url = m.kind === "video" ? mediaUrl(m.url) : null;
|
|
507
|
+
if (url && !out.includes(url)) out.push(url);
|
|
508
|
+
}
|
|
509
|
+
return out;
|
|
510
|
+
}
|
|
511
|
+
function highlightsOf(p) {
|
|
512
|
+
const raw = p.metadata?.highlights;
|
|
513
|
+
if (!Array.isArray(raw)) return [];
|
|
514
|
+
return raw.filter((s) => typeof s === "string").map((s) => s.trim()).filter(Boolean);
|
|
515
|
+
}
|
|
516
|
+
function freeGiftOf(p) {
|
|
517
|
+
const raw = p.metadata?.free_gift;
|
|
518
|
+
return typeof raw === "string" && raw.trim() ? raw.trim() : null;
|
|
519
|
+
}
|
|
502
520
|
function toVariant(v, p, optionless) {
|
|
503
521
|
const images = variantImages(v);
|
|
504
522
|
const options = arr(p.options);
|
|
@@ -546,6 +564,7 @@ function toProduct(p, extra = {}) {
|
|
|
546
564
|
const lead = live[0] ?? arr(p.variants)[0];
|
|
547
565
|
const optionless = arr(p.options).length === 0;
|
|
548
566
|
const images = productImages(p);
|
|
567
|
+
const videos = productVideos(p);
|
|
549
568
|
const prices = live.map((v) => toMajor(v.price));
|
|
550
569
|
const tracked = live.filter((v) => v.track_inventory);
|
|
551
570
|
const category = p.category;
|
|
@@ -572,8 +591,14 @@ function toProduct(p, extra = {}) {
|
|
|
572
591
|
originCountry: lead?.origin_country ?? null,
|
|
573
592
|
thumbnail: images[0] ?? null,
|
|
574
593
|
image_url: images[0] ?? null,
|
|
575
|
-
images: images.join(","),
|
|
594
|
+
images: [...images, ...videos].join(","),
|
|
576
595
|
imageList: images,
|
|
596
|
+
videos,
|
|
597
|
+
// What the buy box says beside the price (D134): plain text, drawn as text.
|
|
598
|
+
highlights: highlightsOf(p),
|
|
599
|
+
freeGift: freeGiftOf(p),
|
|
600
|
+
// Counted by the engine, rounded down, and absent rather than zero.
|
|
601
|
+
soldAtLeast: typeof p.sold_at_least === "number" && p.sold_at_least > 0 ? p.sold_at_least : null,
|
|
577
602
|
// Product-level stock is what a card shows before a variant is picked:
|
|
578
603
|
// buyable when any live variant is, counted only where counting means
|
|
579
604
|
// something.
|
|
@@ -746,7 +771,9 @@ function toIdentityAddress(a) {
|
|
|
746
771
|
state: e.state ?? "",
|
|
747
772
|
postal_code: e.postal_code,
|
|
748
773
|
country: e.country,
|
|
749
|
-
|
|
774
|
+
// Sent whenever the form has it, empty included: the engine keeps a label it is not sent, so
|
|
775
|
+
// leaving out an emptied one would keep the old Home or Work (D134).
|
|
776
|
+
...typeof a.label === "string" ? { label: a.label } : {},
|
|
750
777
|
...a.isPrimary ? { is_default: true } : {}
|
|
751
778
|
};
|
|
752
779
|
}
|
|
@@ -2686,6 +2713,24 @@ var AddressService = class extends BaseService {
|
|
|
2686
2713
|
});
|
|
2687
2714
|
return fromIdentityAddress(a, currentMe()?.email);
|
|
2688
2715
|
}
|
|
2716
|
+
/**
|
|
2717
|
+
* The city and state for a postcode (D134), for the address form to fill
|
|
2718
|
+
* in. India's six-digit PIN codes only, from the directory the engine was
|
|
2719
|
+
* given; null for anything it cannot answer, so the form simply leaves the
|
|
2720
|
+
* fields to the shopper.
|
|
2721
|
+
*/
|
|
2722
|
+
async lookupPostcode({ country = "IN", postcode }) {
|
|
2723
|
+
const code = String(postcode ?? "").trim();
|
|
2724
|
+
const cc = String(country ?? "").trim().toUpperCase();
|
|
2725
|
+
if (cc !== "IN" || !/^[1-9][0-9]{5}$/.test(code)) return null;
|
|
2726
|
+
try {
|
|
2727
|
+
const p = await this.data(`/api/postcodes/${cc}/${code}`);
|
|
2728
|
+
return { country: p.country, postcode: p.postcode, city: p.city, state: p.state, stateCode: p.state_code };
|
|
2729
|
+
} catch (err) {
|
|
2730
|
+
if (err instanceof GoCommerceError && (err.status === 404 || err.status === 400)) return null;
|
|
2731
|
+
throw err;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2689
2734
|
async deleteAddress(id2) {
|
|
2690
2735
|
await this.engine(`/x/identity/me/addresses/${enc(id2)}`, { method: "DELETE", auth: true });
|
|
2691
2736
|
return { id: String(id2), deleted: true };
|
|
@@ -3704,6 +3749,6 @@ function attemptKey(request) {
|
|
|
3704
3749
|
}
|
|
3705
3750
|
var b2bService = new B2bService();
|
|
3706
3751
|
|
|
3707
|
-
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoCommerceError, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, NotSupportedError, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, forgetAll as clearStoreCache, collectionService, connectorName, contactService, countryService, couponService, currencyExponent, currencyService, dealService, demoRequestService, emptyCart, emptyPage, enquiryService, faqService, feedbackService, fromEngineAddress, fromIdentityAddress, fromSearchDoc, galleryService, hasStaticStore, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, minorToMajor, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, priceOf, productImages, productService, profileService, qs, readStaticStore, reelsService, regionService, reviewService, searchService, serveRestLocally, setRequestHost, setStaticStore, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toAddOn, toCart, toCartLine, toCartOffer, toCategory, toCmsPage, toCollection, toEngineAddress, toFreeShipping, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toStorefrontFacets, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
|
|
3752
|
+
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoCommerceError, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, NotSupportedError, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, forgetAll as clearStoreCache, collectionService, connectorName, contactService, countryService, couponService, currencyExponent, currencyService, dealService, demoRequestService, emptyCart, emptyPage, enquiryService, faqService, feedbackService, fromEngineAddress, fromIdentityAddress, fromSearchDoc, galleryService, hasStaticStore, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, minorToMajor, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, priceOf, productImages, productService, productVideos, profileService, qs, readStaticStore, reelsService, regionService, reviewService, searchService, serveRestLocally, setRequestHost, setStaticStore, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toAddOn, toCart, toCartLine, toCartOffer, toCategory, toCmsPage, toCollection, toEngineAddress, toFreeShipping, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toStorefrontFacets, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
|
|
3708
3753
|
//# sourceMappingURL=index.js.map
|
|
3709
3754
|
//# sourceMappingURL=index.js.map
|