@riosst100/pwa-marketplace 3.2.4 → 3.2.6

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 (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/AgeVerification/ageVerificationModal.js +2 -2
  3. package/src/components/AgeVerification/index.js +1 -1
  4. package/src/components/BecomeSeller/becomeSeller.js +13 -10
  5. package/src/components/BecomeSellerPage/becomeSellerPage.js +29 -10
  6. package/src/components/BecomeSellerPage/becomeSellerPage.module.css +21 -0
  7. package/src/components/RFQ/index.js +3 -2
  8. package/src/components/RFQ/modalRfq.js +186 -68
  9. package/src/components/RFQPage/orderRow.js +84 -249
  10. package/src/components/RFQPage/orderRow.module.css +146 -0
  11. package/src/components/RFQPage/quoteDetail.js +173 -86
  12. package/src/components/RFQPage/quoteList.js +87 -65
  13. package/src/components/SocialLogin/googleSignInButton.js +50 -0
  14. package/src/components/SocialLogin/index.js +1 -10
  15. package/src/components/SocialLogin/socialLogin.js +28 -23
  16. package/src/components/WebsiteSwitcher/websiteSwitcherItem.js +21 -7
  17. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +3 -1
  18. package/src/overwrites/venia-ui/lib/components/CreateAccount/createAccount.js +4 -4
  19. package/src/overwrites/venia-ui/lib/components/CreateAccountPage/createAccountPage.js +28 -9
  20. package/src/overwrites/venia-ui/lib/components/CreateAccountPage/createAccountPage.module.css +12 -2
  21. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +1 -1
  22. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +1 -0
  23. package/src/overwrites/venia-ui/lib/components/SignIn/signIn.js +23 -30
  24. package/src/overwrites/venia-ui/lib/components/SignInPage/signInPage.js +22 -9
  25. package/src/overwrites/venia-ui/lib/components/SignInPage/signInPage.module.css +10 -0
  26. package/src/talons/RFQ/rfq.gql.js +162 -0
  27. package/src/talons/RFQ/useRFQ.js +81 -0
  28. package/src/talons/SocialLogin/socialLogin.gql.js +106 -0
  29. package/src/talons/SocialLogin/useSocialLogin.js +169 -0
@@ -0,0 +1,50 @@
1
+ import { useEffect, useCallback, useRef } from "react";
2
+ import React from 'react';
3
+
4
+ export default function GoogleSignInButton(props) {
5
+ const { setToken } = props;
6
+
7
+ const buttonRef = useRef(null);
8
+
9
+ // callback ketika user berhasil login
10
+ const handleCredentialResponse = useCallback((response) => {
11
+ console.log("JWT:", response.credential);
12
+
13
+ setToken(response.credential);
14
+ }, [setToken]);
15
+
16
+ // (response) => {
17
+
18
+
19
+ // // simpan token atau kirim ke backend
20
+ // };
21
+
22
+ useEffect(() => {
23
+ // pastikan script Google sudah ada
24
+ const script = document.createElement("script");
25
+ script.src = "https://accounts.google.com/gsi/client";
26
+ script.async = true;
27
+ document.body.appendChild(script);
28
+
29
+ script.onload = () => {
30
+ // inisialisasi GIS
31
+ google.accounts.id.initialize({
32
+ client_id: "541495182998-oig1ed7n9a5g7e60pu3fcdoek8cnhpo2.apps.googleusercontent.com",
33
+ callback: handleCredentialResponse,
34
+ });
35
+
36
+ // render button di div
37
+ google.accounts.id.renderButton(buttonRef.current, {
38
+ theme: "outline",
39
+ size: "large",
40
+ });
41
+ };
42
+
43
+ return () => {
44
+ // bersihin script jika perlu
45
+ document.body.removeChild(script);
46
+ };
47
+ }, []);
48
+
49
+ return <div ref={buttonRef}></div>;
50
+ }
@@ -1,10 +1 @@
1
- import React from 'react';
2
- import Content from './socialLogin';
3
-
4
- const index = (props) => {
5
- return (
6
- <Content {...props} />
7
- )
8
- }
9
-
10
- export default index
1
+ export { default } from './socialLogin';
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, {useState} from 'react';
2
2
  import Button from '@magento/venia-ui/lib/components/Button';
3
3
  import Image from '@magento/venia-ui/lib/components/Image';
4
4
  import GoogleIcon from './img/google.svg';
@@ -6,20 +6,33 @@ import FacebookIcon from './img/facebook.svg';
6
6
  import InstagramIcon from './img/instagram.svg';
7
7
  import WechatIcon from './img/wechat.svg';
8
8
  import WeiboIcon from './img/weibo.svg';
9
+ import GoogleSignInButton from './googleSignInButton'
10
+ import { useSocialLogin } from '@riosst100/pwa-marketplace/src/talons/SocialLogin/useSocialLogin';
11
+
12
+ const SocialLogin = () => {
13
+ const [jwtToken, setJwtToken] = useState(null);
14
+
15
+ const talonProps = useSocialLogin({
16
+ jwtToken
17
+ });
18
+
19
+ // const {
20
+ // errors,
21
+ // handleCreateAccount,
22
+ // handleEnterKeyPress,
23
+ // signinHandleEnterKeyPress,
24
+ // handleForgotPassword,
25
+ // forgotPasswordHandleEnterKeyPress,
26
+ // handleSubmit,
27
+ // isBusy,
28
+ // setFormApi,
29
+ // recaptchaWidgetProps
30
+ // } = talonProps;
9
31
 
10
- const socialLogin = () => {
11
32
  return (
12
- <div className='relative flex w-full justify-between items-center'>
13
- <Button
14
- className="shadow-type-1 p-[14px] rounded-full w-[52px] h-[52px]"
15
- >
16
- <Image
17
- alt='google'
18
- className="relative"
19
- src={GoogleIcon}
20
- />
21
- </Button>
22
- <Button
33
+ <div className='relative flex w-full justify-center items-center'>
34
+ <GoogleSignInButton setToken={setJwtToken} />
35
+ {/* <Button
23
36
  className="shadow-type-1 p-[14px] rounded-full w-[52px] h-[52px]"
24
37
  >
25
38
  <Image
@@ -54,17 +67,9 @@ const socialLogin = () => {
54
67
  className="relative"
55
68
  src={WeiboIcon}
56
69
  />
57
- </Button>
58
-
59
- <style global jsx>
60
- {`
61
- img[loading="eager"] {
62
- display: contents;
63
- }
64
- `}
65
- </style>
70
+ </Button> */}
66
71
  </div>
67
72
  )
68
73
  }
69
74
 
70
- export default socialLogin
75
+ export default SocialLogin;
@@ -12,23 +12,37 @@ const WebsiteSwitcherItem = props => {
12
12
 
13
13
  const { location } = globalThis;
14
14
  const href = location.href;
15
+ const origin = location.origin;
15
16
 
16
- let match = location && location.pathname.split("/")[1];
17
+ const websiteCodes = [];
18
+
19
+ AVAILABLE_WEBSITES.forEach(store => {
20
+ websiteCodes.push(store.website_code);
21
+ });
22
+
23
+ const pathname = location.pathname;
24
+ const search = location.search;
25
+ const match = location && location.pathname.split("/")[1];
26
+ let websiteCodeInUrl = websiteCodes.find((str) => str === match);
17
27
 
18
28
  const websiteCode = option2 != "base" ? option2 : '';
19
29
 
20
30
  let url = href + websiteCode;
21
31
 
22
32
 
23
- if (match && option2 == "base") {
24
- match = match + "/";
33
+ if (websiteCodeInUrl && option2 == "base") {
34
+ websiteCodeInUrl = websiteCodeInUrl + "/";
35
+ }
25
36
 
26
- url = href.replace(match, websiteCode);
37
+ if (websiteCodeInUrl) {
38
+ url = href.replace(websiteCodeInUrl, websiteCode);
27
39
  }
28
40
 
29
- console.log('href',href)
30
- console.log('match',match)
31
- console.log('url',url)
41
+ if (!websiteCodeInUrl) {
42
+ if (websiteCode) {
43
+ url = origin + '/' + websiteCode + pathname + search;
44
+ }
45
+ }
32
46
 
33
47
  // const handleClick = useCallback(() => {
34
48
  // onClick(option, option2);
@@ -147,6 +147,8 @@ const Adapter = props => {
147
147
  // history.go(0);
148
148
  }
149
149
 
150
+ console.log('currentWebsiteCode',currentWebsiteCode)
151
+
150
152
  if (!websiteCodeInUrl && getWebsiteByUserIp) {
151
153
  setVerifyUserIp(false);
152
154
 
@@ -185,7 +187,7 @@ const Adapter = props => {
185
187
  );
186
188
  }
187
189
  }
188
- }, [websiteCodeInUrl, getWebsiteByUserIp]);
190
+ }, [websiteCodeInUrl, currentWebsiteCode]);
189
191
 
