@riosst100/pwa-marketplace 3.0.3 → 3.0.5

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 (58) hide show
  1. package/i18n/en_US.json +3 -3
  2. package/i18n/id_ID.json +2 -2
  3. package/package.json +1 -1
  4. package/src/componentOverrideMapping.js +1 -0
  5. package/src/components/CrossSeller/item.js +3 -4
  6. package/src/components/LinkToOtherStores/index.js +4 -4
  7. package/src/components/OrderDetail/components/itemsOrdered.js +1 -6
  8. package/src/components/ProductListTab/productListTab.js +1 -1
  9. package/src/components/RMAPage/components/productItem.js +13 -43
  10. package/src/components/SellerCoupon/index.js +1 -0
  11. package/src/components/SellerCoupon/sellerCoupon.js +41 -6
  12. package/src/components/SellerCoupon/sellerCoupon.module.css +22 -0
  13. package/src/components/SellerCoupon/sellerCouponCheckout.js +36 -19
  14. package/src/components/SellerCoupon/sellerCouponCheckout.shimmer.js +21 -0
  15. package/src/components/commons/Select/index.js +8 -4
  16. package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql.js +3 -0
  17. package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +2 -2
  18. package/src/overwrites/peregrine/lib/talons/CartPage/ProductListing/productListingFragments.gql.js +4 -0
  19. package/src/overwrites/peregrine/lib/talons/CheckoutPage/checkoutPage.extended.gql.js +20 -1
  20. package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +3 -3
  21. package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +7 -8
  22. package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +5 -0
  23. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +20 -1
  24. package/src/overwrites/venia-ui/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js +24 -27
  25. package/src/overwrites/venia-ui/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.module.css +2 -0
  26. package/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js +14 -5
  27. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/product.js +41 -1
  28. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListing/product.module.css +1 -1
  29. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/productListingBySeller.js +41 -8
  30. package/src/overwrites/venia-ui/lib/components/CartPage/cartPage.js +0 -7
  31. package/src/overwrites/venia-ui/lib/components/CheckoutPage/ItemsReview/item.js +43 -2
  32. package/src/overwrites/venia-ui/lib/components/CheckoutPage/ItemsReview/item.module.css +36 -0
  33. package/src/overwrites/venia-ui/lib/components/CheckoutPage/ItemsReview/itemsReview.js +8 -2
  34. package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderSummary/orderSummary.js +4 -0
  35. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.js +65 -57
  36. package/src/overwrites/venia-ui/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.module.css +29 -0
  37. package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.js +9 -4
  38. package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.module.css +2 -0
  39. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
  40. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +1 -1
  41. package/src/overwrites/venia-ui/lib/components/Gallery/item.js +2 -10
  42. package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +5 -4
  43. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/Reviews/index.js +1 -0
  44. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/Reviews/reviewModal.js +316 -0
  45. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/Reviews/starInput.js +33 -0
  46. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +29 -2
  47. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +70 -34
  48. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +10 -2
  49. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/modalFormReview.js +8 -8
  50. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/preOrderDetail.js +195 -37
  51. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productReview.js +4 -27
  52. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +194 -63
  53. package/src/talons/ProductContent/productContent.gql.js +11 -1
  54. package/src/talons/ProductContent/useProductContent.js +14 -2
  55. package/src/talons/ReviewModal/reviewModal.gql.js +45 -0
  56. package/src/talons/ReviewModal/useReviewModal.js +87 -0
  57. package/src/components/RMAPage/components/productItem.css +0 -15
  58. package/src/components/RMAPage/components/productItem.module.css +0 -15
package/i18n/en_US.json CHANGED
@@ -63,7 +63,7 @@
63
63
  "checkoutPage.additionalText": "You will also receive an email with the details and we will let you know when your order has shipped.",
64
64
  "checkoutPage.billingAddressSame": "Billing address same as shipping address",
65
65
  "checkoutPage.checkout": "Checkout",
