@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.
@@ -1 +1 @@
1
- export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a8 as MeilisearchService, a9 as Member, ac as MenuService, af as NewsletterService, ak as OrderService, al as PageLayout, am as PageService, ao as PaymentMethodService, aq as PluginService, aq as PluginsService, ar as PopularSearchService, as as PopularityService, ax as ProductService, ay as ProfileService, az as Quote, aA as REDIRECT_GATEWAYS, aB as ReelsService, aC as RegionService, aD as RejectedLine, aG as ReviewService, aJ as SearchService, aK as SettingService, aK as SettingsService, aM as SiteChrome, aN as SiteFooter, aO as SiteHeader, aP as SocialLink, aQ as StateService, aS as StoreService, aU as StorefrontMenu, aX as ThemeSettings, aY as ThemeSettingsResult, aZ as UploadService, a_ as UserService, b1 as VariantService, b2 as VarniCustomDesignService, b3 as VarniCustomProductService, b5 as VendorService, b6 as WarrantyService, b9 as WishlistService, ba as addressService, bb as authService, bc as autocompleteService, bd as b2bService, be as bannerService, bf as blogService, bg as cartService, bh as categoryService, bi as chatService, bj as checkoutService, bk as collectionService, bl as contactService, bm as countryService, bn as couponService, bp as currencyService, bq as dealService, br as demoRequestService, bt as emptyPage, bu as enquiryService, bv as faqService, bw as feedbackService, bA as galleryService, bB as homeService, bC as initService, bD as layoutService, bE as mediaUrl, bF as meilisearchService, bG as menuService, bI as newsletterService, bJ as orderService, bK as ownDomain, bL as pageService, bM as paymentMethodService, bN as pluginService, bO as pluginsService, bP as popularSearchService, bQ as popularityService, bT as productService, bV as profileService, bW as qs, bX as reelsService, bY as regionService, bZ as reviewService, b_ as searchService, b$ as setRequestHost, c0 as settingService, c1 as settingsService, c2 as stateService, c3 as staticStore, c4 as storeForHost, c5 as storeService, cj as toPage, cm as toStorefrontFacets, cq as uploadService, cr as userService, cs as variantService, ct as varniCustomDesignService, cu as varniCustomProductService, cv as vendorService, cw as warrantyService, cx as wishlistService } from '../index-Dm_1E1ai.cjs';
1
+ export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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';
@@ -1 +1 @@
1
- export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Y as HeaderSettings, Z as HomeLayout, _ as HomeLayoutSection, $ as HomeService, a1 as InitService, a2 as Invitation, a3 as LayoutCollection, a4 as LayoutPage, a5 as LayoutService, a6 as Lead, a8 as MeilisearchService, a9 as Member, ac as MenuService, af as NewsletterService, ak as OrderService, al as PageLayout, am as PageService, ao as PaymentMethodService, aq as PluginService, aq as PluginsService, ar as PopularSearchService, as as PopularityService, ax as ProductService, ay as ProfileService, az as Quote, aA as REDIRECT_GATEWAYS, aB as ReelsService, aC as RegionService, aD as RejectedLine, aG as ReviewService, aJ as SearchService, aK as SettingService, aK as SettingsService, aM as SiteChrome, aN as SiteFooter, aO as SiteHeader, aP as SocialLink, aQ as StateService, aS as StoreService, aU as StorefrontMenu, aX as ThemeSettings, aY as ThemeSettingsResult, aZ as UploadService, a_ as UserService, b1 as VariantService, b2 as VarniCustomDesignService, b3 as VarniCustomProductService, b5 as VendorService, b6 as WarrantyService, b9 as WishlistService, ba as addressService, bb as authService, bc as autocompleteService, bd as b2bService, be as bannerService, bf as blogService, bg as cartService, bh as categoryService, bi as chatService, bj as checkoutService, bk as collectionService, bl as contactService, bm as countryService, bn as couponService, bp as currencyService, bq as dealService, br as demoRequestService, bt as emptyPage, bu as enquiryService, bv as faqService, bw as feedbackService, bA as galleryService, bB as homeService, bC as initService, bD as layoutService, bE as mediaUrl, bF as meilisearchService, bG as menuService, bI as newsletterService, bJ as orderService, bK as ownDomain, bL as pageService, bM as paymentMethodService, bN as pluginService, bO as pluginsService, bP as popularSearchService, bQ as popularityService, bT as productService, bV as profileService, bW as qs, bX as reelsService, bY as regionService, bZ as reviewService, b_ as searchService, b$ as setRequestHost, c0 as settingService, c1 as settingsService, c2 as stateService, c3 as staticStore, c4 as storeForHost, c5 as storeService, cj as toPage, cm as toStorefrontFacets, cq as uploadService, cr as userService, cs as variantService, ct as varniCustomDesignService, cu as varniCustomProductService, cv as vendorService, cw as warrantyService, cx as wishlistService } from '../index-Dm_1E1ai.js';
1
+ export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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';
@@ -2852,6 +2852,71 @@ var ReviewService = class extends BaseService {
2852
2852
  };