190
192
  // TODO: Replace with app skeleton. See PWA-547.
191
193
  if (!initialized) {
@@ -86,12 +86,12 @@ const CreateAccount = props => {
86
86
  initialValues={initialValues}
87
87
  onSubmit={handleSubmit}
88
88
  >
89
- <h2 data-cy="CreateAccount-title" className={classes.title}>
89
+ {/* <h2 data-cy="CreateAccount-title" className={classes.title}>
90
90
  <FormattedMessage
91
91
  id={'createAccount.createAccountText'}
92
92
  defaultMessage={'Sign Up'}
93
93
  />
94
- </h2>
94
+ </h2> */}
95
95
  <FormError errors={Array.from(errors.values())} />
96
96
  <div className='grid grid-cols-2 gap-6'>
97
97
  <Field
@@ -257,7 +257,7 @@ const CreateAccount = props => {
257
257
  {/* {cancelButton} */}
258
258
  </div>
259
259
  <div className='block'>
260
- <span className='text-xs font-normal'>
260
+ <span className='text-sm font-normal'>
261
261
  <FormattedMessage
262
262
  id={'createAccount.alreadyHaveAccount'}
263
263
  defaultMessage={"Already have an account ?"}
@@ -266,7 +266,7 @@ const CreateAccount = props => {
266
266
  {' '}
267
267
  <Link
268
268
  to={'/sign-in'}
269
- className='text-xs font-normal text-blue-700 underline'
269
+ className='text-sm font-normal text-blue-700 underline'
270
270
  >
271
271
  <FormattedMessage
272
272
  id={'createAccount.SignIn'}
@@ -16,15 +16,34 @@ const CreateAccountPage = props => {
16
16
  const { formatMessage } = useIntl();
17
17
 
18
18
  return (
19
- <div className={classes.root}>
20
- <StoreTitle>
21
- {formatMessage({
22
- id: 'createAccountPage.title',
23
- defaultMessage: 'Create an Account'
24
- })}
25
- </StoreTitle>
26
- <div className={cn(classes.contentContainer, '!border !border-gray-100 !rounded-lg')}>
27
- <CreateAccount {...createAccountProps} />
19
+ <div className={classes.signInRootContainer}>
20
+ <div className={cn(classes.root, '!py-[60px]')}>
21
+ <StoreTitle>
22
+ {formatMessage({
23
+ id: 'signInPage.title',
24
+ defaultMessage: 'Sign In'
25
+ })}
26
+ </StoreTitle>
27
+ <div className={cn(classes.leftContentContainer, '')}>
28
+ <div class="auth-left">
29
+ <img src="https://img.freepik.com/premium-vector/sign-up-concept-illustration_114360-7965.jpg?semt=ais_hybrid&w=740&q=80" width="50%" />
30
+ <p style={{
31
+ "fontSize": "20px",
32
+ "fontWeight": 500
33
+ }}>Create an account to start shopping or selling your collectibles.</p>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <div className={classes.root}>
38
+ <StoreTitle>
39
+ {formatMessage({
40
+ id: 'createAccountPage.title',
41
+ defaultMessage: 'Create an Account'
42
+ })}
43
+ </StoreTitle>
44
+ <div className={cn(classes.contentContainer, '!border !border-gray-100 !rounded-lg')}>
45
+ <CreateAccount {...createAccountProps} />
46
+ </div>
28
47
  </div>
29
48
  </div>
30
49
  );
@@ -2,7 +2,7 @@
2
2
  composes: gap-y-md from global;
3
3
  composes: grid from global;
4
4
  composes: justify-center from global;
5
- composes: px-0 from global;
5
+ composes: px-6 from global;
6
6
  composes: py-[60px] from global;
7
7
  composes: text-center from global;
8
8
  grid-template-columns: minmax(auto, 800px);
@@ -16,6 +16,16 @@
16
16
  composes: lg_border-2 from global;
17
17
  composes: lg_border-solid from global;
18
18
  composes: lg_border-subtle from global;
19
- composes: lg_pb-md from global;
19
+ /* composes: lg_pb-md from global; */
20
20
  composes: lg_rounded-md from global;
21
+ }
22
+
23
+ .leftContentContainer {
24
+ text-align: left;
25
+ }
26
+
27
+ .signInRootContainer {
28
+ justify-content: space-around;
29
+ display: flex;
30
+ align-items: normal;
21
31
  }
@@ -246,7 +246,7 @@ const OrderRow = props => {
246
246
  </div>
247
247
  </div>
248
248
  <div class="flex flex-col gap-1 pb-2 last_pb-0 justify-center">
249
- <div class="text-[14px] text-blue-700">
249
+ <div class="text-[14px] text-blue-700 mr-4">
250
250
  <span><Price currencyCode={it?.product_sale_price?.currency} value={it?.product_sale_price?.value} /></span>
251
251
  </div>
252
252
  </div>
@@ -537,6 +537,7 @@ const ProductFullDetail = props => {
537
537
  const cartActionContent = isSupportedProductType ? (
538
538
  <section className={cn(classes.actButton, 'justify-between flex gap-x-[20px] px-[15px] py-0')}>
539
539
  <RFQ
540
+ productId={product.id}
540
541
  disabled={isAddToCartDisabled || isPreOrderClosed}
541
542
  classes={{ rfqButton: cn(classes.rfqButton, "w-full") }}
542
543
  />
@@ -58,12 +58,6 @@ const SignIn = props => {
58
58
 
59
59
  return (
60
60
  <div data-cy="SignIn-root" className={cn(classes.root, '!p-[30px]')}>
61
- <span data-cy="SignIn-title" className={cn(classes.title, 'text-xl font-medium')}>
62
- <FormattedMessage
63
- id={'signIn.signInText'}
64
- defaultMessage={'Sign In'}
65
- />
66
- </span>
67
61
  <FormError errors={Array.from(errors.values())} />
68
62
  <Form
69
63
  getApi={setFormApi}
@@ -157,10 +151,10 @@ const SignIn = props => {
157
151
  />}
158
152
  </Button>
159
153
  <div className='block text-center'>
160
- <span className='text-xs font-normal'>
154
+ <span className='text-sm font-normal'>
161
155
  <FormattedMessage
162
156
  id={'signIn.dontHaveAccount'}
163
- defaultMessage={"Don't have an account ? "}
157
+ defaultMessage={"Don't have an account? "}
164
158
  />
165
159
  </span>
166
160
  {' '}
@@ -174,28 +168,26 @@ const SignIn = props => {
174
168
  />
175
169
  </Link>
176
170
  </div>
177
- {/* {showSocialLogin ? (
178
- <>
179
- <div className='max-w-[390px] w-full mx-auto'>
180
- <label
181
- className={cn(
182
- 'relative after_w-full after_h-[1px] after_bg-gray-100 after_block after_absolute after_top-1/2 z-[0]',
183
- 'w-full block'
184
- )}>
185
- <span
186
- className={cn(
187
- 'text-[14px] inline-block font-normal bg-white z-[1] relative px-5',
188
- )}>
189
- <FormattedMessage
190
- id={'signIn.orContinueWith'}
191
- defaultMessage={"Or continue with"}
192
- />
193
- </span>
194
- </label>
195
- </div>
196
- <SocialLogin />
197
- </>
198
- ) : null} */}
171
+ <div className='max-w-[390px] w-full mx-auto'>
172
+ <label
173
+ className={cn(
174
+ 'relative after_w-full after_h-[1px] after_bg-gray-100 after_block after_absolute after_top-1/2 z-[0]',
175
+ 'w-full block'
176
+ )}>
177
+ <span
178
+ className={cn(
179
+ 'text-[14px] inline-block font-normal bg-white z-[1] relative px-5',
180
+ )}>
181
+ <FormattedMessage
182
+ id={'signIn.orContinueWith'}
183
+ defaultMessage={"Or continue with"}
184
+ />
185
+ </span>
186
+ </label>
187
+ </div>
188
+ <div className='relative mx-auto w-full max-w-[490px]'>
189
+ <SocialLogin />
190
+ </div>
199
191
  </div>
200
192
  </Form>
201
193
  </div>
@@ -203,6 +195,7 @@ const SignIn = props => {
203
195
  };
204
196
 
205
197
  export default SignIn;
198
+
206
199
  SignIn.propTypes = {
207
200
  classes: shape({
208
201
  buttonsContainer: string,
@@ -16,15 +16,28 @@ const SignInPage = props => {
16
16
  const { formatMessage } = useIntl();
17
17
 
18
18
  return (
19
- <div className={cn(classes.root, '!py-[60px]')}>
20
- <StoreTitle>
21
- {formatMessage({
22
- id: 'signInPage.title',
23
- defaultMessage: 'Sign In'
24
- })}
25
- </StoreTitle>
26
- <div className={cn(classes.contentContainer, 'border border-gray-100 rounded-lg')}>
27
- <SignIn {...signInProps} />
19
+ <div className={classes.signInRootContainer}>
20
+ <div className={cn(classes.root, '!py-[60px]')}>
21
+ <StoreTitle>
22
+ {formatMessage({
23
+ id: 'signInPage.title',
24
+ defaultMessage: 'Sign In'
25
+ })}
26
+ </StoreTitle>
27
+ <div className={cn(classes.leftContentContainer, '')}>
28
+ <div class="auth-left">
29
+ <img src="https://img.freepik.com/premium-vector/sign-concept-illustration_114360-125.jpg" width="50%" />
30
+ <p style={{
31
+ "fontSize": "20px",
32
+ "fontWeight": 500
33
+ }}>Sign in to start shopping or sell your collectibles.</p>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <div className={cn(classes.root, '!py-[60px]')}>
38
+ <div className={cn(classes.contentContainer, 'border border-gray-100 rounded-lg')}>
39
+ <SignIn {...signInProps} />
40
+ </div>
28
41
  </div>
29
42
  </div>
30
43
  );
@@ -14,4 +14,14 @@
14
14
 
15
15
  .contentContainer {
16
16
  composes: rounded-lg from global;
17
+ }
18
+
19
+ .leftContentContainer {
20
+ text-align: left;
21
+ }
22
+
23
+ .signInRootContainer {
24
+ justify-content: space-around;
25
+ display: flex;
26
+ align-items: normal;
17
27
  }
@@ -0,0 +1,162 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const CREATE_QUICK_RFQ_MUTATION = gql`
4
+ mutation CreateQuickRfq($input: QuickrfqInput!) {
5
+ createQuickrfq(input: $input) {
6
+ message
7
+ quickrfq_id
8
+ success
9
+ }
10
+ }
11
+ `;
12
+
13
+ export const GET_QUICK_RFQ_LIST_QUERY = gql`
14
+ query getQuickRfqList($pageSize: Int, $currentPage: Int) {
15
+ quickrfqList(pageSize: $pageSize, currentPage: $currentPage) {
16
+ items {
17
+ attachment
18
+ attachments {
19
+ created_at
20
+ entity_id
21
+ file_name
22
+ file_path
23
+ file_type
24
+ message_id
25
+ quickrfq_id
26
+ }
27
+ attributes
28
+ cart_id
29
+ comment
30
+ contact_name
31
+ create_date
32
+ email
33
+ info_buy_request
34
+ messages {
35
+ created_at
36
+ customer_id
37
+ entity_id
38
+ is_main
39
+ message
40
+ quickrfq_id
41
+ }
42
+ overview
43
+ phone
44
+ price_per_product {
45
+ currency
46
+ value
47
+ }
48
+ product_id
49
+ product_name
50
+ quantity
51
+ quickrfq_id
52
+ status
53
+ store_currency_code
54
+ store_id
55
+ update_date
56
+ website_id
57
+ }
58
+ page_info {
59
+ current_page
60
+ filter_group
61
+ hide_title
62
+ page_size
63
+ title
64
+ }
65
+ total_count
66
+ }
67
+ }
68
+ `;
69
+
70
+ export const GET_QUICK_RFQ_DETAIL_QUERY = gql`
71
+ query getQuickRfqDetail($quickrfqId: Int!) {
72
+ quickrfqDetail(quickrfq_id: $quickrfqId) {
73
+ attachment
74
+ attachments {
75
+ created_at
76
+ entity_id
77
+ file_name
78
+ file_path
79
+ file_type
80
+ message_id
81
+ quickrfq_id
82
+ }
83
+ attributes
84
+ cart_id
85
+ comment
86
+ contact_name
87
+ create_date
88
+ email
89
+ info_buy_request
90
+ messages {
91
+ created_at
92
+ customer_id
93
+ entity_id
94
+ is_main
95
+ message
96
+ quickrfq_id
97
+ }
98
+ overview
99
+ phone
100
+ price_per_product {
101
+ currency
102
+ value
103
+ }
104
+ product_id
105
+ product_name
106
+ quantity
107
+ quickrfq_id
108
+ status
109
+ store_currency_code
110
+ store_id
111
+ update_date
112
+ website_id
113
+ }
114
+ }
115
+ `;
116
+
117
+ export const SEND_RFQ_MESSAGE_MUTATION = gql`
118
+ mutation sendRfqMessage($input: SendRfqMessageInput!) {
119
+ sendRfqMessage(input: $input) {
120
+ message
121
+ rfq_message {
122
+ attachments {
123
+ created_at
124
+ file_name
125
+ file_path
126
+ file_type
127
+ id
128
+ message_id
129
+ quickrfq_id
130
+ }
131
+ created_at
132
+ customer_id
133
+ id
134
+ is_main
135
+ message
136
+ quickrfq_id
137
+ }
138
+ success
139
+ }
140
+ }
141
+ `;
142
+
143
+ export const CONVERT_QUICK_RFQ_TO_CART_MUTATION = gql`
144
+ mutation convertQuickrfqToCart($quickrfqId: Int!) {
145
+ convertQuickrfqToCart(quickrfq_id: $quickrfqId) {
146
+ cart_id
147
+ masked_cart_id
148
+ message
149
+ quickrfq_id
150
+ rfq_status
151
+ status
152
+ }
153
+ }
154
+ `;
155
+
156
+ export default {
157
+ convertQuickrfqToCartMutation: CONVERT_QUICK_RFQ_TO_CART_MUTATION,
158
+ sendRfqMessageMutation: SEND_RFQ_MESSAGE_MUTATION,
159
+ getQuickRfqDetailQuery: GET_QUICK_RFQ_DETAIL_QUERY,
160
+ getQuickRfqListQuery: GET_QUICK_RFQ_LIST_QUERY,
161
+ createQuickRfqMutation: CREATE_QUICK_RFQ_MUTATION,
162
+ };