66
- "checkoutPage.couponCode": "Apply Coupon Code",
66
+ "checkoutPage.couponCode": "Apply Coupon",
67
67
  "checkoutPage.createAccount": "Create Account",
68
68
  "checkoutPage.editPaymentInformation": "Edit Payment Information",
69
69
  "checkoutPage.editShippingInfo": "Edit Shipping Information",
@@ -82,7 +82,7 @@
82
82
  "checkoutPage.loadingPaymentInformation": "Fetching Payment Information",
83
83
  "checkoutPage.noPaymentAvailable": "Payment is currently unavailable.",
84
84
  "checkoutPage.orderNumber": "Order Number: {orderNumber}",
85
- "checkoutPage.orderSummary": "Summary",
85
+ "checkoutPage.orderSummary": "Order Summary",
86
86
  "checkoutPage.paymentInformation": "Payment Information",
87
87
  "checkoutPage.paymentInformationStep": "Payment Information",
88
88
  "checkoutPage.paymentLoadingError": "There was an error loading payments.",
@@ -139,7 +139,7 @@
139
139
  "country.label": "Country",
140
140
  "couponCode.apply": "Apply",
141
141
  "couponCode.couponCode": "Coupon Code",
142
- "couponCode.enterCode": "Enter code",
142
+ "couponCode.enterCode": "Enter coupon code",
143
143
  "couponCode.errorContainer": "Something went wrong. Please refresh and try again.",
144
144
  "couponCode.removeButton": "Remove",
145
145
  "createAccount.cancelText": "Cancel",
package/i18n/id_ID.json CHANGED
@@ -64,7 +64,7 @@
64
64
  "checkoutPage.additionalText": "You will also receive an email with the details and we will let you know when your order has shipped.",
65
65
  "checkoutPage.billingAddressSame": "Billing address same as shipping address",
66
66
  "checkoutPage.checkout": "Checkout",
67
- "checkoutPage.couponCode": "Apply Coupon Code",
67
+ "checkoutPage.couponCode": "Apply Coupon",
68
68
  "checkoutPage.createAccount": "Create Account",
69
69
  "checkoutPage.editPaymentInformation": "Edit Payment Information",
70
70
  "checkoutPage.editShippingInfo": "Edit Shipping Information",
@@ -140,7 +140,7 @@
140
140
  "country.label": "Country",
141
141
  "couponCode.apply": "Apply",
142
142
  "couponCode.couponCode": "Coupon Code",
143
- "couponCode.enterCode": "Enter code",
143
+ "couponCode.enterCode": "Enter coupon code",
144
144
  "couponCode.errorContainer": "Something went wrong. Please refresh and try again.",
145
145
  "couponCode.removeButton": "Remove",
146
146
  "createAccount.cancelText": "Cancel",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "3.0.3",
