@misiki/gocommerce-connector 0.4.5 → 0.4.7
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-CmPI-hcH.d.cts → index-CQTW5q1J.d.cts} +47 -1
- package/dist/{index-CmPI-hcH.d.ts → index-CQTW5q1J.d.ts} +47 -1
- package/dist/index.cjs +50 -4
- 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 +50 -4
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +50 -4
- 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 +50 -4
- 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-CQTW5q1J.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-CQTW5q1J.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,
|
|
@@ -1011,6 +1013,13 @@ var StoreFacts = class extends BaseService {
|
|
|
1011
1013
|
profile() {
|
|
1012
1014
|
return remember(this.key("profile"), () => this.data("/api/store"));
|
|
1013
1015
|
}
|
|
1016
|
+
/** Where the store delivers (D117): its priced zones' countries, or everywhere. */
|
|
1017
|
+
shipsTo() {
|
|
1018
|
+
return remember(this.key("ships-to"), async () => {
|
|
1019
|
+
const r = await this.data("/api/checkout/countries");
|
|
1020
|
+
return { everywhere: r?.everywhere ?? true, countries: r?.countries ?? [] };
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1014
1023
|
checkoutOptions() {
|
|
1015
1024
|
return remember(this.key("checkout"), () => this.data("/api/checkout"));
|
|
1016
1025
|
}
|
|
@@ -2192,7 +2201,7 @@ var AuthService = class extends UserService {
|
|
|
2192
2201
|
async loginMethod() {
|
|
2193
2202
|
try {
|
|
2194
2203
|
const method = (await this.facts.plugins()).get("identity")?.settings?.login_method;
|
|
2195
|
-
return method === "phone_otp"
|
|
2204
|
+
return method === "phone_otp" || method === "email_or_phone" ? method : "email_password";
|
|
2196
2205
|
} catch {
|
|
2197
2206
|
return "email_password";
|
|
2198
2207
|
}
|
|
@@ -2250,6 +2259,25 @@ var ProfileService = class extends UserService {
|
|
|
2250
2259
|
async save(profile) {
|
|
2251
2260
|
return this.updateProfile(profile);
|
|
2252
2261
|
}
|
|
2262
|
+
/** Texts a code to a phone the signed-in shopper wants to add (D118). */
|
|
2263
|
+
async requestPhoneLink({ phone }) {
|
|
2264
|
+
const res = await this.account("/x/identity/me/phone", {
|
|
2265
|
+
method: "POST",
|
|
2266
|
+
auth: true,
|
|
2267
|
+
body: { phone: String(phone ?? "").trim() }
|
|
2268
|
+
});
|
|
2269
|
+
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2270
|
+
}
|
|
2271
|
+
/** Adds the phone with its code; from then on it signs in to this account too. */
|
|
2272
|
+
async verifyPhoneLink({ phone, otp }) {
|
|
2273
|
+
const c = await this.account("/x/identity/me/phone/verify", {
|
|
2274
|
+
method: "POST",
|
|
2275
|
+
auth: true,
|
|
2276
|
+
body: { phone: String(phone ?? "").trim(), code: String(otp ?? "").trim() }
|
|
2277
|
+
});
|
|
2278
|
+
updateMe(c);
|
|
2279
|
+
return toUser(c);
|
|
2280
|
+
}
|
|
2253
2281
|
};
|
|
2254
2282
|
var userService = new UserService();
|
|
2255
2283
|
var authService = new AuthService();
|
|
@@ -2558,12 +2586,14 @@ var StoreService = class extends BaseService {
|
|
|
2558
2586
|
return super.post(path, data);
|
|
2559
2587
|
}
|
|
2560
2588
|
async live() {
|
|
2561
|
-
const [ready, plugins, menus, base, profile] = await Promise.all([
|
|
2589
|
+
const [ready, plugins, menus, base, profile, ships] = await Promise.all([
|
|
2562
2590
|
this.facts.ready(),
|
|
2563
2591
|
this.facts.plugins().catch(() => /* @__PURE__ */ new Map()),
|
|
2564
2592
|
new MenuService(this._fetch).engineMenus(),
|
|
2565
2593
|
readStaticStore(),
|
|
2566
|
-
this.facts.profile().catch(() => null)
|
|
2594
|
+
this.facts.profile().catch(() => null),
|
|
2595
|
+
// An engine without the route rules nothing out.
|
|
2596
|
+
this.facts.shipsTo().catch(() => ({ everywhere: true, countries: [] }))
|
|
2567
2597
|
]);
|
|
2568
2598
|
const code = ready.currency;
|
|
2569
2599
|
const sameCurrency = (base.currency?.code ?? base.currencyCode) === code;
|
|
@@ -2593,14 +2623,30 @@ var StoreService = class extends BaseService {
|
|
|
2593
2623
|
}
|
|
2594
2624
|
},
|
|
2595
2625
|
...menus?.length ? { menu: menus } : {},
|
|
2626
|
+
...deliverable(base, ships),
|
|
2596
2627
|
// The one way this store signs customers in (D116), which the sign-in
|
|
2597
2628
|
// form reads as PHONE or EMAIL. Without the accounts module the static
|
|
2598
2629
|
// record says.
|
|
2599
|
-
...plugins.has("identity") ? { loginType: plugins.get("identity")?.settings?.login_method
|
|
2630
|
+
...plugins.has("identity") ? { loginType: LOGIN_TYPES[String(plugins.get("identity")?.settings?.login_method)] ?? "EMAIL" } : {}
|
|
2600
2631
|
};
|
|
2601
2632
|
}
|
|
2602
2633
|
};
|
|
2603
2634
|
var storeService = new StoreService();
|
|
2635
|
+
function deliverable(base, ships) {
|
|
2636
|
+
if (ships.everywhere || !ships.countries.length) return {};
|
|
2637
|
+
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|
|
2638
|
+
const countries = ships.countries.map((code) => known.get(code) ?? { code, name: regionName(code) });
|
|
2639
|
+
const keep = base.country && ships.countries.includes(String(base.country.code).toUpperCase());
|
|
2640
|
+
return { countries, ...keep ? {} : { country: countries[0] } };
|
|
2641
|
+
}
|
|
2642
|
+
function regionName(code) {
|
|
2643
|
+
try {
|
|
2644
|
+
return new Intl.DisplayNames(["en"], { type: "region" }).of(code) ?? code;
|
|
2645
|
+
} catch {
|
|
2646
|
+
return code;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
|
|
2604
2650
|
|
|
2605
2651
|
// src/services/page-service.ts
|
|
2606
2652
|
var PageService = class extends BaseService {
|