@empathyco/x-components 3.0.0-alpha.71 → 3.0.0-alpha.74

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 (57) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/design-system/full-theme.css +12 -13
  3. package/docs/API-reference/api/x-components.baseresultpreviousprice.format.md +2 -2
  4. package/docs/API-reference/api/x-components.baseresultpreviousprice.md +1 -1
  5. package/docs/API-reference/api/x-components.historyqueriesactions.md +1 -0
  6. package/docs/API-reference/api/x-components.historyqueriesactions.togglehistoryqueries.md +24 -0
  7. package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -0
  8. package/docs/API-reference/api/x-components.historyqueriesmutations.setisenabled.md +24 -0
  9. package/docs/API-reference/api/x-components.historyqueriesstate.isenabled.md +13 -0
  10. package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -0
  11. package/docs/API-reference/api/x-components.historyqueriesxevents.md +1 -0
  12. package/docs/API-reference/api/x-components.historyqueriesxevents.usertoggledhistoryqueries.md +13 -0
  13. package/docs/API-reference/api/x-components.md +1 -0
  14. package/docs/API-reference/api/x-components.togglehistoryqueries.md +13 -0
  15. package/docs/API-reference/components/common/currency/x-components.base-currency.md +267 -28
  16. package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +36 -8
  17. package/docs/build-search-ui/README.md +23 -12
  18. package/docs/build-search-ui/web-archetype-development-guide.md +6 -8
  19. package/docs/build-search-ui/web-archetype-integration-guide.md +70 -17
  20. package/docs/build-search-ui/{web-use-x-components-guide.md → web-how-to-use-x-components-guide.md} +1 -1
  21. package/docs/build-search-ui/web-x-components-integration-guide.md +4 -1
  22. package/history-queries/index.js +1 -1
  23. package/js/components/currency/base-currency.vue.js.map +1 -1
  24. package/js/components/currency/base-currency.vue_rollup-plugin-vue_script.vue.js +1 -5
  25. package/js/components/currency/base-currency.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  26. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  27. package/js/components/result/base-result-previous-price.vue_rollup-plugin-vue_script.vue.js +1 -1
  28. package/js/components/result/base-result-previous-price.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  29. package/js/index.js +1 -1
  30. package/js/x-modules/history-queries/store/actions/set-history-queries.action.js +6 -4
  31. package/js/x-modules/history-queries/store/actions/set-history-queries.action.js.map +1 -1
  32. package/js/x-modules/history-queries/store/actions/toggle-history-queries.action.js +13 -0
  33. package/js/x-modules/history-queries/store/actions/toggle-history-queries.action.js.map +1 -0
  34. package/js/x-modules/history-queries/store/constants.js +3 -2
  35. package/js/x-modules/history-queries/store/constants.js.map +1 -1
  36. package/js/x-modules/history-queries/store/module.js +11 -3
  37. package/js/x-modules/history-queries/store/module.js.map +1 -1
  38. package/js/x-modules/history-queries/wiring.js +10 -1
  39. package/js/x-modules/history-queries/wiring.js.map +1 -1
  40. package/package.json +2 -2
  41. package/report/x-components.api.json +173 -3
  42. package/report/x-components.api.md +11 -1
  43. package/types/components/currency/base-currency.vue.d.ts.map +1 -1
  44. package/types/components/result/base-result-previous-price.vue.d.ts +1 -2
  45. package/types/components/result/base-result-previous-price.vue.d.ts.map +1 -1
  46. package/types/x-modules/history-queries/events.types.d.ts +5 -0
  47. package/types/x-modules/history-queries/events.types.d.ts.map +1 -1
  48. package/types/x-modules/history-queries/store/actions/set-history-queries.action.d.ts.map +1 -1
  49. package/types/x-modules/history-queries/store/actions/toggle-history-queries.action.d.ts +3 -0
  50. package/types/x-modules/history-queries/store/actions/toggle-history-queries.action.d.ts.map +1 -0
  51. package/types/x-modules/history-queries/store/constants.d.ts +1 -0
  52. package/types/x-modules/history-queries/store/constants.d.ts.map +1 -1
  53. package/types/x-modules/history-queries/store/module.d.ts.map +1 -1
  54. package/types/x-modules/history-queries/store/types.d.ts +17 -0
  55. package/types/x-modules/history-queries/store/types.d.ts.map +1 -1
  56. package/types/x-modules/history-queries/wiring.d.ts +9 -0
  57. package/types/x-modules/history-queries/wiring.d.ts.map +1 -1
@@ -24,9 +24,10 @@ Start building your search and discovery experience in a few simple steps:
24
24
 
