@kharon-labs/react 0.1.0 → 0.1.1

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.cjs CHANGED
@@ -29,13 +29,28 @@ module.exports = __toCommonJS(index_exports);
29
29
  var import_react = require("react");
30
30
  var import_browser = require("@kharon-labs/browser");
31
31
 
32
+ // src/engine/analytics/touch.ts
33
+ var CLICK_ID_PARAMS = {
34
+ gclid: "google",
35
+ gbraid: "google",
36
+ wbraid: "google",
37
+ msclkid: "microsoft",
38
+ fbclid: "meta",
39
+ li_fat_id: "linkedin",
40
+ ttclid: "tiktok",
41
+ twclid: "x"
42
+ };
43
+ var CLICK_ID_KINDS = new Set(Object.values(CLICK_ID_PARAMS));
44
+
32
45
  // src/engine/analytics/beacon.ts
33
46
  var SLOT_ATTRIBUTES = {
34
47
  slot: "data-ge-slot",
35
48
  variant: "data-ge-variant",
36
49
  counterfactual: "data-ge-counterfactual",
37
50
  /** Why the slot shows what it shows (matched, default, holdout). For debugging; not sent. */
38
- reason: "data-ge-reason"
51
+ reason: "data-ge-reason",
52
+ /** Which step of the fallback ladder chose the content (exact, near, segment, default). Sent on impressions. */
53
+ rung: "data-ge-rung"
39
54
  };
40
55
 
41
56
  // packages/react/src/index.tsx
@@ -132,7 +147,8 @@ function Slot({ id, defaults, children, as = "div", className }) {
132
147
  ...decision && {
133
148
  [SLOT_ATTRIBUTES.variant]: decision.variantId ?? "",
134
149
  [SLOT_ATTRIBUTES.counterfactual]: decision.counterfactualVariantId ?? "",
135
- [SLOT_ATTRIBUTES.reason]: decision.reason
150
+ [SLOT_ATTRIBUTES.reason]: decision.reason,
151
+ ...decision.rung && { [SLOT_ATTRIBUTES.rung]: decision.rung }
136
152
  }
137
153
  },
138
154
  children(content)
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export interface SlotProps<F extends string> {
36
36
  }
37
37
  /** A personalizable region. Same shape as the hosted site's `<Slot>`, with defaults in code. */
38
38
  export declare function Slot<F extends string>({ id, defaults, children, as, className }: SlotProps<F>): import("react").DetailedReactHTMLElement<{
39
+ "data-ge-rung"?: ("default" | "exact" | "near" | "segment") | undefined;
39
40
  "data-ge-variant"?: string | undefined;
40
41
  "data-ge-counterfactual"?: string | undefined;
41
42
  "data-ge-reason"?: ("matched" | "default" | "holdout") | undefined;
package/dist/index.js CHANGED
@@ -9,13 +9,28 @@ import {
9
9
  reveal
10
10
  } from "@kharon-labs/browser";
11
11
 
12
+ // src/engine/analytics/touch.ts
13
+ var CLICK_ID_PARAMS = {
14
+ gclid: "google",
15
+ gbraid: "google",
16
+ wbraid: "google",
17
+ msclkid: "microsoft",
18
+ fbclid: "meta",
19
+ li_fat_id: "linkedin",
20
+ ttclid: "tiktok",
21
+ twclid: "x"
22
+ };
23
+ var CLICK_ID_KINDS = new Set(Object.values(CLICK_ID_PARAMS));
24
+
12
25
  // src/engine/analytics/beacon.ts
13
26
  var SLOT_ATTRIBUTES = {
14
27
  slot: "data-ge-slot",
15
28
  variant: "data-ge-variant",
16
29
  counterfactual: "data-ge-counterfactual",
17
30
  /** Why the slot shows what it shows (matched, default, holdout). For debugging; not sent. */
18
- reason: "data-ge-reason"
31
+ reason: "data-ge-reason",
32
+ /** Which step of the fallback ladder chose the content (exact, near, segment, default). Sent on impressions. */
33
+ rung: "data-ge-rung"
19
34
  };
20
35
 
21
36
  // packages/react/src/index.tsx
@@ -112,7 +127,8 @@ function Slot({ id, defaults, children, as = "div", className }) {
112
127
  ...decision && {
113
128
  [SLOT_ATTRIBUTES.variant]: decision.variantId ?? "",
114
129
  [SLOT_ATTRIBUTES.counterfactual]: decision.counterfactualVariantId ?? "",
115
- [SLOT_ATTRIBUTES.reason]: decision.reason
130
+ [SLOT_ATTRIBUTES.reason]: decision.reason,
131
+ ...decision.rung && { [SLOT_ATTRIBUTES.rung]: decision.rung }
116
132
  }
117
133
  },
118
134
  children(content)
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@kharon-labs/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React components for Kharon Labs personalization: <KharonProvider> and <Slot>.",
5
5
  "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/alexarmenciu/growth-engine.git",
9
- "directory": "packages/react"
10
- },
11
6
  "homepage": "https://kharonlabs.com",
12
7
  "type": "module",
13
8
  "sideEffects": false,
@@ -23,7 +18,7 @@
23
18
  },
24
19
  "files": ["dist"],
25
20
  "dependencies": {
26
- "@kharon-labs/browser": "0.1.0"
21
+ "@kharon-labs/browser": "0.2.0"
27
22
  },
28
23
  "peerDependencies": {
29
24
  "react": ">=18"