Skip to content

Commit

Permalink
Merge branch 'main' into feat/update-rollup-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
annacv authored Jan 2, 2024
2 parents 34e5917 + 8cce44c commit 65e95b3
Show file tree
Hide file tree
Showing 32 changed files with 696 additions and 266 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
token: ${{ github.token }}
commit-message: "chore(release): prepare stable release"
committer: Interface X <[email protected]>
title: Stable release
title: "chore(release): prepare stable release"
body: Release preparation
branch: release
delete-branch: true
8 changes: 8 additions & 0 deletions packages/x-adapter-platform/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.3-alpha.1](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-27)

**Note:** Version bump only for package @empathyco/x-adapter-platform





## [1.0.3-alpha.0](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-11-29)

**Note:** Version bump only for package @empathyco/x-adapter-platform
Expand Down
6 changes: 3 additions & 3 deletions packages/x-adapter-platform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-adapter-platform",
"version": "1.0.3-alpha.0",
"version": "1.0.3-alpha.1",
"description": "A search client for the Empathy Platform API",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -42,13 +42,13 @@
},
"dependencies": {
"@empathyco/x-adapter": "^8.0.3-alpha.0",
"@empathyco/x-types": "^10.0.3-alpha.0",
"@empathyco/x-types": "^10.0.3-alpha.1",
"@empathyco/x-utils": "^1.0.3-alpha.0",
"tslib": "~2.6.0"
},
"devDependencies": {
"@microsoft/api-documenter": "~7.23.0",
"@microsoft/api-extractor": "~7.38.0",
"@microsoft/api-extractor": "~7.39.0",
"@types/jest": "~27.5.0",
"concurrently": "~8.2.0",
"jest": "~27.5.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/x-archetype-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.3-alpha.1](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-27)

**Note:** Version bump only for package @empathyco/x-archetype-utils





## [1.0.3-alpha.0](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-11-29)

**Note:** Version bump only for package @empathyco/x-archetype-utils
Expand Down
4 changes: 2 additions & 2 deletions packages/x-archetype-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-archetype-utils",
"version": "1.0.3-alpha.0",
"version": "1.0.3-alpha.1",
"description": "Utilities for x-archetype",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@types/jest": "~27.5.0",
"@types/node": "~18.18.0",
"@types/node": "~18.19.0",
"@vue/test-utils": "~1.0.3",
"jest": "~27.5.0",
"rimraf": "~3.0.2",
Expand Down
43 changes: 43 additions & 0 deletions packages/x-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.1.0-alpha.4](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-29)


### Features

