@misiki/gocommerce-connector 0.4.7 → 0.4.9
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-CQTW5q1J.d.cts → index-oCv5Dabq.d.cts} +45 -6
- package/dist/{index-CQTW5q1J.d.ts → index-oCv5Dabq.d.ts} +45 -6
- package/dist/index.cjs +46 -10
- 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 +46 -10
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +46 -10
- 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 +46 -10
- 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-oCv5Dabq.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-oCv5Dabq.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.js
CHANGED
|
@@ -2083,11 +2083,24 @@ var orderService = new OrderService();
|
|
|
2083
2083
|
|
|
2084
2084
|
// src/services/user-service.ts
|
|
2085
2085
|
var UserService = class extends BaseService {
|
|
2086
|
-
/**
|
|
2087
|
-
|
|
2086
|
+
/**
|
|
2087
|
+
* Email and password. The answer is the user object the storefront keeps in its `me` cookie.
|
|
2088
|
+
* With `phone` and `phoneToken` from `verifyOtp({ askIfNew: true })`, the phone is added to
|
|
2089
|
+
* the account as it signs in (D123).
|
|
2090
|
+
*/
|
|
2091
|
+
async login({
|
|
2092
|
+
email,
|
|
2093
|
+
password,
|
|
2094
|
+
phone,
|
|
2095
|
+
phoneToken
|
|
2096
|
+
}) {
|
|
2088
2097
|
const auth = await this.account("/x/identity/login", {
|
|
2089
2098
|
method: "POST",
|
|
2090
|
-
body: {
|
|
2099
|
+
body: {
|
|
2100
|
+
email: String(email ?? "").trim(),
|
|
2101
|
+
password: String(password ?? ""),
|
|
2102
|
+
...phoneToken ? { phone: String(phone ?? "").trim(), phone_token: phoneToken } : {}
|
|
2103
|
+
}
|
|
2091
2104
|
});
|
|
2092
2105
|
return this.signedIn(auth);
|
|
2093
2106
|
}
|
|
@@ -2251,19 +2264,42 @@ var AuthService = class extends UserService {
|
|
|
2251
2264
|
return { errorCode: err.code ?? "invalid_token", message: err.message };
|
|
2252
2265
|
}
|
|
2253
2266
|
}
|
|
2254
|
-
/**
|
|
2255
|
-
|
|
2267
|
+
/**
|
|
2268
|
+
* Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
|
|
2269
|
+
* host and in the browser read from it, lets the engine end the text "@domain #code" when the
|
|
2270
|
+
* host is the store's own, which Chrome on Android reads to fill the code in (D124).
|
|
2271
|
+
*/
|
|
2272
|
+
async getOtp({ phone, domain }) {
|
|
2273
|
+
const site = domain ?? (typeof window !== "undefined" ? window.location?.hostname : void 0);
|
|
2256
2274
|
const res = await this.account("/x/identity/otp", {
|
|
2257
2275
|
method: "POST",
|
|
2258
|
-
body: { phone: String(phone ?? "").trim() }
|
|
2276
|
+
body: { phone: String(phone ?? "").trim(), ...site ? { domain: site } : {} }
|
|
2259
2277
|
});
|
|
2260
2278
|
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2261
2279
|
}
|
|
2262
|
-
/**
|
|
2263
|
-
|
|
2264
|
-
|
|
2280
|
+
/**
|
|
2281
|
+
* Signs in the account on `phone` with the code it was sent, opening one the first time.
|
|
2282
|
+
* With `askIfNew`, on a store that signs in either way, a phone with no account opens none:
|
|
2283
|
+
* the answer is `{ newPhone: true, phoneToken }`, and the storefront asks "Already have an
|
|
2284
|
+
* account?" — `login` with the token adds the phone to it, `openPhoneAccount` opens a new one (D123).
|
|
2285
|
+
*/
|
|
2286
|
+
async verifyOtp({ phone, otp, askIfNew }) {
|
|
2287
|
+
const res = await this.account("/x/identity/otp/verify", {
|
|
2265
2288
|
method: "POST",
|
|
2266
|
-
body: {
|
|
2289
|
+
body: {
|
|
2290
|
+
phone: String(phone ?? "").trim(),
|
|
2291
|
+
code: String(otp ?? "").trim(),
|
|
2292
|
+
...askIfNew ? { ask_if_new: true } : {}
|
|
2293
|
+
}
|
|
2294
|
+
});
|
|
2295
|
+
if ("new_phone" in res && res.new_phone) return { newPhone: true, phoneToken: res.phone_token };
|
|
2296
|
+
return this.signedIn(res);
|
|
2297
|
+
}
|
|
2298
|
+
/** Opens a new account on a phone `verifyOtp({ askIfNew: true })` proved, and signs it in (D123). */
|
|
2299
|
+
async openPhoneAccount({ phone, phoneToken }) {
|
|
2300
|
+
const auth = await this.account("/x/identity/otp/new-account", {
|
|
2301
|
+
method: "POST",
|
|
2302
|
+
body: { phone: String(phone ?? "").trim(), phone_token: phoneToken }
|
|
2267
2303
|
});
|
|
2268
2304
|
return this.signedIn(auth);
|
|
2269
2305
|
}
|