@misiki/gocommerce-connector 0.15.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 +3 -2
- package/dist/{index-GdjWgh5b.d.cts → index-BsvUnF4H.d.cts} +111 -2
- package/dist/{index-GdjWgh5b.d.ts → index-BsvUnF4H.d.ts} +111 -2
- package/dist/index.cjs +110 -2
- 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 +109 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +110 -2
- 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 +109 -3
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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';
|
package/dist/services/index.d.ts
CHANGED
|
@@ -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,
|
|
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';
|
package/dist/services/index.js
CHANGED
|
@@ -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 ?? "";
|
|
@@ -3031,6 +3096,21 @@ var StoreService = class extends BaseService {
|
|
|
3031
3096
|
...profile?.logo_url ? { logo: mediaUrl(profile.logo_url), logoDark: void 0 } : {},
|
|
3032
3097
|
...profile?.logo_dark_url ? { logoDark: mediaUrl(profile.logo_dark_url) } : {},
|
|
3033
3098
|
...profile?.icon_url ? { favicon: mediaUrl(profile.icon_url) } : {},
|
|
3099
|
+
// What the contact page shows (D156), only what the store published. The address
|
|
3100
|
+
// in the shape the storefront's contact page and home-page JSON-LD already read. The
|
|
3101
|
+
// country beside it, not over `country`: that is the address form's default country.
|
|
3102
|
+
...profile?.country ? { businessCountry: profile.country } : {},
|
|
3103
|
+
...profile?.address ? {
|
|
3104
|
+
address: {
|
|
3105
|
+
street: [profile.address.line1, profile.address.line2].filter(Boolean).join(", "),
|
|
3106
|
+
city: profile.address.city,
|
|
3107
|
+
state: profile.address.state,
|
|
3108
|
+
pincode: profile.address.postal_code,
|
|
3109
|
+
country: profile.address.country
|
|
3110
|
+
}
|
|
3111
|
+
} : {},
|
|
3112
|
+
...profile?.map_location ? { mapLocation: profile.map_location } : {},
|
|
3113
|
+
...profile?.opening_hours?.length ? { openingHours: profile.opening_hours } : {},
|
|
3034
3114
|
currencyCode: code,
|
|
3035
3115
|
currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
|
|
3036
3116
|
currency: {
|
|
@@ -3044,10 +3124,28 @@ var StoreService = class extends BaseService {
|
|
|
3044
3124
|
// Features this connector serves from a module: on exactly when the
|
|
3045
3125
|
// module is installed and switched on, whatever the static record says.
|
|
3046
3126
|
isWishlist: { ...basePlugins.isWishlist, ...flag(plugins.has("wishlist")) },
|
|
3127
|
+
// The corner button and the contact page's WhatsApp card read the number from
|
|
3128
|
+
// here; the engine's plugin holds it, in international digits.
|
|
3129
|
+
whatsappChatButton: {
|
|
3130
|
+
...basePlugins.whatsappChatButton,
|
|
3131
|
+
...flag(plugins.has("whatsapp-chat")),
|
|
3132
|
+
...plugins.has("whatsapp-chat") ? {
|
|
3133
|
+
phone: String(plugins.get("whatsapp-chat")?.settings?.phone ?? ""),
|
|
3134
|
+
message: String(plugins.get("whatsapp-chat")?.settings?.message ?? "")
|
|
3135
|
+
} : {}
|
|
3136
|
+
},
|
|
3047
3137
|
isProductReviewsAndRatings: {
|
|
3048
3138
|
...basePlugins.isProductReviewsAndRatings,
|
|
3049
3139
|
...flag(plugins.has("product-reviews"))
|
|
3050
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),
|
|
3051
3149
|
// The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
|
|
3052
3150
|
// switch (D131) can only show it while that is on.
|
|
3053
3151
|
newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
|
|
@@ -3090,6 +3188,12 @@ function regionName(code) {
|
|
|
3090
3188
|
return code;
|
|
3091
3189
|
}
|
|
3092
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
|
+
}
|
|
3093
3197
|
var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
|
|
3094
3198
|
|
|
3095
3199
|
// src/services/page-service.ts
|
|
@@ -3270,7 +3374,8 @@ var ContactService = class extends BaseService {
|
|
|
3270
3374
|
email,
|
|
3271
3375
|
phone,
|
|
3272
3376
|
message,
|
|
3273
|
-
subject
|
|
3377
|
+
subject,
|
|
3378
|
+
website
|
|
3274
3379
|
}) {
|
|
3275
3380
|
return this.data("/x/contact/messages", {
|
|
3276
3381
|
method: "POST",
|
|
@@ -3279,7 +3384,8 @@ var ContactService = class extends BaseService {
|
|
|
3279
3384
|
email: String(email ?? ""),
|
|
3280
3385
|
...phone ? { phone: String(phone) } : {},
|
|
3281
3386
|
...subject ? { subject: String(subject) } : {},
|
|
3282
|
-
body: String(message ?? "")
|
|
3387
|
+
body: String(message ?? ""),
|
|
3388
|
+
...website ? { website: String(website) } : {}
|
|
3283
3389
|
}
|
|
3284
3390
|
});
|
|
3285
3391
|
}
|
|
@@ -3770,6 +3876,6 @@ function attemptKey(request) {
|
|
|
3770
3876
|
}
|
|
3771
3877
|
var b2bService = new B2bService();
|
|
3772
3878
|
|
|
3773
|
-
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 };
|
|
3774
3880
|
//# sourceMappingURL=index.js.map
|
|
3775
3881
|
//# sourceMappingURL=index.js.map
|