* **x-plugin:** add snippet config getter to XAPI (#1378) ([a76e1b7](https://github.com/empathyco/x/commit/a76e1b716b9aa86fc6853bcf4d1bb7aaa9478f4a))



## [4.1.0-alpha.3](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-29)


### Documentation

* optimize images for SEO (#1379) ([b115a08](https://github.com/empathyco/x/commit/b115a08caa450447f0515532c3d9c9fd1125a1a4))



## [4.1.0-alpha.2](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-28)

**Note:** Version bump only for package @empathyco/x-components





## [4.1.0-alpha.1](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-27)

**Note:** Version bump only for package @empathyco/x-components





## [4.1.0-alpha.0](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-12-11)


### Features

* **query-preview:** use cached query-previews (#1360) ([2579ca4](https://github.com/empathyco/x/commit/2579ca42d52c6f6c428b9129d63dc4a0ddb4788c))



## [4.0.2-alpha.0](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2023-11-29)

**Note:** Version bump only for package @empathyco/x-components
Expand Down
18 changes: 9 additions & 9 deletions packages/x-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-components",
"version": "4.0.2-alpha.0",
"version": "4.1.0-alpha.4",
"description": "Empathy X Components",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -70,15 +70,15 @@
},
"dependencies": {
"@empathyco/x-adapter": "^8.0.3-alpha.0",
"@empathyco/x-adapter-platform": "^1.0.3-alpha.0",
"@empathyco/x-adapter-platform": "^1.0.3-alpha.1",
"@empathyco/x-bus": "^1.0.3-alpha.0",
"@empathyco/x-deep-merge": "^2.0.3-alpha.0",
"@empathyco/x-logger": "^1.2.0-alpha.11",
"@empathyco/x-storage-service": "^2.0.3-alpha.0",
"@empathyco/x-types": "^10.0.3-alpha.0",
"@empathyco/x-types": "^10.0.3-alpha.1",
"@empathyco/x-utils": "^1.0.3-alpha.0",
"@vue/devtools-api": "~6.5.0",
"@vueuse/core": "~10.6.0",
"@vueuse/core": "~10.7.1",
"rxjs": "~7.8.0",
"tslib": "~2.6.0",
"vue-class-component": "~7.2.6",
Expand All @@ -94,23 +94,23 @@
"@badeball/cypress-cucumber-preprocessor": "~17.2.0",
"@bahmutov/cypress-esbuild-preprocessor": "~2.2.0",
"@cypress/vue2": "~2.0.1",
"@empathyco/x-tailwindcss": "^1.1.2-alpha.0",
"@empathyco/x-tailwindcss": "^1.1.2-alpha.1",
"@microsoft/api-documenter": "~7.23.0",
"@microsoft/api-extractor": "~7.38.0",
"@microsoft/api-extractor": "~7.39.0",
"@rollup/plugin-commonjs": "~25.0.7",
"@testing-library/jest-dom": "~5.17.0",
"@types/autoprefixer": "~10.2.0",
"@types/glob": "^8.0.1",
"@types/jest": "~27.5.0",
"@types/node": "~18.18.0",
"@types/node": "~18.19.0",
"@types/testing-library__jest-dom": "~5.14.5",
"@vitejs/plugin-vue2": "^2.2.0",
"@vue/test-utils": "~1.0.3",
"@vue/vue2-jest": "~27.0.0-alpha.3",
"autoprefixer": "~10.4.4",
"convert-source-map": "~2.0.0",
"cypress": "~13.6.0",
"esbuild": "0.19.7",
"esbuild": "0.19.10",
"glob": "~10.3.0",
"jest": "~27.5.0",
"jest-scss-transform": "~1.0.1",
Expand All @@ -126,7 +126,7 @@
"rollup-plugin-vue": "~5.1.9",
"sass": "~1.69.0",
"start-server-and-test": "~2.0.0",
"tailwindcss": "~3.3.0",
"tailwindcss": "~3.4.0",
"ts-jest": "~27.1.0",
"ts-node": "~10.9.1",
"typescript": "~4.9.4",
Expand Down
1 change: 1 addition & 0 deletions packages/x-components/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
:queriesPreviewInfo="queriesPreviewInfo"
#default="{ queryPreviewInfo, totalResults, results }"
data-test="brand-recommendation"
:persistInCache="true"
>
<div class="x-flex x-flex-col x-gap-8 x-mb-16">
<QueryPreviewButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLocalVue } from '@vue/test-utils';
import { XComponentsAdapterDummy } from '../../../__tests__/adapter.dummy';
import { XInstaller } from '../../x-installer/x-installer';
import { SnippetConfig } from '../api.types';
import { NormalisedSnippetConfig, SnippetConfig } from '../api.types';
import { BaseXAPI } from '../base-api';
import { XDummyBus } from '../../../__tests__/bus.dummy';

Expand Down Expand Up @@ -104,4 +104,18 @@ describe('testing default X API', () => {
await vue.nextTick();
expect(storeElement).toHaveTextContent('Portugal');
});

it('should allow set the snippetConfig getter', () => {
const snippetConfig: NormalisedSnippetConfig = {
instance: 'test',
scope: 'test',
lang: 'es',
uiLang: 'es'
};
defaultXAPI?.setSnippetConfigGetter(() => snippetConfig);

const snippet = defaultXAPI?.getSnippetConfig();

expect(snippet).toEqual(snippetConfig);
});
});
19 changes: 19 additions & 0 deletions packages/x-components/src/x-installer/api/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export interface XAPI {
* getting the previously stored result information.
*/
addProductToCart(productId?: string): void;

/**
* To get the snippet config object.
*
* @returns The {@link NormalisedSnippetConfig | snippetConfig} object.
*
* @public
*/
getSnippetConfig(): SnippetConfig;

/**
* To set the {@link @empathyco/x-bus#XBus | bus} to the API. This bus will be used to emit
* the necessary events.
Expand Down Expand Up @@ -48,6 +58,15 @@ export interface XAPI {
*/
setSnippetConfig(config: Partial<SnippetConfig>): void;

/**
* To set or update any property of the snippet config getter.
*
* @param snippetConfigGetter - A function that returns the snippet config object.
*
* @internal
*/
setSnippetConfigGetter(snippetConfigGetter: () => NormalisedSnippetConfig): void;

/**
* To set the snippet config callback.
*
Expand Down
22 changes: 21 additions & 1 deletion packages/x-components/src/x-installer/api/base-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { XBus } from '@empathyco/x-bus';
import { WireMetadata, XEventsTypes } from '../../wiring/index';
import { SnippetConfig, XAPI } from './api.types';
import { NormalisedSnippetConfig, SnippetConfig, XAPI } from './api.types';

/**
* Default implementation for {@link XAPI}.
Expand Down Expand Up @@ -30,6 +30,15 @@ export class BaseXAPI implements XAPI {
*/
protected initCallback!: (config: SnippetConfig) => any;

/**
* Getter for the snippet config object.
*
* @returns The {@link NormalisedSnippetConfig | snippetConfig} object.
*
* @public
*/
public getSnippetConfig!: () => SnippetConfig;

/**
* Callback that allows to update the snippet config. The logic of initialization is out of this
* API since this API is just a facade.
Expand Down Expand Up @@ -78,6 +87,17 @@ export class BaseXAPI implements XAPI {
this.snippetCallback = snippetCallback;
}

/**
* Sets or updates the snippet config getter.
*
* @param snippetConfigGetter - A function that returns the snippet config.
*
* @internal
*/
setSnippetConfigGetter(snippetConfigGetter: () => NormalisedSnippetConfig): void {
this.getSnippetConfig = snippetConfigGetter;
}

/**
* Sets or updates the snippet config.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ describe('testing `XInstaller` utility', () => {
expect(app?.$el).toHaveTextContent('test-2');
});

it('should set the snippetConfig getter', async () => {
const vue = createLocalVue();
window.initX = getMinimumSnippetConfig();
await new XInstaller({
adapter,
vue,
app: createSnippetConfigComponent()
}).init();
const snippetConfig = window.InterfaceX?.getSnippetConfig();
expect(snippetConfig).toEqual({
instance: 'test',
lang: 'test',
scope: 'test',
uiLang: 'test'
});
});

// eslint-disable-next-line max-len
it('initializes the app when window.initX is a function retrieving the snippet config', async () => {
const vue = createLocalVue();
Expand Down
12 changes: 12 additions & 0 deletions packages/x-components/src/x-installer/x-installer/x-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class XInstaller {
this.api = api ?? new BaseXAPI();
this.api.setInitCallback(this.init.bind(this));
this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));
this.api.setSnippetConfigGetter(this.getSnippetConfig.bind(this));
window.InterfaceX = this.api;
}
}
Expand Down Expand Up @@ -355,4 +356,15 @@ export class XInstaller {
this.getVue().set(this.snippetConfig!, name, value);
});
}

/**
* Getter for the snippet config object.
*
* @returns The {@link NormalisedSnippetConfig | snippetConfig} object.
*
* @public
*/
protected getSnippetConfig(): NormalisedSnippetConfig {
return this.snippetConfig!;
}
}
Loading

0 comments on commit 65e95b3

Please sign in to comment.