@misiki/gocommerce-connector 0.4.0 → 0.4.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.
- package/README.md +4 -2
- package/dist/{index-iPG0fxzc.d.cts → index-DIj1rK1d.d.cts} +19 -6
- package/dist/{index-iPG0fxzc.d.ts → index-DIj1rK1d.d.ts} +19 -6
- package/dist/index.cjs +11 -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 +11 -2
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +11 -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 +11 -2
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,8 +98,10 @@ import { setRequestHost } from '@misiki/gocommerce-connector'
|
|
|
98
98
|
setRequestHost(() => getRequestEvent().url.hostname)
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
Each store renders with the name, email and phone its owner set in the panel
|
|
102
|
+
(`GET /api/store`); the static record's values stand only where the owner left
|
|
103
|
+
one empty. Store-level facts (name, plugins, currency, menus) are cached per
|
|
104
|
+
store, so two stores on one process never see each other's. A host under the base domain that names
|
|
103
105
|
a store the engine does not have makes `getStoreByIdOrDomain` throw a
|
|
104
106
|
`GoCommerceError` with status 404 and "store not found" in its message, which
|
|
105
107
|
Svelte Commerce renders as its own "Store not found" page. An engine that is
|
|
@@ -346,6 +346,13 @@ type Plugin = {
|
|
|
346
346
|
title: string;
|
|
347
347
|
settings: Record<string, unknown>;
|
|
348
348
|
};
|
|
349
|
+
/** `GET /api/store`: what anyone may read about the shop. */
|
|
350
|
+
type StoreProfile = {
|
|
351
|
+
name: string;
|
|
352
|
+
email: string;
|
|
353
|
+
phone: string;
|
|
354
|
+
support_url: string;
|
|
355
|
+
};
|
|
349
356
|
type Vendor = {
|
|
350
357
|
id: number;
|
|
351
358
|
slug: string;
|
|
@@ -1264,6 +1271,8 @@ declare class StoreFacts extends BaseService {
|
|
|
1264
1271
|
language: string;
|
|
1265
1272
|
version: string;
|
|
1266
1273
|
}>;
|
|
1274
|
+
/** The store's own name and how a buyer reaches it, as set in its panel. */
|
|
1275
|
+
profile(): Promise<StoreProfile>;
|
|
1267
1276
|
checkoutOptions(): Promise<CheckoutOptions>;
|
|
1268
1277
|
/**
|
|
1269
1278
|
* The whole tree, flat and depth-first. Past 500 categories the engine
|
|
@@ -5232,12 +5241,16 @@ declare const menuService: MenuService;
|
|
|
5232
5241
|
/**
|
|
5233
5242
|
* The store record every page renders from.
|
|
5234
5243
|
*
|
|
5235
|
-
*
|
|
5244
|
+
* Logo, theme and the rest are the storefront's own (its static store,
|
|
5236
5245
|
* registered through `setStaticStore`); the engine has no opinion on them.
|
|
5237
|
-
* Where the engine does have one, it wins:
|
|
5238
|
-
*
|
|
5239
|
-
*
|
|
5240
|
-
*
|
|
5246
|
+
* Where the engine does have one, it wins:
|
|
5247
|
+
* - the store's name and contact, as its owner set them in the panel. One
|
|
5248
|
+
* storefront serves every store under `baseDomain`, so a name in the static
|
|
5249
|
+
* record would be every store's name;
|
|
5250
|
+
* - the settlement currency. Every price on the site is formatted with it, and
|
|
5251
|
+
* a store record saying USD over an engine charging INR would print the
|
|
5252
|
+
* wrong symbol on every price;
|
|
5253
|
+
* - the modules that back a storefront feature, and the menus.
|
|
5241
5254
|
*
|
|
5242
5255
|
* This runs on every request and a throw here takes every page down, so the
|
|
5243
5256
|
* engine's half is best-effort: unreachable, the storefront still renders
|
|
@@ -6489,4 +6502,4 @@ declare class B2bService extends BaseService {
|
|
|
6489
6502
|
}
|
|
6490
6503
|
declare const b2bService: B2bService;
|
|
6491
6504
|
|
|
6492
|
-
export { type Menu 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, HomeService as T, type IdentityAddress as U, InitService as V, type Invitation as W, type Lead as X, type ListMeta as Y, MeilisearchService as Z, type Member as _, AddressService as a,
|
|
6505
|
+
export { type Menu 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, HomeService as T, type IdentityAddress as U, InitService as V, type Invitation as W, type Lead as X, type ListMeta as Y, MeilisearchService as Z, type Member as _, AddressService as a, collectionService as a$, type MenuItem as a0, MenuService as a1, type MenuSummary as a2, type Money as a3, NewsletterService as a4, type Offer as a5, type Order as a6, type OrderLine as a7, OrderService as a8, PageService as a9, type StorefrontCategory as aA, type StorefrontMenu as aB, type StorefrontOrder as aC, type StorefrontProduct as aD, UploadService as aE, UserService as aF, type Variant as aG, type VariantImage as aH, VariantService as aI, VarniCustomDesignService as aJ, VarniCustomProductService as aK, type Vendor as aL, VendorService as aM, WarrantyService as aN, type Wishlist as aO, type WishlistItem as aP, WishlistService as aQ, addressService as aR, authService as aS, autocompleteService as aT, b2bService as aU, bannerService as aV, blogService as aW, cartService as aX, categoryService as aY, chatService as aZ, checkoutService as a_, type PaymentIntent as aa, PaymentMethodService as ab, type Plugin as ac, PluginService as ad, PopularSearchService as ae, PopularityService as af, type Product as ag, type ProductOption as ah, ProductService as ai, ProfileService as aj, type Quote as ak, REDIRECT_GATEWAYS as al, ReelsService as am, RegionService as an, type RejectedLine as ao, type Review as ap, type ReviewPage as aq, ReviewService as ar, type SearchDoc as as, type SearchResult as at, SearchService as au, SettingService as av, type ShippingRate as aw, StateService as ax, type StoreProfile as ay, StoreService as az, type AppliedDiscount as b, userService as b$, contactService as b0, countryService as b1, couponService as b2, currencyExponent as b3, currencyService as b4, dealService as b5, demoRequestService as b6, emptyCart as b7, emptyPage as b8, enquiryService as b9, regionService as bA, reviewService as bB, searchService as bC, setRequestHost as bD, settingService as bE, settingsService as bF, stateService as bG, staticStore as bH, storeForHost as bI, storeService as bJ, toCart as bK, toCartLine as bL, toCategory as bM, toCmsPage as bN, toCollection as bO, toEngineAddress as bP, toIdentityAddress as bQ, toMajor as bR, toMinor as bS, toOrder as bT, toPage as bU, toProduct as bV, toRating as bW, toUser as bX, toVariant as bY, toVendor as bZ, uploadService as b_, faqService as ba, feedbackService as bb, fromEngineAddress as bc, fromIdentityAddress as bd, fromSearchDoc as be, galleryService as bf, homeService as bg, initService as bh, mediaUrl as bi, meilisearchService as bj, menuService as bk, minorToMajor as bl, newsletterService as bm, orderService as bn, pageService as bo, paymentMethodService as bp, pluginService as bq, pluginsService as br, popularSearchService as bs, popularityService as bt, priceOf as bu, productImages as bv, productService as bw, profileService as bx, qs as by, reelsService as bz, type Approval as c, variantService as c0, varniCustomDesignService as c1, varniCustomProductService as c2, vendorService as c3, warrantyService as c4, wishlistService as c5, 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 };
|
|
@@ -346,6 +346,13 @@ type Plugin = {
|
|
|
346
346
|
title: string;
|
|
347
347
|
settings: Record<string, unknown>;
|
|
348
348
|
};
|
|
349
|
+
/** `GET /api/store`: what anyone may read about the shop. */
|
|
350
|
+
type StoreProfile = {
|
|
351
|
+
name: string;
|
|
352
|
+
email: string;
|
|
353
|
+
phone: string;
|
|
354
|
+
support_url: string;
|
|
355
|
+
};
|
|
349
356
|
type Vendor = {
|
|
350
357
|
id: number;
|
|
351
358
|
slug: string;
|
|
@@ -1264,6 +1271,8 @@ declare class StoreFacts extends BaseService {
|
|
|
1264
1271
|
language: string;
|
|
1265
1272
|
version: string;
|
|
1266
1273
|
}>;
|
|
1274
|
+
/** The store's own name and how a buyer reaches it, as set in its panel. */
|
|
1275
|
+
profile(): Promise<StoreProfile>;
|
|
1267
1276
|
checkoutOptions(): Promise<CheckoutOptions>;
|
|
1268
1277
|
/**
|
|
1269
1278
|
* The whole tree, flat and depth-first. Past 500 categories the engine
|
|
@@ -5232,12 +5241,16 @@ declare const menuService: MenuService;
|
|
|
5232
5241
|
/**
|
|
5233
5242
|
* The store record every page renders from.
|
|
5234
5243
|
*
|
|
5235
|
-
*
|
|
5244
|
+
* Logo, theme and the rest are the storefront's own (its static store,
|
|
5236
5245
|
* registered through `setStaticStore`); the engine has no opinion on them.
|
|
5237
|
-
* Where the engine does have one, it wins:
|
|
5238
|
-
*
|
|
5239
|
-
*
|
|
5240
|
-
*
|
|
5246
|
+
* Where the engine does have one, it wins:
|
|
5247
|
+
* - the store's name and contact, as its owner set them in the panel. One
|
|
5248
|
+
* storefront serves every store under `baseDomain`, so a name in the static
|
|
5249
|
+
* record would be every store's name;
|
|
5250
|
+
* - the settlement currency. Every price on the site is formatted with it, and
|
|
5251
|
+
* a store record saying USD over an engine charging INR would print the
|
|
5252
|
+
* wrong symbol on every price;
|
|
5253
|
+
* - the modules that back a storefront feature, and the menus.
|
|
5241
5254
|
*
|
|
5242
5255
|
* This runs on every request and a throw here takes every page down, so the
|
|
5243
5256
|
* engine's half is best-effort: unreachable, the storefront still renders
|
|
@@ -6489,4 +6502,4 @@ declare class B2bService extends BaseService {
|
|
|
6489
6502
|
}
|
|
6490
6503
|
declare const b2bService: B2bService;
|
|
6491
6504
|
|
|
6492
|
-
export { type Menu 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, HomeService as T, type IdentityAddress as U, InitService as V, type Invitation as W, type Lead as X, type ListMeta as Y, MeilisearchService as Z, type Member as _, AddressService as a,
|
|
6505
|
+
export { type Menu 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, HomeService as T, type IdentityAddress as U, InitService as V, type Invitation as W, type Lead as X, type ListMeta as Y, MeilisearchService as Z, type Member as _, AddressService as a, collectionService as a$, type MenuItem as a0, MenuService as a1, type MenuSummary as a2, type Money as a3, NewsletterService as a4, type Offer as a5, type Order as a6, type OrderLine as a7, OrderService as a8, PageService as a9, type StorefrontCategory as aA, type StorefrontMenu as aB, type StorefrontOrder as aC, type StorefrontProduct as aD, UploadService as aE, UserService as aF, type Variant as aG, type VariantImage as aH, VariantService as aI, VarniCustomDesignService as aJ, VarniCustomProductService as aK, type Vendor as aL, VendorService as aM, WarrantyService as aN, type Wishlist as aO, type WishlistItem as aP, WishlistService as aQ, addressService as aR, authService as aS, autocompleteService as aT, b2bService as aU, bannerService as aV, blogService as aW, cartService as aX, categoryService as aY, chatService as aZ, checkoutService as a_, type PaymentIntent as aa, PaymentMethodService as ab, type Plugin as ac, PluginService as ad, PopularSearchService as ae, PopularityService as af, type Product as ag, type ProductOption as ah, ProductService as ai, ProfileService as aj, type Quote as ak, REDIRECT_GATEWAYS as al, ReelsService as am, RegionService as an, type RejectedLine as ao, type Review as ap, type ReviewPage as aq, ReviewService as ar, type SearchDoc as as, type SearchResult as at, SearchService as au, SettingService as av, type ShippingRate as aw, StateService as ax, type StoreProfile as ay, StoreService as az, type AppliedDiscount as b, userService as b$, contactService as b0, countryService as b1, couponService as b2, currencyExponent as b3, currencyService as b4, dealService as b5, demoRequestService as b6, emptyCart as b7, emptyPage as b8, enquiryService as b9, regionService as bA, reviewService as bB, searchService as bC, setRequestHost as bD, settingService as bE, settingsService as bF, stateService as bG, staticStore as bH, storeForHost as bI, storeService as bJ, toCart as bK, toCartLine as bL, toCategory as bM, toCmsPage as bN, toCollection as bO, toEngineAddress as bP, toIdentityAddress as bQ, toMajor as bR, toMinor as bS, toOrder as bT, toPage as bU, toProduct as bV, toRating as bW, toUser as bX, toVariant as bY, toVendor as bZ, uploadService as b_, faqService as ba, feedbackService as bb, fromEngineAddress as bc, fromIdentityAddress as bd, fromSearchDoc as be, galleryService as bf, homeService as bg, initService as bh, mediaUrl as bi, meilisearchService as bj, menuService as bk, minorToMajor as bl, newsletterService as bm, orderService as bn, pageService as bo, paymentMethodService as bp, pluginService as bq, pluginsService as br, popularSearchService as bs, popularityService as bt, priceOf as bu, productImages as bv, productService as bw, profileService as bx, qs as by, reelsService as bz, type Approval as c, variantService as c0, varniCustomDesignService as c1, varniCustomProductService as c2, vendorService as c3, warrantyService as c4, wishlistService as c5, 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
|
@@ -1011,6 +1011,10 @@ var StoreFacts = class extends BaseService {
|
|
|
1011
1011
|
ready() {
|
|
1012
1012
|
return remember(this.key("ready"), () => this.data("/health/ready"));
|
|
1013
1013
|
}
|
|
1014
|
+
/** The store's own name and how a buyer reaches it, as set in its panel. */
|
|
1015
|
+
profile() {
|
|
1016
|
+
return remember(this.key("profile"), () => this.data("/api/store"));
|
|
1017
|
+
}
|
|
1014
1018
|
checkoutOptions() {
|
|
1015
1019
|
return remember(this.key("checkout"), () => this.data("/api/checkout"));
|
|
1016
1020
|
}
|
|
@@ -2513,17 +2517,22 @@ var StoreService = class extends BaseService {
|
|
|
2513
2517
|
return super.post(path, data);
|
|
2514
2518
|
}
|
|
2515
2519
|
async live() {
|
|
2516
|
-
const [ready, plugins, menus, base] = await Promise.all([
|
|
2520
|
+
const [ready, plugins, menus, base, profile] = await Promise.all([
|
|
2517
2521
|
this.facts.ready(),
|
|
2518
2522
|
this.facts.plugins().catch(() => /* @__PURE__ */ new Map()),
|
|
2519
2523
|
new MenuService(this._fetch).engineMenus(),
|
|
2520
|
-
readStaticStore()
|
|
2524
|
+
readStaticStore(),
|
|
2525
|
+
this.facts.profile().catch(() => null)
|
|
2521
2526
|
]);
|
|
2522
2527
|
const code = ready.currency;
|
|
2523
2528
|
const sameCurrency = (base.currency?.code ?? base.currencyCode) === code;
|
|
2524
2529
|
const flag = (on) => ({ ...on ? { active: true } : { active: false } });
|
|
2525
2530
|
const basePlugins = base.plugins ?? {};
|
|
2526
2531
|
return {
|
|
2532
|
+
// Only what the owner filled in: an empty name keeps the static one.
|
|
2533
|
+
...profile?.name ? { name: profile.name } : {},
|
|
2534
|
+
...profile?.email ? { businessEmail: profile.email } : {},
|
|
2535
|
+
...profile?.phone ? { businessPhone: profile.phone } : {},
|
|
2527
2536
|
currencyCode: code,
|
|
2528
2537
|
currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
|
|
2529
2538
|
currency: {
|