@empathyco/x-components 3.0.0-alpha.129 → 3.0.0-alpha.131
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 +26 -0
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-components.historyqueriesswitch.md +15 -0
- package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesdisplayed.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesquerychanged.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesstoragekeychanged.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.md +10 -8
- package/docs/API-reference/api/x-components.historyqueriesxevents.sessionhistoryquerieschanged.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.userclickedconfirmdisablehistoryqueries.md +13 -0
- package/docs/API-reference/api/x-components.historyqueriesxevents.userclickeddisablehistoryqueries.md +13 -0
- package/docs/API-reference/api/x-components.historyqueriesxevents.userclickedenablehistoryqueries.md +13 -0
- package/docs/API-reference/api/x-components.historyqueriesxevents.userpressedclearhistoryqueries.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.userpressedremovehistoryquery.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.userselectedahistoryquery.md +1 -1
- package/docs/API-reference/api/x-components.md +3 -1
- package/docs/API-reference/api/x-components.sethistoryqueriesdisabled.md +13 -0
- package/docs/API-reference/api/x-components.sethistoryqueriesenabled.md +13 -0
- package/docs/API-reference/api/x-components.xinstaller.md +1 -1
- package/docs/API-reference/components/history-queries/x-components.history-queries-switch.md +96 -0
- package/docs/build-search-ui/web-archetype-development-guide.md +1 -1
- package/docs/build-search-ui/web-archetype-integration-guide.md +2 -2
- package/history-queries/index.js +2 -1
- package/js/index.js +2 -1
- package/js/index.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js +2 -2
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries-switch.vue.js +50 -0
- package/js/x-modules/history-queries/components/history-queries-switch.vue.js.map +1 -0
- package/js/x-modules/history-queries/components/history-queries-switch.vue_rollup-plugin-vue_script.vue.js +37 -0
- package/js/x-modules/history-queries/components/history-queries-switch.vue_rollup-plugin-vue_script.vue.js.map +1 -0
- package/js/x-modules/history-queries/wiring.js +14 -5
- package/js/x-modules/history-queries/wiring.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +158 -56
- package/report/x-components.api.md +22 -6
- package/types/x-installer/x-installer/x-installer.d.ts +2 -2
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts +22 -0
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -0
- package/types/x-modules/history-queries/components/index.d.ts +1 -0
- package/types/x-modules/history-queries/components/index.d.ts.map +1 -1
- package/types/x-modules/history-queries/events.types.d.ts +20 -10
- package/types/x-modules/history-queries/events.types.d.ts.map +1 -1
- package/types/x-modules/history-queries/wiring.d.ts +13 -4
- package/types/x-modules/history-queries/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.historyqueriesxevents.usertoggledhistoryqueries.md +0 -13
- package/docs/API-reference/api/x-components.togglehistoryqueries.md +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.131](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.130...@empathyco/x-components@3.0.0-alpha.131) (2022-07-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **history-queries:** add `HistoryQueriesSwitch` component (#593)
|
|
11
|
+
([8c87cc3](https://github.com/empathyco/x/commit/8c87cc3a35336720d3da79ab7347e52caa4cd922)),
|
|
12
|
+
closes [EX-6515](https://searchbroker.atlassian.net/browse/EX-6515)
|
|
13
|
+
|
|
14
|
+
# Change Log
|
|
15
|
+
|
|
16
|
+
All notable changes to this project will be documented in this file. See
|
|
17
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
18
|
+
|
|
19
|
+
## [3.0.0-alpha.130](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.129...@empathyco/x-components@3.0.0-alpha.130) (2022-07-12)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- Move `XAPI` from `window.X` to `window.InterfaceX` (#599)
|
|
24
|
+
([4538778](https://github.com/empathyco/x/commit/45387783c947f859667f2786ba9013b83b952063)),
|
|
25
|
+
closes [EX-6645](https://searchbroker.atlassian.net/browse/EX-6645)
|
|
26
|
+
|
|
27
|
+
# Change Log
|
|
28
|
+
|
|
29
|
+
All notable changes to this project will be documented in this file. See
|
|
30
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
31
|
+
|
|
6
32
|
## [3.0.0-alpha.129](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.128...@empathyco/x-components@3.0.0-alpha.129) (2022-07-11)
|
|
7
33
|
|
|
8
34
|
### Features
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [HistoryQueriesSwitch](./x-components.historyqueriesswitch.md)
|
|
4
|
+
|
|
5
|
+
## HistoryQueriesSwitch class
|
|
6
|
+
|
|
7
|
+
History Queries Switch is a component to enable or disable the history queries. This component emits events depending on the `isEnabled` value.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export default class HistoryQueriesSwitch extends Vue
|
|
13
|
+
```
|
|
14
|
+
<b>Extends:</b> Vue
|
|
15
|
+
|
package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesdisplayed.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.HistoryQueriesDisplayed property
|
|
6
6
|
|
|
7
|
-
The current history queries have been displayed to the user.
|
|
7
|
+
The current history queries have been displayed to the user. Payload: The displayed history queries.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesquerychanged.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.HistoryQueriesQueryChanged property
|
|
6
6
|
|
|
7
|
-
The query for searching inside the history-queries has changed.
|
|
7
|
+
The query for searching inside the history-queries has changed. Payload: The history-queries query.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
package/docs/API-reference/api/x-components.historyqueriesxevents.historyqueriesstoragekeychanged.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.HistoryQueriesStorageKeyChanged property
|
|
6
6
|
|
|
7
|
-
The key for saving the history queries in to the browser storage has changed.
|
|
7
|
+
The key for saving the history queries in to the browser storage has changed. Payload: The new history-queries storage key.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -16,12 +16,14 @@ export interface HistoryQueriesXEvents
|
|
|
16
16
|
|
|
17
17
|
| Property | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| [HistoryQueriesDisplayed](./x-components.historyqueriesxevents.historyqueriesdisplayed.md) | HistoryQuery\[\] | The current history queries have been displayed to the user.
|
|
20
|
-
| [HistoryQueriesQueryChanged](./x-components.historyqueriesxevents.historyqueriesquerychanged.md) | string | The query for searching inside the history-queries has changed.
|
|
21
|
-
| [HistoryQueriesStorageKeyChanged](./x-components.historyqueriesxevents.historyqueriesstoragekeychanged.md) | string | The key for saving the history queries in to the browser storage has changed.
|
|
22
|
-
| [SessionHistoryQueriesChanged](./x-components.historyqueriesxevents.sessionhistoryquerieschanged.md) | HistoryQuery\[\] | The queries made in the current session have changed
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
| [
|
|
19
|
+
| [HistoryQueriesDisplayed](./x-components.historyqueriesxevents.historyqueriesdisplayed.md) | HistoryQuery\[\] | The current history queries have been displayed to the user. Payload: The displayed history queries. |
|
|
20
|
+
| [HistoryQueriesQueryChanged](./x-components.historyqueriesxevents.historyqueriesquerychanged.md) | string | The query for searching inside the history-queries has changed. Payload: The history-queries query. |
|
|
21
|
+
| [HistoryQueriesStorageKeyChanged](./x-components.historyqueriesxevents.historyqueriesstoragekeychanged.md) | string | The key for saving the history queries in to the browser storage has changed. Payload: The new history-queries storage key. |
|
|
22
|
+
| [SessionHistoryQueriesChanged](./x-components.historyqueriesxevents.sessionhistoryquerieschanged.md) | HistoryQuery\[\] | The queries made in the current session have changed Payload: The session history queries. |
|
|
23
|
+
| [UserClickedConfirmDisableHistoryQueries](./x-components.historyqueriesxevents.userclickedconfirmdisablehistoryqueries.md) | void | The user has clicked the confirm button to disable the history queries. Payload: None. |
|
|
24
|
+
| [UserClickedDisableHistoryQueries](./x-components.historyqueriesxevents.userclickeddisablehistoryqueries.md) | void | The user has clicked a control to disable the history queries. Payload: None. |
|
|
25
|
+
| [UserClickedEnableHistoryQueries](./x-components.historyqueriesxevents.userclickedenablehistoryqueries.md) | void | The user has clicked a control to enable the history queries. Payload: None. |
|
|
26
|
+
| [UserPressedClearHistoryQueries](./x-components.historyqueriesxevents.userpressedclearhistoryqueries.md) | void | The user pressed the button for clearing all the history queries. Payload: none. |
|
|
27
|
+
| [UserPressedRemoveHistoryQuery](./x-components.historyqueriesxevents.userpressedremovehistoryquery.md) | HistoryQuery | The user pressed the button for removing a single [history query](./x-types.historyquery.md)<!-- -->. Payload: The <code>HistoryQuery</code> to remove. |
|
|
28
|
+
| [UserSelectedAHistoryQuery](./x-components.historyqueriesxevents.userselectedahistoryquery.md) | HistoryQuery | The user has selected a history-query. Payload: The [history query](./x-types.historyquery.md) selected. |
|
|
27
29
|
|
package/docs/API-reference/api/x-components.historyqueriesxevents.sessionhistoryquerieschanged.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.SessionHistoryQueriesChanged property
|
|
6
6
|
|
|
7
|
-
The queries made in the current session have changed
|
|
7
|
+
The queries made in the current session have changed Payload: The session history queries.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [HistoryQueriesXEvents](./x-components.historyqueriesxevents.md) > [UserClickedConfirmDisableHistoryQueries](./x-components.historyqueriesxevents.userclickedconfirmdisablehistoryqueries.md)
|
|
4
|
+
|
|
5
|
+
## HistoryQueriesXEvents.UserClickedConfirmDisableHistoryQueries property
|
|
6
|
+
|
|
7
|
+
The user has clicked the confirm button to disable the history queries. Payload: None.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
UserClickedConfirmDisableHistoryQueries: void;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [HistoryQueriesXEvents](./x-components.historyqueriesxevents.md) > [UserClickedDisableHistoryQueries](./x-components.historyqueriesxevents.userclickeddisablehistoryqueries.md)
|
|
4
|
+
|
|
5
|
+
## HistoryQueriesXEvents.UserClickedDisableHistoryQueries property
|
|
6
|
+
|
|
7
|
+
The user has clicked a control to disable the history queries. Payload: None.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
UserClickedDisableHistoryQueries: void;
|
|
13
|
+
```
|
package/docs/API-reference/api/x-components.historyqueriesxevents.userclickedenablehistoryqueries.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [HistoryQueriesXEvents](./x-components.historyqueriesxevents.md) > [UserClickedEnableHistoryQueries](./x-components.historyqueriesxevents.userclickedenablehistoryqueries.md)
|
|
4
|
+
|
|
5
|
+
## HistoryQueriesXEvents.UserClickedEnableHistoryQueries property
|
|
6
|
+
|
|
7
|
+
The user has clicked a control to enable the history queries. Payload: None.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
UserClickedEnableHistoryQueries: void;
|
|
13
|
+
```
|
package/docs/API-reference/api/x-components.historyqueriesxevents.userpressedremovehistoryquery.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.UserPressedRemoveHistoryQuery property
|
|
6
6
|
|
|
7
|
-
The user pressed the button for removing a single [history query](./x-types.historyquery.md)<!-- -->.
|
|
7
|
+
The user pressed the button for removing a single [history query](./x-types.historyquery.md)<!-- -->. Payload: The `HistoryQuery` to remove.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
package/docs/API-reference/api/x-components.historyqueriesxevents.userselectedahistoryquery.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## HistoryQueriesXEvents.UserSelectedAHistoryQuery property
|
|
6
6
|
|
|
7
|
-
The user has selected a history-query.
|
|
7
|
+
The user has selected a history-query. Payload: The [history query](./x-types.historyquery.md) selected.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -77,6 +77,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
77
77
|
| [HierarchicalFilter](./x-components.hierarchicalfilter.md) | Renders a hierarchical filter recursively, emitting the needed events when clicked. |
|
|
78
78
|
| [HistoryQueries](./x-components.historyqueries.md) | This component renders a list of suggestions coming from the user queries history. |
|
|
79
79
|
| [HistoryQueriesGetter](./x-components.historyqueriesgetter.md) | Class implementation for the [HistoryQueriesGetters.historyQueries](./x-components.historyqueriesgetters.historyqueries.md) getter. |
|
|
80
|
+
| [HistoryQueriesSwitch](./x-components.historyqueriesswitch.md) | History Queries Switch is a component to enable or disable the history queries. This component emits events depending on the <code>isEnabled</code> value. |
|
|
80
81
|
| [HistoryQuery](./x-components.historyquery.md) | This component renders a history query suggestion combining two buttons: one for selecting this suggestion as the search query, and another one to remove this query suggestion from the history queries. |
|
|
81
82
|
| [IdentifierResult](./x-components.identifierresult.md) | This component renders an identifier result value and highlights its matching part with the query from the state. Receives as prop the [result data](./x-types.result.md)<!-- -->. |
|
|
82
83
|
| [IdentifierResults](./x-components.identifierresults.md) | Paints the list of identifier results stored in the state. Each identifier result should be represented by a [identifier result component](./x-components.identifierresult.md) besides any other component. |
|
|
@@ -500,6 +501,8 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
500
501
|
| [setConsent](./x-components.setconsent.md) | Sets the tagging state <code>consent</code>. |
|
|
501
502
|
| [setExtraParams](./x-components.setextraparams.md) | Sets the extra params of the [ExtraParamsXModule](./x-components.extraparamsxmodule.md)<!-- -->. |
|
|
502
503
|
| [setHistoryQueries](./x-components.sethistoryqueries.md) | Default implementation for the [HistoryQueriesActions.setHistoryQueries()](./x-components.historyqueriesactions.sethistoryqueries.md)<!-- -->. |
|
|
504
|
+
| [setHistoryQueriesDisabled](./x-components.sethistoryqueriesdisabled.md) | Disables history queries. |
|
|
505
|
+
| [setHistoryQueriesEnabled](./x-components.sethistoryqueriesenabled.md) | Enables history queries. |
|
|
503
506
|
| [setHistoryQueriesQuery](./x-components.sethistoryqueriesquery.md) | Sets the query of the history queries module. Used for searching into the history queries. |
|
|
504
507
|
| [setIdentifierResultsExtraParams](./x-components.setidentifierresultsextraparams.md) | Sets the identifier result state <code>params</code>. |
|
|
505
508
|
| [setIdentifierResultsQuery](./x-components.setidentifierresultsquery.md) | Sets the identifier-results module query. |
|
|
@@ -548,7 +551,6 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
548
551
|
| [taggingXModule](./x-components.taggingxmodule.md) | Tagging [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>empathize</code> entry point. |
|
|
549
552
|
| [TagIcon](./x-components.tagicon.md) | |
|
|
550
553
|
| [throttleFunction](./x-components.throttlefunction.md) | Util function that returns a throttled version of the function passed as parameter. |
|
|
551
|
-
| [toggleHistoryQueries](./x-components.togglehistoryqueries.md) | Enables or disables history queries. |
|
|
552
554
|
| [toggleRelatedTag](./x-components.togglerelatedtag.md) | Default implementation for the [RelatedTagsActions.toggleRelatedTag()](./x-components.relatedtagsactions.togglerelatedtag.md)<!-- -->. |
|
|
553
555
|
| [toggleRelatedTagWire](./x-components.togglerelatedtagwire.md) | Sets the selected related tags. |
|
|
554
556
|
| [track](./x-components.track.md) | Default implementation for the [TaggingActions.track()](./x-components.taggingactions.track.md)<!-- -->. |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [setHistoryQueriesDisabled](./x-components.sethistoryqueriesdisabled.md)
|
|
4
|
+
|
|
5
|
+
## setHistoryQueriesDisabled variable
|
|
6
|
+
|
|
7
|
+
Disables history queries.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
setHistoryQueriesDisabled: import("../..").AnyWire
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [setHistoryQueriesEnabled](./x-components.sethistoryqueriesenabled.md)
|
|
4
|
+
|
|
5
|
+
## setHistoryQueriesEnabled variable
|
|
6
|
+
|
|
7
|
+
Enables history queries.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
setHistoryQueriesEnabled: import("../..").AnyWire
|
|
13
|
+
```
|
|
@@ -33,7 +33,7 @@ The way to use this class is the next: 1. Create the installer passing in the [I
|
|
|
33
33
|
2.2 If the API option is enabled (`createAPI` is `true` in [InstallXOptions](./x-components.installxoptions.md)<!-- -->, or is not present as the default value is `true`<!-- -->) then this init step can be done with the Public API:
|
|
34
34
|
|
|
35
35
|
```
|
|
36
|
-
window.
|
|
36
|
+
window.InterfaceX.init(snippetConfig)
|
|
37
37
|
```
|
|
38
38
|
2.3 When the script of the project build is loaded it searches for a global `initX` variable that the customer must have in their web site. This variable can be a function that returns the [SnippetConfig](./x-components.snippetconfig.md) or an object that contains the [SnippetConfig](./x-components.snippetconfig.md) itself:
|
|
39
39
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: HistoryQueriesSwitch
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HistoryQueriesSwitch
|
|
8
|
+
|
|
9
|
+
History Queries Switch is a component to enable or disable the history queries.
|
|
10
|
+
This component emits events depending on the `isEnabled` value.
|
|
11
|
+
|
|
12
|
+
## Events
|
|
13
|
+
|
|
14
|
+
A list of events that the component will emit:
|
|
15
|
+
|
|
16
|
+
- [`UserClickedEnableHistoryQueries`](x-components.historyqueriesxevents.userclickedenablehistoryqueries.md): the event is emitted
|
|
17
|
+
whenever the user clicks the switch and the history queries are disabled.
|
|
18
|
+
- [`UserClickedDisableHistoryQueries`](x-components.historyqueriesxevents.userclickeddisablehistoryqueries.md): the event is emitted
|
|
19
|
+
whenever the user clicks the switch and the history queries are enabled.
|
|
20
|
+
|
|
21
|
+
## See it in action
|
|
22
|
+
|
|
23
|
+
Here you have a basic example of how the switch is rendered.
|
|
24
|
+
|
|
25
|
+
_Try clicking it to see how it changes its state_
|
|
26
|
+
|
|
27
|
+
```vue live
|
|
28
|
+
<template>
|
|
29
|
+
<HistoryQueriesSwitch />
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import { HistoryQueriesSwitch } from "@empathyco/x-components";
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: "HistoryQueriesSwitchDemo",
|
|
37
|
+
components: {
|
|
38
|
+
HistoryQueriesSwitch
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Here you have a more complex example.
|
|
45
|
+
|
|
46
|
+
```vue live
|
|
47
|
+
<template>
|
|
48
|
+
<div>
|
|
49
|
+
<div>
|
|
50
|
+
<SearchInput :instant="false" />
|
|
51
|
+
<SearchButton>Search</SearchButton>
|
|
52
|
+
</div>
|
|
53
|
+
<label>
|
|
54
|
+
History queries:
|
|
55
|
+
<HistoryQueriesSwitch />
|
|
56
|
+
<HistoryQueries />
|
|
57
|
+
<BaseEventsModal :eventsToOpenModal="eventsToOpenModal">
|
|
58
|
+
<BaseEventButton :events="disableEvents">Disable</BaseEventButton>
|
|
59
|
+
<BaseEventButton :events="cancelEvents">Cancel</BaseEventButton>
|
|
60
|
+
</BaseEventsModal>
|
|
61
|
+
</label>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import { BaseEventButton, BaseEventsModal } from "@empathyco/x-components";
|
|
67
|
+
import {
|
|
68
|
+
HistoryQueriesSwitch,
|
|
69
|
+
HistoryQueries
|
|
70
|
+
} from "@empathyco/x-components/history-queries";
|
|
71
|
+
import { SearchInput, SearchButton } from "@empathyco/x-components/search";
|
|
72
|
+
export default {
|
|
73
|
+
name: "HistoryQueriesSwitchDemo",
|
|
74
|
+
components: {
|
|
75
|
+
BaseEventButton,
|
|
76
|
+
BaseEventsModal,
|
|
77
|
+
HistoryQueriesSwitch,
|
|
78
|
+
HistoryQueries,
|
|
79
|
+
SearchInput,
|
|
80
|
+
SearchButton
|
|
81
|
+
},
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
eventsToOpenModal: ["UserClickedDisableHistoryQueries"],
|
|
85
|
+
disableEvents: {
|
|
86
|
+
UserClickedConfirmDisableHistoryQueries: undefined,
|
|
87
|
+
UserClickedCloseEventsModal: undefined
|
|
88
|
+
},
|
|
89
|
+
cancelEvents: {
|
|
90
|
+
UserClickedCloseEventsModal: undefined
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
```
|
|
@@ -142,7 +142,7 @@ Since the X Archetype project operates as a layer and is designed to be int
|
|
|
142
142
|
any kind of website regardless the chosen technology, the `XInstaller` utility and its
|
|
143
143
|
`installXOptions` object are designed to install the xPlugin, adding the connection between the
|
|
144
144
|
X Components and the search API and bootstrapping the entire application with powerful APIs
|
|
145
|
-
that are available in the `window.
|
|
145
|
+
that are available in the `window.InterfaceX` object.
|
|
146
146
|
|
|
147
147
|
To configure the xPlugin, run this code:
|
|
148
148
|
|
|
@@ -182,7 +182,7 @@ object to provide the initialization options:
|
|
|
182
182
|
```html
|
|
183
183
|
<script src="https://x.empathy.co/my-store/app.js"></script>
|
|
184
184
|
<script>
|
|
185
|
-
window.
|
|
185
|
+
window.InterfaceX.init({
|
|
186
186
|
instance: 'my-store',
|
|
187
187
|
env: 'live',
|
|
188
188
|
scope: 'desktop',
|
|
@@ -262,7 +262,7 @@ shopping cart:
|
|
|
262
262
|
```html
|
|
263
263
|
<script src="https://x.empathy.co/my-store/app.js"></script>
|
|
264
264
|
<script>
|
|
265
|
-
window.
|
|
265
|
+
window.InterfaceX.init({
|
|
266
266
|
instance: 'my-store',
|
|
267
267
|
env: 'live',
|
|
268
268
|
scope: 'desktop',
|
package/history-queries/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as ClearHistoryQueries } from '../js/x-modules/history-queries/components/clear-history-queries.vue.js';
|
|
2
2
|
export { default as HistoryQueries } from '../js/x-modules/history-queries/components/history-queries.vue.js';
|
|
3
|
+
export { default as HistoryQueriesSwitch } from '../js/x-modules/history-queries/components/history-queries-switch.vue.js';
|
|
3
4
|
export { default as HistoryQuery } from '../js/x-modules/history-queries/components/history-query.vue.js';
|
|
4
5
|
export { default as MyHistory } from '../js/x-modules/history-queries/components/my-history.vue.js';
|
|
5
6
|
export { default as RemoveHistoryQuery } from '../js/x-modules/history-queries/components/remove-history-query.vue.js';
|
|
@@ -13,5 +14,5 @@ export { HistoryQueriesGetter, historyQueries } from '../js/x-modules/history-qu
|
|
|
13
14
|
export { sessionHistoryQueries } from '../js/x-modules/history-queries/store/getters/session-history-queries.getter.js';
|
|
14
15
|
export { storageKey } from '../js/x-modules/history-queries/store/getters/storage-key.getter.js';
|
|
15
16
|
export { historyQueriesXStoreModule } from '../js/x-modules/history-queries/store/module.js';
|
|
16
|
-
export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery,
|
|
17
|
+
export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesDisabled, setHistoryQueriesEnabled, setHistoryQueriesQuery } from '../js/x-modules/history-queries/wiring.js';
|
|
17
18
|
export { historyQueriesXModule } from '../js/x-modules/history-queries/x-module.js';
|
package/js/index.js
CHANGED
|
@@ -208,6 +208,7 @@ export { isNewQuery } from './x-modules/facets/utils.js';
|
|
|
208
208
|
export { default as FacetsMixin } from './x-modules/facets/components/facets.mixin.js';
|
|
209
209
|
export { default as ClearHistoryQueries } from './x-modules/history-queries/components/clear-history-queries.vue.js';
|
|
210
210
|
export { default as HistoryQueries } from './x-modules/history-queries/components/history-queries.vue.js';
|
|
211
|
+
export { default as HistoryQueriesSwitch } from './x-modules/history-queries/components/history-queries-switch.vue.js';
|
|
211
212
|
export { default as HistoryQuery } from './x-modules/history-queries/components/history-query.vue.js';
|
|
212
213
|
export { default as MyHistory } from './x-modules/history-queries/components/my-history.vue.js';
|
|
213
214
|
export { default as RemoveHistoryQuery } from './x-modules/history-queries/components/remove-history-query.vue.js';
|
|
@@ -221,7 +222,7 @@ export { HistoryQueriesGetter, historyQueries } from './x-modules/history-querie
|
|
|
221
222
|
export { sessionHistoryQueries } from './x-modules/history-queries/store/getters/session-history-queries.getter.js';
|
|
222
223
|
export { storageKey } from './x-modules/history-queries/store/getters/storage-key.getter.js';
|
|
223
224
|
export { historyQueriesXStoreModule } from './x-modules/history-queries/store/module.js';
|
|
224
|
-
export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery,
|
|
225
|
+
export { addQueryToHistoryQueries, clearHistoryQueries, clearHistoryQueriesQuery, historyQueriesWiring, loadHistoryQueriesFromBrowserStorageWire, refreshHistoryQueriesSession, removeHistoryQuery, setHistoryQueriesDisabled, setHistoryQueriesEnabled, setHistoryQueriesQuery } from './x-modules/history-queries/wiring.js';
|
|
225
226
|
export { historyQueriesXModule } from './x-modules/history-queries/x-module.js';
|
|
226
227
|
export { default as IdentifierResult } from './x-modules/identifier-results/components/identifier-result.vue.js';
|
|
227
228
|
export { default as IdentifierResults } from './x-modules/identifier-results/components/identifier-results.vue.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -37,7 +37,7 @@ import { BaseXAPI } from '../api/base-api.js';
|
|
|
37
37
|
* the Public API:
|
|
38
38
|
*
|
|
39
39
|
* ```
|
|
40
|
-
* window.
|
|
40
|
+
* window.InterfaceX.init(snippetConfig)
|
|
41
41
|
* ```
|
|
42
42
|
*
|
|
43
43
|
* 2.3 When the script of the project build is loaded it searches for a global `initX`
|
|
@@ -105,7 +105,7 @@ class XInstaller {
|
|
|
105
105
|
this.api = api ?? new BaseXAPI();
|
|
106
106
|
this.api.setInitCallback(this.init.bind(this));
|
|
107
107
|
this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));
|
|
108
|
-
window.
|
|
108
|
+
window.InterfaceX = this.api;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-installer.js","sources":["../../../../src/x-installer/x-installer/x-installer.ts"],"sourcesContent":["import { forEach } from '@empathyco/x-utils';\nimport Vue, { PluginObject, VueConstructor } from 'vue';\nimport { BaseXBus } from '../../plugins/x-bus';\nimport { XBus } from '../../plugins/x-bus.types';\nimport { XPlugin } from '../../plugins/x-plugin';\nimport { XPluginOptions } from '../../plugins/x-plugin.types';\nimport { SnippetConfig, XAPI } from '../api/api.types';\nimport { BaseXAPI } from '../api/base-api';\nimport { InitWrapper, InstallXOptions, VueConstructorPartialArgument } from './types';\n\ndeclare global {\n interface Window {\n X?: XAPI;\n initX?: (() => SnippetConfig) | SnippetConfig;\n }\n}\n\n/**\n * The purpose of this class is to offer a quick way to initialize the XComponents in a setup\n * project. It allows to receive all the options in {@link InstallXOptions} which is an extension\n * of {@link XPluginOptions} with all the options for the plugin and some options more.\n *\n * This class does multiple things:\n * 1. Install the {@link XPlugin} with the {@link XPluginOptions}.\n * 2. Creates the public {@link XAPI} and add it to global window.\n * 3. Creates the Vue Application for the customer project.\n *\n * The steps 2 & 3 are optional and depends on the options passed in {@link InstallXOptions}.\n *\n * @example The way to use this class is the next:\n * 1. Create the installer passing in the {@link InstallXOptions}. This only save the options:\n *\n * ```\n * const installer = new XInstaller(installXOptions)\n * ```\n *\n * 2. Initialize passing the {@link SnippetConfig}. This installs the plugin and creates the App.\n * There are 3 different ways to do this:\n *\n * 2.1 Using the created installer:\n *\n * ```\n * installer.init(snippetConfig)\n * ```\n *\n * 2.2 If the API option is enabled (`createAPI` is `true` in {@link InstallXOptions}, or\n * is not present as the default value is `true`) then this init step can be done with\n * the Public API:\n *\n * ```\n * window.X.init(snippetConfig)\n * ```\n *\n * 2.3 When the script of the project build is loaded it searches for a global `initX`\n * variable that the customer must have in their web site. This variable can be a\n * function that returns the {@link SnippetConfig} or an object that contains the\n * {@link SnippetConfig} itself:\n *\n * ```\n * window.initX = function() {\n * return {\n * instance,\n * env,\n * scope,\n * lang,\n * searchLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * };\n * ```\n *\n * ```\n * window.initX = {\n * instance,\n * env,\n * scope,\n * lang,\n * searchLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * ```\n *\n * @public\n */\nexport class XInstaller {\n private api?: XAPI;\n\n /**\n * The configuration coming from the snippet {@link SnippetConfig}.\n *\n * @internal\n */\n protected snippetConfig!: SnippetConfig;\n\n /**\n * Receives the {@link InstallXOptions} and merges it with the default fallback options. Also\n * creates the public {@link XAPI}.\n *\n * @remarks Auto initializes the Vue application if window.initX is defined as a function or\n * object specifying the {@link SnippetConfig | snippet config}.\n *\n *\n * @param options - The {@link InstallXOptions}.\n *\n * @public\n */\n public constructor(protected readonly options: InstallXOptions) {\n this.createAPI();\n }\n\n /**\n * Creates the public {@link XAPI} using the `api` option from {@link InstallXOptions}. If this\n * `api` option is not passed, then a default {@link BaseXAPI} is created. To disable the API\n * creation the value `false` must be passed in the `api` option.\n *\n * @internal\n */\n protected createAPI(): void {\n const { api } = this.options;\n if (api !== false) {\n this.api = api ?? new BaseXAPI();\n this.api.setInitCallback(this.init.bind(this));\n this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));\n window.X = this.api;\n }\n }\n\n /**\n * Retrieves the {@link SnippetConfig | snippet config} it is defined in the window.initX.\n *\n * @returns The snippet config if it is defined or undefined otherwise.\n *\n * @internal\n */\n private retrieveSnippetConfig(): SnippetConfig | undefined {\n if (typeof window.initX === 'function') {\n return window.initX();\n } else if (typeof window.initX === 'object') {\n return window.initX;\n }\n }\n\n /**\n * Receives the {@link SnippetConfig | snippet config} or retrieves it from window.initX and\n * installs the plugin and initializes the Vue application.\n *\n * @param snippetConfig - The {@link SnippetConfig} that receives from snippet integration.\n *\n * @returns If {@link SnippetConfig | snippet config} is passed or configured in window.initX,\n * returns an object with the {@link XAPI}, the {@link XBus}, the {@link XPlugin} and the Vue App\n * used in the application. Else, a rejected promise is returned.\n *\n * @public\n */\n init(snippetConfig: SnippetConfig): Promise<InitWrapper>;\n init(): Promise<InitWrapper | void>;\n async init(snippetConfig = this.retrieveSnippetConfig()): Promise<InitWrapper | void> {\n if (snippetConfig) {\n const bus = this.createBus();\n const pluginOptions = this.getPluginOptions();\n const plugin = this.installPlugin(pluginOptions, bus);\n const extraPlugins = await this.installExtraPlugins(snippetConfig, bus);\n const app = this.createApp(extraPlugins, snippetConfig);\n this.api?.setBus(bus);\n\n return {\n api: this.api,\n app,\n bus,\n plugin\n };\n }\n\n return Promise.resolve();\n }\n\n /**\n * Creates the {@link XPluginOptions} object.\n *\n * @returns The {@link XPluginOptions} object.\n *\n * @internal\n */\n protected getPluginOptions(): XPluginOptions {\n const { adapter, store, initialXModules, xModules, __PRIVATE__xModules } = this.options;\n return {\n adapter,\n store,\n xModules,\n initialXModules,\n __PRIVATE__xModules\n };\n }\n\n /**\n * This method returns the bus instance to be used in the {@link XPlugin} and in the {@link XAPI}.\n * It returns the `bus` parameter in the {@link InstallXOptions} or if not provided, then\n * creates a new instance of {@link BaseXBus}.\n *\n * @returns XBus - The bus instance.\n *\n * @internal\n */\n protected createBus(): XBus {\n return this.options.bus ?? new BaseXBus();\n }\n\n /**\n * This method returns the VueConstructor to use to create the App instance.\n * It returns the `vue` parameter in the {@link InstallXOptions} or if not provided, then\n * returns the default Vue.\n *\n * @remarks The purpose of this option is mainly the testing. In a test we can use this option\n * to pass the local vue instance created by `createLocalVue` method.\n *\n * @returns VueConstructor - The vue constructor to create the App instance.\n *\n * @internal\n */\n protected getVue(): VueConstructor {\n return this.options.vue ?? Vue;\n }\n\n /**\n * Creates and install the Vue Plugin. If `plugin` parameter is passed in the\n * {@link InstallXOptions}, then it is used. If not, then a new instance of {@link XPlugin} is\n * created and installed.\n *\n * @param pluginOptions - The {@link XPluginOptions} to passed as parameter to the install method\n * of the plugin.\n * @param bus - The {@link XBus} to be used to create the XPlugin.\n *\n * @returns PluginObject<XPluginOption> - The plugin instance.\n * @internal\n */\n protected installPlugin(pluginOptions: XPluginOptions, bus: XBus): PluginObject<XPluginOptions> {\n const plugin = this.options.plugin ?? new XPlugin(bus);\n const vue = this.getVue();\n vue.use(plugin, pluginOptions);\n return plugin;\n }\n\n /**\n * Install more plugins to Vue defined by the user.\n *\n * @param snippet - The snippet configuration.\n * @param bus - The events bus used in the application.\n * @returns The arguments from the plugins installation to be used in Vue's constructor.\n * @internal\n */\n protected installExtraPlugins(\n snippet: SnippetConfig,\n bus: XBus\n ): Promise<VueConstructorPartialArgument> {\n const vue = this.getVue();\n return Promise.resolve(this.options.installExtraPlugins?.({ vue, snippet, bus }));\n }\n\n /**\n * In the case that the `app` parameter is present in the {@link InstallXOptions}, then a new Vue\n * application is created using that app.\n *\n * @param extraPlugins - Vue plugins initialisation data.\n * @param snippetConfig - Configuration from the client snippet.\n * @returns The Created Vue application or undefined if not created.\n *\n * @internal\n */\n protected createApp(\n extraPlugins: VueConstructorPartialArgument,\n snippetConfig: SnippetConfig\n ): Vue | undefined {\n if (this.options.app !== undefined) {\n const vue = this.getVue();\n this.snippetConfig = vue.observable(snippetConfig);\n return new vue({\n ...extraPlugins,\n ...this.options.vueOptions,\n provide() {\n return {\n snippetConfig\n };\n },\n store: this.options.store,\n el: this.getMountingTarget(this.options.domElement),\n render: h => h(this.options.app)\n });\n }\n }\n\n /**\n * It returns the HTML element to mount the Vue Application. If the `domElement` parameter in the\n * {@link InstallXOptions} is an Element or a string, then it is used. If it is\n * not present then a new <div> Element is created and append to the body to be used.\n *\n * @param elementOrSelector - String or Element used to mount the Vue App.\n *\n * @returns The Element to use as mounting point for the Vue App.\n * @internal\n */\n protected getMountingTarget(elementOrSelector?: string | Element): Element {\n if (typeof elementOrSelector === 'string') {\n const target = document.querySelector(elementOrSelector);\n if (!target) {\n throw Error(\n `XComponents app couldn't be mounted: Element \"${elementOrSelector}\" couldn't be found`\n );\n }\n return target;\n } else if (elementOrSelector !== undefined) {\n return elementOrSelector;\n } else {\n return document.body.appendChild(document.createElement('div'));\n }\n }\n\n /**\n * It updates all the provided properties from the current snippet config.\n *\n * @param snippetConfig - All the properties to be updated in the {@link SnippetConfig}.\n *\n * @internal\n */\n protected updateSnippetConfig(snippetConfig: Partial<SnippetConfig>): void {\n forEach(snippetConfig, (name, value) => {\n this.getVue().set(this.snippetConfig, name, value);\n });\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuEa,UAAU;;;;;;;;;;;;;IAsBrB,YAAsC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;KAClB;;;;;;;;IASS,SAAS;QACjB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACvE,MAAM,CAAC,CAAC,GA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G,CAAC;aACjC,CAAC,CAAC;SACJ;KACF;;;;;;;;;;;IAYS,iBAAiB,CAAC,iBAAoC;QAC9D,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,KAAK,CACT,iDAAiD,iBAAiB,qBAAqB,CACxF,CAAC;aACH;YACD,OAAO,MAAM,CAAC;SACf;aAAM,IAAI,iBAAiB,KAAK,SAAS,EAAE;YAC1C,OAAO,iBAAiB,CAAC;SAC1B;aAAM;YACL,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;SACjE;KACF;;;;;;;;IASS,mBAAmB,CAAC,aAAqC;QACjE,OAAO,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,KAAK;YACjC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACpD,CAAC,CAAC;KACJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"x-installer.js","sources":["../../../../src/x-installer/x-installer/x-installer.ts"],"sourcesContent":["import { forEach } from '@empathyco/x-utils';\nimport Vue, { PluginObject, VueConstructor } from 'vue';\nimport { BaseXBus } from '../../plugins/x-bus';\nimport { XBus } from '../../plugins/x-bus.types';\nimport { XPlugin } from '../../plugins/x-plugin';\nimport { XPluginOptions } from '../../plugins/x-plugin.types';\nimport { SnippetConfig, XAPI } from '../api/api.types';\nimport { BaseXAPI } from '../api/base-api';\nimport { InitWrapper, InstallXOptions, VueConstructorPartialArgument } from './types';\n\ndeclare global {\n interface Window {\n InterfaceX?: XAPI;\n initX?: (() => SnippetConfig) | SnippetConfig;\n }\n}\n\n/**\n * The purpose of this class is to offer a quick way to initialize the XComponents in a setup\n * project. It allows to receive all the options in {@link InstallXOptions} which is an extension\n * of {@link XPluginOptions} with all the options for the plugin and some options more.\n *\n * This class does multiple things:\n * 1. Install the {@link XPlugin} with the {@link XPluginOptions}.\n * 2. Creates the public {@link XAPI} and add it to global window.\n * 3. Creates the Vue Application for the customer project.\n *\n * The steps 2 & 3 are optional and depends on the options passed in {@link InstallXOptions}.\n *\n * @example The way to use this class is the next:\n * 1. Create the installer passing in the {@link InstallXOptions}. This only save the options:\n *\n * ```\n * const installer = new XInstaller(installXOptions)\n * ```\n *\n * 2. Initialize passing the {@link SnippetConfig}. This installs the plugin and creates the App.\n * There are 3 different ways to do this:\n *\n * 2.1 Using the created installer:\n *\n * ```\n * installer.init(snippetConfig)\n * ```\n *\n * 2.2 If the API option is enabled (`createAPI` is `true` in {@link InstallXOptions}, or\n * is not present as the default value is `true`) then this init step can be done with\n * the Public API:\n *\n * ```\n * window.InterfaceX.init(snippetConfig)\n * ```\n *\n * 2.3 When the script of the project build is loaded it searches for a global `initX`\n * variable that the customer must have in their web site. This variable can be a\n * function that returns the {@link SnippetConfig} or an object that contains the\n * {@link SnippetConfig} itself:\n *\n * ```\n * window.initX = function() {\n * return {\n * instance,\n * env,\n * scope,\n * lang,\n * searchLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * };\n * ```\n *\n * ```\n * window.initX = {\n * instance,\n * env,\n * scope,\n * lang,\n * searchLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * ```\n *\n * @public\n */\nexport class XInstaller {\n private api?: XAPI;\n\n /**\n * The configuration coming from the snippet {@link SnippetConfig}.\n *\n * @internal\n */\n protected snippetConfig!: SnippetConfig;\n\n /**\n * Receives the {@link InstallXOptions} and merges it with the default fallback options. Also\n * creates the public {@link XAPI}.\n *\n * @remarks Auto initializes the Vue application if window.initX is defined as a function or\n * object specifying the {@link SnippetConfig | snippet config}.\n *\n *\n * @param options - The {@link InstallXOptions}.\n *\n * @public\n */\n public constructor(protected readonly options: InstallXOptions) {\n this.createAPI();\n }\n\n /**\n * Creates the public {@link XAPI} using the `api` option from {@link InstallXOptions}. If this\n * `api` option is not passed, then a default {@link BaseXAPI} is created. To disable the API\n * creation the value `false` must be passed in the `api` option.\n *\n * @internal\n */\n protected createAPI(): void {\n const { api } = this.options;\n if (api !== false) {\n this.api = api ?? new BaseXAPI();\n this.api.setInitCallback(this.init.bind(this));\n this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));\n window.InterfaceX = this.api;\n }\n }\n\n /**\n * Retrieves the {@link SnippetConfig | snippet config} it is defined in the window.initX.\n *\n * @returns The snippet config if it is defined or undefined otherwise.\n *\n * @internal\n */\n private retrieveSnippetConfig(): SnippetConfig | undefined {\n if (typeof window.initX === 'function') {\n return window.initX();\n } else if (typeof window.initX === 'object') {\n return window.initX;\n }\n }\n\n /**\n * Receives the {@link SnippetConfig | snippet config} or retrieves it from window.initX and\n * installs the plugin and initializes the Vue application.\n *\n * @param snippetConfig - The {@link SnippetConfig} that receives from snippet integration.\n *\n * @returns If {@link SnippetConfig | snippet config} is passed or configured in window.initX,\n * returns an object with the {@link XAPI}, the {@link XBus}, the {@link XPlugin} and the Vue App\n * used in the application. Else, a rejected promise is returned.\n *\n * @public\n */\n init(snippetConfig: SnippetConfig): Promise<InitWrapper>;\n init(): Promise<InitWrapper | void>;\n async init(snippetConfig = this.retrieveSnippetConfig()): Promise<InitWrapper | void> {\n if (snippetConfig) {\n const bus = this.createBus();\n const pluginOptions = this.getPluginOptions();\n const plugin = this.installPlugin(pluginOptions, bus);\n const extraPlugins = await this.installExtraPlugins(snippetConfig, bus);\n const app = this.createApp(extraPlugins, snippetConfig);\n this.api?.setBus(bus);\n\n return {\n api: this.api,\n app,\n bus,\n plugin\n };\n }\n\n return Promise.resolve();\n }\n\n /**\n * Creates the {@link XPluginOptions} object.\n *\n * @returns The {@link XPluginOptions} object.\n *\n * @internal\n */\n protected getPluginOptions(): XPluginOptions {\n const { adapter, store, initialXModules, xModules, __PRIVATE__xModules } = this.options;\n return {\n adapter,\n store,\n xModules,\n initialXModules,\n __PRIVATE__xModules\n };\n }\n\n /**\n * This method returns the bus instance to be used in the {@link XPlugin} and in the {@link XAPI}.\n * It returns the `bus` parameter in the {@link InstallXOptions} or if not provided, then\n * creates a new instance of {@link BaseXBus}.\n *\n * @returns XBus - The bus instance.\n *\n * @internal\n */\n protected createBus(): XBus {\n return this.options.bus ?? new BaseXBus();\n }\n\n /**\n * This method returns the VueConstructor to use to create the App instance.\n * It returns the `vue` parameter in the {@link InstallXOptions} or if not provided, then\n * returns the default Vue.\n *\n * @remarks The purpose of this option is mainly the testing. In a test we can use this option\n * to pass the local vue instance created by `createLocalVue` method.\n *\n * @returns VueConstructor - The vue constructor to create the App instance.\n *\n * @internal\n */\n protected getVue(): VueConstructor {\n return this.options.vue ?? Vue;\n }\n\n /**\n * Creates and install the Vue Plugin. If `plugin` parameter is passed in the\n * {@link InstallXOptions}, then it is used. If not, then a new instance of {@link XPlugin} is\n * created and installed.\n *\n * @param pluginOptions - The {@link XPluginOptions} to passed as parameter to the install method\n * of the plugin.\n * @param bus - The {@link XBus} to be used to create the XPlugin.\n *\n * @returns PluginObject<XPluginOption> - The plugin instance.\n * @internal\n */\n protected installPlugin(pluginOptions: XPluginOptions, bus: XBus): PluginObject<XPluginOptions> {\n const plugin = this.options.plugin ?? new XPlugin(bus);\n const vue = this.getVue();\n vue.use(plugin, pluginOptions);\n return plugin;\n }\n\n /**\n * Install more plugins to Vue defined by the user.\n *\n * @param snippet - The snippet configuration.\n * @param bus - The events bus used in the application.\n * @returns The arguments from the plugins installation to be used in Vue's constructor.\n * @internal\n */\n protected installExtraPlugins(\n snippet: SnippetConfig,\n bus: XBus\n ): Promise<VueConstructorPartialArgument> {\n const vue = this.getVue();\n return Promise.resolve(this.options.installExtraPlugins?.({ vue, snippet, bus }));\n }\n\n /**\n * In the case that the `app` parameter is present in the {@link InstallXOptions}, then a new Vue\n * application is created using that app.\n *\n * @param extraPlugins - Vue plugins initialisation data.\n * @param snippetConfig - Configuration from the client snippet.\n * @returns The Created Vue application or undefined if not created.\n *\n * @internal\n */\n protected createApp(\n extraPlugins: VueConstructorPartialArgument,\n snippetConfig: SnippetConfig\n ): Vue | undefined {\n if (this.options.app !== undefined) {\n const vue = this.getVue();\n this.snippetConfig = vue.observable(snippetConfig);\n return new vue({\n ...extraPlugins,\n ...this.options.vueOptions,\n provide() {\n return {\n snippetConfig\n };\n },\n store: this.options.store,\n el: this.getMountingTarget(this.options.domElement),\n render: h => h(this.options.app)\n });\n }\n }\n\n /**\n * It returns the HTML element to mount the Vue Application. If the `domElement` parameter in the\n * {@link InstallXOptions} is an Element or a string, then it is used. If it is\n * not present then a new <div> Element is created and append to the body to be used.\n *\n * @param elementOrSelector - String or Element used to mount the Vue App.\n *\n * @returns The Element to use as mounting point for the Vue App.\n * @internal\n */\n protected getMountingTarget(elementOrSelector?: string | Element): Element {\n if (typeof elementOrSelector === 'string') {\n const target = document.querySelector(elementOrSelector);\n if (!target) {\n throw Error(\n `XComponents app couldn't be mounted: Element \"${elementOrSelector}\" couldn't be found`\n );\n }\n return target;\n } else if (elementOrSelector !== undefined) {\n return elementOrSelector;\n } else {\n return document.body.appendChild(document.createElement('div'));\n }\n }\n\n /**\n * It updates all the provided properties from the current snippet config.\n *\n * @param snippetConfig - All the properties to be updated in the {@link SnippetConfig}.\n *\n * @internal\n */\n protected updateSnippetConfig(snippetConfig: Partial<SnippetConfig>): void {\n forEach(snippetConfig, (name, value) => {\n this.getVue().set(this.snippetConfig, name, value);\n });\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuEa,UAAU;;;;;;;;;;;;;IAsBrB,YAAsC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;KAClB;;;;;;;;IASS,SAAS;QACjB,MAAM,EAAE,GAAG,EAAE,GAAG,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,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,GAAG,CAAC;gBACb,GAAG,YAAY;gBACf,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU;gBAC1B,OAAO;oBACL,OAAO;wBACL,aAAa;qBACd,CAAC;iBACH;gBACD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;gBACnD,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;aACjC,CAAC,CAAC;SACJ;KACF;;;;;;;;;;;IAYS,iBAAiB,CAAC,iBAAoC;QAC9D,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,KAAK,CACT,iDAAiD,iBAAiB,qBAAqB,CACxF,CAAC;aACH;YACD,OAAO,MAAM,CAAC;SACf;aAAM,IAAI,iBAAiB,KAAK,SAAS,EAAE;YAC1C,OAAO,iBAAiB,CAAC;SAC1B;aAAM;YACL,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;SACjE;KACF;;;;;;;;IASS,mBAAmB,CAAC,aAAqC;QACjE,OAAO,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,KAAK;YACjC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACpD,CAAC,CAAC;KACJ;;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import script from './history-queries-switch.vue_rollup-plugin-vue_script.vue.js';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.mjs';
|
|
3
|
+
|
|
4
|
+
/* script */
|
|
5
|
+
const __vue_script__ = script;
|
|
6
|
+
|
|
7
|
+
/* template */
|
|
8
|
+
var __vue_render__ = function () {
|
|
9
|
+
var _vm = this;
|
|
10
|
+
var _h = _vm.$createElement;
|
|
11
|
+
var _c = _vm._self._c || _h;
|
|
12
|
+
return _c("BaseSwitch", {
|
|
13
|
+
attrs: { value: _vm.isEnabled },
|
|
14
|
+
on: { change: _vm.toggle },
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
var __vue_staticRenderFns__ = [];
|
|
18
|
+
__vue_render__._withStripped = true;
|
|
19
|
+
|
|
20
|
+
/* style */
|
|
21
|
+
const __vue_inject_styles__ = undefined;
|
|
22
|
+
/* scoped */
|
|
23
|
+
const __vue_scope_id__ = undefined;
|
|
24
|
+
/* module identifier */
|
|
25
|
+
const __vue_module_identifier__ = undefined;
|
|
26
|
+
/* functional template */
|
|
27
|
+
const __vue_is_functional_template__ = false;
|
|
28
|
+
/* style inject */
|
|
29
|
+
|
|
30
|
+
/* style inject SSR */
|
|
31
|
+
|
|
32
|
+
/* style inject shadow dom */
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
37
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
38
|
+
__vue_inject_styles__,
|
|
39
|
+
__vue_script__,
|
|
40
|
+
__vue_scope_id__,
|
|
41
|
+
__vue_is_functional_template__,
|
|
42
|
+
__vue_module_identifier__,
|
|
43
|
+
false,
|
|
44
|
+
undefined,
|
|
45
|
+
undefined,
|
|
46
|
+
undefined
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export { __vue_component__ as default };
|
|
50
|
+
//# sourceMappingURL=history-queries-switch.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-queries-switch.vue.js","sources":["../../../../../src/x-modules/history-queries/components/history-queries-switch.vue"],"sourcesContent":["<template>\n <BaseSwitch @change=\"toggle\" :value=\"isEnabled\" />\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component } from 'vue-property-decorator';\n import BaseSwitch from '../../../components/base-switch.vue';\n import { State } from '../../../components/decorators/store.decorators';\n import { xComponentMixin } from '../../../components/x-component.mixin';\n import { historyQueriesXModule } from '../x-module';\n\n /**\n * History Queries Switch is a component to enable or disable the history queries.\n * This component emits events depending on the `isEnabled` value.\n *\n * @public\n */\n @Component({\n mixins: [xComponentMixin(historyQueriesXModule)],\n components: { BaseSwitch }\n })\n export default class HistoryQueriesSwitch extends Vue {\n /**\n * A boolean with the isEnabled value coming from the store state.\n *\n * @internal\n */\n @State('historyQueries', 'isEnabled')\n public isEnabled!: boolean;\n\n /**\n * Emits an event based on the switch state.\n *\n * @internal\n */\n protected toggle(): void {\n this.$x.emit(\n this.isEnabled ? 'UserClickedDisableHistoryQueries' : 'UserClickedEnableHistoryQueries'\n );\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedEnableHistoryQueries`]\n (x-components.historyqueriesxevents.userclickedenablehistoryqueries.md): the event is emitted\n whenever the user clicks the switch and the history queries are disabled.\n- [`UserClickedDisableHistoryQueries`]\n (x-components.historyqueriesxevents.userclickeddisablehistoryqueries.md): the event is emitted\n whenever the user clicks the switch and the history queries are enabled.\n\n## See it in action\n\nHere you have a basic example of how the switch is rendered.\n\n_Try clicking it to see how it changes its state_\n\n```vue live\n<template>\n <HistoryQueriesSwitch />\n</template>\n\n<script>\n import { HistoryQueriesSwitch } from '@empathyco/x-components';\n\n export default {\n name: 'HistoryQueriesSwitchDemo',\n components: {\n HistoryQueriesSwitch\n }\n };\n</script>\n```\n\nHere you have a more complex example.\n\n```vue live\n<template>\n <div>\n <div>\n <SearchInput :instant=\"false\" />\n <SearchButton>Search</SearchButton>\n </div>\n <label>\n History queries:\n <HistoryQueriesSwitch />\n <HistoryQueries />\n <BaseEventsModal :eventsToOpenModal=\"eventsToOpenModal\">\n <BaseEventButton :events=\"disableEvents\">Disable</BaseEventButton>\n <BaseEventButton :events=\"cancelEvents\">Cancel</BaseEventButton>\n </BaseEventsModal>\n </label>\n </div>\n</template>\n\n<script>\n import { BaseEventButton, BaseEventsModal } from '@empathyco/x-components';\n import { HistoryQueriesSwitch, HistoryQueries } from '@empathyco/x-components/history-queries';\n import { SearchInput, SearchButton } from '@empathyco/x-components/search';\n export default {\n name: 'HistoryQueriesSwitchDemo',\n components: {\n BaseEventButton,\n BaseEventsModal,\n HistoryQueriesSwitch,\n HistoryQueries,\n SearchInput,\n SearchButton\n },\n data() {\n return {\n eventsToOpenModal: ['UserClickedDisableHistoryQueries'],\n disableEvents: {\n UserClickedConfirmDisableHistoryQueries: undefined,\n UserClickedCloseEventsModal: undefined\n },\n cancelEvents: {\n UserClickedCloseEventsModal: undefined\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
import { Component } from 'vue-property-decorator';
|
|
4
|
+
import __vue_component__ from '../../../components/base-switch.vue.js';
|
|
5
|
+
import { State } from '../../../components/decorators/store.decorators.js';
|
|
6
|
+
import { xComponentMixin } from '../../../components/x-component.mixin.js';
|
|
7
|
+
import { historyQueriesXModule } from '../x-module.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* History Queries Switch is a component to enable or disable the history queries.
|
|
11
|
+
* This component emits events depending on the `isEnabled` value.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
let HistoryQueriesSwitch = class HistoryQueriesSwitch extends Vue {
|
|
16
|
+
/**
|
|
17
|
+
* Emits an event based on the switch state.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
toggle() {
|
|
22
|
+
this.$x.emit(this.isEnabled ? 'UserClickedDisableHistoryQueries' : 'UserClickedEnableHistoryQueries');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
__decorate([
|
|
26
|
+
State('historyQueries', 'isEnabled')
|
|
27
|
+
], HistoryQueriesSwitch.prototype, "isEnabled", void 0);
|
|
28
|
+
HistoryQueriesSwitch = __decorate([
|
|
29
|
+
Component({
|
|
30
|
+
mixins: [xComponentMixin(historyQueriesXModule)],
|
|
31
|
+
components: { BaseSwitch: __vue_component__ }
|
|
32
|
+
})
|
|
33
|
+
], HistoryQueriesSwitch);
|
|
34
|
+
var script = HistoryQueriesSwitch;
|
|
35
|
+
|
|
36
|
+
export { script as default };
|
|
37
|
+
//# sourceMappingURL=history-queries-switch.vue_rollup-plugin-vue_script.vue.js.map
|