@builder.io/sdk-solid 0.0.19 → 0.0.20
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/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import { isBrowser } from "../../functions/is-browser.js";
|
|
|
11
11
|
import { isEditing } from "../../functions/is-editing.js";
|
|
12
12
|
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
13
13
|
import { components, createRegisterComponentMessage } from "../../functions/register-component.js";
|
|
14
|
-
import {
|
|
14
|
+
import { _track } from "../../functions/track.js";
|
|
15
15
|
import RenderBlocks from "../render-blocks.jsx";
|
|
16
16
|
import RenderContentStyles from "./components/render-styles.jsx";
|
|
17
17
|
import { registerInsertMenu, setupBrowserForEditing } from "../../scripts/init-editing.js";
|
|
@@ -100,11 +100,15 @@ function RenderContent(props) {
|
|
|
100
100
|
|
|
101
101
|
function onClick(_event) {
|
|
102
102
|
if (useContent) {
|
|
103
|
-
|
|
103
|
+
const variationId = useContent?.testVariationId;
|
|
104
|
+
const contentId = useContent?.id;
|
|
105
|
+
|
|
106
|
+
_track({
|
|
104
107
|
type: "click",
|
|
105
108
|
canTrack: canTrackToUse(),
|
|
106
|
-
contentId
|
|
107
|
-
|
|
109
|
+
contentId,
|
|
110
|
+
apiKey: props.apiKey,
|
|
111
|
+
variationId: variationId !== contentId ? variationId : undefined
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
114
|
}
|
|
@@ -195,11 +199,15 @@ function RenderContent(props) {
|
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
if (useContent) {
|
|
198
|
-
|
|
202
|
+
const variationId = useContent?.testVariationId;
|
|
203
|
+
const contentId = useContent?.id;
|
|
204
|
+
|
|
205
|
+
_track({
|
|
199
206
|
type: "impression",
|
|
200
207
|
canTrack: canTrackToUse(),
|
|
201
|
-
contentId
|
|
202
|
-
|
|
208
|
+
contentId,
|
|
209
|
+
apiKey: props.apiKey,
|
|
210
|
+
variationId: variationId !== contentId ? variationId : undefined
|
|
203
211
|
});
|
|
204
212
|
} // override normal content in preview mode
|
|
205
213
|
|
package/src/functions/track.js
CHANGED
|
@@ -71,23 +71,24 @@ const createEvent = (_a) => __async(void 0, null, function* () {
|
|
|
71
71
|
var _b = _a, {
|
|
72
72
|
type: eventType,
|
|
73
73
|
canTrack,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
apiKey,
|
|
75
|
+
metadata
|
|
76
76
|
} = _b, properties = __objRest(_b, [
|
|
77
77
|
"type",
|
|
78
78
|
"canTrack",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
79
|
+
"apiKey",
|
|
80
|
+
"metadata"
|
|
81
81
|
]);
|
|
82
82
|
return {
|
|
83
83
|
type: eventType,
|
|
84
|
-
data: __spreadProps(__spreadValues(__spreadValues({}, properties),
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
data: __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, properties), {
|
|
85
|
+
metadata: JSON.stringify(metadata)
|
|
86
|
+
}), yield getTrackingEventData({ canTrack })), {
|
|
87
|
+
ownerId: apiKey
|
|
87
88
|
})
|
|
88
89
|
};
|
|
89
90
|
});
|
|
90
|
-
function
|
|
91
|
+
function _track(eventProps) {
|
|
91
92
|
return __async(this, null, function* () {
|
|
92
93
|
if (!eventProps.canTrack) {
|
|
93
94
|
return;
|
|
@@ -112,6 +113,8 @@ function track(eventProps) {
|
|
|
112
113
|
});
|
|
113
114
|
});
|
|
114
115
|
}
|
|
116
|
+
const track = (args) => _track(__spreadProps(__spreadValues({}, args), { canTrack: true }));
|
|
115
117
|
export {
|
|
118
|
+
_track,
|
|
116
119
|
track
|
|
117
120
|
};
|
package/src/index.js
CHANGED
|
@@ -8,3 +8,7 @@ export * from "./functions/register.js";
|
|
|
8
8
|
export * from "./functions/set-editor-settings.js";
|
|
9
9
|
export * from "./functions/get-content/index.js";
|
|
10
10
|
export * from "./functions/get-builder-search-params/index.js";
|
|
11
|
+
import { track } from "./functions/track";
|
|
12
|
+
export {
|
|
13
|
+
track
|
|
14
|
+
};
|