@empathyco/x-adapter-platform 1.0.0-alpha.21 → 1.0.0-alpha.22

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.
Files changed (34) hide show
  1. package/dist/cjs/mappers/index.js +1 -0
  2. package/dist/cjs/mappers/index.js.map +1 -1
  3. package/dist/cjs/mappers/url.utils.js +59 -0
  4. package/dist/cjs/mappers/url.utils.js.map +1 -0
  5. package/dist/cjs/schemas/models/banner.schema.js +2 -2
  6. package/dist/cjs/schemas/models/banner.schema.js.map +1 -1
  7. package/dist/cjs/schemas/models/promoted.schema.js +2 -2
  8. package/dist/cjs/schemas/models/promoted.schema.js.map +1 -1
  9. package/dist/cjs/schemas/models/redirection.schema.js +2 -2
  10. package/dist/cjs/schemas/models/redirection.schema.js.map +1 -1
  11. package/dist/cjs/schemas/models/result.schema.js +4 -4
  12. package/dist/cjs/schemas/models/result.schema.js.map +1 -1
  13. package/dist/cjs/schemas/responses/search-response.schema.js +2 -2
  14. package/dist/cjs/schemas/responses/search-response.schema.js.map +1 -1
  15. package/dist/cjs/types/platform-adapter.types.js.map +1 -1
  16. package/dist/esm/mappers/index.js +1 -0
  17. package/dist/esm/mappers/index.js.map +1 -1
  18. package/dist/esm/mappers/url.utils.js +54 -0
  19. package/dist/esm/mappers/url.utils.js.map +1 -0
  20. package/dist/esm/schemas/models/banner.schema.js +1 -1
  21. package/dist/esm/schemas/models/banner.schema.js.map +1 -1
  22. package/dist/esm/schemas/models/promoted.schema.js +1 -1
  23. package/dist/esm/schemas/models/promoted.schema.js.map +1 -1
  24. package/dist/esm/schemas/models/redirection.schema.js +1 -1
  25. package/dist/esm/schemas/models/redirection.schema.js.map +1 -1
  26. package/dist/esm/schemas/models/result.schema.js +1 -1
  27. package/dist/esm/schemas/models/result.schema.js.map +1 -1
  28. package/dist/esm/schemas/responses/search-response.schema.js +1 -1
  29. package/dist/esm/schemas/responses/search-response.schema.js.map +1 -1
  30. package/dist/esm/types/platform-adapter.types.js.map +1 -1
  31. package/dist/types/mappers/index.d.ts +1 -0
  32. package/dist/types/mappers/url.utils.d.ts +20 -0
  33. package/dist/types/types/platform-adapter.types.d.ts +11 -11
  34. package/package.json +5 -5
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./requests"), exports);
5
5
  tslib_1.__exportStar(require("./responses"), exports);
6
+ tslib_1.__exportStar(require("./url.utils"), exports);
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mappers/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,sDAA4B","sourcesContent":["export * from './requests';\nexport * from './responses';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mappers/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,sDAA4B;AAC5B,sDAA4B","sourcesContent":["export * from './requests';\nexport * from './responses';\nexport * from './url.utils';\n"]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractUrlParameters = exports.getTaggingInfoFromUrl = void 0;
4
+ /**
5
+ * Extracts the tagging info from a URL.
6
+ *
7
+ * @param taggingUrl - The url containing the tagging info.
8
+ *
9
+ * @returns The object with the tagging info.
10
+ */
11
+ function getTaggingInfoFromUrl(taggingUrl) {
12
+ const { url, params } = extractUrlParameters(taggingUrl);
13
+ return {
14
+ url,
15
+ params: {
16
+ ...params,
17
+ follow: false
18
+ }
19
+ };
20
+ }
21
+ exports.getTaggingInfoFromUrl = getTaggingInfoFromUrl;
22
+ /**
23
+ * Returns the base url path and an object with the query parameters.
24
+ *
25
+ * @param url - The url string to manipulate.
26
+ *
27
+ * @returns The object with the url information.
28
+ */
29
+ function extractUrlParameters(url) {
30
+ const searchParams = new Map();
31
+ try {
32
+ const urlObject = new URL(url);
33
+ urlObject.searchParams.forEach((value, key) => {
34
+ const param = searchParams.get(key);
35
+ if (Array.isArray(param)) {
36
+ searchParams.set(key, [...param, value]);
37
+ }
38
+ else if (param) {
39
+ searchParams.set(key, [param, value]);
40
+ }
41
+ else {
42
+ searchParams.set(key, value);
43
+ }
44
+ });
45
+ return {
46
+ url: `${urlObject.origin}${urlObject.pathname}`,
47
+ params: Object.fromEntries(searchParams)
48
+ };
49
+ }
50
+ catch (e) {
51
+ //eslint-disable-next-line no-console
52
+ console.warn('Invalid url', url); // TODO Use Empathy's logger
53
+ return {
54
+ url
55
+ };
56
+ }
57
+ }
58
+ exports.extractUrlParameters = extractUrlParameters;
59
+ //# sourceMappingURL=url.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;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;;;;;;GAMG;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 */\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 */\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"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bannerMutableSchema = void 0;
4
4
  const x_adapter_1 = require("@empathyco/x-adapter");
