@empathyco/x-components 3.0.0-alpha.236 → 3.0.0-alpha.237

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.0-alpha.237](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.236...@empathyco/x-components@3.0.0-alpha.237) (2022-12-01)
7
+
8
+ ### Features
9
+
10
+ - **recommendations:** add `updateRecommendation` mutation (#891)
11
+ ([0e9ceec](https://github.com/empathyco/x/commit/0e9ceec145458a55ccbe4abf8e7b49f64d1717ae))
12
+
13
+ # Change Log
14
+
15
+ All notable changes to this project will be documented in this file. See
16
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
17
+
6
18
  ## [3.0.0-alpha.236](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.235...@empathyco/x-components@3.0.0-alpha.236) (2022-11-29)
7
19
 
8
20
  ### Features
@@ -19,4 +19,5 @@ export interface RecommendationsMutations extends StatusMutations
19
19
  | --- | --- |
20
20
  | [setParams(params)](./x-components.recommendationsmutations.setparams.md) | Sets the extra params of the module. |
21
21
  | [setRecommendations(recommendations)](./x-components.recommendationsmutations.setrecommendations.md) | Sets the recommendations of the module. |
22
+ | [updateRecommendation(recommendation)](./x-components.recommendationsmutations.updaterecommendation.md) | Updates a recommendation with new fields. |
22
23
 
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [RecommendationsMutations](./x-components.recommendationsmutations.md) &gt; [updateRecommendation](./x-components.recommendationsmutations.updaterecommendation.md)
4
+
5
+ ## RecommendationsMutations.updateRecommendation() method
6
+
7
+ Updates a recommendation with new fields.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ updateRecommendation(recommendation: Partial<Result> & Pick<Result, 'id'>): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | recommendation | Partial&lt;Result&gt; &amp; Pick&lt;Result, 'id'&gt; | A recommendation containing at least an id and the properties to modify. |
20
+
21
+ <b>Returns:</b>
22
+
23
+ void
24
+
@@ -29,6 +29,12 @@ const recommendationsXStoreModule = {
29
29
  setStatus,
30
30
  setParams(state, params) {
31
31
  state.params = params;
32
+ },
33
+ updateRecommendation(state, recommendation) {
34
+ const stateRecommendation = state.recommendations.find(stateRecommendation => recommendation.id === stateRecommendation.id);
35
+ if (stateRecommendation) {
36
+ Object.assign(stateRecommendation, recommendation);
37
+ }
32
38
  }
33
39
  },
34
40
  actions: {
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"sourcesContent":["import { setStatus } from '../../../store/utils/status-store.utils';\nimport {\n cancelFetchAndSaveRecommendations,\n fetchAndSaveRecommendations\n} from './actions/fetch-and-save-recommendations.action';\nimport { fetchRecommendations } from './actions/fetch-recommendations.action';\nimport { RECOMMENDATIONS_ORIGIN } from './constants';\nimport { request } from './getters/request.getter';\nimport { RecommendationsXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the recommendations module.\n *\n * @internal\n */\nexport const recommendationsXStoreModule: RecommendationsXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24\n },\n origin: RECOMMENDATIONS_ORIGIN,\n status: 'initial',\n recommendations: [],\n params: {}\n }),\n getters: {\n request\n },\n mutations: {\n setRecommendations(state, recommendations) {\n state.recommendations = recommendations;\n },\n setStatus,\n setParams(state, params) {\n state.params = params;\n }\n },\n actions: {\n cancelFetchAndSaveRecommendations,\n fetchRecommendations,\n fetchAndSaveRecommendations\n }\n};\n"],"names":[],"mappings":";;;;;;AAUA;;;;;MAKa,2BAA2B,GAAgC;IACtE,KAAK,EAAE,OAAO;QACZ,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;SACtB;QACD,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,EAAE;KACX,CAAC;IACF,OAAO,EAAE;QACP,OAAO;KACR;IACD,SAAS,EAAE;QACT,kBAAkB,CAAC,KAAK,EAAE,eAAe;YACvC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;SACzC;QACD,SAAS;QACT,SAAS,CAAC,KAAK,EAAE,MAAM;YACrB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;KACF;IACD,OAAO,EAAE;QACP,iCAAiC;QACjC,oBAAoB;QACpB,2BAA2B;KAC5B;;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"sourcesContent":["import { setStatus } from '../../../store/utils/status-store.utils';\nimport {\n cancelFetchAndSaveRecommendations,\n fetchAndSaveRecommendations\n} from './actions/fetch-and-save-recommendations.action';\nimport { fetchRecommendations } from './actions/fetch-recommendations.action';\nimport { RECOMMENDATIONS_ORIGIN } from './constants';\nimport { request } from './getters/request.getter';\nimport { RecommendationsXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the recommendations module.\n *\n * @internal\n */\nexport const recommendationsXStoreModule: RecommendationsXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24\n },\n origin: RECOMMENDATIONS_ORIGIN,\n status: 'initial',\n recommendations: [],\n params: {}\n }),\n getters: {\n request\n },\n mutations: {\n setRecommendations(state, recommendations) {\n state.recommendations = recommendations;\n },\n setStatus,\n setParams(state, params) {\n state.params = params;\n },\n updateRecommendation(state, recommendation) {\n const stateRecommendation = state.recommendations.find(\n stateRecommendation => recommendation.id === stateRecommendation.id\n );\n if (stateRecommendation) {\n Object.assign(stateRecommendation, recommendation);\n }\n }\n },\n actions: {\n cancelFetchAndSaveRecommendations,\n fetchRecommendations,\n fetchAndSaveRecommendations\n }\n};\n"],"names":[],"mappings":";;;;;;AAUA;;;;;MAKa,2BAA2B,GAAgC;IACtE,KAAK,EAAE,OAAO;QACZ,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;SACtB;QACD,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,EAAE;KACX,CAAC;IACF,OAAO,EAAE;QACP,OAAO;KACR;IACD,SAAS,EAAE;QACT,kBAAkB,CAAC,KAAK,EAAE,eAAe;YACvC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;SACzC;QACD,SAAS;QACT,SAAS,CAAC,KAAK,EAAE,MAAM;YACrB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,oBAAoB,CAAC,KAAK,EAAE,cAAc;YACxC,MAAM,mBAAmB,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CACpD,mBAAmB,IAAI,cAAc,CAAC,EAAE,KAAK,mBAAmB,CAAC,EAAE,CACpE,CAAC;YACF,IAAI,mBAAmB,EAAE;gBACvB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;aACpD;SACF;KACF;IACD,OAAO,EAAE;QACP,iCAAiC;QACjC,oBAAoB;QACpB,2BAA2B;KAC5B;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "3.0.0-alpha.236",
3
+ "version": "3.0.0-alpha.237",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -135,5 +135,5 @@
135
135
  "access": "public",
136
136
  "directory": "dist"
137
137
  },
