@empathyco/x-adapter-platform 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/schemas/models/result.schema.js +7 -3
- package/dist/cjs/schemas/models/result.schema.js.map +1 -1
- package/dist/cjs/types/models/result.model.js.map +1 -1
- package/dist/esm/schemas/models/result.schema.js +7 -3
- package/dist/esm/schemas/models/result.schema.js.map +1 -1
- package/dist/esm/types/models/result.model.js.map +1 -1
- package/dist/types/types/models/result.model.d.ts +1 -1
- package/package.json +3 -3
- package/report/x-adapter-platform.api.json +1 -1
- package/report/x-adapter-platform.api.md +1 -1
|
@@ -20,9 +20,13 @@ exports.resultSchema = (0, x_adapter_1.createMutableSchema)({
|
|
|
20
20
|
value: () => null,
|
|
21
21
|
},
|
|
22
22
|
price: {
|
|
23
|
-
value:
|
|
24
|
-
originalValue: ({ __prices: rawPrices }) => { var _a, _b; return (_b = (_a = rawPrices.previous) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : rawPrices.current.value; },
|
|
25
|
-
hasDiscount: ({ __prices: rawPrices }) => {
|
|
23
|
+
value: ({ __prices: rawPrices }) => { var _a; return (_a = rawPrices.current) === null || _a === void 0 ? void 0 : _a.value; },
|
|
24
|
+
originalValue: ({ __prices: rawPrices }) => { var _a, _b, _c; return (_b = (_a = rawPrices.previous) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : (_c = rawPrices.current) === null || _c === void 0 ? void 0 : _c.value; },
|
|
25
|
+
hasDiscount: ({ __prices: rawPrices }) => {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
return ((_b = (_a = rawPrices.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0) <
|
|
28
|
+
((_f = (_d = (_c = rawPrices.previous) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : (_e = rawPrices.current) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 0);
|
|
29
|
+
},
|
|
26
30
|
},
|
|
27
31
|
type: () => 'Default',
|
|
28
32
|
modelName: () => 'Result',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":";;;AAEA,oDAA0D;AAC1D,uDAA6F;AAE7F;;;;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,
|
|
1
|
+
{"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":";;;AAEA,oDAA0D;AAC1D,uDAA6F;AAE7F;;;;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,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,WAAC,OAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,CAAA,EAAA;QAC5D,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,mBACzC,OAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,CAAA,EAAA;QACvD,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;;YACvC,OAAA,CAAC,MAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,mCAAI,CAAC,CAAC;gBAC/B,CAAC,MAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,mCAAI,CAAC,CAAC,CAAA;SAAA;KAC/D;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,wCAA4B,EAAC,YAAY,CAAC;SAC/E;KACF;CACF,CAAC,CAAA","sourcesContent":["import type { Result } from '@empathyco/x-types'\nimport type { PlatformResult } from '../../types/models/result.model'\nimport { createMutableSchema } from '@empathyco/x-adapter'\nimport { getDisplayTaggingInfoFromUrl, getTaggingInfoFromUrl } from '../../mappers/url.utils'\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: rawPrices }) => rawPrices.current?.value,\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current?.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n (rawPrices.current?.value ?? 0) <\n (rawPrices.previous?.value ?? rawPrices.current?.value ?? 0),\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 }) => getDisplayTaggingInfoFromUrl(displayClick),\n },\n },\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.model.js","sourceRoot":"","sources":["../../../../src/types/models/result.model.ts"],"names":[],"mappings":"","sourcesContent":["import type { PlatformTagging } from './tagging.model'\n\n/**\n * Result model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformResult {\n // Unique document id. Not repeated in whole catalog.\n __id: string\n // Customer id (SKU, MOCACO, etc.) Needed for SKU search.\n __externalId: string\n // Title of the Result Card.\n __name: string\n // Link to Product Description Page (PDP).\n __url: string\n // An Array with all the images links.\n __images: string[]\n __prices: {\n // The current price of the result.\n current
|
|
1
|
+
{"version":3,"file":"result.model.js","sourceRoot":"","sources":["../../../../src/types/models/result.model.ts"],"names":[],"mappings":"","sourcesContent":["import type { PlatformTagging } from './tagging.model'\n\n/**\n * Result model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformResult {\n // Unique document id. Not repeated in whole catalog.\n __id: string\n // Customer id (SKU, MOCACO, etc.) Needed for SKU search.\n __externalId: string\n // Title of the Result Card.\n __name: string\n // Link to Product Description Page (PDP).\n __url: string\n // An Array with all the images links.\n __images: string[]\n __prices: {\n // The current price of the result.\n current?: {\n value: number\n }\n // If there is a discount this is the previous price without discount.\n previous?: {\n value: number\n }\n // Prewarming price.\n future?: {\n value: number\n }\n }\n // Tagging links for the current Document.\n tagging: PlatformTagging\n}\n"]}
|
|
@@ -17,9 +17,13 @@ export const resultSchema = createMutableSchema({
|
|
|
17
17
|
value: () => null,
|
|
18
18
|
},
|
|
19
19
|
price: {
|
|
20
|
-
value:
|
|
21
|
-
originalValue: ({ __prices: rawPrices }) => { var _a, _b; return (_b = (_a = rawPrices.previous) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : rawPrices.current.value; },
|
|
22
|
-
hasDiscount: ({ __prices: rawPrices }) => {
|
|
20
|
+
value: ({ __prices: rawPrices }) => { var _a; return (_a = rawPrices.current) === null || _a === void 0 ? void 0 : _a.value; },
|
|
21
|
+
originalValue: ({ __prices: rawPrices }) => { var _a, _b, _c; return (_b = (_a = rawPrices.previous) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : (_c = rawPrices.current) === null || _c === void 0 ? void 0 : _c.value; },
|
|
22
|
+
hasDiscount: ({ __prices: rawPrices }) => {
|
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24
|
+
return ((_b = (_a = rawPrices.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0) <
|
|
25
|
+
((_f = (_d = (_c = rawPrices.previous) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : (_e = rawPrices.current) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 0);
|
|
26
|
+
},
|
|
23
27
|
},
|
|
24
28
|
type: () => 'Default',
|
|
25
29
|
modelName: () => 'Result',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.schema.js","sourceRoot":"","sources":["../../../../src/schemas/models/result.schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,yBAAy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AC,OAAO,0CAAE,KAAK,mCAAI,CAAC,CAAC;gBAC/B,CAAC,MAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,KAAK,mCAAI,MAAA,SAAS,CAAC,OAAO,0CAAE,KAAK,mCAAI,CAAC,CAAC,CAAA;SAAA;KAC/D;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,4BAA4B,CAAC,YAAY,CAAC;SAC/E;KACF;CACF,CAAC,CAAA","sourcesContent":["import type { Result } from '@empathyco/x-types'\nimport type { PlatformResult } from '../../types/models/result.model'\nimport { createMutableSchema } from '@empathyco/x-adapter'\nimport { getDisplayTaggingInfoFromUrl, getTaggingInfoFromUrl } from '../../mappers/url.utils'\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: rawPrices }) => rawPrices.current?.value,\n originalValue: ({ __prices: rawPrices }) =>\n rawPrices.previous?.value ?? rawPrices.current?.value,\n hasDiscount: ({ __prices: rawPrices }) =>\n (rawPrices.current?.value ?? 0) <\n (rawPrices.previous?.value ?? rawPrices.current?.value ?? 0),\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 }) => getDisplayTaggingInfoFromUrl(displayClick),\n },\n },\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.model.js","sourceRoot":"","sources":["../../../../src/types/models/result.model.ts"],"names":[],"mappings":"","sourcesContent":["import type { PlatformTagging } from './tagging.model'\n\n/**\n * Result model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformResult {\n // Unique document id. Not repeated in whole catalog.\n __id: string\n // Customer id (SKU, MOCACO, etc.) Needed for SKU search.\n __externalId: string\n // Title of the Result Card.\n __name: string\n // Link to Product Description Page (PDP).\n __url: string\n // An Array with all the images links.\n __images: string[]\n __prices: {\n // The current price of the result.\n current
|
|
1
|
+
{"version":3,"file":"result.model.js","sourceRoot":"","sources":["../../../../src/types/models/result.model.ts"],"names":[],"mappings":"","sourcesContent":["import type { PlatformTagging } from './tagging.model'\n\n/**\n * Result model for the `platform` API.\n *\n * @public\n */\nexport interface PlatformResult {\n // Unique document id. Not repeated in whole catalog.\n __id: string\n // Customer id (SKU, MOCACO, etc.) Needed for SKU search.\n __externalId: string\n // Title of the Result Card.\n __name: string\n // Link to Product Description Page (PDP).\n __url: string\n // An Array with all the images links.\n __images: string[]\n __prices: {\n // The current price of the result.\n current?: {\n value: number\n }\n // If there is a discount this is the previous price without discount.\n previous?: {\n value: number\n }\n // Prewarming price.\n future?: {\n value: number\n }\n }\n // Tagging links for the current Document.\n tagging: PlatformTagging\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-adapter-platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@empathyco/x-adapter": "8.1.6",
|
|
51
|
-
"@empathyco/x-types": "10.
|
|
51
|
+
"@empathyco/x-types": "10.3.0",
|
|
52
52
|
"@empathyco/x-utils": "1.0.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "0707a73f5c7a80d3110d78bab73704f66bdb15d9"
|
|
66
66
|
}
|
|
@@ -6829,7 +6829,7 @@
|
|
|
6829
6829
|
},
|
|
6830
6830
|
{
|
|
6831
6831
|
"kind": "Content",
|
|
6832
|
-
"text": "{\n current
|
|
6832
|
+
"text": "{\n current?: {\n value: number;\n };\n previous?: {\n value: number;\n };\n future?: {\n value: number;\n };\n }"
|
|
6833
6833
|
},
|
|
6834
6834
|
{
|
|
6835
6835
|
"kind": "Content",
|