Skip to content

Commit

Permalink
Release v0.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
compose-sdk-release-bot committed Aug 5, 2023
1 parent baddc16 commit 65da31e
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 614 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.7.3",
"version": "0.7.4",
"license": "SEE LICENSE IN LICENSE.md",
"private": true,
"workspaces": [
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sisense/sdk-cli",
"description": "CLI for generating programmatic interface from Sisense data model",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": "./dist/index.js",
"main": "./dist/index.js",
Expand All @@ -10,11 +10,11 @@
"license": "SEE LICENSE IN LICENSE.md",
"bin": "./dist/index.js",
"dependencies": {
"@sisense/sdk-common": "^0.7.3",
"@sisense/sdk-data": "^0.7.3",
"@sisense/sdk-modeling": "^0.7.3",
"@sisense/sdk-query-client": "^0.7.3",
"@sisense/sdk-rest-client": "^0.7.3",
"@sisense/sdk-common": "^0.7.4",
"@sisense/sdk-data": "^0.7.4",
"@sisense/sdk-modeling": "^0.7.4",
"@sisense/sdk-query-client": "^0.7.4",
"@sisense/sdk-rest-client": "^0.7.4",
"cross-fetch": "^4.0.0",
"inquirer": "^8.1.2",
"yargs": "17.7.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-common",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": {
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-common/src/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const trackProductEvent = async (
// for some reason, this endpoint returns an empty text response on
// success. Swallow this error since (so far) this is the only endpoint
// that behaves like this.
if (e instanceof SyntaxError && e.message === 'Unexpected end of JSON input') {
if (e instanceof Error && e.message.includes('Unexpected end of JSON input')) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-data",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": {
".": "./dist/index.js",
Expand All @@ -12,7 +12,7 @@
"author": "Sisense ",
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
"@sisense/sdk-rest-client": "^0.7.3",
"@sisense/sdk-rest-client": "^0.7.4",
"guid-typescript": "^1.0.9",
"numeral": "^2.0.6"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-modeling/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-modeling",
"version": "0.7.3",
"version": "0.7.4",
"author": "Sisense",
"license": "SEE LICENSE IN LICENSE.md",
"type": "module",
Expand All @@ -9,7 +9,7 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"@sisense/sdk-data": "^0.7.3"
"@sisense/sdk-data": "^0.7.4"
},
"scripts": {
"build": "tsc --build",
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk-query-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-query-client",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": "./dist/index.js",
"main": "./dist/index.js",
Expand All @@ -9,8 +9,8 @@
"author": "Sisense",
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
"@sisense/sdk-data": "^0.7.3",
"@sisense/sdk-rest-client": "^0.7.3",
"@sisense/sdk-data": "^0.7.4",
"@sisense/sdk-rest-client": "^0.7.4",
"@sisense/task-manager": "^0.1.0",
"numeral": "^2.0.6",
"uuid": "^9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-rest-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-rest-client",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": "./dist/index.js",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-ui-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-ui-angular",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"main": "./dist/index.d.ts",
"module": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-ui-preact/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-ui-preact",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": {
".": {
Expand All @@ -14,7 +14,7 @@
"author": "Sisense",
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
"@sisense/sdk-ui": "^0.7.3",
"@sisense/sdk-ui": "^0.7.4",
"preact": "^10.13.2"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-ui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-ui-vue",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisense/sdk-ui",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"exports": {
".": {
Expand All @@ -19,9 +19,9 @@
"@emotion/styled": "^11.10.5",
"@mui/material": "^5.11.6",
"@sisense/sdk-common": "workspace:^",
"@sisense/sdk-data": "^0.7.3",
"@sisense/sdk-query-client": "^0.7.3",
"@sisense/sdk-rest-client": "^0.7.3",
"@sisense/sdk-data": "^0.7.4",
"@sisense/sdk-query-client": "^0.7.4",
"@sisense/sdk-rest-client": "^0.7.4",
"@sisense/sisense-charts": "5.1.0-alpha-812d1e70.0",
"classnames": "^2.3.2",
"colorjs.io": "^0.4.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ThemeSettings } from '../../../types';
import { PwcDesignSettings, PwcPalette } from '../pwc-design-settings';
import { ThemeSettings } from '../../../types.js';
import { LegacyDesignSettings, LegacyPalette } from '../legacy-design-settings.js';

export const redPwcDesignSettings: PwcDesignSettings = {
export const redLegacyDesignSettings: LegacyDesignSettings = {
oid: '64a408e0affe66003378c8d7',
typography: {
customFontSelected: false,
Expand Down Expand Up @@ -74,7 +74,7 @@ export const redThemeSettings: ThemeSettings = {
},
};

export const corporatePalette: PwcPalette = {
export const corporatePalette: LegacyPalette = {
_id: '64106b7c984c23001b2d472e',
colors: ['#779fa8', '#bf1e1d', '#787070'],
name: 'Corporate',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
corporatePalette,
redLegacyDesignSettings,
redThemeSettings,
} from './__mocks__/legacy-design-settings.mock';
import { convertToThemeSettings, getPaletteName } from './legacy-design-settings';

describe('legacy-design-settings', () => {
describe('convertToThemeSettings', () => {
it('should convert LegacyDesignSettings and LegacyPalette to ThemeSettings', () => {
const themeSettings = convertToThemeSettings(redLegacyDesignSettings, corporatePalette);
expect(themeSettings).toEqual(redThemeSettings);
});
});

describe('getPaletteName', () => {
it('should return the color palette name from LegacyDesignSettings', () => {
const paletteName = getPaletteName(redLegacyDesignSettings);
expect(paletteName).toBe('Corporate');
});
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ThemeOid, CompleteThemeSettings } from '../../types';

/**
* Legacy analog of CompleteThemeSettings used in PWC (PrismWebClient).
* Legacy analog of CompleteThemeSettings used in Sisense UI.
*/
export type PwcDesignSettings = {
export type LegacyDesignSettings = {
oid: ThemeOid;
dashboards: {
toolbarBackgroundColor: string;
Expand Down Expand Up @@ -58,9 +58,9 @@ export type PwcDesignSettings = {
};

/**
* Palette object used in PWC.
* Palette object used in legacy (form Sisense UI).
*/
export type PwcPalette = {
export type LegacyPalette = {
_id: string;
colors: string[];
name: string;
Expand All @@ -72,43 +72,43 @@ export type PwcPalette = {
/**
* Error object returned by server when palette is not found.
*/
export type PwcPaletteError = {
export type LegacyPaletteError = {
message: string;
status: 'error';
};

/**
* Converts PWC design settings and it's palette object to CompleteThemeSettings.
* Converts legacy (used in Sisense UI) design settings and it's palette object to CompleteThemeSettings.
*
* @param pwcDesignSettings - PWC design settings.
* @param pwcPalette - PWC palette object.
* @param legacyDesignSettings - legacy design settings.
* @param legacyPalette - legacy palette object.
* @returns
*/
export function convertToThemeSettings(
pwcDesignSettings: PwcDesignSettings,
pwcPalette: PwcPalette,
legacyDesignSettings: LegacyDesignSettings,
legacyPalette: LegacyPalette,
): CompleteThemeSettings {
const themeSettings: CompleteThemeSettings = {
chart: {
textColor: pwcDesignSettings.dashboards.widgetTextColor,
backgroundColor: pwcDesignSettings.dashboards.widgetBackgroundColor,
secondaryTextColor: pwcDesignSettings.dashboards.widgetSecondaryTextColor,
textColor: legacyDesignSettings.dashboards.widgetTextColor,
backgroundColor: legacyDesignSettings.dashboards.widgetBackgroundColor,
secondaryTextColor: legacyDesignSettings.dashboards.widgetSecondaryTextColor,
},
typography: {
fontFamily: pwcDesignSettings.typography.fontFamily,
fontFamily: legacyDesignSettings.typography.fontFamily,
},
palette: {
variantColors: pwcPalette.colors,
variantColors: legacyPalette.colors,
},
general: {
brandColor: pwcDesignSettings.general.brandColor,
backgroundColor: pwcDesignSettings.general.backgroundColor,
primaryButtonTextColor: pwcDesignSettings.general.primaryButtonTextColor,
brandColor: legacyDesignSettings.general.brandColor,
backgroundColor: legacyDesignSettings.general.backgroundColor,
primaryButtonTextColor: legacyDesignSettings.general.primaryButtonTextColor,
},
};
return themeSettings;
}

export function getPaletteName(pwcDesignSettings: PwcDesignSettings): string {
return pwcDesignSettings.dashboards.colorPaletteName;
export function getPaletteName(legacyDesignSettings: LegacyDesignSettings): string {
return legacyDesignSettings.dashboards.colorPaletteName;
}

This file was deleted.

24 changes: 12 additions & 12 deletions packages/sdk-ui/src/components/ThemeProvider/theme-loader.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { HttpClient } from '@sisense/sdk-rest-client';
import { getThemeSettingsByOid } from './theme-loader';
import { PwcDesignSettings, PwcPalette } from './pwc-design-settings';
import { LegacyDesignSettings, LegacyPalette } from './legacy-design-settings';
import { ThemeOid, ThemeSettings } from '../../types';
import {
corporatePalette,
redPwcDesignSettings,
redLegacyDesignSettings,
redThemeSettings,
} from './__mocks__/pwc-design-settings.mock';
} from './__mocks__/legacy-design-settings.mock';

describe('getThemeSettingsByOid', () => {
const httpClientMock: jest.Mocked<Pick<HttpClient, 'get'>> = {
Expand All @@ -18,16 +18,16 @@ describe('getThemeSettingsByOid', () => {
});

it('should return the converted theme settings when successful', async () => {
const pwcDesignSettings: PwcDesignSettings = redPwcDesignSettings;
const themeOid: ThemeOid = pwcDesignSettings.oid;
const legacyDesignSettings: LegacyDesignSettings = redLegacyDesignSettings;
const themeOid: ThemeOid = legacyDesignSettings.oid;

const pwcPalette: PwcPalette = corporatePalette;
const paletteName = pwcPalette.name;
const legacyPalette: LegacyPalette = corporatePalette;
const paletteName = legacyPalette.name;

const expectedThemeSettings: ThemeSettings = redThemeSettings;

httpClientMock.get.mockResolvedValueOnce(pwcDesignSettings);
httpClientMock.get.mockResolvedValueOnce(pwcPalette);
httpClientMock.get.mockResolvedValueOnce(legacyDesignSettings);
httpClientMock.get.mockResolvedValueOnce(legacyPalette);

const themeSettings = await getThemeSettingsByOid(themeOid, httpClientMock);
expect(httpClientMock.get).toHaveBeenCalledTimes(2);
Expand All @@ -45,15 +45,15 @@ describe('getThemeSettingsByOid', () => {
});

it('should throw an Error when the palette is not found', () => {
const pwcDesignSettings: PwcDesignSettings = redPwcDesignSettings;
const themeOid: ThemeOid = pwcDesignSettings.oid;
const legacyDesignSettings: LegacyDesignSettings = redLegacyDesignSettings;
const themeOid: ThemeOid = legacyDesignSettings.oid;

const errorResponse = {
status: 'error',
message: 'Palette not found',
};

httpClientMock.get.mockResolvedValueOnce(pwcDesignSettings);
httpClientMock.get.mockResolvedValueOnce(legacyDesignSettings);
httpClientMock.get.mockResolvedValueOnce(errorResponse);

return expect(getThemeSettingsByOid(themeOid, httpClientMock)).rejects.toThrow(/not found/);
Expand Down
Loading

0 comments on commit 65da31e

Please sign in to comment.