@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
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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 { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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';
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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 { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, L as DealService, M as DemoRequestService, N as EngineRequest, O as EnquiryService, S as FaqService, T as FeedbackService, U as FooterSettings, X as GalleryService, Z as GoogleReview, _ as GoogleReviewService, $ as GoogleReviews, a1 as HeaderSettings, a2 as HomeLayout, a3 as HomeLayoutSection, a4 as HomeService, a6 as InitService, a7 as Invitation, a8 as LayoutCollection, a9 as LayoutPage, aa as LayoutService, ab as Lead, ad as MeilisearchService, ae as Member, ah as MenuService, ak as NewsletterService, ap as OrderService, aq as PageLayout, ar as PageService, at as PaymentMethodService, av as PluginService, av as PluginsService, aw as PopularSearchService, ax as PopularityService, aC as ProductService, aD as ProfileService, aE as Quote, aF as REDIRECT_GATEWAYS, aG as ReelsService, aH as RegionService, aI as RejectedLine, aL as ReviewService, aO as SearchService, aP as SettingService, aP as SettingsService, aR as SiteChrome, aS as SiteFooter, aT as SiteHeader, aU as SocialLink, aV as StateService, aX as StoreService, aZ as StorefrontMenu, b0 as ThemeSettings, b1 as ThemeSettingsResult, b2 as UploadService, b3 as UserService, b6 as VariantService, b7 as VarniCustomDesignService, b8 as VarniCustomProductService, ba as VendorService, bb as WarrantyService, 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, bu as currencyService, bv as dealService, bw as demoRequestService, by as emptyPage, bz as enquiryService, bA as faqService, bB as feedbackService, bF as galleryService, bG as googleReviewService, bH as homeService, bI as initService, bJ as layoutService, bK as mediaUrl, bL as meilisearchService, bM as menuService, 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, bZ as productService, 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, cp as toPage, cs as toStorefrontFacets, 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';
|
package/dist/services/index.js
CHANGED
|
@@ -172,6 +172,41 @@ function metaBrowser() {
|
|
|
172
172
|
event_source_url: window.location.origin + window.location.pathname
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
+
var ATTRIBUTION_KEY = "gc_attribution";
|
|
176
|
+
var ATTRIBUTION_DAYS = 30;
|
|
177
|
+
var TOUCH_FIELDS = [
|
|
178
|
+
"utm_source",
|
|
179
|
+
"utm_medium",
|
|
180
|
+
"utm_campaign",
|
|
181
|
+
"utm_content",
|
|
182
|
+
"utm_term",
|
|
183
|
+
"gclid",
|
|
184
|
+
"gbraid",
|
|
185
|
+
"wbraid",
|
|
186
|
+
"fbclid",
|
|
187
|
+
"ttclid",
|
|
188
|
+
"msclkid",
|
|
189
|
+
"referrer",
|
|
190
|
+
"at"
|
|
191
|
+
];
|
|
192
|
+
function cleanTouch(raw, now) {
|
|
193
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
194
|
+
const at = Date.parse(String(raw.at ?? ""));
|
|
195
|
+
if (!Number.isFinite(at) || now - at > ATTRIBUTION_DAYS * 864e5 || at - now > 864e5) return void 0;
|
|
196
|
+
const out = {};
|
|
197
|
+
for (const k of TOUCH_FIELDS) {
|
|
198
|
+
const v = raw[k];
|
|
199
|
+
if (typeof v === "string" && v.trim()) out[k] = v.trim().slice(0, 200);
|
|
200
|
+
}
|
|
201
|
+
return Object.keys(out).length > 1 ? out : void 0;
|
|
202
|
+
}
|
|
203
|
+
function landingAttribution(now = Date.now()) {
|
|
204
|
+
const saved = readJSON(ATTRIBUTION_KEY);
|
|
205
|
+
const last = cleanTouch(saved?.last, now);
|
|
206
|
+
const first = cleanTouch(saved?.first, now) ?? last;
|
|
207
|
+
if (!first && !last) return void 0;
|
|
208
|
+
return { ...first ? { first } : {}, ...last ? { last } : {} };
|
|
209
|
+
}
|
|
175
210
|
function storedCartId() {
|
|
176
211
|
const v = readLocal("cart_id");
|
|
177
212
|
if (!v || v === "undefined" || v === "null") return null;
|
|
@@ -2200,10 +2235,18 @@ var CheckoutService = class extends BaseService {
|
|
|
2200
2235
|
const retry = extras.attempt?.body === `${code}:${serialised}`;
|
|
2201
2236
|
const key = retry ? extras.attempt.key : newKey();
|
|
2202
2237
|
const meta = retry ? extras.attempt?.meta : metaBrowser();
|
|
2203
|
-
|
|
2238
|
+
const attribution = retry ? extras.attempt?.attribution : landingAttribution();
|
|
2239
|
+
saveCartExtras(id2, {
|
|
2240
|
+
attempt: { key, body: `${code}:${serialised}`, ...meta ? { meta } : {}, ...attribution ? { attribution } : {} }
|
|
2241
|
+
});
|
|
2242
|
+
const metadata = {
|
|
2243
|
+
...extra.metadata,
|
|
2244
|
+
...meta ? { meta_capi: meta } : {},
|
|
2245
|
+
...attribution ? { attribution } : {}
|
|
2246
|
+
};
|
|
2204
2247
|
const result = await this.data(`/api/checkout/${encodeURIComponent(code)}`, {
|
|
2205
2248
|
method: "POST",
|
|
2206
|
-
body:
|
|
2249
|
+
body: Object.keys(metadata).length ? { ...body, metadata } : body,
|
|
2207
2250
|
headers: { "Idempotency-Key": key }
|
|
2208
2251
|
});
|
|
2209
2252
|
if (result.order.access_token) {
|
|
@@ -3166,6 +3209,7 @@ var StoreService = class extends BaseService {
|
|
|
3166
3209
|
// one storefront serves every store, and one store's pixel must never
|
|
3167
3210
|
// load on another's pages.
|
|
3168
3211
|
...adTags(plugins),
|
|
3212
|
+
googleTagManager: googleTags(plugins),
|
|
3169
3213
|
// Discount codes are core: every GoCommerce store takes them, so
|
|
3170
3214
|
// the code box is shown whatever the static record says.
|
|
3171
3215
|
isDiscountCoupons: { ...basePlugins.isDiscountCoupons, active: true },
|
|
@@ -3207,6 +3251,16 @@ function adTags(plugins) {
|
|
|
3207
3251
|
})
|
|
3208
3252
|
);
|
|
3209
3253
|
}
|
|
3254
|
+
function googleTags(plugins) {
|
|
3255
|
+
const s = plugins.get("google-analytics")?.settings ?? {};
|
|
3256
|
+
const id2 = (field) => String(s[field] ?? "").trim();
|
|
3257
|
+
const [account, part] = id2("conversion_label").split("/");
|
|
3258
|
+
const label = part === void 0 ? account : part;
|
|
3259
|
+
const ads = id2("google_ads_id") || (part === void 0 ? "" : account);
|
|
3260
|
+
const tags = [id2("ga4_measurement_id"), ads, id2("gtm_container_id")].filter(Boolean);
|
|
3261
|
+
if (!tags.length) return { active: false };
|
|
3262
|
+
return { active: true, tags, conversions: ads && label ? [{ event: "purchase", label }] : [] };
|
|
3263
|
+
}
|
|
3210
3264
|
function deliverable(base, ships) {
|
|
3211
3265
|
if (ships.everywhere || !ships.countries.length) return {};
|
|
3212
3266
|
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|