@misiki/gocommerce-connector 0.14.0 → 0.16.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.
@@ -3027,6 +3027,27 @@ var StoreService = class extends BaseService {
3027
3027
  ...profile?.name ? { name: profile.name } : {},
3028
3028
  ...profile?.email ? { businessEmail: profile.email } : {},
3029
3029
  ...profile?.phone ? { businessPhone: profile.phone } : {},
3030
+ // The store's pictures (D148), the same: one it has not chosen keeps the static one.
3031
+ // Its own logo also replaces the static dark logo, which would be the deployment's
3032
+ // mark beside this store's; without a dark one of its own, its logo is the fallback.
3033
+ ...profile?.logo_url ? { logo: mediaUrl(profile.logo_url), logoDark: void 0 } : {},
3034
+ ...profile?.logo_dark_url ? { logoDark: mediaUrl(profile.logo_dark_url) } : {},
3035
+ ...profile?.icon_url ? { favicon: mediaUrl(profile.icon_url) } : {},
3036
+ // What the contact page shows (D156), only what the store published. The address
3037
+ // in the shape the storefront's contact page and home-page JSON-LD already read. The
3038
+ // country beside it, not over `country`: that is the address form's default country.
3039
+ ...profile?.country ? { businessCountry: profile.country } : {},
3040
+ ...profile?.address ? {
3041
+ address: {
3042
+ street: [profile.address.line1, profile.address.line2].filter(Boolean).join(", "),
3043
+ city: profile.address.city,
3044
+ state: profile.address.state,
3045
+ pincode: profile.address.postal_code,
3046
+ country: profile.address.country
3047
+ }
3048
+ } : {},
3049
+ ...profile?.map_location ? { mapLocation: profile.map_location } : {},
3050
+ ...profile?.opening_hours?.length ? { openingHours: profile.opening_hours } : {},
3030
3051
  currencyCode: code,
3031
3052
  currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
3032
3053
  currency: {
@@ -3040,6 +3061,16 @@ var StoreService = class extends BaseService {
3040
3061
  // Features this connector serves from a module: on exactly when the
3041
3062
  // module is installed and switched on, whatever the static record says.
3042
3063
  isWishlist: { ...basePlugins.isWishlist, ...flag(plugins.has("wishlist")) },
3064
+ // The corner button and the contact page's WhatsApp card read the number from
3065
+ // here; the engine's plugin holds it, in international digits.
3066
+ whatsappChatButton: {
3067
+ ...basePlugins.whatsappChatButton,
3068
+ ...flag(plugins.has("whatsapp-chat")),
3069
+ ...plugins.has("whatsapp-chat") ? {
3070
+ phone: String(plugins.get("whatsapp-chat")?.settings?.phone ?? ""),
3071
+ message: String(plugins.get("whatsapp-chat")?.settings?.message ?? "")
3072
+ } : {}
3073
+ },
3043
3074
  isProductReviewsAndRatings: {
3044
3075
  ...basePlugins.isProductReviewsAndRatings,
3045
3076
  ...flag(plugins.has("product-reviews"))
@@ -3049,7 +3080,18 @@ var StoreService = class extends BaseService {
3049
3080
  newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
3050
3081
  // Discount codes are core: every GoCommerce store takes them, so
3051
3082
  // the code box is shown whatever the static record says.
3052
- isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true }
3083
+ isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
3084
+ // The engine resizes the store's own pictures in Cloudflare's URL shape
3085
+ // (D139), so the storefront's srcset asks it for each width. Its public
3086
+ // origin, not the proxy path: an <img> needs no CORS, and the proxy would
3087
+ // put every picture through the storefront's server.
3088
+ ...profile?.images_path && this.creds.apiUrl ? {
3089
+ imageCdn: {
3090
+ provider: "cloudflare",
3091
+ url: this.creds.apiUrl.trim().replace(/\/+$/, "") + profile.images_path,
3092
+ active: true
3093
+ }
3094
+ } : {}
3053
3095
  },
3054
3096
  ...menus?.length ? { menu: menus } : {},
3055
3097
  ...deliverable(base, ships),
@@ -3255,7 +3297,8 @@ var ContactService = class extends BaseService {
3255
3297
  email,
3256
3298
  phone,
3257
3299
  message,
3258
- subject
3300
+ subject,
3301
+ website
3259
3302
  }) {
3260
3303
  return this.data("/x/contact/messages", {
3261
3304
  method: "POST",
@@ -3264,7 +3307,8 @@ var ContactService = class extends BaseService {
3264
3307
  email: String(email ?? ""),
3265
3308
  ...phone ? { phone: String(phone) } : {},
3266
3309
  ...subject ? { subject: String(subject) } : {},
3267
- body: String(message ?? "")
3310
+ body: String(message ?? ""),
3311
+ ...website ? { website: String(website) } : {}
3268
3312
  }
3269
3313
  });
3270
3314
  }