@misiki/gocommerce-connector 0.4.6 → 0.4.8
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-B0Gf_Bvg.d.cts → index-Bjx8kR8G.d.cts} +80 -5
- package/dist/{index-B0Gf_Bvg.d.ts → index-Bjx8kR8G.d.ts} +80 -5
- package/dist/index.cjs +62 -9
- 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 +62 -9
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +62 -9
- 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 +62 -9
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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, az as StoreService, aB as StorefrontMenu, aE as UploadService, aF as UserService, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aM as VendorService, aN as WarrantyService, 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, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, 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, 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, bV as toPage, 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 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, az as StoreService, aB as StorefrontMenu, aE as UploadService, aF as UserService, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aM as VendorService, aN as WarrantyService, 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, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, 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, 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, bV as toPage, 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-Bjx8kR8G.cjs';
|
package/dist/services/index.d.ts
CHANGED
|
@@ -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, az as StoreService, aB as StorefrontMenu, aE as UploadService, aF as UserService, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aM as VendorService, aN as WarrantyService, 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, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, 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, 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, bV as toPage, 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 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, az as StoreService, aB as StorefrontMenu, aE as UploadService, aF as UserService, aI as VariantService, aJ as VarniCustomDesignService, aK as VarniCustomProductService, aM as VendorService, aN as WarrantyService, 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, b4 as currencyService, b5 as dealService, b6 as demoRequestService, b8 as emptyPage, b9 as enquiryService, ba as faqService, bb as feedbackService, bf as galleryService, bg as homeService, bh as initService, bi as mediaUrl, bj as meilisearchService, bk as menuService, 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, 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, bV as toPage, 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-Bjx8kR8G.js';
|
package/dist/services/index.js
CHANGED
|
@@ -130,6 +130,7 @@ function toMe(c) {
|
|
|
130
130
|
avatar: null,
|
|
131
131
|
role: "USER",
|
|
132
132
|
emailVerified: c.email_verified,
|
|
133
|
+
phoneVerified: !!c.phone_verified,
|
|
133
134
|
storeId: null
|
|
134
135
|
};
|
|
135
136
|
}
|
|
@@ -952,6 +953,7 @@ function toUser(c) {
|
|
|
952
953
|
email: c.email,
|
|
953
954
|
emailVerified: c.email_verified,
|
|
954
955
|
phone: c.phone || null,
|
|
956
|
+
phoneVerified: !!c.phone_verified,
|
|
955
957
|
firstName: firstName || "",
|
|
956
958
|
lastName: rest.join(" "),
|
|
957
959
|
name: c.name,
|
|
@@ -2062,11 +2064,24 @@ var orderService = new OrderService();
|
|
|
2062
2064
|
|
|
2063
2065
|
// src/services/user-service.ts
|
|
2064
2066
|
var UserService = class extends BaseService {
|
|
2065
|
-
/**
|
|
2066
|
-
|
|
2067
|
+
/**
|
|
2068
|
+
* Email and password. The answer is the user object the storefront keeps in its `me` cookie.
|
|
2069
|
+
* With `phone` and `phoneToken` from `verifyOtp({ askIfNew: true })`, the phone is added to
|
|
2070
|
+
* the account as it signs in (D123).
|
|
2071
|
+
*/
|
|
2072
|
+
async login({
|
|
2073
|
+
email,
|
|
2074
|
+
password,
|
|
2075
|
+
phone,
|
|
2076
|
+
phoneToken
|
|
2077
|
+
}) {
|
|
2067
2078
|
const auth = await this.account("/x/identity/login", {
|
|
2068
2079
|
method: "POST",
|
|
2069
|
-
body: {
|
|
2080
|
+
body: {
|
|
2081
|
+
email: String(email ?? "").trim(),
|
|
2082
|
+
password: String(password ?? ""),
|
|
2083
|
+
...phoneToken ? { phone: String(phone ?? "").trim(), phone_token: phoneToken } : {}
|
|
2084
|
+
}
|
|
2070
2085
|
});
|
|
2071
2086
|
return this.signedIn(auth);
|
|
2072
2087
|
}
|
|
@@ -2199,7 +2214,7 @@ var AuthService = class extends UserService {
|
|
|
2199
2214
|
async loginMethod() {
|
|
2200
2215
|
try {
|
|
2201
2216
|
const method = (await this.facts.plugins()).get("identity")?.settings?.login_method;
|
|
2202
|
-
return method === "phone_otp"
|
|
2217
|
+
return method === "phone_otp" || method === "email_or_phone" ? method : "email_password";
|
|
2203
2218
|
} catch {
|
|
2204
2219
|
return "email_password";
|
|
2205
2220
|
}
|
|
@@ -2238,11 +2253,29 @@ var AuthService = class extends UserService {
|
|
|
2238
2253
|
});
|
|
2239
2254
|
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2240
2255
|
}
|
|
2241
|
-
/**
|
|
2242
|
-
|
|
2243
|
-
|
|
2256
|
+
/**
|
|
2257
|
+
* Signs in the account on `phone` with the code it was sent, opening one the first time.
|
|
2258
|
+
* With `askIfNew`, on a store that signs in either way, a phone with no account opens none:
|
|
2259
|
+
* the answer is `{ newPhone: true, phoneToken }`, and the storefront asks "Already have an
|
|
2260
|
+
* account?" — `login` with the token adds the phone to it, `openPhoneAccount` opens a new one (D123).
|
|
2261
|
+
*/
|
|
2262
|
+
async verifyOtp({ phone, otp, askIfNew }) {
|
|
2263
|
+
const res = await this.account("/x/identity/otp/verify", {
|
|
2244
2264
|
method: "POST",
|
|
2245
|
-
body: {
|
|
2265
|
+
body: {
|
|
2266
|
+
phone: String(phone ?? "").trim(),
|
|
2267
|
+
code: String(otp ?? "").trim(),
|
|
2268
|
+
...askIfNew ? { ask_if_new: true } : {}
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2271
|
+
if ("new_phone" in res && res.new_phone) return { newPhone: true, phoneToken: res.phone_token };
|
|
2272
|
+
return this.signedIn(res);
|
|
2273
|
+
}
|
|
2274
|
+
/** Opens a new account on a phone `verifyOtp({ askIfNew: true })` proved, and signs it in (D123). */
|
|
2275
|
+
async openPhoneAccount({ phone, phoneToken }) {
|
|
2276
|
+
const auth = await this.account("/x/identity/otp/new-account", {
|
|
2277
|
+
method: "POST",
|
|
2278
|
+
body: { phone: String(phone ?? "").trim(), phone_token: phoneToken }
|
|
2246
2279
|
});
|
|
2247
2280
|
return this.signedIn(auth);
|
|
2248
2281
|
}
|
|
@@ -2257,6 +2290,25 @@ var ProfileService = class extends UserService {
|
|
|
2257
2290
|
async save(profile) {
|
|
2258
2291
|
return this.updateProfile(profile);
|
|
2259
2292
|
}
|
|
2293
|
+
/** Texts a code to a phone the signed-in shopper wants to add (D118). */
|
|
2294
|
+
async requestPhoneLink({ phone }) {
|
|
2295
|
+
const res = await this.account("/x/identity/me/phone", {
|
|
2296
|
+
method: "POST",
|
|
2297
|
+
auth: true,
|
|
2298
|
+
body: { phone: String(phone ?? "").trim() }
|
|
2299
|
+
});
|
|
2300
|
+
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2301
|
+
}
|
|
2302
|
+
/** Adds the phone with its code; from then on it signs in to this account too. */
|
|
2303
|
+
async verifyPhoneLink({ phone, otp }) {
|
|
2304
|
+
const c = await this.account("/x/identity/me/phone/verify", {
|
|
2305
|
+
method: "POST",
|
|
2306
|
+
auth: true,
|
|
2307
|
+
body: { phone: String(phone ?? "").trim(), code: String(otp ?? "").trim() }
|
|
2308
|
+
});
|
|
2309
|
+
updateMe(c);
|
|
2310
|
+
return toUser(c);
|
|
2311
|
+
}
|
|
2260
2312
|
};
|
|
2261
2313
|
var userService = new UserService();
|
|
2262
2314
|
var authService = new AuthService();
|
|
@@ -2606,7 +2658,7 @@ var StoreService = class extends BaseService {
|
|
|
2606
2658
|
// The one way this store signs customers in (D116), which the sign-in
|
|
2607
2659
|
// form reads as PHONE or EMAIL. Without the accounts module the static
|
|
2608
2660
|
// record says.
|
|
2609
|
-
...plugins.has("identity") ? { loginType: plugins.get("identity")?.settings?.login_method
|
|
2661
|
+
...plugins.has("identity") ? { loginType: LOGIN_TYPES[String(plugins.get("identity")?.settings?.login_method)] ?? "EMAIL" } : {}
|
|
2610
2662
|
};
|
|
2611
2663
|
}
|
|
2612
2664
|
};
|
|
@@ -2625,6 +2677,7 @@ function regionName(code) {
|
|
|
2625
2677
|
return code;
|
|
2626
2678
|
}
|
|
2627
2679
|
}
|
|
2680
|
+
var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
|
|
2628
2681
|
|
|
2629
2682
|
// src/services/page-service.ts
|
|
2630
2683
|
var PageService = class extends BaseService {
|