138
- "gitHead": "634a16e805abc8871a8bcce33adeaf4afb7b68d3"
138
+ "gitHead": "1495e90ffaf7dbb91980a98698974b6d82d75a67"
139
139
  }
@@ -34872,6 +34872,82 @@
34872
34872
  }
34873
34873
  ],
34874
34874
  "name": "setRecommendations"
34875
+ },
34876
+ {
34877
+ "kind": "MethodSignature",
34878
+ "canonicalReference": "@empathyco/x-components!RecommendationsMutations#updateRecommendation:member(1)",
34879
+ "docComment": "/**\n * Updates a recommendation with new fields.\n *\n * @param recommendation - A recommendation containing at least an id and the properties to modify.\n */\n",
34880
+ "excerptTokens": [
34881
+ {
34882
+ "kind": "Content",
34883
+ "text": "updateRecommendation(recommendation: "
34884
+ },
34885
+ {
34886
+ "kind": "Reference",
34887
+ "text": "Partial",
34888
+ "canonicalReference": "!Partial:type"
34889
+ },
34890
+ {
34891
+ "kind": "Content",
34892
+ "text": "<"
34893
+ },
34894
+ {
34895
+ "kind": "Reference",
34896
+ "text": "Result",
34897
+ "canonicalReference": "@empathyco/x-components!Result:interface"
34898
+ },
34899
+ {
34900
+ "kind": "Content",
34901
+ "text": "> & "
34902
+ },
34903
+ {
34904
+ "kind": "Reference",
34905
+ "text": "Pick",
34906
+ "canonicalReference": "!Pick:type"
34907
+ },
34908
+ {
34909
+ "kind": "Content",
34910
+ "text": "<"
34911
+ },
34912
+ {
34913
+ "kind": "Reference",
34914
+ "text": "Result",
34915
+ "canonicalReference": "@empathyco/x-components!Result:interface"
34916
+ },
34917
+ {
34918
+ "kind": "Content",
34919
+ "text": ", 'id'>"
34920
+ },
34921
+ {
34922
+ "kind": "Content",
34923
+ "text": "): "
34924
+ },
34925
+ {
34926
+ "kind": "Content",
34927
+ "text": "void"
34928
+ },
34929
+ {
34930
+ "kind": "Content",
34931
+ "text": ";"
34932
+ }
34933
+ ],
34934
+ "isOptional": false,
34935
+ "returnTypeTokenRange": {
34936
+ "startIndex": 10,
34937
+ "endIndex": 11
34938
+ },
34939
+ "releaseTag": "Public",
34940
+ "overloadIndex": 1,
34941
+ "parameters": [
34942
+ {
34943
+ "parameterName": "recommendation",
34944
+ "parameterTypeTokenRange": {
34945
+ "startIndex": 1,
34946
+ "endIndex": 9
34947
+ }
34948
+ }
34949
+ ],
34950
+ "name": "updateRecommendation"
34875
34951
  }
34876
34952
  ],
34877
34953
  "extendsTokenRanges": [
@@ -3305,6 +3305,7 @@ export interface RecommendationsGetters {
3305
3305
  export interface RecommendationsMutations extends StatusMutations {
3306
3306
  setParams(params: Dictionary<unknown>): void;
3307
3307
  setRecommendations(recommendations: Result[]): void;
3308
+ updateRecommendation(recommendation: Partial<Result> & Pick<Result, 'id'>): void;
3308
3309
  }
3309
3310
 
3310
3311
  // @public
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,2BA2BzC,CAAC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,2BAmCzC,CAAC"}
@@ -45,6 +45,13 @@ export interface RecommendationsMutations extends StatusMutations {
45
45
  * @param params - The new extra params.
46
46
  */
47
47
  setParams(params: Dictionary<unknown>): void;
48
+ /**
49
+ * Updates a recommendation with new fields.
50
+ *
51
+ * @param recommendation - A recommendation containing at least an id
52
+ * and the properties to modify.
53
+ */
54
+ updateRecommendation(recommendation: Partial<Result> & Pick<Result, 'id'>): void;
48
55
  }
49
56
  /**
50
57
  * Recommendations store actions.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/recommendations/store/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE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,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/recommendations/store/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,sDAAsD;IACtD,MAAM,EAAE,qBAAqB,CAAC;IAC9B,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,8CAA8C;IAC9C,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D;;;;OAIG;IACH,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACpD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7C;;;;;OAKG;IACH,oBAAoB,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;CAClF;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,iCAAiC,IAAI,IAAI,CAAC;IAC1C;;OAEG;IACH,2BAA2B,CAAC,OAAO,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