5
- const x_utils_1 = require("@empathyco/x-utils");
5
+ const url_utils_1 = require("../../mappers/url.utils");
6
6
  exports.bannerMutableSchema = (0, x_adapter_1.createMutableSchema)({
7
7
  id: 'id',
8
8
  title: 'title',
@@ -10,7 +10,7 @@ exports.bannerMutableSchema = (0, x_adapter_1.createMutableSchema)({
10
10
  image: 'image_url',
11
11
  modelName: () => 'Banner',
12
12
  tagging: {
13
- query: ({ tagging }) => { var _a; return (0, x_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.query) !== null && _a !== void 0 ? _a : ''); }
13
+ query: ({ tagging }) => { var _a; return (0, url_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.query) !== null && _a !== void 0 ? _a : ''); }
14
14
  }
15
15
  });
16
16
  //# sourceMappingURL=banner.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/banner.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAEnE,gDAA2D;AAG9C,QAAA,mBAAmB,GAAG,IAAA,+BAAmB,EAAiC;IACrF,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,+BAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Banner } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformBanner } from '../../types/models/banner.model';\n\nexport const bannerMutableSchema = createMutableSchema<Schema<PlatformBanner, Banner>>({\n id: 'id',\n title: 'title',\n url: 'url',\n image: 'image_url',\n modelName: () => 'Banner',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"banner.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/banner.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAEnE,uDAAgE;AAGnD,QAAA,mBAAmB,GAAG,IAAA,+BAAmB,EAAiC;IACrF,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,iCAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Banner } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformBanner } from '../../types/models/banner.model';\n\nexport const bannerMutableSchema = createMutableSchema<Schema<PlatformBanner, Banner>>({\n id: 'id',\n title: 'title',\n url: 'url',\n image: 'image_url',\n modelName: () => 'Banner',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.promotedMutableSchema = void 0;
4
4
  const x_adapter_1 = require("@empathyco/x-adapter");
5
- const x_utils_1 = require("@empathyco/x-utils");
5
+ const url_utils_1 = require("../../mappers/url.utils");
6
6
  exports.promotedMutableSchema = (0, x_adapter_1.createMutableSchema)({
7
7
  id: 'id',
8
8
  url: 'url',
@@ -10,7 +10,7 @@ exports.promotedMutableSchema = (0, x_adapter_1.createMutableSchema)({
10
10
  image: 'image_url',
11
11
  modelName: () => 'Promoted',
12
12
  tagging: {
13
- query: ({ tagging }) => { var _a; return (0, x_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.query) !== null && _a !== void 0 ? _a : ''); }
13
+ query: ({ tagging }) => { var _a; return (0, url_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.query) !== null && _a !== void 0 ? _a : ''); }
14
14
  }
15
15
  });
16
16
  //# sourceMappingURL=promoted.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"promoted.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/promoted.schema.ts"],"names":[],"mappings":";;;AACA,oDAAmE;AACnE,gDAA2D;AAG9C,QAAA,qBAAqB,GAAG,IAAA,+BAAmB,EAAqC;IAC3F,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU;IAC3B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,+BAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { Promoted } from '@empathyco/x-types';\nimport { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformPromoted } from '../../types/models/promoted.model';\n\nexport const promotedMutableSchema = createMutableSchema<Schema<PlatformPromoted, Promoted>>({\n id: 'id',\n url: 'url',\n title: 'title',\n image: 'image_url',\n modelName: () => 'Promoted',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"promoted.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/promoted.schema.ts"],"names":[],"mappings":";;;AACA,oDAAmE;AAEnE,uDAAgE;AAEnD,QAAA,qBAAqB,GAAG,IAAA,+BAAmB,EAAqC;IAC3F,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU;IAC3B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,iCAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { Promoted } from '@empathyco/x-types';\nimport { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { PlatformPromoted } from '../../types/models/promoted.model';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\n\nexport const promotedMutableSchema = createMutableSchema<Schema<PlatformPromoted, Promoted>>({\n id: 'id',\n url: 'url',\n title: 'title',\n image: 'image_url',\n modelName: () => 'Promoted',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.redirectionMutableSchema = void 0;
4
4
  const x_adapter_1 = require("@empathyco/x-adapter");
5
- const x_utils_1 = require("@empathyco/x-utils");
5
+ const url_utils_1 = require("../../mappers/url.utils");
6
6
  exports.redirectionMutableSchema = (0, x_adapter_1.createMutableSchema)({
7
7
  id: 'id',
8
8
  url: 'url',
9
9
  modelName: () => 'Redirection',
10
10
  tagging: {
11
- click: ({ tagging }) => { var _a; return (0, x_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.click) !== null && _a !== void 0 ? _a : ''); }
11
+ click: ({ tagging }) => { var _a; return (0, url_utils_1.getTaggingInfoFromUrl)((_a = tagging === null || tagging === void 0 ? void 0 : tagging.click) !== null && _a !== void 0 ? _a : ''); }
12
12
  }
13
13
  });
