robbyson-frontend-library 0.0.1

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.
Files changed (33) hide show
  1. package/index.d.ts +11 -0
  2. package/package.json +25 -0
  3. package/src/components/assets/assets.interfaces.tsx +3 -0
  4. package/src/components/assets/assets.types.d.ts +7 -0
  5. package/src/components/assets/index.d.ts +1 -0
  6. package/src/components/basic-button/basic-button.interface.tsx +7 -0
  7. package/src/components/basic-button/basic-button.types.d.ts +7 -0
  8. package/src/components/basic-button/index.d.ts +1 -0
  9. package/src/components/colors/colors.interfaces.tsx +3 -0
  10. package/src/components/colors/colors.types.d.ts +7 -0
  11. package/src/components/colors/index.d.ts +1 -0
  12. package/src/components/floating-label-text-input/floating-label-text-input.interface.tsx +9 -0
  13. package/src/components/floating-label-text-input/floating-label-text-input.types.d.ts +7 -0
  14. package/src/components/floating-label-text-input/index.d.ts +1 -0
  15. package/src/components/index.tsx +1 -0
  16. package/src/components/typography/index.d.ts +1 -0
  17. package/src/components/typography/typography.interfaces.tsx +3 -0
  18. package/src/components/typography/typography.types.d.ts +7 -0
  19. package/src/index.tsx +6 -0
  20. package/src/ioc.ts +18 -0
  21. package/src/models/base.repository.model.tsx +3 -0
  22. package/src/models/index.d.ts +2 -0
  23. package/src/models/theme-base.tsx +160 -0
  24. package/src/models/user-session.model.tsx +101 -0
  25. package/src/repositories/authentication.repository.interface.tsx +17 -0
  26. package/src/repositories/index.d.ts +3 -0
  27. package/src/repositories/locale.repository.interface.tsx +4 -0
  28. package/src/repositories/theme.repository.interface.tsx +5 -0
  29. package/src/services/authentication.service.interface.tsx +19 -0
  30. package/src/services/index.d.ts +3 -0
  31. package/src/services/locale.service.interface.tsx +4 -0
  32. package/src/services/theme.service.interface.tsx +3 -0
  33. package/tsconfig.json +30 -0
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './src/repositories/';
2
+ export * from './src/services/';
3
+ export * from './src/models';
4
+ export * from "./src/index";
5
+ export * from "./src/components/";
6
+
7
+ export * from "./src/components/basic-button";
8
+ export * from "./src/components/floating-label-text-input";
9
+ export * from "./src/components/colors";
10
+ export * from "./src/components/typography";
11
+ export * from "./src/components/assets";
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "robbyson-frontend-library",
3
+ "version": "0.0.1",
4
+ "description": "Robbyson frontend Library",
5
+ "main": "./dist/index.js",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "Robbyson Systems S/A",
9
+ "email": "contact@robbyson.com",
10
+ "url": "https://www.robbyson.com"
11
+ },
12
+ "scripts": {
13
+ "watch": "yarn clean && tsc -w",
14
+ "build:dev": "yarn clean && tsc --build",
15
+ "build:prod": "yarn clean && tsc",
16
+ "clean": "rm -rf dist"
17
+ },
18
+ "devDependencies": {
19
+ "@types/react": "^18.0.27",
20
+ "typescript": "^4.9.5"
21
+ },
22
+ "dependencies": {
23
+ "react": "^18.2.0"
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ export interface AssetsProps<T> extends React.DOMAttributes<T> {
2
+
3
+ }
@@ -0,0 +1,7 @@
1
+ ///<reference types="react" />
2
+
3
+ declare module 'styleguide/Assets' {
4
+ const Assets: React.ComponentType<AssetsProps<any>>;
5
+
6
+ export default Assets;
7
+ }
@@ -0,0 +1 @@
1
+ export * from './assets.interfaces';
@@ -0,0 +1,7 @@
1
+ export interface BasicButtonProps<T> extends React.DOMAttributes<T> {
2
+ iconAlign?: string;
3
+ text?: string;
4
+ hasIcon?: Boolean;
5
+ iconHandle?: string;
6
+ textlocaleHandle?: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ ///<reference types="react" />
2
+
3
+ declare module 'styleguide/BasicButton' {
4
+ const BasicButton: React.ComponentType<BasicButtonProps<any>>;
5
+
6
+ export default BasicButton;
7
+ }
@@ -0,0 +1 @@
1
+ export * from './basic-button.interface';
@@ -0,0 +1,3 @@
1
+ export interface ColorsProps<T> extends React.DOMAttributes<T> {
2
+
3
+ }
@@ -0,0 +1,7 @@
1
+ ///<reference types="react" />
2
+
3
+ declare module 'styleguide/Colors' {
4
+ const Colors: React.ComponentType<ColorsProps<any>>;
5
+
6
+ export default Colors;
7
+ }
@@ -0,0 +1 @@
1
+ export * from './colors.interfaces';
@@ -0,0 +1,9 @@
1
+ export interface FloatingLabelTextInputProps<T> extends React.InputHTMLAttributes<T> {
2
+ type?: string;
3
+ className?: string;
4
+ id?: string;
5
+ placeholderLocaleHandle?: string;
6
+ placeholderText?: string;
7
+ labelLocaleHandle?: string;
8
+ labelText?: string;
9
+ }
@@ -0,0 +1,7 @@
1
+ ///<reference types="react" />
2
+
3
+ declare module 'styleguide/FloatingLabelTextInput' {
4
+ const FloatingLabelTextInput: React.ComponentType<FloatingLabelTextInputProps<any>>;
5
+
6
+ export default FloatingLabelTextInput;
7
+ }
@@ -0,0 +1 @@
1
+ export * from './floating-label-text-input.interface';
@@ -0,0 +1 @@
1
+ export { }
@@ -0,0 +1 @@
1
+ export * from './typography.interfaces';
@@ -0,0 +1,3 @@
1
+ export interface TypographyProps<T> extends React.DOMAttributes<T> {
2
+
3
+ }
@@ -0,0 +1,7 @@
1
+ ///<reference types="react" />
2
+
3
+ declare module 'styleguide/Typography' {
4
+ const Typography: React.ComponentType<TypographyProps<any>>;
5
+
6
+ export default Typography;
7
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,6 @@
1
+ export * from './ioc';
2
+
3
+ export * from './models/theme-base';
4
+ export * from './models/user-session.model';
5
+
6
+ export * from './components';
package/src/ioc.ts ADDED
@@ -0,0 +1,18 @@
1
+ export class IoC {
2
+
3
+ private static _registed: { identifier: string, instance: any }[] = [];
4
+
5
+ public static GetInstance<T>(instanceIdentifier: string): T {
6
+ var implementation: any;
7
+ IoC._registed.forEach((registeredInstance) => {
8
+ if (registeredInstance.identifier === instanceIdentifier)
9
+ implementation = registeredInstance.instance as T;
10
+ });
11
+
12
+ return implementation as T;
13
+ }
14
+
15
+ public static Register(instanceIdentifier: string, instance: any) {
16
+ IoC._registed.push({ identifier: instanceIdentifier, instance });
17
+ }
18
+ }
@@ -0,0 +1,3 @@
1
+ export class BaseRepositoryModel {
2
+
3
+ }
@@ -0,0 +1,2 @@
1
+ export * from './user-session.model'
2
+ export * from './theme-base'
@@ -0,0 +1,160 @@
1
+
2
+ class ThemeBaseColors {
3
+ primary1: string;
4
+ primary2: string;
5
+ secondary1: string;
6
+ secondary2: string;
7
+ secondary3: string;
8
+ brand1: string;
9
+ brand2: string;
10
+ hover1: string;
11
+ solidBackground: string;
12
+ gradientBackground: string;
13
+ levels: {
14
+ shade100: string,
15
+ shade75: string,
16
+ shade50: string,
17
+ shade25: string,
18
+ radialGradient: string;
19
+ }[];
20
+ neutral90: string;
21
+ neutral80: string;
22
+ neutral70: string;
23
+ neutral60: string;
24
+ neutral50: string;
25
+ neutral40: string;
26
+ neutral30: string;
27
+ neutral20: string;
28
+ neutral10: string;
29
+ neutral0: string;
30
+ successes: {
31
+ text: string,
32
+ hover: string,
33
+ dark: string,
34
+ default: string,
35
+ light: string,
36
+ background: string
37
+ };
38
+ errors: {
39
+ text: string,
40
+ hover: string,
41
+ dark: string,
42
+ default: string,
43
+ light: string,
44
+ background: string
45
+ };
46
+ warnings: {
47
+ text: string,
48
+ hover: string,
49
+ dark: string,
50
+ default: string,
51
+ light: string,
52
+ background: string
53
+ };
54
+ itemsTags: {
55
+ experience: {
56
+ text: string,
57
+ background: string
58
+ },
59
+ physical: {
60
+ text: string,
61
+ background: string
62
+ },
63
+ auction: {
64
+ text: string,
65
+ background: string
66
+ },
67
+ raffle: {
68
+ text: string,
69
+ background: string
70
+ },
71
+ crowdfunding: {
72
+ text: string,
73
+ background: string
74
+ },
75
+ voucher: {
76
+ text: string,
77
+ background: string
78
+ }
79
+ };
80
+ complementary: {
81
+ agendaReminder: string;
82
+ };
83
+
84
+ }
85
+
86
+ class ThemeBaseRect {
87
+ top: string;
88
+ right: string;
89
+ bottom: string;
90
+ left: string;
91
+ }
92
+
93
+ class ThemeTypography {
94
+ fontFamily: string; // font-family
95
+ size: string; // size
96
+ textTransform: string; //text-transform
97
+ letterSpacing: string; //letter-spacing
98
+ lineHeight: string; //lineHeight
99
+ }
100
+
101
+ class ThemeAssets {
102
+ src: string;
103
+ width: string;
104
+ height: string;
105
+ }
106
+
107
+ export class ThemeBase {
108
+ colors: ThemeBaseColors;
109
+ fonts: {
110
+ fontFamily: string; // font-family
111
+ fontWeight: string; // font-weight
112
+ fontStyle: string; // font-style
113
+ src: string; // src
114
+ }[];
115
+ typography: {
116
+ h1: ThemeTypography,
117
+ h2: ThemeTypography,
118
+ h3: ThemeTypography,
119
+ h4: ThemeTypography,
120
+ h5: ThemeTypography,
121
+ h6: ThemeTypography,
122
+ subtitle1: ThemeTypography,
123
+ subtitle2: ThemeTypography,
124
+ body1Medium: ThemeTypography,
125
+ body1Book: ThemeTypography,
126
+ body1BookItalic: ThemeTypography,
127
+ body1Link: ThemeTypography,
128
+ body2Medium: ThemeTypography,
129
+ body2Book: ThemeTypography,
130
+ buttonMedium: ThemeTypography,
131
+ chip: ThemeTypography,
132
+ overline: ThemeTypography,
133
+ small: ThemeTypography,
134
+ toolTip: ThemeTypography,
135
+ };
136
+ assets: {
137
+ logoText: ThemeAssets;
138
+ logoComplete: ThemeAssets;
139
+ logoIcon: ThemeAssets;
140
+ logoTextNegative: ThemeAssets;
141
+ logoCompleteNegative: ThemeAssets;
142
+ logoIconNegative: ThemeAssets;
143
+ backgroundLogo: ThemeAssets;
144
+ logoMobile: ThemeAssets;
145
+ };
146
+
147
+ constructor() {
148
+ this.colors = new ThemeBaseColors();
149
+ this.assets = {
150
+ logoText: new ThemeAssets(),
151
+ logoComplete: new ThemeAssets(),
152
+ logoIcon: new ThemeAssets(),
153
+ logoTextNegative: new ThemeAssets(),
154
+ logoCompleteNegative: new ThemeAssets(),
155
+ logoIconNegative: new ThemeAssets(),
156
+ backgroundLogo: new ThemeAssets(),
157
+ logoMobile: new ThemeAssets()
158
+ };
159
+ }
160
+ };
@@ -0,0 +1,101 @@
1
+ import { BaseRepositoryModel } from "./base.repository.model";
2
+
3
+ export class UserSessionModel extends BaseRepositoryModel {
4
+ _id: number;
5
+ name: string;
6
+ identification: string;
7
+ externalKey: string;
8
+ RobbysonUserId: number;
9
+ primaryAttribute: {
10
+ attribute: {
11
+ _id: string,
12
+ primary: boolean
13
+ },
14
+ _id: string,
15
+ active: boolean
16
+ };
17
+ passwordUpdatedAt: Date;
18
+ hierarchy: {
19
+ hierarchyLevel: {
20
+ _id: string,
21
+ name: string,
22
+ weight: number,
23
+ permission: {
24
+ application: {
25
+ _id: number,
26
+ description: string
27
+ },
28
+ _id: string,
29
+ send?: boolean,
30
+ receive?: boolean
31
+ }[]
32
+ },
33
+ parents: string[];
34
+ _id: string;
35
+ date: Date;
36
+ identification: string,
37
+ attributes:
38
+ {
39
+ attribute: {
40
+ _id: string,
41
+ primary: boolean
42
+ },
43
+ _id: string,
44
+ active: boolean
45
+ }[],
46
+ name: string
47
+ };
48
+ nickname: string;
49
+ about: string;
50
+ contractor: { // @TODO: this field is not completed filled as ClienteRobbyson and both needs to be the same, fix it at service-authentication
51
+ _id: number,
52
+ active: boolean,
53
+ closingDay: number,
54
+ coins_indicator_id: number,
55
+ enableEAD: boolean,
56
+ enableHumor: boolean,
57
+ enableRobbysonCorporateApp: boolean,
58
+ enableMeetings: boolean,
59
+ locale: {
60
+ identifier: string,
61
+ name: string
62
+ },
63
+ minDaysToEarnCoins: number,
64
+ name: string,
65
+ timezone: string,
66
+ usesAccessControl: boolean,
67
+ usesCustomClosingDay: boolean,
68
+ usesExternalAuthentication: boolean,
69
+ passwordLength?: number,
70
+ passwordExpirationDays?: number,
71
+ usesSpeedTest: boolean,
72
+ sessionTime?: boolean
73
+ };
74
+ ClienteRobbyson: { // @TODO: Merge it with contractor
75
+ IdIndicadorTaxaAcesso: number,
76
+ IdIndicadorHumorToPraBaixo: number,
77
+ IdIndicadorHumorToDeBoa: number,
78
+ IdIndicadorHumorTopDeMais: number,
79
+ IdClassificacaoMensagemPrivada: number,
80
+ usesRobbysonAuthentication: boolean,
81
+ externalAuth?: boolean,
82
+ usesCustomClosingDay: boolean,
83
+ idAngelFriendClassification: number,
84
+ enableGuidance: boolean,
85
+ treeVisualizationMonths: number,
86
+ embeddedThirdPartyRv: boolean,
87
+ chatSendFiles: boolean,
88
+ chatMaxSizeFile?: number
89
+ };
90
+ UsuarioAceitouTermoUsoAtual: boolean;
91
+ isAcceptedLastUseTerm: boolean;
92
+ UsuarioJaLogou: boolean;
93
+ firstAccess: boolean;
94
+ forceAvatarDisplay?: boolean;
95
+ Admin: boolean;
96
+ Operation: boolean;
97
+ login: string;
98
+ system_id: number;
99
+ mirror: boolean;
100
+ SessionKey: string;
101
+ }
@@ -0,0 +1,17 @@
1
+ import { UserSessionModel } from "../models/user-session.model";
2
+
3
+ export interface IAuthenticationRepository {
4
+ auth(
5
+ {
6
+ login,
7
+ password,
8
+ system_id,
9
+ reCaptcha
10
+ }: {
11
+ login: string;
12
+ password: string;
13
+ system_id: number;
14
+ reCaptcha: string;
15
+ }
16
+ ): Promise<UserSessionModel>;
17
+ }
@@ -0,0 +1,3 @@
1
+ export * from './authentication.repository.interface';
2
+ export * from './locale.repository.interface';
3
+ export * from './theme.repository.interface';
@@ -0,0 +1,4 @@
1
+ export interface ILocaleRepository {
2
+ getByContractor(contractorId: number, languageIdentifier: string): Promise<any>;
3
+ getByHeader(): Promise<any>;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { ThemeBase } from "../models/theme-base";
2
+
3
+ export interface IThemeRepository {
4
+ getContractorTheme(contractorId: number): Promise<ThemeBase>;
5
+ }
@@ -0,0 +1,19 @@
1
+ import { UserSessionModel } from "../models/user-session.model";
2
+
3
+ export interface IAuthenticationService {
4
+ auth({
5
+ login,
6
+ password,
7
+ system_id,
8
+ reCaptcha
9
+ }: {
10
+ login: string;
11
+ password: string;
12
+ system_id: number;
13
+ reCaptcha: string;
14
+ }): Promise<UserSessionModel>;
15
+
16
+ getLoggedUser(): UserSessionModel;
17
+ checkSession(): Promise<boolean>;
18
+ clearSession(): void;
19
+ }
@@ -0,0 +1,3 @@
1
+ export * from './authentication.service.interface';
2
+ export * from './locale.service.interface';
3
+ export * from './theme.service.interface';
@@ -0,0 +1,4 @@
1
+ export interface ILocaleService {
2
+ setApplicationLocale(contractorId?: number, languageIdentifier?: string): Promise<Boolean>;
3
+ getLocaleByHandle(handle: string): string
4
+ }
@@ -0,0 +1,3 @@
1
+ export interface IThemeService {
2
+ setApplicationTheme(contractorId?: number): Promise<Boolean>;
3
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable",
7
+ "esnext"
8
+ ],
9
+ "baseUrl": "./",
10
+ "allowJs": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "strict": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "module": "esnext",
18
+ "moduleResolution": "node",
19
+ "resolveJsonModule": true,
20
+ "isolatedModules": true,
21
+ "noEmit": false,
22
+ "strictPropertyInitialization": false,
23
+ "outDir": "./dist",
24
+ "jsx": "react"
25
+ },
26
+ "include": [
27
+ "src",
28
+ "index.d.ts"
29
+ ]
30
+ }