@empathyco/x-adapter-platform 1.0.0-alpha.76 → 1.0.0-alpha.78

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.
@@ -11,7 +11,7 @@ const semantic_queries_response_mapper_1 = require("../mappers/responses/semanti
11
11
  * @public
12
12
  */
13
13
  exports.semanticQueriesEndpointAdapter = (0, x_adapter_1.endpointAdapterFactory)({
14
- endpoint: 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search-single/{extraParams.instance}',
14
+ endpoint: 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search_single/{extraParams.instance}',
15
15
  requestMapper: semantic_queries_request_mapper_1.semanticQueriesRequestMapper,
16
16
  responseMapper: semantic_queries_response_mapper_1.semanticQueriesResponseMapper,
17
17
  defaultRequestOptions: {
@@ -1 +1 @@
1
- {"version":3,"file":"semantic-queries.endpoint-adapter.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/semantic-queries.endpoint-adapter.ts"],"names":[],"mappings":";;;AAAA,oDAA8D;AAE9D,yGAAmG;AACnG,mCAAmC;AACnC,4GAAsG;AAEtG;;;;GAIG;AACU,QAAA,8BAA8B,GAAG,IAAA,kCAAsB,EAGlE;IACA,QAAQ,EACN,+FAA+F;IACjG,aAAa,EAAE,8DAA4B;IAC3C,cAAc,EAAE,gEAA6B;IAC7C,qBAAqB,EAAE;QACrB,EAAE,EAAE,kBAAkB;KACvB;CACF,CAAC,CAAC","sourcesContent":["import { endpointAdapterFactory } from '@empathyco/x-adapter';\nimport { SemanticQueriesResponse, SemanticQueriesRequest } from '@empathyco/x-types';\nimport { semanticQueriesRequestMapper } from '../mappers/requests/semantic-queries-request.mapper';\n// eslint-disable-next-line max-len\nimport { semanticQueriesResponseMapper } from '../mappers/responses/semantic-queries-response.mapper';\n\n/**\n * Default adapter for the semantic queries endpoint.\n *\n * @public\n */\nexport const semanticQueriesEndpointAdapter = endpointAdapterFactory<\n SemanticQueriesRequest,\n SemanticQueriesResponse\n>({\n endpoint:\n 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search-single/{extraParams.instance}',\n requestMapper: semanticQueriesRequestMapper,\n responseMapper: semanticQueriesResponseMapper,\n defaultRequestOptions: {\n id: 'semantic-queries'\n }\n});\n"]}
1
+ {"version":3,"file":"semantic-queries.endpoint-adapter.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/semantic-queries.endpoint-adapter.ts"],"names":[],"mappings":";;;AAAA,oDAA8D;AAE9D,yGAAmG;AACnG,mCAAmC;AACnC,4GAAsG;AAEtG;;;;GAIG;AACU,QAAA,8BAA8B,GAAG,IAAA,kCAAsB,EAGlE;IACA,QAAQ,EACN,+FAA+F;IACjG,aAAa,EAAE,8DAA4B;IAC3C,cAAc,EAAE,gEAA6B;IAC7C,qBAAqB,EAAE;QACrB,EAAE,EAAE,kBAAkB;KACvB;CACF,CAAC,CAAC","sourcesContent":["import { endpointAdapterFactory } from '@empathyco/x-adapter';\nimport { SemanticQueriesResponse, SemanticQueriesRequest } from '@empathyco/x-types';\nimport { semanticQueriesRequestMapper } from '../mappers/requests/semantic-queries-request.mapper';\n// eslint-disable-next-line max-len\nimport { semanticQueriesResponseMapper } from '../mappers/responses/semantic-queries-response.mapper';\n\n/**\n * Default adapter for the semantic queries endpoint.\n *\n * @public\n */\nexport const semanticQueriesEndpointAdapter = endpointAdapterFactory<\n SemanticQueriesRequest,\n SemanticQueriesResponse\n>({\n endpoint:\n 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search_single/{extraParams.instance}',\n requestMapper: semanticQueriesRequestMapper,\n responseMapper: semanticQueriesResponseMapper,\n defaultRequestOptions: {\n id: 'semantic-queries'\n }\n});\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractUrlParameters = exports.getTaggingInfoFromUrl = void 0;
3
+ exports.extractUrlParameters = exports.getDisplayClickTagging = exports.getTaggingInfoFromUrl = void 0;
4
4
  /**
5
5
  * Extracts the tagging info from a URL.
6
6
  *
@@ -21,6 +21,22 @@ function getTaggingInfoFromUrl(taggingUrl) {
21
21
  };
22
22
  }
23
23
  exports.getTaggingInfoFromUrl = getTaggingInfoFromUrl;
24
+ /**
25
+ * Generates the displayClick tagging info.
26
+ *
27
+ * @param displayTaggingUrl - The url containing the displayClick tagging info.
28
+ * @returns The object with the tagging info.
29
+ *
30
+ * @public
31
+ */
32
+ function getDisplayClickTagging(displayTaggingUrl) {
33
+ const displayClickTagging = getTaggingInfoFromUrl(displayTaggingUrl);
34
+ const displayClickTaggingParams = displayClickTagging.params;
35
+ displayClickTaggingParams.displayId = displayClickTaggingParams.q;
36
+ delete displayClickTaggingParams.q;
37
+ return displayClickTagging;
38
+ }
39
+ exports.getDisplayClickTagging = getDisplayClickTagging;
24
40
  /**
25
41
  * Returns the base url path and an object with the query parameters.
26
42
  *
@@ -1 +1 @@
1
- {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAC;AACJ,CAAC;AATD,sDASC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,GAAW;IAI9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC1D,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aAC1C;iBAAM,IAAI,KAAK,EAAE;gBAChB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aACvC;iBAAM;gBACL,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aAC9B;QACH,CAAC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,qCAAqC;QACrC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,4BAA4B;QAC9D,OAAO;YACL,GAAG;SACJ,CAAC;KACH;AACH,CAAC;AA5BD,oDA4BC","sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl);\n return {\n url,\n params: {\n ...params,\n follow: false\n }\n };\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string;\n params?: Record<string, string[] | string>;\n} {\n const searchParams = new Map<string, string | string[]>();\n try {\n const urlObject = new URL(url);\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key);\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value]);\n } else if (param) {\n searchParams.set(key, [param, value]);\n } else {\n searchParams.set(key, value);\n }\n });\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams)\n };\n } catch (e) {\n //eslint-disable-next-line no-console\n console.warn('Invalid url', url); // TODO Use Empathy's logger\n return {\n url\n };\n }\n}\n"]}
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAC;AACJ,CAAC;AATD,sDASC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,iBAAyB;IAC9D,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IACrE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAE7D,yBAAyB,CAAC,SAAS,GAAG,yBAAyB,CAAC,CAAC,CAAC;IAClE,OAAO,yBAAyB,CAAC,CAAC,CAAC;IAEnC,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AARD,wDAQC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,GAAW;IAI9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC1D,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aAC1C;iBAAM,IAAI,KAAK,EAAE;gBAChB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aACvC;iBAAM;gBACL,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aAC9B;QACH,CAAC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,qCAAqC;QACrC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,4BAA4B;QAC9D,OAAO;YACL,GAAG;SACJ,CAAC;KACH;AACH,CAAC;AA5BD,oDA4BC","sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl);\n return {\n url,\n params: {\n ...params,\n follow: false\n }\n };\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayClickTagging(displayTaggingUrl: string): TaggingRequest {\n const displayClickTagging = getTaggingInfoFromUrl(displayTaggingUrl);\n const displayClickTaggingParams = displayClickTagging.params;\n\n displayClickTaggingParams.displayId = displayClickTaggingParams.q;\n delete displayClickTaggingParams.q;\n\n return displayClickTagging;\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string;\n params?: Record<string, string[] | string>;\n} {\n const searchParams = new Map<string, string | string[]>();\n try {\n const urlObject = new URL(url);\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key);\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value]);\n } else if (param) {\n searchParams.set(key, [param, value]);\n } else {\n searchParams.set(key, value);\n }\n });\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams)\n };\n } catch (e) {\n //eslint-disable-next-line no-console\n console.warn('Invalid url', url); // TODO Use Empathy's logger\n return {\n url\n };\n }\n}\n"]}
@@ -33,7 +33,8 @@ exports.resultSchema = (0, x_adapter_1.createMutableSchema)({
33
33
  $subSchema: {
34
34
  add2cart: ({ add2cart }) => (0, url_utils_1.getTaggingInfoFromUrl)(add2cart),
35
35
  checkout: ({ checkout }) => (0, url_utils_1.getTaggingInfoFromUrl)(checkout),
36
- click: ({ click }) => (0, url_utils_1.getTaggingInfoFromUrl)(click)
36
+ click: ({ click }) => (0, url_utils_1.getTaggingInfoFromUrl)(click),
37
+ displayClick: ({ displayClick }) => (0, url_utils_1.getDisplayClickTagging)(displayClick)
37
38
  }
38
39
  }
39
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAE3D,uDAAgE;AAGhE;;;;GAIG;AACU,QAAA,YAAY,GAAG,IAAA,+BAAmB,EAAyB;IACtE,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,OAAO;IACZ,UAAU,EAAE;QACV,KAAK,EAAE,cAAc;KACtB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACzC,OAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QACtD,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,SAAS,CAAC,MAAM,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QAC5F,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACvC,OAAA,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAA;KACnF;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,QAAQ,CAAC;YAC3D,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,QAAQ,CAAC;YAC3D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,KAAK,CAAC;SACnD;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\n/**\n * Default implementation for the ResultSchema.\n *\n * @public\n */\nexport const resultSchema = createMutableSchema<PlatformResult, Result>({\n id: '__id',\n images: '__images',\n name: '__name',\n url: '__url',\n identifier: {\n value: '__externalId'\n },\n rating: {\n value: () => null\n },\n price: {\n value: '__prices.current.value',\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current.value,\n futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n rawPrices.current.value < (rawPrices.previous?.value ?? rawPrices.current.value)\n },\n type: () => 'Default',\n modelName: () => 'Result',\n isWishlisted: () => false,\n tagging: {\n $path: 'tagging',\n $subSchema: {\n add2cart: ({ add2cart }) => getTaggingInfoFromUrl(add2cart),\n checkout: ({ checkout }) => getTaggingInfoFromUrl(checkout),\n click: ({ click }) => getTaggingInfoFromUrl(click)\n }\n }\n});\n"]}
1
+ {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAE3D,uDAAwF;AAGxF;;;;GAIG;AACU,QAAA,YAAY,GAAG,IAAA,+BAAmB,EAAyB;IACtE,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,OAAO;IACZ,UAAU,EAAE;QACV,KAAK,EAAE,cAAc;KACtB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACzC,OAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QACtD,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,SAAS,CAAC,MAAM,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QAC5F,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACvC,OAAA,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAA;KACnF;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,QAAQ,CAAC;YAC3D,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,QAAQ,CAAC;YAC3D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAA,iCAAqB,EAAC,KAAK,CAAC;YAClD,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,IAAA,kCAAsB,EAAC,YAAY,CAAC;SACzE;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getDisplayClickTagging, getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\n/**\n * Default implementation for the ResultSchema.\n *\n * @public\n */\nexport const resultSchema = createMutableSchema<PlatformResult, Result>({\n id: '__id',\n images: '__images',\n name: '__name',\n url: '__url',\n identifier: {\n value: '__externalId'\n },\n rating: {\n value: () => null\n },\n price: {\n value: '__prices.current.value',\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current.value,\n futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n rawPrices.current.value < (rawPrices.previous?.value ?? rawPrices.current.value)\n },\n type: () => 'Default',\n modelName: () => 'Result',\n isWishlisted: () => false,\n tagging: {\n $path: 'tagging',\n $subSchema: {\n add2cart: ({ add2cart }) => getTaggingInfoFromUrl(add2cart),\n checkout: ({ checkout }) => getTaggingInfoFromUrl(checkout),\n click: ({ click }) => getTaggingInfoFromUrl(click),\n displayClick: ({ displayClick }) => getDisplayClickTagging(displayClick)\n }\n }\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tagging.model.js","sourceRoot":"","sources":["../../../../src/types/models/tagging.model.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tagging model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformTagging {\n add2cart: string;\n checkout: string;\n click: string;\n}\n"]}
1
+ {"version":3,"file":"tagging.model.js","sourceRoot":"","sources":["../../../../src/types/models/tagging.model.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tagging model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformTagging {\n add2cart: string;\n checkout: string;\n click: string;\n displayClick: string;\n}\n"]}
@@ -8,7 +8,7 @@ import { semanticQueriesResponseMapper } from '../mappers/responses/semantic-que
8
8
  * @public
9
9
  */
10
10
  export const semanticQueriesEndpointAdapter = endpointAdapterFactory({
11
- endpoint: 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search-single/{extraParams.instance}',
11
+ endpoint: 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search_single/{extraParams.instance}',
12
12
  requestMapper: semanticQueriesRequestMapper,
13
13
  responseMapper: semanticQueriesResponseMapper,
14
14
  defaultRequestOptions: {
@@ -1 +1 @@
1
- {"version":3,"file":"semantic-queries.endpoint-adapter.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/semantic-queries.endpoint-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,mCAAmC;AACnC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uDAAuD,CAAC;AAEtG;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAGlE;IACA,QAAQ,EACN,+FAA+F;IACjG,aAAa,EAAE,4BAA4B;IAC3C,cAAc,EAAE,6BAA6B;IAC7C,qBAAqB,EAAE;QACrB,EAAE,EAAE,kBAAkB;KACvB;CACF,CAAC,CAAC","sourcesContent":["import { endpointAdapterFactory } from '@empathyco/x-adapter';\nimport { SemanticQueriesResponse, SemanticQueriesRequest } from '@empathyco/x-types';\nimport { semanticQueriesRequestMapper } from '../mappers/requests/semantic-queries-request.mapper';\n// eslint-disable-next-line max-len\nimport { semanticQueriesResponseMapper } from '../mappers/responses/semantic-queries-response.mapper';\n\n/**\n * Default adapter for the semantic queries endpoint.\n *\n * @public\n */\nexport const semanticQueriesEndpointAdapter = endpointAdapterFactory<\n SemanticQueriesRequest,\n SemanticQueriesResponse\n>({\n endpoint:\n 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search-single/{extraParams.instance}',\n requestMapper: semanticQueriesRequestMapper,\n responseMapper: semanticQueriesResponseMapper,\n defaultRequestOptions: {\n id: 'semantic-queries'\n }\n});\n"]}
1
+ {"version":3,"file":"semantic-queries.endpoint-adapter.js","sourceRoot":"","sources":["../../../src/endpoint-adapters/semantic-queries.endpoint-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,mCAAmC;AACnC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uDAAuD,CAAC;AAEtG;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAGlE;IACA,QAAQ,EACN,+FAA+F;IACjG,aAAa,EAAE,4BAA4B;IAC3C,cAAc,EAAE,6BAA6B;IAC7C,qBAAqB,EAAE;QACrB,EAAE,EAAE,kBAAkB;KACvB;CACF,CAAC,CAAC","sourcesContent":["import { endpointAdapterFactory } from '@empathyco/x-adapter';\nimport { SemanticQueriesResponse, SemanticQueriesRequest } from '@empathyco/x-types';\nimport { semanticQueriesRequestMapper } from '../mappers/requests/semantic-queries-request.mapper';\n// eslint-disable-next-line max-len\nimport { semanticQueriesResponseMapper } from '../mappers/responses/semantic-queries-response.mapper';\n\n/**\n * Default adapter for the semantic queries endpoint.\n *\n * @public\n */\nexport const semanticQueriesEndpointAdapter = endpointAdapterFactory<\n SemanticQueriesRequest,\n SemanticQueriesResponse\n>({\n endpoint:\n 'https://api.{extraParams.env(.)}empathy.co/semantics-api/search_single/{extraParams.instance}',\n requestMapper: semanticQueriesRequestMapper,\n responseMapper: semanticQueriesResponseMapper,\n defaultRequestOptions: {\n id: 'semantic-queries'\n }\n});\n"]}
@@ -17,6 +17,21 @@ export function getTaggingInfoFromUrl(taggingUrl) {
17
17
  }
18
18
  };
19
19
  }
20
+ /**
21
+ * Generates the displayClick tagging info.
22
+ *
23
+ * @param displayTaggingUrl - The url containing the displayClick tagging info.
24
+ * @returns The object with the tagging info.
25
+ *
26
+ * @public
27
+ */
28
+ export function getDisplayClickTagging(displayTaggingUrl) {
29
+ const displayClickTagging = getTaggingInfoFromUrl(displayTaggingUrl);
30
+ const displayClickTaggingParams = displayClickTagging.params;
31
+ displayClickTaggingParams.displayId = displayClickTaggingParams.q;
32
+ delete displayClickTaggingParams.q;
33
+ return displayClickTagging;
34
+ }
20
35
  /**
21
36
  * Returns the base url path and an object with the query parameters.
22
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAI9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC1D,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aAC1C;iBAAM,IAAI,KAAK,EAAE;gBAChB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aACvC;iBAAM;gBACL,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aAC9B;QACH,CAAC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,qCAAqC;QACrC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,4BAA4B;QAC9D,OAAO;YACL,GAAG;SACJ,CAAC;KACH;AACH,CAAC","sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl);\n return {\n url,\n params: {\n ...params,\n follow: false\n }\n };\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string;\n params?: Record<string, string[] | string>;\n} {\n const searchParams = new Map<string, string | string[]>();\n try {\n const urlObject = new URL(url);\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key);\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value]);\n } else if (param) {\n searchParams.set(key, [param, value]);\n } else {\n searchParams.set(key, value);\n }\n });\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams)\n };\n } catch (e) {\n //eslint-disable-next-line no-console\n console.warn('Invalid url', url); // TODO Use Empathy's logger\n return {\n url\n };\n }\n}\n"]}
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO;QACL,GAAG;QACH,MAAM,EAAE;YACN,GAAG,MAAM;YACT,MAAM,EAAE,KAAK;SACd;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,iBAAyB;IAC9D,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IACrE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAE7D,yBAAyB,CAAC,SAAS,GAAG,yBAAyB,CAAC,CAAC,CAAC;IAClE,OAAO,yBAAyB,CAAC,CAAC,CAAC;IAEnC,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAI9C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC1D,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aAC1C;iBAAM,IAAI,KAAK,EAAE;gBAChB,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;aACvC;iBAAM;gBACL,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aAC9B;QACH,CAAC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SACzC,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,qCAAqC;QACrC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,4BAA4B;QAC9D,OAAO;YACL,GAAG;SACJ,CAAC;KACH;AACH,CAAC","sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\n\n/**\n * Extracts the tagging info from a URL.\n *\n * @param taggingUrl - The url containing the tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest {\n const { url, params } = extractUrlParameters(taggingUrl);\n return {\n url,\n params: {\n ...params,\n follow: false\n }\n };\n}\n\n/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n * @returns The object with the tagging info.\n *\n * @public\n */\nexport function getDisplayClickTagging(displayTaggingUrl: string): TaggingRequest {\n const displayClickTagging = getTaggingInfoFromUrl(displayTaggingUrl);\n const displayClickTaggingParams = displayClickTagging.params;\n\n displayClickTaggingParams.displayId = displayClickTaggingParams.q;\n delete displayClickTaggingParams.q;\n\n return displayClickTagging;\n}\n\n/**\n * Returns the base url path and an object with the query parameters.\n *\n * @param url - The url string to manipulate.\n *\n * @returns The object with the url information.\n *\n * @public\n */\nexport function extractUrlParameters(url: string): {\n url: string;\n params?: Record<string, string[] | string>;\n} {\n const searchParams = new Map<string, string | string[]>();\n try {\n const urlObject = new URL(url);\n urlObject.searchParams.forEach((value, key) => {\n const param = searchParams.get(key);\n if (Array.isArray(param)) {\n searchParams.set(key, [...param, value]);\n } else if (param) {\n searchParams.set(key, [param, value]);\n } else {\n searchParams.set(key, value);\n }\n });\n return {\n url: `${urlObject.origin}${urlObject.pathname}`,\n params: Object.fromEntries(searchParams)\n };\n } catch (e) {\n //eslint-disable-next-line no-console\n console.warn('Invalid url', url); // TODO Use Empathy's logger\n return {\n url\n };\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createMutableSchema } from '@empathyco/x-adapter';
2
- import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
2
+ import { getDisplayClickTagging, getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  /**
4
4
  * Default implementation for the ResultSchema.
5
5
  *
@@ -30,7 +30,8 @@ export const resultSchema = createMutableSchema({
30
30
  $subSchema: {
31
31
  add2cart: ({ add2cart }) => getTaggingInfoFromUrl(add2cart),
32
32
  checkout: ({ checkout }) => getTaggingInfoFromUrl(checkout),
33
- click: ({ click }) => getTaggingInfoFromUrl(click)
33
+ click: ({ click }) => getTaggingInfoFromUrl(click),
34
+ displayClick: ({ displayClick }) => getDisplayClickTagging(displayClick)
34
35
  }
35
36
  }
36
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAyB;IACtE,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,OAAO;IACZ,UAAU,EAAE;QACV,KAAK,EAAE,cAAc;KACtB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACzC,OAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QACtD,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,SAAS,CAAC,MAAM,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QAC5F,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACvC,OAAA,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAA;KACnF;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC;YAC3D,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC;YAC3D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC;SACnD;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\n/**\n * Default implementation for the ResultSchema.\n *\n * @public\n */\nexport const resultSchema = createMutableSchema<PlatformResult, Result>({\n id: '__id',\n images: '__images',\n name: '__name',\n url: '__url',\n identifier: {\n value: '__externalId'\n },\n rating: {\n value: () => null\n },\n price: {\n value: '__prices.current.value',\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current.value,\n futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n rawPrices.current.value < (rawPrices.previous?.value ?? rawPrices.current.value)\n },\n type: () => 'Default',\n modelName: () => 'Result',\n isWishlisted: () => false,\n tagging: {\n $path: 'tagging',\n $subSchema: {\n add2cart: ({ add2cart }) => getTaggingInfoFromUrl(add2cart),\n checkout: ({ checkout }) => getTaggingInfoFromUrl(checkout),\n click: ({ click }) => getTaggingInfoFromUrl(click)\n }\n }\n});\n"]}
1
+ {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGxF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAyB;IACtE,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,OAAO;IACZ,UAAU,EAAE;QACV,KAAK,EAAE,cAAc;KACtB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,wBAAwB;QAC/B,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACzC,OAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QACtD,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,SAAS,CAAC,MAAM,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAA,EAAA;QAC5F,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,eACvC,OAAA,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,EAAA;KACnF;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC;YAC3D,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC;YAC3D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC;YAClD,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,sBAAsB,CAAC,YAAY,CAAC;SACzE;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getDisplayClickTagging, getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\n/**\n * Default implementation for the ResultSchema.\n *\n * @public\n */\nexport const resultSchema = createMutableSchema<PlatformResult, Result>({\n id: '__id',\n images: '__images',\n name: '__name',\n url: '__url',\n identifier: {\n value: '__externalId'\n },\n rating: {\n value: () => null\n },\n price: {\n value: '__prices.current.value',\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current.value,\n futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n rawPrices.current.value < (rawPrices.previous?.value ?? rawPrices.current.value)\n },\n type: () => 'Default',\n modelName: () => 'Result',\n isWishlisted: () => false,\n tagging: {\n $path: 'tagging',\n $subSchema: {\n add2cart: ({ add2cart }) => getTaggingInfoFromUrl(add2cart),\n checkout: ({ checkout }) => getTaggingInfoFromUrl(checkout),\n click: ({ click }) => getTaggingInfoFromUrl(click),\n displayClick: ({ displayClick }) => getDisplayClickTagging(displayClick)\n }\n }\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tagging.model.js","sourceRoot":"","sources":["../../../../src/types/models/tagging.model.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tagging model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformTagging {\n add2cart: string;\n checkout: string;\n click: string;\n}\n"]}
1
+ {"version":3,"file":"tagging.model.js","sourceRoot":"","sources":["../../../../src/types/models/tagging.model.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Tagging model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformTagging {\n add2cart: string;\n checkout: string;\n click: string;\n displayClick: string;\n}\n"]}
@@ -9,6 +9,15 @@ import { TaggingRequest } from '@empathyco/x-types';
9
9
  * @public
10
10
  */
11
11
  export declare function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest;
12
+ /**
13
+ * Generates the displayClick tagging info.
14
+ *
15
+ * @param displayTaggingUrl - The url containing the displayClick tagging info.
16
+ * @returns The object with the tagging info.
17
+ *
18
+ * @public
19
+ */
20
+ export declare function getDisplayClickTagging(displayTaggingUrl: string): TaggingRequest;
12
21
  /**
13
22
  * Returns the base url path and an object with the query parameters.
14
23
  *
@@ -7,4 +7,5 @@ export interface PlatformTagging {
7
7
  add2cart: string;
8
8
  checkout: string;
9
9
  click: string;
10
+ displayClick: string;
10
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-adapter-platform",
3
- "version": "1.0.0-alpha.76",
3
+ "version": "1.0.0-alpha.78",
4
4
  "description": "A search client for the Empathy Platform API",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "f82fbf72b2cb2db236ea5490cd6a75002bc7dfd9"
61
+ "gitHead": "4496791f07bdaeaf56f14334719623ba374baddb"
62
62
  }
@@ -427,6 +427,52 @@
427
427
  "endIndex": 14
428
428
  }
429
429
  },
430
+ {
431
+ "kind": "Function",
432
+ "canonicalReference": "@empathyco/x-adapter-platform!getDisplayClickTagging:function(1)",
433
+ "docComment": "/**\n * Generates the displayClick tagging info.\n *\n * @param displayTaggingUrl - The url containing the displayClick tagging info.\n *\n * @returns The object with the tagging info.\n *\n * @public\n */\n",
434
+ "excerptTokens": [
435
+ {
436
+ "kind": "Content",
437
+ "text": "export declare function getDisplayClickTagging(displayTaggingUrl: "
438
+ },
439
+ {
440
+ "kind": "Content",
441
+ "text": "string"
442
+ },
443
+ {
444
+ "kind": "Content",
445
+ "text": "): "
446
+ },
447
+ {
448
+ "kind": "Reference",
449
+ "text": "TaggingRequest",
450
+ "canonicalReference": "@empathyco/x-adapter-platform!TaggingRequest:interface"
451
+ },
452
+ {
453
+ "kind": "Content",
454
+ "text": ";"
455
+ }
456
+ ],
457
+ "fileUrlPath": "dist/types/mappers/url.utils.d.ts",
458
+ "returnTypeTokenRange": {
459
+ "startIndex": 3,
460
+ "endIndex": 4
461
+ },
462
+ "releaseTag": "Public",
463
+ "overloadIndex": 1,
464
+ "parameters": [
465
+ {
466
+ "parameterName": "displayTaggingUrl",
467
+ "parameterTypeTokenRange": {
468
+ "startIndex": 1,
469
+ "endIndex": 2
470
+ },
471
+ "isOptional": false
472
+ }
473
+ ],
474
+ "name": "getDisplayClickTagging"
475
+ },
430
476
  {
431
477
  "kind": "Function",
432
478
  "canonicalReference": "@empathyco/x-adapter-platform!getFacetConfig:function(1)",
@@ -4298,6 +4344,33 @@
4298
4344
  "startIndex": 1,
4299
4345
  "endIndex": 2
4300
4346
  }
4347
+ },
4348
+ {
4349
+ "kind": "PropertySignature",
4350
+ "canonicalReference": "@empathyco/x-adapter-platform!PlatformTagging#displayClick:member",
4351
+ "docComment": "",
4352
+ "excerptTokens": [
4353
+ {
4354
+ "kind": "Content",
4355
+ "text": "displayClick: "
4356
+ },
4357
+ {
4358
+ "kind": "Content",
4359
+ "text": "string"
4360
+ },
4361
+ {
4362
+ "kind": "Content",
4363
+ "text": ";"
4364
+ }
4365
+ ],
4366
+ "isReadonly": false,
4367
+ "isOptional": false,
4368
+ "releaseTag": "Public",
4369
+ "name": "displayClick",
4370
+ "propertyTypeTokenRange": {
4371
+ "startIndex": 1,
4372
+ "endIndex": 2
4373
+ }
4301
4374
  }
4302
4375
  ],
4303
4376
  "extendsTokenRanges": []
@@ -59,11 +59,14 @@ export interface FacetConfig {
59
59
  // @public
60
60
  export const facetSchema: MutableSchema<PlatformFacet, EditableNumberRangeFacet | HierarchicalFacet | NumberRangeFacet | SimpleFacet>;
61
61
 
62
+ // Warning: (ae-forgotten-export) The symbol "TaggingRequest" needs to be exported by the entry point index.d.ts
63
+ //
64
+ // @public
65
+ export function getDisplayClickTagging(displayTaggingUrl: string): TaggingRequest;
66
+
62
67
  // @public
63
68
  export function getFacetConfig(type: PlatformFacetType): FacetConfig;
64
69
 
65
- // Warning: (ae-forgotten-export) The symbol "TaggingRequest" needs to be exported by the entry point index.d.ts
66
- //
67
70
  // @public
68
71
  export function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest;
69
72
 
@@ -461,6 +464,8 @@ export interface PlatformTagging {
461
464
  checkout: string;
462
465
  // (undocumented)
463
466
  click: string;
467
+ // (undocumented)
468
+ displayClick: string;
464
469
  }
465
470
 
466
471
  // @public