@misiki/gocommerce-connector 0.16.0 → 0.19.0
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 +2 -1
- package/dist/{index-Dm_1E1ai.d.cts → index-BsvUnF4H.d.cts} +85 -1
- package/dist/{index-Dm_1E1ai.d.ts → index-BsvUnF4H.d.ts} +85 -1
- package/dist/index.cjs +81 -0
- 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 +80 -1
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +81 -0
- 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 +80 -1
- 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 AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as
|
|
1
|
+
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, be as WishlistService, bf as addressService, bg as authService, bh as autocompleteService, bi as b2bService, bj as bannerService, bk as blogService, bl as cartService, bm as categoryService, bn as chatService, bo as checkoutService, bp as collectionService, bq as contactService, br as countryService, bs as couponService, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, bO as newsletterService, bP as orderService, bQ as ownDomain, bR as pageService, bS as paymentMethodService, bT as pluginService, bU as pluginsService, bV as popularSearchService, bW as popularityService, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, b$ as profileService, c0 as qs, c1 as reelsService, c2 as regionService, c3 as reviewService, c4 as searchService, c5 as setRequestHost, c6 as settingService, c7 as settingsService, c8 as stateService, c9 as staticStore, ca as storeForHost, cb as storeService, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, cw as uploadService, cx as userService, cy as variantService, cz as varniCustomDesignService, cA as varniCustomProductService, cB as vendorService, cC as warrantyService, cD as wishlistService } from './index-BsvUnF4H.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 AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as
|
|
1
|
+
export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, be as WishlistService, bf as addressService, bg as authService, bh as autocompleteService, bi as b2bService, bj as bannerService, bk as blogService, bl as cartService, bm as categoryService, bn as chatService, bo as checkoutService, bp as collectionService, bq as contactService, br as countryService, bs as couponService, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, bO as newsletterService, bP as orderService, bQ as ownDomain, bR as pageService, bS as paymentMethodService, bT as pluginService, bU as pluginsService, bV as popularSearchService, bW as popularityService, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, b$ as profileService, c0 as qs, c1 as reelsService, c2 as regionService, c3 as reviewService, c4 as searchService, c5 as setRequestHost, c6 as settingService, c7 as settingsService, c8 as stateService, c9 as staticStore, ca as storeForHost, cb as storeService, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, cw as uploadService, cx as userService, cy as variantService, cz as varniCustomDesignService, cA as varniCustomProductService, cB as vendorService, cC as warrantyService, cD as wishlistService } from './index-BsvUnF4H.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.js
CHANGED
|
@@ -2871,6 +2871,71 @@ var ReviewService = class extends BaseService {
|
|
|
2871
2871
|
};
|
|
2872
2872
|
var reviewService = new ReviewService();
|
|
2873
2873
|
|
|
2874
|
+
// src/services/google-review-service.ts
|
|
2875
|
+
var PLUGIN = "google-reviews";
|
|
2876
|
+
var GoogleReviewService = class extends BaseService {
|
|
2877
|
+
facts = new StoreFacts(this._fetch);
|
|
2878
|
+
/**
|
|
2879
|
+
* Google's rating and its most relevant reviews, read live. Google's terms
|
|
2880
|
+
* forbid keeping them, so nothing here caches them either, and every call
|
|
2881
|
+
* is one the store pays Google for: call it when the section is in view.
|
|
2882
|
+
*/
|
|
2883
|
+
async place() {
|
|
2884
|
+
if (!await this.switchOn("show_place")) return null;
|
|
2885
|
+
const p = await this.orNull(() => this.data("/x/google-reviews/place"));
|
|
2886
|
+
if (!p?.user_rating_count) return null;
|
|
2887
|
+
return {
|
|
2888
|
+
rating: p.rating,
|
|
2889
|
+
count: p.user_rating_count,
|
|
2890
|
+
mapsUrl: p.google_maps_uri ?? "",
|
|
2891
|
+
reviews: (p.reviews ?? []).map((r) => ({
|
|
2892
|
+
author: r.author?.name ?? "",
|
|
2893
|
+
authorUrl: r.author?.uri ?? "",
|
|
2894
|
+
authorPhoto: r.author?.photo_uri ?? "",
|
|
2895
|
+
rating: r.rating,
|
|
2896
|
+
text: r.text ?? "",
|
|
2897
|
+
language: r.language ?? "",
|
|
2898
|
+
when: r.relative_time ?? "",
|
|
2899
|
+
visited: r.visit_date ?? "",
|
|
2900
|
+
url: r.google_maps_uri ?? "",
|
|
2901
|
+
reportUrl: r.flag_uri ?? ""
|
|
2902
|
+
}))
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
/**
|
|
2906
|
+
* What Google Customer Reviews' opt-in is rendered with, for an order placed
|
|
2907
|
+
* in this browser: its access token is kept here, and nowhere else can ask.
|
|
2908
|
+
* Every field is the order's own; the keys are Google's, to pass unchanged
|
|
2909
|
+
* to `gapi.surveyoptin.render`.
|
|
2910
|
+
*/
|
|
2911
|
+
async survey(orderNumber) {
|
|
2912
|
+
const kept = orderNumber ? placedOrder(orderNumber) : void 0;
|
|
2913
|
+
if (!kept || !await this.switchOn("customer_reviews")) return null;
|
|
2914
|
+
return this.orNull(
|
|
2915
|
+
() => this.data(`/x/google-reviews/survey/${encodeURIComponent(orderNumber)}`, {
|
|
2916
|
+
query: { token: kept.token }
|
|
2917
|
+
})
|
|
2918
|
+
);
|
|
2919
|
+
}
|
|
2920
|
+
async switchOn(setting) {
|
|
2921
|
+
try {
|
|
2922
|
+
return (await this.facts.plugins()).get(PLUGIN)?.settings?.[setting] === true;
|
|
2923
|
+
} catch {
|
|
2924
|
+
return false;
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
/** Off, used up for the day, or refused by Google: nothing to show. Anything else still throws. */
|
|
2928
|
+
async orNull(call) {
|
|
2929
|
+
try {
|
|
2930
|
+
return await call();
|
|
2931
|
+
} catch (err) {
|
|
2932
|
+
if (err instanceof GoCommerceError && [404, 429, 502].includes(err.status)) return null;
|
|
2933
|
+
throw err;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
};
|
|
2937
|
+
var googleReviewService = new GoogleReviewService();
|
|
2938
|
+
|
|
2874
2939
|
// src/services/menu-service.ts
|
|
2875
2940
|
function linkFor(item) {
|
|
2876
2941
|
const t = item.target ?? "";
|
|
@@ -3089,6 +3154,14 @@ var StoreService = class extends BaseService {
|
|
|
3089
3154
|
...basePlugins.isProductReviewsAndRatings,
|
|
3090
3155
|
...flag(plugins.has("product-reviews"))
|
|
3091
3156
|
},
|
|
3157
|
+
// Google Customer Reviews (ext/google-reviews): the confirmation page's survey offer,
|
|
3158
|
+
// whose fields the engine builds from the order, and Google's store widget, which
|
|
3159
|
+
// belongs to the same programme and so needs the survey on.
|
|
3160
|
+
googleReviewsOptIn: {
|
|
3161
|
+
...basePlugins.googleReviewsOptIn,
|
|
3162
|
+
...flag(googleSetting(plugins, "customer_reviews") === true)
|
|
3163
|
+
},
|
|
3164
|
+
googleStoreWidget: storeWidget(plugins),
|
|
3092
3165
|
// The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
|
|
3093
3166
|
// switch (D131) can only show it while that is on.
|
|
3094
3167
|
newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
|
|
@@ -3131,6 +3204,12 @@ function regionName(code) {
|
|
|
3131
3204
|
return code;
|
|
3132
3205
|
}
|
|
3133
3206
|
}
|
|
3207
|
+
var googleSetting = (plugins, key) => plugins.get("google-reviews")?.settings?.[key];
|
|
3208
|
+
function storeWidget(plugins) {
|
|
3209
|
+
const where = googleSetting(plugins, "store_widget");
|
|
3210
|
+
if (googleSetting(plugins, "customer_reviews") !== true || !where) return { active: false };
|
|
3211
|
+
return { active: true, position: where === "Bottom left" ? "LEFT_BOTTOM" : "RIGHT_BOTTOM" };
|
|
3212
|
+
}
|
|
3134
3213
|
var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
|
|
3135
3214
|
|
|
3136
3215
|
// src/services/page-service.ts
|
|
@@ -3813,6 +3892,6 @@ function attemptKey(request) {
|
|
|
3813
3892
|
}
|
|
3814
3893
|
var b2bService = new B2bService();
|
|
3815
3894
|
|
|
3816
|
-
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoCommerceError, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, NotSupportedError, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, forgetAll as clearStoreCache, collectionService, connectorName, contactService, countryService, couponService, currencyExponent, currencyService, dealService, demoRequestService, emptyCart, emptyPage, enquiryService, faqService, feedbackService, fromEngineAddress, fromIdentityAddress, fromSearchDoc, galleryService, hasStaticStore, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, minorToMajor, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, priceOf, productImages, productService, productVideos, profileService, qs, readStaticStore, reelsService, regionService, reviewService, searchService, serveRestLocally, setRequestHost, setStaticStore, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toAddOn, toCart, toCartLine, toCartOffer, toCategory, toCmsPage, toCollection, toEngineAddress, toFreeShipping, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toStorefrontFacets, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
|
|
3895
|
+
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoCommerceError, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, NotSupportedError, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, forgetAll as clearStoreCache, collectionService, connectorName, contactService, countryService, couponService, currencyExponent, currencyService, dealService, demoRequestService, emptyCart, emptyPage, enquiryService, faqService, feedbackService, fromEngineAddress, fromIdentityAddress, fromSearchDoc, galleryService, googleReviewService, hasStaticStore, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, minorToMajor, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, priceOf, productImages, productService, productVideos, profileService, qs, readStaticStore, reelsService, regionService, reviewService, searchService, serveRestLocally, setRequestHost, setStaticStore, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toAddOn, toCart, toCartLine, toCartOffer, toCategory, toCmsPage, toCollection, toEngineAddress, toFreeShipping, toIdentityAddress, toMajor, toMinor, toOrder, toPage, toProduct, toRating, toStorefrontFacets, toUser, toVariant, toVendor, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
|
|
3817
3896
|
//# sourceMappingURL=index.js.map
|
|
3818
3897
|
//# sourceMappingURL=index.js.map
|