@bigz-app/booking-widget 0.3.0 → 0.3.2

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.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Google Ads Conversion Tracking Utility
3
+ *
4
+ * This utility handles Google Ads conversion tracking for the booking widget.
5
+ * It includes consent checking, gtag initialization, and conversion tracking.
6
+ */
7
+ export interface GoogleAdsConfig {
8
+ /**
9
+ * Google Ads Tag ID (e.g., 'AW-XXXXXXX')
10
+ */
11
+ tagId?: string;
12
+ /**
13
+ * Google Ads Conversion ID/Label (e.g., 'booking_conversion')
14
+ */
15
+ conversionId?: string;
16
+ /**
17
+ * Optional conversion value for the booking
18
+ */
19
+ conversionValue?: number;
20
+ /**
21
+ * Optional conversion currency (defaults to 'EUR')
22
+ */
23
+ conversionCurrency?: string;
24
+ /**
25
+ * Optional transaction ID for deduplication
26
+ */
27
+ transactionId?: string;
28
+ }
29
+ /**
30
+ * Interface for Google Consent Mode state
31
+ */
32
+ export interface ConsentData {
33
+ ad_storage?: "granted" | "denied";
34
+ analytics_storage?: "granted" | "denied";
35
+ functionality_storage?: "granted" | "denied";
36
+ personalization_storage?: "granted" | "denied";
37
+ security_storage?: "granted" | "denied";
38
+ }
39
+ /**
40
+ * Check if Google Consent Mode has granted the necessary permissions for ads tracking
41
+ * This checks multiple sources of consent state in order of preference
42
+ */
43
+ export declare function checkGoogleConsent(): boolean;
44
+ /**
45
+ * Check if gtag is already initialized on the host page
46
+ */
47
+ export declare function isGtagInitialized(): boolean;
48
+ /**
49
+ * Initialize Google Tag (gtag) if not already present
50
+ */
51
+ export declare function initializeGtag(tagId: string): Promise<void>;
52
+ /**
53
+ * Track a Google Ads conversion
54
+ */
55
+ export declare function trackConversion(config: GoogleAdsConfig): void;
56
+ /**
57
+ * Main function to handle Google Ads conversion tracking
58
+ * This function checks consent, initializes gtag if needed, and tracks the conversion
59
+ */
60
+ export declare function handleGoogleAdsConversion(config: GoogleAdsConfig): Promise<void>;
61
+ /**
62
+ * Utility function to get conversion value from booking data
63
+ */
64
+ export declare function getConversionValueFromBooking(bookingData: any): number | undefined;
65
+ //# sourceMappingURL=google-ads-tracking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-ads-tracking.d.ts","sourceRoot":"","sources":["../../src/utils/google-ads-tracking.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,iBAAiB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACzC,qBAAqB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7C,uBAAuB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/C,gBAAgB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAoH5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CA0B3C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqE3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAiE7D;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CtF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAiClF"}
package/package.json CHANGED
@@ -1,77 +1,72 @@
1
1
  {
2
- "name": "@bigz-app/booking-widget",
3
- "version": "0.3.0",
4
- "description": "Booking widget for Big Z Booking System @ bigz.app",
5
- "type": "module",
6
- "main": "dist/index.cjs",
7
- "module": "dist/index.esm.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "README.md"
12
- ],
13
- "exports": {
14
- ".": {
15
- "import": "./dist/index.esm.js",
16
- "require": "./dist/index.cjs",
17
- "types": "./dist/index.d.ts"
18
- },
19
- "./umd": "./dist/index.umd.js",
20
- "./package.json": "./package.json"
21
- },
22
- "unpkg": "dist/index.umd.js",
23
- "jsdelivr": "dist/index.umd.js",
24
- "keywords": [
25
- "bigz",
26
- "booking-widget"
27
- ],
28
- "author": "99 Power",
29
- "license": "UNLICENSED",
30
- "peerDependencies": {
31
- "react": "^18.0.0 || ^19.0.0",
32
- "react-dom": "^18.0.0 || ^19.0.0"
33
- },
34
- "dependencies": {
35
- "@hookform/resolvers": "^3.3.2",
36
- "@stripe/react-stripe-js": "^3.7.0",
37
- "@stripe/stripe-js": "^4.9.0",
38
- "@tiptap/starter-kit": "3.0.7",
39
- "markdown-to-jsx": "^7.7.12",
40
- "preact": "^10.26.9",
41
- "react-hook-form": "^7.48.2",
42
- "zod": "^3.22.4"
43
- },
44
- "devDependencies": {
45
- "@biomejs/biome": "1.9.4",
46
- "@rollup/plugin-alias": "^5.1.1",
47
- "@rollup/plugin-commonjs": "^25.0.7",
48
- "@rollup/plugin-node-resolve": "^15.2.3",
49
- "@rollup/plugin-replace": "^6.0.2",
50
- "@rollup/plugin-typescript": "^11.1.5",
51
- "@types/node": "^20.17.47",
52
- "@types/react": "^18.2.45",
53
- "@types/react-dom": "^18.2.18",
54
- "rollup": "^4.9.1",
55
- "rollup-plugin-peer-deps-external": "^2.2.4",
56
- "typescript": "^5.3.3"
57
- },
58
- "publishConfig": {
59
- "access": "public"
60
- },
61
- "scripts": {
62
- "dev": "rollup -c -w",
63
- "build": "rollup -c",
64
- "build:types": "tsc --emitDeclarationOnly",
65
- "clean": "rm -rf dist",
66
- "rebuild": "npm run clean && npm run build",
67
- "test": "echo 'Add test script here'",
68
- "pack:check": "npm pack --dry-run",
69
- "link:local": "pnpm link --global",
70
- "unlink:local": "pnpm unlink --global",
71
- "lint": "biome lint .",
72
- "format": "biome format . --write",
73
- "check": "biome check .",
74
- "check:write": "biome check . --write",
75
- "postbuild": "echo 'Preact build complete.'"
76
- }
77
- }
2
+ "name": "@bigz-app/booking-widget",
3
+ "version": "0.3.2",
4
+ "description": "Booking widget for Big Z Booking System @ bigz.app",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": ["dist", "README.md"],
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.cjs",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./umd": "./dist/index.umd.js",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "unpkg": "dist/index.umd.js",
20
+ "jsdelivr": "dist/index.umd.js",
21
+ "keywords": ["bigz", "booking-widget"],
22
+ "author": "99 Power",
23
+ "license": "UNLICENSED",
24
+ "scripts": {
25
+ "dev": "rollup -c -w",
26
+ "build": "rollup -c",
27
+ "build:types": "tsc --emitDeclarationOnly",
28
+ "clean": "rm -rf dist",
29
+ "rebuild": "npm run clean && npm run build",
30
+ "prepublishOnly": "npm run rebuild",
31
+ "test": "echo 'Add test script here'",
32
+ "pack:check": "npm pack --dry-run",
33
+ "link:local": "pnpm link --global",
34
+ "unlink:local": "pnpm unlink --global",
35
+ "lint": "biome lint .",
36
+ "format": "biome format . --write",
37
+ "check": "biome check .",
38
+ "check:write": "biome check . --write",
39
+ "postbuild": "echo 'Preact build complete.'"
40
+ },
41
+ "peerDependencies": {
42
+ "react": "^18.0.0 || ^19.0.0",
43
+ "react-dom": "^18.0.0 || ^19.0.0"
44
+ },
45
+ "dependencies": {
46
+ "@hookform/resolvers": "^3.3.2",
47
+ "@stripe/react-stripe-js": "^3.7.0",
48
+ "@stripe/stripe-js": "^4.9.0",
49
+ "@tiptap/starter-kit": "3.0.7",
50
+ "markdown-to-jsx": "^7.7.12",
51
+ "preact": "^10.26.9",
52
+ "react-hook-form": "^7.48.2",
53
+ "zod": "^3.22.4"
54
+ },
55
+ "devDependencies": {
56
+ "@biomejs/biome": "1.9.4",
57
+ "@rollup/plugin-alias": "^5.1.1",
58
+ "@rollup/plugin-commonjs": "^25.0.7",
59
+ "@rollup/plugin-node-resolve": "^15.2.3",
60
+ "@rollup/plugin-replace": "^6.0.2",
61
+ "@rollup/plugin-typescript": "^11.1.5",
62
+ "@types/node": "^20.17.47",
63
+ "@types/react": "^18.2.45",
64
+ "@types/react-dom": "^18.2.18",
65
+ "rollup": "^4.9.1",
66
+ "rollup-plugin-peer-deps-external": "^2.2.4",
67
+ "typescript": "^5.3.3"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public"
71
+ }
72
+ }