@misiki/gocommerce-connector 0.19.0 → 0.21.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, 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, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, 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, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, 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, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, 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
+ export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, 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, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, 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, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, 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, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, 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-BnLRuRag.cjs';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, 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, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, 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, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, 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, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, 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';
1
+ export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, P as Envelope, Q as FacetValue, R as Faq, S as FaqService, T as FeedbackService, U as FooterSettings, V as FreeShipping, W as Fulfillment, X as GalleryService, Y as GooglePlace, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a0 as GoogleSurvey, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a5 as IdentityAddress, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ac as ListMeta, ad as MeilisearchService, ae as Member, af as Menu, ag as MenuItem, ah as MenuService, ai as MenuSummary, aj as Money, ak as NewsletterService, al as Offer, am as OpeningHours, an as Order, ao as OrderLine, ap as OrderService, aq as PageLayout, ar as PageService, as as PaymentIntent, at as PaymentMethodService, au as Plugin, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, ay as Postcode, az as Product, aA as ProductFacets, aB as ProductOption, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aJ as Review, aK as ReviewPage, aL as ReviewService, aM as SearchDoc, aN as SearchResult, aO as SearchService, aP as SettingService, aP as SettingsService, aQ as ShippingRate, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aW as StoreProfile, aX as StoreService, aY as StorefrontCategory, aZ as StorefrontMenu, a_ as StorefrontOrder, a$ as StorefrontProduct, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b4 as Variant, b5 as VariantImage, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, b9 as Vendor, ba as VendorService, bb as WarrantyService, bc as Wishlist, bd as WishlistItem, 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, bt as currencyExponent, bu as currencyService, bv as dealService, bw as demoRequestService, bx as emptyCart, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bC as fromEngineAddress, bD as fromIdentityAddress, bE as fromSearchDoc, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, bN as minorToMajor, 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, bX as priceOf, bY as productImages, bZ as productService, b_ as productVideos, 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, cc as toAddOn, cd as toCart, ce as toCartLine, cf as toCartOffer, cg as toCategory, ch as toCmsPage, ci as toCollection, cj as toEngineAddress, ck as toFreeShipping, cl as toIdentityAddress, cm as toMajor, cn as toMinor, co as toOrder, cp as toPage, cq as toProduct, cr as toRating, cs as toStorefrontFacets, ct as toUser, cu as toVariant, cv as toVendor, 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-BnLRuRag.js';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.js CHANGED
@@ -234,6 +234,17 @@ function currentMe() {
234
234
  return null;
235
235
  }
236
236
  }
237
+ function metaBrowser() {
238
+ const fbp = readCookie("_fbp");
239
+ if (!fbp || typeof window.fbq !== "function") return void 0;
240
+ const fbc = readCookie("_fbc");
241
+ return {
242
+ fbp,
243
+ ...fbc ? { fbc } : {},
244
+ client_user_agent: window.navigator.userAgent,
245
+ event_source_url: window.location.origin + window.location.pathname
246
+ };
247
+ }
237
248
  function storedCartId() {
238
249
  const v = readLocal("cart_id");
239
250
  if (!v || v === "undefined" || v === "null") return null;
@@ -2205,11 +2216,13 @@ var CheckoutService = class extends BaseService {
2205
2216
  ...extra
2206
2217
  };
2207
2218
  const serialised = JSON.stringify(body);
2208
- const key = extras.attempt?.body === `${code}:${serialised}` ? extras.attempt.key : newKey();
2209
- saveCartExtras(id2, { attempt: { key, body: `${code}:${serialised}` } });
2219
+ const retry = extras.attempt?.body === `${code}:${serialised}`;
2220
+ const key = retry ? extras.attempt.key : newKey();
2221
+ const meta = retry ? extras.attempt?.meta : metaBrowser();
2222
+ saveCartExtras(id2, { attempt: { key, body: `${code}:${serialised}`, ...meta ? { meta } : {} } });
2210
2223
  const result = await this.data(`/api/checkout/${encodeURIComponent(code)}`, {
2211
2224
  method: "POST",
2212
- body,
2225
+ body: meta ? { ...body, metadata: { ...extra.metadata, meta_capi: meta } } : body,
2213
2226
  headers: { "Idempotency-Key": key }
2214
2227
  });
2215
2228
  if (result.order.access_token) {
@@ -3165,6 +3178,11 @@ var StoreService = class extends BaseService {
3165
3178
  // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
3166
3179
  // switch (D131) can only show it while that is on.
3167
3180
  newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) },
3181
+ // The ad and analytics tags (D160). The engine decides, not the static record:
3182
+ // one storefront serves every store, and one store's pixel must never
3183
+ // load on another's pages.
3184
+ ...adTags(plugins),
3185
+ googleTagManager: googleTags(plugins),
3168
3186
  // Discount codes are core: every GoCommerce store takes them, so
3169
3187
  // the code box is shown whatever the static record says.
3170
3188
  isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
@@ -3190,6 +3208,32 @@ var StoreService = class extends BaseService {
3190
3208
  }
3191
3209
  };
3192
3210
  var storeService = new StoreService();
3211
+ var AD_TAGS = [
3212
+ ["meta-pixel", "pixel_id", "facebookPixel"],
3213
+ ["microsoft-clarity", "project_id", "microsoftClarity"],
3214
+ ["hotjar", "site_id", "hotjar"],
3215
+ ["tiktok-pixel", "pixel_id", "tiktokPixel"],
3216
+ ["pinterest-tag", "tag_id", "pinterestTag"],
3217
+ ["snapchat-pixel", "pixel_id", "snapchatPixel"]
3218
+ ];
3219
+ function adTags(plugins) {
3220
+ return Object.fromEntries(
3221
+ AD_TAGS.map(([key, field, name]) => {
3222
+ const id2 = String(plugins.get(key)?.settings?.[field] ?? "").trim();
3223
+ return [name, id2 ? { active: true, id: id2 } : { active: false }];
3224
+ })
3225
+ );
3226
+ }
3227
+ function googleTags(plugins) {
3228
+ const s = plugins.get("google-analytics")?.settings ?? {};
3229
+ const id2 = (field) => String(s[field] ?? "").trim();
3230
+ const [account, part] = id2("conversion_label").split("/");
3231
+ const label = part === void 0 ? account : part;
3232
+ const ads = id2("google_ads_id") || (part === void 0 ? "" : account);
3233
+ const tags = [id2("ga4_measurement_id"), ads, id2("gtm_container_id")].filter(Boolean);
3234
+ if (!tags.length) return { active: false };
3235
+ return { active: true, tags, conversions: ads && label ? [{ event: "purchase", label }] : [] };
3236
+ }
3193
3237
  function deliverable(base, ships) {
3194
3238
  if (ships.everywhere || !ships.countries.length) return {};
3195
3239
  const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));