4
+ "version": "3.0.5",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -1,4 +1,5 @@
1
1
  module.exports = componentOverrideMapping = {
2
+ ['@magento/venia-ui/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js']: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js',
2
3
  ['@magento/peregrine/lib/talons/Header/useCartTrigger.js']: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Header/useCartTrigger.js',
3
4
  ['@magento/peregrine/lib/talons/CartPage/useCartPage.js']: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/CartPage/useCartPage.js',
4
5
  [`@magento/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js',
@@ -9,7 +9,7 @@ import logoImage from './logo_seller.png';
9
9
 
10
10
  const Item = ({ sellerName, sales, price, condition }) => {
11
11
  return (
12
- <div className='flex flex-col items-center text-center lg_text-left md_text-left lg_flex-row md_flex-row bg-white rounded-lg border border-gray-100 p-[15px] gap-y-4'>
12
+ <div className='flex flex-col items-center text-center justify-around lg_text-left md_text-left lg_flex-row md_flex-row bg-white rounded-lg border border-gray-100 p-[15px] gap-y-4'>
13
13
  <div className='seller_info-container flex flex-row gap-x-[15px] lg_w-1/3 md_w-1/3'>
14
14
  <div className='flex flex-col gap-y-[15px]'>
15
15
  <div className='seller_summary-wrapper flex flex-row gap-x-2.5 items-center'>
@@ -41,16 +41,15 @@ const Item = ({ sellerName, sales, price, condition }) => {
41
41
  onSubmit={() => { }}
42
42
  className="flex flex-col gap-x-7 gap-y-7 items-center lg_flex-row md_flex-row"
43
43
  >
44
- <QuantityStepper min={1} />
45
44
  <Button
46
- data-cy="addToCartButton"
45
+ data-cy="viewProductButton"
47
46
  classes={{
48
47
  content: 'normal-case font-medium text-[16px]'
49
48
  }}
50
49
  priority="high"
51
50
  type="button"
52
51
  >
53
- Add To Cart
52
+ View Product
54
53
  </Button>
55
54
  </Form>
56
55
  </div>
@@ -18,10 +18,10 @@ const LinkToOtherStores = (props) => {
18
18
  'product_link': 'https://tokopedia.com',
19
19
  'stores': 'Tokopedia'
20
20
  },
21
- {
22
- 'product_link': 'https://lazada.sg',
23
- 'stores': 'Lazada'
24
- }
21
+ // {
22
+ // 'product_link': 'https://lazada.sg',
23
+ // 'stores': 'Lazada'
24
+ // }
25
25
  ];
26
26
 
27
27
  const getLogo = (stores) => {
@@ -11,11 +11,6 @@ const ItemsOrdered = ({ order }) => {
11
11
  const tax = order?.total?.total_tax?.value || 0;
12
12
  const grandTotal = order?.total?.grand_total?.value || 0;
13
13
 
14
- const itemLink = useMemo(
15
- () => resourceUrl(`/${urlKey}${urlSuffix || ''}`),
16
- [urlKey, urlSuffix]
17
- );
18
-
19
14
  return (
20
15
  <>
21
16
  <div className='rounded-md border border-gray-100 pb-4'>
@@ -34,7 +29,7 @@ const ItemsOrdered = ({ order }) => {
34
29
  {items.map((item, idx) => (
35
30
  <tr key={item.id || idx} className='border-b border-gray-150'>
36
31
  <td className="col name text-left align-top py-3 px-2.5" data-th="Product Name">
37
- <Link to={itemLink} className="product name product-item-name">{item.product_name}</Link>
32
+ <strong className="product name product-item-name">{item.product_name}</strong>
38
33
  {item.selected_options && item.selected_options.length > 0 && (
39
34
  <dl className="item-options">
40
35
  {item.selected_options.map((opt, i) => (
@@ -37,7 +37,7 @@ const ProductListTab = props => {
37
37
  },
38
38
  {
39
39
  'label': 'Pre Order',
40
- 'value': 'lof_preorder'
40
+ 'value': 'card_pre_orders'
41
41
  },
42
42
  // {
43
43
  // 'label': 'Auction',
@@ -4,9 +4,7 @@ import { Link } from 'react-router-dom';
4
4
  import Select from '@riosst100/pwa-marketplace/src/components/commons/Select';
5
5
  import TextField from '@riosst100/pwa-marketplace/src/components/commons/Textfield';
6
6
  import Checkbox from '@riosst100/pwa-marketplace/src/components/commons/Checkbox';
7
- import QuantityStepper from '@magento/venia-ui/lib/components/QuantityStepper';
8
- import defaultClasses from './productItem.module.css';
9
- import { useStyle } from '@magento/venia-ui/lib/classify';
7
+
10
8
 
11
9
  const productItem = (props) => {
12
10
  const {
@@ -43,8 +41,6 @@ const productItem = (props) => {
43
41
  // Input change handler with qty_requested validation
44
42
  const handleFieldChange = (field, value) => {
45
43
  if (field === 'qty_requested' && item && item.quantity_ordered) {
46
- console.log('value',value)
47
- console.log('item.quantity_ordered',item.quantity_ordered)
48
44
  if (value > item.quantity_ordered) {
49
45
  value = item.quantity_ordered;
50
46
  }
@@ -55,8 +51,6 @@ const productItem = (props) => {
55
51
  if (onItemChange) onItemChange(field, value);
56
52
  };
57
53
 
58
- const classes = useStyle(defaultClasses, props.classes);
59
-
60
54
  return (
61
55
  <>
62
56
  <div className='item flex flex-col lg_flex-row justify-between border border-gray-100 rounded-md p-4'>
@@ -108,47 +102,23 @@ const productItem = (props) => {
108
102
  <p className='mb-1'>
109
103
  Qty Return
110
104
  </p>
111
- <QuantityStepper
112
- classes={{
113
- root: classes.quantityRoot
114
- }}
115
- initialValue={item.quantity_ordered}
116
- // itemId={item.id}
117
- />
118
- {/* <TextField
119
- type="number"
105
+ <TextField
120
106
  value={
121
- itemState.qty_requested !== undefined
122
- ? String(itemState.qty_requested)
123
- : ''
107
+ itemState.qty_requested > item.quantity_ordered
108
+ ? item.quantity_ordered
109
+ : itemState.qty_requested || ''
124
110
  }
125
- min={1}
126
- max={item.quantity_ordered}
127
- onChange={(e) => {
128
- let val = e.target.value;
129
-
130
- // Jika kosong
131
- if (val === '') {
132
- handleFieldChange('qty_requested', '');
133
- return;
134
- }
135
-
136
- val = parseFloat(val);
137
-
138
- if (isNaN(val)) {
139
- handleFieldChange('qty_requested', '');
140
- return;
141
- }
142
-
143
- // batas maksimum
111
+ onChange={e => {
112
+ let val = parseFloat(e.target.value);
113
+ if (isNaN(val)) val = '';
144
114
  if (val > item.quantity_ordered) val = item.quantity_ordered;
145
-
146
- // batas minimum
147
- if (val < 1) val = 1;
148
-
115
+ if (val < 1 && val !== '') val = 1;
149
116
  handleFieldChange('qty_requested', val);
150
117
  }}
151
- /> */}
118
+ type="number"
119
+ min={1}
120
+ max={item.quantity_ordered}
121
+ />
152
122
  </div>
153
123
  <div className='flex flex-col mb-2.5'>
154
124
  <p className='mb-1'>
@@ -1 +1,2 @@
1
1
  export { default } from './sellerCoupon';
2
+ export { default as SellerCouponCheckoutShimmer } from './sellerCouponCheckout.shimmer';
@@ -1,5 +1,6 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useMemo, useState, useCallback } from 'react';
2
2
  import classes from './sellerCoupon.module.css';
3
+ import SellerCouponCheckout from '@riosst100/pwa-marketplace/src/components/SellerCoupon/sellerCouponCheckout';
3
4
 
4
5
  const dayDiff = (toDate) => {
5
6
  if (!toDate) return null;
@@ -13,20 +14,24 @@ const dayDiff = (toDate) => {
13
14
 
14
15
  const SellerCoupon = ({ couponData, couponError, couponLoading }) => {
15
16
  if (couponLoading) {
16
- return <div className={classes.container}><p className={classes.metaText}>Loading coupons...</p></div>;
17
+ return '';
18
+ // return <div className={classes.container}><p className={classes.metaText}>Loading coupons...</p></div>;
17
19
  }
18
20
 
19
21
  if (couponError) {
20
- return <div className={classes.container}><p className={classes.metaText}>Failed to load coupons.</p></div>;
22
+ return '';
23
+ // return <div className={classes.container}><p className={classes.metaText}>Failed to load coupons.</p></div>;
21
24
  }
22
25
 
23
26
  const items = couponData?.sellerCoupons?.items || [];
24
27
 
25
28
  if (!items.length) {
26
- return <div className={classes.container}><p className={classes.metaText}>No coupons available.</p></div>;
29
+ return '';
30
+ // return <div className={classes.container}><p className={classes.metaText}>No coupons available.</p></div>;
27
31
  }
28
32
 
29
33
  const [copied, setCopied] = useState(null);
34
+ const [couponModalOpen, setCouponModalOpen] = useState(false);
30
35
 
31
36
  const handleClaim = async (code) => {
32
37
  try {
@@ -40,10 +45,14 @@ const SellerCoupon = ({ couponData, couponError, couponLoading }) => {
40
45
  setTimeout(() => setCopied(null), 2000);
41
46
  };
42
47
 
48
+ const handleViewCoupons = useCallback(() => {
49
+ setCouponModalOpen(true);
50
+ }, [setCouponModalOpen]);
51
+
43
52
  return (
44
53
  <section className={classes.container} aria-label="Seller coupons">
45
54
  <div className={classes.scroller}>
46
- {items.map(item => {
55
+ {items.slice(0, 3).map(item => {
47
56
  const key = item.couponcode_id || item.coupon_id || item.code;
48
57
  const daysLeft = dayDiff(item.to_date);
49
58
  const expiryLabel = daysLeft === null
@@ -66,7 +75,7 @@ const SellerCoupon = ({ couponData, couponError, couponLoading }) => {
66
75
  <div className={classes.actions}>
67
76
  <button
68
77
  type="button"
69
- className={classes.claimBtn}
78
+ className={copied === item.code ? classes.claimedBtn : classes.claimBtn}
70
79
  onClick={() => handleClaim(item.code)}
71
80
  aria-label={`Claim coupon ${item.code}`}
72
81
  >
@@ -76,6 +85,32 @@ const SellerCoupon = ({ couponData, couponError, couponLoading }) => {
76
85
  </div>
77
86
  );
78
87
  })}
88
+ {couponModalOpen && (
89
+ <SellerCouponCheckout
90
+ couponData={couponData}
91
+ couponLoading={couponLoading}
92
+ couponError={couponError}
93
+ autoOpen={true}
94
+ closeOnClaim={true}
95
+ couponModalOpen={couponModalOpen}
96
+ setCouponModalOpen={setCouponModalOpen}
97
+ onSelectCoupon={handleClaim}
98
+ onTriggerRender={() => null}
99
+ isCopyAction={true}
100
+ />
101
+ )}
102
+ <div className={classes.viewAllCard} role="group" aria-label="View All Coupons">
103
+ <div className={classes.actions}>
104
+ <button
105
+ type="button"
106
+ className={classes.viewAllBtn}
107
+ onClick={handleViewCoupons}
108
+ aria-label="View All Coupons"
109
+ >
110
+ View All Coupons
111
+ </button>
112
+ </div>
113
+ </div>
79
114
  </div>
80
115
  </section>
81
116
  );
@@ -19,6 +19,14 @@
19
19
  padding:8px 4px 12px;
20
20
  scroll-snap-type:x mandatory;
21
21
  }
22
+ .viewAllCard {
23
+ position:relative;
24
+ display:flex;
25
+ align-items:stretch;
26
+ padding:0 12px 0 24px;
27
+ scroll-snap-align:start;
28
+ overflow:hidden;
29
+ }
22
30
  .card{
23
31
  position:relative;
24
32
  background:#fff8f1;
@@ -90,6 +98,20 @@
90
98
  justify-content:center;
91
99
  padding:10px 0;
92
100
  }
101
+ .viewAllBtn {
102
+ color:#f76b1c;
103
+ padding:8px 18px;
104
+ font-weight:600;
105
+ cursor:pointer;
106
+ text-decoration:underline;
107
+ }
108
+ .claimedBtn {
109
+ color: #a19791;
110
+ border:none;
111
+ border-radius:6px;
112
+ padding:8px 18px;
113
+ cursor:pointer;
114
+ }
93
115
  .claimBtn{
94
116
  background: #f76b1c;
95
117
  color:#fff;
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import listClasses from './sellerCoupon.module.css';
4
4
  import modalClasses from './sellerCouponCheckout.module.css';
5
+ import { SellerCouponCheckoutShimmer } from '@riosst100/pwa-marketplace/src/components/SellerCoupon';
5
6
 
6
7
  // Reuse day diff logic
7
8
  const dayDiff = (toDate) => {
@@ -28,23 +29,26 @@ const getPortalRoot = () => {
28
29
  const SellerCouponCheckout = ({
29
30
  couponData,
30
31
  couponError,
32
+ setCouponModalOpen,
33
+ couponModalOpen,
31
34
  couponLoading,
35
+ isCopyAction,
32
36
  triggerLabel = 'View Seller Coupons',
33
37
  onSelectCoupon,
34
38
  onTriggerRender, // optional custom trigger renderer
35
39
  autoOpen = false, // auto open modal when mounted
36
40
  closeOnClaim = true // close after claiming
37
41
  }) => {
38
- const [open, setOpen] = useState(false);
42
+ // const [open, setOpen] = useState(false);
39
43
  const [copied, setCopied] = useState(null);
40
44
 
41
45
  const items = couponData?.sellerCoupons?.items || [];
42
46
 
43
- const handleOpen = () => setOpen(true);
44
- const handleClose = () => setOpen(false);
47
+ const handleOpen = () => setCouponModalOpen(true);
48
+ const handleClose = () => setCouponModalOpen(false);
45
49
 
46
50
  useEffect(() => {
47
- if (!open) return;
51
+ if (!couponModalOpen) return;
48
52
  const onKey = (e) => {
49
53
  if (e.key === 'Escape') {
50
54
  handleClose();
@@ -52,7 +56,7 @@ const SellerCouponCheckout = ({
52
56
  };
53
57
  document.addEventListener('keydown', onKey);
54
58
  return () => document.removeEventListener('keydown', onKey);
55
- }, [open]);
59
+ }, [couponModalOpen]);
56
60
 
57
61
  const handleClaim = async (item) => {
58
62
  try {
@@ -62,29 +66,34 @@ const SellerCouponCheckout = ({
62
66
  } catch (_) {
63
67
  /* ignore */
64
68
  }
69
+ console.log('item.code',item.code)
65
70
  setCopied(item.code);
66
71
  setTimeout(() => setCopied(null), 2000);
67
- if (onSelectCoupon) onSelectCoupon(item);
68
- if (closeOnClaim) handleClose();
72
+ if (!isCopyAction) {
73
+ if (onSelectCoupon) onSelectCoupon(item);
74
+ if (closeOnClaim) handleClose();
75
+ }
69
76
  };
70
77
 
71
78
  // Auto open behavior
72
79
  useEffect(() => {
73
- if (autoOpen && !open) {
74
- setOpen(true);
80
+ if (autoOpen && !couponModalOpen) {
81
+ setCouponModalOpen(true);
75
82
  }
76
- }, [autoOpen, open]);
83
+ }, [autoOpen, couponModalOpen]);
84
+
85
+ console.log('copied',copied)
77
86
 
78
- const modal = open ? (
87
+ const modal = couponModalOpen ? (
79
88
  <div className={modalClasses.overlay} role="dialog" aria-modal="true" aria-label="Seller coupons list">
80
89
  <div className={modalClasses.backdrop} onClick={handleClose} />
81
90
  <div className={modalClasses.dialog}>
82
91
  <div className={modalClasses.header}>
83
- <h2 className={modalClasses.title}>Seller Coupons</h2>
92
+ <h2 className={modalClasses.title}>{isCopyAction ? 'Store Coupons' : 'Apply Coupon'}</h2>
84
93
  <button type="button" className={modalClasses.closeBtn} onClick={handleClose} aria-label="Close coupon modal">×</button>
85
94
  </div>
86
95
  <div className={modalClasses.body}>
87
- {couponLoading && <p className={listClasses.metaText}>Loading coupons...</p>}
96
+ {couponLoading && <SellerCouponCheckoutShimmer />}
88
97
  {!couponLoading && couponError && <p className={listClasses.metaText}>Failed to load coupons.</p>}
89
98
  {!couponLoading && !couponError && !items.length && <p className={listClasses.metaText}>No coupons available.</p>}
90
99
  {!couponLoading && !couponError && items.length > 0 && (
@@ -108,14 +117,22 @@ const SellerCouponCheckout = ({
108
117
  </div>
109
118
  <div className={listClasses.divider} aria-hidden="true" />
110
119
  <div className={listClasses.actions}>
111
- <button
120
+ {isCopyAction ? <button
112
121
  type="button"
113
- className={listClasses.claimBtn}
122
+ className={copied === item.code ? listClasses.claimedBtn : listClasses.claimBtn}
114
123
  onClick={() => handleClaim(item)}
115
124
  aria-label={`Claim coupon ${item.code}`}
116
125
  >
117
126
  {copied === item.code ? 'Copied' : 'Claim'}
118
- </button>
127
+ </button> :
128
+ <button
129
+ type="button"
130
+ className={copied === item.code ? listClasses.claimedBtn : listClasses.claimBtn}
131
+ onClick={() => handleClaim(item)}
132
+ aria-label={`Apply coupon ${item.code}`}
133
+ >
134
+ {copied === item.code ? 'Applied' : 'Apply'}
135
+ </button>}
119
136
  </div>
120
137
  </div>
121
138
  );
@@ -128,20 +145,20 @@ const SellerCouponCheckout = ({
128
145
  ) : null;
129
146
 
130
147
  const trigger = onTriggerRender
131
- ? onTriggerRender({ open, setOpen, handleOpen })
148
+ ? onTriggerRender({ couponModalOpen, setCouponModalOpen, handleOpen })
132
149
  : (
133
150
  <button
134
151
  type="button"
135
152
  className={modalClasses.triggerBtn}
136
153
  onClick={handleOpen}
137
154
  aria-haspopup="dialog"
138
- aria-expanded={open}
155
+ aria-expanded={couponModalOpen}
139
156
  >
140
157
  {triggerLabel}
141
158
  </button>
142
159
  );
143
160
 
144
- return <>{onTriggerRender ? trigger : trigger}{open ? ReactDOM.createPortal(modal, getPortalRoot()) : null}</>;
161
+ return <>{onTriggerRender ? trigger : trigger}{couponModalOpen ? ReactDOM.createPortal(modal, getPortalRoot()) : null}</>;
145
162
  };
146
163
 
147
164
  export default SellerCouponCheckout;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
3
+
4
+ const SellerCouponCheckout = props => {
5
+ return (
6
+ <>
7
+ <Shimmer width="100%" height="85.1px" />
8
+ <Shimmer width="100%" height="85.1px" />
9
+ <Shimmer width="100%" height="85.1px" />
10
+ <Shimmer width="100%" height="85.1px" />
11
+ <Shimmer width="100%" height="85.1px" />
12
+ <Shimmer width="100%" height="85.1px" />
13
+ <Shimmer width="100%" height="85.1px" />
14
+ <Shimmer width="100%" height="85.1px" />
15
+ <Shimmer width="100%" height="85.1px" />
16
+ <Shimmer width="100%" height="85.1px" />
17
+ </>
18
+ );
19
+ };
20
+
21
+ export default SellerCouponCheckout;
@@ -7,7 +7,9 @@ const Select = (props) => {
7
7
  className,
8
8
  options = [],
9
9
  value,
10
- onChange
10
+ onChange,
11
+ showPlaceholder = true,
12
+ placeholder = 'Choose Option'
11
13
  } = props;
12
14
 
13
15
  return (
@@ -17,9 +19,11 @@ const Select = (props) => {
17
19
  value={value}
18
20
  onChange={onChange}
19
21
  >
20
- <option value=''>
21
- Choose Option
22
- </option>
22
+ {showPlaceholder && (
23
+ <option value=''>
24
+ {placeholder}
25
+ </option>
26
+ )}
23
27
  {options.map((item) => (
24
28
  <option key={item.value} value={item.value}>
25
29
  {item.label}
@@ -22,6 +22,9 @@ export const PriceSummaryFragment = gql`
22
22
  items {
23
23
  uid
24
24
  quantity
25
+ is_preorder
26
+ pre_order_payment_type
27
+ pre_order_deposit
25
28
  }
26
29
  ...ShippingSummaryFragment
27
30
  prices {
@@ -104,8 +104,6 @@ export const usePriceSummary = (props = {}) => {
104
104
  // }
105
105
  // });
106
106
 
107
- await setCheckoutState(true);
108
-
109
107
  await createSellerCart({ initCheckoutSplitCart, sellerUrl });
110
108
 
111
109
  await removeCart();
@@ -114,6 +112,8 @@ export const usePriceSummary = (props = {}) => {
114
112
  await createCart({
115
113
  fetchCartId
116
114
  });
115
+
116
+ await setCheckoutState(true);
117
117
 
118
118
  history.push('/checkout');
119
119
  }, [history, setCheckoutState, createSellerCart, fetchCartId, createCart, apolloClient, removeCart, cartId, initCheckoutSplitCart, initCheckoutSplitCartData]);
@@ -6,6 +6,9 @@ export const ProductListingFragment = gql`
6
6
  # eslint-disable-next-line @graphql-eslint/require-id-when-available
7
7
  items {
8
8
  uid
9
+ is_preorder
10
+ pre_order_payment_type
11
+ pre_order_deposit
9
12
  # eslint-disable-next-line @graphql-eslint/require-id-when-available
10
13
  seller {
11
14
  seller_name
@@ -17,6 +20,7 @@ export const ProductListingFragment = gql`
17
20
  name
18
21
  sku
19
22
  url_key
23
+ release_date
20
24
  thumbnail {
21
25
  url
22
26
  }
@@ -13,6 +13,20 @@ export const ITEM_SELLER_FRAGMENT = gql`
13
13
  }
14
14
  `;
15
15
 
16
+ // Extend items to include preorder fields used in ItemsReview/item.js overwrite
17
+ export const ITEM_PREORDER_FRAGMENT = gql`
18
+ fragment ItemPreorderFragment on Cart {
19
+ items {
20
+ is_preorder
21
+ pre_order_payment_type
22
+ pre_order_deposit
23
+ product {
24
+ release_date
25
+ }
26
+ }
27
+ }
28
+ `;
29
+
16
30
  export const CREATE_CART = gql`
17
31
  mutation createCart {
18
32
  cartId: createEmptyCart
@@ -64,10 +78,12 @@ export const GET_ORDER_DETAILS = gql`
64
78
  }
65
79
  ...ItemsReviewFragment
66
80
  ...ItemSellerFragment
81
+ ...ItemPreorderFragment
67
82
  }
68
83
  }
