@riosst100/pwa-marketplace 2.8.8 → 2.8.9

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 (27) hide show
  1. package/package.json +1 -1
  2. package/src/components/PaymentMethod/PaypalExpress/paypalExpress.js +3 -2
  3. package/src/components/PaymentMethod/Xendit/xendit.js +53 -0
  4. package/src/components/ProductReviewItem/index.js +1 -0
  5. package/src/components/ProductReviewItem/productReviewItem.js +67 -0
  6. package/src/components/SellerReview/sellerReview.js +21 -25
  7. package/src/components/VerifyEmailPage/index.js +1 -0
  8. package/src/components/VerifyEmailPage/verifyEmail.js +79 -0
  9. package/src/components/VerifyEmailPage/verifyEmail.module.css +71 -0
  10. package/src/intercept.js +8 -0
  11. package/src/overwrites/peregrine/lib/talons/CheckoutPage/checkoutPage.extended.gql.js +88 -0
  12. package/src/overwrites/peregrine/lib/talons/CheckoutPage/useCheckoutPage.js +124 -13
  13. package/src/overwrites/peregrine/lib/talons/CheckoutPage/xendit.gql.js +15 -0
  14. package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.module.css +2 -0
  15. package/src/overwrites/venia-ui/lib/components/CheckoutPage/BillingAddress/billingAddress.module.css +9 -1
  16. package/src/overwrites/venia-ui/lib/components/CheckoutPage/ItemsReview/itemsReview.module.css +3 -2
  17. package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +68 -44
  18. package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.module.css +102 -5
  19. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentInformation.module.css +6 -0
  20. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethodCollection.js +6 -20
  21. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethods.js +33 -2
  22. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethods.module.css +13 -3
  23. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PaymentInformation/summary.module.css +3 -1
  24. package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.module.css +14 -3
  25. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/modalFormReview.js +2 -2
  26. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productReview.js +156 -38
  27. package/src/talons/PaymentMethod/PaypalExpress/usePaypalExpress.js +5 -1
@@ -1,7 +1,7 @@
1
1
  .root {
2
2
  composes: gap-xs from global;
3
3
  composes: grid from global;
4
- composes: p-md from global;
4
+ composes: p-xs from global;
5
5
  }
6
6
 
7
7
  .heading_container {
@@ -11,6 +11,8 @@
11
11
  }
12
12
 
13
13
  .heading {
14
+ /* composes: text-base from global; */
15
+ font-size: 16px;
14
16
  composes: font-medium from global;
15
17
  }
16
18
 
@@ -173,14 +173,25 @@
173
173
 
174
174
  .review_order_button {
175
175
  composes: root_highPriority from '@magento/venia-ui/lib/components/Button/button.module.css';
176
-
176
+ box-shadow: none;
177
177
  grid-column: 1 / span 1;
178
178
  composes: m-auto from global;
179
+ text-transform: capitalize;
180
+ }
181
+ .review_order_button:hover,
182
+ .review_order_button:focus,
183
+ .review_order_button:active {
184
+ box-shadow: none;
179
185
  }
180
-
181
186
  .place_order_button {
182
187
  composes: root_highPriority from '@magento/venia-ui/lib/components/Button/button.module.css';
183
-
188
+ box-shadow: none;
184
189
  grid-column: 1 / span 1;
185
190
  composes: m-auto from global;
191
+ text-transform: capitalize;
192
+ }
193
+ .place_order_button:hover,
194
+ .place_order_button:focus,
195
+ .place_order_button:active {
196
+ box-shadow: none;
186
197
  }