14
14
  //# sourceMappingURL=redirection.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirection.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/redirection.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAEnE,gDAA2D;AAG9C,QAAA,wBAAwB,GAAG,IAAA,+BAAmB,EAEzD;IACA,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,+BAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Redirection } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformRedirection } from '../../types/models/redirection.model';\n\nexport const redirectionMutableSchema = createMutableSchema<\n Schema<PlatformRedirection, Redirection>\n>({\n id: 'id',\n url: 'url',\n modelName: () => 'Redirection',\n tagging: {\n click: ({ tagging }) => getTaggingInfoFromUrl(tagging?.click ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"redirection.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/redirection.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAGnE,uDAAgE;AAEnD,QAAA,wBAAwB,GAAG,IAAA,+BAAmB,EAEzD;IACA,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,iCAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Redirection } from '@empathyco/x-types';\nimport { PlatformRedirection } from '../../types/models/redirection.model';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\n\nexport const redirectionMutableSchema = createMutableSchema<\n Schema<PlatformRedirection, Redirection>\n>({\n id: 'id',\n url: 'url',\n modelName: () => 'Redirection',\n tagging: {\n click: ({ tagging }) => getTaggingInfoFromUrl(tagging?.click ?? '')\n }\n});\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resultSchema = void 0;
4
4
  const x_adapter_1 = require("@empathyco/x-adapter");
