@misiki/gocommerce-connector 0.21.0 → 0.23.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 +3 -1
- package/dist/{index-BnLRuRag.d.cts → index-BM6hYdQs.d.cts} +43 -1
- package/dist/{index-BnLRuRag.d.ts → index-BM6hYdQs.d.ts} +43 -1
- package/dist/index.cjs +91 -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 +90 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +91 -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 +90 -3
- 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,
|
|
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, bc as WhatsappConsent, bd as WhatsappConsentOffer, be as WhatsappService, bh as WishlistService, bi as addressService, bj as authService, bk as autocompleteService, bl as b2bService, bm as bannerService, bn as blogService, bo as cartService, bp as categoryService, bq as chatService, br as checkoutService, bs as collectionService, bt as contactService, bu as countryService, bv as couponService, bx as currencyService, by as dealService, bz as demoRequestService, bB as emptyPage, bC as enquiryService, bD as faqService, bE as feedbackService, bI as galleryService, bJ as googleReviewService, bK as homeService, bL as initService, bM as layoutService, bN as mediaUrl, bO as meilisearchService, bP as menuService, bR as newsletterService, bS as orderService, bT as ownDomain, bU as pageService, bV as paymentMethodService, bW as pluginService, bX as pluginsService, bY as popularSearchService, bZ as popularityService, c0 as productService, c2 as profileService, c3 as qs, c4 as reelsService, c5 as regionService, c6 as reviewService, c7 as searchService, c8 as setRequestHost, c9 as settingService, ca as settingsService, cb as stateService, cc as staticStore, cd as storeForHost, ce as storeService, cs as toPage, cv as toStorefrontFacets, cz as uploadService, cA as userService, cB as variantService, cC as varniCustomDesignService, cD as varniCustomProductService, cE as vendorService, cF as warrantyService, cG as whatsappService, cH as wishlistService } from '../index-BM6hYdQs.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,
|
|
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, bc as WhatsappConsent, bd as WhatsappConsentOffer, be as WhatsappService, bh as WishlistService, bi as addressService, bj as authService, bk as autocompleteService, bl as b2bService, bm as bannerService, bn as blogService, bo as cartService, bp as categoryService, bq as chatService, br as checkoutService, bs as collectionService, bt as contactService, bu as countryService, bv as couponService, bx as currencyService, by as dealService, bz as demoRequestService, bB as emptyPage, bC as enquiryService, bD as faqService, bE as feedbackService, bI as galleryService, bJ as googleReviewService, bK as homeService, bL as initService, bM as layoutService, bN as mediaUrl, bO as meilisearchService, bP as menuService, bR as newsletterService, bS as orderService, bT as ownDomain, bU as pageService, bV as paymentMethodService, bW as pluginService, bX as pluginsService, bY as popularSearchService, bZ as popularityService, c0 as productService, c2 as profileService, c3 as qs, c4 as reelsService, c5 as regionService, c6 as reviewService, c7 as searchService, c8 as setRequestHost, c9 as settingService, ca as settingsService, cb as stateService, cc as staticStore, cd as storeForHost, ce as storeService, cs as toPage, cv as toStorefrontFacets, cz as uploadService, cA as userService, cB as variantService, cC as varniCustomDesignService, cD as varniCustomProductService, cE as vendorService, cF as warrantyService, cG as whatsappService, cH as wishlistService } from '../index-BM6hYdQs.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) {
|
|
@@ -3655,6 +3698,50 @@ function withAmounts(v) {
|
|
|
3655
3698
|
}
|
|
3656
3699
|
var variantService = new VariantService();
|
|
3657
3700
|
|
|
3701
|
+
// src/services/whatsapp-service.ts
|
|
3702
|
+
var WhatsappService = class extends BaseService {
|
|
3703
|
+
/**
|
|
3704
|
+
* Whether to show the boxes. Never throws: an engine without the module, or
|
|
3705
|
+
* one that fails, answers both off, because checkout must not depend on it.
|
|
3706
|
+
*/
|
|
3707
|
+
async consentOffer() {
|
|
3708
|
+
try {
|
|
3709
|
+
const d = await this.data("/x/notify-whatsapp/consent");
|
|
3710
|
+
const enabled = d?.enabled === true;
|
|
3711
|
+
return { enabled, marketing: enabled && d?.marketing === true };
|
|
3712
|
+
} catch {
|
|
3713
|
+
return { enabled: false, marketing: false };
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
/**
|
|
3717
|
+
* Records both answers for the phone as typed, against the bag (with
|
|
3718
|
+
* `marketing`, the engine keeps the phone on it for basket reminders). Throws
|
|
3719
|
+
* the engine's 400 (`validation_failed`) when the phone is not a WhatsApp
|
|
3720
|
+
* number for the store's country.
|
|
3721
|
+
*/
|
|
3722
|
+
async setConsent({
|
|
3723
|
+
cartId,
|
|
3724
|
+
phone,
|
|
3725
|
+
orderUpdates,
|
|
3726
|
+
marketing
|
|
3727
|
+
}) {
|
|
3728
|
+
const d = await this.data(
|
|
3729
|
+
"/x/notify-whatsapp/consent",
|
|
3730
|
+
{
|
|
3731
|
+
method: "PUT",
|
|
3732
|
+
body: {
|
|
3733
|
+
cart_id: cartId || storedCartId() || "",
|
|
3734
|
+
phone: String(phone ?? "").trim(),
|
|
3735
|
+
order_updates: orderUpdates === true,
|
|
3736
|
+
marketing: marketing === true
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
);
|
|
3740
|
+
return { phone: d.phone, orderUpdates: d.order_updates, marketing: d.marketing };
|
|
3741
|
+
}
|
|
3742
|
+
};
|
|
3743
|
+
var whatsappService = new WhatsappService();
|
|
3744
|
+
|
|
3658
3745
|
// src/services/b2b-service.ts
|
|
3659
3746
|
var B2bService = class extends BaseService {
|
|
3660
3747
|
// ------------------------------------------------------------ company
|
|
@@ -3920,6 +4007,6 @@ function attemptKey(request) {
|
|
|
3920
4007
|
}
|
|
3921
4008
|
var b2bService = new B2bService();
|
|
3922
4009
|
|
|
3923
|
-
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, googleReviewService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
|
|
4010
|
+
export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, GoogleReviewService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WhatsappService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, googleReviewService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, whatsappService, wishlistService };
|
|
3924
4011
|
//# sourceMappingURL=index.js.map
|
|
3925
4012
|
//# sourceMappingURL=index.js.map
|