Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - NX NPM scripts #18

Merged
merged 6 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@
"version": "0.1.0",
"main": "index.js",
"scripts": {
"web-sdk:dev": "pnpm exec nx dev web-sdk",
"web-sdk:build": "pnpm exec nx build web-sdk",
"web-sdk:example": "pnpm exec nx example web-sdk",
"start:backoffice:dev": "echo \"Error: no test specified\" && exit 1",
"start:workflow-builder:dev": "echo \"Error: no test specified\" && exit 1",
"start:web-ui:dev": "echo \"Error: no test specified\" && exit 1"
"format": "nx affected --target=format",
"lint": "nx affected --target=lint",
"lint:fix": "nx affected --target=lint:fix",
"test": "nx affected --target=test",
"test:e2e": "nx affected --target=test:e2e",
"dev": "nx run-many --target=dev --projects=web-sdk",
"start": "nx run-many --target=start --projects=web-sdk",
"build": "nx affected --target=build",
"web-sdk:dev": "nx run web-sdk:dev",
"web-sdk:start": "nx run web-sdk:start",
"web-sdk:build": "nx run web-sdk:build",
"web-sdk:example": "nx run web-sdk:example",
"web-sdk:lint": "nx run web-sdk:lint",
"web-sdk:lint:fix": "nx run web-sdk:lint:fix",
"web-sdk:format": "nx run web-sdk:format",
"backoffice:dev": "echo \"Error: no test specified\" && exit 1",
"workflow-builder:dev": "echo \"Error: no test specified\" && exit 1",
"web-ui:dev": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion sdks/web-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"build": "vite build",
"commit": "git add . && git-cz",
"deprecated:build:sdk": "rollup --config",
"preview": "vite preview",
"start": "vite preview",
"test": "echo \"Not yet implemented\"",
"test:e2e": "echo \"Not yet implemented\"",
"check": "svelte-check --tsconfig ./tsconfig.json",
"format": "prettier --write \"./src/**/*.{js,svelte,html,ts}\"",
"lint": "eslint \"./src/**/*.{js,ts,svelte}\"",
Expand Down
2 changes: 1 addition & 1 deletion sdks/web-sdk/src/lib/services/flow-event-bus/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export enum EFlowEvent {
FLOW_EXIT = 'FLOW_EXIT',
FLOW_ERROR = 'FLOW_ERROR',
FLOW_NAVIGATION_UPDATE = 'FLOW_NAVIGATION_UPDATE',
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export const flowEventBus: IFlowEventBus = ({ type, payload }) => {
default:
throw new Error(`Unknown flow event type ${type}`);
}
};
};
11 changes: 8 additions & 3 deletions sdks/web-sdk/src/lib/services/flow-event-bus/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export interface IFlowNavigationUpdatePayload extends IEventOptions {
};
}

export interface IFlowEventBusParams<TType extends EFlowEvent, TPayload extends TFlowEventBusPayload> {
export interface IFlowEventBusParams<
TType extends EFlowEvent,
TPayload extends TFlowEventBusPayload,
> {
type: TType;
payload: TPayload;
}
Expand All @@ -40,6 +43,8 @@ export interface IFlowEventBus {

({ type, payload }: IFlowEventBusParams<EFlowEvent.FLOW_ERROR, IFlowErrorPayload>): void;

({ type, payload }: IFlowEventBusParams<EFlowEvent.FLOW_NAVIGATION_UPDATE, IFlowNavigationUpdatePayload>): void;

({
type,
payload,
}: IFlowEventBusParams<EFlowEvent.FLOW_NAVIGATION_UPDATE, IFlowNavigationUpdatePayload>): void;
}
9 changes: 7 additions & 2 deletions sdks/web-sdk/src/lib/services/flow-event-bus/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { IFlowCompletePayload, IFlowErrorPayload, IFlowExitPayload, IFlowNavigationUpdatePayload } from './interfaces';
import {
IFlowCompletePayload,
IFlowErrorPayload,
IFlowExitPayload,
IFlowNavigationUpdatePayload,
} from './interfaces';

export type TFlowEventBusPayload =
| IFlowCompletePayload
| IFlowExitPayload
| IFlowErrorPayload
| IFlowNavigationUpdatePayload;
| IFlowNavigationUpdatePayload;
2 changes: 1 addition & 1 deletion sdks/web-sdk/src/lib/utils/configuration-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const v1adapter = (config: RecursivePartial<FlowsInitOptions>): IAppConfiguratio
flows: newFlows,
steps: flowSteps,
general,
...components
...components,
};
};

Expand Down
10 changes: 7 additions & 3 deletions sdks/web-sdk/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import ConfigurationProvider from './ConfigurationProvider.svelte';
import { BallerineSDK } from './types/BallerineSDK';
import { setFlowCallbacks, updateConfiguration, updateTranslations } from './lib/utils/configuration-management';
import {
setFlowCallbacks,
updateConfiguration,
updateTranslations,
} from './lib/utils/configuration-management';
import { BallerineSDKFlows } from './types/BallerineSDK';
import { getConfigFromQueryParams } from './lib/utils/get-config-from-query-params';

//
export const flows: BallerineSDKFlows = {
// Use the b_fid query param as the default flowName, fallback to the passed flowName arg.
// Optional args/args with default values should probably be last.
Expand Down Expand Up @@ -82,7 +86,7 @@ export const flows: BallerineSDKFlows = {
.catch(reject);
});
},
set: function(key: string, value: any): void {
set: function (key: string, value: any): void {
throw new Error('Function not implemented.');
},
};