5
- const x_utils_1 = require("@empathyco/x-utils");
5
+ const url_utils_1 = require("../../mappers/url.utils");
6
6
  exports.resultSchema = (0, x_adapter_1.createMutableSchema)({
7
7
  id: 'id',
8
8
  images: ({ image }) => {
@@ -27,9 +27,9 @@ exports.resultSchema = (0, x_adapter_1.createMutableSchema)({
27
27
  tagging: {
28
28
  $path: 'tagging',
29
29
  $subSchema: {
30
- add2cart: ({ add2cart }) => (0, x_utils_1.getTaggingInfoFromUrl)(add2cart),
31
- checkout: ({ checkout }) => (0, x_utils_1.getTaggingInfoFromUrl)(checkout),
32
- click: ({ click }) => (0, x_utils_1.getTaggingInfoFromUrl)(click)
30
+ add2cart: ({ add2cart }) => (0, url_utils_1.getTaggingInfoFromUrl)(add2cart),
31
+ checkout: ({ checkout }) => (0, url_utils_1.getTaggingInfoFromUrl)(checkout),
32
+ click: ({ click }) => (0, url_utils_1.getTaggingInfoFromUrl)(click)
33
33
  }
34
34
  }
35
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAEnE,gDAA2D;AAG9C,QAAA,YAAY,GAAG,IAAA,+BAAmB,EAAiC;IAC9E,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,CAAC;IACD,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE;QACV,KAAK,EAAE,IAAI;KACZ;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;QACtB,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;KACzB;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,+BAAqB,EAAC,QAAQ,CAAC;YAC3D,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,+BAAqB,EAAC,QAAQ,CAAC;YAC3D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAA,+BAAqB,EAAC,KAAK,CAAC;SACnD;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\nexport const resultSchema = createMutableSchema<Schema<PlatformResult, Result>>({\n id: 'id',\n images: ({ image }) => {\n return image ? [image] : [];\n },\n name: 'name',\n url: 'url',\n identifier: {\n value: 'id'\n },\n rating: {\n value: () => null\n },\n price: {\n value: 'price',\n originalValue: 'price',\n hasDiscount: () => false\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,oDAAmE;AAEnE,uDAAgE;AAGnD,QAAA,YAAY,GAAG,IAAA,+BAAmB,EAAiC;IAC9E,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,CAAC;IACD,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE;QACV,KAAK,EAAE,IAAI;KACZ;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;QACtB,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;KACzB;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, Schema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\nexport const resultSchema = createMutableSchema<Schema<PlatformResult, Result>>({\n id: 'id',\n images: ({ image }) => {\n return image ? [image] : [];\n },\n name: 'name',\n url: 'url',\n identifier: {\n value: 'id'\n },\n rating: {\n value: () => null\n },\n price: {\n value: 'price',\n originalValue: 'price',\n hasDiscount: () => false\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"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchResponseMutableSchema = void 0;
4
4
  const x_adapter_1 = require("@empathyco/x-adapter");
5
- const x_utils_1 = require("@empathyco/x-utils");
5
+ const url_utils_1 = require("../../mappers/url.utils");
6
6
  const banner_schema_1 = require("../models/banner.schema");
7
7
  const facet_schema_1 = require("../models/facet.schema");
8
8
  const promoted_schema_1 = require("../models/promoted.schema");
@@ -31,6 +31,6 @@ exports.searchResponseMutableSchema = (0, x_adapter_1.createMutableSchema)({
31
31
  $path: 'direct.content',
32
32
  $subSchema: redirection_schema_1.redirectionMutableSchema
33
33
  },
34
- queryTagging: ({ catalog }) => { var _a; return (0, x_utils_1.getTaggingInfoFromUrl)((_a = catalog === null || catalog === void 0 ? void 0 : catalog.tagging) === null || _a === void 0 ? void 0 : _a.query); }
34
+ queryTagging: ({ catalog }) => { var _a; return (0, url_utils_1.getTaggingInfoFromUrl)((_a = catalog === null || catalog === void 0 ? void 0 : catalog.tagging) === null || _a === void 0 ? void 0 : _a.query); }
35
35
  });
36
36
  //# sourceMappingURL=search-response.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-response.schema.js","sourceRoot":"","sources":["../../../../src/schemas/responses/search-response.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AACnE,gDAA2D;AAG3D,2DAA8D;AAC9D,yDAA4D;AAC5D,+DAAkE;AAClE,qEAAwE;AACxE,2DAAuD;AAE1C,QAAA,2BAA2B,GAAG,IAAA,+BAAmB,EAE5D;IACA,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,4BAAY;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,iCAAkB;KAC/B;IACD,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE;QACP,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,mCAAmB;KAChC;IACD,SAAS,EAAE;QACT,KAAK,EAAE,kBAAkB;QACzB,UAAU,EAAE,uCAAqB;KAClC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,6CAAwB;KACrC;IACD,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,+BAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,CAAC,CAAA,EAAA;CAC9E,CAAC,CAAC","sourcesContent":["import { Schema, createMutableSchema } from '@empathyco/x-adapter';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { SearchResponse } from '@empathyco/x-types';\nimport { PlatformSearchResponse } from '../../types/responses/search-response.model';\nimport { bannerMutableSchema } from '../models/banner.schema';\nimport { facetMutableSchema } from '../models/facet.schema';\nimport { promotedMutableSchema } from '../models/promoted.schema';\nimport { redirectionMutableSchema } from '../models/redirection.schema';\nimport { resultSchema } from '../models/result.schema';\n\nexport const searchResponseMutableSchema = createMutableSchema<\n Schema<PlatformSearchResponse, SearchResponse>\n>({\n results: {\n $path: 'catalog.content',\n $subSchema: resultSchema\n },\n facets: {\n $path: 'catalog.facets',\n $subSchema: facetMutableSchema\n },\n totalResults: 'catalog.numFound',\n spellcheck: 'catalog.spellchecked',\n banners: {\n $path: 'banner.content',\n $subSchema: bannerMutableSchema\n },\n promoteds: {\n $path: 'promoted.content',\n $subSchema: promotedMutableSchema\n },\n redirections: {\n $path: 'direct.content',\n $subSchema: redirectionMutableSchema\n },\n queryTagging: ({ catalog }) => getTaggingInfoFromUrl(catalog?.tagging?.query)\n});\n"]}
1
+ {"version":3,"file":"search-response.schema.js","sourceRoot":"","sources":["../../../../src/schemas/responses/search-response.schema.ts"],"names":[],"mappings":";;;AAAA,oDAAmE;AAEnE,uDAAgE;AAEhE,2DAA8D;AAC9D,yDAA4D;AAC5D,+DAAkE;AAClE,qEAAwE;AACxE,2DAAuD;AAE1C,QAAA,2BAA2B,GAAG,IAAA,+BAAmB,EAE5D;IACA,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,4BAAY;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,iCAAkB;KAC/B;IACD,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE;QACP,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,mCAAmB;KAChC;IACD,SAAS,EAAE;QACT,KAAK,EAAE,kBAAkB;QACzB,UAAU,EAAE,uCAAqB;KAClC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,6CAAwB;KACrC;IACD,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,IAAA,iCAAqB,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,CAAC,CAAA,EAAA;CAC9E,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { SearchResponse } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformSearchResponse } from '../../types/responses/search-response.model';\nimport { bannerMutableSchema } from '../models/banner.schema';\nimport { facetMutableSchema } from '../models/facet.schema';\nimport { promotedMutableSchema } from '../models/promoted.schema';\nimport { redirectionMutableSchema } from '../models/redirection.schema';\nimport { resultSchema } from '../models/result.schema';\n\nexport const searchResponseMutableSchema = createMutableSchema<\n Schema<PlatformSearchResponse, SearchResponse>\n>({\n results: {\n $path: 'catalog.content',\n $subSchema: resultSchema\n },\n facets: {\n $path: 'catalog.facets',\n $subSchema: facetMutableSchema\n },\n totalResults: 'catalog.numFound',\n spellcheck: 'catalog.spellchecked',\n banners: {\n $path: 'banner.content',\n $subSchema: bannerMutableSchema\n },\n promoteds: {\n $path: 'promoted.content',\n $subSchema: promotedMutableSchema\n },\n redirections: {\n $path: 'direct.content',\n $subSchema: redirectionMutableSchema\n },\n queryTagging: ({ catalog }) => getTaggingInfoFromUrl(catalog?.tagging?.query)\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"platform-adapter.types.js","sourceRoot":"","sources":["../../../src/types/platform-adapter.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Adapter, EndpointAdapter } from '@empathyco/x-adapter';\nimport {\n IdentifierResultsRequest,\n IdentifierResultsResponse,\n PopularSearchesRequest,\n PopularSearchesResponse,\n QuerySuggestionsRequest,\n NextQueriesRequest,\n NextQueriesResponse,\n QuerySuggestionsResponse,\n RecommendationsRequest,\n RecommendationsResponse,\n TaggingRequest,\n RelatedTagsResponse,\n RelatedTagsRequest,\n SearchRequest,\n SearchResponse\n} from '@empathyco/x-types';\n\nexport interface PlatformAdapter extends Adapter {\n search: EndpointAdapter<SearchRequest, SearchResponse>;\n popularSearches: EndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;\n nextQueries: EndpointAdapter<NextQueriesRequest, NextQueriesResponse>;\n recommendations: EndpointAdapter<RecommendationsRequest, RecommendationsResponse>;\n querySuggestions: EndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;\n relatedTags: EndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;\n identifierResults: EndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;\n tagging: EndpointAdapter<TaggingRequest, void>;\n}\n"]}
1
+ {"version":3,"file":"platform-adapter.types.js","sourceRoot":"","sources":["../../../src/types/platform-adapter.types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n IdentifierResultsRequest,\n IdentifierResultsResponse,\n NextQueriesRequest,\n NextQueriesResponse,\n PopularSearchesRequest,\n PopularSearchesResponse,\n QuerySuggestionsRequest,\n QuerySuggestionsResponse,\n RecommendationsRequest,\n RecommendationsResponse,\n RelatedTagsRequest,\n RelatedTagsResponse,\n SearchRequest,\n SearchResponse,\n TaggingRequest,\n XComponentsAdapter\n} from '@empathyco/x-types';\nimport { ExtendableEndpointAdapter } from '@empathyco/x-adapter';\n\nexport interface PlatformAdapter extends XComponentsAdapter {\n search: ExtendableEndpointAdapter<SearchRequest, SearchResponse>;\n popularSearches: ExtendableEndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;\n nextQueries: ExtendableEndpointAdapter<NextQueriesRequest, NextQueriesResponse>;\n recommendations: ExtendableEndpointAdapter<RecommendationsRequest, RecommendationsResponse>;\n querySuggestions: ExtendableEndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;\n relatedTags: ExtendableEndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;\n identifierResults: ExtendableEndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;\n tagging: ExtendableEndpointAdapter<TaggingRequest, void>;\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from './requests';
2
2
  export * from './responses';
3
+ export * from './url.utils';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC","sourcesContent":["export * from './requests';\nexport * from './responses';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC","sourcesContent":["export * from './requests';\nexport * from './responses';\nexport * from './url.utils';\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Extracts the tagging info from a URL.
3
+ *
4
+ * @param taggingUrl - The url containing the tagging info.
5
+ *
6
+ * @returns The object with the tagging info.
7
+ */
8
+ export function getTaggingInfoFromUrl(taggingUrl) {
9
+ const { url, params } = extractUrlParameters(taggingUrl);
10
+ return {
11
+ url,
12
+ params: {
13
+ ...params,
14
+ follow: false
15
+ }
16
+ };
17
+ }
18
+ /**
19
+ * Returns the base url path and an object with the query parameters.
20
+ *
21
+ * @param url - The url string to manipulate.
22
+ *
23
+ * @returns The object with the url information.
24
+ */
25
+ export function extractUrlParameters(url) {
26
+ const searchParams = new Map();
27
+ try {
28
+ const urlObject = new URL(url);
29
+ urlObject.searchParams.forEach((value, key) => {
30
+ const param = searchParams.get(key);
31
+ if (Array.isArray(param)) {
32
+ searchParams.set(key, [...param, value]);
33
+ }
34
+ else if (param) {
35
+ searchParams.set(key, [param, value]);
36
+ }
37
+ else {
38
+ searchParams.set(key, value);
39
+ }
40
+ });
41
+ return {
42
+ url: `${urlObject.origin}${urlObject.pathname}`,
43
+ params: Object.fromEntries(searchParams)
44
+ };
45
+ }
46
+ catch (e) {
47
+ //eslint-disable-next-line no-console
48
+ console.warn('Invalid url', url); // TODO Use Empathy's logger
49
+ return {
50
+ url
51
+ };
52
+ }
53
+ }
54
+ //# sourceMappingURL=url.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/mappers/url.utils.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;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;;;;;;GAMG;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 */\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 */\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 '@empathyco/x-utils';
2
+ import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  export const bannerMutableSchema = createMutableSchema({
4
4
  id: 'id',
5
5
  title: 'title',
@@ -1 +1 @@
1
- {"version":3,"file":"banner.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/banner.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAiC;IACrF,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Banner } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformBanner } from '../../types/models/banner.model';\n\nexport const bannerMutableSchema = createMutableSchema<Schema<PlatformBanner, Banner>>({\n id: 'id',\n title: 'title',\n url: 'url',\n image: 'image_url',\n modelName: () => 'Banner',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"banner.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/banner.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAiC;IACrF,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ;IACzB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Banner } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformBanner } from '../../types/models/banner.model';\n\nexport const bannerMutableSchema = createMutableSchema<Schema<PlatformBanner, Banner>>({\n id: 'id',\n title: 'title',\n url: 'url',\n image: 'image_url',\n modelName: () => 'Banner',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createMutableSchema } from '@empathyco/x-adapter';
2
- import { getTaggingInfoFromUrl } from '@empathyco/x-utils';
2
+ import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  export const promotedMutableSchema = createMutableSchema({
4
4
  id: 'id',
5
5
  url: 'url',
@@ -1 +1 @@
1
- {"version":3,"file":"promoted.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/promoted.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAqC;IAC3F,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU;IAC3B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { Promoted } from '@empathyco/x-types';\nimport { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformPromoted } from '../../types/models/promoted.model';\n\nexport const promotedMutableSchema = createMutableSchema<Schema<PlatformPromoted, Promoted>>({\n id: 'id',\n url: 'url',\n title: 'title',\n image: 'image_url',\n modelName: () => 'Promoted',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"promoted.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/promoted.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAqC;IAC3F,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU;IAC3B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { Promoted } from '@empathyco/x-types';\nimport { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { PlatformPromoted } from '../../types/models/promoted.model';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\n\nexport const promotedMutableSchema = createMutableSchema<Schema<PlatformPromoted, Promoted>>({\n id: 'id',\n url: 'url',\n title: 'title',\n image: 'image_url',\n modelName: () => 'Promoted',\n tagging: {\n query: ({ tagging }) => getTaggingInfoFromUrl(tagging?.query ?? '')\n }\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createMutableSchema } from '@empathyco/x-adapter';
2
- import { getTaggingInfoFromUrl } from '@empathyco/x-utils';
2
+ import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  export const redirectionMutableSchema = createMutableSchema({
4
4
  id: 'id',
5
5
  url: 'url',
@@ -1 +1 @@
1
- {"version":3,"file":"redirection.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/redirection.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAEzD;IACA,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Redirection } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformRedirection } from '../../types/models/redirection.model';\n\nexport const redirectionMutableSchema = createMutableSchema<\n Schema<PlatformRedirection, Redirection>\n>({\n id: 'id',\n url: 'url',\n modelName: () => 'Redirection',\n tagging: {\n click: ({ tagging }) => getTaggingInfoFromUrl(tagging?.click ?? '')\n }\n});\n"]}
1
+ {"version":3,"file":"redirection.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/redirection.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAEzD;IACA,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA;KACpE;CACF,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { Redirection } from '@empathyco/x-types';\nimport { PlatformRedirection } from '../../types/models/redirection.model';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\n\nexport const redirectionMutableSchema = createMutableSchema<\n Schema<PlatformRedirection, Redirection>\n>({\n id: 'id',\n url: 'url',\n modelName: () => 'Redirection',\n tagging: {\n click: ({ tagging }) => getTaggingInfoFromUrl(tagging?.click ?? '')\n }\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createMutableSchema } from '@empathyco/x-adapter';
2
- import { getTaggingInfoFromUrl } from '@empathyco/x-utils';
2
+ import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  export const resultSchema = createMutableSchema({
4
4
  id: 'id',
5
5
  images: ({ image }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAiC;IAC9E,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,CAAC;IACD,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE;QACV,KAAK,EAAE,IAAI;KACZ;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;QACtB,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;KACzB;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, Schema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\nexport const resultSchema = createMutableSchema<Schema<PlatformResult, Result>>({\n id: 'id',\n images: ({ image }) => {\n return image ? [image] : [];\n },\n name: 'name',\n url: 'url',\n identifier: {\n value: 'id'\n },\n rating: {\n value: () => null\n },\n price: {\n value: 'price',\n originalValue: 'price',\n hasDiscount: () => false\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,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAiC;IAC9E,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACpB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,CAAC;IACD,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE;QACV,KAAK,EAAE,IAAI;KACZ;IACD,MAAM,EAAE;QACN,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;QACtB,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;KACzB;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, Schema } from '@empathyco/x-adapter';\nimport { Result } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformResult } from '../../types/models/result.model';\n\nexport const resultSchema = createMutableSchema<Schema<PlatformResult, Result>>({\n id: 'id',\n images: ({ image }) => {\n return image ? [image] : [];\n },\n name: 'name',\n url: 'url',\n identifier: {\n value: 'id'\n },\n rating: {\n value: () => null\n },\n price: {\n value: 'price',\n originalValue: 'price',\n hasDiscount: () => false\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,5 +1,5 @@
1
1
  import { createMutableSchema } from '@empathyco/x-adapter';
2
- import { getTaggingInfoFromUrl } from '@empathyco/x-utils';
2
+ import { getTaggingInfoFromUrl } from '../../mappers/url.utils';
3
3
  import { bannerMutableSchema } from '../models/banner.schema';
4
4
  import { facetMutableSchema } from '../models/facet.schema';
5
5
  import { promotedMutableSchema } from '../models/promoted.schema';
@@ -1 +1 @@
1
- {"version":3,"file":"search-response.schema.js","sourceRoot":"","sources":["../../../../src/schemas/responses/search-response.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAE5D;IACA,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,YAAY;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,kBAAkB;KAC/B;IACD,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE;QACP,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,mBAAmB;KAChC;IACD,SAAS,EAAE;QACT,KAAK,EAAE,kBAAkB;QACzB,UAAU,EAAE,qBAAqB;KAClC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,wBAAwB;KACrC;IACD,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,CAAC,CAAA,EAAA;CAC9E,CAAC,CAAC","sourcesContent":["import { Schema, createMutableSchema } from '@empathyco/x-adapter';\nimport { getTaggingInfoFromUrl } from '@empathyco/x-utils';\nimport { SearchResponse } from '@empathyco/x-types';\nimport { PlatformSearchResponse } from '../../types/responses/search-response.model';\nimport { bannerMutableSchema } from '../models/banner.schema';\nimport { facetMutableSchema } from '../models/facet.schema';\nimport { promotedMutableSchema } from '../models/promoted.schema';\nimport { redirectionMutableSchema } from '../models/redirection.schema';\nimport { resultSchema } from '../models/result.schema';\n\nexport const searchResponseMutableSchema = createMutableSchema<\n Schema<PlatformSearchResponse, SearchResponse>\n>({\n results: {\n $path: 'catalog.content',\n $subSchema: resultSchema\n },\n facets: {\n $path: 'catalog.facets',\n $subSchema: facetMutableSchema\n },\n totalResults: 'catalog.numFound',\n spellcheck: 'catalog.spellchecked',\n banners: {\n $path: 'banner.content',\n $subSchema: bannerMutableSchema\n },\n promoteds: {\n $path: 'promoted.content',\n $subSchema: promotedMutableSchema\n },\n redirections: {\n $path: 'direct.content',\n $subSchema: redirectionMutableSchema\n },\n queryTagging: ({ catalog }) => getTaggingInfoFromUrl(catalog?.tagging?.query)\n});\n"]}
1
+ {"version":3,"file":"search-response.schema.js","sourceRoot":"","sources":["../../../../src/schemas/responses/search-response.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAU,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAE5D;IACA,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,YAAY;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,kBAAkB;KAC/B;IACD,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE;QACP,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,mBAAmB;KAChC;IACD,SAAS,EAAE;QACT,KAAK,EAAE,kBAAkB;QACzB,UAAU,EAAE,qBAAqB;KAClC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE,wBAAwB;KACrC;IACD,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,CAAC,CAAA,EAAA;CAC9E,CAAC,CAAC","sourcesContent":["import { createMutableSchema, Schema } from '@empathyco/x-adapter';\nimport { SearchResponse } from '@empathyco/x-types';\nimport { getTaggingInfoFromUrl } from '../../mappers/url.utils';\nimport { PlatformSearchResponse } from '../../types/responses/search-response.model';\nimport { bannerMutableSchema } from '../models/banner.schema';\nimport { facetMutableSchema } from '../models/facet.schema';\nimport { promotedMutableSchema } from '../models/promoted.schema';\nimport { redirectionMutableSchema } from '../models/redirection.schema';\nimport { resultSchema } from '../models/result.schema';\n\nexport const searchResponseMutableSchema = createMutableSchema<\n Schema<PlatformSearchResponse, SearchResponse>\n>({\n results: {\n $path: 'catalog.content',\n $subSchema: resultSchema\n },\n facets: {\n $path: 'catalog.facets',\n $subSchema: facetMutableSchema\n },\n totalResults: 'catalog.numFound',\n spellcheck: 'catalog.spellchecked',\n banners: {\n $path: 'banner.content',\n $subSchema: bannerMutableSchema\n },\n promoteds: {\n $path: 'promoted.content',\n $subSchema: promotedMutableSchema\n },\n redirections: {\n $path: 'direct.content',\n $subSchema: redirectionMutableSchema\n },\n queryTagging: ({ catalog }) => getTaggingInfoFromUrl(catalog?.tagging?.query)\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"platform-adapter.types.js","sourceRoot":"","sources":["../../../src/types/platform-adapter.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Adapter, EndpointAdapter } from '@empathyco/x-adapter';\nimport {\n IdentifierResultsRequest,\n IdentifierResultsResponse,\n PopularSearchesRequest,\n PopularSearchesResponse,\n QuerySuggestionsRequest,\n NextQueriesRequest,\n NextQueriesResponse,\n QuerySuggestionsResponse,\n RecommendationsRequest,\n RecommendationsResponse,\n TaggingRequest,\n RelatedTagsResponse,\n RelatedTagsRequest,\n SearchRequest,\n SearchResponse\n} from '@empathyco/x-types';\n\nexport interface PlatformAdapter extends Adapter {\n search: EndpointAdapter<SearchRequest, SearchResponse>;\n popularSearches: EndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;\n nextQueries: EndpointAdapter<NextQueriesRequest, NextQueriesResponse>;\n recommendations: EndpointAdapter<RecommendationsRequest, RecommendationsResponse>;\n querySuggestions: EndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;\n relatedTags: EndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;\n identifierResults: EndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;\n tagging: EndpointAdapter<TaggingRequest, void>;\n}\n"]}
1
+ {"version":3,"file":"platform-adapter.types.js","sourceRoot":"","sources":["../../../src/types/platform-adapter.types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n IdentifierResultsRequest,\n IdentifierResultsResponse,\n NextQueriesRequest,\n NextQueriesResponse,\n PopularSearchesRequest,\n PopularSearchesResponse,\n QuerySuggestionsRequest,\n QuerySuggestionsResponse,\n RecommendationsRequest,\n RecommendationsResponse,\n RelatedTagsRequest,\n RelatedTagsResponse,\n SearchRequest,\n SearchResponse,\n TaggingRequest,\n XComponentsAdapter\n} from '@empathyco/x-types';\nimport { ExtendableEndpointAdapter } from '@empathyco/x-adapter';\n\nexport interface PlatformAdapter extends XComponentsAdapter {\n search: ExtendableEndpointAdapter<SearchRequest, SearchResponse>;\n popularSearches: ExtendableEndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;\n nextQueries: ExtendableEndpointAdapter<NextQueriesRequest, NextQueriesResponse>;\n recommendations: ExtendableEndpointAdapter<RecommendationsRequest, RecommendationsResponse>;\n querySuggestions: ExtendableEndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;\n relatedTags: ExtendableEndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;\n identifierResults: ExtendableEndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;\n tagging: ExtendableEndpointAdapter<TaggingRequest, void>;\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from './requests';
2
2
  export * from './responses';
3
+ export * from './url.utils';
@@ -0,0 +1,20 @@
1
+ import { TaggingRequest } from '@empathyco/x-types';
2
+ /**
3
+ * Extracts the tagging info from a URL.
4
+ *
5
+ * @param taggingUrl - The url containing the tagging info.
6
+ *
7
+ * @returns The object with the tagging info.
8
+ */
9
+ export declare function getTaggingInfoFromUrl(taggingUrl: string): TaggingRequest;
10
+ /**
11
+ * Returns the base url path and an object with the query parameters.
12
+ *
13
+ * @param url - The url string to manipulate.
14
+ *
15
+ * @returns The object with the url information.
16
+ */
17
+ export declare function extractUrlParameters(url: string): {
18
+ url: string;
19
+ params?: Record<string, string[] | string>;
20
+ };
@@ -1,12 +1,12 @@
1
- import { Adapter, EndpointAdapter } from '@empathyco/x-adapter';
2
- import { IdentifierResultsRequest, IdentifierResultsResponse, PopularSearchesRequest, PopularSearchesResponse, QuerySuggestionsRequest, NextQueriesRequest, NextQueriesResponse, QuerySuggestionsResponse, RecommendationsRequest, RecommendationsResponse, TaggingRequest, RelatedTagsResponse, RelatedTagsRequest, SearchRequest, SearchResponse } from '@empathyco/x-types';
3
- export interface PlatformAdapter extends Adapter {
4
- search: EndpointAdapter<SearchRequest, SearchResponse>;
5
- popularSearches: EndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;
6
- nextQueries: EndpointAdapter<NextQueriesRequest, NextQueriesResponse>;
7
- recommendations: EndpointAdapter<RecommendationsRequest, RecommendationsResponse>;
8
- querySuggestions: EndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;
9
- relatedTags: EndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;
10
- identifierResults: EndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;
11
- tagging: EndpointAdapter<TaggingRequest, void>;
1
+ import { IdentifierResultsRequest, IdentifierResultsResponse, NextQueriesRequest, NextQueriesResponse, PopularSearchesRequest, PopularSearchesResponse, QuerySuggestionsRequest, QuerySuggestionsResponse, RecommendationsRequest, RecommendationsResponse, RelatedTagsRequest, RelatedTagsResponse, SearchRequest, SearchResponse, TaggingRequest, XComponentsAdapter } from '@empathyco/x-types';
2
+ import { ExtendableEndpointAdapter } from '@empathyco/x-adapter';
3
+ export interface PlatformAdapter extends XComponentsAdapter {
4
+ search: ExtendableEndpointAdapter<SearchRequest, SearchResponse>;
5
+ popularSearches: ExtendableEndpointAdapter<PopularSearchesRequest, PopularSearchesResponse>;
6
+ nextQueries: ExtendableEndpointAdapter<NextQueriesRequest, NextQueriesResponse>;
7
+ recommendations: ExtendableEndpointAdapter<RecommendationsRequest, RecommendationsResponse>;
8
+ querySuggestions: ExtendableEndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;
9
+ relatedTags: ExtendableEndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;
10
+ identifierResults: ExtendableEndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;
11
+ tagging: ExtendableEndpointAdapter<TaggingRequest, void>;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-adapter-platform",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.22",
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",
@@ -35,9 +35,9 @@
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "@empathyco/x-adapter": "^8.0.0-alpha.1",
39
- "@empathyco/x-types": "^10.0.0-alpha.25",
40
- "@empathyco/x-utils": "^1.0.0-alpha.4",
38
+ "@empathyco/x-adapter": "^8.0.0-alpha.2",
39
+ "@empathyco/x-types": "^10.0.0-alpha.26",
40
+ "@empathyco/x-utils": "^1.0.0-alpha.5",
41
41
  "tslib": "~2.3.0"
42
42
  },
43
43
  "devDependencies": {
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "a1e6557d05a9e4b60ef44aa25196299a1b622500"
56
+ "gitHead": "4f0b22a49c3fe9bfbba789012e168c04ec976265"
57
57
  }