@misiki/gocommerce-connector 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeService, V as InitService, W as Invitation, X as Lead, Z as MeilisearchService, _ as Member, a1 as MenuService, a4 as NewsletterService, a8 as OrderService, a9 as PageService, ab as PaymentMethodService, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ar as ReviewService, au as SearchService, av as SettingService, av as SettingsService, ax as StateService, ay as StoreService, aA as StorefrontMenu, aD as UploadService, aE as UserService, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aL as VendorService, aM as WarrantyService, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, be as galleryService, bf as homeService, bg as initService, bh as meilisearchService, bi as menuService, bk as newsletterService, bl as orderService, bm as pageService, bn as paymentMethodService, bo as pluginService, bp as pluginsService, bq as popularSearchService, br as popularityService, bu as productService, bv as profileService, bw as qs, bx as reelsService, by as regionService, bz as reviewService, bA as searchService, bB as settingService, bC as settingsService, bD as stateService, bE as staticStore, bF as storeService, bQ as toPage, bW as uploadService, bX as userService, bY as variantService, bZ as varniCustomDesignService, b_ as varniCustomProductService, b$ as vendorService, c0 as warrantyService, c1 as wishlistService } from '../index-BfbB3jQb.cjs';
1
+ export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeService, V as InitService, W as Invitation, X as Lead, Z as MeilisearchService, _ as Member, a1 as MenuService, a4 as NewsletterService, a8 as OrderService, a9 as PageService, ab as PaymentMethodService, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ar as ReviewService, au as SearchService, av as SettingService, av as SettingsService, ax as StateService, ay as StoreService, aA as StorefrontMenu, aD as UploadService, aE as UserService, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aL as VendorService, aM as WarrantyService, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, be as galleryService, bf as homeService, bg as initService, bh as mediaUrl, bi as meilisearchService, bj as menuService, bl as newsletterService, bm as orderService, bn as pageService, bo as paymentMethodService, bp as pluginService, bq as pluginsService, br as popularSearchService, bs as popularityService, bv as productService, bw as profileService, bx as qs, by as reelsService, bz as regionService, bA as reviewService, bB as searchService, bC as settingService, bD as settingsService, bE as stateService, bF as staticStore, bG as storeService, bR as toPage, bX as uploadService, bY as userService, bZ as variantService, b_ as varniCustomDesignService, b$ as varniCustomProductService, c0 as vendorService, c1 as warrantyService, c2 as wishlistService } from '../index-D8lNRhqJ.cjs';
@@ -1 +1 @@
1
- export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeService, V as InitService, W as Invitation, X as Lead, Z as MeilisearchService, _ as Member, a1 as MenuService, a4 as NewsletterService, a8 as OrderService, a9 as PageService, ab as PaymentMethodService, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ar as ReviewService, au as SearchService, av as SettingService, av as SettingsService, ax as StateService, ay as StoreService, aA as StorefrontMenu, aD as UploadService, aE as UserService, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aL as VendorService, aM as WarrantyService, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, be as galleryService, bf as homeService, bg as initService, bh as meilisearchService, bi as menuService, bk as newsletterService, bl as orderService, bm as pageService, bn as paymentMethodService, bo as pluginService, bp as pluginsService, bq as popularSearchService, br as popularityService, bu as productService, bv as profileService, bw as qs, bx as reelsService, by as regionService, bz as reviewService, bA as searchService, bB as settingService, bC as settingsService, bD as stateService, bE as staticStore, bF as storeService, bQ as toPage, bW as uploadService, bX as userService, bY as variantService, bZ as varniCustomDesignService, b_ as varniCustomProductService, b$ as vendorService, c0 as warrantyService, c1 as wishlistService } from '../index-BfbB3jQb.js';
1
+ export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeService, V as InitService, W as Invitation, X as Lead, Z as MeilisearchService, _ as Member, a1 as MenuService, a4 as NewsletterService, a8 as OrderService, a9 as PageService, ab as PaymentMethodService, ad as PluginService, ad as PluginsService, ae as PopularSearchService, af as PopularityService, ai as ProductService, aj as ProfileService, ak as Quote, al as REDIRECT_GATEWAYS, am as ReelsService, an as RegionService, ao as RejectedLine, ar as ReviewService, au as SearchService, av as SettingService, av as SettingsService, ax as StateService, ay as StoreService, aA as StorefrontMenu, aD as UploadService, aE as UserService, aH as VariantService, aI as VarniCustomDesignService, aJ as VarniCustomProductService, aL as VendorService, aM as WarrantyService, aP as WishlistService, aQ as addressService, aR as authService, aS as autocompleteService, aT as b2bService, aU as bannerService, aV as blogService, aW as cartService, aX as categoryService, aY as chatService, aZ as checkoutService, a_ as collectionService, a$ as contactService, b0 as countryService, b1 as couponService, b3 as currencyService, b4 as dealService, b5 as demoRequestService, b7 as emptyPage, b8 as enquiryService, b9 as faqService, ba as feedbackService, be as galleryService, bf as homeService, bg as initService, bh as mediaUrl, bi as meilisearchService, bj as menuService, bl as newsletterService, bm as orderService, bn as pageService, bo as paymentMethodService, bp as pluginService, bq as pluginsService, br as popularSearchService, bs as popularityService, bv as productService, bw as profileService, bx as qs, by as reelsService, bz as regionService, bA as reviewService, bB as searchService, bC as settingService, bD as settingsService, bE as stateService, bF as staticStore, bG as storeService, bR as toPage, bX as uploadService, bY as userService, bZ as variantService, b_ as varniCustomDesignService, b$ as varniCustomProductService, c0 as vendorService, c1 as warrantyService, c2 as wishlistService } from '../index-D8lNRhqJ.js';
@@ -189,6 +189,12 @@ var rememberWishlistToken = (token) => writeLocal(WISHLIST, token);
189
189
  var forgetWishlistToken = () => removeLocal(WISHLIST);
