@misiki/gocommerce-connector 0.20.0 → 0.22.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-BnLRuRag.d.cts → index-CIhSE2qR.d.cts} +1 -0
- package/dist/{index-BnLRuRag.d.ts → index-CIhSE2qR.d.ts} +1 -0
- package/dist/index.cjs +56 -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 +56 -2
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +56 -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 +56 -2
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
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-
|
|
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-CIhSE2qR.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-
|
|
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-CIhSE2qR.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The two ways a call through this connector fails.
|
package/dist/index.js
CHANGED
|
@@ -245,6 +245,41 @@ function metaBrowser() {
|
|
|
245
245
|
event_source_url: window.location.origin + window.location.pathname
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
+
var ATTRIBUTION_KEY = "gc_attribution";
|
|
249
|
+
var ATTRIBUTION_DAYS = 30;
|
|
250
|
+
var TOUCH_FIELDS = [
|
|
251
|
+
"utm_source",
|
|
252
|
+
"utm_medium",
|
|
253
|
+
"utm_campaign",
|
|
254
|
+
"utm_content",
|
|
255
|
+
"utm_term",
|
|
256
|
+
"gclid",
|
|
257
|
+
"gbraid",
|
|
258
|
+
"wbraid",
|
|
259
|
+
"fbclid",
|
|
260
|
+
"ttclid",
|
|
261
|
+
"msclkid",
|
|
262
|
+
"referrer",
|
|
263
|
+
"at"
|
|
264
|
+
];
|
|
265
|
+
function cleanTouch(raw, now) {
|
|
266
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
267
|
+
const at = Date.parse(String(raw.at ?? ""));
|
|
268
|
+
if (!Number.isFinite(at) || now - at > ATTRIBUTION_DAYS * 864e5 || at - now > 864e5) return void 0;
|
|
269
|
+
const out = {};
|
|
270
|
+
for (const k of TOUCH_FIELDS) {
|
|
271
|
+
const v = raw[k];
|
|
272
|
+
if (typeof v === "string" && v.trim()) out[k] = v.trim().slice(0, 200);
|
|
273
|
+
}
|
|
274
|
+
return Object.keys(out).length > 1 ? out : void 0;
|
|
275
|
+
}
|
|
276
|
+
function landingAttribution(now = Date.now()) {
|
|
277
|
+
const saved = readJSON(ATTRIBUTION_KEY);
|
|
278
|
+
const last = cleanTouch(saved?.last, now);
|
|
279
|
+
const first = cleanTouch(saved?.first, now) ?? last;
|
|
280
|
+
if (!first && !last) return void 0;
|
|
281
|
+
return { ...first ? { first } : {}, ...last ? { last } : {} };
|
|
282
|
+
}
|
|
248
283
|
function storedCartId() {
|
|
249
284
|
const v = readLocal("cart_id");
|
|
250
285
|
if (!v || v === "undefined" || v === "null") return null;
|
|
@@ -2219,10 +2254,18 @@ var CheckoutService = class extends BaseService {
|
|
|
2219
2254
|
const retry = extras.attempt?.body === `${code}:${serialised}`;
|
|
2220
2255
|
const key = retry ? extras.attempt.key : newKey();
|
|
2221
2256
|
const meta = retry ? extras.attempt?.meta : metaBrowser();
|
|
2222
|
-
|
|
2257
|
+
const attribution = retry ? extras.attempt?.attribution : landingAttribution();
|
|
2258
|
+
saveCartExtras(id2, {
|
|
2259
|
+
attempt: { key, body: `${code}:${serialised}`, ...meta ? { meta } : {}, ...attribution ? { attribution } : {} }
|
|
2260
|
+
});
|
|
2261
|
+
const metadata = {
|
|
2262
|
+
...extra.metadata,
|
|
2263
|
+
...meta ? { meta_capi: meta } : {},
|
|
2264
|
+
...attribution ? { attribution } : {}
|
|
2265
|
+
};
|
|
2223
2266
|
const result = await this.data(`/api/checkout/${encodeURIComponent(code)}`, {
|
|
2224
2267
|
method: "POST",
|
|
2225
|
-
body:
|
|
2268
|
+
body: Object.keys(metadata).length ? { ...body, metadata } : body,
|
|
2226
2269
|
headers: { "Idempotency-Key": key }
|
|
2227
2270
|
});
|
|
2228
2271
|
if (result.order.access_token) {
|
|
@@ -3182,6 +3225,7 @@ var StoreService = class extends BaseService {
|
|
|
3182
3225
|
// one storefront serves every store, and one store's pixel must never
|
|
3183
3226
|
// load on another's pages.
|
|
3184
3227
|
...adTags(plugins),
|
|
3228
|
+
googleTagManager: googleTags(plugins),
|
|
3185
3229
|
// Discount codes are core: every GoCommerce store takes them, so
|
|
3186
3230
|
// the code box is shown whatever the static record says.
|
|
3187
3231
|
isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
|
|
@@ -3223,6 +3267,16 @@ function adTags(plugins) {
|
|
|
3223
3267
|
})
|
|
3224
3268
|
);
|
|
3225
3269
|
}
|
|
3270
|
+
function googleTags(plugins) {
|
|
3271
|
+
const s = plugins.get("google-analytics")?.settings ?? {};
|
|
3272
|
+
const id2 = (field) => String(s[field] ?? "").trim();
|
|
3273
|
+
const [account, part] = id2("conversion_label").split("/");
|
|
3274
|
+
const label = part === void 0 ? account : part;
|
|
3275
|
+
const ads = id2("google_ads_id") || (part === void 0 ? "" : account);
|
|
3276
|
+
const tags = [id2("ga4_measurement_id"), ads, id2("gtm_container_id")].filter(Boolean);
|
|
3277
|
+
if (!tags.length) return { active: false };
|
|
3278
|
+
return { active: true, tags, conversions: ads && label ? [{ event: "purchase", label }] : [] };
|
|
3279
|
+
}
|
|
3226
3280
|
function deliverable(base, ships) {
|
|
3227
3281
|
if (ships.everywhere || !ships.countries.length) return {};
|
|
3228
3282
|
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|