@@ -27,7 +27,7 @@ const modalFormReview = (props) => {
27
27
  className="modal_form_review !p-[30px] md_min-w-[650px]"
28
28
  >
29
29
  <div className='form_review-container'>
30
- <div className='header_title-modal flex justify-between mb-10'>
30
+ <div className='header_title-modal flex justify-between mb-5'>
31
31
  <div className='text-lg text-black font-medium'>
32
32
  Write Review
33
33
  </div>
@@ -38,7 +38,7 @@ const modalFormReview = (props) => {
38
38
 
39
39
  <Form
40
40
  data-cy="form_review"
41
- className="flex flex-col gap-y-6"
41
+ className="flex flex-col gap-y-3"
42
42
  initialValues={{}}
43
43
  onSubmit={() => { }}
44
44
  onChange={() => { }}
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import Review from '@riosst100/pwa-marketplace/src/components/SellerReviewItem';
2
+ import Review from '@riosst100/pwa-marketplace/src/components/ProductReviewItem';
3
3
  import { Star1 } from 'iconsax-react';
4
4
  import Button from '../../Button';
5
5
  import ModalFormReview from './modalFormReview';
@@ -7,53 +7,171 @@ import ModalFormReview from './modalFormReview';
7
7
  const productReview = (props) => {
8
8
 
9
9
  const { className } = props;
10
-
11
10
  const [open, setOpen] = useState(false);
11
+ const [filter, setFilter] = useState('All');
12
+
13
+
14
+ // Dummy reviews data
15
+ const dummyReviews = {
16
+ __typename: 'ProductRates',
17
+ total_count: 6,
18
+ items: [
19
+ {
20
+ __typename: 'ProductRate',
21
+ id: 1,
22
+ name: 'John Doe',
23
+ date: '18 January 2024',
24
+ rating: 5,
25
+ comment: 'Got item at a great price. Arrived way quicker than expected, extremely well packaged and exactly as described. Highly recommend the seller.'
26
+ },
27
+ {
28
+ __typename: 'ProductRate',
29
+ id: 2,
30
+ name: 'Roger Taylor',
31
+ date: '25 January 2024',
32
+ rating: 2,
33
+ comment: 'Arrived late and packaging was damaged. Not satisfied.'
34
+ },
35
+ {
36
+ __typename: 'ProductRate',
37
+ id: 3,
38
+ name: 'Sarah Smith',
39
+ date: '02 February 2024',
40
+ rating: 4,
41
+ comment: 'Good product, but delivery could be faster.'
42
+ },
43
+ {
44
+ __typename: 'ProductRate',
45
+ id: 4,
46
+ name: 'Michael Johnson',
47
+ date: '10 February 2024',
48
+ rating: 3,
49
+ comment: 'Average experience, item as described but nothing special.'
50
+ },
51
+ {
52
+ __typename: 'ProductRate',
53
+ id: 5,
54
+ name: 'Emily Davis',
55
+ date: '15 February 2024',
56
+ rating: 5,
57
+ comment: 'Excellent service and product quality! Will buy again.'
58
+ },
59
+ {
60
+ __typename: 'ProductRate',
61
+ id: 6,
62
+ name: 'David Lee',
63
+ date: '20 February 2024',
64
+ rating: 1,
65
+ comment: 'Item not as described. Very disappointed.'
66
+ }
67
+ ],
68
+ page_info: {
69
+ __typename: 'SearchResultPageInfo',
70
+ total_pages: 1,
71
+ page_size: 10,
72
+ current_page: 1,
73
+ total_count: 6
74
+ }
75
+ };
76
+
77
+
78
+ const totalReviews = dummyReviews.items.length;
79
+ const averageRating = totalReviews > 0
80
+ ? (dummyReviews.items.reduce((sum, item) => sum + item.rating, 0) / totalReviews).toFixed(1)
81
+ : 0;
82
+
83
+ const starCounts = { 5: 0, 4: 0, 3: 0, 2: 0, 1: 0 };
84
+ dummyReviews.items.forEach(item => {
85
+ if (starCounts[item.rating] !== undefined) {
86
+ starCounts[item.rating]++;
87
+ }
88
+ });
89
+
90
+ const getPercent = (count) => totalReviews > 0 ? Math.round((count / totalReviews) * 100) : 0;
91
+
92
+ const filteredReviews = filter === 'All'
93
+ ? dummyReviews.items
94
+ : dummyReviews.items.filter(item => item.rating === parseInt(filter));
12
95
 
13
96
  return (
14
97
  <>
15
98
  <ModalFormReview open={open} setOpen={setOpen} />
16
99
  <div className={className}>
17
- <div className='review-summary flex justify-between mb-[30px] pb-[30px] border-b border-gray-100'>
18
- <div className="justify-start items-end gap-[15px] inline-flex">
19
- <div className="text-center text-zinc-900 text-[40px] font-medium leading-10">4.7</div>
20
- <div className="flex-col justify-start items-start gap-[9px] inline-flex">
21
- <div className="justify-start items-start gap-1.5 inline-flex">
22
- <div className="w-3.5 h-3.5 relative">
23
- <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
24
- </div>
25
- <div className="w-3.5 h-3.5 relative">
26
- <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
27
- </div>
28
- <div className="w-3.5 h-3.5 relative">
29
- <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
30
- </div>
31
- <div className="w-3.5 h-3.5 relative">
32
- <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
33
- </div>
34
- <div className="w-3.5 h-3.5 relative">
35
- <Star1 color='#D9D9D9' size={14} className='fill-[#D9D9D9]' />
100
+ <div className="w-full flex items-start xs_flex-col lg_flex-row gap-[30px]">
101
+ <div className="w-full xs_max-w-full lg_max-w-[365px] border border-[#E6E9EA] rounded-md p-6">
102
+ <div className="flex justify-between items-start mb-1">
103
+ <div className="flex flex-col">
104
+ <div className="flex items-center gap-1 mb-1">
105
+ {[...Array(5)].map((_, i) => (
106
+ <div key={i} className="w-4 h-4">
107
+ <Star1
108
+ color={i < Math.round(averageRating) ? '#F7C317' : '#D9D9D9'}
109
+ size={16}
110
+ className={i < Math.round(averageRating) ? 'fill-[#F7C317]' : ''}
111
+ />
112
+ </div>
113
+ ))}
114
+ <span className="ml-1 font-medium text-sm">{averageRating} out of 5</span>
36
115
  </div>
37
116
  </div>
38
- <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">(26 Reviews)</div>
117
+ </div>
118
+ <div className="mt-4">
119
+ {[5, 4, 3, 2, 1].map(star => {
120
+ const count = starCounts[star] || 0;
121
+ const percentage = totalReviews ? Math.round((count / totalReviews) * 100) : 0;
122
+ return (
123
+ <div key={star} className="flex items-center mb-2">
124
+ <div className="flex items-center mr-2">
125
+ <Star1 color="#F7C317" size={14} className="fill-[#F7C317]" />
126
+ <span className="text-sm ml-1">{star}</span>
127
+ </div>
128
+ <div className="relative h-[8px] flex-1 bg-[#E4EBF5] rounded-sm mr-2">
129
+ <div
130
+ className="absolute h-[8px] bg-[#FF7A00] rounded-sm"
131
+ style={{width: `${percentage}%`}}
132
+ />
133
+ </div>
134
+ <span className="text-sm text-right">{percentage}%</span>
135
+ </div>
136
+ );
137
+ })}
138
+ </div>
139
+ </div>
140
+ <div className="flex-1">
141
+ <div className="flex items-center justify-between mb-6">
142
+ <div className="flex items-center">
143
+ <span className="font-medium mr-3">Filter By</span>
144
+ <select
145
+ className="border border-[#E6E9EA] rounded px-3 py-2 text-sm"
146
+ value={filter}
147
+ onChange={e => setFilter(e.target.value)}
148
+ >
149
+ <option value="All">All Stars</option>
150
+ <option value="5">5 Stars</option>
151
+ <option value="4">4 Stars</option>
152
+ <option value="3">3 Stars</option>
153
+ <option value="2">2 Stars</option>
154
+ <option value="1">1 Stars</option>
155
+ </select>
156
+ </div>
157
+ <Button
158
+ priority='low'
159
+ classes={{
160
+ content: 'normal-case font-normal text-base'
161
+ }}
162
+ onClick={() => setOpen(true)}
163
+ >
164
+ Write a review
165
+ </Button>
166
+ </div>
167
+ {/* Reviews List */}
168
+ <div className='space-y-4 mb-6'>
169
+ <Review reviews={{
170
+ ...dummyReviews,
171
+ items: filteredReviews
172
+ }} />
39
173
  </div>
40
174
  </div>
41
- <Button
42
- priority='low'
43
- classes={{
44
- content: 'normal-case font-normal text-base'
45
- }}
46
- onClick={() => setOpen(true)}
47
- >
48
- Write a review
49
- </Button>
50
- </div>
51
- <div className='review-list flex flex-col gap-y-4'>
52
- <Review />
53
- <Review />
54
- <Review />
55
- <Review />
56
- <Review />
57
175
  </div>
58
176
  </div>
59
177
  </>
@@ -37,8 +37,12 @@ export const usePaypalExpress = props => {
37
37
  * This function will be called if address was successfully set.
38
38
  */
39
39
  const onBillingAddressChangedSuccess = useCallback(() => {
40
+ // Guard: avoid sending an invalid mutation if selectedMethod is missing.
41
+ if (!selectedMethod) {
42
+ return;
43
+ }
40
44
  updatePaymentMethod({
41
- variables: {cartId, selectedMethod}
45
+ variables: { cartId, selectedMethod }
42
46
  });
43
47
  }, [updatePaymentMethod, cartId, selectedMethod]);
44
48