Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,22 @@
"core"
],
"scripts": {
"build": "rollup -c",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/lodash.merge": "^4.6.9",
"@types/node": "^20.12.7",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?fa0b844715320a3953d6d055997c0770f8695082",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?fa0b844715320a3953d6d055997c0770f8695082",
"eslint": "~8.57.0",
"prettier": "^3.2.5",
"rollup-plugin-dts": "^6.1.0",
"tslib": "^2.6.2",
"typescript": "^5.4.5"
},
Expand Down
60 changes: 60 additions & 0 deletions packages/core/rollup.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

const commonjs = require('@rollup/plugin-commonjs');
const dynamicImportVars = require('@rollup/plugin-dynamic-import-vars');
const nodeResolve = require('@rollup/plugin-node-resolve');
const typescript = require('@rollup/plugin-typescript');
const dts = require('rollup-plugin-dts');

const pkg = require('./package.json');

module.exports = [
{
cache: false,
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
inlineDynamicImports: true,
sourcemap: true,
},
{
file: pkg.umd,
format: 'umd',
inlineDynamicImports: true,
name: 'core',
sourcemap: true,
},
{
file: pkg.module,
format: 'esm',
inlineDynamicImports: true,
sourcemap: true,
},
],
plugins: [nodeResolve(), commonjs(), dynamicImportVars(), typescript({tsconfig: './tsconfig.lib.json'})],
},
{
cache: false,
input: 'dist/esm/types/index.d.ts',
output: [{file: 'dist/index.d.ts', format: 'esm'}],
plugins: [dts.default()],
},
];
4 changes: 2 additions & 2 deletions packages/core/src/api/authenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* under the License.
*/

import {AuthClient} from 'src/auth-client';
import {AuthApiRequestBody} from 'src/models/auth-api-request';
import {AuthClient} from '../auth-client';
import AsgardeoUIException from '../exception';
import {AuthApiRequestBody} from '../models/auth-api-request';
import {AuthApiResponse} from '../models/auth-api-response';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* under the License.
*/

import {UIAuthClient} from 'src/models/auth-config';
import {AuthClient} from '../auth-client';
import AsgardeoUIException from '../exception';
import {AuthApiResponse} from '../models/auth-api-response';
import {UIAuthClient} from '../models/auth-config';

/**
* This function is used to authorize the user.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/api/branding-preference-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* under the License.
*/

import {AuthClient} from 'src/auth-client';
import AsgardeoUIException from 'src/exception';
import {BrandingPreferenceTextAPIResponse} from 'src/models/branding-text-api-response';
import {AuthClient} from '../auth-client';
import AsgardeoUIException from '../exception';
import {BrandingPreferenceTextAPIResponse} from '../models/branding-text-api-response';

/**
* Fetch the branding preference text from the server.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/api/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* under the License.
*/

import {AuthClient} from 'src/auth-client';
import AsgardeoUIException from 'src/exception';
import {MeAPIResponse} from 'src/models/me-api-response';
import {AuthClient} from '../auth-client';
import AsgardeoUIException from '../exception';
import {MeAPIResponse} from '../models/me-api-response';

/**
* Fetch the profile information of the authenticated user.
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/branding/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

import merge from 'lodash.merge';
import getBrandingPreference from 'src/api/branding-preference';
import {AuthClient} from 'src/auth-client';
import {BrandingPreferenceAPIResponseInterface} from 'src/models/branding-api-response';
import DEFAULT_BRANDING from './default-branding/default-branding';
import getBrandingPreference from '../api/branding-preference';
import {AuthClient} from '../auth-client';
import {BrandingPreferenceAPIResponseInterface} from '../models/branding-api-response';
import {Customization, GetBranding} from '../models/customization';

/**
Expand All @@ -45,12 +45,12 @@ export const getBranding = async (props: GetBranding): Promise<Customization> =>
}

if (brandingFromConsole?.preference?.configs?.isBrandingEnabled) {
mergedBranding = await merge(DEFAULT_BRANDING, brandingFromConsole ?? {}, customization ?? {});
mergedBranding = merge(DEFAULT_BRANDING, brandingFromConsole ?? {}, customization ?? {});
} else {
mergedBranding = await merge(DEFAULT_BRANDING, customization ?? {});
mergedBranding = merge(DEFAULT_BRANDING, customization ?? {});
}
} else {
mergedBranding = await merge(merged ?? {}, customization ?? {});
mergedBranding = merge(merged ?? {}, customization ?? {});
}

return mergedBranding;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/branding/default-branding/dark-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

import {ThemeConfigInterface} from 'src/models/branding-api-response';
import {ThemeConfigInterface} from '../../models/branding-api-response';

const DARK_THEME: ThemeConfigInterface = {
buttons: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
* under the License.
*/

import DARK_THEME from './dark-theme';
import LIGHT_THEME from './light-theme';
import {
BrandingPreferenceAPIResponseInterface,
PredefinedThemes,
PredefinedLayouts,
BrandingPreferenceTypes,
} from 'src/models/branding-api-response';
import DARK_THEME from './dark-theme';
import LIGHT_THEME from './light-theme';
} from '../../models/branding-api-response';

const DEFAULT_BRANDING: BrandingPreferenceAPIResponseInterface = {
locale: 'en-US',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/branding/default-branding/light-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

import {ThemeConfigInterface} from 'src/models/branding-api-response';
import {ThemeConfigInterface} from '../../models/branding-api-response';

const LIGHT_THEME: ThemeConfigInterface = {
buttons: {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import merge from 'lodash.merge';
import getBrandingPreferenceText from 'src/api/branding-preference-text';
import {AuthClient} from 'src/auth-client';
import {BrandingPreferenceTextAPIResponse} from 'src/models/branding-text-api-response';
import getBrandingPreferenceText from '../api/branding-preference-text';
import {AuthClient} from '../auth-client';
import {BrandingPreferenceTextAPIResponse} from '../models/branding-text-api-response';
import {GetLocalization, TextObject} from './screens/model';

/**
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export {default as getBranding} from './branding/branding';
export * from './i18n/public';
export * from './auth-client';
export * from './models/public-models';
export {default as AsgardeoUIException} from './exception';
2 changes: 1 addition & 1 deletion packages/core/src/models/customization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* under the License.
*/

import {TextPreference} from 'src/i18n/public';
import {BrandingPreferenceInterface, BrandingPreferenceTypes} from './branding-api-response';
import {RecursivePartial} from './common';
import {TextPreference} from '../i18n/screens/model';

/**
* Interface for the text in the customization object.
Expand Down
Loading