25
25
  - **Discover more about the [Interface X ecosystem](#the-interface-x-ecosystem)** and how
26
26
  Interface X works.
27
- - **[Integrate the Interface X Components](#integrate-interface-x-components)** in your store web
27
+ - **[Integrate the Interface X Archetype](#integrate-interface-x-archetype)** in your store web
28
28
  application.
29
- - **[Use and configure the Interface X Components](#use-and-configure-the-interface-x-components)**
29
+ - **[Develop using the Interface X](#develop-with-interface-x)** inside your current project.
30
+ - **[How to use and configure the Interface X Components](#how-to-use-and-configure-the-interface-x-components)**
30
31
  in your project.
31
32
 
32
33
  <!-- 3. Style your UI. 4. Translate your search experience-->
@@ -42,11 +43,21 @@ numerous components to choose from, and the catalog evolves quickly with new exp
42
43
  Check out the **[open source project in GitHub](https://github.com/empathyco/x)**.
43
44
 
44
45
  Interested in learning more about how Interface&nbsp;X works? Discover more about its
45
- **[architecture](./x-architecture/README.md)**.
46
+ **[architecture](x-architecture/README.md)**.
46
47
 
47
- ## Integrate Interface X Components
48
+ ## Integrate Interface X Archetype
48
49
 
49
- You can use the X&nbsp;Components in a project in two ways:
50
+ Once you have finished developing or extending your search interface using the
51
+ Interface&nbsp;X&nbsp;Archetype project you will probably want to integrate it into your current
52
+ store. The integration of an existing Archetype into your project is pretty straightforward. You
53
+ will need to load the generated Javascript into your website and initialise it.
54
+
55
+ To start integrating an existent Archetype into your project please visit
56
+ [extended guide about Archetype integration](web-archetype-integration-guide.md).
57
+
58
+ ## Develop with Interface X
59
+
60
+ You can use the Interface X in a project in two ways:
50
61
 
51
62
  - using the separate **Interface&nbsp;X&nbsp;Archetype** project, an out-of-the-box project with all
52
63
  you need to get up and running fast, or
@@ -59,7 +70,7 @@ You can use Empathy Search API, Elasticsearch, or Solr endpoints with both appro
59
70
 
60
71
  :::
61
72
 
62
- ##### Integration via Interface X Archetype project
73
+ ##### Develop via Interface X Archetype
63
74
 
64
75
  The **[Interface&nbsp;X&nbsp;Archetype](https://github.com/empathyco/x-archetype)** project is the
65
76
  perfect combination of all the existing X&nbsp;Components. Instead of starting from a completely
@@ -74,10 +85,10 @@ perfect solution for most cases. But don’t worry! It’s still super flexible!
74
85
  - Use the individual X&nbsp;Component internationalization tool or use your own tool.
75
86
  - Create new components or modify the existing ones.
76
87
 
77
- To start using the X&nbsp;Archetype project, see
78
- **[Integrate Interface X Archetype project](web-archetype-integration-guide.md)**.
88
+ To start developing the X&nbsp;Archetype project, see
89
+ **[Develop via Interface X Archetype](web-archetype-development-guide.md)**.
79
90
 
80
- ##### Integration via Interface X Components library
91
+ ##### Develop via Interface X Components library
81
92
 
82
93
  This is the more deep and flexible use of the
83
94
  **[Interface X Components library](https://github.com/empathyco/x/tree/main/packages/x-components)**,
@@ -91,9 +102,9 @@ go if you like to look under the hood!
91
102
  - Determine styles using design tokens or custom CSS.
92
103
 
93
104
  To get started with the X Components library, check out
94
- **[Integrate Interface X Components in your Vue application](web-x-components-integration-guide.md)**.
105
+ **[Develop using Interface X Components library](web-x-components-integration-guide.md)**.
95
106
 
96
- ## Use and configure the Interface X Components
107
+ ## How to use and configure the Interface X Components
97
108
 
98
109
  Using the Interface&nbsp;X&nbsp;Components is a piece of cake! Just import and register the
99
110
  component, include it in your template, and you’re ready to go! What’s more, each component offers
@@ -101,7 +112,7 @@ multiple configuration parameters to play around with, allowing you greater flex
101
112
  experience.
102
113
 
103
114
  Unsure how to start? Check out
104
- **[Use & configure Interface X Components in your project](web-use-x-components-guide.md)**.
115
+ **[How to use & configure Interface X Components in your project](web-how-to-use-x-components-guide.md)**.
105
116
 
106
117
  <!--
107
118
  ## Style your UI
@@ -77,13 +77,10 @@ Then, replace the current repository name (`@empathyco/x-archetype`) with the na
77
77
  repository in the `package.json` file.
78
78
 
79
79
  ```json
80
- // Define your repository
81
80
  {
82
- "name": "<your-repo>",
83
- "author": "Empathy Systems Corporation S.L.",
84
-
85
- }
86
-
81
+ "name": "<your-repo>",
82
+ "author": "Empathy Systems Corporation S.L."
83
+ }
87
84
  ```
88
85
 
89
86
  ## 2. Install the dependencies and execute the project
@@ -116,7 +113,7 @@ configurations, or mappers that points to a demo environment. You need to make s
116
113
  the configuration according to the search features you use in your project.
117
114
 
118
115
  Export the required search adapter with your configuration as you will need it for the search
119
- [xPlugin configuration](web-archetype-integration-guide.md#_4-configure-the-plugin).
116
+ [xPlugin configuration](#4-configure-the-plugin).
120
117
 
121
118
  ::: interact
122
119
 
@@ -178,7 +175,8 @@ Once you have your Interface&nbsp;X&nbsp;Archetype project, you're ready to inte
178
175
  store, or extend the search and discovery experience to meet your business needs:
179
176
 
180
177
  - [Integrate an Interface&nbsp;X&nbsp;Archetype project into an existing website](web-archetype-integration-guide.md).
181
- - Change the configuration of [X Components](web-use-x-components-guide.md) or create new ones.
178
+ - Change the configuration of [X Components](web-how-to-use-x-components-guide.md) or create new
179
+ ones.
182
180
  - Adapt the
183
181
  [design system](https://github.com/empathyco/x/blob/main/packages/x-components/contributing/design-system.md)
184
182
  to your branding.
@@ -24,6 +24,14 @@ The integration is a 2-steps process:
24
24
  Depending on your business needs, there are 2 different ways of making this integration process:
25
25
  auto initialising, or initialising on demand.
26
26
 
27
+ ::: note Frameworks & Libraries Integration
28
+
29
+ As the Archetype is bundled including all the needed dependencies, then it is possible to integrate
30
+ on top of any existing website, regardless of the technologies that it has been built with:
31
+ **React**, **Vue**, **Svelte**...
32
+
33
+ :::
34
+
27
35
  ## Auto initialisation
28
36
 
29
37
  This is the easiest way to integrate the Interface&nbsp;X project in a website. The way to do so is
@@ -161,26 +169,71 @@ invoked at any time. Note that you should only call this function **once**.
161
169
  The snippet configuration allows you to configure certain parts of the Interface&nbsp;X project like
162
170
  language, the currency, inform whether the user has given us his consent to process personal data.
163
171
 
164
- | Name | Type | Required | Description |
165
- | --------------------- | ------------------------------------------------------------------------------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
166
- | instance | `string` | ✅ | The identifier of the API client instance. Should be provided by Empathy |
167
- | env | `'live'` &#124; `'staging'` | | The API environment to use. Note that you can use the production version of your Interface&nbsp;X with the staging API, or viceversa. |
168
- | scope | `string` | | The context name where the search interface is being executed. I.e. `mobile`, `mobile-app`, `tablet`, `desktop` |
169
- | lang | `string` | ✅ | The language to use. By default this lang is used for both the front-end and the API requests |
170
- | searchLang | `string` | | A language to use only for the API requests |
171
- | consent | `boolean` | ✅ | Used to let X know whether the user has accepted the usage of cookies and therefore the sessionId can be used and sent to the Search and Tagging API. If this parameter is configured with false value, then the sessionId in not generated nor sent to the Tagging API. No consent means the wisdom of the crowd signals (Related Tags, Next Queries, etc.) will not be inferred from that session. This parameter should be set to true as soon as the user accepts the usage of Customer cookies but note that Empathy not uses any cookie in its libraries, although we tie the cookie acceptance to the sessionID generation in Local Storage. If accepting the cookies does not trigger a page reload, please consider using `window.initX.consent = true` to update the consent parameter so that the current session is tracked already. |
172
- | documentDirection | `'ltr'` &#124; `'rtl'` | | The writing direction that the X Components should use |
173
- | currency | `string` | ✅ | The currency identifier. Used to configure how prices are shown |
174
- | callbacks | `Record<XEventName, (payload: XEventPayload<Event>, metadata: WireMetadata) => void` | | A record of callbacks where the key is the event to listen, and the value is the callback to be executed whenever the event is emitted. For example, to listen to the `UserAcceptedAQuery` event: `{ UserAcceptedAQuery({ eventPayload }) { console.log('UserAcceptedAQuery', eventPayload); }` |
175
- | isSpa | `boolean` | | True when the X Components archetype is being run on top of an SPA. |
176
- | &lt;extra parameters> | `any` | | Any other parameter to be sent directly to the API calls. For example, some times is needed to filter the search catalog with a warehouse parameter. In that case you can just add `warehouse: <your-warehouse-identifier>` to the snippet config. |
172
+ | Name | Type | Required | Description |
173
+ | ----------------------- | ------------------------------------------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
174
+ | instance | `string` | ✅ | The identifier of the API client instance. Should be provided by Empathy |
175
+ | env | `'live'` &#124; `'staging'` | | The API environment to use. Note that you can use the production version of your Interface&nbsp;X with the staging API, or viceversa. |
176
+ | scope | `string` | | The context name where the search interface is being executed. I.e. `mobile`, `mobile-app`, `tablet`, `desktop` |
177
+ | lang | `string` | ✅ | The language to use. By default this lang is used for both the front-end and the API requests |
178
+ | searchLang | `string` | | A language to use only for the API requests |
179
+ | consent | `boolean` | ✅ | Used to let X know whether the user has accepted the usage of cookies and therefore the sessionId can be used and sent to the Search and Tagging API. If this parameter is configured with false value, then the sessionId in not generated nor sent to the Tagging API. No consent means the wisdom of the crowd signals (Related Tags, Next Queries, etc.) will not be inferred from that session. This parameter should be set to true as soon as the user accepts the usage of Customer cookies but note that Empathy not uses any cookie in its libraries, although we tie the cookie acceptance to the sessionID generation in Local Storage. If accepting the cookies does not trigger a page reload, please consider using `window.initX.consent = true` to update the consent parameter so that the current session is tracked already. |
180
+ | documentDirection | `'ltr'` &#124; `'rtl'` | | The writing direction that the X Components should use |
181
+ | currency | `string` | ✅ | The currency identifier. Used to configure how prices are shown |
182
+ | [callbacks](#callbacks) | `Record<XEventName, (payload: XEventPayload<Event>, metadata: WireMetadata) => void` | | A record of callbacks where the key is the event to listen, and the value is the callback to be executed whenever the event is emitted. For example, to listen to the `UserAcceptedAQuery` event: `{ UserAcceptedAQuery({ eventPayload }) { console.log('UserAcceptedAQuery', eventPayload); }` |
183
+ | isSpa | `boolean` | | True when the X Components archetype is being run on top of an SPA. |
184
+ | &lt;extra parameters> | `any` | | Any other parameter to be sent directly to the API calls. For example, some times is needed to filter the search catalog with a warehouse parameter. In that case you can just add `warehouse: <your-warehouse-identifier>` to the snippet config. |
185
+
186
+ ### Callbacks
187
+
188
+ As the callbacks are a powerful tool in the initialisation options, we provide this section to get
189
+ deep in their use. This is an example of initialisation providing callbacks to subscribe to certain
190
+ events.
191
+
192
+ ```html
193
+ <script src="https://x.empathy.co/my-store/app.js"></script>
194
+ <script>
195
+ window.X.init({
196
+ instance: 'my-store',
197
+ env: 'live',
198
+ scope: 'desktop',
199
+ lang: 'en',
200
+ currency: 'EUR',
201
+ consent: false,
202
+ callbacks: {
203
+ UserAcceptedAQuery: query => {
204
+ doSomethingInWebApp(query);
205
+ },
206
+ UserClickedResultAddToCart: result => {
207
+ addToCartInWebApp(result);
208
+ }
209
+ }
210
+ });
211
+ </script>
212
+ ```
213
+
214
+ In this example we are subscribing to `UserAcceptedAQuery` and `UserClickedResultAddToCart` so in
215
+ this way we can perform an action inside our application when these events are triggered. Even
216
+ though we have subscribed to two events, as Interface X Components is an event based architecture
217
+ there are more than one hundred of events available to be subscribed to. The complete list is not
218
+ yet part of this documentation, but you may access to the
219
+ [XEventsTypes](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)
220
+ where all of them are defined.
221
+
222
+ ::: note
223
+
224
+ The XEventsTypes are those that can be triggered from different modules inside the X Components, but
225
+ have in mind that every module has its own sort of components. So have a look to DeviceXEvents,
226
+ EmpathizeXEvents, SearchBoxXEvents, etc.
227
+
228
+ :::
177
229
 
178
230
  ## X API
179
231
 
180
232
  The X API allows your website to communicate with Interface X. It is a set of utilities that helps
181
233
  to integrate Interface X into your website.
182
234
 
183
- | Function | Parameters | Description |
184
- | -------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------- |
185
- | init | - [Snippet Configuration](#snippet-configuration) - The initialisation options | [Initialises Interface X on demand](#initialise-on-demand). |
186
- | search | - query (Optional) - The query to open Interface&nbsp;X with | Opens Interface&nbsp;X with the given search query. |
235
+ | Function | Parameters | Description |
236
+ | ---------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
237
+ | init | - [Snippet Configuration](#snippet-configuration) - The initialisation options | [Initialises Interface X on demand](#initialise-on-demand). |
238
+ | search | - query (Optional) - The query to open Interface&nbsp;X with | Opens Interface&nbsp;X and triggers a search with the given query. |
239
+ | setSnippetConfig | - [Snippet Configuration](#snippet-configuration) - The Initialisation options | Changes the options and all components react to the changes. Useful, for example, to change both search engine and displayed language without reloading the page. |
@@ -13,7 +13,7 @@ search UI experiences. The goal of using components is to include only the compo
13
13
  wherever you want. So, **just import the components, register, and go!**
14
14
 
15
15
  Once you’ve installed the
16
- [dependencies and the xPlugin](web-x-components-integration-guide.md#_1-install-the-dependencies),
16
+ [dependencies and the xPlugin](web-x-components-integration-guide.md#1-install-the-dependencies),
17
17
  you’re ready to use X&nbsp;Components in your project.
18
18
 
19
19
  ## 1. Import and register the X Components
@@ -35,6 +35,8 @@ To integrate the X&nbsp;Components in a frontend UI, you need:
35
35
  - **Empathy Search API** to retrieve search data (or any other search API)
36
36
  - A **search adapter** to communicate with the search API. You can use the Empathy Adapter and
37
37
  configure it with the `EmpathyAdapterBuilder`
38
+ - You must be working on a **Vue** project, or on a **React** project using the
39
+ [React Wrapper](https://github.com/empathyco/x/tree/main/packages/react-wrapper).
38
40
 
39
41
  :::
40
42
 
@@ -193,7 +195,8 @@ poster="/assets/media/videos/How-to-use-X-components-in-a-real-project.jpeg"
193
195
  Once you have integrated the Interface&nbsp;X&nbsp;Components in your project, you're ready to start
194
196
  building your search and discovery UI:
195
197
 
196
- - Change the configuration of the [X Components](web-use-x-components-guide.md) or create new ones.
198
+ - Change the configuration of the [X Components](web-how-to-use-x-components-guide.md) or create new
199
+ ones.
197
200
  - Adapt the
198
201
  [design system](https://github.com/empathyco/x/blob/main/packages/x-components/contributing/design-system.md)
199
202
  to your branding.
@@ -13,5 +13,5 @@ export { HistoryQueriesGetter, historyQueries } from '../js/x-modules/history-qu
13
13
  export { sessionHistoryQueries } from '../js/x-modules/history-queries/store/getters/session-history-queries.getter.js';
14
14
  export { storageKey } from '../js/x-modules/history-queries/store/getters/storage-key.getter.js';
15
15
  export { historyQueriesXStoreModule } from '../js/x-modules/history-queries/store/module.js';
16
- export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery } from '../js/x-modules/history-queries/wiring.js';
16
+ export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery, toggleHistoryQueries } from '../js/x-modules/history-queries/wiring.js';
17
17
  export { historyQueriesXModule } from '../js/x-modules/history-queries/x-module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { currencyFormatter } from '../../utils/currency-formatter';\n import { XInject } from '../decorators/injection.decorators';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n @Component\n export default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return (\n this.format ??\n this.injectedFormat ??\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn('It is necessary to pass a prop or inject the format')\n );\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n<!-- output: '12.345.678,876 €' -->\n<BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n<!-- output: '12.345.678 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n<!-- output: '$ 12.345.678,87' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n<!-- output: '$12.345.678,87' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n<!-- output: '12.345.678,87 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n<!-- output: '12.345.678,87€' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n<!-- output: '12,345,678.87 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n<!-- output: '12 345 678.87 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n<!-- output: '12 345 678 - 87 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n<!-- output: '12.345.678,876543 €' -->\n<BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n<!-- output: '12.345.678,870000 €' -->\n<BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n<!-- output: '12.345.678,000000 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n<!-- output: '12.345.678,87 €' -->\n<BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n<!-- output: '12.345.678 €' -->\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-currency.vue.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span v-if=\"value !== undefined\" class=\"x-currency\">{{ currency }}</span>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { currencyFormatter } from '../../utils/currency-formatter';\n import { XInject } from '../decorators/injection.decorators';\n\n /**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n @Component\n export default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return this.format ?? this.injectedFormat ?? 'i.iii,dd';\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, with the proper\nformat provided as string property. The rendered tag is a span in order to render a default inline\nHTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" />\n <!-- output: '12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678,876 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,ddd? €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$ i.iii,dd\" />\n <!-- output: '$ 12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"$i.iii,dd\" />\n <!-- output: '$12.345.678,87' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd€\" />\n <!-- output: '12.345.678,87€' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i,iii.dd €\" />\n <!-- output: '12,345,678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii.dd €\" />\n <!-- output: '12 345 678.87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i iii - dd €\" />\n <!-- output: '12 345 678 - 87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,876543 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,870000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678\" format=\"i.iii,dddddd €\" />\n <!-- output: '12.345.678,000000 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii,dd €\" />\n <!-- output: '12.345.678,87 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" format=\"i.iii €\" />\n <!-- output: '12.345.678 €' -->\n</template>\n\n<script>\n import { BaseCurrency } from '@empathyco/x-components';\n\n export default {\n name: 'BaseCurrencyDemo',\n components: {\n BaseCurrency\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -51,11 +51,7 @@ let BaseCurrency = class BaseCurrency extends Vue {
51
51
  * @internal
52
52
  */
53
53
  get renderedFormat() {
54
- return (this.format ??
55
- this.injectedFormat ??
56
- //TODO: add here logger
57
- //eslint-disable-next-line no-console
58
- console.warn('It is necessary to pass a prop or inject the format'));
54
+ return this.format ?? this.injectedFormat ?? 'i.iii,dd';
59
55
  }
60
56
  /**
61
57
  * Returns the formatted result as string.
@@ -1 +1 @@
1
- {"version":3,"file":"base-currency.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/currency/base-currency.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { currencyFormatter } from '../../utils/currency-formatter';\nimport { XInject } from '../decorators/injection.decorators';\n\n/**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n@Component\nexport default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return (\n this.format ??\n this.injectedFormat ??\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn('It is necessary to pass a prop or inject the format')\n );\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n}\n"],"names":[],"mappings":";;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAqB,YAAY,GAAjC,MAAqB,YAAa,SAAQ,GAAG;;;;;;;;IAmC3C,IAAc,cAAc;QAC1B,QACE,IAAI,CAAC,MAAM;YACX,IAAI,CAAC,cAAc;;;YAGnB,OAAO,CAAC,IAAI,CAAC,qDAAqD,CAAC,EACnE;KACH;;;;;;;;IASD,IAAc,QAAQ;QACpB,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;KAC3D;CACF,CAAA;AA7CC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2CACA;AAQzB;IADC,IAAI,EAAE;4CACmB;AAQ1B;IADC,OAAO,CAAC,gBAAgB,CAAC;oDACK;AA1BZ,YAAY;IADhC,SAAS;GACW,YAAY,CAuDhC;aAvDoB,YAAY;;;;"}
1
+ {"version":3,"file":"base-currency.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/currency/base-currency.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { currencyFormatter } from '../../utils/currency-formatter';\nimport { XInject } from '../decorators/injection.decorators';\n\n/**\n * Renders the value received as a property which always must be a JavaScript number, with the\n * proper format provided as a string property or by injection. The rendered tag is a span in\n * order to render a default inline HTML element.\n *\n * Regarding the format or mask to be defined as string:\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * format doesn't include decimals, it is filled with zeros until reach the length defined with\n * 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - If you want to hide the decimal part if it's zero, you can add the `?` symbol after the\n * decimal characters (e.g. 'i.iii,dd?', for `1234` you would get `1.234` instead of `1.234,00`).\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST matches with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, it deletes significant digits.\n *\n * @example\n * Basic example:\n *\n * ```vue\n * <BaseCurrency\n * :value=\"123456.789\"\n * format=\"i.iiii,dddd €\"\n * />\n * ```\n *\n * It will render: `123.456,7890 €`.\n *\n * See docs below for more examples.\n *\n * @public\n */\n@Component\nexport default class BaseCurrency extends Vue {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n @Prop({ required: true })\n protected value!: number;\n\n /**\n * The format as string.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n\n /**\n * The injected format as string.\n *\n * @public\n */\n @XInject('currencyFormat')\n public injectedFormat!: string;\n\n /**\n * A format which can be passed through prop or injected.\n *\n * @returns A format as string.\n *\n * @internal\n */\n protected get renderedFormat(): string {\n return this.format ?? this.injectedFormat ?? 'i.iii,dd';\n }\n\n /**\n * Returns the formatted result as string.\n *\n * @returns Formatted number.\n *\n * @internal\n */\n protected get currency(): string {\n return currencyFormatter(this.value, this.renderedFormat);\n }\n}\n"],"names":[],"mappings":";;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAqB,YAAY,GAAjC,MAAqB,YAAa,SAAQ,GAAG;;;;;;;;IAmC3C,IAAc,cAAc;QAC1B,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,IAAI,UAAU,CAAC;KACzD;;;;;;;;IASD,IAAc,QAAQ;QACpB,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;KAC3D;CACF,CAAA;AAvCC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2CACA;AAQzB;IADC,IAAI,EAAE;4CACmB;AAQ1B;IADC,OAAO,CAAC,gBAAgB,CAAC;oDACK;AA1BZ,YAAY;IADhC,SAAS;GACW,YAAY,CAiDhC;aAjDoB,YAAY;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { Component, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n @Component({\n components: { BaseCurrency }\n })\n export default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop({ default: 'i.iii,dd' })\n protected format!: string;\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<BaseResultPreviousPrice :value=\"result\" :format=\"'i.iii,ddd €'\" />\n```\n\n### Overriding default slot\n\n```vue\n<BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n</BaseResultPreviousPrice>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { Component, Prop } from 'vue-property-decorator';\n import Vue from 'vue';\n import BaseCurrency from '../currency/base-currency.vue';\n\n /**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n @Component({\n components: { BaseCurrency }\n })\n export default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script>\n import { BaseResultPreviousPrice } from '@empathyco/x-components';\n\n export default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -14,7 +14,7 @@ __decorate([
14
14
  Prop({ required: true })
15
15
  ], BaseResultPreviousPrice.prototype, "result", void 0);
16
16
  __decorate([
17
- Prop({ default: 'i.iii,dd' })
17
+ Prop()
18
18
  ], BaseResultPreviousPrice.prototype, "format", void 0);
19
19
  BaseResultPreviousPrice = __decorate([
20
20
  Component({
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-previous-price.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Result } from '@empathyco/x-types';\nimport { Component, Prop } from 'vue-property-decorator';\nimport Vue from 'vue';\nimport BaseCurrency from '../currency/base-currency.vue';\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n@Component({\n components: { BaseCurrency }\n})\nexport default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop({ default: 'i.iii,dd' })\n protected format!: string;\n}\n"],"names":["BaseCurrency"],"mappings":";;;;;AAsBA;;;;;AAQA,IAAqB,uBAAuB,GAA5C,MAAqB,uBAAwB,SAAQ,GAAG;CA4BvD,CAAA;AArBC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;uDACC;AAoB1B;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;uDACJ;AA3BP,uBAAuB;IAH3C,SAAS,CAAC;QACT,UAAU,EAAE,gBAAEA,iBAAY,EAAE;KAC7B,CAAC;GACmB,uBAAuB,CA4B3C;aA5BoB,uBAAuB;;;;"}
1
+ {"version":3,"file":"base-result-previous-price.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Result } from '@empathyco/x-types';\nimport { Component, Prop } from 'vue-property-decorator';\nimport Vue from 'vue';\nimport BaseCurrency from '../currency/base-currency.vue';\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result | result} previous price.\n *\n * @public\n */\n@Component({\n components: { BaseCurrency }\n})\nexport default class BaseResultPreviousPrice extends Vue {\n /**\n * (Required) The {@link @empathyco/x-types#Result | result} information.\n *\n * @public\n */\n @Prop({ required: true })\n protected result!: Result;\n\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n @Prop()\n protected format?: string;\n}\n"],"names":["BaseCurrency"],"mappings":";;;;;AAsBA;;;;;AAQA,IAAqB,uBAAuB,GAA5C,MAAqB,uBAAwB,SAAQ,GAAG;CA2BvD,CAAA;AApBC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;uDACC;AAmB1B;IADC,IAAI,EAAE;uDACmB;AA1BP,uBAAuB;IAH3C,SAAS,CAAC;QACT,UAAU,EAAE,gBAAEA,iBAAY,EAAE;KAC7B,CAAC;GACmB,uBAAuB,CA2B3C;aA3BoB,uBAAuB;;;;"}
package/js/index.js CHANGED
@@ -216,7 +216,7 @@ export { HistoryQueriesGetter, historyQueries } from './x-modules/history-querie
216
216
  export { sessionHistoryQueries } from './x-modules/history-queries/store/getters/session-history-queries.getter.js';
217
217
  export { storageKey } from './x-modules/history-queries/store/getters/storage-key.getter.js';
218
218
  export { historyQueriesXStoreModule } from './x-modules/history-queries/store/module.js';
219
- export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery } from './x-modules/history-queries/wiring.js';
219
+ export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery, toggleHistoryQueries } from './x-modules/history-queries/wiring.js';
220
220
  export { historyQueriesXModule } from './x-modules/history-queries/x-module.js';
221
221
  export { default as IdentifierResult } from './x-modules/identifier-results/components/identifier-result.vue.js';
222
222
  export { default as IdentifierResults } from './x-modules/identifier-results/components/identifier-results.vue.js';
@@ -9,11 +9,13 @@ import { localStorageService } from '../../../../utils/storage.js';
9
9
  * @public
10
10
  */
11
11
  const setHistoryQueries = ({ commit, state, getters }, historyQueries) => {
12
- if (historyQueries.length > state.config.maxItemsToStore) {
13
- historyQueries = historyQueries.slice(0, state.config.maxItemsToStore);
12
+ if (state.isEnabled) {
13
+ if (historyQueries.length > state.config.maxItemsToStore) {
14
+ historyQueries = historyQueries.slice(0, state.config.maxItemsToStore);
15
+ }
16
+ commit('setHistoryQueries', historyQueries);
17
+ localStorageService.setItem(getters.storageKey, historyQueries);
14
18
  }
15
- commit('setHistoryQueries', historyQueries);
16
- localStorageService.setItem(getters.storageKey, historyQueries);
17
19
  };
18
20
 
19
21
  export { setHistoryQueries };
@@ -1 +1 @@
1
- {"version":3,"file":"set-history-queries.action.js","sources":["../../../../../../src/x-modules/history-queries/store/actions/set-history-queries.action.ts"],"sourcesContent":["import { localStorageService } from '../../../../utils/storage';\nimport { HistoryQueriesXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link HistoryQueriesActions.setHistoryQueries}.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n * @param historyQueries - The new history queries to save to the store and browser storage.\n * @public\n */\nexport const setHistoryQueries: HistoryQueriesXStoreModule['actions']['setHistoryQueries'] = (\n { commit, state, getters },\n historyQueries\n) => {\n if (historyQueries.length > state.config.maxItemsToStore) {\n historyQueries = historyQueries.slice(0, state.config.maxItemsToStore);\n }\n commit('setHistoryQueries', historyQueries);\n localStorageService.setItem(getters.storageKey, historyQueries);\n};\n"],"names":[],"mappings":";;AAGA;;;;;;;;MAQa,iBAAiB,GAA+D,CAC3F,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAC1B,cAAc;IAEd,IAAI,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE;QACxD,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;KACxE;IACD,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAC5C,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;AAClE;;;;"}
1
+ {"version":3,"file":"set-history-queries.action.js","sources":["../../../../../../src/x-modules/history-queries/store/actions/set-history-queries.action.ts"],"sourcesContent":["import { localStorageService } from '../../../../utils/storage';\nimport { HistoryQueriesXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link HistoryQueriesActions.setHistoryQueries}.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n * @param historyQueries - The new history queries to save to the store and browser storage.\n * @public\n */\nexport const setHistoryQueries: HistoryQueriesXStoreModule['actions']['setHistoryQueries'] = (\n { commit, state, getters },\n historyQueries\n) => {\n if (state.isEnabled) {\n if (historyQueries.length > state.config.maxItemsToStore) {\n historyQueries = historyQueries.slice(0, state.config.maxItemsToStore);\n }\n commit('setHistoryQueries', historyQueries);\n localStorageService.setItem(getters.storageKey, historyQueries);\n }\n};\n"],"names":[],"mappings":";;AAGA;;;;;;;;MAQa,iBAAiB,GAA+D,CAC3F,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAC1B,cAAc;IAEd,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,IAAI,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE;YACxD,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SACxE;QACD,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;QAC5C,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KACjE;AACH;;;;"}
@@ -0,0 +1,13 @@
1
+ import { localStorageService } from '../../../../utils/storage.js';
2
+ import { HISTORY_QUERIES_ENABLED_KEY } from '../constants.js';
3
+
4
+ const toggleHistoryQueries = async ({ dispatch, commit }, isEnabled) => {
5
+ if (!isEnabled) {
6
+ await dispatch('setHistoryQueries', []);
7
+ }
8
+ commit('setIsEnabled', isEnabled);
9
+ localStorageService.setItem(HISTORY_QUERIES_ENABLED_KEY, isEnabled);
10
+ };
11
+
12
+ export { toggleHistoryQueries };
13
+ //# sourceMappingURL=toggle-history-queries.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-history-queries.action.js","sources":["../../../../../../src/x-modules/history-queries/store/actions/toggle-history-queries.action.ts"],"sourcesContent":["import { localStorageService } from '../../../../utils/storage';\nimport { HISTORY_QUERIES_ENABLED_KEY } from '../constants';\nimport { HistoryQueriesXStoreModule } from '../types';\n\nexport const toggleHistoryQueries: HistoryQueriesXStoreModule['actions']['toggleHistoryQueries'] =\n async ({ dispatch, commit }, isEnabled) => {\n if (!isEnabled) {\n await dispatch('setHistoryQueries', []);\n }\n\n commit('setIsEnabled', isEnabled);\n localStorageService.setItem(HISTORY_QUERIES_ENABLED_KEY, isEnabled);\n };\n"],"names":[],"mappings":";;;MAIa,oBAAoB,GAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS;IACpC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,QAAQ,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;KACzC;IAED,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAClC,mBAAmB,CAAC,OAAO,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC;AACtE;;;;"}
@@ -1,5 +1,6 @@
1
1
  const HISTORY_QUERIES_STORAGE_KEY = 'history-queries';
2
- const SESSION_TIME_STAMP_STORAGE_KEY = 'session-time-stamp';
2
+ const SESSION_TIME_STAMP_STORAGE_KEY = 'session-time-stamp';
3
+ const HISTORY_QUERIES_ENABLED_KEY = 'history-queries-enabled';
3
4
 
4
- export { HISTORY_QUERIES_STORAGE_KEY, SESSION_TIME_STAMP_STORAGE_KEY };
5
+ export { HISTORY_QUERIES_ENABLED_KEY, HISTORY_QUERIES_STORAGE_KEY, SESSION_TIME_STAMP_STORAGE_KEY };
5
6
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../src/x-modules/history-queries/store/constants.ts"],"sourcesContent":["export const HISTORY_QUERIES_STORAGE_KEY = 'history-queries';\nexport const SESSION_TIME_STAMP_STORAGE_KEY = 'session-time-stamp';\n"],"names":[],"mappings":"MAAa,2BAA2B,GAAG,kBAAkB;MAChD,8BAA8B,GAAG;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/x-modules/history-queries/store/constants.ts"],"sourcesContent":["export const HISTORY_QUERIES_STORAGE_KEY = 'history-queries';\nexport const SESSION_TIME_STAMP_STORAGE_KEY = 'session-time-stamp';\nexport const HISTORY_QUERIES_ENABLED_KEY = 'history-queries-enabled';\n"],"names":[],"mappings":"MAAa,2BAA2B,GAAG,kBAAkB;MAChD,8BAA8B,GAAG,qBAAqB;MACtD,2BAA2B,GAAG;;;;"}
@@ -1,10 +1,13 @@
1
1
  import { setQuery } from '../../../store/utils/query.utils.js';
2
+ import { localStorageService } from '../../../utils/storage.js';
2
3
  import { addQueryToHistory } from './actions/add-query-to-history.action.js';
3
4
  import { loadHistoryQueriesFromBrowserStorage } from './actions/load-history-queries-from-browser-storage.action.js';
4
5
  import { refreshSession } from './actions/refresh-session.action.js';
5
6
  import { removeFromHistory } from './actions/remove-query-from-history.action.js';
6
7
  import { setHistoryQueries } from './actions/set-history-queries.action.js';
7
8
  import { setUrlParams } from './actions/set-url-params.action.js';
9
+ import { toggleHistoryQueries } from './actions/toggle-history-queries.action.js';
10
+ import { HISTORY_QUERIES_ENABLED_KEY } from './constants.js';
8
11
  import { historyQueries } from './getters/history-queries.getter.js';
9
12
  import { normalizedQuery } from './getters/normalized-query.getter.js';
10
13
  import { sessionHistoryQueries } from './getters/session-history-queries.getter.js';
@@ -25,7 +28,8 @@ const historyQueriesXStoreModule = {
25
28
  },
26
29
  query: '',
27
30
  historyQueries: [],
28
- sessionTimeStampInMs: Date.now()
31
+ sessionTimeStampInMs: Date.now(),
32
+ isEnabled: localStorageService.getItem(HISTORY_QUERIES_ENABLED_KEY) ?? true
29
33
  }),
30
34
  getters: {
31
35
  historyQueries,
@@ -40,7 +44,10 @@ const historyQueriesXStoreModule = {
40
44
  setSessionTimeStamp(state, sessionTimeStamp) {
41
45
  state.sessionTimeStampInMs = sessionTimeStamp;
42
46
  },
43
- setQuery
47
+ setQuery,
48
+ setIsEnabled(state, isEnabled) {
49
+ state.isEnabled = isEnabled;
50
+ }
44
51
  },
45
52
  actions: {
46
53
  addQueryToHistory,
@@ -48,7 +55,8 @@ const historyQueriesXStoreModule = {
48
55
  refreshSession,
49
56
  removeFromHistory,
50
57
  setHistoryQueries,
51
- setUrlParams
58
+ setUrlParams,
59
+ toggleHistoryQueries
52
60
  }
53
61
  };
54
62
 
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/history-queries/store/module.ts"],"sourcesContent":["import { setQuery } from '../../../store/utils/query.utils';\nimport { addQueryToHistory } from './actions/add-query-to-history.action';\n// eslint-disable-next-line max-len\nimport { loadHistoryQueriesFromBrowserStorage } from './actions/load-history-queries-from-browser-storage.action';\nimport { refreshSession } from './actions/refresh-session.action';\nimport { removeFromHistory } from './actions/remove-query-from-history.action';\nimport { setHistoryQueries } from './actions/set-history-queries.action';\nimport { setUrlParams } from './actions/set-url-params.action';\nimport { historyQueries } from './getters/history-queries.getter';\nimport { normalizedQuery } from './getters/normalized-query.getter';\nimport { sessionHistoryQueries } from './getters/session-history-queries.getter';\nimport { storageKey } from './getters/storage-key.getter';\nimport { HistoryQueriesXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the history-queries module.\n *\n * @internal\n */\nexport const historyQueriesXStoreModule: HistoryQueriesXStoreModule = {\n state: () => ({\n config: {\n debounceInMs: 150,\n maxItemsToStore: 50,\n hideIfEqualsQuery: true,\n sessionTTLInMs: 30 * 60 * 1000\n },\n query: '',\n historyQueries: [],\n sessionTimeStampInMs: Date.now()\n }),\n getters: {\n historyQueries,\n normalizedQuery,\n sessionHistoryQueries,\n storageKey\n },\n mutations: {\n setHistoryQueries(state, historyQueries) {\n state.historyQueries = historyQueries;\n },\n setSessionTimeStamp(state, sessionTimeStamp) {\n state.sessionTimeStampInMs = sessionTimeStamp;\n },\n setQuery\n },\n actions: {\n addQueryToHistory,\n loadHistoryQueriesFromBrowserStorage,\n refreshSession,\n removeFromHistory,\n setHistoryQueries,\n setUrlParams\n }\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAcA;;;;;MAKa,0BAA0B,GAA+B;IACpE,KAAK,EAAE,OAAO;QACZ,MAAM,EAAE;YACN,YAAY,EAAE,GAAG;YACjB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,IAAI;YACvB,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;SAC/B;QACD,KAAK,EAAE,EAAE;QACT,cAAc,EAAE,EAAE;QAClB,oBAAoB,EAAE,IAAI,CAAC,GAAG,EAAE;KACjC,CAAC;IACF,OAAO,EAAE;QACP,cAAc;QACd,eAAe;QACf,qBAAqB;QACrB,UAAU;KACX;IACD,SAAS,EAAE;QACT,iBAAiB,CAAC,KAAK,EAAE,cAAc;YACrC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;SACvC;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;YACzC,KAAK,CAAC,oBAAoB,GAAG,gBAAgB,CAAC;SAC/C;QACD,QAAQ;KACT;IACD,OAAO,EAAE;QACP,iBAAiB;QACjB,oCAAoC;QACpC,cAAc;QACd,iBAAiB;QACjB,iBAAiB;QACjB,YAAY;KACb;;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/history-queries/store/module.ts"],"sourcesContent":["import { setQuery } from '../../../store/utils/query.utils';\nimport { localStorageService } from '../../../utils/storage';\nimport { addQueryToHistory } from './actions/add-query-to-history.action';\n// eslint-disable-next-line max-len\nimport { loadHistoryQueriesFromBrowserStorage } from './actions/load-history-queries-from-browser-storage.action';\nimport { refreshSession } from './actions/refresh-session.action';\nimport { removeFromHistory } from './actions/remove-query-from-history.action';\nimport { setHistoryQueries } from './actions/set-history-queries.action';\nimport { setUrlParams } from './actions/set-url-params.action';\nimport { toggleHistoryQueries } from './actions/toggle-history-queries.action';\nimport { HISTORY_QUERIES_ENABLED_KEY } from './constants';\nimport { historyQueries } from './getters/history-queries.getter';\nimport { normalizedQuery } from './getters/normalized-query.getter';\nimport { sessionHistoryQueries } from './getters/session-history-queries.getter';\nimport { storageKey } from './getters/storage-key.getter';\nimport { HistoryQueriesXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the history-queries module.\n *\n * @internal\n */\nexport const historyQueriesXStoreModule: HistoryQueriesXStoreModule = {\n state: () => ({\n config: {\n debounceInMs: 150,\n maxItemsToStore: 50,\n hideIfEqualsQuery: true,\n sessionTTLInMs: 30 * 60 * 1000\n },\n query: '',\n historyQueries: [],\n sessionTimeStampInMs: Date.now(),\n isEnabled: localStorageService.getItem<boolean>(HISTORY_QUERIES_ENABLED_KEY) ?? true\n }),\n getters: {\n historyQueries,\n normalizedQuery,\n sessionHistoryQueries,\n storageKey\n },\n mutations: {\n setHistoryQueries(state, historyQueries) {\n state.historyQueries = historyQueries;\n },\n setSessionTimeStamp(state, sessionTimeStamp) {\n state.sessionTimeStampInMs = sessionTimeStamp;\n },\n setQuery,\n setIsEnabled(state, isEnabled) {\n state.isEnabled = isEnabled;\n }\n },\n actions: {\n addQueryToHistory,\n loadHistoryQueriesFromBrowserStorage,\n refreshSession,\n removeFromHistory,\n setHistoryQueries,\n setUrlParams,\n toggleHistoryQueries\n }\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiBA;;;;;MAKa,0BAA0B,GAA+B;IACpE,KAAK,EAAE,OAAO;QACZ,MAAM,EAAE;YACN,YAAY,EAAE,GAAG;YACjB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,IAAI;YACvB,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;SAC/B;QACD,KAAK,EAAE,EAAE;QACT,cAAc,EAAE,EAAE;QAClB,oBAAoB,EAAE,IAAI,CAAC,GAAG,EAAE;QAChC,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAU,2BAA2B,CAAC,IAAI,IAAI;KACrF,CAAC;IACF,OAAO,EAAE;QACP,cAAc;QACd,eAAe;QACf,qBAAqB;QACrB,UAAU;KACX;IACD,SAAS,EAAE;QACT,iBAAiB,CAAC,KAAK,EAAE,cAAc;YACrC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;SACvC;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;YACzC,KAAK,CAAC,oBAAoB,GAAG,gBAAgB,CAAC;SAC/C;QACD,QAAQ;QACR,YAAY,CAAC,KAAK,EAAE,SAAS;YAC3B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;SAC7B;KACF;IACD,OAAO,EAAE;QACP,iBAAiB;QACjB,oCAAoC;QACpC,cAAc;QACd,iBAAiB;QACjB,iBAAiB;QACjB,YAAY;QACZ,oBAAoB;KACrB;;;;;"}
@@ -76,6 +76,12 @@ const clearHistoryQueries = wireDispatch('setHistoryQueries', []);
76
76
  * @public
77
77
  */
78
78
  const removeHistoryQuery = wireDispatch('removeFromHistory');
79
+ /**
80
+ * Enables or disables history queries.
81
+ *
82
+ * @public
83
+ */
84
+ const toggleHistoryQueries = wireDispatch('toggleHistoryQueries');
79
85
  /**
80
86
  * Debounce function for the module.
81
87
  */
@@ -110,8 +116,11 @@ const historyQueriesWiring = createWiring({
110
116
  },
111
117
  UserPressedRemoveHistoryQuery: {
112
118
  removeHistoryQuery
119
+ },
120
+ UserToggledHistoryQueries: {
121
+ toggleHistoryQueries
113
122
  }
114
123
  });
115
124
 
116
- export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery };
125
+ export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesQuery, toggleHistoryQueries };
117
126
  //# sourceMappingURL=wiring.js.map