@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 CHANGED
@@ -142,6 +142,7 @@ down stays best-effort: the storefront renders from its static record.
142
142
  | PIN code autofill | `/api/postcodes/IN/{pin}` — `addressService.lookupPostcode({ country, postcode })`: city and state, or null when the engine has no directory or the PIN is unknown (D134) |
143
143
  | wishlist | `/x/wishlist` |
144
144
  | reviews | `/x/reviews` |
145
+ | Google reviews | `/x/google-reviews/place` — `googleReviewService.place()`: the store's Google rating, rating count and up to five Google reviews with their authors' names, photos and profile links, read live on every call because Google's terms forbid keeping them (call it when the section is in view; each call is billed to the store's Google key). Null while ext/google-reviews or its `show_place` switch is off, when the place has no ratings, when the day's lookups are spent (429) or Google refuses (502). `/x/google-reviews/survey/{number}` — `googleReviewService.survey(number)`: Google Customer Reviews' opt-in fields, built by the engine from an order placed in this browser, read with its access token; null for any other order or while `customer_reviews` is off |
145
146
  | content pages (`/p/…`, legal pages) | `/x/cms/pages` |
146
147
  | FAQ | `/x/faq` |
147
148
  | composed home page | `/x/layouts/home` (`?preview=` for a draft) — `layoutService.getHomeLayout()`, null when the store has none; carries `themeSettings` and each collection list's `collections` |
@@ -152,9 +153,9 @@ down stays best-effort: the storefront renders from its static record.
152
153
  | product specs table | the product's category attribute answers |
153
154
  | attribute filters (`?attributes.color=Red`) | `/api/products?attr=color:Red` |
154
155
  | newsletter box | `/x/newsletter/subscribe` |
155
- | contact form, product enquiries | `/x/contact/messages` |
156
+ | contact form, product enquiries | `/x/contact/messages`, with the form's hidden `website` honeypot passed on so the engine drops what a bot filled in |
156
157
  | search words, type-ahead (plugin on) | `/x/meilisearch/search`, falling back to the engine's own search when it is off or down |
157
- | store record | the storefront's own config, with the engine's currency, menus and module switches over it; the store's own logo, dark logo and icon (`logo_url`, `logo_dark_url`, `icon_url` from `/api/store`, D148) replace `logo`, `logoDark` and `favicon` when it has them |
158
+ | store record | the storefront's own config, with the engine's currency, menus and module switches over it; the store's own logo, dark logo and icon (`logo_url`, `logo_dark_url`, `icon_url` from `/api/store`, D148) replace `logo`, `logoDark` and `favicon` when it has them; for the contact page (D156), the address once the store shows it (as `address: { street, city, state, pincode, country }`), `mapLocation` and `openingHours` when set, `businessCountry` (the store's ISO country, for the phone's country code), the `whatsapp-chat` plugin's number as `plugins.whatsappChatButton`, and Google Customer Reviews (ext/google-reviews) as `plugins.googleReviewsOptIn` (`active` while the survey is on) and `plugins.googleStoreWidget` (`{ active, position: 'RIGHT_BOTTOM' \| 'LEFT_BOTTOM' }`, off without the survey) |
158
159
  | resized product pictures | `/images/{store}/cdn-cgi/image/width=…/…` — the store record's `plugins.imageCdn` is turned on with provider `cloudflare` and the engine's `images_path` (from `/api/store`, D139) after `PUBLIC_GOCOMMERCE_API_URL`, so the storefront's srcset asks the engine for each width; an engine without it leaves the static record's setting |
159
160
 
160
161
  Blogs, banners, reels, chat, warranties, deals and uploads have no engine
@@ -418,6 +418,36 @@ type Plugin = {
418
418
  title: string;
419
419
  settings: Record<string, unknown>;
420
420
  };
421
+ /** `GET /x/google-reviews/place` (ext/google-reviews): Google's answer just now, never stored. */
422
+ type GooglePlace = {
423
+ rating: number;
424
+ user_rating_count: number;
425
+ google_maps_uri: string;
426
+ reviews: {
427
+ author: {
428
+ name: string;
429
+ uri?: string;
430
+ photo_uri?: string;
431
+ };
432
+ rating: number;
433
+ text?: string;
434
+ language?: string;
435
+ relative_time?: string;
436
+ publish_time?: string;
437
+ visit_date?: string;
438
+ google_maps_uri?: string;
439
+ flag_uri?: string;
440
+ }[];
441
+ };
442
+ /** `GET /x/google-reviews/survey/{number}`: Google Customer Reviews' opt-in fields, from the order. */
443
+ type GoogleSurvey = {
444
+ merchant_id: number;
445
+ order_id: string;
446
+ email: string;
447
+ delivery_country: string;
448
+ estimated_delivery_date: string;
449
+ opt_in_style?: string;
450
+ };
421
451
  /** `GET /api/store`: what anyone may read about the shop. */
