@misiki/gocommerce-connector 0.4.8 → 0.6.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 +1 -0
- package/dist/{index-Bjx8kR8G.d.cts → index-1Tr-Urb_.d.cts} +42 -3
- package/dist/{index-Bjx8kR8G.d.ts → index-1Tr-Urb_.d.ts} +42 -3
- package/dist/index.cjs +44 -3
- 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 +43 -4
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +44 -3
- 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 +43 -4
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,7 @@ down stays best-effort: the storefront renders from its static record.
|
|
|
129
129
|
| reviews | `/x/reviews` |
|
|
130
130
|
| content pages (`/p/…`, legal pages) | `/x/cms/pages` |
|
|
131
131
|
| FAQ | `/x/faq` |
|
|
132
|
+
| composed home page | `/x/layouts/home` (`?preview=` for a draft) — `layoutService.getHomeLayout()`, null when the store has none |
|
|
132
133
|
| menus | `/x/navigation/menus/{header,footer}`, laid over `store.menu`; any menu by handle |
|
|
133
134
|
| product specs table | the product's category attribute answers |
|
|
134
135
|
| attribute filters (`?attributes.color=Red`) | `/api/products?attr=color:Red` |
|
|
@@ -4999,9 +4999,14 @@ declare class AuthService extends UserService {
|
|
|
4999
4999
|
errorCode: string;
|
|
5000
5000
|
message: string;
|
|
5001
5001
|
}>;
|
|
5002
|
-
/**
|
|
5003
|
-
|
|
5002
|
+
/**
|
|
5003
|
+
* Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
|
|
5004
|
+
* host and in the browser read from it, lets the engine end the text "@domain #code" when the
|
|
5005
|
+
* host is the store's own, which Chrome on Android reads to fill the code in (D124).
|
|
5006
|
+
*/
|
|
5007
|
+
getOtp({ phone, domain }: {
|
|
5004
5008
|
phone: string;
|
|
5009
|
+
domain?: string;
|
|
5005
5010
|
}): Promise<{
|
|
5006
5011
|
expiresInMinutes: number;
|
|
5007
5012
|
}>;
|
|
@@ -5614,6 +5619,40 @@ declare class FaqService extends BaseService {
|
|
|
5614
5619
|
declare const pageService: PageService;
|
|
5615
5620
|
declare const faqService: FaqService;
|
|
5616
5621
|
|
|
5622
|
+
/**
|
|
5623
|
+
* One section of a composed page. `settings` is the merchant's, as validated
|
|
5624
|
+
* by the engine: plain text (never HTML) and links that are `/path` or
|
|
5625
|
+
* `http(s)://`. A product grid also carries its products, resolved live and
|
|
5626
|
+
* mapped like any other product the storefront renders.
|
|
5627
|
+
*/
|
|
5628
|
+
type HomeLayoutSection = {
|
|
5629
|
+
id: string;
|
|
5630
|
+
type: string;
|
|
5631
|
+
settings: Record<string, unknown>;
|
|
5632
|
+
products?: StorefrontProduct[];
|
|
5633
|
+
};
|
|
5634
|
+
type HomeLayout = {
|
|
5635
|
+
page: string;
|
|
5636
|
+
theme: string;
|
|
5637
|
+
/** The published revision this is; absent on a preview. */
|
|
5638
|
+
revision?: number;
|
|
5639
|
+
/** True when this is the saved draft shown through a preview key. */
|
|
5640
|
+
preview: boolean;
|
|
5641
|
+
sections: HomeLayoutSection[];
|
|
5642
|
+
};
|
|
5643
|
+
/**
|
|
5644
|
+
* Composed pages from ext/layouts. A store without one — the plugin off,
|
|
5645
|
+
* nothing published, an engine built without the module, or a preview key
|
|
5646
|
+
* that is wrong or expired — answers null, and the storefront renders its
|
|
5647
|
+
* built-in page.
|
|
5648
|
+
*/
|
|
5649
|
+
declare class LayoutService extends BaseService {
|
|
5650
|
+
getHomeLayout({ preview }?: {
|
|
5651
|
+
preview?: string | null;
|
|
5652
|
+
}): Promise<HomeLayout | null>;
|
|
5653
|
+
}
|
|
5654
|
+
declare const layoutService: LayoutService;
|
|
5655
|
+
|
|
5617
5656
|
/** The marketplace's sellers: approved vendors only. */
|
|
5618
5657
|
declare class VendorService extends BaseService {
|
|
5619
5658
|
list({ page, limit, q, search, }?: {
|
|
@@ -6754,4 +6793,4 @@ declare class B2bService extends BaseService {
|
|
|
6754
6793
|
}
|
|
6755
6794
|
declare const b2bService: B2bService;
|
|
6756
6795
|
|
|
6757
|
-
export { type
|
|
6796
|
+
export { type ListMeta 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, type HomeLayout as T, type HomeLayoutSection as U, HomeService as V, type IdentityAddress as W, InitService as X, type Invitation as Y, LayoutService as Z, type Lead as _, AddressService as a, categoryService as a$, MeilisearchService as a0, type Member as a1, type Menu as a2, type MenuItem as a3, MenuService as a4, type MenuSummary as a5, type Money as a6, NewsletterService as a7, type Offer as a8, type Order as a9, StateService as aA, type StoreProfile as aB, StoreService as aC, type StorefrontCategory as aD, type StorefrontMenu as aE, type StorefrontOrder as aF, type StorefrontProduct as aG, UploadService as aH, UserService as aI, type Variant as aJ, type VariantImage as aK, VariantService as aL, VarniCustomDesignService as aM, VarniCustomProductService as aN, type Vendor as aO, VendorService as aP, WarrantyService as aQ, type Wishlist as aR, type WishlistItem as aS, WishlistService as aT, addressService as aU, authService as aV, autocompleteService as aW, b2bService as aX, bannerService as aY, blogService as aZ, cartService as a_, type OrderLine as aa, OrderService as ab, PageService as ac, type PaymentIntent as ad, PaymentMethodService as ae, type Plugin as af, PluginService as ag, PopularSearchService as ah, PopularityService as ai, type Product as aj, type ProductOption as ak, ProductService as al, ProfileService as am, type Quote as an, REDIRECT_GATEWAYS as ao, ReelsService as ap, RegionService as aq, type RejectedLine as ar, type Review as as, type ReviewPage as at, ReviewService as au, type SearchDoc as av, type SearchResult as aw, SearchService as ax, SettingService as ay, type ShippingRate as az, type AppliedDiscount as b, toRating as b$, chatService as b0, checkoutService as b1, collectionService as b2, contactService as b3, countryService as b4, couponService as b5, currencyExponent as b6, currencyService as b7, dealService as b8, demoRequestService as b9, productImages as bA, productService as bB, profileService as bC, qs as bD, reelsService as bE, regionService as bF, reviewService as bG, searchService as bH, setRequestHost as bI, settingService as bJ, settingsService as bK, stateService as bL, staticStore as bM, storeForHost as bN, storeService as bO, toCart as bP, toCartLine as bQ, toCategory as bR, toCmsPage as bS, toCollection as bT, toEngineAddress as bU, toIdentityAddress as bV, toMajor as bW, toMinor as bX, toOrder as bY, toPage as bZ, toProduct as b_, emptyCart as ba, emptyPage as bb, enquiryService as bc, faqService as bd, feedbackService as be, fromEngineAddress as bf, fromIdentityAddress as bg, fromSearchDoc as bh, galleryService as bi, homeService as bj, initService as bk, layoutService as bl, mediaUrl as bm, meilisearchService as bn, menuService as bo, minorToMajor as bp, newsletterService as bq, orderService as br, ownDomain as bs, pageService as bt, paymentMethodService as bu, pluginService as bv, pluginsService as bw, popularSearchService as bx, popularityService as by, priceOf as bz, type Approval as c, toUser as c0, toVariant as c1, toVendor as c2, uploadService as c3, userService as c4, variantService as c5, varniCustomDesignService as c6, varniCustomProductService as c7, vendorService as c8, warrantyService as c9, wishlistService as ca, 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 };
|
|
@@ -4999,9 +4999,14 @@ declare class AuthService extends UserService {
|
|
|
4999
4999
|
errorCode: string;
|
|
5000
5000
|
message: string;
|
|
5001
5001
|
}>;
|
|
5002
|
-
/**
|
|
5003
|
-
|
|
5002
|
+
/**
|
|
5003
|
+
* Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
|
|
5004
|
+
* host and in the browser read from it, lets the engine end the text "@domain #code" when the
|
|
5005
|
+
* host is the store's own, which Chrome on Android reads to fill the code in (D124).
|
|
5006
|
+
*/
|
|
5007
|
+
getOtp({ phone, domain }: {
|
|
5004
5008
|
phone: string;
|
|
5009
|
+
domain?: string;
|
|
5005
5010
|
}): Promise<{
|
|
5006
5011
|
expiresInMinutes: number;
|
|
5007
5012
|
}>;
|
|
@@ -5614,6 +5619,40 @@ declare class FaqService extends BaseService {
|
|
|
5614
5619
|
declare const pageService: PageService;
|
|
5615
5620
|
declare const faqService: FaqService;
|
|
5616
5621
|
|
|
5622
|
+
/**
|
|
5623
|
+
* One section of a composed page. `settings` is the merchant's, as validated
|
|
5624
|
+
* by the engine: plain text (never HTML) and links that are `/path` or
|
|
5625
|
+
* `http(s)://`. A product grid also carries its products, resolved live and
|
|
5626
|
+
* mapped like any other product the storefront renders.
|
|
5627
|
+
*/
|
|
5628
|
+
type HomeLayoutSection = {
|
|
5629
|
+
id: string;
|
|
5630
|
+
type: string;
|
|
5631
|
+
settings: Record<string, unknown>;
|
|
5632
|
+
products?: StorefrontProduct[];
|
|
5633
|
+
};
|
|
5634
|
+
type HomeLayout = {
|
|
5635
|
+
page: string;
|
|
5636
|
+
theme: string;
|
|
5637
|
+
/** The published revision this is; absent on a preview. */
|
|
5638
|
+
revision?: number;
|
|
5639
|
+
/** True when this is the saved draft shown through a preview key. */
|
|
5640
|
+
preview: boolean;
|
|
5641
|
+
sections: HomeLayoutSection[];
|
|
5642
|
+
};
|
|
5643
|
+
/**
|
|
5644
|
+
* Composed pages from ext/layouts. A store without one — the plugin off,
|
|
5645
|
+
* nothing published, an engine built without the module, or a preview key
|
|
5646
|
+
* that is wrong or expired — answers null, and the storefront renders its
|
|
5647
|
+
* built-in page.
|
|
5648
|
+
*/
|
|
5649
|
+
declare class LayoutService extends BaseService {
|
|
5650
|
+
getHomeLayout({ preview }?: {
|
|
5651
|
+
preview?: string | null;
|
|
5652
|
+
}): Promise<HomeLayout | null>;
|
|
5653
|
+
}
|
|
5654
|
+
declare const layoutService: LayoutService;
|
|
5655
|
+
|
|
5617
5656
|
/** The marketplace's sellers: approved vendors only. */
|
|
5618
5657
|
declare class VendorService extends BaseService {
|
|
5619
5658
|
list({ page, limit, q, search, }?: {
|
|
@@ -6754,4 +6793,4 @@ declare class B2bService extends BaseService {
|
|
|
6754
6793
|
}
|
|
6755
6794
|
declare const b2bService: B2bService;
|
|
6756
6795
|
|
|
6757
|
-
export { type
|
|
6796
|
+
export { type ListMeta 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, type HomeLayout as T, type HomeLayoutSection as U, HomeService as V, type IdentityAddress as W, InitService as X, type Invitation as Y, LayoutService as Z, type Lead as _, AddressService as a, categoryService as a$, MeilisearchService as a0, type Member as a1, type Menu as a2, type MenuItem as a3, MenuService as a4, type MenuSummary as a5, type Money as a6, NewsletterService as a7, type Offer as a8, type Order as a9, StateService as aA, type StoreProfile as aB, StoreService as aC, type StorefrontCategory as aD, type StorefrontMenu as aE, type StorefrontOrder as aF, type StorefrontProduct as aG, UploadService as aH, UserService as aI, type Variant as aJ, type VariantImage as aK, VariantService as aL, VarniCustomDesignService as aM, VarniCustomProductService as aN, type Vendor as aO, VendorService as aP, WarrantyService as aQ, type Wishlist as aR, type WishlistItem as aS, WishlistService as aT, addressService as aU, authService as aV, autocompleteService as aW, b2bService as aX, bannerService as aY, blogService as aZ, cartService as a_, type OrderLine as aa, OrderService as ab, PageService as ac, type PaymentIntent as ad, PaymentMethodService as ae, type Plugin as af, PluginService as ag, PopularSearchService as ah, PopularityService as ai, type Product as aj, type ProductOption as ak, ProductService as al, ProfileService as am, type Quote as an, REDIRECT_GATEWAYS as ao, ReelsService as ap, RegionService as aq, type RejectedLine as ar, type Review as as, type ReviewPage as at, ReviewService as au, type SearchDoc as av, type SearchResult as aw, SearchService as ax, SettingService as ay, type ShippingRate as az, type AppliedDiscount as b, toRating as b$, chatService as b0, checkoutService as b1, collectionService as b2, contactService as b3, countryService as b4, couponService as b5, currencyExponent as b6, currencyService as b7, dealService as b8, demoRequestService as b9, productImages as bA, productService as bB, profileService as bC, qs as bD, reelsService as bE, regionService as bF, reviewService as bG, searchService as bH, setRequestHost as bI, settingService as bJ, settingsService as bK, stateService as bL, staticStore as bM, storeForHost as bN, storeService as bO, toCart as bP, toCartLine as bQ, toCategory as bR, toCmsPage as bS, toCollection as bT, toEngineAddress as bU, toIdentityAddress as bV, toMajor as bW, toMinor as bX, toOrder as bY, toPage as bZ, toProduct as b_, emptyCart as ba, emptyPage as bb, enquiryService as bc, faqService as bd, feedbackService as be, fromEngineAddress as bf, fromIdentityAddress as bg, fromSearchDoc as bh, galleryService as bi, homeService as bj, initService as bk, layoutService as bl, mediaUrl as bm, meilisearchService as bn, menuService as bo, minorToMajor as bp, newsletterService as bq, orderService as br, ownDomain as bs, pageService as bt, paymentMethodService as bu, pluginService as bv, pluginsService as bw, popularSearchService as bx, popularityService as by, priceOf as bz, type Approval as c, toUser as c0, toVariant as c1, toVendor as c2, uploadService as c3, userService as c4, variantService as c5, varniCustomDesignService as c6, varniCustomProductService as c7, vendorService as c8, warrantyService as c9, wishlistService as ca, 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 };
|
package/dist/index.cjs
CHANGED
|
@@ -2266,11 +2266,16 @@ var AuthService = class extends UserService {
|
|
|
2266
2266
|
return { errorCode: err.code ?? "invalid_token", message: err.message };
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
/**
|
|
2270
|
-
|
|
2269
|
+
/**
|
|
2270
|
+
* Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
|
|
2271
|
+
* host and in the browser read from it, lets the engine end the text "@domain #code" when the
|
|
2272
|
+
* host is the store's own, which Chrome on Android reads to fill the code in (D124).
|
|
2273
|
+
*/
|
|
2274
|
+
async getOtp({ phone, domain }) {
|
|
2275
|
+
const site = domain ?? (typeof window !== "undefined" ? window.location?.hostname : void 0);
|
|
2271
2276
|
const res = await this.account("/x/identity/otp", {
|
|
2272
2277
|
method: "POST",
|
|
2273
|
-
body: { phone: String(phone ?? "").trim() }
|
|
2278
|
+
body: { phone: String(phone ?? "").trim(), ...site ? { domain: site } : {} }
|
|
2274
2279
|
});
|
|
2275
2280
|
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2276
2281
|
}
|
|
@@ -2727,6 +2732,40 @@ var FaqService = class extends BaseService {
|
|
|
2727
2732
|
var pageService = new PageService();
|
|
2728
2733
|
var faqService = new FaqService();
|
|
2729
2734
|
|
|
2735
|
+
// src/services/layout-service.ts
|
|
2736
|
+
var IMAGE_KEYS = ["image", "mobile_image"];
|
|
2737
|
+
var LayoutService = class extends BaseService {
|
|
2738
|
+
async getHomeLayout({ preview } = {}) {
|
|
2739
|
+
let layout;
|
|
2740
|
+
try {
|
|
2741
|
+
layout = await this.data("/x/layouts/home", {
|
|
2742
|
+
query: { preview: preview?.trim() || void 0 }
|
|
2743
|
+
});
|
|
2744
|
+
} catch (err) {
|
|
2745
|
+
if (err instanceof GoCommerceError && err.status === 404) return null;
|
|
2746
|
+
throw err;
|
|
2747
|
+
}
|
|
2748
|
+
if (!layout) return null;
|
|
2749
|
+
return {
|
|
2750
|
+
page: layout.page,
|
|
2751
|
+
theme: layout.theme,
|
|
2752
|
+
revision: layout.revision,
|
|
2753
|
+
preview: !!layout.preview,
|
|
2754
|
+
sections: (layout.sections ?? []).map(toSection)
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
function toSection(s) {
|
|
2759
|
+
const settings = { ...s.settings ?? {} };
|
|
2760
|
+
for (const key of IMAGE_KEYS) {
|
|
2761
|
+
if (typeof settings[key] === "string") settings[key] = mediaUrl(settings[key]);
|
|
2762
|
+
}
|
|
2763
|
+
const out = { id: s.id, type: s.type, settings };
|
|
2764
|
+
if (s.type === "product-grid") out.products = (s.products ?? []).map((p) => toProduct(p));
|
|
2765
|
+
return out;
|
|
2766
|
+
}
|
|
2767
|
+
var layoutService = new LayoutService();
|
|
2768
|
+
|
|
2730
2769
|
// src/services/vendor-service.ts
|
|
2731
2770
|
var VendorService = class extends BaseService {
|
|
2732
2771
|
async list({
|
|
@@ -3286,6 +3325,7 @@ exports.GalleryService = GalleryService;
|
|
|
3286
3325
|
exports.GoCommerceError = GoCommerceError;
|
|
3287
3326
|
exports.HomeService = HomeService;
|
|
3288
3327
|
exports.InitService = InitService;
|
|
3328
|
+
exports.LayoutService = LayoutService;
|
|
3289
3329
|
exports.MeilisearchService = MeilisearchService;
|
|
3290
3330
|
exports.MenuService = MenuService;
|
|
3291
3331
|
exports.NewsletterService = NewsletterService;
|
|
@@ -3348,6 +3388,7 @@ exports.galleryService = galleryService;
|
|
|
3348
3388
|
exports.hasStaticStore = hasStaticStore;
|
|
3349
3389
|
exports.homeService = homeService;
|
|
3350
3390
|
exports.initService = initService;
|
|
3391
|
+
exports.layoutService = layoutService;
|
|
3351
3392
|
exports.mediaUrl = mediaUrl;
|
|
3352
3393
|
exports.meilisearchService = meilisearchService;
|
|
3353
3394
|
exports.menuService = menuService;
|