@storepecker/storefront-core 1.2.0 → 2.1.0
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/api/index.cjs +76 -75
- package/dist/api/index.d.cts +5 -3
- package/dist/api/index.d.ts +5 -3
- package/dist/api/index.js +9 -8
- package/dist/{booking-CegE1cje.d.ts → booking-BgZoXUBv.d.cts} +2 -41
- package/dist/{booking-B21s0inO.d.cts → booking-CZ59BXk3.d.ts} +2 -41
- package/dist/cart-BY8D8w-s.d.cts +90 -0
- package/dist/cart-GuhgeBBt.d.ts +90 -0
- package/dist/checkout/index.cjs +38 -37
- package/dist/checkout/index.d.cts +2 -1
- package/dist/checkout/index.d.ts +2 -1
- package/dist/checkout/index.js +6 -5
- package/dist/{chunk-34KV265H.cjs → chunk-26A3EBZI.cjs} +20 -20
- package/dist/chunk-2AHH3XBW.cjs +47 -0
- package/dist/{chunk-K5B62JZO.cjs → chunk-47XTPPII.cjs} +4 -4
- package/dist/chunk-4C4NTH6O.js +41 -0
- package/dist/{chunk-UM24VDYB.js → chunk-7R2V4C7Q.js} +2 -2
- package/dist/{chunk-CSISWBZZ.js → chunk-B7FOXIZN.js} +1 -1
- package/dist/chunk-BBRB475I.cjs +43 -0
- package/dist/chunk-BBRXE57K.cjs +50 -0
- package/dist/{chunk-QCQCFYYR.js → chunk-BHOXJGIE.js} +1 -1
- package/dist/chunk-BQ256JKN.js +39 -0
- package/dist/{chunk-7UH6REGV.js → chunk-C7ZJZEEN.js} +1 -1
- package/dist/{chunk-A6IO3HIN.cjs → chunk-FMHR5ABF.cjs} +28 -28
- package/dist/{chunk-JHGXIIBZ.cjs → chunk-G3R7ZVAG.cjs} +7 -7
- package/dist/{chunk-4MJMNIAB.js → chunk-GHABOHLA.js} +1 -1
- package/dist/chunk-GTV42PDK.cjs +46 -0
- package/dist/chunk-HEFA67WK.js +42 -0
- package/dist/chunk-HSF2D56O.js +40 -0
- package/dist/{chunk-GB3HW6DM.js → chunk-JWKDXFS4.js} +1 -1
- package/dist/{chunk-KWKHHRRJ.cjs → chunk-KKQKHG26.cjs} +3 -3
- package/dist/{chunk-QM73PI5L.cjs → chunk-N3ZCCKXV.cjs} +10 -10
- package/dist/{chunk-GQTO5ZE2.cjs → chunk-NE3ZHELZ.cjs} +0 -46
- package/dist/chunk-PWYWNRVO.cjs +150 -0
- package/dist/{chunk-E7WPE3PV.js → chunk-QAC72HKO.js} +1 -1
- package/dist/{chunk-CFF632IQ.cjs → chunk-SMHJRNCR.cjs} +4 -4
- package/dist/chunk-UOFTDL4D.js +146 -0
- package/dist/chunk-WEMNXIRS.js +47 -0
- package/dist/{chunk-LC5ZAUKL.cjs → chunk-XLQAALMU.cjs} +10 -10
- package/dist/{chunk-Z7LHRD3V.js → chunk-Y6NFUWTH.js} +3 -3
- package/dist/{chunk-LBGIUNM6.js → chunk-YY77CUWX.js} +1 -1
- package/dist/{chunk-UXLUE3HW.cjs → chunk-ZO2HREQL.cjs} +2 -2
- package/dist/collections-CenI9AlQ.d.cts +40 -0
- package/dist/collections-CenI9AlQ.d.ts +40 -0
- package/dist/components/index.cjs +126 -7
- package/dist/components/index.d.cts +35 -8
- package/dist/components/index.d.ts +35 -8
- package/dist/components/index.js +122 -7
- package/dist/hooks/index.cjs +368 -27
- package/dist/hooks/index.d.cts +83 -3
- package/dist/hooks/index.d.ts +83 -3
- package/dist/hooks/index.js +352 -14
- package/dist/middleware/index.cjs +47 -0
- package/dist/middleware/index.d.cts +8 -0
- package/dist/middleware/index.d.ts +8 -0
- package/dist/middleware/index.js +44 -0
- package/dist/models/index.d.cts +5 -3
- package/dist/models/index.d.ts +5 -3
- package/dist/{cart-VaCKkJ1C.d.cts → product-Dfi0ke-4.d.cts} +1 -88
- package/dist/{cart-VaCKkJ1C.d.ts → product-Dfi0ke-4.d.ts} +1 -88
- package/dist/store/index.cjs +17 -85
- package/dist/store/index.d.cts +22 -2
- package/dist/store/index.d.ts +22 -2
- package/dist/store/index.js +7 -82
- package/dist/utils/index.cjs +80 -65
- package/dist/utils/index.d.cts +72 -7
- package/dist/utils/index.d.ts +72 -7
- package/dist/utils/index.js +20 -43
- package/dist/{wishlist-FG8tgn76.d.ts → wishlist-DHOvXmJj.d.cts} +1 -1
- package/dist/{wishlist-CkAhLpbI.d.cts → wishlist-LfdFxddw.d.ts} +1 -1
- package/package.json +24 -5
- package/dist/chunk-7DQIKSGY.js +0 -40
- package/dist/chunk-FLBJKM6G.js +0 -83
- package/dist/chunk-S3WIGYDS.cjs +0 -42
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
3
|
+
var chunkBBRB475I_cjs = require('../chunk-BBRB475I.cjs');
|
|
4
|
+
var chunkN3ZCCKXV_cjs = require('../chunk-N3ZCCKXV.cjs');
|
|
5
|
+
require('../chunk-G3R7ZVAG.cjs');
|
|
6
|
+
var chunk4CVKE6CC_cjs = require('../chunk-4CVKE6CC.cjs');
|
|
7
|
+
require('../chunk-47XTPPII.cjs');
|
|
8
|
+
require('../chunk-ZO2HREQL.cjs');
|
|
9
|
+
require('../chunk-BBRXE57K.cjs');
|
|
10
|
+
require('../chunk-NE3ZHELZ.cjs');
|
|
9
11
|
require('../chunk-N3CTXRFT.cjs');
|
|
10
12
|
var react = require('react');
|
|
11
13
|
var clsx = require('clsx');
|
|
12
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var Modal = require('react-responsive-modal');
|
|
16
|
+
require('react-responsive-modal/styles.css');
|
|
13
17
|
|
|
14
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
19
|
|
|
16
20
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
21
|
+
var Modal__default = /*#__PURE__*/_interopDefault(Modal);
|
|
17
22
|
|
|
18
23
|
// src/components/search-dropdown/search-dropdown.module.css
|
|
19
24
|
var search_dropdown_default = {};
|
|
@@ -338,7 +343,7 @@ var AddressForm = react.forwardRef(
|
|
|
338
343
|
handlePhoneChange,
|
|
339
344
|
isSubmitting,
|
|
340
345
|
isEditing
|
|
341
|
-
} =
|
|
346
|
+
} = chunkN3ZCCKXV_cjs.useAddressForm({
|
|
342
347
|
address,
|
|
343
348
|
onSuccess,
|
|
344
349
|
onError,
|
|
@@ -571,6 +576,120 @@ var AddressForm = react.forwardRef(
|
|
|
571
576
|
);
|
|
572
577
|
AddressForm.displayName = "AddressForm";
|
|
573
578
|
var address_form_default2 = AddressForm;
|
|
579
|
+
function ShareIcon({
|
|
580
|
+
width = 20,
|
|
581
|
+
height = 23,
|
|
582
|
+
className
|
|
583
|
+
}) {
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
585
|
+
"svg",
|
|
586
|
+
{
|
|
587
|
+
width,
|
|
588
|
+
height,
|
|
589
|
+
viewBox: "0 0 20 23",
|
|
590
|
+
fill: "none",
|
|
591
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
592
|
+
className,
|
|
593
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
594
|
+
"path",
|
|
595
|
+
{
|
|
596
|
+
d: "M5.0745 10.357C4.82568 9.90934 4.43524 9.55692 3.96446 9.35513C3.49369 9.15333 2.96923 9.11357 2.47341 9.24209C1.97759 9.37061 1.53848 9.66013 1.22501 10.0652C0.911539 10.4703 0.741455 10.968 0.741455 11.4802C0.741455 11.9924 0.911539 12.4901 1.22501 12.8952C1.53848 13.3003 1.97759 13.5898 2.47341 13.7183C2.96923 13.8469 3.49369 13.8071 3.96446 13.6053C4.43524 13.4035 4.82568 13.0511 5.0745 12.6034M5.0745 10.357C5.25947 10.69 5.36531 11.0723 5.36531 11.4802C5.36531 11.8882 5.25947 12.2715 5.0745 12.6034M5.0745 10.357L14.9045 4.89641M5.0745 12.6034L14.9045 18.064M14.9045 4.89641C15.0486 5.16783 15.2454 5.4078 15.4833 5.60229C15.7213 5.79678 15.9956 5.94187 16.2903 6.0291C16.585 6.11633 16.8941 6.14393 17.1996 6.1103C17.5051 6.07667 17.8008 5.98247 18.0694 5.83323C18.338 5.68398 18.5742 5.48267 18.7642 5.24108C18.9541 4.99948 19.094 4.72244 19.1756 4.42616C19.2572 4.12988 19.279 3.8203 19.2395 3.51552C19.2001 3.21074 19.1003 2.91687 18.946 2.65111C18.6419 2.12739 18.1445 1.74388 17.5606 1.58304C16.9768 1.4222 16.3531 1.49685 15.8237 1.79096C15.2943 2.08507 14.9014 2.57515 14.7295 3.15586C14.5577 3.73656 14.6205 4.36152 14.9045 4.89641ZM14.9045 18.064C14.757 18.3295 14.6632 18.6215 14.6286 18.9232C14.5939 19.225 14.619 19.5306 14.7025 19.8226C14.7859 20.1146 14.9261 20.3874 15.1149 20.6253C15.3038 20.8631 15.5376 21.0615 15.8031 21.209C16.0686 21.3565 16.3606 21.4502 16.6623 21.4849C16.9641 21.5196 17.2697 21.4944 17.5617 21.411C17.8537 21.3276 18.1265 21.1874 18.3644 20.9986C18.6022 20.8097 18.8006 20.5758 18.9481 20.3103C19.246 19.7741 19.3186 19.1415 19.1501 18.5517C18.9816 17.962 18.5857 17.4633 18.0494 17.1654C17.5132 16.8675 16.8806 16.7948 16.2908 16.9634C15.7011 17.1319 15.2024 17.5278 14.9045 18.064Z",
|
|
597
|
+
stroke: "currentColor",
|
|
598
|
+
strokeWidth: "1.5",
|
|
599
|
+
strokeLinecap: "round",
|
|
600
|
+
strokeLinejoin: "round"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
}
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
var ShareButton = ({
|
|
607
|
+
product,
|
|
608
|
+
className = "flex space-x-2 items-center hover:text-textSecondary transition-all duration-100",
|
|
609
|
+
iconSize = 22
|
|
610
|
+
}) => {
|
|
611
|
+
const _handleShare = () => {
|
|
612
|
+
chunk4CVKE6CC_cjs.shareLink(
|
|
613
|
+
`Buy ${product.name} at ${chunk4CVKE6CC_cjs.convertToCurrency(
|
|
614
|
+
Number(product.selling_price)
|
|
615
|
+
)}`,
|
|
616
|
+
product.name
|
|
617
|
+
);
|
|
618
|
+
};
|
|
619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className, onClick: _handleShare, children: /* @__PURE__ */ jsxRuntime.jsx(ShareIcon, { width: iconSize, height: iconSize }) }) });
|
|
620
|
+
};
|
|
621
|
+
var share_button_default = ShareButton;
|
|
622
|
+
var checkIfLimitReached = (attribute) => {
|
|
623
|
+
return chunkBBRB475I_cjs.isExpired(attribute.expiry_date) || attribute.download_count === 0;
|
|
624
|
+
};
|
|
625
|
+
var DigitalProductDownloadModal = ({ open, onClose, product, downloadAttribute, onDownload, loading }) => {
|
|
626
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
627
|
+
Modal__default.default,
|
|
628
|
+
{
|
|
629
|
+
classNames: {
|
|
630
|
+
modal: "modal modal-lg modal-confirm",
|
|
631
|
+
closeButton: "modal-close"
|
|
632
|
+
},
|
|
633
|
+
open,
|
|
634
|
+
onClose,
|
|
635
|
+
center: true,
|
|
636
|
+
closeIcon: null,
|
|
637
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "modal-body px-4 py-2", children: [
|
|
638
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-2xl block mb-2 fw-regular", children: [
|
|
639
|
+
"Download links for ",
|
|
640
|
+
product?.product_name
|
|
641
|
+
] }),
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "mb-4 mt-2" }),
|
|
643
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "download-links", children: loading ? Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-100 rounded-1 mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
|
|
644
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-100", children: [
|
|
645
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine line w-75" }),
|
|
646
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine line w-50 mt-2" })
|
|
647
|
+
] }),
|
|
648
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shine w-160 h-32 rounded-1" })
|
|
649
|
+
] }) }, index)) : downloadAttribute.map((attribute, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
650
|
+
"div",
|
|
651
|
+
{
|
|
652
|
+
className: "flex items-center justify-between mt-3",
|
|
653
|
+
children: [
|
|
654
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "block text-md lh-1", children: [
|
|
656
|
+
"Download link ",
|
|
657
|
+
index + 1
|
|
658
|
+
] }),
|
|
659
|
+
checkIfLimitReached(attribute) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-danger text-sm lh-1", children: "Download link expired." }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-textSecondary text-sm lh-1", children: [
|
|
660
|
+
"Remaining tries: ",
|
|
661
|
+
attribute.download_count,
|
|
662
|
+
" ",
|
|
663
|
+
"\u2022\xA0 Expires",
|
|
664
|
+
" ",
|
|
665
|
+
chunkBBRB475I_cjs.timeFromNow(attribute.expiry_date)
|
|
666
|
+
] })
|
|
667
|
+
] }),
|
|
668
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
669
|
+
"button",
|
|
670
|
+
{
|
|
671
|
+
className: "btn btn-text btn-medium",
|
|
672
|
+
onClick: () => onDownload(attribute),
|
|
673
|
+
disabled: checkIfLimitReached(attribute),
|
|
674
|
+
children: "Download"
|
|
675
|
+
}
|
|
676
|
+
)
|
|
677
|
+
]
|
|
678
|
+
},
|
|
679
|
+
`${attribute.download_link}-${index}`
|
|
680
|
+
)) }),
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-textSecondary text-sm fw-regular p-2 bg-warning-light rounded-2 mt-4", children: [
|
|
682
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-textSecondary", children: "Warning:" }),
|
|
683
|
+
" The download link is time-sensitive and will expire after a set period. You are limited to a specific number of download attempts, with each attempt reducing the remaining tries. To avoid any disruptions, please ensure a stable internet connection before proceeding with the download."
|
|
684
|
+
] })
|
|
685
|
+
] })
|
|
686
|
+
}
|
|
687
|
+
);
|
|
688
|
+
};
|
|
689
|
+
var digital_product_download_modal_default = DigitalProductDownloadModal;
|
|
574
690
|
|
|
575
691
|
exports.AddressForm = address_form_default2;
|
|
692
|
+
exports.DigitalProductDownloadModal = digital_product_download_modal_default;
|
|
576
693
|
exports.SearchDropdown = search_dropdown_default2;
|
|
694
|
+
exports.ShareButton = share_button_default;
|
|
695
|
+
exports.ShareIcon = ShareIcon;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
2
2
|
import { U as UseAddressFormOptions, u as useAddressForm } from '../useAddressForm-DgkCP1nG.cjs';
|
|
3
|
+
import { c as ProductDetail } from '../product-Dfi0ke-4.cjs';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { O as Order } from '../orders-DHJhJ3xz.cjs';
|
|
3
6
|
import 'formik';
|
|
4
7
|
import '../address-DQEZzyUG.cjs';
|
|
8
|
+
import 'react-toastify';
|
|
5
9
|
|
|
6
10
|
interface SearchDropdownOption {
|
|
7
11
|
value: string | number;
|
|
@@ -20,13 +24,13 @@ interface SearchDropdownProps {
|
|
|
20
24
|
error?: string;
|
|
21
25
|
label?: string;
|
|
22
26
|
name?: string;
|
|
23
|
-
renderOption?: (option: SearchDropdownOption) => React.ReactNode;
|
|
24
|
-
renderSelected?: (option: SearchDropdownOption | null) => React.ReactNode;
|
|
27
|
+
renderOption?: (option: SearchDropdownOption) => React$1.ReactNode;
|
|
28
|
+
renderSelected?: (option: SearchDropdownOption | null) => React$1.ReactNode;
|
|
25
29
|
filterFunction?: (option: SearchDropdownOption, searchTerm: string) => boolean;
|
|
26
30
|
emptyMessage?: string;
|
|
27
31
|
maxHeight?: string;
|
|
28
32
|
}
|
|
29
|
-
declare const SearchDropdown: React.FC<SearchDropdownProps>;
|
|
33
|
+
declare const SearchDropdown: React$1.FC<SearchDropdownProps>;
|
|
30
34
|
|
|
31
35
|
interface AddressFormRef {
|
|
32
36
|
formik: ReturnType<typeof useAddressForm>["formik"];
|
|
@@ -38,8 +42,8 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
38
42
|
type: "submit";
|
|
39
43
|
disabled: boolean;
|
|
40
44
|
loading: boolean;
|
|
41
|
-
children: React.ReactNode;
|
|
42
|
-
}) => React.ReactNode;
|
|
45
|
+
children: React$1.ReactNode;
|
|
46
|
+
}) => React$1.ReactNode;
|
|
43
47
|
/** Called when formik instance is ready (alternative to ref) */
|
|
44
48
|
onFormikReady?: (formik: ReturnType<typeof useAddressForm>["formik"]) => void;
|
|
45
49
|
/** Called when cancel is clicked */
|
|
@@ -53,6 +57,29 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
53
57
|
/** Submit button text. Default: "Save" */
|
|
54
58
|
submitLabel?: string;
|
|
55
59
|
}
|
|
56
|
-
declare const AddressForm: React.ForwardRefExoticComponent<AddressFormProps & React.RefAttributes<AddressFormRef>>;
|
|
60
|
+
declare const AddressForm: React$1.ForwardRefExoticComponent<AddressFormProps & React$1.RefAttributes<AddressFormRef>>;
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
interface ShareButtonProps {
|
|
63
|
+
product: ProductDetail.Root;
|
|
64
|
+
className?: string;
|
|
65
|
+
iconSize?: number;
|
|
66
|
+
}
|
|
67
|
+
declare const ShareButton: React.FC<ShareButtonProps>;
|
|
68
|
+
|
|
69
|
+
declare function ShareIcon({ width, height, className, }: {
|
|
70
|
+
width?: number;
|
|
71
|
+
height?: number;
|
|
72
|
+
className?: string;
|
|
73
|
+
}): react_jsx_runtime.JSX.Element;
|
|
74
|
+
|
|
75
|
+
interface DigitalProductDownloadModalProps {
|
|
76
|
+
open: boolean;
|
|
77
|
+
onClose: () => void;
|
|
78
|
+
product: Order.PurchasedProduct | null;
|
|
79
|
+
downloadAttribute: ProductDetail.DigitalProductVariant[];
|
|
80
|
+
onDownload: (attribute: ProductDetail.DigitalProductVariant) => void;
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
}
|
|
83
|
+
declare const DigitalProductDownloadModal: React.FC<DigitalProductDownloadModalProps>;
|
|
84
|
+
|
|
85
|
+
export { AddressForm, type AddressFormProps, type AddressFormRef, DigitalProductDownloadModal, type DigitalProductDownloadModalProps, SearchDropdown, type SearchDropdownOption, type SearchDropdownProps, ShareButton, type ShareButtonProps, ShareIcon };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
2
2
|
import { U as UseAddressFormOptions, u as useAddressForm } from '../useAddressForm-C-Uzug4d.js';
|
|
3
|
+
import { c as ProductDetail } from '../product-Dfi0ke-4.js';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { O as Order } from '../orders-DHJhJ3xz.js';
|
|
3
6
|
import 'formik';
|
|
4
7
|
import '../address-DQEZzyUG.js';
|
|
8
|
+
import 'react-toastify';
|
|
5
9
|
|
|
6
10
|
interface SearchDropdownOption {
|
|
7
11
|
value: string | number;
|
|
@@ -20,13 +24,13 @@ interface SearchDropdownProps {
|
|
|
20
24
|
error?: string;
|
|
21
25
|
label?: string;
|
|
22
26
|
name?: string;
|
|
23
|
-
renderOption?: (option: SearchDropdownOption) => React.ReactNode;
|
|
24
|
-
renderSelected?: (option: SearchDropdownOption | null) => React.ReactNode;
|
|
27
|
+
renderOption?: (option: SearchDropdownOption) => React$1.ReactNode;
|
|
28
|
+
renderSelected?: (option: SearchDropdownOption | null) => React$1.ReactNode;
|
|
25
29
|
filterFunction?: (option: SearchDropdownOption, searchTerm: string) => boolean;
|
|
26
30
|
emptyMessage?: string;
|
|
27
31
|
maxHeight?: string;
|
|
28
32
|
}
|
|
29
|
-
declare const SearchDropdown: React.FC<SearchDropdownProps>;
|
|
33
|
+
declare const SearchDropdown: React$1.FC<SearchDropdownProps>;
|
|
30
34
|
|
|
31
35
|
interface AddressFormRef {
|
|
32
36
|
formik: ReturnType<typeof useAddressForm>["formik"];
|
|
@@ -38,8 +42,8 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
38
42
|
type: "submit";
|
|
39
43
|
disabled: boolean;
|
|
40
44
|
loading: boolean;
|
|
41
|
-
children: React.ReactNode;
|
|
42
|
-
}) => React.ReactNode;
|
|
45
|
+
children: React$1.ReactNode;
|
|
46
|
+
}) => React$1.ReactNode;
|
|
43
47
|
/** Called when formik instance is ready (alternative to ref) */
|
|
44
48
|
onFormikReady?: (formik: ReturnType<typeof useAddressForm>["formik"]) => void;
|
|
45
49
|
/** Called when cancel is clicked */
|
|
@@ -53,6 +57,29 @@ interface AddressFormProps extends UseAddressFormOptions {
|
|
|
53
57
|
/** Submit button text. Default: "Save" */
|
|
54
58
|
submitLabel?: string;
|
|
55
59
|
}
|
|
56
|
-
declare const AddressForm: React.ForwardRefExoticComponent<AddressFormProps & React.RefAttributes<AddressFormRef>>;
|
|
60
|
+
declare const AddressForm: React$1.ForwardRefExoticComponent<AddressFormProps & React$1.RefAttributes<AddressFormRef>>;
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
interface ShareButtonProps {
|
|
63
|
+
product: ProductDetail.Root;
|
|
64
|
+
className?: string;
|
|
65
|
+
iconSize?: number;
|
|
66
|
+
}
|
|
67
|
+
declare const ShareButton: React.FC<ShareButtonProps>;
|
|
68
|
+
|
|
69
|
+
declare function ShareIcon({ width, height, className, }: {
|
|
70
|
+
width?: number;
|
|
71
|
+
height?: number;
|
|
72
|
+
className?: string;
|
|
73
|
+
}): react_jsx_runtime.JSX.Element;
|
|
74
|
+
|
|
75
|
+
interface DigitalProductDownloadModalProps {
|
|
76
|
+
open: boolean;
|
|
77
|
+
onClose: () => void;
|
|
78
|
+
product: Order.PurchasedProduct | null;
|
|
79
|
+
downloadAttribute: ProductDetail.DigitalProductVariant[];
|
|
80
|
+
onDownload: (attribute: ProductDetail.DigitalProductVariant) => void;
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
}
|
|
83
|
+
declare const DigitalProductDownloadModal: React.FC<DigitalProductDownloadModalProps>;
|
|
84
|
+
|
|
85
|
+
export { AddressForm, type AddressFormProps, type AddressFormRef, DigitalProductDownloadModal, type DigitalProductDownloadModalProps, SearchDropdown, type SearchDropdownOption, type SearchDropdownProps, ShareButton, type ShareButtonProps, ShareIcon };
|
package/dist/components/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
1
|
+
import { timeFromNow, isExpired } from '../chunk-HSF2D56O.js';
|
|
2
|
+
import { useAddressForm } from '../chunk-7R2V4C7Q.js';
|
|
3
|
+
import '../chunk-YY77CUWX.js';
|
|
4
|
+
import { shareLink, convertToCurrency } from '../chunk-YUPBTD4M.js';
|
|
5
|
+
import '../chunk-B7FOXIZN.js';
|
|
6
|
+
import '../chunk-JWKDXFS4.js';
|
|
7
|
+
import '../chunk-WEMNXIRS.js';
|
|
8
|
+
import '../chunk-BQ256JKN.js';
|
|
7
9
|
import '../chunk-JQMLHRWL.js';
|
|
8
10
|
import { forwardRef, useImperativeHandle, useEffect, useState, useRef, useMemo, useCallback } from 'react';
|
|
9
11
|
import clsx from 'clsx';
|
|
10
12
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
+
import Modal from 'react-responsive-modal';
|
|
14
|
+
import 'react-responsive-modal/styles.css';
|
|
11
15
|
|
|
12
16
|
// src/components/search-dropdown/search-dropdown.module.css
|
|
13
17
|
var search_dropdown_default = {};
|
|
@@ -565,5 +569,116 @@ var AddressForm = forwardRef(
|
|
|
565
569
|
);
|
|
566
570
|
AddressForm.displayName = "AddressForm";
|
|
567
571
|
var address_form_default2 = AddressForm;
|
|
572
|
+
function ShareIcon({
|
|
573
|
+
width = 20,
|
|
574
|
+
height = 23,
|
|
575
|
+
className
|
|
576
|
+
}) {
|
|
577
|
+
return /* @__PURE__ */ jsx(
|
|
578
|
+
"svg",
|
|
579
|
+
{
|
|
580
|
+
width,
|
|
581
|
+
height,
|
|
582
|
+
viewBox: "0 0 20 23",
|
|
583
|
+
fill: "none",
|
|
584
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
585
|
+
className,
|
|
586
|
+
children: /* @__PURE__ */ jsx(
|
|
587
|
+
"path",
|
|
588
|
+
{
|
|
589
|
+
d: "M5.0745 10.357C4.82568 9.90934 4.43524 9.55692 3.96446 9.35513C3.49369 9.15333 2.96923 9.11357 2.47341 9.24209C1.97759 9.37061 1.53848 9.66013 1.22501 10.0652C0.911539 10.4703 0.741455 10.968 0.741455 11.4802C0.741455 11.9924 0.911539 12.4901 1.22501 12.8952C1.53848 13.3003 1.97759 13.5898 2.47341 13.7183C2.96923 13.8469 3.49369 13.8071 3.96446 13.6053C4.43524 13.4035 4.82568 13.0511 5.0745 12.6034M5.0745 10.357C5.25947 10.69 5.36531 11.0723 5.36531 11.4802C5.36531 11.8882 5.25947 12.2715 5.0745 12.6034M5.0745 10.357L14.9045 4.89641M5.0745 12.6034L14.9045 18.064M14.9045 4.89641C15.0486 5.16783 15.2454 5.4078 15.4833 5.60229C15.7213 5.79678 15.9956 5.94187 16.2903 6.0291C16.585 6.11633 16.8941 6.14393 17.1996 6.1103C17.5051 6.07667 17.8008 5.98247 18.0694 5.83323C18.338 5.68398 18.5742 5.48267 18.7642 5.24108C18.9541 4.99948 19.094 4.72244 19.1756 4.42616C19.2572 4.12988 19.279 3.8203 19.2395 3.51552C19.2001 3.21074 19.1003 2.91687 18.946 2.65111C18.6419 2.12739 18.1445 1.74388 17.5606 1.58304C16.9768 1.4222 16.3531 1.49685 15.8237 1.79096C15.2943 2.08507 14.9014 2.57515 14.7295 3.15586C14.5577 3.73656 14.6205 4.36152 14.9045 4.89641ZM14.9045 18.064C14.757 18.3295 14.6632 18.6215 14.6286 18.9232C14.5939 19.225 14.619 19.5306 14.7025 19.8226C14.7859 20.1146 14.9261 20.3874 15.1149 20.6253C15.3038 20.8631 15.5376 21.0615 15.8031 21.209C16.0686 21.3565 16.3606 21.4502 16.6623 21.4849C16.9641 21.5196 17.2697 21.4944 17.5617 21.411C17.8537 21.3276 18.1265 21.1874 18.3644 20.9986C18.6022 20.8097 18.8006 20.5758 18.9481 20.3103C19.246 19.7741 19.3186 19.1415 19.1501 18.5517C18.9816 17.962 18.5857 17.4633 18.0494 17.1654C17.5132 16.8675 16.8806 16.7948 16.2908 16.9634C15.7011 17.1319 15.2024 17.5278 14.9045 18.064Z",
|
|
590
|
+
stroke: "currentColor",
|
|
591
|
+
strokeWidth: "1.5",
|
|
592
|
+
strokeLinecap: "round",
|
|
593
|
+
strokeLinejoin: "round"
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
var ShareButton = ({
|
|
600
|
+
product,
|
|
601
|
+
className = "flex space-x-2 items-center hover:text-textSecondary transition-all duration-100",
|
|
602
|
+
iconSize = 22
|
|
603
|
+
}) => {
|
|
604
|
+
const _handleShare = () => {
|
|
605
|
+
shareLink(
|
|
606
|
+
`Buy ${product.name} at ${convertToCurrency(
|
|
607
|
+
Number(product.selling_price)
|
|
608
|
+
)}`,
|
|
609
|
+
product.name
|
|
610
|
+
);
|
|
611
|
+
};
|
|
612
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsx("button", { className, onClick: _handleShare, children: /* @__PURE__ */ jsx(ShareIcon, { width: iconSize, height: iconSize }) }) });
|
|
613
|
+
};
|
|
614
|
+
var share_button_default = ShareButton;
|
|
615
|
+
var checkIfLimitReached = (attribute) => {
|
|
616
|
+
return isExpired(attribute.expiry_date) || attribute.download_count === 0;
|
|
617
|
+
};
|
|
618
|
+
var DigitalProductDownloadModal = ({ open, onClose, product, downloadAttribute, onDownload, loading }) => {
|
|
619
|
+
return /* @__PURE__ */ jsx(
|
|
620
|
+
Modal,
|
|
621
|
+
{
|
|
622
|
+
classNames: {
|
|
623
|
+
modal: "modal modal-lg modal-confirm",
|
|
624
|
+
closeButton: "modal-close"
|
|
625
|
+
},
|
|
626
|
+
open,
|
|
627
|
+
onClose,
|
|
628
|
+
center: true,
|
|
629
|
+
closeIcon: null,
|
|
630
|
+
children: /* @__PURE__ */ jsxs("div", { className: "modal-body px-4 py-2", children: [
|
|
631
|
+
/* @__PURE__ */ jsxs("span", { className: "text-2xl block mb-2 fw-regular", children: [
|
|
632
|
+
"Download links for ",
|
|
633
|
+
product?.product_name
|
|
634
|
+
] }),
|
|
635
|
+
/* @__PURE__ */ jsx("hr", { className: "mb-4 mt-2" }),
|
|
636
|
+
/* @__PURE__ */ jsx("div", { className: "download-links", children: loading ? Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsx("div", { className: "w-100 rounded-1 mb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
637
|
+
/* @__PURE__ */ jsxs("div", { className: "w-100", children: [
|
|
638
|
+
/* @__PURE__ */ jsx("div", { className: "shine line w-75" }),
|
|
639
|
+
/* @__PURE__ */ jsx("div", { className: "shine line w-50 mt-2" })
|
|
640
|
+
] }),
|
|
641
|
+
/* @__PURE__ */ jsx("div", { className: "shine w-160 h-32 rounded-1" })
|
|
642
|
+
] }) }, index)) : downloadAttribute.map((attribute, index) => /* @__PURE__ */ jsxs(
|
|
643
|
+
"div",
|
|
644
|
+
{
|
|
645
|
+
className: "flex items-center justify-between mt-3",
|
|
646
|
+
children: [
|
|
647
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
648
|
+
/* @__PURE__ */ jsxs("span", { className: "block text-md lh-1", children: [
|
|
649
|
+
"Download link ",
|
|
650
|
+
index + 1
|
|
651
|
+
] }),
|
|
652
|
+
checkIfLimitReached(attribute) ? /* @__PURE__ */ jsx("span", { className: "text-danger text-sm lh-1", children: "Download link expired." }) : /* @__PURE__ */ jsxs("span", { className: "text-textSecondary text-sm lh-1", children: [
|
|
653
|
+
"Remaining tries: ",
|
|
654
|
+
attribute.download_count,
|
|
655
|
+
" ",
|
|
656
|
+
"\u2022\xA0 Expires",
|
|
657
|
+
" ",
|
|
658
|
+
timeFromNow(attribute.expiry_date)
|
|
659
|
+
] })
|
|
660
|
+
] }),
|
|
661
|
+
/* @__PURE__ */ jsx(
|
|
662
|
+
"button",
|
|
663
|
+
{
|
|
664
|
+
className: "btn btn-text btn-medium",
|
|
665
|
+
onClick: () => onDownload(attribute),
|
|
666
|
+
disabled: checkIfLimitReached(attribute),
|
|
667
|
+
children: "Download"
|
|
668
|
+
}
|
|
669
|
+
)
|
|
670
|
+
]
|
|
671
|
+
},
|
|
672
|
+
`${attribute.download_link}-${index}`
|
|
673
|
+
)) }),
|
|
674
|
+
/* @__PURE__ */ jsxs("p", { className: "text-textSecondary text-sm fw-regular p-2 bg-warning-light rounded-2 mt-4", children: [
|
|
675
|
+
/* @__PURE__ */ jsx("strong", { className: "text-textSecondary", children: "Warning:" }),
|
|
676
|
+
" The download link is time-sensitive and will expire after a set period. You are limited to a specific number of download attempts, with each attempt reducing the remaining tries. To avoid any disruptions, please ensure a stable internet connection before proceeding with the download."
|
|
677
|
+
] })
|
|
678
|
+
] })
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
};
|
|
682
|
+
var digital_product_download_modal_default = DigitalProductDownloadModal;
|
|
568
683
|
|
|
569
|
-
export { address_form_default2 as AddressForm, search_dropdown_default2 as SearchDropdown };
|
|
684
|
+
export { address_form_default2 as AddressForm, digital_product_download_modal_default as DigitalProductDownloadModal, search_dropdown_default2 as SearchDropdown, share_button_default as ShareButton, ShareIcon };
|