@misiki/gocommerce-connector 0.4.4 → 0.4.6
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-BNYk4TS2.d.cts → index-B0Gf_Bvg.d.cts} +52 -5
- package/dist/{index-BNYk4TS2.d.ts → index-B0Gf_Bvg.d.ts} +52 -5
- package/dist/index.cjs +58 -7
- 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 +58 -7
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +58 -7
- 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 +58 -7
- 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 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-
|
|
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-B0Gf_Bvg.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-
|
|
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-B0Gf_Bvg.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.js
CHANGED
|
@@ -1030,6 +1030,13 @@ var StoreFacts = class extends BaseService {
|
|
|
1030
1030
|
profile() {
|
|
1031
1031
|
return remember(this.key("profile"), () => this.data("/api/store"));
|
|
1032
1032
|
}
|
|
1033
|
+
/** Where the store delivers (D117): its priced zones' countries, or everywhere. */
|
|
1034
|
+
shipsTo() {
|
|
1035
|
+
return remember(this.key("ships-to"), async () => {
|
|
1036
|
+
const r = await this.data("/api/checkout/countries");
|
|
1037
|
+
return { everywhere: r?.everywhere ?? true, countries: r?.countries ?? [] };
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1033
1040
|
checkoutOptions() {
|
|
1034
1041
|
return remember(this.key("checkout"), () => this.data("/api/checkout"));
|
|
1035
1042
|
}
|
|
@@ -2203,6 +2210,19 @@ var UserService = class extends BaseService {
|
|
|
2203
2210
|
}
|
|
2204
2211
|
};
|
|
2205
2212
|
var AuthService = class extends UserService {
|
|
2213
|
+
facts = new StoreFacts(this._fetch);
|
|
2214
|
+
/**
|
|
2215
|
+
* How this store signs customers in: `email_password` or `phone_otp`.
|
|
2216
|
+
* A store whose accounts module says nothing signs in by email.
|
|
2217
|
+
*/
|
|
2218
|
+
async loginMethod() {
|
|
2219
|
+
try {
|
|
2220
|
+
const method = (await this.facts.plugins()).get("identity")?.settings?.login_method;
|
|
2221
|
+
return method === "phone_otp" ? "phone_otp" : "email_password";
|
|
2222
|
+
} catch {
|
|
2223
|
+
return "email_password";
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2206
2226
|
async forgotPassword({ email }) {
|
|
2207
2227
|
return this.account("/x/identity/password-reset", {
|
|
2208
2228
|
method: "POST",
|
|
@@ -2229,11 +2249,21 @@ var AuthService = class extends UserService {
|
|
|
2229
2249
|
return { errorCode: err.code ?? "invalid_token", message: err.message };
|
|
2230
2250
|
}
|
|
2231
2251
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2252
|
+
/** Texts a 4-digit sign-in code to `phone`, which needs its country code. */
|
|
2253
|
+
async getOtp({ phone }) {
|
|
2254
|
+
const res = await this.account("/x/identity/otp", {
|
|
2255
|
+
method: "POST",
|
|
2256
|
+
body: { phone: String(phone ?? "").trim() }
|
|
2257
|
+
});
|
|
2258
|
+
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2234
2259
|
}
|
|
2235
|
-
|
|
2236
|
-
|
|
2260
|
+
/** Signs in the account on `phone` with the code it was sent, opening one the first time. */
|
|
2261
|
+
async verifyOtp({ phone, otp }) {
|
|
2262
|
+
const auth = await this.account("/x/identity/otp/verify", {
|
|
2263
|
+
method: "POST",
|
|
2264
|
+
body: { phone: String(phone ?? "").trim(), code: String(otp ?? "").trim() }
|
|
2265
|
+
});
|
|
2266
|
+
return this.signedIn(auth);
|
|
2237
2267
|
}
|
|
2238
2268
|
async joinAsAdmin() {
|
|
2239
2269
|
throw new NotSupportedError("AuthService", "joinAsAdmin", "operators are invited from the admin panel");
|
|
@@ -2551,12 +2581,14 @@ var StoreService = class extends BaseService {
|
|
|
2551
2581
|
return super.post(path, data);
|
|
2552
2582
|
}
|
|
2553
2583
|
async live() {
|
|
2554
|
-
const [ready, plugins, menus, base, profile] = await Promise.all([
|
|
2584
|
+
const [ready, plugins, menus, base, profile, ships] = await Promise.all([
|
|
2555
2585
|
this.facts.ready(),
|
|
2556
2586
|
this.facts.plugins().catch(() => /* @__PURE__ */ new Map()),
|
|
2557
2587
|
new MenuService(this._fetch).engineMenus(),
|
|
2558
2588
|
readStaticStore(),
|
|
2559
|
-
this.facts.profile().catch(() => null)
|
|
2589
|
+
this.facts.profile().catch(() => null),
|
|
2590
|
+
// An engine without the route rules nothing out.
|
|
2591
|
+
this.facts.shipsTo().catch(() => ({ everywhere: true, countries: [] }))
|
|
2560
2592
|
]);
|
|
2561
2593
|
const code = ready.currency;
|
|
2562
2594
|
const sameCurrency = (base.currency?.code ?? base.currencyCode) === code;
|
|
@@ -2585,11 +2617,30 @@ var StoreService = class extends BaseService {
|
|
|
2585
2617
|
...flag(plugins.has("product-reviews"))
|
|
2586
2618
|
}
|
|
2587
2619
|
},
|
|
2588
|
-
...menus?.length ? { menu: menus } : {}
|
|
2620
|
+
...menus?.length ? { menu: menus } : {},
|
|
2621
|
+
...deliverable(base, ships),
|
|
2622
|
+
// The one way this store signs customers in (D116), which the sign-in
|
|
2623
|
+
// form reads as PHONE or EMAIL. Without the accounts module the static
|
|
2624
|
+
// record says.
|
|
2625
|
+
...plugins.has("identity") ? { loginType: plugins.get("identity")?.settings?.login_method === "phone_otp" ? "PHONE" : "EMAIL" } : {}
|
|
2589
2626
|
};
|
|
2590
2627
|
}
|
|
2591
2628
|
};
|
|
2592
2629
|
var storeService = new StoreService();
|
|
2630
|
+
function deliverable(base, ships) {
|
|
2631
|
+
if (ships.everywhere || !ships.countries.length) return {};
|
|
2632
|
+
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|
|
2633
|
+
const countries = ships.countries.map((code) => known.get(code) ?? { code, name: regionName(code) });
|
|
2634
|
+
const keep = base.country && ships.countries.includes(String(base.country.code).toUpperCase());
|
|
2635
|
+
return { countries, ...keep ? {} : { country: countries[0] } };
|
|
2636
|
+
}
|
|
2637
|
+
function regionName(code) {
|
|
2638
|
+
try {
|
|
2639
|
+
return new Intl.DisplayNames(["en"], { type: "region" }).of(code) ?? code;
|
|
2640
|
+
} catch {
|
|
2641
|
+
return code;
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2593
2644
|
|
|
2594
2645
|
// src/services/page-service.ts
|
|
2595
2646
|
var PageService = class extends BaseService {
|