@weareconceptstudio/account 0.0.2 → 0.0.3
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.
- package/dist/templates/AccountSettingsTemplate/AccountPassword/utils.d.ts +1 -1
- package/dist/templates/AccountTemplate/index.d.ts +2 -2
- package/dist/templates/AccountTemplate/index.js +7 -7
- package/dist/templates/AccountTemplate/style.js +1 -1
- package/dist/templates/ResetPasswordTemplate/index.d.ts +3 -4
- package/dist/templates/ResetPasswordTemplate/index.js +12 -14
- package/dist/templates/{SignUpTemplate/defaultFormFields.d.ts → ResetPasswordTemplate/utils.d.ts} +2 -2
- package/dist/templates/ResetPasswordTemplate/utils.js +13 -0
- package/dist/templates/SignInTemplate/index.d.ts +2 -1
- package/dist/templates/SignInTemplate/index.js +5 -7
- package/dist/templates/SignInTemplate/style.js +1 -1
- package/dist/templates/SignInTemplate/utils.d.ts +23 -0
- package/dist/templates/SignInTemplate/utils.js +23 -0
- package/dist/templates/SignUpTemplate/index.js +1 -1
- package/dist/templates/SignUpTemplate/utils.d.ts +23 -0
- package/dist/templates/SignUpTemplate/{defaultFormFields.js → utils.js} +2 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default AccountTemplate;
|
|
2
|
-
declare function AccountTemplate({ isFullWidth,
|
|
2
|
+
declare function AccountTemplate({ isFullWidth, menuOptions, children, onSignOut }: {
|
|
3
3
|
isFullWidth?: boolean;
|
|
4
|
-
|
|
4
|
+
menuOptions?: any[];
|
|
5
5
|
children: any;
|
|
6
6
|
onSignOut: any;
|
|
7
7
|
}): React.JSX.Element;
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { Text, Link, useUi, Page } from '@weareconceptstudio/core';
|
|
3
3
|
//* Style
|
|
4
4
|
import AccountStyle from './style';
|
|
5
|
-
const AccountTemplate = ({ isFullWidth = false,
|
|
5
|
+
const AccountTemplate = ({ isFullWidth = false, menuOptions = [], children, onSignOut }) => {
|
|
6
6
|
const { winWidth } = useUi();
|
|
7
7
|
//! Line Store
|
|
8
8
|
const lineStore = useMemo(() => {
|
|
@@ -10,6 +10,11 @@ const AccountTemplate = ({ isFullWidth = false, menu_options = [], children, onS
|
|
|
10
10
|
return React.createElement("div", { className: `space-line` });
|
|
11
11
|
}
|
|
12
12
|
}, [winWidth]);
|
|
13
|
+
//! Menu
|
|
14
|
+
const menu = useMemo(() => {
|
|
15
|
+
return menuOptions.map((menuItem, index) => (React.createElement(Link, { key: index, href: menuItem.url, className: `menu-item ${menuItem.className ? menuItem.className : ''}`, ...menuItem.options },
|
|
16
|
+
React.createElement(Text, { tag: `span`, className: `account-p account-p1 account-font-bold sidebar-item`, text: menuItem.name }))));
|
|
17
|
+
}, [menuOptions]);
|
|
13
18
|
return (React.createElement(Page, { className: 'account use-account' },
|
|
14
19
|
React.createElement(AccountStyle, null,
|
|
15
20
|
React.createElement("div", { className: 'account-wrap' },
|
|
@@ -18,12 +23,7 @@ const AccountTemplate = ({ isFullWidth = false, menu_options = [], children, onS
|
|
|
18
23
|
React.createElement("div", { className: `my-acc-wrap` },
|
|
19
24
|
React.createElement(Text, { className: 'account-p account-p1 account-font-bold account-primary-color1', text: 'myAccount' }),
|
|
20
25
|
React.createElement("div", { className: `account-line` })),
|
|
21
|
-
React.createElement("div", { className: 'tabs-wrap' },
|
|
22
|
-
? menu_options.map((item, index) => {
|
|
23
|
-
return (React.createElement(Link, { key: index, href: item.url, className: 'link-item' },
|
|
24
|
-
React.createElement(Text, { tag: `span`, className: `account-p account-p1 account-font-bold sidebar-item`, text: item.name })));
|
|
25
|
-
})
|
|
26
|
-
: null),
|
|
26
|
+
React.createElement("div", { className: 'tabs-wrap' }, menu),
|
|
27
27
|
React.createElement(Text, { text: 'signOut', onClick: onSignOut, className: 'account-p account-p1 account-error-color account-font-bold sign-out' }))),
|
|
28
28
|
lineStore,
|
|
29
29
|
React.createElement("div", { className: `right-bar` },
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ResetPasswordProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
onResetPassword: () => Promise<any>;
|
|
3
|
+
formFields: [];
|
|
4
|
+
onFormSubmit: (values: any) => Promise<any>;
|
|
6
5
|
}
|
|
7
|
-
declare const ResetPasswordTemplate: ({
|
|
6
|
+
declare const ResetPasswordTemplate: ({ formFields, onFormSubmit }: ResetPasswordProps) => React.JSX.Element;
|
|
8
7
|
export default ResetPasswordTemplate;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Text, Link, Page } from '@weareconceptstudio/core';
|
|
3
|
-
import {
|
|
3
|
+
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { AccountButton } from '../../components';
|
|
5
5
|
import ResetPasswordTemplateStyle from './style';
|
|
6
|
-
|
|
6
|
+
import { defaultFormFields } from './utils';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const ResetPasswordTemplate = ({ formFields = defaultFormFields, onFormSubmit }) => {
|
|
9
|
+
const [isSuccess, setIsSuccess] = useState(false);
|
|
10
|
+
const onSubmit = async (values) => {
|
|
11
|
+
return await onFormSubmit(values).then(() => {
|
|
12
|
+
setIsSuccess(true);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
7
15
|
return (React.createElement(Page, { className: 'reset-password use-account' },
|
|
8
16
|
React.createElement(ResetPasswordTemplateStyle, null,
|
|
9
17
|
React.createElement("div", { className: `reset-password-wrapper` }, !isSuccess ? (React.createElement(React.Fragment, null,
|
|
10
18
|
React.createElement(Text, { tag: 'h1', text: 'resetPassword', className: 'account-h2 account-font-bold account-primary-color1 title' }),
|
|
11
|
-
React.createElement(
|
|
12
|
-
React.createElement(Form.Item, { name: 'password', label: 'newPassword', className: `new-password-input-wrap` },
|
|
13
|
-
React.createElement(Input.Password, { placeholder: 'newPasswordPlaceholder' })),
|
|
19
|
+
React.createElement(FormBuilder, { fields: formFields, onSubmit: onSubmit },
|
|
14
20
|
React.createElement("div", { className: 'forgotLinkWrap' },
|
|
15
21
|
React.createElement(Link, { href: '/forgot-password' },
|
|
16
22
|
React.createElement(Text, { tag: 'span', className: 'account-p account-p3 account-font-medium account-primary-color1 underline forgotLink', text: 'forgotPasswordLink' }))),
|
|
17
|
-
React.createElement(Form.Item, { name: 'token',
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
options: { noStyle: true } },
|
|
20
|
-
React.createElement(Input, { type: 'hidden' })),
|
|
21
|
-
React.createElement(Form.Item, { name: 'email',
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
options: { noStyle: true } },
|
|
24
|
-
React.createElement(Input, { type: 'hidden' })),
|
|
25
23
|
React.createElement(AccountButton
|
|
26
24
|
// @ts-ignore
|
|
27
25
|
, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface SignInProps {
|
|
3
|
+
formFields: [];
|
|
3
4
|
onFormSubmit: () => Promise<any>;
|
|
4
5
|
}
|
|
5
|
-
declare const SignInTemplate: ({ onFormSubmit }: SignInProps) => React.JSX.Element;
|
|
6
|
+
declare const SignInTemplate: ({ formFields, onFormSubmit }: SignInProps) => React.JSX.Element;
|
|
6
7
|
export default SignInTemplate;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Text, Link, Page } from '@weareconceptstudio/core';
|
|
3
|
-
import {
|
|
3
|
+
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { AccountButton } from '../../components';
|
|
5
5
|
import SignInTemplateStyle from './style';
|
|
6
|
-
|
|
6
|
+
import { defaultFormFields } from './utils';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const SignInTemplate = ({ formFields = defaultFormFields, onFormSubmit }) => {
|
|
7
9
|
return (React.createElement(Page, { className: 'sign-in use-account' },
|
|
8
10
|
React.createElement(SignInTemplateStyle, null,
|
|
9
11
|
React.createElement("div", { className: 'sign-in-wrapper' },
|
|
10
12
|
React.createElement(Text, { tag: 'h1', className: 'account-h2 account-font-bold account-primary-color1 title', text: 'welcomeBack' }),
|
|
11
|
-
React.createElement(
|
|
12
|
-
React.createElement(Form.Item, { name: 'email', label: 'email', rules: [{ type: 'email' }] },
|
|
13
|
-
React.createElement(Input, { placeholder: 'emailPlaceholder' })),
|
|
14
|
-
React.createElement(Form.Item, { name: 'password', label: 'password' },
|
|
15
|
-
React.createElement(Input.Password, { placeholder: 'passwordPlaceholder' })),
|
|
13
|
+
React.createElement(FormBuilder, { fields: formFields, onSubmit: onFormSubmit },
|
|
16
14
|
React.createElement("div", { className: 'forgotLinkWrap' },
|
|
17
15
|
React.createElement(Link, { href: '/forgot-password' },
|
|
18
16
|
React.createElement(Text, { tag: 'span', className: 'account-p account-p3 account-font-medium account-primary-color1 underline forgotLink', text: 'forgotPasswordLink' }))),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const defaultFormFields: ({
|
|
2
|
+
fieldType: string;
|
|
3
|
+
labelProps: {
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
rules: {
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
fieldProps: {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
fieldType: string;
|
|
15
|
+
labelProps: {
|
|
16
|
+
label: string;
|
|
17
|
+
name: string;
|
|
18
|
+
rules?: undefined;
|
|
19
|
+
};
|
|
20
|
+
fieldProps: {
|
|
21
|
+
placeholder: string;
|
|
22
|
+
};
|
|
23
|
+
})[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const defaultFormFields = [
|
|
2
|
+
{
|
|
3
|
+
fieldType: 'input',
|
|
4
|
+
labelProps: {
|
|
5
|
+
label: 'email',
|
|
6
|
+
name: 'email',
|
|
7
|
+
rules: [{ type: 'email' }],
|
|
8
|
+
},
|
|
9
|
+
fieldProps: {
|
|
10
|
+
placeholder: 'emailPlaceholder',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
fieldType: 'password',
|
|
15
|
+
labelProps: {
|
|
16
|
+
label: 'password',
|
|
17
|
+
name: 'password',
|
|
18
|
+
},
|
|
19
|
+
fieldProps: {
|
|
20
|
+
placeholder: 'passwordPlaceholder',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
@@ -3,7 +3,7 @@ import { Text, useTranslation, Link, Page } from '@weareconceptstudio/core';
|
|
|
3
3
|
import { FormBuilder } from '@weareconceptstudio/form';
|
|
4
4
|
import { AccountButton, CustomCheckbox } from '../../components';
|
|
5
5
|
import SignUpTemplateStyle from './style';
|
|
6
|
-
import defaultFormFields from './
|
|
6
|
+
import { defaultFormFields } from './utils';
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
const SignUpTemplate = ({ formFields = defaultFormFields, onFormSubmit }) => {
|
|
9
9
|
const { translate } = useTranslation();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const defaultFormFields: ({
|
|
2
|
+
fieldType: string;
|
|
3
|
+
labelProps: {
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
rules?: undefined;
|
|
7
|
+
};
|
|
8
|
+
fieldProps: {
|
|
9
|
+
placeholder: string;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
fieldType: string;
|
|
13
|
+
labelProps: {
|
|
14
|
+
label: string;
|
|
15
|
+
name: string;
|
|
16
|
+
rules: {
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
fieldProps: {
|
|
21
|
+
placeholder: string;
|
|
22
|
+
};
|
|
23
|
+
})[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const defaultFormFields = [
|
|
2
2
|
{
|
|
3
3
|
fieldType: 'input',
|
|
4
4
|
labelProps: {
|
|
@@ -24,6 +24,7 @@ export default [
|
|
|
24
24
|
labelProps: {
|
|
25
25
|
label: 'email',
|
|
26
26
|
name: 'email',
|
|
27
|
+
rules: [{ type: 'email' }],
|
|
27
28
|
},
|
|
28
29
|
fieldProps: {
|
|
29
30
|
placeholder: 'emailPlaceholder',
|