@uniformdev/context 19.159.0 → 19.159.1-alpha.16
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.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +17 -8
- package/dist/index.js +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -156,8 +156,13 @@ type EdgeTestComponentOptions = {
|
|
156
156
|
declare const EdgeNodeTagName = "nesitag";
|
157
157
|
|
158
158
|
type InsightsEndpoint = {
|
159
|
+
type: 'api';
|
159
160
|
host: string;
|
160
161
|
apiKey: string;
|
162
|
+
} | {
|
163
|
+
type: 'proxy';
|
164
|
+
path: string;
|
165
|
+
apiKey?: string;
|
161
166
|
};
|
162
167
|
type EnableUniformInsightsOptions = {
|
163
168
|
endpoint: InsightsEndpoint;
|
package/dist/index.d.ts
CHANGED
@@ -156,8 +156,13 @@ type EdgeTestComponentOptions = {
|
|
156
156
|
declare const EdgeNodeTagName = "nesitag";
|
157
157
|
|
158
158
|
type InsightsEndpoint = {
|
159
|
+
type: 'api';
|
159
160
|
host: string;
|
160
161
|
apiKey: string;
|
162
|
+
} | {
|
163
|
+
type: 'proxy';
|
164
|
+
path: string;
|
165
|
+
apiKey?: string;
|
161
166
|
};
|
162
167
|
type EnableUniformInsightsOptions = {
|
163
168
|
endpoint: InsightsEndpoint;
|
package/dist/index.esm.js
CHANGED
@@ -2070,10 +2070,16 @@ var getBasePayload = () => {
|
|
2070
2070
|
};
|
2071
2071
|
};
|
2072
2072
|
var createInsightsClient = ({ endpoint }) => {
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2073
|
+
let endpointUrl;
|
2074
|
+
const apiKey = endpoint.apiKey;
|
2075
|
+
if (endpoint.type === "api") {
|
2076
|
+
const url = new URL(endpoint.host);
|
2077
|
+
url.pathname = "/v0/events";
|
2078
|
+
url.searchParams.set("name", "analytics_events");
|
2079
|
+
endpointUrl = url.toString();
|
2080
|
+
} else {
|
2081
|
+
endpointUrl = endpoint.path;
|
2082
|
+
}
|
2077
2083
|
const sendMessage = async (message) => {
|
2078
2084
|
if (typeof window.__UNIFORM_CONTEXTUAL_EDITING__ !== "undefined") {
|
2079
2085
|
return;
|
@@ -2082,12 +2088,15 @@ var createInsightsClient = ({ endpoint }) => {
|
|
2082
2088
|
...message,
|
2083
2089
|
payload: JSON.stringify(message.payload)
|
2084
2090
|
};
|
2091
|
+
const headers = {
|
2092
|
+
"Content-Type": "application/json"
|
2093
|
+
};
|
2094
|
+
if (apiKey) {
|
2095
|
+
headers.Authorization = `Bearer ${apiKey}`;
|
2096
|
+
}
|
2085
2097
|
const response = await fetch(endpointUrl, {
|
2086
2098
|
method: "POST",
|
2087
|
-
headers
|
2088
|
-
"Content-Type": "application/json",
|
2089
|
-
Authorization: `Bearer ${endpoint.apiKey}`
|
2090
|
-
},
|
2099
|
+
headers,
|
2091
2100
|
body: JSON.stringify(converted)
|
2092
2101
|
});
|
2093
2102
|
const json = await response.json();
|
package/dist/index.js
CHANGED
@@ -2142,10 +2142,16 @@ var getBasePayload = () => {
|
|
2142
2142
|
};
|
2143
2143
|
};
|
2144
2144
|
var createInsightsClient = ({ endpoint }) => {
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2145
|
+
let endpointUrl;
|
2146
|
+
const apiKey = endpoint.apiKey;
|
2147
|
+
if (endpoint.type === "api") {
|
2148
|
+
const url = new URL(endpoint.host);
|
2149
|
+
url.pathname = "/v0/events";
|
2150
|
+
url.searchParams.set("name", "analytics_events");
|
2151
|
+
endpointUrl = url.toString();
|
2152
|
+
} else {
|
2153
|
+
endpointUrl = endpoint.path;
|
2154
|
+
}
|
2149
2155
|
const sendMessage = async (message) => {
|
2150
2156
|
if (typeof window.__UNIFORM_CONTEXTUAL_EDITING__ !== "undefined") {
|
2151
2157
|
return;
|
@@ -2154,12 +2160,15 @@ var createInsightsClient = ({ endpoint }) => {
|
|
2154
2160
|
...message,
|
2155
2161
|
payload: JSON.stringify(message.payload)
|
2156
2162
|
};
|
2163
|
+
const headers = {
|
2164
|
+
"Content-Type": "application/json"
|
2165
|
+
};
|
2166
|
+
if (apiKey) {
|
2167
|
+
headers.Authorization = `Bearer ${apiKey}`;
|
2168
|
+
}
|
2157
2169
|
const response = await fetch(endpointUrl, {
|
2158
2170
|
method: "POST",
|
2159
|
-
headers
|
2160
|
-
"Content-Type": "application/json",
|
2161
|
-
Authorization: `Bearer ${endpoint.apiKey}`
|
2162
|
-
},
|
2171
|
+
headers,
|
2163
2172
|
body: JSON.stringify(converted)
|
2164
2173
|
});
|
2165
2174
|
const json = await response.json();
|
package/dist/index.mjs
CHANGED
@@ -2070,10 +2070,16 @@ var getBasePayload = () => {
|
|
2070
2070
|
};
|
2071
2071
|
};
|
2072
2072
|
var createInsightsClient = ({ endpoint }) => {
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2073
|
+
let endpointUrl;
|
2074
|
+
const apiKey = endpoint.apiKey;
|
2075
|
+
if (endpoint.type === "api") {
|
2076
|
+
const url = new URL(endpoint.host);
|
2077
|
+
url.pathname = "/v0/events";
|
2078
|
+
url.searchParams.set("name", "analytics_events");
|
2079
|
+
endpointUrl = url.toString();
|
2080
|
+
} else {
|
2081
|
+
endpointUrl = endpoint.path;
|
2082
|
+
}
|
2077
2083
|
const sendMessage = async (message) => {
|
2078
2084
|
if (typeof window.__UNIFORM_CONTEXTUAL_EDITING__ !== "undefined") {
|
2079
2085
|
return;
|
@@ -2082,12 +2088,15 @@ var createInsightsClient = ({ endpoint }) => {
|
|
2082
2088
|
...message,
|
2083
2089
|
payload: JSON.stringify(message.payload)
|
2084
2090
|
};
|
2091
|
+
const headers = {
|
2092
|
+
"Content-Type": "application/json"
|
2093
|
+
};
|
2094
|
+
if (apiKey) {
|
2095
|
+
headers.Authorization = `Bearer ${apiKey}`;
|
2096
|
+
}
|
2085
2097
|
const response = await fetch(endpointUrl, {
|
2086
2098
|
method: "POST",
|
2087
|
-
headers
|
2088
|
-
"Content-Type": "application/json",
|
2089
|
-
Authorization: `Bearer ${endpoint.apiKey}`
|
2090
|
-
},
|
2099
|
+
headers,
|
2091
2100
|
body: JSON.stringify(converted)
|
2092
2101
|
});
|
2093
2102
|
const json = await response.json();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "19.159.
|
3
|
+
"version": "19.159.1-alpha.16+112313047e",
|
4
4
|
"description": "Uniform Context core package",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -68,5 +68,5 @@
|
|
68
68
|
"publishConfig": {
|
69
69
|
"access": "public"
|
70
70
|
},
|
71
|
-
"gitHead": "
|
71
|
+
"gitHead": "112313047e98c7a1c0045ea1c5d01a4c74b29871"
|
72
72
|
}
|