@misiki/gocommerce-connector 0.4.9 → 0.7.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeService, U as IdentityAddress, V as InitService, W as Invitation, X as Lead, Y as ListMeta, Z as MeilisearchService, _ as Member, $ as Menu, a0 as MenuItem, a1 as MenuService, a2 as MenuSummary, a3 as Money, a4 as NewsletterService, a5 as Offer, a6 as Order, a7 as OrderLine, a8 as OrderService, a9 as PageService, aa as PaymentIntent, ab as PaymentMethodService, ac as Plugin, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ag as Product, ah as ProductOption, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ap as Review, aq as ReviewPage, ar as ReviewService, as as SearchDoc, at as SearchResult, au as SearchService, av as SettingService, av as SettingsService, aw as ShippingRate, ax as StateService, ay as StoreProfile, az as StoreService, aA as StorefrontCategory, aB as StorefrontMenu, aC as StorefrontOrder, aD as StorefrontProduct, aE as UploadService, aF as UserService, aG as Variant, aH as VariantImage, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aL as Vendor, aM as VendorService, aN as WarrantyService, aO as Wishlist, aP as WishlistItem, aQ as WishlistService, aR as addressService, aS as authService, aT as autocompleteService, aU as b2bService, aV as bannerService, aW as blogService, aX as cartService, aY as categoryService, aZ as chatService, a_ as checkoutService, a$ as collectionService, b0 as contactService, b1 as countryService, b2 as couponService, b3 as currencyExponent, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b7 as emptyCart, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bc as fromEngineAddress, bd as fromIdentityAddress, be as fromSearchDoc, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, bl as minorToMajor, bm as newsletterService, bn as orderService, bo as ownDomain, bp as pageService, bq as paymentMethodService, br as pluginService, bs as pluginsService, bt as popularSearchService, bu as popularityService, bv as priceOf, bw as productImages, bx as productService, by as profileService, bz as qs, bA as reelsService, bB as regionService, bC as reviewService, bD as searchService, bE as setRequestHost, bF as settingService, bG as settingsService, bH as stateService, bI as staticStore, bJ as storeForHost, bK as storeService, bL as toCart, bM as toCartLine, bN as toCategory, bO as toCmsPage, bP as toCollection, bQ as toEngineAddress, bR as toIdentityAddress, bS as toMajor, bT as toMinor, bU as toOrder, bV as toPage, bW as toProduct, bX as toRating, bY as toUser, bZ as toVariant, b_ as toVendor, b$ as uploadService, c0 as userService, c1 as variantService, c2 as varniCustomDesignService, c3 as varniCustomProductService, c4 as vendorService, c5 as warrantyService, c6 as wishlistService } from './index-oCv5Dabq.cjs';
1
+ export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, $ as ListMeta, a0 as MeilisearchService, a1 as Member, a2 as Menu, a3 as MenuItem, a4 as MenuService, a5 as MenuSummary, a6 as Money, a7 as NewsletterService, a8 as Offer, a9 as Order, aa as OrderLine, ab as OrderService, ac as PageService, ad as PaymentIntent, ae as PaymentMethodService, af as Plugin, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, aj as Product, ak as ProductOption, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, as as Review, at as ReviewPage, au as ReviewService, av as SearchDoc, aw as SearchResult, ax as SearchService, ay as SettingService, ay as SettingsService, az as ShippingRate, aA as StateService, aB as StoreProfile, aC as StoreService, aD as StorefrontCategory, aE as StorefrontMenu, aF as StorefrontOrder, aG as StorefrontProduct, aH as UploadService, aI as UserService, aJ as Variant, aK as VariantImage, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aO as Vendor, aP as VendorService, aQ as WarrantyService, aR as Wishlist, aS as WishlistItem, aT as WishlistService, aU as addressService, aV as authService, aW as autocompleteService, aX as b2bService, aY as bannerService, aZ as blogService, a_ as cartService, a$ as categoryService, b0 as chatService, b1 as checkoutService, b2 as collectionService, b3 as contactService, b4 as countryService, b5 as couponService, b6 as currencyExponent, b7 as currencyService, b8 as dealService, b9 as demoRequestService, ba as emptyCart, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bf as fromEngineAddress, bg as fromIdentityAddress, bh as fromSearchDoc, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, bp as minorToMajor, bq as newsletterService, br as orderService, bs as ownDomain, bt as pageService, bu as paymentMethodService, bv as pluginService, bw as pluginsService, bx as popularSearchService, by as popularityService, bz as priceOf, bA as productImages, bB as productService, bC as profileService, bD as qs, bE as reelsService, bF as regionService, bG as reviewService, bH as searchService, bI as setRequestHost, bJ as settingService, bK as settingsService, bL as stateService, bM as staticStore, bN as storeForHost, bO as storeService, bP as toCart, bQ as toCartLine, bR as toCategory, bS as toCmsPage, bT as toCollection, bU as toEngineAddress, bV as toIdentityAddress, bW as toMajor, bX as toMinor, bY as toOrder, bZ as toPage, b_ as toProduct, b$ as toRating, c0 as toUser, c1 as toVariant, c2 as toVendor, c3 as uploadService, c4 as userService, c5 as variantService, c6 as varniCustomDesignService, c7 as varniCustomProductService, c8 as vendorService, c9 as warrantyService, ca as wishlistService } from './index-D-hnd6-D.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 Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeService, U as IdentityAddress, V as InitService, W as Invitation, X as Lead, Y as ListMeta, Z as MeilisearchService, _ as Member, $ as Menu, a0 as MenuItem, a1 as MenuService, a2 as MenuSummary, a3 as Money, a4 as NewsletterService, a5 as Offer, a6 as Order, a7 as OrderLine, a8 as OrderService, a9 as PageService, aa as PaymentIntent, ab as PaymentMethodService, ac as Plugin, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ag as Product, ah as ProductOption, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ap as Review, aq as ReviewPage, ar as ReviewService, as as SearchDoc, at as SearchResult, au as SearchService, av as SettingService, av as SettingsService, aw as ShippingRate, ax as StateService, ay as StoreProfile, az as StoreService, aA as StorefrontCategory, aB as StorefrontMenu, aC as StorefrontOrder, aD as StorefrontProduct, aE as UploadService, aF as UserService, aG as Variant, aH as VariantImage, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aL as Vendor, aM as VendorService, aN as WarrantyService, aO as Wishlist, aP as WishlistItem, aQ as WishlistService, aR as addressService, aS as authService, aT as autocompleteService, aU as b2bService, aV as bannerService, aW as blogService, aX as cartService, aY as categoryService, aZ as chatService, a_ as checkoutService, a$ as collectionService, b0 as contactService, b1 as countryService, b2 as couponService, b3 as currencyExponent, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b7 as emptyCart, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bc as fromEngineAddress, bd as fromIdentityAddress, be as fromSearchDoc, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, bl as minorToMajor, bm as newsletterService, bn as orderService, bo as ownDomain, bp as pageService, bq as paymentMethodService, br as pluginService, bs as pluginsService, bt as popularSearchService, bu as popularityService, bv as priceOf, bw as productImages, bx as productService, by as profileService, bz as qs, bA as reelsService, bB as regionService, bC as reviewService, bD as searchService, bE as setRequestHost, bF as settingService, bG as settingsService, bH as stateService, bI as staticStore, bJ as storeForHost, bK as storeService, bL as toCart, bM as toCartLine, bN as toCategory, bO as toCmsPage, bP as toCollection, bQ as toEngineAddress, bR as toIdentityAddress, bS as toMajor, bT as toMinor, bU as toOrder, bV as toPage, bW as toProduct, bX as toRating, bY as toUser, bZ as toVariant, b_ as toVendor, b$ as uploadService, c0 as userService, c1 as variantService, c2 as varniCustomDesignService, c3 as varniCustomProductService, c4 as vendorService, c5 as warrantyService, c6 as wishlistService } from './index-oCv5Dabq.js';
1
+ export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, $ as ListMeta, a0 as MeilisearchService, a1 as Member, a2 as Menu, a3 as MenuItem, a4 as MenuService, a5 as MenuSummary, a6 as Money, a7 as NewsletterService, a8 as Offer, a9 as Order, aa as OrderLine, ab as OrderService, ac as PageService, ad as PaymentIntent, ae as PaymentMethodService, af as Plugin, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, aj as Product, ak as ProductOption, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, as as Review, at as ReviewPage, au as ReviewService, av as SearchDoc, aw as SearchResult, ax as SearchService, ay as SettingService, ay as SettingsService, az as ShippingRate, aA as StateService, aB as StoreProfile, aC as StoreService, aD as StorefrontCategory, aE as StorefrontMenu, aF as StorefrontOrder, aG as StorefrontProduct, aH as UploadService, aI as UserService, aJ as Variant, aK as VariantImage, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aO as Vendor, aP as VendorService, aQ as WarrantyService, aR as Wishlist, aS as WishlistItem, aT as WishlistService, aU as addressService, aV as authService, aW as autocompleteService, aX as b2bService, aY as bannerService, aZ as blogService, a_ as cartService, a$ as categoryService, b0 as chatService, b1 as checkoutService, b2 as collectionService, b3 as contactService, b4 as countryService, b5 as couponService, b6 as currencyExponent, b7 as currencyService, b8 as dealService, b9 as demoRequestService, ba as emptyCart, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bf as fromEngineAddress, bg as fromIdentityAddress, bh as fromSearchDoc, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, bp as minorToMajor, bq as newsletterService, br as orderService, bs as ownDomain, bt as pageService, bu as paymentMethodService, bv as pluginService, bw as pluginsService, bx as popularSearchService, by as popularityService, bz as priceOf, bA as productImages, bB as productService, bC as profileService, bD as qs, bE as reelsService, bF as regionService, bG as reviewService, bH as searchService, bI as setRequestHost, bJ as settingService, bK as settingsService, bL as stateService, bM as staticStore, bN as storeForHost, bO as storeService, bP as toCart, bQ as toCartLine, bR as toCategory, bS as toCmsPage, bT as toCollection, bU as toEngineAddress, bV as toIdentityAddress, bW as toMajor, bX as toMinor, bY as toOrder, bZ as toPage, b_ as toProduct, b$ as toRating, c0 as toUser, c1 as toVariant, c2 as toVendor, c3 as uploadService, c4 as userService, c5 as variantService, c6 as varniCustomDesignService, c7 as varniCustomProductService, c8 as vendorService, c9 as warrantyService, ca as wishlistService } from './index-D-hnd6-D.js';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.js CHANGED
@@ -2051,6 +2051,31 @@ var OrderService = class extends BaseService {
2051
2051
  async listPublic(_args = {}) {
2052
2052
  return emptyPage();
2053
2053
  }
2054
+ /**
2055
+ * Opens an order with its number and the email or phone on it, no code. The
2056
+ * engine answers one 404 for an unknown number and a wrong contact. The
2057
+ * token it answers is kept like an order placed in this browser, so the
2058
+ * order page and `getOrder` read it again.
2059
+ */
2060
+ async openOrder({ orderNo, contact }) {
2061
+ const res = await this.data(
2062
+ `/api/orders/${encodeURIComponent(orderNo.trim())}/open`,
2063
+ { method: "POST", body: { contact: contact.trim() } }
2064
+ );
2065
+ rememberOrder({ number: res.order.number, token: res.access_token, cartId: "" });
2066
+ return { data: [toOrder(res.order)] };
2067
+ }
2068
+ /**
2069
+ * Opens an order from the link in its emails, which carries the order's key
2070
+ * (`/order-tracking?order=…&key=…`). The key is kept like an order placed in
2071
+ * this browser, so the page can drop it from the address bar.
2072
+ */
2073
+ async openOrderWithKey({ orderNo, key }) {
2074
+ const number = orderNo.trim();
2075
+ const order = await this.data(`/api/orders/${encodeURIComponent(number)}`, { query: { token: key.trim() } });
2076
+ rememberOrder({ number: order.number, token: key.trim(), cartId: "" });
2077
+ return { data: [toOrder(order)] };
2078
+ }
2054
2079
  /**
2055
2080
  * Sends a 4-digit code to the email or phone on the order, when `contact`
2056
2081
  * is that email or phone. The engine answers the same either way, so this
@@ -2730,6 +2755,40 @@ var FaqService = class extends BaseService {
2730
2755
  var pageService = new PageService();
2731
2756
  var faqService = new FaqService();
2732
2757
 
2758
+ // src/services/layout-service.ts
2759
+ var IMAGE_KEYS = ["image", "mobile_image"];
2760
+ var LayoutService = class extends BaseService {
2761
+ async getHomeLayout({ preview } = {}) {
2762
+ let layout;
2763
+ try {
2764
+ layout = await this.data("/x/layouts/home", {
2765
+ query: { preview: preview?.trim() || void 0 }
2766
+ });
2767
+ } catch (err) {
2768
+ if (err instanceof GoCommerceError && err.status === 404) return null;
2769
+ throw err;
2770
+ }
2771
+ if (!layout) return null;
2772
+ return {
2773
+ page: layout.page,
2774
+ theme: layout.theme,
2775
+ revision: layout.revision,
2776
+ preview: !!layout.preview,
2777
+ sections: (layout.sections ?? []).map(toSection)
2778
+ };
2779
+ }
2780
+ };
2781
+ function toSection(s) {
2782
+ const settings = { ...s.settings ?? {} };
2783
+ for (const key of IMAGE_KEYS) {
2784
+ if (typeof settings[key] === "string") settings[key] = mediaUrl(settings[key]);
2785
+ }
2786
+ const out = { id: s.id, type: s.type, settings };
2787
+ if (s.type === "product-grid") out.products = (s.products ?? []).map((p) => toProduct(p));
2788
+ return out;
2789
+ }
2790
+ var layoutService = new LayoutService();
2791
+
2733
2792
  // src/services/vendor-service.ts
2734
2793
  var VendorService = class extends BaseService {
2735
2794
  async list({
@@ -3263,6 +3322,6 @@ function attemptKey(request) {
3263
3322
  }
3264
3323
  var b2bService = new B2bService();
3265
3324
 
3266
- 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, 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, 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, toCart, toCartLine, toCategory, toCmsPage, toCollection, toEngineAddress, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3325
+ 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, toCart, toCartLine, toCategory, toCmsPage, toCollection, toEngineAddress, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3267
3326
  //# sourceMappingURL=index.js.map
3268
3327
  //# sourceMappingURL=index.js.map