@coveops/abi 1.5.7 → 1.5.8

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.
@@ -126,13 +126,13 @@ async function initRecs() {
126
126
  const organizationId = "anheuserbuschinbevprod";
127
127
  const accessToken = "eyJhbGciOiJIUzI1NiJ9.eyJmaWx0ZXIiOiJAb2JqZWN0dHlwZT09RkFRIE9SIEBvYmplY3R0eXBlPT1BY2NvdW50IE9SIEB0YXJnZXRvcmc9PSh1YXQscHJvZHVjdGlvbikiLCJ2OCI6dHJ1ZSwidG9rZW5JZCI6InZ5MnJob3U0eTdjazJ2czd1Y3FwZDJzY3lhIiwib3JnYW5pemF0aW9uIjoiYW5oZXVzZXJidXNjaGluYmV2cHJvZCIsInVzZXJJZHMiOlt7InR5cGUiOiJVc2VyIiwibmFtZSI6ImFnbmllc3prYS5ub3Zha292YUBhYi1pbmJldi5jb20iLCJwcm92aWRlciI6IkVtYWlsIFNlY3VyaXR5IFByb3ZpZGVyIn1dLCJyb2xlcyI6WyJxdWVyeUV4ZWN1dG9yIl0sImlzcyI6IlNlYXJjaEFwaSIsImV4cCI6MTcyODQxOTcwNCwiaWF0IjoxNzI4MzMzMzA0fQ.KZjuzS5x8GlJY1E-wUAMpRFvUsMt0lurjDIS7bCBzEM";
128
128
  const recsInterface = document.querySelector('#recs');
129
- (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "CZ");
129
+ (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "BE");
130
130
  await (recsInterface === null || recsInterface === void 0 ? void 0 : recsInterface.initialize({
131
131
  accessToken: accessToken,
132
132
  organizationId: organizationId,
133
133
  preprocessRequest: (request, clientOrigin, metadata) => {
134
134
  if (clientOrigin == "searchApiFetch" && (metadata === null || metadata === void 0 ? void 0 : metadata.method) == "recommendations") {
135
- //request.url += '&viewAllContent=1';
135
+ request.url += '&viewAllContent=1';
136
136
  var body = JSON.parse(request.body);
137
137
  body.context = {
138
138
  "user_country": "CZ",
@@ -25,8 +25,8 @@ const RecsInitializationHelper = class {
25
25
  else {
26
26
  fromDate.setMonth(fromDate.getMonth() - 1);
27
27
  }
28
- let filter = encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`);
29
- let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
28
+ let filter = encodeURIComponent(`(clicks.c_context_user_country_snow=='${this.userCountry}')`);
29
+ let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_context_user_country_snow&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
30
30
  const reqHeaders = new Headers();
31
31
  reqHeaders.append("authorization", "Bearer xxf42da36f-db11-4565-8358-8bac8c307236");
32
32
  const requestOptions = {
@@ -17,8 +17,8 @@ export class RecsInitializationHelper {
17
17
  else {
18
18
  fromDate.setMonth(fromDate.getMonth() - 1);
19
19
  }
20
- let filter = encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`);
21
- let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
20
+ let filter = encodeURIComponent(`(clicks.c_context_user_country_snow=='${this.userCountry}')`);
21
+ let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_context_user_country_snow&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
22
22
  const reqHeaders = new Headers();
23
23
  reqHeaders.append("authorization", "Bearer xxf42da36f-db11-4565-8358-8bac8c307236");
24
24
  const requestOptions = {
@@ -123,13 +123,13 @@ async function initRecs() {
123
123
  const organizationId = process.env.ORGANIZATION_ID;
124
124
  const accessToken = process.env.API_KEY;
125
125
  const recsInterface = document.querySelector('#recs');
126
- (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "CZ");
126
+ (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "BE");
127
127
  await (recsInterface === null || recsInterface === void 0 ? void 0 : recsInterface.initialize({
128
128
  accessToken: accessToken,
129
129
  organizationId: organizationId,
130
130
  preprocessRequest: (request, clientOrigin, metadata) => {
131
131
  if (clientOrigin == "searchApiFetch" && (metadata === null || metadata === void 0 ? void 0 : metadata.method) == "recommendations") {
132
- //request.url += '&viewAllContent=1';
132
+ request.url += '&viewAllContent=1';
133
133
  var body = JSON.parse(request.body);
134
134
  body.context = {
135
135
  "user_country": "CZ",
@@ -1248,13 +1248,13 @@ async function initRecs() {
1248
1248
  const organizationId = "anheuserbuschinbevprod";
1249
1249
  const accessToken = "eyJhbGciOiJIUzI1NiJ9.eyJmaWx0ZXIiOiJAb2JqZWN0dHlwZT09RkFRIE9SIEBvYmplY3R0eXBlPT1BY2NvdW50IE9SIEB0YXJnZXRvcmc9PSh1YXQscHJvZHVjdGlvbikiLCJ2OCI6dHJ1ZSwidG9rZW5JZCI6InZ5MnJob3U0eTdjazJ2czd1Y3FwZDJzY3lhIiwib3JnYW5pemF0aW9uIjoiYW5oZXVzZXJidXNjaGluYmV2cHJvZCIsInVzZXJJZHMiOlt7InR5cGUiOiJVc2VyIiwibmFtZSI6ImFnbmllc3prYS5ub3Zha292YUBhYi1pbmJldi5jb20iLCJwcm92aWRlciI6IkVtYWlsIFNlY3VyaXR5IFByb3ZpZGVyIn1dLCJyb2xlcyI6WyJxdWVyeUV4ZWN1dG9yIl0sImlzcyI6IlNlYXJjaEFwaSIsImV4cCI6MTcyODQxOTcwNCwiaWF0IjoxNzI4MzMzMzA0fQ.KZjuzS5x8GlJY1E-wUAMpRFvUsMt0lurjDIS7bCBzEM";
1250
1250
  const recsInterface = document.querySelector('#recs');
1251
- (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "CZ");
1251
+ (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "BE");
1252
1252
  await (recsInterface === null || recsInterface === void 0 ? void 0 : recsInterface.initialize({
1253
1253
  accessToken: accessToken,
1254
1254
  organizationId: organizationId,
1255
1255
  preprocessRequest: (request, clientOrigin, metadata) => {
1256
1256
  if (clientOrigin == "searchApiFetch" && (metadata === null || metadata === void 0 ? void 0 : metadata.method) == "recommendations") {
1257
- //request.url += '&viewAllContent=1';
1257
+ request.url += '&viewAllContent=1';
1258
1258
  var body = JSON.parse(request.body);
1259
1259
  body.context = {
1260
1260
  "user_country": "CZ",
@@ -3283,8 +3283,8 @@ const RecsInitializationHelper$1 = class extends H {
3283
3283
  else {
3284
3284
  fromDate.setMonth(fromDate.getMonth() - 1);
3285
3285
  }
3286
- let filter = encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`);
3287
- let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
3286
+ let filter = encodeURIComponent(`(clicks.c_context_user_country_snow=='${this.userCountry}')`);
3287
+ let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_context_user_country_snow&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
3288
3288
  const reqHeaders = new Headers();
3289
3289
  reqHeaders.append("authorization", "Bearer xxf42da36f-db11-4565-8358-8bac8c307236");
3290
3290
  const requestOptions = {
package/dist/esm/index.js CHANGED
@@ -124,13 +124,13 @@ async function initRecs() {
124
124
  const organizationId = "anheuserbuschinbevprod";
125
125
  const accessToken = "eyJhbGciOiJIUzI1NiJ9.eyJmaWx0ZXIiOiJAb2JqZWN0dHlwZT09RkFRIE9SIEBvYmplY3R0eXBlPT1BY2NvdW50IE9SIEB0YXJnZXRvcmc9PSh1YXQscHJvZHVjdGlvbikiLCJ2OCI6dHJ1ZSwidG9rZW5JZCI6InZ5MnJob3U0eTdjazJ2czd1Y3FwZDJzY3lhIiwib3JnYW5pemF0aW9uIjoiYW5oZXVzZXJidXNjaGluYmV2cHJvZCIsInVzZXJJZHMiOlt7InR5cGUiOiJVc2VyIiwibmFtZSI6ImFnbmllc3prYS5ub3Zha292YUBhYi1pbmJldi5jb20iLCJwcm92aWRlciI6IkVtYWlsIFNlY3VyaXR5IFByb3ZpZGVyIn1dLCJyb2xlcyI6WyJxdWVyeUV4ZWN1dG9yIl0sImlzcyI6IlNlYXJjaEFwaSIsImV4cCI6MTcyODQxOTcwNCwiaWF0IjoxNzI4MzMzMzA0fQ.KZjuzS5x8GlJY1E-wUAMpRFvUsMt0lurjDIS7bCBzEM";
126
126
  const recsInterface = document.querySelector('#recs');
127
- (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "CZ");
127
+ (_a = recsInterface.querySelector("recs-initialization-helper")) === null || _a === void 0 ? void 0 : _a.setAttribute("user-country", "BE");
128
128
  await (recsInterface === null || recsInterface === void 0 ? void 0 : recsInterface.initialize({
129
129
  accessToken: accessToken,
130
130
  organizationId: organizationId,
131
131
  preprocessRequest: (request, clientOrigin, metadata) => {
132
132
  if (clientOrigin == "searchApiFetch" && (metadata === null || metadata === void 0 ? void 0 : metadata.method) == "recommendations") {
133
- //request.url += '&viewAllContent=1';
133
+ request.url += '&viewAllContent=1';
134
134
  var body = JSON.parse(request.body);
135
135
  body.context = {
136
136
  "user_country": "CZ",
@@ -21,8 +21,8 @@ const RecsInitializationHelper = class {
21
21
  else {
22
22
  fromDate.setMonth(fromDate.getMonth() - 1);
23
23
  }
24
- let filter = encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`);
25
- let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
24
+ let filter = encodeURIComponent(`(clicks.c_context_user_country_snow=='${this.userCountry}')`);
25
+ let url = `https://${(_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_context_user_country_snow&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
26
26
  const reqHeaders = new Headers();
27
27
  reqHeaders.append("authorization", "Bearer xxf42da36f-db11-4565-8358-8bac8c307236");
28
28
  const requestOptions = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coveops/abi",
3
3
  "description": "Abi project",
4
- "version": "1.5.7",
4
+ "version": "1.5.8",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.js",
@@ -25,9 +25,9 @@ export class RecsInitializationHelper {
25
25
  else {
26
26
  fromDate.setMonth(fromDate.getMonth() - 1);
27
27
  }
28
- let filter = encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`);
28
+ let filter = encodeURIComponent(`(clicks.c_context_user_country_snow=='${this.userCountry}')`);
29
29
 
30
- let url = `https://${this.bindings?.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
30
+ let url = `https://${this.bindings?.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${fromDate.toISOString()}&to=${toDate}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_context_user_country_snow&d=documentSysUriHash&f=${filter}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;
31
31
  const reqHeaders = new Headers();
32
32
  reqHeaders.append("authorization", "Bearer xxf42da36f-db11-4565-8358-8bac8c307236");
33
33
 
package/src/index.ts CHANGED
@@ -137,13 +137,13 @@ async function initRecs() {
137
137
  const accessToken = process.env.API_KEY!;
138
138
 
139
139
  const recsInterface:HTMLAtomicRecsInterfaceElement = document.querySelector('#recs')!;
140
- recsInterface.querySelector("recs-initialization-helper")?.setAttribute("user-country","CZ");
140
+ recsInterface.querySelector("recs-initialization-helper")?.setAttribute("user-country","BE");
141
141
  await recsInterface?.initialize({
142
142
  accessToken: accessToken,
143
143
  organizationId: organizationId,
144
144
  preprocessRequest: (request, clientOrigin, metadata) => {
145
145
  if(clientOrigin == "searchApiFetch" && metadata?.method == "recommendations") {
146
- //request.url += '&viewAllContent=1';
146
+ request.url += '&viewAllContent=1';
147
147
  var body = JSON.parse(request.body as string);
148
148
  body.context = {
149
149
  "user_country": "CZ",
@@ -14,7 +14,7 @@
14
14
  <!--
15
15
  When using the Coveo CDN - Make sure you're using the same minor version as the packaged Atomic.
16
16
  E.g., if you have "@coveo/atomic@2.0.0" installed, use the "/atomic/v2.0.0/" path.
17
- When deploying with the Coveo CLI, the Atomic CDN defined in the coveo.deploy.json configuration file will be used.
17
+ When deploying with the Coveo CLI,the Atomic CDN defined in the coveo.deploy.json configuration file will be used.
18
18
 
19
19
  <script type="module" src="https://static.cloud.coveo.com/atomic/vMAJOR.MINOR/atomic.esm.js"></script>
20
20
  -->
@@ -1 +0,0 @@
1
- import{r as t,g as e}from"./p-c10b6b7f.js";import{i as s,Q as a}from"./p-ac870f21.js";import{w as o}from"./p-c82303fb.js";import"./p-d20ee37c.js";const c=class{constructor(e){t(this,e)}async connectedCallback(){var t;try{await o(),this.bindings=await s(this.host);let e=(new Date).toISOString(),c=new Date;1==c.getMonth()?(c.setMonth(12),c.setFullYear(c.getFullYear()-1)):c.setMonth(c.getMonth()-1);let i=encodeURIComponent(`(clicks.c_user_country=='${this.userCountry}')`),n=`https://${null===(t=this.bindings)||void 0===t?void 0:t.engine.state.configuration.organizationId}.admin.org.coveo.com/rest/ua/v15/stats/combinedData?from=${c.toISOString()}&to=${e}&m=DocumentView&d=documentTitle&d=documentURL&d=clicks.c_user_country&&d=documentSysUriHash&f=${i}&p=1&n=10&s=DocumentView&asc=false&includeMetadata=true`;const r=new Headers;r.append("authorization","Bearer xxf42da36f-db11-4565-8358-8bac8c307236");const d={method:"GET",headers:r};let m=await fetch(n,d);if(m=await m.json(),m.combinations.length>0){let t=m.combinations.map((t=>t.documentSysUriHash));a(this.bindings.engine).add("dqExp",t),this.bindings.interfaceElement.getRecommendations()}else this.bindings.interfaceElement.style.display="none"}catch(t){console.error(t)}}get host(){return e(this)}};export{c as recs_initialization_helper}