422
452
  type StoreProfile = {
423
453
  name: string;
@@ -431,6 +461,29 @@ type StoreProfile = {
431
461
  logo_url?: string;
432
462
  logo_dark_url?: string;
433
463
  icon_url?: string;
464
+ /**
465
+ * For a contact page (D156); absent on an engine before it. The address is
466
+ * null unless the store chose to show it; the map location is a Google Maps
467
+ * link or "lat,long"; the hours are one range per open day, Monday first.
468
+ * The country (ISO alpha-2) is public on its own, for the phone's country code.
469
+ */
470
+ country?: string;
471
+ address?: {
472
+ line1: string;
473
+ line2: string;
474
+ city: string;
475
+ state: string;
476
+ postal_code: string;
477
+ country: string;
478
+ } | null;
479
+ map_location?: string;
480
+ opening_hours?: OpeningHours[];
481
+ };
482
+ /** When the shop is open on one day: `day` is mon…sun, the times 24-hour HH:MM. */
483
+ type OpeningHours = {
484
+ day: string;
485
+ opens: string;
486
+ closes: string;
434
487
  };
435
488
  type Vendor = {
436
489
  id: number;
@@ -6127,6 +6180,60 @@ declare class ReviewService extends BaseService {
6127
6180
  }
6128
6181
  declare const reviewService: ReviewService;
6129
6182
 
6183
+ /** A Google review with what Google's attribution policy asks a storefront to show. */
6184
+ type GoogleReview = {
6185
+ author: string;
6186
+ /** The author's Google profile and photo; https or empty. */
6187
+ authorUrl: string;
6188
+ authorPhoto: string;
6189
+ rating: number;
6190
+ /** The reviewer's own words, in their language. Empty for a rating with no words. */
6191
+ text: string;
6192
+ language: string;
6193
+ /** Google's own words for when, such as "a month ago". */
6194
+ when: string;
6195
+ /** YYYY-MM, when Google has one. */
6196
+ visited: string;
6197
+ /** The review on Google Maps, and where to report it to Google. */
6198
+ url: string;
6199
+ reportUrl: string;
6200
+ };
6201
+ type GoogleReviews = {
6202
+ /** Google's own rating and count, never worked out from `reviews`. */
6203
+ rating: number;
6204
+ count: number;
6205
+ /** Every review, on Google Maps: `reviews` are at most five of them. */
6206
+ mapsUrl: string;
6207
+ reviews: GoogleReview[];
6208
+ };
6209
+ /**
6210
+ * The store's Google reviews and Google Customer Reviews (ext/google-reviews).
6211
+ *
6212
+ * Both calls answer null when there is nothing to show — the plugin or its
6213
+ * switch off, Google refusing, the day's lookups spent — because each is an
6214
+ * extra on a page that must render without it.
6215
+ */
6216
+ declare class GoogleReviewService extends BaseService {
6217
+ private readonly facts;
6218
+ /**
6219
+ * Google's rating and its most relevant reviews, read live. Google's terms
6220
+ * forbid keeping them, so nothing here caches them either, and every call
6221
+ * is one the store pays Google for: call it when the section is in view.
6222
+ */
6223
+ place(): Promise<GoogleReviews | null>;
6224
+ /**
6225
+ * What Google Customer Reviews' opt-in is rendered with, for an order placed
6226
+ * in this browser: its access token is kept here, and nowhere else can ask.
6227
+ * Every field is the order's own; the keys are Google's, to pass unchanged
6228
+ * to `gapi.surveyoptin.render`.
6229
+ */
6230
+ survey(orderNumber: string): Promise<GoogleSurvey | null>;
6231
+ private switchOn;
6232
+ /** Off, used up for the day, or refused by Google: nothing to show. Anything else still throws. */
6233
+ private orNull;
6234
+ }
6235
+ declare const googleReviewService: GoogleReviewService;
6236
+
6130
6237
  type StorefrontMenu = {
6131
6238
  menuId: string;
6132
6239
  name: string;
@@ -6507,12 +6614,14 @@ declare const vendorService: VendorService;
6507
6614
 
6508
6615
  /** The storefront's contact form and product enquiries, through ext/contact's inbox. */
6509
6616
  declare class ContactService extends BaseService {
6510
- submitContactUsForm({ name, email, phone, message, subject, }: {
6617
+ submitContactUsForm({ name, email, phone, message, subject, website, }: {
6511
6618
  name: string;
6512
6619
  email: string;
6513
6620
  phone?: string;
6514
6621
  message: string;
6515
6622
  subject?: string;
6623
+ /** The form's hidden honeypot, passed on so the engine drops what a bot filled in. */
6624
+ website?: string;
6516
6625
  }): Promise<{
6517
6626
  status: string;
6518
6627
  }>;
@@ -7584,4 +7693,4 @@ declare class B2bService extends BaseService {
7584
7693
  }
7585
7694
  declare const b2bService: B2bService;
7586
7695
 
7587
- export { HomeService as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type CompanyOrder as D, ContactService as E, CountryService as F, CouponService as G, type Credentials as H, type Credit as I, CurrencyService as J, type Customer as K, DealService as L, DemoRequestService as M, type EngineRequest as N, EnquiryService as O, type Envelope as P, type FacetValue as Q, type Faq as R, FaqService as S, FeedbackService as T, type FooterSettings as U, type FreeShipping as V, type Fulfillment as W, GalleryService as X, type HeaderSettings as Y, type HomeLayout as Z, type HomeLayoutSection as _, type Address as a, type VariantImage as a$, type IdentityAddress as a0, InitService as a1, type Invitation as a2, type LayoutCollection as a3, type LayoutPage as a4, LayoutService as a5, type Lead as a6, type ListMeta as a7, MeilisearchService as a8, type Member as a9, ReelsService as aA, RegionService as aB, type RejectedLine as aC, type Review as aD, type ReviewPage as aE, ReviewService as aF, type SearchDoc as aG, type SearchResult as aH, SearchService as aI, SettingService as aJ, type ShippingRate as aK, type SiteChrome as aL, type SiteFooter as aM, type SiteHeader as aN, type SocialLink as aO, StateService as aP, type StoreProfile as aQ, StoreService as aR, type StorefrontCategory as aS, type StorefrontMenu as aT, type StorefrontOrder as aU, type StorefrontProduct as aV, type ThemeSettings as aW, type ThemeSettingsResult as aX, UploadService as aY, UserService as aZ, type Variant as a_, type Menu as aa, type MenuItem as ab, MenuService as ac, type MenuSummary as ad, type Money as ae, NewsletterService as af, type Offer as ag, type Order as ah, type OrderLine as ai, OrderService as aj, type PageLayout as ak, PageService as al, type PaymentIntent as am, PaymentMethodService as an, type Plugin as ao, PluginService as ap, PopularSearchService as aq, PopularityService as ar, type Postcode as as, type Product as at, type ProductFacets as au, type ProductOption as av, ProductService as aw, ProfileService as ax, type Quote as ay, REDIRECT_GATEWAYS as az, AddressService as b, settingService as b$, VariantService as b0, VarniCustomDesignService as b1, VarniCustomProductService as b2, type Vendor as b3, VendorService as b4, WarrantyService as b5, type Wishlist as b6, type WishlistItem as b7, WishlistService as b8, addressService as b9, homeService as bA, initService as bB, layoutService as bC, mediaUrl as bD, meilisearchService as bE, menuService as bF, minorToMajor as bG, newsletterService as bH, orderService as bI, ownDomain as bJ, pageService as bK, paymentMethodService as bL, pluginService as bM, pluginsService as bN, popularSearchService as bO, popularityService as bP, priceOf as bQ, productImages as bR, productService as bS, productVideos as bT, profileService as bU, qs as bV, reelsService as bW, regionService as bX, reviewService as bY, searchService as bZ, setRequestHost as b_, authService as ba, autocompleteService as bb, b2bService as bc, bannerService as bd, blogService as be, cartService as bf, categoryService as bg, chatService as bh, checkoutService as bi, collectionService as bj, contactService as bk, countryService as bl, couponService as bm, currencyExponent as bn, currencyService as bo, dealService as bp, demoRequestService as bq, emptyCart as br, emptyPage as bs, enquiryService as bt, faqService as bu, feedbackService as bv, fromEngineAddress as bw, fromIdentityAddress as bx, fromSearchDoc as by, galleryService as bz, type AppliedDiscount as c, settingsService as c0, stateService as c1, staticStore as c2, storeForHost as c3, storeService as c4, toAddOn as c5, toCart as c6, toCartLine as c7, toCartOffer as c8, toCategory as c9, toCmsPage as ca, toCollection as cb, toEngineAddress as cc, toFreeShipping as cd, toIdentityAddress as ce, toMajor as cf, toMinor as cg, toOrder as ch, toPage as ci, toProduct as cj, toRating as ck, toStorefrontFacets as cl, toUser as cm, toVariant as cn, toVendor as co, uploadService as cp, userService as cq, variantService as cr, varniCustomDesignService as cs, varniCustomProductService as ct, vendorService as cu, warrantyService as cv, wishlistService as cw, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutResult as u, CheckoutService as v, type CmsPage as w, type Collection as x, CollectionService as y, type Company as z };
7696
+ export { type GoogleReviews as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type CompanyOrder as D, ContactService as E, CountryService as F, CouponService as G, type Credentials as H, type Credit as I, CurrencyService as J, type Customer as K, DealService as L, DemoRequestService as M, type EngineRequest as N, EnquiryService as O, type Envelope as P, type FacetValue as Q, type Faq as R, FaqService as S, FeedbackService as T, type FooterSettings as U, type FreeShipping as V, type Fulfillment as W, GalleryService as X, type GooglePlace as Y, type GoogleReview as Z, GoogleReviewService as _, type Address as a, type StorefrontProduct as a$, type GoogleSurvey as a0, type HeaderSettings as a1, type HomeLayout as a2, type HomeLayoutSection as a3, HomeService as a4, type IdentityAddress as a5, InitService as a6, type Invitation as a7, type LayoutCollection as a8, type LayoutPage as a9, type ProductFacets as aA, type ProductOption as aB, ProductService as aC, ProfileService as aD, type Quote as aE, REDIRECT_GATEWAYS as aF, ReelsService as aG, RegionService as aH, type RejectedLine as aI, type Review as aJ, type ReviewPage as aK, ReviewService as aL, type SearchDoc as aM, type SearchResult as aN, SearchService as aO, SettingService as aP, type ShippingRate as aQ, type SiteChrome as aR, type SiteFooter as aS, type SiteHeader as aT, type SocialLink as aU, StateService as aV, type StoreProfile as aW, StoreService as aX, type StorefrontCategory as aY, type StorefrontMenu as aZ, type StorefrontOrder as a_, LayoutService as aa, type Lead as ab, type ListMeta as ac, MeilisearchService as ad, type Member as ae, type Menu as af, type MenuItem as ag, MenuService as ah, type MenuSummary as ai, type Money as aj, NewsletterService as ak, type Offer as al, type OpeningHours as am, type Order as an, type OrderLine as ao, OrderService as ap, type PageLayout as aq, PageService as ar, type PaymentIntent as as, PaymentMethodService as at, type Plugin as au, PluginService as av, PopularSearchService as aw, PopularityService as ax, type Postcode as ay, type Product as az, AddressService as b, profileService as b$, type ThemeSettings as b0, type ThemeSettingsResult as b1, UploadService as b2, UserService as b3, type Variant as b4, type VariantImage as b5, VariantService as b6, VarniCustomDesignService as b7, VarniCustomProductService as b8, type Vendor as b9, faqService as bA, feedbackService as bB, fromEngineAddress as bC, fromIdentityAddress as bD, fromSearchDoc as bE, galleryService as bF, googleReviewService as bG, homeService as bH, initService as bI, layoutService as bJ, mediaUrl as bK, meilisearchService as bL, menuService as bM, minorToMajor as bN, newsletterService as bO, orderService as bP, ownDomain as bQ, pageService as bR, paymentMethodService as bS, pluginService as bT, pluginsService as bU, popularSearchService as bV, popularityService as bW, priceOf as bX, productImages as bY, productService as bZ, productVideos as b_, VendorService as ba, WarrantyService as bb, type Wishlist as bc, type WishlistItem as bd, WishlistService as be, addressService as bf, authService as bg, autocompleteService as bh, b2bService as bi, bannerService as bj, blogService as bk, cartService as bl, categoryService as bm, chatService as bn, checkoutService as bo, collectionService as bp, contactService as bq, countryService as br, couponService as bs, currencyExponent as bt, currencyService as bu, dealService as bv, demoRequestService as bw, emptyCart as bx, emptyPage as by, enquiryService as bz, type AppliedDiscount as c, qs as c0, reelsService as c1, regionService as c2, reviewService as c3, searchService as c4, setRequestHost as c5, settingService as c6, settingsService as c7, stateService as c8, staticStore as c9, varniCustomProductService as cA, vendorService as cB, warrantyService as cC, wishlistService as cD, storeForHost as ca, storeService as cb, toAddOn as cc, toCart as cd, toCartLine as ce, toCartOffer as cf, toCategory as cg, toCmsPage as ch, toCollection as ci, toEngineAddress as cj, toFreeShipping as ck, toIdentityAddress as cl, toMajor as cm, toMinor as cn, toOrder as co, toPage as cp, toProduct as cq, toRating as cr, toStorefrontFacets as cs, toUser as ct, toVariant as cu, toVendor as cv, uploadService as cw, userService as cx, variantService as cy, varniCustomDesignService as cz, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutResult as u, CheckoutService as v, type CmsPage as w, type Collection as x, CollectionService as y, type Company as z };
@@ -418,6 +418,36 @@ type Plugin = {
418
418
  title: string;
419
419
  settings: Record<string, unknown>;
420
420
  };
421
+ /** `GET /x/google-reviews/place` (ext/google-reviews): Google's answer just now, never stored. */
422
+ type GooglePlace = {
423
+ rating: number;
424
+ user_rating_count: number;
425
+ google_maps_uri: string;
426
+ reviews: {
427
+ author: {
428
+ name: string;
429
+ uri?: string;
430
+ photo_uri?: string;
431
+ };
432
+ rating: number;
433
+ text?: string;
434
+ language?: string;
435
+ relative_time?: string;
436
+ publish_time?: string;
437
+ visit_date?: string;
438
+ google_maps_uri?: string;
439
+ flag_uri?: string;
440
+ }[];
441
+ };
442
+ /** `GET /x/google-reviews/survey/{number}`: Google Customer Reviews' opt-in fields, from the order. */
443
+ type GoogleSurvey = {
444
+ merchant_id: number;
445
+ order_id: string;
446
+ email: string;
447
+ delivery_country: string;
448
+ estimated_delivery_date: string;
449
+ opt_in_style?: string;
450
+ };
421
451
  /** `GET /api/store`: what anyone may read about the shop. */
422
452
  type StoreProfile = {
423
453
  name: string;
@@ -431,6 +461,29 @@ type StoreProfile = {
431
461
  logo_url?: string;
432
462
  logo_dark_url?: string;
433
463
  icon_url?: string;
464
+ /**
465
+ * For a contact page (D156); absent on an engine before it. The address is
466
+ * null unless the store chose to show it; the map location is a Google Maps
467
+ * link or "lat,long"; the hours are one range per open day, Monday first.
468
+ * The country (ISO alpha-2) is public on its own, for the phone's country code.
469
+ */
470
+ country?: string;
471
+ address?: {
472
+ line1: string;
473
+ line2: string;
474
+ city: string;
475
+ state: string;
476
+ postal_code: string;
477
+ country: string;
478
+ } | null;
479
+ map_location?: string;
480
+ opening_hours?: OpeningHours[];
481
+ };
482
+ /** When the shop is open on one day: `day` is mon…sun, the times 24-hour HH:MM. */
483
+ type OpeningHours = {
484
+ day: string;
485
+ opens: string;
486
+ closes: string;
434
487
  };
435
488
  type Vendor = {
436
489
  id: number;
@@ -6127,6 +6180,60 @@ declare class ReviewService extends BaseService {
6127
6180
  }
6128
6181
  declare const reviewService: ReviewService;
6129
6182
 
6183
+ /** A Google review with what Google's attribution policy asks a storefront to show. */
6184
+ type GoogleReview = {
6185
+ author: string;
6186
+ /** The author's Google profile and photo; https or empty. */
6187
+ authorUrl: string;
6188
+ authorPhoto: string;
6189
+ rating: number;
6190
+ /** The reviewer's own words, in their language. Empty for a rating with no words. */
6191
+ text: string;
6192
+ language: string;
6193
+ /** Google's own words for when, such as "a month ago". */
6194
+ when: string;
6195
+ /** YYYY-MM, when Google has one. */
6196
+ visited: string;
6197
+ /** The review on Google Maps, and where to report it to Google. */
6198
+ url: string;
6199
+ reportUrl: string;
6200
+ };
6201
+ type GoogleReviews = {
6202
+ /** Google's own rating and count, never worked out from `reviews`. */
6203
+ rating: number;
6204
+ count: number;
6205
+ /** Every review, on Google Maps: `reviews` are at most five of them. */
6206
+ mapsUrl: string;
6207
+ reviews: GoogleReview[];
6208
+ };
6209
+ /**
6210
+ * The store's Google reviews and Google Customer Reviews (ext/google-reviews).
6211
+ *
6212
+ * Both calls answer null when there is nothing to show — the plugin or its
6213
+ * switch off, Google refusing, the day's lookups spent — because each is an
6214
+ * extra on a page that must render without it.
6215
+ */
6216
+ declare class GoogleReviewService extends BaseService {
6217
+ private readonly facts;
6218
+ /**
6219
+ * Google's rating and its most relevant reviews, read live. Google's terms
6220
+ * forbid keeping them, so nothing here caches them either, and every call
6221
+ * is one the store pays Google for: call it when the section is in view.
6222
+ */
6223
+ place(): Promise<GoogleReviews | null>;
6224
+ /**
6225
+ * What Google Customer Reviews' opt-in is rendered with, for an order placed
6226
+ * in this browser: its access token is kept here, and nowhere else can ask.
6227
+ * Every field is the order's own; the keys are Google's, to pass unchanged
6228
+ * to `gapi.surveyoptin.render`.
6229
+ */
6230
+ survey(orderNumber: string): Promise<GoogleSurvey | null>;
6231
+ private switchOn;
6232
+ /** Off, used up for the day, or refused by Google: nothing to show. Anything else still throws. */
6233
+ private orNull;
6234
+ }
6235
+ declare const googleReviewService: GoogleReviewService;
6236
+
6130
6237
  type StorefrontMenu = {
6131
6238
  menuId: string;
6132
6239
  name: string;
@@ -6507,12 +6614,14 @@ declare const vendorService: VendorService;
6507
6614
 
6508
6615
  /** The storefront's contact form and product enquiries, through ext/contact's inbox. */
6509
6616
  declare class ContactService extends BaseService {
6510
- submitContactUsForm({ name, email, phone, message, subject, }: {
6617
+ submitContactUsForm({ name, email, phone, message, subject, website, }: {
6511
6618
  name: string;
6512
6619
  email: string;
6513
6620
  phone?: string;
6514
6621
  message: string;
6515
6622
  subject?: string;
6623
+ /** The form's hidden honeypot, passed on so the engine drops what a bot filled in. */
6624
+ website?: string;
6516
6625
  }): Promise<{
6517
6626
  status: string;
6518
6627
  }>;
@@ -7584,4 +7693,4 @@ declare class B2bService extends BaseService {
7584
7693
  }
7585
7694
  declare const b2bService: B2bService;
7586
7695
 
7587
- export { HomeService as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type CompanyOrder as D, ContactService as E, CountryService as F, CouponService as G, type Credentials as H, type Credit as I, CurrencyService as J, type Customer as K, DealService as L, DemoRequestService as M, type EngineRequest as N, EnquiryService as O, type Envelope as P, type FacetValue as Q, type Faq as R, FaqService as S, FeedbackService as T, type FooterSettings as U, type FreeShipping as V, type Fulfillment as W, GalleryService as X, type HeaderSettings as Y, type HomeLayout as Z, type HomeLayoutSection as _, type Address as a, type VariantImage as a$, type IdentityAddress as a0, InitService as a1, type Invitation as a2, type LayoutCollection as a3, type LayoutPage as a4, LayoutService as a5, type Lead as a6, type ListMeta as a7, MeilisearchService as a8, type Member as a9, ReelsService as aA, RegionService as aB, type RejectedLine as aC, type Review as aD, type ReviewPage as aE, ReviewService as aF, type SearchDoc as aG, type SearchResult as aH, SearchService as aI, SettingService as aJ, type ShippingRate as aK, type SiteChrome as aL, type SiteFooter as aM, type SiteHeader as aN, type SocialLink as aO, StateService as aP, type StoreProfile as aQ, StoreService as aR, type StorefrontCategory as aS, type StorefrontMenu as aT, type StorefrontOrder as aU, type StorefrontProduct as aV, type ThemeSettings as aW, type ThemeSettingsResult as aX, UploadService as aY, UserService as aZ, type Variant as a_, type Menu as aa, type MenuItem as ab, MenuService as ac, type MenuSummary as ad, type Money as ae, NewsletterService as af, type Offer as ag, type Order as ah, type OrderLine as ai, OrderService as aj, type PageLayout as ak, PageService as al, type PaymentIntent as am, PaymentMethodService as an, type Plugin as ao, PluginService as ap, PopularSearchService as aq, PopularityService as ar, type Postcode as as, type Product as at, type ProductFacets as au, type ProductOption as av, ProductService as aw, ProfileService as ax, type Quote as ay, REDIRECT_GATEWAYS as az, AddressService as b, settingService as b$, VariantService as b0, VarniCustomDesignService as b1, VarniCustomProductService as b2, type Vendor as b3, VendorService as b4, WarrantyService as b5, type Wishlist as b6, type WishlistItem as b7, WishlistService as b8, addressService as b9, homeService as bA, initService as bB, layoutService as bC, mediaUrl as bD, meilisearchService as bE, menuService as bF, minorToMajor as bG, newsletterService as bH, orderService as bI, ownDomain as bJ, pageService as bK, paymentMethodService as bL, pluginService as bM, pluginsService as bN, popularSearchService as bO, popularityService as bP, priceOf as bQ, productImages as bR, productService as bS, productVideos as bT, profileService as bU, qs as bV, reelsService as bW, regionService as bX, reviewService as bY, searchService as bZ, setRequestHost as b_, authService as ba, autocompleteService as bb, b2bService as bc, bannerService as bd, blogService as be, cartService as bf, categoryService as bg, chatService as bh, checkoutService as bi, collectionService as bj, contactService as bk, countryService as bl, couponService as bm, currencyExponent as bn, currencyService as bo, dealService as bp, demoRequestService as bq, emptyCart as br, emptyPage as bs, enquiryService as bt, faqService as bu, feedbackService as bv, fromEngineAddress as bw, fromIdentityAddress as bx, fromSearchDoc as by, galleryService as bz, type AppliedDiscount as c, settingsService as c0, stateService as c1, staticStore as c2, storeForHost as c3, storeService as c4, toAddOn as c5, toCart as c6, toCartLine as c7, toCartOffer as c8, toCategory as c9, toCmsPage as ca, toCollection as cb, toEngineAddress as cc, toFreeShipping as cd, toIdentityAddress as ce, toMajor as cf, toMinor as cg, toOrder as ch, toPage as ci, toProduct as cj, toRating as ck, toStorefrontFacets as cl, toUser as cm, toVariant as cn, toVendor as co, uploadService as cp, userService as cq, variantService as cr, varniCustomDesignService as cs, varniCustomProductService as ct, vendorService as cu, warrantyService as cv, wishlistService as cw, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutResult as u, CheckoutService as v, type CmsPage as w, type Collection as x, CollectionService as y, type Company as z };
7696
+ export { type GoogleReviews as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type CompanyOrder as D, ContactService as E, CountryService as F, CouponService as G, type Credentials as H, type Credit as I, CurrencyService as J, type Customer as K, DealService as L, DemoRequestService as M, type EngineRequest as N, EnquiryService as O, type Envelope as P, type FacetValue as Q, type Faq as R, FaqService as S, FeedbackService as T, type FooterSettings as U, type FreeShipping as V, type Fulfillment as W, GalleryService as X, type GooglePlace as Y, type GoogleReview as Z, GoogleReviewService as _, type Address as a, type StorefrontProduct as a$, type GoogleSurvey as a0, type HeaderSettings as a1, type HomeLayout as a2, type HomeLayoutSection as a3, HomeService as a4, type IdentityAddress as a5, InitService as a6, type Invitation as a7, type LayoutCollection as a8, type LayoutPage as a9, type ProductFacets as aA, type ProductOption as aB, ProductService as aC, ProfileService as aD, type Quote as aE, REDIRECT_GATEWAYS as aF, ReelsService as aG, RegionService as aH, type RejectedLine as aI, type Review as aJ, type ReviewPage as aK, ReviewService as aL, type SearchDoc as aM, type SearchResult as aN, SearchService as aO, SettingService as aP, type ShippingRate as aQ, type SiteChrome as aR, type SiteFooter as aS, type SiteHeader as aT, type SocialLink as aU, StateService as aV, type StoreProfile as aW, StoreService as aX, type StorefrontCategory as aY, type StorefrontMenu as aZ, type StorefrontOrder as a_, LayoutService as aa, type Lead as ab, type ListMeta as ac, MeilisearchService as ad, type Member as ae, type Menu as af, type MenuItem as ag, MenuService as ah, type MenuSummary as ai, type Money as aj, NewsletterService as ak, type Offer as al, type OpeningHours as am, type Order as an, type OrderLine as ao, OrderService as ap, type PageLayout as aq, PageService as ar, type PaymentIntent as as, PaymentMethodService as at, type Plugin as au, PluginService as av, PopularSearchService as aw, PopularityService as ax, type Postcode as ay, type Product as az, AddressService as b, profileService as b$, type ThemeSettings as b0, type ThemeSettingsResult as b1, UploadService as b2, UserService as b3, type Variant as b4, type VariantImage as b5, VariantService as b6, VarniCustomDesignService as b7, VarniCustomProductService as b8, type Vendor as b9, faqService as bA, feedbackService as bB, fromEngineAddress as bC, fromIdentityAddress as bD, fromSearchDoc as bE, galleryService as bF, googleReviewService as bG, homeService as bH, initService as bI, layoutService as bJ, mediaUrl as bK, meilisearchService as bL, menuService as bM, minorToMajor as bN, newsletterService as bO, orderService as bP, ownDomain as bQ, pageService as bR, paymentMethodService as bS, pluginService as bT, pluginsService as bU, popularSearchService as bV, popularityService as bW, priceOf as bX, productImages as bY, productService as bZ, productVideos as b_, VendorService as ba, WarrantyService as bb, type Wishlist as bc, type WishlistItem as bd, WishlistService as be, addressService as bf, authService as bg, autocompleteService as bh, b2bService as bi, bannerService as bj, blogService as bk, cartService as bl, categoryService as bm, chatService as bn, checkoutService as bo, collectionService as bp, contactService as bq, countryService as br, couponService as bs, currencyExponent as bt, currencyService as bu, dealService as bv, demoRequestService as bw, emptyCart as bx, emptyPage as by, enquiryService as bz, type AppliedDiscount as c, qs as c0, reelsService as c1, regionService as c2, reviewService as c3, searchService as c4, setRequestHost as c5, settingService as c6, settingsService as c7, stateService as c8, staticStore as c9, varniCustomProductService as cA, vendorService as cB, warrantyService as cC, wishlistService as cD, storeForHost as ca, storeService as cb, toAddOn as cc, toCart as cd, toCartLine as ce, toCartOffer as cf, toCategory as cg, toCmsPage as ch, toCollection as ci, toEngineAddress as cj, toFreeShipping as ck, toIdentityAddress as cl, toMajor as cm, toMinor as cn, toOrder as co, toPage as cp, toProduct as cq, toRating as cr, toStorefrontFacets as cs, toUser as ct, toVariant as cu, toVendor as cv, uploadService as cw, userService as cx, variantService as cy, varniCustomDesignService as cz, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutResult as u, CheckoutService as v, type CmsPage as w, type Collection as x, CollectionService as y, type Company as z };
package/dist/index.cjs CHANGED
@@ -2873,6 +2873,71 @@ var ReviewService = class extends BaseService {
2873
2873
  };
2874
2874
  var reviewService = new ReviewService();
2875
2875
 
2876
+ // src/services/google-review-service.ts
2877
+ var PLUGIN = "google-reviews";
2878
+ var GoogleReviewService = class extends BaseService {
2879
+ facts = new StoreFacts(this._fetch);
2880
+ /**
2881
+ * Google's rating and its most relevant reviews, read live. Google's terms
2882
+ * forbid keeping them, so nothing here caches them either, and every call
2883
+ * is one the store pays Google for: call it when the section is in view.
2884
+ */
2885
+ async place() {
2886
+ if (!await this.switchOn("show_place")) return null;
2887
+ const p = await this.orNull(() => this.data("/x/google-reviews/place"));
2888
+ if (!p?.user_rating_count) return null;
2889
+ return {
2890
+ rating: p.rating,
2891
+ count: p.user_rating_count,
2892
+ mapsUrl: p.google_maps_uri ?? "",
2893
+ reviews: (p.reviews ?? []).map((r) => ({
2894
+ author: r.author?.name ?? "",
2895
+ authorUrl: r.author?.uri ?? "",
2896
+ authorPhoto: r.author?.photo_uri ?? "",
2897
+ rating: r.rating,
2898
+ text: r.text ?? "",
2899
+ language: r.language ?? "",
2900
+ when: r.relative_time ?? "",
2901
+ visited: r.visit_date ?? "",
2902
+ url: r.google_maps_uri ?? "",
2903
+ reportUrl: r.flag_uri ?? ""
2904
+ }))
2905
+ };
2906
+ }
2907
+ /**
2908
+ * What Google Customer Reviews' opt-in is rendered with, for an order placed
2909
+ * in this browser: its access token is kept here, and nowhere else can ask.
2910
+ * Every field is the order's own; the keys are Google's, to pass unchanged
2911
+ * to `gapi.surveyoptin.render`.
2912
+ */
2913
+ async survey(orderNumber) {
2914
+ const kept = orderNumber ? placedOrder(orderNumber) : void 0;
2915
+ if (!kept || !await this.switchOn("customer_reviews")) return null;
2916
+ return this.orNull(
2917
+ () => this.data(`/x/google-reviews/survey/${encodeURIComponent(orderNumber)}`, {
2918
+ query: { token: kept.token }
2919
+ })
2920
+ );
2921
+ }
2922
+ async switchOn(setting) {
2923
+ try {
2924
+ return (await this.facts.plugins()).get(PLUGIN)?.settings?.[setting] === true;
2925
+ } catch {
2926
+ return false;
2927
+ }
2928
+ }
2929
+ /** Off, used up for the day, or refused by Google: nothing to show. Anything else still throws. */
2930
+ async orNull(call) {
2931
+ try {
2932
+ return await call();
2933
+ } catch (err) {
2934
+ if (err instanceof GoCommerceError && [404, 429, 502].includes(err.status)) return null;
2935
+ throw err;
2936
+ }
2937
+ }
2938
+ };
2939
+ var googleReviewService = new GoogleReviewService();
2940
+
2876
2941
  // src/services/menu-service.ts
2877
2942
  function linkFor(item) {
2878
2943
  const t = item.target ?? "";
@@ -3049,6 +3114,21 @@ var StoreService = class extends BaseService {
3049
3114
  ...profile?.logo_url ? { logo: mediaUrl(profile.logo_url), logoDark: void 0 } : {},
3050
3115
  ...profile?.logo_dark_url ? { logoDark: mediaUrl(profile.logo_dark_url) } : {},
3051
3116
  ...profile?.icon_url ? { favicon: mediaUrl(profile.icon_url) } : {},
3117
+ // What the contact page shows (D156), only what the store published. The address
3118
+ // in the shape the storefront's contact page and home-page JSON-LD already read. The
3119
+ // country beside it, not over `country`: that is the address form's default country.
3120
+ ...profile?.country ? { businessCountry: profile.country } : {},
3121
+ ...profile?.address ? {
3122
+ address: {
3123
+ street: [profile.address.line1, profile.address.line2].filter(Boolean).join(", "),
3124
+ city: profile.address.city,
3125
+ state: profile.address.state,
3126
+ pincode: profile.address.postal_code,
3127
+ country: profile.address.country
3128
+ }
3129
+ } : {},
3130
+ ...profile?.map_location ? { mapLocation: profile.map_location } : {},
3131
+ ...profile?.opening_hours?.length ? { openingHours: profile.opening_hours } : {},
3052
3132
  currencyCode: code,
3053
3133
  currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
3054
3134
  currency: {
@@ -3062,10 +3142,28 @@ var StoreService = class extends BaseService {
3062
3142
  // Features this connector serves from a module: on exactly when the
3063
3143
  // module is installed and switched on, whatever the static record says.
3064
3144
  isWishlist: { ...basePlugins.isWishlist, ...flag(plugins.has("wishlist")) },
3145
+ // The corner button and the contact page's WhatsApp card read the number from
3146
+ // here; the engine's plugin holds it, in international digits.
3147
+ whatsappChatButton: {
3148
+ ...basePlugins.whatsappChatButton,
3149
+ ...flag(plugins.has("whatsapp-chat")),
3150
+ ...plugins.has("whatsapp-chat") ? {
3151
+ phone: String(plugins.get("whatsapp-chat")?.settings?.phone ?? ""),
3152
+ message: String(plugins.get("whatsapp-chat")?.settings?.message ?? "")
3153
+ } : {}
3154
+ },
3065
3155
  isProductReviewsAndRatings: {
3066
3156
  ...basePlugins.isProductReviewsAndRatings,
3067
3157
  ...flag(plugins.has("product-reviews"))
3068
3158
  },
3159
+ // Google Customer Reviews (ext/google-reviews): the confirmation page's survey offer,
3160
+ // whose fields the engine builds from the order, and Google's store widget, which
3161
+ // belongs to the same programme and so needs the survey on.
3162
+ googleReviewsOptIn: {
3163
+ ...basePlugins.googleReviewsOptIn,
3164
+ ...flag(googleSetting(plugins, "customer_reviews") === true)
3165
+ },
3166
+ googleStoreWidget: storeWidget(plugins),
3069
3167
  // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
3070
3168
  // switch (D131) can only show it while that is on.
3071
3169
  newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
@@ -3108,6 +3206,12 @@ function regionName(code) {
3108
3206
  return code;
3109
3207
  }
3110
3208
  }
3209
+ var googleSetting = (plugins, key) => plugins.get("google-reviews")?.settings?.[key];
3210
+ function storeWidget(plugins) {
3211
+ const where = googleSetting(plugins, "store_widget");
3212
+ if (googleSetting(plugins, "customer_reviews") !== true || !where) return { active: false };
3213
+ return { active: true, position: where === "Bottom left" ? "LEFT_BOTTOM" : "RIGHT_BOTTOM" };
3214
+ }
3111
3215
  var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
3112
3216
 
3113
3217
  // src/services/page-service.ts
@@ -3288,7 +3392,8 @@ var ContactService = class extends BaseService {
3288
3392
  email,
3289
3393
  phone,
3290
3394
  message,
3291
- subject
3395
+ subject,
3396
+ website
3292
3397
  }) {
3293
3398
  return this.data("/x/contact/messages", {
3294
3399
  method: "POST",
@@ -3297,7 +3402,8 @@ var ContactService = class extends BaseService {
3297
3402
  email: String(email ?? ""),
3298
3403
  ...phone ? { phone: String(phone) } : {},
3299
3404
  ...subject ? { subject: String(subject) } : {},
3300
- body: String(message ?? "")
3405
+ body: String(message ?? ""),
3406
+ ...website ? { website: String(website) } : {}
3301
3407
  }
3302
3408
  });
3303
3409
  }
@@ -3812,6 +3918,7 @@ exports.FaqService = FaqService;
3812
3918
  exports.FeedbackService = FeedbackService;
3813
3919
  exports.GalleryService = GalleryService;
3814
3920
  exports.GoCommerceError = GoCommerceError;
3921
+ exports.GoogleReviewService = GoogleReviewService;
3815
3922
  exports.HomeService = HomeService;
3816
3923
  exports.InitService = InitService;
3817
3924
  exports.LayoutService = LayoutService;
@@ -3874,6 +3981,7 @@ exports.fromEngineAddress = fromEngineAddress;
3874
3981
  exports.fromIdentityAddress = fromIdentityAddress;
3875
3982
  exports.fromSearchDoc = fromSearchDoc;
3876
3983
  exports.galleryService = galleryService;
3984
+ exports.googleReviewService = googleReviewService;
3877
3985
  exports.hasStaticStore = hasStaticStore;
3878
3986
  exports.homeService = homeService;
3879
3987
  exports.initService = initService;