@empathyco/x-components 3.0.0-alpha.102 → 3.0.0-alpha.103
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 +13 -0
- package/design-system/full-theme.css +4 -4
- package/docs/build-search-ui/README.md +8 -8
- package/docs/build-search-ui/web-archetype-development-guide.md +8 -7
- package/docs/build-search-ui/web-archetype-integration-guide.md +25 -19
- package/docs/build-search-ui/web-how-to-use-x-components-guide.md +4 -4
- package/docs/build-search-ui/web-x-components-development-guide.md +6 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.103](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.102...@empathyco/x-components@3.0.0-alpha.103) (2022-05-25)
|
|
7
|
+
|
|
8
|
+
### Documentation
|
|
9
|
+
|
|
10
|
+
- fix links and minor typos
|
|
11
|
+
([e0197d5](https://github.com/empathyco/x/commit/e0197d5bff978048aed39dff5878d60682b7aa9f)),
|
|
12
|
+
closes [EX-6125](https://searchbroker.atlassian.net/browse/EX-6125)
|
|
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
|
+
|
|
6
19
|
## [3.0.0-alpha.102](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.101...@empathyco/x-components@3.0.0-alpha.102) (2022-05-19)
|
|
7
20
|
|
|
8
21
|
### Features
|
|
@@ -3211,10 +3211,6 @@
|
|
|
3211
3211
|
border-radius: var(--x-size-border-radius-progress-bar-default);
|
|
3212
3212
|
background-color: var(--x-color-background-progress-bar-line-default);
|
|
3213
3213
|
}
|
|
3214
|
-
.x-result.x-result--card {
|
|
3215
|
-
overflow: hidden;
|
|
3216
|
-
--x-size-border-radius-result-default: var(--x-size-border-radius-result-card);
|
|
3217
|
-
}
|
|
3218
3214
|
:root {
|
|
3219
3215
|
--x-size-height-progress-bar-line-default: var(--x-size-base-02);
|
|
3220
3216
|
--x-size-width-progress-bar-line-default: var(--x-size-base-20);
|
|
@@ -3224,6 +3220,10 @@
|
|
|
3224
3220
|
--x-size-border-radius-progress-bar-default: var(--x-size-border-radius-base-pill);
|
|
3225
3221
|
--x-size-border-width-progress-bar-default: 0;
|
|
3226
3222
|
}
|
|
3223
|
+
.x-result.x-result--card {
|
|
3224
|
+
overflow: hidden;
|
|
3225
|
+
--x-size-border-radius-result-default: var(--x-size-border-radius-result-card);
|
|
3226
|
+
}
|
|
3227
3227
|
:root {
|
|
3228
3228
|
--x-size-border-radius-result-card: var(--x-size-border-radius-base-s);
|
|
3229
3229
|
}
|
|
@@ -26,10 +26,10 @@ Start building your search and discovery experience:
|
|
|
26
26
|
|
|
27
27
|
- **Discover the [Interface X ecosystem](#the-interface-x-ecosystem)** and how Interface X
|
|
28
28
|
works.
|
|
29
|
-
- **[Develop using Interface X](#
|
|
30
|
-
- **[Integrate the Interface X Archetype](#
|
|
29
|
+
- **[Develop using Interface X](#developing-with-interface-x)** inside your project.
|
|
30
|
+
- **[Integrate the Interface X Archetype](#integrating-interface-x-archetype)** in your store web
|
|
31
31
|
application.
|
|
32
|
-
- **[Use and configure the Interface X Components](#
|
|
32
|
+
- **[Use and configure the Interface X Components](#using-and-configuring-the-interface-x-components)**
|
|
33
33
|
in your project.
|
|
34
34
|
|
|
35
35
|
<!-- 3. Style your UI. 4. Translate your search experience-->
|
|
@@ -47,7 +47,7 @@ Check out the **[open source project in GitHub](https://github.com/empathyco/x)*
|
|
|
47
47
|
Interested in learning more about how Interface X works? Discover more about its
|
|
48
48
|
**[architecture](web-x-architecture.md)**.
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Developing with Interface X
|
|
51
51
|
|
|
52
52
|
You can use the Interface X in a project in two ways:
|
|
53
53
|
|
|
@@ -62,7 +62,7 @@ You can use Empathy Search API, Elasticsearch, or Solr endpoints with both appro
|
|
|
62
62
|
|
|
63
63
|
:::
|
|
64
64
|
|
|
65
|
-
#####
|
|
65
|
+
##### Developing via Interface X Archetype
|
|
66
66
|
|
|
67
67
|
The **[Interface X Archetype](https://github.com/empathyco/x-archetype)** project is the
|
|
68
68
|
perfect combination of all the existing X Components. It allows you to ramp up quickly with an
|
|
@@ -80,7 +80,7 @@ This is the perfect solution for most cases as you can use it as a springboard t
|
|
|
80
80
|
To start developing the X Archetype project, see
|
|
81
81
|
**[Develop using Interface X Archetype](web-archetype-development-guide.md)**.
|
|
82
82
|
|
|
83
|
-
#####
|
|
83
|
+
##### Developing via Interface X Components library
|
|
84
84
|
|
|
85
85
|
This is the more deep and flexible use of the
|
|
86
86
|
**[Interface X Components library](https://github.com/empathyco/x/tree/main/packages/x-components)**,
|
|
@@ -96,7 +96,7 @@ go if you like to look under the hood.
|
|
|
96
96
|
To get started with the X Components library, check out
|
|
97
97
|
**[Develop using Interface X Components library](web-x-components-development-guide.md)**.
|
|
98
98
|
|
|
99
|
-
##
|
|
99
|
+
## Integrating Interface X Archetype
|
|
100
100
|
|
|
101
101
|
With the **[Interface X Archetype](https://github.com/empathyco/x-archetype)** you have an
|
|
102
102
|
isolated search layer up and running in your store web application in a matter of minutes.
|
|
@@ -108,7 +108,7 @@ Check out
|
|
|
108
108
|
**[Integrate InterfaceX Archetype into an existing website](web-archetype-integration-guide.md)**,
|
|
109
109
|
to integrate the X Archetype project.
|
|
110
110
|
|
|
111
|
-
##
|
|
111
|
+
## Using and configuring the Interface X Components
|
|
112
112
|
|
|
113
113
|
To use the Interface X Components, just **import** and **register** the component,
|
|
114
114
|
**include** it in your template, and you’re ready to go.
|
|
@@ -35,7 +35,7 @@ To use Interface X Archetype as a search UI layer, you need:
|
|
|
35
35
|
3. Configure the **search adapter**.
|
|
36
36
|
4. Configure the **xPlugin**.
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Cloning the project and initializing your repository
|
|
39
39
|
|
|
40
40
|
Clone the [X Archetype project](https://github.com/empathyco/x-archetype.git) from the GitHub
|
|
41
41
|
repository to your target folder. You need a non-initialized repository, so make sure you remove the
|
|
@@ -79,7 +79,7 @@ repository in the `package.json` file.
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
##
|
|
82
|
+
## Installing the dependencies and executing the project
|
|
83
83
|
|
|
84
84
|
Install the project dependencies via `npm` in the root folder of your cloned repository. Then, you
|
|
85
85
|
can run the project.
|
|
@@ -100,7 +100,7 @@ Interface X Archetype repository.
|
|
|
100
100
|
|
|
101
101
|
:::
|
|
102
102
|
|
|
103
|
-
##
|
|
103
|
+
## Configuring the search adapter
|
|
104
104
|
|
|
105
105
|
Before using your project, configure the Empathy Search Adapter in the
|
|
106
106
|
`x-archetype/src/adapter/adapter.ts` file, using the Empathy Adapter Builder to make it work with
|
|
@@ -109,7 +109,7 @@ configurations, or mappers that points to a demo environment. You need to adjust
|
|
|
109
109
|
according to the search features you use in your project.
|
|
110
110
|
|
|
111
111
|
Export the required search adapter with your configuration as you will need it for the search
|
|
112
|
-
[xPlugin configuration](#
|
|
112
|
+
[xPlugin configuration](#configuring-the-plugin).
|
|
113
113
|
|
|
114
114
|
::: interact
|
|
115
115
|
|
|
@@ -132,11 +132,11 @@ are displayed in English. However, if you want to deploy the application in Spai
|
|
|
132
132
|
</br>
|
|
133
133
|
|
|
134
134
|
For detailed information, see
|
|
135
|
-
[Snippet configuration](web-archetype-integration-guide.md#snippet-configuration)
|
|
135
|
+
[Snippet configuration](web-archetype-integration-guide.md#snippet-configuration).
|
|
136
136
|
|
|
137
137
|
:::
|
|
138
138
|
|
|
139
|
-
##
|
|
139
|
+
## Configuring the plugin
|
|
140
140
|
|
|
141
141
|
The `xPlugin` initializes the properties needed by the X Components. It has key options that
|
|
142
142
|
you can configure in the `/x-archetype/src/x-components/plugin.options.ts` file.
|
|
@@ -173,7 +173,8 @@ new XInstaller(installXOptions).init({
|
|
|
173
173
|
Once you have your Interface X Archetype project, you're ready to **integrate** it in your
|
|
174
174
|
store or **extend** the search and discovery experience to meet your business needs:
|
|
175
175
|
|
|
176
|
-
- [**Integrate an Interface X Archetype project**
|
|
176
|
+
- [**Integrate an Interface X Archetype project**](web-archetype-integration-guide.md)
|
|
177
|
+
into an existing website.
|
|
177
178
|
- Change the **configuration of [X Components](web-how-to-use-x-components-guide.md)** or
|
|
178
179
|
create new ones.
|
|
179
180
|
- Adapt the
|
|
@@ -19,11 +19,13 @@ meet your business needs.
|
|
|
19
19
|
To integrate the Interface X Archetype layer in your commerce store, just **load** the
|
|
20
20
|
generated Interface X JavaScript file and **initialize** it.
|
|
21
21
|
|
|
22
|
-
::: note IMPORTANT
|
|
23
|
-
provided by a CDN through the following environment URLs:
|
|
22
|
+
::: note IMPORTANT
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
If the X Archetype script is hosted by Empathy, all the X resources are provided by a CDN
|
|
25
|
+
through the following environment URLs:
|
|
26
|
+
|
|
27
|
+
- **Production**: `https://x.empathy.co/{INSTANCE}/app.js`
|
|
28
|
+
- **Staging**: `https://x.staging.empathy.co/{INSTANCE}/app.js`
|
|
27
29
|
|
|
28
30
|
Where `{INSTANCE}` is the name of your commerce store. If you require any assistance, contact
|
|
29
31
|
[Empathy Support](mailto:support@empathy.co).
|
|
@@ -32,8 +34,8 @@ Where `{INSTANCE}` is the name of your commerce store. If you require any assist
|
|
|
32
34
|
|
|
33
35
|
Depending on your business needs, Interface X supports two initialization types:
|
|
34
36
|
|
|
35
|
-
- **[Automatic initialization](#initializing-interface-x-project-automatically)**
|
|
36
|
-
- **[On-demand initialization](#initializing-interface-x-project-on-demand)**
|
|
37
|
+
- **[Automatic initialization](#initializing-the-interface-x-project-automatically)**
|
|
38
|
+
- **[On-demand initialization](#initializing-the-interface-x-project-on-demand)**
|
|
37
39
|
|
|
38
40
|
::: develop Frameworks & libraries integration
|
|
39
41
|
|
|
@@ -43,16 +45,18 @@ for a correct implementation.
|
|
|
43
45
|
|
|
44
46
|
:::
|
|
45
47
|
|
|
46
|
-
## Initializing Interface X project automatically
|
|
48
|
+
## Initializing the Interface X project automatically
|
|
47
49
|
|
|
48
50
|
Automatic initialization is the easiest way to integrate the Interface X project in a website.
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
**Steps to initialize the project automatically**
|
|
53
|
+
|
|
54
|
+
1. **Configure the JavaScript snippet** to define either an initialization object or a function.
|
|
55
|
+
2. **Load and initialize** the Interface X script.
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
#### Configuring the snippet
|
|
54
58
|
|
|
55
|
-
First,
|
|
59
|
+
First, add the JavaScript snippet configuration to define multiple initialization options, i.e. the API to
|
|
56
60
|
use, the language or currency to display, or even the tagging parameters to collect search-related
|
|
57
61
|
data to generate conversational search features and analytics.
|
|
58
62
|
|
|
@@ -97,7 +101,7 @@ more information on the supported parameters, check out
|
|
|
97
101
|
|
|
98
102
|
:::
|
|
99
103
|
|
|
100
|
-
|
|
104
|
+
#### Loading the script
|
|
101
105
|
|
|
102
106
|
Once the snippet configuration is ready, add the Interface X script to your webpage. The script
|
|
103
107
|
is hosted in a URL with the following syntax:
|
|
@@ -140,14 +144,16 @@ attribute `src` so that it points to the staging environment as follows:
|
|
|
140
144
|
Thus, when the Interface X JavaScript file is loaded, it retrieves the configuration from the
|
|
141
145
|
defined object or function.
|
|
142
146
|
|
|
143
|
-
## Initializing Interface X project on demand
|
|
147
|
+
## Initializing the Interface X project on demand
|
|
144
148
|
|
|
145
149
|
On-demand initialization allows you to control when Interface X is loaded.
|
|
146
150
|
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
**Steps to initialize the project on demand**
|
|
152
|
+
|
|
153
|
+
1. **Load** the Interface X script.
|
|
154
|
+
2. **Initialize** Interface X.
|
|
149
155
|
|
|
150
|
-
|
|
156
|
+
#### Loading the script
|
|
151
157
|
|
|
152
158
|
Add the Interface X script hosted in a URL with the following syntax:
|
|
153
159
|
`https://x.<environment?>.empathy.co/<instance>/app.js`.
|
|
@@ -166,9 +172,9 @@ attribute `src` so that it points to the staging environment as follows:
|
|
|
166
172
|
<script src="https://x.staging.empathy.co/my-store/app.js"></script>
|
|
167
173
|
```
|
|
168
174
|
|
|
169
|
-
|
|
175
|
+
#### Initializing Interface X
|
|
170
176
|
|
|
171
|
-
Since no initialization configuration
|
|
177
|
+
Since no initialization configuration is defined when loading the script, you need to **invoke the
|
|
172
178
|
initialization function** created automatically in the
|
|
173
179
|
[X API](https://github.com/empathyco/x/blob/main/packages/x-components/src/x-installer/api/base-api.ts)
|
|
174
180
|
object to provide the initialization options:
|
|
@@ -232,7 +238,7 @@ following configuration options:
|
|
|
232
238
|
|
|
233
239
|
::: note Consent parameter
|
|
234
240
|
|
|
235
|
-
When the `
|
|
241
|
+
When the `consent` parameter is set to `false`, the `sessionId` is not generated nor sent to the
|
|
236
242
|
Tagging API. Only shoppers' behavioral data (wisdom of the crowd) is inferred from the current
|
|
237
243
|
session. The `consent` parameter is set to `true` as soon as the shopper accepts the use of cookies.
|
|
238
244
|
If page reload is not triggered after accepting cookies, update the `consent` parameter
|
|
@@ -24,7 +24,7 @@ you’re ready to use X Components in your project.
|
|
|
24
24
|
|
|
25
25
|
2. **Configure the X Components behavior** to customize the search and discovery experience.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Importing and registering the X Components
|
|
28
28
|
|
|
29
29
|
Many of the X Components are distributed into modules to make them easier to manage. So you
|
|
30
30
|
need to indicate from which module you’re importing each component as appropriate.
|
|
@@ -56,7 +56,7 @@ export default {
|
|
|
56
56
|
//The components are now ready to be used inside your template.
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Configuring the X Components
|
|
60
60
|
|
|
61
61
|
You can configure some behaviors for each component to customize the search experience.
|
|
62
62
|
|
|
@@ -115,7 +115,7 @@ Learn more about the
|
|
|
115
115
|
|
|
116
116
|
:::
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
**1. Importing the components from the search-box module**
|
|
119
119
|
|
|
120
120
|
For this purpose, you need to import the `SearchInput`, `SearchButton`, and `ClearSearchInput`
|
|
121
121
|
components from the `search-box` module to the desired app component. Then, register them and
|
|
@@ -147,7 +147,7 @@ Now, you’re ready to start using the component wherever you want in your templ
|
|
|
147
147
|
</template>
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
**2. Configuring the SearchInput component**
|
|
151
151
|
|
|
152
152
|
Next, you want to configure the behavior of the `SearchInput` component. Here you use the
|
|
153
153
|
`maxLength` prop to limit the maximum length to 20 characters.
|
|
@@ -32,8 +32,6 @@ You can find the X Components library in the
|
|
|
32
32
|
|
|
33
33
|
To integrate the X Components in a frontend UI, you need:
|
|
34
34
|
|
|
35
|
-
<br/>
|
|
36
|
-
|
|
37
35
|
- **Empathy Search API** to retrieve search data (or any other search API)
|
|
38
36
|
- A **search adapter** to communicate with the search API. You can use the Empathy Adapter and
|
|
39
37
|
configure it with the `EmpathyAdapterBuilder`
|
|
@@ -49,7 +47,7 @@ To integrate the X Components in a frontend UI, you need:
|
|
|
49
47
|
3. Configure the **xPlugin**.
|
|
50
48
|
4. Install and **initialize the xPlugin**.
|
|
51
49
|
|
|
52
|
-
##
|
|
50
|
+
## Installing the dependencies
|
|
53
51
|
|
|
54
52
|
To build your search and discovery UI, the following project dependencies are required:
|
|
55
53
|
|
|
@@ -78,7 +76,7 @@ Install the project dependencies via `npm` as follows:
|
|
|
78
76
|
npm install --save @empathyco/x-components @empathyco/x-types @empathyco/x-adapter reflect-metadata
|
|
79
77
|
```
|
|
80
78
|
|
|
81
|
-
##
|
|
79
|
+
## Configuring the search adapter
|
|
82
80
|
|
|
83
81
|
::: warning
|
|
84
82
|
|
|
@@ -88,7 +86,7 @@ have imported the `reflect-metadata` polyfill before executing any code of the s
|
|
|
88
86
|
:::
|
|
89
87
|
|
|
90
88
|
Next, construct the search adapter. You will need the search adapter in the
|
|
91
|
-
[xPlugin configuration](#
|
|
89
|
+
[xPlugin configuration](#configuring-the-plugin).
|
|
92
90
|
|
|
93
91
|
Empathy Search Adapter is a library for making it easier to consume search APIs. The project
|
|
94
92
|
contains two main parts: an **implementation** to consume the Empathy Search API, and an
|
|
@@ -121,7 +119,7 @@ If you do not use the Empathy Search API, you need to build your own adapter.
|
|
|
121
119
|
For more information, see
|
|
122
120
|
[Using the Empathy Search Adapter](https://github.com/empathyco/x/tree/main/packages/search-adapter).
|
|
123
121
|
|
|
124
|
-
##
|
|
122
|
+
## Configuring the plugin
|
|
125
123
|
|
|
126
124
|
Plugins are self-contained code that usually add global-level functionality to Vue projects. They’re
|
|
127
125
|
specifically objects that expose an `install` method, allowing you to keep your components clear and
|
|
@@ -143,7 +141,7 @@ Then, **configure** the xPlugin. It has two key options you need to configure:
|
|
|
143
141
|
1. **Adapter**: A search adapter is required to connect and communicate with the search API. Here
|
|
144
142
|
you’re using the `EmpathyAdapterBuilder` to communicate specifically with the Empathy Search API.
|
|
145
143
|
If you are not using the Empathy Search API, you need to build your own adapter. See
|
|
146
|
-
[
|
|
144
|
+
[Configuring the search adapter](#configuring-the-search-adapter).
|
|
147
145
|
|
|
148
146
|
::: develop
|
|
149
147
|
|
|
@@ -162,7 +160,7 @@ Then, **configure** the xPlugin. It has two key options you need to configure:
|
|
|
162
160
|
|
|
163
161
|
:::
|
|
164
162
|
|
|
165
|
-
##
|
|
163
|
+
## Installing and initializing the plugin
|
|
166
164
|
|
|
167
165
|
Finally, the last step is to install and initialize the xPlugin. You need to do this in the
|
|
168
166
|
`main.ts` or `main.js file` of the project.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.103",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"access": "public",
|
|
126
126
|
"directory": "dist"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "ebf432d98e58e51b0a1eec708b1d1a78e13f0bb6"
|
|
129
129
|
}
|