2853
2853
  var reviewService = new ReviewService();
2854
2854
 
2855
+ // src/services/google-review-service.ts
2856
+ var PLUGIN = "google-reviews";
2857
+ var GoogleReviewService = class extends BaseService {
2858
+ facts = new StoreFacts(this._fetch);
2859
+ /**
2860
+ * Google's rating and its most relevant reviews, read live. Google's terms
2861
+ * forbid keeping them, so nothing here caches them either, and every call
2862
+ * is one the store pays Google for: call it when the section is in view.
2863
+ */
2864
+ async place() {
2865
+ if (!await this.switchOn("show_place")) return null;
2866
+ const p = await this.orNull(() => this.data("/x/google-reviews/place"));
2867
+ if (!p?.user_rating_count) return null;
2868
+ return {
2869
+ rating: p.rating,
2870
+ count: p.user_rating_count,
2871
+ mapsUrl: p.google_maps_uri ?? "",
2872
+ reviews: (p.reviews ?? []).map((r) => ({
2873
+ author: r.author?.name ?? "",
2874
+ authorUrl: r.author?.uri ?? "",
2875
+ authorPhoto: r.author?.photo_uri ?? "",
2876
+ rating: r.rating,
2877
+ text: r.text ?? "",
2878
+ language: r.language ?? "",
2879
+ when: r.relative_time ?? "",
2880
+ visited: r.visit_date ?? "",
2881
+ url: r.google_maps_uri ?? "",
2882
+ reportUrl: r.flag_uri ?? ""
2883
+ }))
2884
+ };
2885
+ }
2886
+ /**
2887
+ * What Google Customer Reviews' opt-in is rendered with, for an order placed
2888
+ * in this browser: its access token is kept here, and nowhere else can ask.
2889
+ * Every field is the order's own; the keys are Google's, to pass unchanged
2890
+ * to `gapi.surveyoptin.render`.
2891
+ */
2892
+ async survey(orderNumber) {
2893
+ const kept = orderNumber ? placedOrder(orderNumber) : void 0;
2894
+ if (!kept || !await this.switchOn("customer_reviews")) return null;
2895
+ return this.orNull(
2896
+ () => this.data(`/x/google-reviews/survey/${encodeURIComponent(orderNumber)}`, {
2897
+ query: { token: kept.token }
2898
+ })
2899
+ );
2900
+ }
2901
+ async switchOn(setting) {
2902
+ try {
2903
+ return (await this.facts.plugins()).get(PLUGIN)?.settings?.[setting] === true;
2904
+ } catch {
2905
+ return false;
2906
+ }
2907
+ }
2908
+ /** Off, used up for the day, or refused by Google: nothing to show. Anything else still throws. */
2909
+ async orNull(call) {
2910
+ try {
2911
+ return await call();
2912
+ } catch (err) {
2913
+ if (err instanceof GoCommerceError && [404, 429, 502].includes(err.status)) return null;
2914
+ throw err;
2915
+ }
2916
+ }
2917
+ };
2918
+ var googleReviewService = new GoogleReviewService();
2919
+
2855
2920
  // src/services/menu-service.ts
2856
2921
  function linkFor(item) {
2857
2922
  const t = item.target ?? "";
@@ -3073,6 +3138,14 @@ var StoreService = class extends BaseService {
3073
3138
  ...basePlugins.isProductReviewsAndRatings,
3074
3139
  ...flag(plugins.has("product-reviews"))
3075
3140
  },
3141
+ // Google Customer Reviews (ext/google-reviews): the confirmation page's survey offer,
3142
+ // whose fields the engine builds from the order, and Google's store widget, which
3143
+ // belongs to the same programme and so needs the survey on.
3144
+ googleReviewsOptIn: {
3145
+ ...basePlugins.googleReviewsOptIn,
3146
+ ...flag(googleSetting(plugins, "customer_reviews") === true)
3147
+ },
3148
+ googleStoreWidget: storeWidget(plugins),
3076
3149
  // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
3077
3150
  // switch (D131) can only show it while that is on.
3078
3151
  newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
@@ -3115,6 +3188,12 @@ function regionName(code) {
3115
3188
  return code;
3116
3189
  }
3117
3190
  }
3191
+ var googleSetting = (plugins, key) => plugins.get("google-reviews")?.settings?.[key];
3192
+ function storeWidget(plugins) {
3193
+ const where = googleSetting(plugins, "store_widget");
3194
+ if (googleSetting(plugins, "customer_reviews") !== true || !where) return { active: false };
3195
+ return { active: true, position: where === "Bottom left" ? "LEFT_BOTTOM" : "RIGHT_BOTTOM" };
3196
+ }
3118
3197
  var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
3119
3198
 
3120
3199
  // src/services/page-service.ts
@@ -3797,6 +3876,6 @@ function attemptKey(request) {
3797
3876
  }
3798
3877
  var b2bService = new B2bService();
3799
3878
 
3800
- export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, 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, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3879
+ export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, 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, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, googleReviewService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3801
3880
  //# sourceMappingURL=index.js.map
3802
3881
  //# sourceMappingURL=index.js.map