190
190
 
191
191
  // src/services/base.service.ts
192
+ function mediaUrl(url) {
193
+ if (!url) return null;
194
+ if (!url.startsWith("/") || url.startsWith("//")) return url;
195
+ const { apiUrl, proxyPath } = BaseService.getCredentials();
196
+ return (proxyPath || apiUrl || "").trim().replace(/\/+$/, "") + url;
197
+ }
192
198
  var BaseService = class _BaseService {
193
199
  static _credentials = { apiUrl: "" };
194
200
  _fetch;
@@ -412,7 +418,8 @@ var liveVariants = (p) => arr(p.variants).filter((v) => v.active);
412
418
  function variantImages(v) {
413
419
  const out = [];
414
420
  for (const img of [v.image, ...arr(v.images)]) {
415
- if (img?.url && (img.kind ?? "image") === "image" && !out.includes(img.url)) out.push(img.url);
421
+ const url = mediaUrl(img?.url);
422
+ if (url && (img?.kind ?? "image") === "image" && !out.includes(url)) out.push(url);
416
423
  }
417
424
  return out;
418
425
  }
@@ -421,7 +428,7 @@ function productImages(p) {
421
428
  const push = (url) => {
422
429
  if (url && !out.includes(url)) out.push(url);
423
430
  };
424
- push(p.image_url);
431
+ push(mediaUrl(p.image_url));
425
432
  for (const v of arr(p.variants)) for (const url of variantImages(v)) push(url);
426
433
  return out;
427
434
  }
@@ -551,9 +558,9 @@ function fromSearchDoc(d) {
551
558
  mrp: price,
552
559
  minPrice: price,
553
560
  maxPrice: minorToMajor(d.price_max_minor, d.currency),
554
- thumbnail: d.image ?? null,
555
- image_url: d.image ?? null,
556
- images: d.image ?? "",
561
+ thumbnail: mediaUrl(d.image),
562
+ image_url: mediaUrl(d.image),
563
+ images: mediaUrl(d.image) ?? "",
557
564
  stock: d.in_stock ? 1 : 0,
558
565
  hasStock: d.in_stock,
559
566
  // The index cannot say how much is left, only whether any is; a card
@@ -582,7 +589,7 @@ function toCategory(c) {
582
589
  level: c.depth,
583
590
  rank: c.position,
584
591
  childCount: c.child_count,
585
- thumbnail: c.metadata?.image ?? null,
592
+ thumbnail: mediaUrl(c.metadata?.image),
586
593
  description: c.metadata?.description ?? null,
587
594
  isActive: true,
588
595
  isFeatured: false,
@@ -602,7 +609,7 @@ function toCollection(c) {
602
609
  description: c.description || null,
603
610
  subTitle: null,
604
611
  rank: str(c.position),
605
- thumbnail: c.metadata?.image ?? null,
612
+ thumbnail: mediaUrl(c.metadata?.image),
606
613
  isActive: true,
607
614
  metaTitle: c.title,
608
615
  metaDescription: c.description || null,
@@ -685,7 +692,7 @@ function toCartLine(l, extra = {}) {
685
692
  title: l.title,
686
693
  name: l.title,
687
694
  slug: extra.slug ?? "",
688
- thumbnail: extra.thumbnail ?? null,
695
+ thumbnail: mediaUrl(extra.thumbnail),
689
696
  variantTitle: l.variant_label ?? "",
690
697
  qty: l.quantity,
691
698
  price: toMajor(l.unit_price),
@@ -793,8 +800,8 @@ function toOrderLine(l, currency) {
793
800
  title: l.title,
794
801
  name: l.title,
795
802
  slug: "",
796
- thumbnail: l.image_url ?? null,
797
- img: l.image_url ?? null,
803
+ thumbnail: mediaUrl(l.image_url),
804
+ img: mediaUrl(l.image_url),
798
805
  variantTitle: l.variant_label ?? "",
799
806
  qty: l.quantity,
800
807
  shippedQty: l.shipped_quantity,
@@ -1952,7 +1959,7 @@ var OrderService = class extends BaseService {
1952
1959
  productId: l.product_id,
1953
1960
  variantId: l.variant_id,
1954
1961
  title: l.title,
1955
- img: l.image_url ?? null,
1962
+ img: mediaUrl(l.image_url),
1956
1963
  price: toMajor(l.unit_price),
1957
1964
  qty: l.quantity
1958
1965
  });
@@ -3053,6 +3060,6 @@ function attemptKey(request) {
3053
3060
  }
3054
3061
  var b2bService = new B2bService();
3055
3062
 
3056
- export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, HomeService, InitService, MeilisearchService, MenuService, NewsletterService, 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, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, homeService, initService, meilisearchService, menuService, newsletterService, orderService, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, settingService, settingsService, stateService, staticStore, storeService, toPage, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3063
+ export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, HomeService, InitService, MeilisearchService, MenuService, NewsletterService, 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, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, homeService, initService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, settingService, settingsService, stateService, staticStore, storeService, toPage, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3057
3064
  //# sourceMappingURL=index.js.map
3058
3065
  //# sourceMappingURL=index.js.map