@misiki/gocommerce-connector 0.14.0 → 0.15.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
@@ -154,7 +154,8 @@ down stays best-effort: the storefront renders from its static record.
154
154
  | newsletter box | `/x/newsletter/subscribe` |
155
155
  | contact form, product enquiries | `/x/contact/messages` |
156
156
  | 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 |
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
+ | 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 |
158
159
 
159
160
  Blogs, banners, reels, chat, warranties, deals and uploads have no engine
160
161
  equivalent. Their lists answer empty and anything that would write or open one
@@ -425,6 +425,12 @@ type StoreProfile = {
425
425
  phone: string;
426
426
  support_url: string;
427
427
  language: string;
428
+ /** Where the engine serves this store's pictures resized (D139); absent on an engine before it. */
429
+ images_path?: string;
430
+ /** The store's logo, logo for dark backgrounds and square icon (D148); empty or absent when it has none. */
431
+ logo_url?: string;
432
+ logo_dark_url?: string;
433
+ icon_url?: string;
428
434
  };
429
435
  type Vendor = {
430
436
  id: number;
@@ -6158,12 +6164,12 @@ declare const menuService: MenuService;
6158
6164
  /**
6159
6165
  * The store record every page renders from.
6160
6166
  *
6161
- * Logo, theme and the rest are the storefront's own (its static store,
6162
- * registered through `setStaticStore`); the engine has no opinion on them.
6163
- * Where the engine does have one, it wins:
6164
- * - the store's name and contact, as its owner set them in the panel. One
6165
- * storefront serves every store under `baseDomain`, so a name in the static
6166
- * record would be every store's name;
6167
+ * Theme and the rest are the storefront's own (its static store, registered
6168
+ * through `setStaticStore`); the engine has no opinion on them. Where the
6169
+ * engine does have one, it wins:
6170
+ * - the store's name, contact, logo and icon, as its owner set them in the
6171
+ * panel. One storefront serves every store under `baseDomain`, so a name or
6172
+ * a logo in the static record would be every store's;
6167
6173
  * - the settlement currency. Every price on the site is formatted with it, and
6168
6174
  * a store record saying USD over an engine charging INR would print the
6169
6175
  * wrong symbol on every price;
@@ -425,6 +425,12 @@ type StoreProfile = {
425
425
  phone: string;
426
426
  support_url: string;
427
427
  language: string;
428
+ /** Where the engine serves this store's pictures resized (D139); absent on an engine before it. */
429
+ images_path?: string;
430
+ /** The store's logo, logo for dark backgrounds and square icon (D148); empty or absent when it has none. */
431
+ logo_url?: string;
432
+ logo_dark_url?: string;
433
+ icon_url?: string;
428
434
  };
429
435
  type Vendor = {
430
436
  id: number;
@@ -6158,12 +6164,12 @@ declare const menuService: MenuService;
6158
6164
  /**
6159
6165
  * The store record every page renders from.
6160
6166
  *
6161
- * Logo, theme and the rest are the storefront's own (its static store,
6162
- * registered through `setStaticStore`); the engine has no opinion on them.
6163
- * Where the engine does have one, it wins:
6164
- * - the store's name and contact, as its owner set them in the panel. One
6165
- * storefront serves every store under `baseDomain`, so a name in the static
6166
- * record would be every store's name;
6167
+ * Theme and the rest are the storefront's own (its static store, registered
6168
+ * through `setStaticStore`); the engine has no opinion on them. Where the
6169
+ * engine does have one, it wins:
6170
+ * - the store's name, contact, logo and icon, as its owner set them in the
6171
+ * panel. One storefront serves every store under `baseDomain`, so a name or
6172
+ * a logo in the static record would be every store's;
6167
6173
  * - the settlement currency. Every price on the site is formatted with it, and
6168
6174
  * a store record saying USD over an engine charging INR would print the
6169
6175
  * wrong symbol on every price;
package/dist/index.cjs CHANGED
@@ -3043,6 +3043,12 @@ var StoreService = class extends BaseService {
3043
3043
  ...profile?.name ? { name: profile.name } : {},
3044
3044
  ...profile?.email ? { businessEmail: profile.email } : {},
3045
3045
  ...profile?.phone ? { businessPhone: profile.phone } : {},
3046
+ // The store's pictures (D148), the same: one it has not chosen keeps the static one.
3047
+ // Its own logo also replaces the static dark logo, which would be the deployment's
3048
+ // mark beside this store's; without a dark one of its own, its logo is the fallback.
3049
+ ...profile?.logo_url ? { logo: mediaUrl(profile.logo_url), logoDark: void 0 } : {},
3050
+ ...profile?.logo_dark_url ? { logoDark: mediaUrl(profile.logo_dark_url) } : {},
3051
+ ...profile?.icon_url ? { favicon: mediaUrl(profile.icon_url) } : {},
3046
3052
  currencyCode: code,
3047
3053
  currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
3048
3054
  currency: {
@@ -3065,7 +3071,18 @@ var StoreService = class extends BaseService {
3065
3071
  newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
3066
3072
  // Discount codes are core: every GoCommerce store takes them, so
3067
3073
  // the code box is shown whatever the static record says.
3068
- isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true }
3074
+ isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
3075
+ // The engine resizes the store's own pictures in Cloudflare's URL shape
3076
+ // (D139), so the storefront's srcset asks it for each width. Its public
3077
+ // origin, not the proxy path: an <img> needs no CORS, and the proxy would
3078
+ // put every picture through the storefront's server.
3079
+ ...profile?.images_path && this.creds.apiUrl ? {
3080
+ imageCdn: {
3081
+ provider: "cloudflare",
3082
+ url: this.creds.apiUrl.trim().replace(/\/+$/, "") + profile.images_path,
3083
+ active: true
3084
+ }
3085
+ } : {}
3069
3086
  },
3070
3087
  ...menus?.length ? { menu: menus } : {},
3071
3088
  ...deliverable(base, ships),