@bigz-app/booking-widget 0.3.3 → 0.3.4
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 +2 -1
- package/dist/booking-widget.js +2 -27
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/shared/DialogPortal.d.ts.map +1 -1
- package/dist/index.cjs +2 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +2 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/google-ads-tracking.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogPortal.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DialogPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,YAAY,CAAC,EAC5B,QAAQ,EACR,MAAM,EACN,MAAe,GACf,EAAE;IACF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,
|
|
1
|
+
{"version":3,"file":"DialogPortal.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DialogPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,YAAY,CAAC,EAC5B,QAAQ,EACR,MAAM,EACN,MAAe,GACf,EAAE;IACF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,4BA8GA;AAGD,wBAAgB,aAAa,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAkB,EAClB,SAAS,EACT,MAAe,GACf,EAAE;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,kDAoIA"}
|
package/dist/index.cjs
CHANGED
|
@@ -6801,7 +6801,6 @@ function DialogPortal({ children, isOpen, zIndex = 999999, }) {
|
|
|
6801
6801
|
}
|
|
6802
6802
|
catch (error) {
|
|
6803
6803
|
// Ignore removal errors - element may have already been removed
|
|
6804
|
-
console.debug("Portal cleanup: Element already removed");
|
|
6805
6804
|
}
|
|
6806
6805
|
}
|
|
6807
6806
|
document.body.style.overflow = "";
|
|
@@ -10302,27 +10301,23 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
|
|
|
10302
10301
|
*/
|
|
10303
10302
|
function isGtagAvailable() {
|
|
10304
10303
|
if (typeof window === "undefined") {
|
|
10305
|
-
console.warn("[Google Ads] window is undefined (SSR context)");
|
|
10306
10304
|
return false;
|
|
10307
10305
|
}
|
|
10308
10306
|
// Check current window
|
|
10309
10307
|
if (typeof window.gtag === "function") {
|
|
10310
|
-
console.log("[Google Ads] gtag found in current window");
|
|
10311
10308
|
return true;
|
|
10312
10309
|
}
|
|
10313
10310
|
// Check parent window (for iframe/widget scenarios)
|
|
10314
10311
|
if (window !== window.parent) {
|
|
10315
10312
|
try {
|
|
10316
10313
|
if (typeof window.parent?.gtag === "function") {
|
|
10317
|
-
console.log("[Google Ads] gtag found in parent window");
|
|
10318
10314
|
return true;
|
|
10319
10315
|
}
|
|
10320
10316
|
}
|
|
10321
10317
|
catch (e) {
|
|
10322
|
-
|
|
10318
|
+
// Cannot access parent window (cross-origin)
|
|
10323
10319
|
}
|
|
10324
10320
|
}
|
|
10325
|
-
console.log("[Google Ads] gtag not found");
|
|
10326
10321
|
return false;
|
|
10327
10322
|
}
|
|
10328
10323
|
/**
|
|
@@ -10330,31 +10325,25 @@ function isGtagAvailable() {
|
|
|
10330
10325
|
*/
|
|
10331
10326
|
function initializeGtag(tagId) {
|
|
10332
10327
|
if (typeof window === "undefined") {
|
|
10333
|
-
console.warn("[Google Ads] window is undefined, cannot initialize gtag");
|
|
10334
10328
|
return;
|
|
10335
10329
|
}
|
|
10336
10330
|
// Skip if gtag already exists
|
|
10337
10331
|
if (isGtagAvailable()) {
|
|
10338
|
-
console.log("[Google Ads] gtag already initialized, skipping init");
|
|
10339
10332
|
return;
|
|
10340
10333
|
}
|
|
10341
10334
|
// Initialize dataLayer and gtag function
|
|
10342
|
-
console.log("[Google Ads] Initializing dataLayer and gtag function");
|
|
10343
10335
|
window.dataLayer = window.dataLayer || [];
|
|
10344
10336
|
window.gtag = (...args) => {
|
|
10345
10337
|
window.dataLayer.push(args);
|
|
10346
10338
|
};
|
|
10347
10339
|
// Set current timestamp
|
|
10348
|
-
console.log("[Google Ads] Setting gtag timestamp");
|
|
10349
10340
|
window.gtag("js", new Date());
|
|
10350
10341
|
// Load gtag script
|
|
10351
|
-
console.log("[Google Ads] Loading gtag script from:", `https://www.googletagmanager.com/gtag/js?id=${tagId}`);
|
|
10352
10342
|
const script = document.createElement("script");
|
|
10353
10343
|
script.async = true;
|
|
10354
10344
|
script.src = `https://www.googletagmanager.com/gtag/js?id=${tagId}`;
|
|
10355
10345
|
document.head.appendChild(script);
|
|
10356
10346
|
// Configure the tag
|
|
10357
|
-
console.log("[Google Ads] Configuring gtag with tagId:", tagId);
|
|
10358
10347
|
window.gtag("config", tagId, {
|
|
10359
10348
|
anonymize_ip: true,
|
|
10360
10349
|
allow_google_signals: false,
|
|
@@ -10366,7 +10355,6 @@ function initializeGtag(tagId) {
|
|
|
10366
10355
|
*/
|
|
10367
10356
|
function sendConversion(config) {
|
|
10368
10357
|
if (typeof window === "undefined") {
|
|
10369
|
-
console.warn("[Google Ads] window is undefined, cannot send conversion");
|
|
10370
10358
|
return;
|
|
10371
10359
|
}
|
|
10372
10360
|
let gtag = window.gtag;
|
|
@@ -10374,16 +10362,12 @@ function sendConversion(config) {
|
|
|
10374
10362
|
if (typeof gtag !== "function" && window !== window.parent) {
|
|
10375
10363
|
try {
|
|
10376
10364
|
gtag = window.parent?.gtag;
|
|
10377
|
-
if (typeof gtag === "function") {
|
|
10378
|
-
console.log("[Google Ads] Using parent window gtag");
|
|
10379
|
-
}
|
|
10380
10365
|
}
|
|
10381
10366
|
catch {
|
|
10382
|
-
|
|
10367
|
+
// Cannot access parent window (cross-origin)
|
|
10383
10368
|
}
|
|
10384
10369
|
}
|
|
10385
10370
|
if (typeof gtag !== "function") {
|
|
10386
|
-
console.warn("[Google Ads] gtag not available, cannot send conversion");
|
|
10387
10371
|
return;
|
|
10388
10372
|
}
|
|
10389
10373
|
// Build conversion data
|
|
@@ -10400,7 +10384,6 @@ function sendConversion(config) {
|
|
|
10400
10384
|
if (config.transactionId) {
|
|
10401
10385
|
conversionData.transaction_id = config.transactionId;
|
|
10402
10386
|
}
|
|
10403
|
-
console.log("[Google Ads] Dispatching conversion event:", conversionData);
|
|
10404
10387
|
// Send conversion event
|
|
10405
10388
|
gtag("event", "conversion", conversionData);
|
|
10406
10389
|
}
|
|
@@ -10411,22 +10394,14 @@ function sendConversion(config) {
|
|
|
10411
10394
|
function handleGoogleAdsConversion(config) {
|
|
10412
10395
|
// Validate required config
|
|
10413
10396
|
if (!config.tagId || !config.conversionId) {
|
|
10414
|
-
console.warn("[Google Ads] Missing tagId or conversionId", config);
|
|
10415
10397
|
return;
|
|
10416
10398
|
}
|
|
10417
|
-
console.log("[Google Ads] Waiting 1500ms before tracking conversion...");
|
|
10418
10399
|
// Wait 1500ms before proceeding
|
|
10419
10400
|
setTimeout(() => {
|
|
10420
|
-
console.log("[Google Ads] Checking if gtag is available...");
|
|
10421
10401
|
// Check if gtag is available, initialize if not
|
|
10422
10402
|
if (!isGtagAvailable()) {
|
|
10423
|
-
console.log("[Google Ads] gtag not found, initializing...");
|
|
10424
10403
|
initializeGtag(config.tagId);
|
|
10425
10404
|
}
|
|
10426
|
-
else {
|
|
10427
|
-
console.log("[Google Ads] gtag already available.");
|
|
10428
|
-
}
|
|
10429
|
-
console.log("[Google Ads] Sending conversion event...", config);
|
|
10430
10405
|
sendConversion(config);
|
|
10431
10406
|
}, 1500);
|
|
10432
10407
|
}
|