69
84
  ${ItemsReviewFragment}
70
85
  ${ITEM_SELLER_FRAGMENT}
86
+ ${ITEM_PREORDER_FRAGMENT}
71
87
  `;
72
88
 
73
89
  export const GET_CHECKOUT_DETAILS = gql`
@@ -77,11 +93,13 @@ export const GET_CHECKOUT_DETAILS = gql`
77
93
  ...CheckoutPageFragment
78
94
  ...ItemsReviewFragment
79
95
  ...ItemSellerFragment
96
+ ...ItemPreorderFragment
80
97
  }
81
98
  }
82
99
  ${CheckoutPageFragment}
83
100
  ${ItemsReviewFragment}
84
101
  ${ITEM_SELLER_FRAGMENT}
102
+ ${ITEM_PREORDER_FRAGMENT}
85
103
  `;
86
104
 
87
105
  export const GET_CUSTOMER = gql`
@@ -100,5 +118,6 @@ export default {
100
118
  getCustomerQuery: GET_CUSTOMER,
101
119
  getOrderDetailsQuery: GET_ORDER_DETAILS,
102
120
  placeOrderMutation: PLACE_ORDER,
103
- itemSellerFragment: ITEM_SELLER_FRAGMENT
121
+ itemSellerFragment: ITEM_SELLER_FRAGMENT,
122
+ itemPreorderFragment: ITEM_PREORDER_FRAGMENT
104
123
  };