Skip to content

Instantly share code, notes, and snippets.

@00MB
Created July 15, 2022 12:30
Show Gist options
  • Save 00MB/25b106bccd4d1a92e2aa6f35b2ba4572 to your computer and use it in GitHub Desktop.
Save 00MB/25b106bccd4d1a92e2aa6f35b2ba4572 to your computer and use it in GitHub Desktop.
heliopay
var $8zHUo$reactjsxruntime = require("react/jsx-runtime");
var $8zHUo$react = require("react");
var $8zHUo$reactdom = require("react-dom");
var $8zHUo$heliofihelioicons = require("@heliofi/helio-icons");
var $8zHUo$styledcomponents = require("styled-components");
var $8zHUo$heliofisolanaadapter = require("@heliofi/solana-adapter");
var $8zHUo$projectserumanchor = require("@project-serum/anchor");
var $8zHUo$solanawalletadapterreact = require("@solana/wallet-adapter-react");
var $8zHUo$solanawalletadapterbase = require("@solana/wallet-adapter-base");
var $8zHUo$solanawalletadapterreactui = require("@solana/wallet-adapter-react-ui");
var $8zHUo$solanawalletadapterwallets = require("@solana/wallet-adapter-wallets");
var $8zHUo$solanaweb3js = require("@solana/web3.js");
var $8zHUo$awsamplify = require("aws-amplify");
var $8zHUo$formik = require("formik");
var $8zHUo$yup = require("yup");
var $8zHUo$downshift = require("downshift");
function $parcel$exportWildcard(dest, source) {
Object.keys(source).forEach(function(key) {
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
return;
}
Object.defineProperty(dest, key, {
enumerable: true,
get: function get() {
return source[key];
}
});
});
return dest;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
var $5dcc767f924b770d$exports = {};
$parcel$export($5dcc767f924b770d$exports, "Card", () => $07c424f3b823958c$export$60332b2344f7fe41);
$parcel$export($5dcc767f924b770d$exports, "LoadingModal", () => $50eae0a3751f928b$export$a530fe7a272dd531);
$parcel$export($5dcc767f924b770d$exports, "HelioPay", () => $65ec508d08439ab7$export$1c90827ac4b58be8);
const $07c424f3b823958c$export$60332b2344f7fe41 = ({ children: children , className: className })=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
className: `${className} overflow-visible rounded-lg bg-white shadow`,
children: children
});
const $f420d294c40a72d3$var$HelioIcon = ()=>{
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("svg", {
width: "46",
height: "46",
viewBox: "0 0 46 46",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M20.5675 31.9001C19.0155 31.4887 17.6051 30.6639 16.4799 29.5195C15.3336 28.3962 14.5088 26.9858 14.0992 25.4319C13.6782 23.8435 13.705 22.171 14.1739 20.596L7.78407 18.2709C6.89612 21.0304 6.78513 23.9813 7.46449 26.8002C8.14193 29.6209 9.58102 32.1967 11.6268 34.254C11.6478 34.275 11.6689 34.2922 11.6899 34.3133C11.711 34.3343 11.7282 34.3554 11.7492 34.3764C13.8045 36.4203 16.3823 37.8613 19.203 38.5387C22.0219 39.2181 24.9728 39.1071 27.7323 38.2191L25.4015 31.8274C23.8265 32.2963 22.1539 32.3192 20.5675 31.9001Z",
fill: "#F76C1B"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M23.0187 14.1851C25.2979 14.2521 27.4623 15.1879 29.0736 16.7992C29.0946 16.8202 29.1138 16.8432 29.1329 16.8623C29.154 16.8834 29.1769 16.9025 29.1961 16.9217C30.8074 18.533 31.7413 20.6993 31.8102 22.9766C31.8771 25.2558 31.0734 27.4718 29.5597 29.1769L34.3802 33.9975C37.3292 31.0485 38.9884 27.047 38.9884 22.8751C38.9903 18.7052 37.3331 14.7056 34.3822 11.7547C34.3592 11.7318 34.3343 11.7107 34.3094 11.6858C34.2884 11.6648 34.2654 11.638 34.2425 11.615C31.2935 8.66603 27.292 7.00686 23.1201 7.00686C18.9483 7.00686 14.9468 8.66603 11.9978 11.615L16.8184 16.4356C18.5215 14.9238 20.7395 14.1181 23.0187 14.1851Z",
fill: "#F76C1B"
})
]
});
};
var $f420d294c40a72d3$export$2e2bcd8739ae039 = $f420d294c40a72d3$var$HelioIcon;
const $24a4a0dd0dbb739c$export$8a776f14d89aa9ff = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgb(0 0 0 / 50%);
display: flex;
justify-content: center;
align-items: flex-start;
padding-top: 120px;
*,
*:before,
*:after {
box-sizing: border-box;
}
`;
const $24a4a0dd0dbb739c$export$d9e0000d8e58e539 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 400px;
padding: 24px;
background: #ffffff;
box-shadow: 0px 4px 20px rgba(156, 163, 175, 0.15);
border-radius: 8px;
`;
const $24a4a0dd0dbb739c$export$d16d4758aede78d8 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
position: relative;
padding-right: 50px;
`;
const $24a4a0dd0dbb739c$export$c7f2e9d539e11208 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 8px;
${({ spin: spin })=>spin && `
animation: spin 1s linear infinite;
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`}
svg,
img,
div {
width: 100%;
height: 100%;
object-fit: contain;
}
`;
const $24a4a0dd0dbb739c$export$110bbbe8db58a02b = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 700;
font-size: 16px;
line-height: 140%;
color: #5a6578;
`;
const $24a4a0dd0dbb739c$export$bf2130e73c45c48 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
position: absolute;
top: 0;
right: 0;
width: 32px;
height: 32px;
cursor: pointer;
svg {
width: 100%;
height: 100%;
fill: #9ca3af;
}
`;
const $24a4a0dd0dbb739c$export$81645ce662b26656 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
padding-top: 20px;
`;
const $f80b45cbc2e4b97b$export$2b77a92f1a5ad772 = ({ title: title , onHide: onHide , children: children , icon: icon , animateIcon: animateIcon = false , closeOnClickOutside: closeOnClickOutside = false , })=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $24a4a0dd0dbb739c$export$8a776f14d89aa9ff), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $24a4a0dd0dbb739c$export$d9e0000d8e58e539), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $24a4a0dd0dbb739c$export$d16d4758aede78d8), {
children: [
icon && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $24a4a0dd0dbb739c$export$c7f2e9d539e11208), {
spin: animateIcon,
children: icon
}),
title && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $24a4a0dd0dbb739c$export$110bbbe8db58a02b), {
children: title
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $24a4a0dd0dbb739c$export$bf2130e73c45c48), {
onClick: onHide,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.CrossIcon), {})
})
]
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $24a4a0dd0dbb739c$export$81645ce662b26656), {
children: children
})
]
})
});
var $f80b45cbc2e4b97b$export$2e2bcd8739ae039 = $f80b45cbc2e4b97b$export$2b77a92f1a5ad772;
const $249a596dd32680bd$export$5fa75be4c074112 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
padding-top: 40px;
`;
const $249a596dd32680bd$export$c705ebf61df9051d = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 700;
font-size: 30px;
line-height: 125%;
color: #000000;
padding-bottom: 4px;
`;
const $249a596dd32680bd$export$93797548e0e3cb3c = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 125%;
color: #000000;
`;
const $249a596dd32680bd$export$142440d2a540abc2 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).a`
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 125%;
text-decoration-line: underline;
color: #f76c1b;
margin-top: 65px;
display: inline-block;
`;
const $50eae0a3751f928b$export$a530fe7a272dd531 = ({ onHide: onHide })=>/*#__PURE__*/ (0, ($parcel$interopDefault($8zHUo$reactdom))).createPortal(/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $f80b45cbc2e4b97b$export$2b77a92f1a5ad772), {
onHide: onHide,
icon: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $f420d294c40a72d3$export$2e2bcd8739ae039), {}),
animateIcon: true,
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $249a596dd32680bd$export$5fa75be4c074112), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $249a596dd32680bd$export$c705ebf61df9051d), {
children: "Processing.."
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $249a596dd32680bd$export$93797548e0e3cb3c), {
children: "Approving trasnsaction"
})
]
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $249a596dd32680bd$export$142440d2a540abc2), {
href: "https://docs.hel.io/",
target: "_blank",
rel: "noreferrer",
children: "Need help?"
})
]
})
}), document.body);
var $9701ba2273add435$exports = {};
var $d3dafd66e4f28ca2$exports = {};
$parcel$export($d3dafd66e4f28ca2$exports, "AnchorProvider", () => $d3dafd66e4f28ca2$export$1d7e255c6105d39b);
const $7b0da4c5826b088d$export$8f73317645bb7b8e = /*#__PURE__*/ (0, $8zHUo$react.createContext)(null);
const $7b0da4c5826b088d$export$dd8c890eb4723001 = ()=>(0, $8zHUo$react.useContext)($7b0da4c5826b088d$export$8f73317645bb7b8e);
const $d3dafd66e4f28ca2$var$opts = {
preflightCommitment: "processed"
};
const $d3dafd66e4f28ca2$export$1d7e255c6105d39b = ({ children: children })=>{
const wallet = (0, $8zHUo$solanawalletadapterreact.useAnchorWallet)();
const { connection: connection } = (0, $8zHUo$solanawalletadapterreact.useConnection)();
const programProvider = (0, $8zHUo$react.useMemo)(()=>{
if (!wallet) return null;
const provider = new (0, $8zHUo$projectserumanchor.Provider)(connection, wallet, $d3dafd66e4f28ca2$var$opts);
return new (0, $8zHUo$projectserumanchor.Program)((0, $8zHUo$heliofisolanaadapter.IDL), (0, $8zHUo$heliofisolanaadapter.PROGRAM_ID), provider);
}, [
wallet,
connection
]);
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $7b0da4c5826b088d$export$8f73317645bb7b8e).Provider, {
value: programProvider,
children: children
});
};
var $1f35fb592a369309$exports = {};
$parcel$export($1f35fb592a369309$exports, "SolanaProvider", () => $1f35fb592a369309$export$c5409cdf1943e1a3);
let $17b52f92b27b101e$export$a5bc4a64e9e6804a;
(function(HttpCodes1) {
HttpCodes1[HttpCodes1["SUCCESS"] = 200] = "SUCCESS";
HttpCodes1[HttpCodes1["NOT_FOUNT"] = 404] = "NOT_FOUNT";
HttpCodes1[HttpCodes1["BAD_REQUEST"] = 400] = "BAD_REQUEST";
HttpCodes1[HttpCodes1["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
})($17b52f92b27b101e$export$a5bc4a64e9e6804a || ($17b52f92b27b101e$export$a5bc4a64e9e6804a = {}));
let $2a2b81c25ae8d7fe$export$aad5b37c780fee8b;
(function(ClusterType1) {
ClusterType1["Mainnet"] = "mainnet-beta";
ClusterType1["Testnet"] = "testnet";
ClusterType1["Devnet"] = "devnet";
})($2a2b81c25ae8d7fe$export$aad5b37c780fee8b || ($2a2b81c25ae8d7fe$export$aad5b37c780fee8b = {}));
let $f903f862c4742328$export$cea649f8e2f11986;
(function(DefaultCurrencies1) {
DefaultCurrencies1["USDC"] = "USDC";
DefaultCurrencies1["SOL"] = "SOL";
})($f903f862c4742328$export$cea649f8e2f11986 || ($f903f862c4742328$export$cea649f8e2f11986 = {}));
class $d60209765fa3b57f$export$2684242beaf2882f {
static amountToUSD(amount) {
return "$" + amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
static roundValue(amount, decimals) {
return parseFloat(String(amount)).toFixed(decimals);
}
static setPeggedCurrency(amount, currency) {
return ($d60209765fa3b57f$export$2684242beaf2882f.getCurrencyBySymbol(currency).sign || "") + amount;
}
static setCurrencies(currencies) {
$d60209765fa3b57f$export$2684242beaf2882f.currencies = currencies;
}
static getCurrencyBySymbol(symbol) {
const currency1 = $d60209765fa3b57f$export$2684242beaf2882f.currencies?.find((currency)=>currency.symbol === symbol);
if (currency1 == null) throw new Error(`Unable to find currency: ${currency1}`);
return currency1;
}
static getDefaultCurrencySymbol() {
return (0, $f903f862c4742328$export$cea649f8e2f11986).USDC;
}
static getDefaultCurrency() {
return $d60209765fa3b57f$export$2684242beaf2882f.getCurrencyBySymbol($d60209765fa3b57f$export$2684242beaf2882f.getDefaultCurrencySymbol());
}
static getCurrenciesCount() {
return $d60209765fa3b57f$export$2684242beaf2882f.currencies.length;
}
static isSolPayment(symbol) {
return $d60209765fa3b57f$export$2684242beaf2882f.getCurrencyBySymbol(symbol).symbol === $d60209765fa3b57f$export$2684242beaf2882f.getSolCurrencySymbol();
}
static getSolCurrencySymbol() {
return (0, $f903f862c4742328$export$cea649f8e2f11986).SOL;
}
}
const $396769fae9df288e$var$config = '{"aws_project_region":"eu-west-1","aws_appsync_graphqlEndpoint":"https://r3wnlhc6kfe4xbl42xh4xecjyq.appsync-api.eu-west-1.amazonaws.com/graphql","aws_appsync_region":"eu-west-1","aws_appsync_authenticationType":"AWS_IAM","aws_appsync_apiKey":"da2-vfyfapxfzzcd5fau56wo7uwxnq","aws_cloud_logic_custom":[{"name":"heliomerchant","endpoint":"https://0p104a9qb6.execute-api.eu-west-1.amazonaws.com/test","region":"eu-west-1"}],"aws_cognito_identity_pool_id":"eu-west-1:12b8fde5-3589-40d3-b0c1-250c17640b20","aws_cognito_region":"eu-west-1","aws_user_pools_id":"eu-west-1_Pqzmf5hKU","aws_user_pools_web_client_id":"73ib9ts9qlgjf1nnib6rucs0bq","oauth":{},"aws_cognito_username_attributes":[],"aws_cognito_social_providers":[],"aws_cognito_signup_attributes":["EMAIL"],"aws_cognito_mfa_configuration":"OFF","aws_cognito_mfa_types":["SMS"],"aws_cognito_password_protection_settings":{"passwordPolicyMinLength":8,"passwordPolicyCharacters":[]},"aws_cognito_verification_mechanisms":["EMAIL"],"aws_user_files_s3_bucket":"helioimages153344-test","aws_user_files_s3_bucket_region":"eu-west-1"}';
const $396769fae9df288e$export$499fb6d65ff63a5e = ()=>{
if ($396769fae9df288e$var$config == null) throw new Error("Please provide NEXT_PUBLIC_AWS_CONFIG as env variable");
return JSON.parse($396769fae9df288e$var$config);
};
const $cee2a81b5e4e9eb6$export$c29d011687c8c231 = "\n query CurrenciesByOrder(\n $type: String!\n $order: ModelIntKeyConditionInput\n $sortDirection: ModelSortDirection\n $filter: ModelCurrencyFilterInput\n $limit: Int\n $nextToken: String\n ) {\n currenciesByOrder(\n type: $type\n order: $order\n sortDirection: $sortDirection\n filter: $filter\n limit: $limit\n nextToken: $nextToken\n ) {\n items {\n id\n symbol\n name\n mintAddress\n decimals\n coinMarketCapId\n type\n sign\n order\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n";
(0, $8zHUo$awsamplify.Amplify).configure((0, $396769fae9df288e$export$499fb6d65ff63a5e)());
let $45e184d90a0e847e$var$AuthMode;
(function(AuthMode1) {
AuthMode1["AWS_LAMBDA"] = "AWS_LAMBDA";
AuthMode1["API_KEY"] = "API_KEY";
})($45e184d90a0e847e$var$AuthMode || ($45e184d90a0e847e$var$AuthMode = {}));
const $45e184d90a0e847e$export$c93407251c80de24 = (cluster)=>{
switch(cluster){
case (0, $2a2b81c25ae8d7fe$export$aad5b37c780fee8b).Testnet:
case (0, $2a2b81c25ae8d7fe$export$aad5b37c780fee8b).Devnet:
return "https://test.api.hel.io";
case (0, $2a2b81c25ae8d7fe$export$aad5b37c780fee8b).Mainnet:
return "https://prod.api.hel.io";
default:
return "https://test.api.hel.io";
}
};
const $45e184d90a0e847e$export$858af8e7e02b8a8d = {
async getPaymentRequestByIdPublic (id, cluster) {
const HELIO_BASE_API_URL = $45e184d90a0e847e$export$c93407251c80de24(cluster);
const url = `${HELIO_BASE_API_URL}/payment-request/${id}`;
const paymentResult = await (await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json"
}
})).json();
return paymentResult;
},
listCurrencies: async ()=>{
const result = await (0, $8zHUo$awsamplify.API).graphql({
query: (0, $cee2a81b5e4e9eb6$export$c29d011687c8c231),
variables: {
type: "token"
},
authMode: $45e184d90a0e847e$var$AuthMode.API_KEY
});
return result.data?.currenciesByOrder?.items || [];
}
};
const $2f138ba4c0da2b96$export$9211e20bd4453b2f = /*#__PURE__*/ (0, $8zHUo$react.createContext)({
currencyList: [],
setCurrencyList: ()=>{},
paymentDetails: null,
setPaymentDetails: ()=>{},
cluster: null,
setCluster: ()=>{}
});
const $2f138ba4c0da2b96$export$78de68c6948c799f = ()=>{
const { currencyList: currencyList , setCurrencyList: setCurrencyList , paymentDetails: paymentDetails , setPaymentDetails: setPaymentDetails , cluster: cluster1 , setCluster: setCluster , } = (0, $8zHUo$react.useContext)($2f138ba4c0da2b96$export$9211e20bd4453b2f);
const getCurrencyList = async ()=>{
const result = await (0, $45e184d90a0e847e$export$858af8e7e02b8a8d).listCurrencies();
setCurrencyList(result || []);
(0, $d60209765fa3b57f$export$2684242beaf2882f).setCurrencies(result);
};
const getPaymentDetails = async (paymentRequestId)=>{
setPaymentDetails(null);
if (!cluster1) throw new Error("Please provide a cluster");
const result = await (0, $45e184d90a0e847e$export$858af8e7e02b8a8d).getPaymentRequestByIdPublic(paymentRequestId, cluster1);
setPaymentDetails(result || {});
};
const initCluster = (cluster)=>{
setCluster(cluster);
};
return {
currencyList: currencyList,
paymentDetails: paymentDetails,
getCurrencyList: getCurrencyList,
getPaymentDetails: getPaymentDetails,
cluster: cluster1,
initCluster: initCluster
};
};
const $43484e65f1c3bffc$export$2cf855dff8fa0423 = ({ children: children })=>{
const [currencyList, setCurrencyList] = (0, $8zHUo$react.useState)([]);
const [paymentDetails, setPaymentDetails] = (0, $8zHUo$react.useState)(null);
const [cluster, setCluster] = (0, $8zHUo$react.useState)(null);
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2f138ba4c0da2b96$export$9211e20bd4453b2f).Provider, {
value: {
currencyList: currencyList,
setCurrencyList: setCurrencyList,
paymentDetails: paymentDetails,
setPaymentDetails: setPaymentDetails,
cluster: cluster,
setCluster: setCluster
},
children: children
});
};
const $1f35fb592a369309$export$c5409cdf1943e1a3 = ({ children: children , cluster: cluster })=>{
const network = cluster == (0, $2a2b81c25ae8d7fe$export$aad5b37c780fee8b).Devnet ? (0, $8zHUo$solanawalletadapterbase.WalletAdapterNetwork).Devnet : (0, $8zHUo$solanawalletadapterbase.WalletAdapterNetwork).Mainnet;
const endpoint = (0, $8zHUo$react.useMemo)(()=>(0, $8zHUo$solanaweb3js.clusterApiUrl)(network), [
network
]);
const wallets = (0, $8zHUo$react.useMemo)(()=>[
new (0, $8zHUo$solanawalletadapterwallets.PhantomWalletAdapter)(),
new (0, $8zHUo$solanawalletadapterwallets.SlopeWalletAdapter)(),
new (0, $8zHUo$solanawalletadapterwallets.SolflareWalletAdapter)({
network: network
}),
], [
network
]);
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$solanawalletadapterreact.ConnectionProvider), {
endpoint: endpoint,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$solanawalletadapterreact.WalletProvider), {
wallets: wallets,
autoConnect: true,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$solanawalletadapterreactui.WalletModalProvider), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $d3dafd66e4f28ca2$export$1d7e255c6105d39b), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $43484e65f1c3bffc$export$2cf855dff8fa0423), {
children: children
})
})
})
})
});
};
$parcel$exportWildcard($9701ba2273add435$exports, $d3dafd66e4f28ca2$exports);
$parcel$exportWildcard($9701ba2273add435$exports, $1f35fb592a369309$exports);
const $80fa29dfee0cd44c$export$1a544859460ce168 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: inline-block;
width: 100%;
.wallet-adapter-button-trigger {
background-color: ${(props)=>props.theme.colors.primary};
border: none;
box-shadow: 0px 4px 12px rgba(247, 108, 27, 0.4);
border-radius: 8px;
color: #fff;
padding: 12px;
font-weight: 700;
font-size: 14px;
line-height: 125%;
height: 48px;
cursor: pointer;
width: 100%;
text-align: center;
justify-content: center;
&:hover {
background-color: ${(props)=>props.theme.colors.primary};
}
}
`;
const $17bf6ea4f99be17e$export$79b5060180039794 = ()=>{
const { connecting: connecting } = (0, $8zHUo$solanawalletadapterreact.useWallet)();
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $80fa29dfee0cd44c$export$1a544859460ce168), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$solanawalletadapterreactui.WalletMultiButton), {
startIcon: undefined,
children: connecting ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("span", {
children: "CONNECTING..."
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("span", {
className: "rounded-full",
children: "CONNECT WALLET"
})
})
});
};
var $17bf6ea4f99be17e$export$2e2bcd8739ae039 = $17bf6ea4f99be17e$export$79b5060180039794;
const $128d52fcbee1094e$export$2d5d2ba3c7c8c40b = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).button`
background: ${(props)=>props.theme.colors.primary};
border: none;
box-shadow: 0px 4px 12px rgba(247, 108, 27, 0.4);
border-radius: 8px;
color: #fff;
padding: 12px;
font-weight: 700;
font-size: 14px;
line-height: 125%;
width: 100%;
height: 48px;
cursor: pointer;
user-select: none;
&:disabled {
cursor: not-allowed;
}
`;
const $092b6831bbf3b794$var$Button = ({ children: children , ...props })=>{
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $128d52fcbee1094e$export$2d5d2ba3c7c8c40b), {
...props,
children: children
});
};
var $092b6831bbf3b794$export$2e2bcd8739ae039 = $092b6831bbf3b794$var$Button;
const $82ec9399ddea996c$export$f9ba527e25c2bc92 = {
ESC: "Escape"
};
const $8d7ad93b083c830d$var$useOnClickOutside = (onClose)=>{
const ref = (0, $8zHUo$react.useRef)(null);
const escapeListener = (0, $8zHUo$react.useCallback)((e)=>{
if (e.key === (0, $82ec9399ddea996c$export$f9ba527e25c2bc92).ESC) onClose();
}, []);
const clickListener = (0, $8zHUo$react.useCallback)((e)=>{
if (!ref.current.contains(e.target)) onClose?.();
}, [
ref.current
]);
(0, $8zHUo$react.useEffect)(()=>{
document.addEventListener("click", clickListener);
document.addEventListener("keyup", escapeListener);
return ()=>{
document.removeEventListener("click", clickListener);
document.removeEventListener("keyup", escapeListener);
};
}, []);
return ref;
};
var $8d7ad93b083c830d$export$2e2bcd8739ae039 = $8d7ad93b083c830d$var$useOnClickOutside;
const $d7167569386d0d4c$export$6969335ea1e4e77c = (target, source)=>{
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(source))if (source[key] instanceof Object) Object.assign(source[key], $d7167569386d0d4c$export$6969335ea1e4e77c(target[key], source[key]));
// Join `target` and modified `source`
Object.assign(target || {}, source);
return target;
};
const $d7167569386d0d4c$export$1184c6d59ee70d77 = (address)=>{
if (address == "null") return "N/A";
return `${address.slice(0, 6)}..${address.slice(-3)}`;
};
const $d7167569386d0d4c$export$d255a53dfa808aa7 = (str, start, end)=>{
const result = str.match(new RegExp(start + "(.*)" + end));
if (result == null || result.length < 1) return undefined;
return result[1].trim();
};
const $d7167569386d0d4c$export$3fde1aac5afb2bc6 = (obj)=>{
const newObj = {
...obj
};
Object.keys(newObj).forEach((key)=>{
if (newObj[key] === undefined) delete newObj[key];
});
return newObj;
};
const $cb297e41428236a3$export$c98b736faf5575f6 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
position: relative;
`;
const $cb297e41428236a3$export$f48bda32bee484ec = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
background: #ffffff;
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.05),
0px 8px 10px rgba(195, 200, 209, 0.2);
border-radius: 8px;
position: absolute;
top: 100%;
margin-top: 10px;
min-width: 165px;
overflow: hidden;
`;
const $cb297e41428236a3$export$cae703c457e46f23 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
padding: 13px 11px;
cursor: pointer;
white-space: nowrap;
transition: all 0.3s ease-in-out;
&:hover {
background: #fff8f4;
}
`;
const $cb297e41428236a3$export$a9ce7d322be3fd53 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 24px;
height: 24px;
margin-right: 11px;
svg {
width: 100%;
height: 100%;
fill: ${({ theme: theme })=>theme.colors.primary};
}
path {
fill: ${({ theme: theme })=>theme.colors.primary};
}
`;
const $cb297e41428236a3$export$ca9dbc68a4fd6b8d = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 125%;
color: #f76c1b;
`;
const $cb297e41428236a3$export$44f08023ef489e07 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
cursor: pointer;
font-family: 'Arial', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 140%;
color: #9ca3af;
display: flex;
align-items: center;
user-select: none;
`;
const $cb297e41428236a3$export$eaacb7a4d16e9968 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).span`
color: ${(props)=>props.theme.colors.primary};
margin-left: 4px;
display: flex;
align-items: center;
&::after {
content: '';
width: 0;
height: 0;
border-top: solid 6px ${(props)=>props.theme.colors.primary};
border-left: solid 6px transparent;
border-right: solid 6px transparent;
margin-left: 10px;
}
`;
const $bf3a1cd4c32738d7$var$WalletController = ()=>{
const { setVisible: setVisible } = (0, $8zHUo$solanawalletadapterreactui.useWalletModal)();
const { disconnect: disconnect , publicKey: publicKey } = (0, $8zHUo$solanawalletadapterreact.useWallet)();
const [isOpen, setIsOpen] = (0, $8zHUo$react.useState)(false);
const handleClickOutside = ()=>{
setIsOpen(false);
};
const dropdownRef = (0, $8d7ad93b083c830d$export$2e2bcd8739ae039)(handleClickOutside);
const items = [
{
label: "Change wallet",
action: ()=>{
setIsOpen(false);
setVisible(true);
},
icon: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.ArrowsDoubleIcon), {})
},
{
label: "Disconnect Wallet",
action: ()=>{
setIsOpen(false);
disconnect();
},
icon: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.ExitIcon), {})
},
];
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $cb297e41428236a3$export$c98b736faf5575f6), {
ref: dropdownRef,
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $cb297e41428236a3$export$44f08023ef489e07), {
onClick: ()=>setIsOpen(!isOpen),
children: [
"Connected",
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $cb297e41428236a3$export$eaacb7a4d16e9968), {
children: (0, $d7167569386d0d4c$export$1184c6d59ee70d77)(String(publicKey))
})
]
}),
isOpen && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $cb297e41428236a3$export$f48bda32bee484ec), {
children: items.map(({ label: label , action: action , icon: icon })=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $cb297e41428236a3$export$cae703c457e46f23), {
onClick: action,
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $cb297e41428236a3$export$a9ce7d322be3fd53), {
children: icon
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $cb297e41428236a3$export$ca9dbc68a4fd6b8d), {
children: label
})
]
}, label))
})
]
});
};
var $bf3a1cd4c32738d7$export$2e2bcd8739ae039 = $bf3a1cd4c32738d7$var$WalletController;
const $b2ec992c8303f413$export$1f99da106a398c44 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
*, *:before, *:after {
box-sizing: border-box;
}
`;
const $b2ec992c8303f413$export$81761b52b04ea573 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
margin-bottom: 4px;
max-width: 270px;
`;
const $b2ec992c8303f413$export$221f581ac9e6dce = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
max-width: 160px;
flex: 1;
`;
const $b2ec992c8303f413$export$ced921df2f20b82 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
margin-left: 12px;
font-family: 'Arial', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 140%;
color: #9ca3af;
`;
const $b2ec992c8303f413$export$28be41ac4e8a64c4 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 45px;
height: 16px;
margin-top: 2px;
display: block;
`;
const $b2ec992c8303f413$export$f81d233d83b4f9e7 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
`;
const $b2ec992c8303f413$export$7e30077cd8dfa6f4 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
color: #ff0000;
font-size: 12px;
font-weight: 400;
line-height: 1.5;
margin-top: 4px;
`;
const $b2ec992c8303f413$export$40edfd27ba0f9274 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
margin-left: 8px;
background-color: #9ca3af;
border-radius: 20px;
padding: 5px 6px 4px;
margin-top: 4px;
font-size: 8px;
font-weight: 700;
letter-spacing: 0.5px;
line-height: 1;
color: #fff;
user-select: none;
`;
const $f8673c9442cde184$var$HelioLogoGray = ()=>{
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("svg", {
width: "46",
height: "16",
viewBox: "0 0 46 16",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M7.20331 15.6365V9.14532C7.20331 7.66547 6.43141 7.20146 5.21984 7.20146C4.74708 7.21203 4.28302 7.33105 3.86327 7.54937C3.44352 7.76769 3.07923 8.07951 2.79835 8.46091V15.6365H0V0.90918H2.79835V6.36293C3.26723 5.83356 3.84427 5.41156 4.49026 5.12562C5.13625 4.83967 5.83606 4.69648 6.54215 4.70576C8.87603 4.70576 10 5.98675 10 8.06319V15.6365H7.20331Z",
fill: "#9CA3AF"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M17.232 15.8181C13.9914 15.8181 11.6364 13.5749 11.6364 10.09C11.6364 6.60503 13.931 4.36353 17.232 4.36353C20.4525 4.36353 22.727 6.54662 22.727 9.84962C22.7302 10.2117 22.7033 10.5735 22.6465 10.9312H14.4946C14.6355 12.5735 15.7626 13.4948 17.1783 13.4948C18.386 13.4948 19.0502 12.8939 19.4126 12.1596H22.4519C21.8481 14.1958 19.9963 15.8181 17.232 15.8181ZM14.5147 9.05016H19.8151C19.7749 7.58809 18.6074 6.66678 17.1582 6.66678C15.8096 6.66678 14.7428 7.528 14.5214 9.05016H14.5147Z",
fill: "#9CA3AF"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M24.1818 0.90918H26.909V15.6365H24.1818V0.90918Z",
fill: "#9CA3AF"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M28.7273 1.63561C28.7273 0.718072 29.4517 0 30.4579 0C31.4641 0 32.1818 0.711423 32.1818 1.63561C32.1818 2.5598 31.4373 3.27122 30.4512 3.27122C29.4652 3.27122 28.7273 2.5465 28.7273 1.63561ZM29.0291 4.58769H31.8464V15.6364H29.0291V4.58769Z",
fill: "#9CA3AF"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M42.5692 9.81818C42.5192 8.9767 42.1497 8.18608 41.5362 7.60795C40.9227 7.02983 40.1116 6.70786 39.2686 6.70786C38.4256 6.70786 37.6145 7.02983 37.001 7.60795C36.3875 8.18608 36.018 8.9767 35.968 9.81818H33.4546C33.4546 8.2751 34.0676 6.79523 35.1587 5.70411C36.2498 4.61299 37.7297 4 39.2728 4C40.8158 4 42.2957 4.61299 43.3868 5.70411C44.478 6.79523 45.091 8.2751 45.091 9.81818H42.5692Z",
fill: "#9CA3AF"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
d: "M39.395 16.0001C38.3049 16.0002 37.2369 15.6902 36.3145 15.1056C35.3921 14.5211 34.6527 13.686 34.1818 12.6966L36.4424 11.6365C36.7064 12.1827 37.115 12.6452 37.6232 12.9729C38.1314 13.3007 38.7196 13.4811 39.3231 13.4943C39.9266 13.5075 40.522 13.3531 41.0439 13.0479C41.5659 12.7427 41.9941 12.2986 42.2814 11.7644L44.5454 12.8263C44.0588 13.7798 43.321 14.5803 42.4125 15.1401C41.5041 15.6999 40.4602 15.9974 39.395 16.0001Z",
fill: "#9CA3AF"
})
]
});
};
var $f8673c9442cde184$export$2e2bcd8739ae039 = $f8673c9442cde184$var$HelioLogoGray;
const $ac9ad45b25632a31$var$validationSchema = $8zHUo$yup.object({
fullName: $8zHUo$yup.string().when("requireFullName", {
is: true,
then: $8zHUo$yup.string().required("Full name is required")
}),
customPrice: $8zHUo$yup.number().when("canChangePrice", {
is: true,
then: $8zHUo$yup.number().required("Price is required")
}),
quantity: $8zHUo$yup.number().when("canChangeQuantity", {
is: true,
then: $8zHUo$yup.number().typeError("Quantity has to be a number").positive("Quantity must be a positive number").required("Quantity is required")
}),
email: $8zHUo$yup.string().when("requireEmail", {
is: true,
then: $8zHUo$yup.string().email().required("E-mail address is required")
}),
discordUsername: $8zHUo$yup.string().when("requireDiscordUsername", {
is: true,
then: $8zHUo$yup.string().required("Discord username is required")
}),
twitterUsername: $8zHUo$yup.string().when("requireTwitterUsername", {
is: true,
then: $8zHUo$yup.string().required("Twitter username is required")
}),
country: $8zHUo$yup.string().when("requireCountry", {
is: true,
then: $8zHUo$yup.string().required("Country is required")
}),
deliveryAddress: $8zHUo$yup.string().when("requireDeliveryAddress", {
is: true,
then: $8zHUo$yup.string().required("Shipping address is required")
})
});
var $ac9ad45b25632a31$export$2e2bcd8739ae039 = $ac9ad45b25632a31$var$validationSchema;
class $37cdb6eb4c28b28b$export$f894d240fcbfa580 {
static convertFromMinimalUnits(currency, minimalAmount) {
const currencyMeta = currency;
if (currencyMeta == null) return 0;
return minimalAmount / Math.pow(10, currencyMeta.decimals);
}
static convertToMinimalUnits(currency, actualAmount) {
if (currency == null || actualAmount == null) return 0;
const currencyMeta = currency;
if (currencyMeta == null) return 0;
return Math.round(Math.pow(10, currencyMeta.decimals) * actualAmount);
}
}
const $286a50aa8ba13d50$export$b6fc3b0e5138327b = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
justify-content: space-between;
background: #ffffff;
border: 1px solid #ececec;
border-radius: 8px;
min-height: 48px;
transition: all 0.3s ease-in-out;
${({ focus: focus })=>focus && `
border-color: #F76C1B;
`}
`;
const $286a50aa8ba13d50$export$3e4fab27752c504f = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).span`
font-size: 16px;
font-weight: 400;
line-height: 1.5;
margin-left: 12px;
`;
const $286a50aa8ba13d50$export$e23718a891aaefd = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).span`
margin-right: 12px;
`;
const $286a50aa8ba13d50$export$339b1cddb0b6e766 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
border: none;
width: 100%;
padding: 12px;
border-radius: 8px;
font-size: 14px;
`;
const $4ba2198f74114cf5$var$InputContainer = ({ className: className , inactive: inactive , placeholder: placeholder , fieldValue: fieldValue , prefix: prefix , suffix: suffix , children: children , focus: focus })=>{
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $286a50aa8ba13d50$export$b6fc3b0e5138327b), {
className: className,
focus: focus,
children: [
prefix && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $286a50aa8ba13d50$export$3e4fab27752c504f), {
children: prefix
}),
inactive ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $286a50aa8ba13d50$export$339b1cddb0b6e766), {
children: fieldValue ?? placeholder
}) : children,
suffix && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $286a50aa8ba13d50$export$e23718a891aaefd), {
children: suffix
})
]
});
};
var $4ba2198f74114cf5$export$2e2bcd8739ae039 = $4ba2198f74114cf5$var$InputContainer;
const $82b6d7abc0c1b7db$export$a195049fd73b3fe2 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
margin-bottom: 12px;
user-select: none;
`;
const $82b6d7abc0c1b7db$export$ed4eff50d964b03e = (0, ($parcel$interopDefault($8zHUo$styledcomponents)))((0, $8zHUo$formik.Field))`
border: none;
width: 100%;
padding: 12px;
border-radius: 8px;
font-size: 14px;
color: #5a6578;
&:focus {
outline: none;
}
&::placeholder {
color: #5a6578;
opacity: 0.5;
}
${({ as: as })=>as === "textarea" && `
padding: 12px;
height: 64px;
`}
`;
const $82b6d7abc0c1b7db$export$7e30077cd8dfa6f4 = (0, ($parcel$interopDefault($8zHUo$styledcomponents)))((0, $8zHUo$formik.ErrorMessage))`
color: #ff0000;
font-size: 12px;
font-weight: 400;
line-height: 1.5;
margin-top: 4px;
`;
const $82b6d7abc0c1b7db$export$eea83358d9434634 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).label`
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
margin-bottom: 5px;
color: #9ca3af;
display: block;
`;
const $b6f0dafea9b9d36c$var$Input = ({ placeholder: placeholder , fieldId: fieldId , fieldAs: fieldAs , fieldValue: fieldValue , fieldName: fieldName , prefix: prefix , suffix: suffix , inactive: inactive , disabled: disabled , onChange: onChange , inputClassName: inputClassName = "" , label: label , })=>{
const [focus, setFocus] = (0, $8zHUo$react.useState)(false);
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $82b6d7abc0c1b7db$export$a195049fd73b3fe2), {
children: [
label && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $82b6d7abc0c1b7db$export$eea83358d9434634), {
htmlFor: fieldId,
children: label
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $4ba2198f74114cf5$export$2e2bcd8739ae039), {
placeholder: placeholder,
prefix: prefix,
suffix: suffix,
inactive: inactive,
fieldValue: fieldValue,
focus: focus,
children: fieldValue ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $82b6d7abc0c1b7db$export$ed4eff50d964b03e), {
type: "text",
name: fieldName,
placeholder: placeholder,
value: fieldValue,
className: inputClassName,
onChange: (event)=>onChange?.(event),
disabled: disabled,
onFocus: ()=>setFocus(true),
onBlur: ()=>setFocus(false)
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $82b6d7abc0c1b7db$export$ed4eff50d964b03e), {
id: fieldId,
component: fieldAs,
type: "text",
name: fieldName,
placeholder: placeholder,
className: inputClassName,
disabled: disabled,
onFocus: ()=>setFocus(true),
onBlur: ()=>setFocus(false)
})
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $82b6d7abc0c1b7db$export$7e30077cd8dfa6f4), {
name: fieldName,
component: "div"
})
]
});
};
var $b6f0dafea9b9d36c$export$2e2bcd8739ae039 = $b6f0dafea9b9d36c$var$Input;
const $63b0e6be8c84e053$export$671ce2d400c94825 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div``;
const $63b0e6be8c84e053$export$8bde14b5d6dc4df9 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
background: #fff4ed;
border-radius: 8px;
padding: 15px;
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
color: #8e522e;
margin-bottom: 20px;
b {
font-weight: 600;
}
`;
const $63b0e6be8c84e053$export$270ecda204b9b7b = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 700;
font-size: 16px;
line-height: 125%;
color: #000000;
margin-bottom: 9px;
`;
const $63b0e6be8c84e053$export$5557f2b9bd9ba52a = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
color: #000000;
margin-bottom: 20px;
`;
const $63b0e6be8c84e053$export$b1e5d8175a0e1e0d = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
color: #000;
font-weight: 400;
p {
margin-right: 8px;
}
`;
const $0f9964e812e323fd$export$10f3649d5bd8d696 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
margin-bottom: 12px;
`;
const $0f9964e812e323fd$export$99151310f230aa5d = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
position: relative;
width: 100%;
`;
const $0f9964e812e323fd$export$dc96b5eee5fc9705 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
cursor: pointer;
padding: 12px;
width: 100%;
justify-content: space-between;
`;
const $0f9964e812e323fd$export$5a10b49d07b05526 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
color: ${({ selected: selected })=>selected ? "#000" : "#5a6578"};
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
opacity: ${({ selected: selected })=>selected ? 1 : 0.5};
`;
const $0f9964e812e323fd$export$7dd4d92f143902e3 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 24px;
height: 24px;
margin-left: 8px;
svg {
width: 100%;
height: 100%;
}
`;
const $0f9964e812e323fd$export$b65be752f71d1c44 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
outline: none;
`;
const $0f9964e812e323fd$export$b019e40da43a154c = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
position: absolute;
top: 100%;
left: 0;
width: 100%;
background-color: #fff;
box-shadow: 0px 8px 10px rgba(195, 200, 209, 0.2);
border-radius: 8px;
max-height: 192px;
overflow-y: auto;
margin-top: 8px;
z-index: 2;
`;
const $0f9964e812e323fd$export$5512073c0768b16c = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
cursor: pointer;
padding: 8px;
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
color: #000000;
&:hover {
background-color: #fff4ed;
}
${({ highlighted: highlighted })=>highlighted && `
background-color: #FFF4ED;
`}
`;
const $0f9964e812e323fd$export$eea83358d9434634 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).label`
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
margin-bottom: 5px;
color: #9ca3af;
display: block;
`;
const $0f9964e812e323fd$export$7e30077cd8dfa6f4 = (0, ($parcel$interopDefault($8zHUo$styledcomponents)))((0, $8zHUo$formik.ErrorMessage))`
color: #ff0000;
font-size: 12px;
font-weight: 400;
line-height: 1.5;
margin-top: 4px;
`;
function $49d9e1b0fc001918$var$itemToString(item) {
return item ? item.label : "";
}
const $49d9e1b0fc001918$var$SelectBox = ({ options: options , onChange: onChange , value: value , placeholder: placeholder , showValidations: showValidations = false , fieldName: fieldName , className: className , label: label })=>{
const { isOpen: isOpen , getToggleButtonProps: getToggleButtonProps , getMenuProps: getMenuProps , getItemProps: getItemProps , highlightedIndex: highlightedIndex , getLabelProps: getLabelProps , } = (0, $8zHUo$downshift.useSelect)({
items: options,
itemToString: $49d9e1b0fc001918$var$itemToString,
onSelectedItemChange: ({ selectedItem: selectedItem })=>{
if (selectedItem) onChange(selectedItem);
}
});
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $0f9964e812e323fd$export$10f3649d5bd8d696), {
className: className,
children: [
label && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$eea83358d9434634), {
children: label
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $4ba2198f74114cf5$export$2e2bcd8739ae039), {
placeholder: placeholder,
focus: isOpen,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $0f9964e812e323fd$export$99151310f230aa5d), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $0f9964e812e323fd$export$dc96b5eee5fc9705), {
...getToggleButtonProps(),
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$5a10b49d07b05526), {
selected: value,
...getLabelProps(),
children: value || placeholder
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$7dd4d92f143902e3), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.ArrowsDownIcon), {})
})
]
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$b65be752f71d1c44), {
...getMenuProps(),
children: isOpen && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$b019e40da43a154c), {
children: options.map((item, index)=>{
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$5512073c0768b16c), {
highlighted: highlightedIndex === index,
...getItemProps({
key: item.label,
index: index,
item: item
}),
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
children: item.label
})
}, `${item.value}${index}`);
})
})
})
]
})
}),
showValidations && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $0f9964e812e323fd$export$7e30077cd8dfa6f4), {
name: fieldName ?? "selectbox",
component: "div"
})
]
});
};
var $49d9e1b0fc001918$export$2e2bcd8739ae039 = $49d9e1b0fc001918$var$SelectBox;
const $b71fcabc3f13b061$export$e5ad74579c86b003 = [
{
code: "AF",
code3: "AFG",
name: "Afghanistan",
number: "004"
},
{
code: "AL",
code3: "ALB",
name: "Albania",
number: "008"
},
{
code: "DZ",
code3: "DZA",
name: "Algeria",
number: "012"
},
{
code: "AS",
code3: "ASM",
name: "American Samoa",
number: "016"
},
{
code: "AD",
code3: "AND",
name: "Andorra",
number: "020"
},
{
code: "AO",
code3: "AGO",
name: "Angola",
number: "024"
},
{
code: "AI",
code3: "AIA",
name: "Anguilla",
number: "660"
},
{
code: "AQ",
code3: "ATA",
name: "Antarctica",
number: "010"
},
{
code: "AG",
code3: "ATG",
name: "Antigua and Barbuda",
number: "028"
},
{
code: "AR",
code3: "ARG",
name: "Argentina",
number: "032"
},
{
code: "AM",
code3: "ARM",
name: "Armenia",
number: "051"
},
{
code: "AW",
code3: "ABW",
name: "Aruba",
number: "533"
},
{
code: "AU",
code3: "AUS",
name: "Australia",
number: "036"
},
{
code: "AT",
code3: "AUT",
name: "Austria",
number: "040"
},
{
code: "AZ",
code3: "AZE",
name: "Azerbaijan",
number: "031"
},
{
code: "BS",
code3: "BHS",
name: "Bahamas (the)",
number: "044"
},
{
code: "BH",
code3: "BHR",
name: "Bahrain",
number: "048"
},
{
code: "BD",
code3: "BGD",
name: "Bangladesh",
number: "050"
},
{
code: "BB",
code3: "BRB",
name: "Barbados",
number: "052"
},
{
code: "BY",
code3: "BLR",
name: "Belarus",
number: "112"
},
{
code: "BE",
code3: "BEL",
name: "Belgium",
number: "056"
},
{
code: "BZ",
code3: "BLZ",
name: "Belize",
number: "084"
},
{
code: "BJ",
code3: "BEN",
name: "Benin",
number: "204"
},
{
code: "BM",
code3: "BMU",
name: "Bermuda",
number: "060"
},
{
code: "BT",
code3: "BTN",
name: "Bhutan",
number: "064"
},
{
code: "BO",
code3: "BOL",
name: "Bolivia (Plurinational State of)",
number: "068"
},
{
code: "BQ",
code3: "BES",
name: "Bonaire, Sint Eustatius and Saba",
number: "535"
},
{
code: "BA",
code3: "BIH",
name: "Bosnia and Herzegovina",
number: "070"
},
{
code: "BW",
code3: "BWA",
name: "Botswana",
number: "072"
},
{
code: "BV",
code3: "BVT",
name: "Bouvet Island",
number: "074"
},
{
code: "BR",
code3: "BRA",
name: "Brazil",
number: "076"
},
{
code: "IO",
code3: "IOT",
name: "British Indian Ocean Territory (the)",
number: "086"
},
{
code: "BN",
code3: "BRN",
name: "Brunei Darussalam",
number: "096"
},
{
code: "BG",
code3: "BGR",
name: "Bulgaria",
number: "100"
},
{
code: "BF",
code3: "BFA",
name: "Burkina Faso",
number: "854"
},
{
code: "BI",
code3: "BDI",
name: "Burundi",
number: "108"
},
{
code: "CV",
code3: "CPV",
name: "Cabo Verde",
number: "132"
},
{
code: "KH",
code3: "KHM",
name: "Cambodia",
number: "116"
},
{
code: "CM",
code3: "CMR",
name: "Cameroon",
number: "120"
},
{
code: "CA",
code3: "CAN",
name: "Canada",
number: "124"
},
{
code: "KY",
code3: "CYM",
name: "Cayman Islands (the)",
number: "136"
},
{
code: "CF",
code3: "CAF",
name: "Central African Republic (the)",
number: "140"
},
{
code: "TD",
code3: "TCD",
name: "Chad",
number: "148"
},
{
code: "CL",
code3: "CHL",
name: "Chile",
number: "152"
},
{
code: "CN",
code3: "CHN",
name: "China",
number: "156"
},
{
code: "CX",
code3: "CXR",
name: "Christmas Island",
number: "162"
},
{
code: "CC",
code3: "CCK",
name: "Cocos (Keeling) Islands (the)",
number: "166"
},
{
code: "CO",
code3: "COL",
name: "Colombia",
number: "170"
},
{
code: "KM",
code3: "COM",
name: "Comoros (the)",
number: "174"
},
{
code: "CD",
code3: "COD",
name: "Congo (the Democratic Republic of the)",
number: "180"
},
{
code: "CG",
code3: "COG",
name: "Congo (the)",
number: "178"
},
{
code: "CK",
code3: "COK",
name: "Cook Islands (the)",
number: "184"
},
{
code: "CR",
code3: "CRI",
name: "Costa Rica",
number: "188"
},
{
code: "HR",
code3: "HRV",
name: "Croatia",
number: "191"
},
{
code: "CU",
code3: "CUB",
name: "Cuba",
number: "192"
},
{
code: "CW",
code3: "CUW",
name: "Cura\xe7ao",
number: "531"
},
{
code: "CY",
code3: "CYP",
name: "Cyprus",
number: "196"
},
{
code: "CZ",
code3: "CZE",
name: "Czechia",
number: "203"
},
{
code: "CI",
code3: "CIV",
name: "C\xf4te d'Ivoire",
number: "384"
},
{
code: "DK",
code3: "DNK",
name: "Denmark",
number: "208"
},
{
code: "DJ",
code3: "DJI",
name: "Djibouti",
number: "262"
},
{
code: "DM",
code3: "DMA",
name: "Dominica",
number: "212"
},
{
code: "DO",
code3: "DOM",
name: "Dominican Republic (the)",
number: "214"
},
{
code: "EC",
code3: "ECU",
name: "Ecuador",
number: "218"
},
{
code: "EG",
code3: "EGY",
name: "Egypt",
number: "818"
},
{
code: "SV",
code3: "SLV",
name: "El Salvador",
number: "222"
},
{
code: "GQ",
code3: "GNQ",
name: "Equatorial Guinea",
number: "226"
},
{
code: "ER",
code3: "ERI",
name: "Eritrea",
number: "232"
},
{
code: "EE",
code3: "EST",
name: "Estonia",
number: "233"
},
{
code: "SZ",
code3: "SWZ",
name: "Eswatini",
number: "748"
},
{
code: "ET",
code3: "ETH",
name: "Ethiopia",
number: "231"
},
{
code: "FK",
code3: "FLK",
name: "Falkland Islands (the) [Malvinas]",
number: "238"
},
{
code: "FO",
code3: "FRO",
name: "Faroe Islands (the)",
number: "234"
},
{
code: "FJ",
code3: "FJI",
name: "Fiji",
number: "242"
},
{
code: "FI",
code3: "FIN",
name: "Finland",
number: "246"
},
{
code: "FR",
code3: "FRA",
name: "France",
number: "250"
},
{
code: "GF",
code3: "GUF",
name: "French Guiana",
number: "254"
},
{
code: "PF",
code3: "PYF",
name: "French Polynesia",
number: "258"
},
{
code: "TF",
code3: "ATF",
name: "French Southern Territories (the)",
number: "260"
},
{
code: "GA",
code3: "GAB",
name: "Gabon",
number: "266"
},
{
code: "GM",
code3: "GMB",
name: "Gambia (the)",
number: "270"
},
{
code: "GE",
code3: "GEO",
name: "Georgia",
number: "268"
},
{
code: "DE",
code3: "DEU",
name: "Germany",
number: "276"
},
{
code: "GH",
code3: "GHA",
name: "Ghana",
number: "288"
},
{
code: "GI",
code3: "GIB",
name: "Gibraltar",
number: "292"
},
{
code: "GR",
code3: "GRC",
name: "Greece",
number: "300"
},
{
code: "GL",
code3: "GRL",
name: "Greenland",
number: "304"
},
{
code: "GD",
code3: "GRD",
name: "Grenada",
number: "308"
},
{
code: "GP",
code3: "GLP",
name: "Guadeloupe",
number: "312"
},
{
code: "GU",
code3: "GUM",
name: "Guam",
number: "316"
},
{
code: "GT",
code3: "GTM",
name: "Guatemala",
number: "320"
},
{
code: "GG",
code3: "GGY",
name: "Guernsey",
number: "831"
},
{
code: "GN",
code3: "GIN",
name: "Guinea",
number: "324"
},
{
code: "GW",
code3: "GNB",
name: "Guinea-Bissau",
number: "624"
},
{
code: "GY",
code3: "GUY",
name: "Guyana",
number: "328"
},
{
code: "HT",
code3: "HTI",
name: "Haiti",
number: "332"
},
{
code: "HM",
code3: "HMD",
name: "Heard Island and McDonald Islands",
number: "334"
},
{
code: "VA",
code3: "VAT",
name: "Holy See (the)",
number: "336"
},
{
code: "HN",
code3: "HND",
name: "Honduras",
number: "340"
},
{
code: "HK",
code3: "HKG",
name: "Hong Kong",
number: "344"
},
{
code: "HU",
code3: "HUN",
name: "Hungary",
number: "348"
},
{
code: "IS",
code3: "ISL",
name: "Iceland",
number: "352"
},
{
code: "IN",
code3: "IND",
name: "India",
number: "356"
},
{
code: "ID",
code3: "IDN",
name: "Indonesia",
number: "360"
},
{
code: "IR",
code3: "IRN",
name: "Iran (Islamic Republic of)",
number: "364"
},
{
code: "IQ",
code3: "IRQ",
name: "Iraq",
number: "368"
},
{
code: "IE",
code3: "IRL",
name: "Ireland",
number: "372"
},
{
code: "IM",
code3: "IMN",
name: "Isle of Man",
number: "833"
},
{
code: "IL",
code3: "ISR",
name: "Israel",
number: "376"
},
{
code: "IT",
code3: "ITA",
name: "Italy",
number: "380"
},
{
code: "JM",
code3: "JAM",
name: "Jamaica",
number: "388"
},
{
code: "JP",
code3: "JPN",
name: "Japan",
number: "392"
},
{
code: "JE",
code3: "JEY",
name: "Jersey",
number: "832"
},
{
code: "JO",
code3: "JOR",
name: "Jordan",
number: "400"
},
{
code: "KZ",
code3: "KAZ",
name: "Kazakhstan",
number: "398"
},
{
code: "KE",
code3: "KEN",
name: "Kenya",
number: "404"
},
{
code: "KI",
code3: "KIR",
name: "Kiribati",
number: "296"
},
{
code: "KP",
code3: "PRK",
name: "Korea (the Democratic People's Republic of)",
number: "408"
},
{
code: "KR",
code3: "KOR",
name: "Korea (the Republic of)",
number: "410"
},
{
code: "KW",
code3: "KWT",
name: "Kuwait",
number: "414"
},
{
code: "KG",
code3: "KGZ",
name: "Kyrgyzstan",
number: "417"
},
{
code: "LA",
code3: "LAO",
name: "Lao People's Democratic Republic (the)",
number: "418"
},
{
code: "LV",
code3: "LVA",
name: "Latvia",
number: "428"
},
{
code: "LB",
code3: "LBN",
name: "Lebanon",
number: "422"
},
{
code: "LS",
code3: "LSO",
name: "Lesotho",
number: "426"
},
{
code: "LR",
code3: "LBR",
name: "Liberia",
number: "430"
},
{
code: "LY",
code3: "LBY",
name: "Libya",
number: "434"
},
{
code: "LI",
code3: "LIE",
name: "Liechtenstein",
number: "438"
},
{
code: "LT",
code3: "LTU",
name: "Lithuania",
number: "440"
},
{
code: "LU",
code3: "LUX",
name: "Luxembourg",
number: "442"
},
{
code: "MO",
code3: "MAC",
name: "Macao",
number: "446"
},
{
code: "MG",
code3: "MDG",
name: "Madagascar",
number: "450"
},
{
code: "MW",
code3: "MWI",
name: "Malawi",
number: "454"
},
{
code: "MY",
code3: "MYS",
name: "Malaysia",
number: "458"
},
{
code: "MV",
code3: "MDV",
name: "Maldives",
number: "462"
},
{
code: "ML",
code3: "MLI",
name: "Mali",
number: "466"
},
{
code: "MT",
code3: "MLT",
name: "Malta",
number: "470"
},
{
code: "MH",
code3: "MHL",
name: "Marshall Islands (the)",
number: "584"
},
{
code: "MQ",
code3: "MTQ",
name: "Martinique",
number: "474"
},
{
code: "MR",
code3: "MRT",
name: "Mauritania",
number: "478"
},
{
code: "MU",
code3: "MUS",
name: "Mauritius",
number: "480"
},
{
code: "YT",
code3: "MYT",
name: "Mayotte",
number: "175"
},
{
code: "MX",
code3: "MEX",
name: "Mexico",
number: "484"
},
{
code: "FM",
code3: "FSM",
name: "Micronesia (Federated States of)",
number: "583"
},
{
code: "MD",
code3: "MDA",
name: "Moldova (the Republic of)",
number: "498"
},
{
code: "MC",
code3: "MCO",
name: "Monaco",
number: "492"
},
{
code: "MN",
code3: "MNG",
name: "Mongolia",
number: "496"
},
{
code: "ME",
code3: "MNE",
name: "Montenegro",
number: "499"
},
{
code: "MS",
code3: "MSR",
name: "Montserrat",
number: "500"
},
{
code: "MA",
code3: "MAR",
name: "Morocco",
number: "504"
},
{
code: "MZ",
code3: "MOZ",
name: "Mozambique",
number: "508"
},
{
code: "MM",
code3: "MMR",
name: "Myanmar",
number: "104"
},
{
code: "NA",
code3: "NAM",
name: "Namibia",
number: "516"
},
{
code: "NR",
code3: "NRU",
name: "Nauru",
number: "520"
},
{
code: "NP",
code3: "NPL",
name: "Nepal",
number: "524"
},
{
code: "NL",
code3: "NLD",
name: "Netherlands (the)",
number: "528"
},
{
code: "NC",
code3: "NCL",
name: "New Caledonia",
number: "540"
},
{
code: "NZ",
code3: "NZL",
name: "New Zealand",
number: "554"
},
{
code: "NI",
code3: "NIC",
name: "Nicaragua",
number: "558"
},
{
code: "NE",
code3: "NER",
name: "Niger (the)",
number: "562"
},
{
code: "NG",
code3: "NGA",
name: "Nigeria",
number: "566"
},
{
code: "NU",
code3: "NIU",
name: "Niue",
number: "570"
},
{
code: "NF",
code3: "NFK",
name: "Norfolk Island",
number: "574"
},
{
code: "MP",
code3: "MNP",
name: "Northern Mariana Islands (the)",
number: "580"
},
{
code: "NO",
code3: "NOR",
name: "Norway",
number: "578"
},
{
code: "OM",
code3: "OMN",
name: "Oman",
number: "512"
},
{
code: "PK",
code3: "PAK",
name: "Pakistan",
number: "586"
},
{
code: "PW",
code3: "PLW",
name: "Palau",
number: "585"
},
{
code: "PS",
code3: "PSE",
name: "Palestine, State of",
number: "275"
},
{
code: "PA",
code3: "PAN",
name: "Panama",
number: "591"
},
{
code: "PG",
code3: "PNG",
name: "Papua New Guinea",
number: "598"
},
{
code: "PY",
code3: "PRY",
name: "Paraguay",
number: "600"
},
{
code: "PE",
code3: "PER",
name: "Peru",
number: "604"
},
{
code: "PH",
code3: "PHL",
name: "Philippines (the)",
number: "608"
},
{
code: "PN",
code3: "PCN",
name: "Pitcairn",
number: "612"
},
{
code: "PL",
code3: "POL",
name: "Poland",
number: "616"
},
{
code: "PT",
code3: "PRT",
name: "Portugal",
number: "620"
},
{
code: "PR",
code3: "PRI",
name: "Puerto Rico",
number: "630"
},
{
code: "QA",
code3: "QAT",
name: "Qatar",
number: "634"
},
{
code: "MK",
code3: "MKD",
name: "Republic of North Macedonia",
number: "807"
},
{
code: "RO",
code3: "ROU",
name: "Romania",
number: "642"
},
{
code: "RU",
code3: "RUS",
name: "Russian Federation (the)",
number: "643"
},
{
code: "RW",
code3: "RWA",
name: "Rwanda",
number: "646"
},
{
code: "RE",
code3: "REU",
name: "R\xe9union",
number: "638"
},
{
code: "BL",
code3: "BLM",
name: "Saint Barth\xe9lemy",
number: "652"
},
{
code: "SH",
code3: "SHN",
name: "Saint Helena, Ascension and Tristan da Cunha",
number: "654"
},
{
code: "KN",
code3: "KNA",
name: "Saint Kitts and Nevis",
number: "659"
},
{
code: "LC",
code3: "LCA",
name: "Saint Lucia",
number: "662"
},
{
code: "MF",
code3: "MAF",
name: "Saint Martin (French part)",
number: "663"
},
{
code: "PM",
code3: "SPM",
name: "Saint Pierre and Miquelon",
number: "666"
},
{
code: "VC",
code3: "VCT",
name: "Saint Vincent and the Grenadines",
number: "670"
},
{
code: "WS",
code3: "WSM",
name: "Samoa",
number: "882"
},
{
code: "SM",
code3: "SMR",
name: "San Marino",
number: "674"
},
{
code: "ST",
code3: "STP",
name: "Sao Tome and Principe",
number: "678"
},
{
code: "SA",
code3: "SAU",
name: "Saudi Arabia",
number: "682"
},
{
code: "SN",
code3: "SEN",
name: "Senegal",
number: "686"
},
{
code: "RS",
code3: "SRB",
name: "Serbia",
number: "688"
},
{
code: "SC",
code3: "SYC",
name: "Seychelles",
number: "690"
},
{
code: "SL",
code3: "SLE",
name: "Sierra Leone",
number: "694"
},
{
code: "SG",
code3: "SGP",
name: "Singapore",
number: "702"
},
{
code: "SX",
code3: "SXM",
name: "Sint Maarten (Dutch part)",
number: "534"
},
{
code: "SK",
code3: "SVK",
name: "Slovakia",
number: "703"
},
{
code: "SI",
code3: "SVN",
name: "Slovenia",
number: "705"
},
{
code: "SB",
code3: "SLB",
name: "Solomon Islands",
number: "090"
},
{
code: "SO",
code3: "SOM",
name: "Somalia",
number: "706"
},
{
code: "ZA",
code3: "ZAF",
name: "South Africa",
number: "710"
},
{
code: "GS",
code3: "SGS",
name: "South Georgia and the South Sandwich Islands",
number: "239"
},
{
code: "SS",
code3: "SSD",
name: "South Sudan",
number: "728"
},
{
code: "ES",
code3: "ESP",
name: "Spain",
number: "724"
},
{
code: "LK",
code3: "LKA",
name: "Sri Lanka",
number: "144"
},
{
code: "SD",
code3: "SDN",
name: "Sudan (the)",
number: "729"
},
{
code: "SR",
code3: "SUR",
name: "Suriname",
number: "740"
},
{
code: "SJ",
code3: "SJM",
name: "Svalbard and Jan Mayen",
number: "744"
},
{
code: "SE",
code3: "SWE",
name: "Sweden",
number: "752"
},
{
code: "CH",
code3: "CHE",
name: "Switzerland",
number: "756"
},
{
code: "SY",
code3: "SYR",
name: "Syrian Arab Republic",
number: "760"
},
{
code: "TW",
code3: "TWN",
name: "Taiwan",
number: "158"
},
{
code: "TJ",
code3: "TJK",
name: "Tajikistan",
number: "762"
},
{
code: "TZ",
code3: "TZA",
name: "Tanzania, United Republic of",
number: "834"
},
{
code: "TH",
code3: "THA",
name: "Thailand",
number: "764"
},
{
code: "TL",
code3: "TLS",
name: "Timor-Leste",
number: "626"
},
{
code: "TG",
code3: "TGO",
name: "Togo",
number: "768"
},
{
code: "TK",
code3: "TKL",
name: "Tokelau",
number: "772"
},
{
code: "TO",
code3: "TON",
name: "Tonga",
number: "776"
},
{
code: "TT",
code3: "TTO",
name: "Trinidad and Tobago",
number: "780"
},
{
code: "TN",
code3: "TUN",
name: "Tunisia",
number: "788"
},
{
code: "TR",
code3: "TUR",
name: "Turkey",
number: "792"
},
{
code: "TM",
code3: "TKM",
name: "Turkmenistan",
number: "795"
},
{
code: "TC",
code3: "TCA",
name: "Turks and Caicos Islands (the)",
number: "796"
},
{
code: "TV",
code3: "TUV",
name: "Tuvalu",
number: "798"
},
{
code: "UG",
code3: "UGA",
name: "Uganda",
number: "800"
},
{
code: "UA",
code3: "UKR",
name: "Ukraine",
number: "804"
},
{
code: "AE",
code3: "ARE",
name: "United Arab Emirates (the)",
number: "784"
},
{
code: "GB",
code3: "GBR",
name: "United Kingdom of Great Britain and Northern Ireland (the)",
number: "826"
},
{
code: "UM",
code3: "UMI",
name: "United States Minor Outlying Islands (the)",
number: "581"
},
{
code: "US",
code3: "USA",
name: "United States of America (the)",
number: "840"
},
{
code: "UY",
code3: "URY",
name: "Uruguay",
number: "858"
},
{
code: "UZ",
code3: "UZB",
name: "Uzbekistan",
number: "860"
},
{
code: "VU",
code3: "VUT",
name: "Vanuatu",
number: "548"
},
{
code: "VE",
code3: "VEN",
name: "Venezuela (Bolivarian Republic of)",
number: "862"
},
{
code: "VN",
code3: "VNM",
name: "Viet Nam",
number: "704"
},
{
code: "VG",
code3: "VGB",
name: "Virgin Islands (British)",
number: "092"
},
{
code: "VI",
code3: "VIR",
name: "Virgin Islands (U.S.)",
number: "850"
},
{
code: "WF",
code3: "WLF",
name: "Wallis and Futuna",
number: "876"
},
{
code: "EH",
code3: "ESH",
name: "Western Sahara",
number: "732"
},
{
code: "YE",
code3: "YEM",
name: "Yemen",
number: "887"
},
{
code: "ZM",
code3: "ZMB",
name: "Zambia",
number: "894"
},
{
code: "ZW",
code3: "ZWE",
name: "Zimbabwe",
number: "716"
},
{
code: "AX",
code3: "ALA",
name: "\xc5land Islands",
number: "248"
},
];
const $d10676a480354390$export$fc8297141ec1552 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
`;
const $d10676a480354390$export$670ff79d2e22e44e = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
font-size: 28px;
margin-left: 8px;
cursor: pointer;
svg {
width: 100%;
height: 100%;
fill: ${({ theme: theme })=>theme.colors.primary};
}
`;
const $d10676a480354390$export$e3f12e49881df171 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
font-size: 24px;
margin-left: 8px;
cursor: pointer;
padding: 4px;
svg {
width: 100%;
height: 100%;
fill: ${({ theme: theme })=>theme.colors.primary};
}
`;
const $184901a51e3c15e1$var$NumberInput = ({ fieldId: fieldId , fieldName: fieldName , placeholder: placeholder , min: min = 1 , max: max , step: step = 1 , value: value , setFieldValue: setFieldValue , label: label })=>{
const handleDecrement = ()=>{
if (!value) {
setFieldValue(fieldName, min);
return;
}
if (value > min) setFieldValue(fieldName, Number(value) - Number(step));
};
const handleIncrement = ()=>{
if (!value) {
setFieldValue(fieldName, min);
return;
}
if (max && value < max || !max) setFieldValue(fieldName, Number(value) + Number(step));
};
const handleChange = (event)=>{
const re = /^[0-9\b]+$/;
if (re.test(event.target.value)) setFieldValue(fieldName, event.target.value);
};
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: fieldId,
fieldName: fieldName,
placeholder: placeholder,
fieldValue: value,
onChange: handleChange,
label: label,
suffix: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $d10676a480354390$export$fc8297141ec1552), {
className: "mr-2 flex flex-row items-center gap-x-2",
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $d10676a480354390$export$670ff79d2e22e44e), {
className: "flex h-6 w-6 cursor-pointer select-none items-center justify-center",
onClick: handleDecrement,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.MinusIcon), {})
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $d10676a480354390$export$e3f12e49881df171), {
className: "flex h-6 w-6 cursor-pointer select-none items-center justify-center",
onClick: handleIncrement,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.PlusIcon), {})
})
]
})
});
};
var $184901a51e3c15e1$export$2e2bcd8739ae039 = $184901a51e3c15e1$var$NumberInput;
const $d0c1d350bd4d45bc$export$b1fdf0708b3abd8b = "https://helio-assets.s3.eu-west-1.amazonaws.com";
const $b2b13d0f7ab480d4$var$CurrencyIcon = ({ className: className , gradient: gradient = false , iconName: iconName })=>{
const filename = iconName + (gradient ? "" : "_uncolored");
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
className: className,
children: iconName && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("img", {
alt: iconName,
src: `${(0, $d0c1d350bd4d45bc$export$b1fdf0708b3abd8b)}/${filename}.svg`
})
});
};
var $b2b13d0f7ab480d4$export$2e2bcd8739ae039 = $b2b13d0f7ab480d4$var$CurrencyIcon;
const $3e3de281221554cd$var$CustomerDetailsFormModal = ({ onHide: onHide , onSubmit: onSubmit })=>{
const { currencyList: currencyList , paymentDetails: paymentDetails } = (0, $2f138ba4c0da2b96$export$78de68c6948c799f)();
const [normalizedPrice, setNormalizedPrice] = (0, $8zHUo$react.useState)(0);
const [currency1, setCurrency] = (0, $8zHUo$react.useState)(null);
const countryOptions = (0, $b71fcabc3f13b061$export$e5ad74579c86b003).map((country)=>({
label: country.name,
value: country.code
}));
const getCurrency = (currency)=>{
if (!currency) return;
return currencyList.find((c)=>c.symbol === currency);
};
(0, $8zHUo$react.useEffect)(()=>{
setCurrency(getCurrency(paymentDetails.currency));
}, [
paymentDetails?.currency
]);
(0, $8zHUo$react.useEffect)(()=>{
if (paymentDetails?.currency != null && paymentDetails?.normalizedPrice != null) setNormalizedPrice((0, $37cdb6eb4c28b28b$export$f894d240fcbfa580).convertFromMinimalUnits(getCurrency(paymentDetails.currency), paymentDetails.normalizedPrice));
}, [
paymentDetails
]);
const formatTotalPrice = (price, quantity = 1)=>{
const totalPrice = Number((price * quantity).toFixed(3));
return totalPrice || price;
};
const isCustomerDetailsRequired = ()=>{
if (!paymentDetails) return false;
return paymentDetails.requireEmail || paymentDetails.requireFullName || paymentDetails.requireDiscordUsername || paymentDetails.requireTwitterUsername || paymentDetails.requireCountry || paymentDetails.requireDeliveryAddress;
};
const initialValues = {
requireEmail: paymentDetails.requireEmail,
requireDiscordUsername: paymentDetails.requireDiscordUsername,
requireFullName: paymentDetails.requireFullName,
requireTwitterUsername: paymentDetails.requireTwitterUsername,
requireCountry: paymentDetails.requireCountry,
requireDeliveryAddress: paymentDetails.requireDeliveryAddress,
canChangePrice: paymentDetails.canChangePrice,
canChangeQuantity: paymentDetails.canChangeQuantity,
fullName: undefined,
email: undefined,
discordUsername: undefined,
twitterUsername: undefined,
country: undefined,
deliveryAddress: undefined,
quantity: paymentDetails.canChangeQuantity ? 1 : undefined,
customPrice: paymentDetails.canChangePrice ? undefined : normalizedPrice
};
const handleSubmit = (values)=>{
const details = {
fullName: values.fullName,
email: values.email,
discordUsername: values.discordUsername,
twitterUsername: values.twitterUsername,
country: values.country,
deliveryAddress: values.deliveryAddress
};
const clearDetails = (0, $d7167569386d0d4c$export$3fde1aac5afb2bc6)(details);
onSubmit({
customerDetails: clearDetails,
amount: (0, $37cdb6eb4c28b28b$export$f894d240fcbfa580).convertToMinimalUnits(getCurrency(paymentDetails.currency), values.canChangePrice ? values.customPrice : normalizedPrice),
quantity: values.quantity || 1
});
};
return /*#__PURE__*/ (0, ($parcel$interopDefault($8zHUo$reactdom))).createPortal(/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $f80b45cbc2e4b97b$export$2b77a92f1a5ad772), {
onHide: onHide,
icon: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2b13d0f7ab480d4$export$2e2bcd8739ae039), {
iconName: currency1?.symbol || ""
}),
title: `Pay with ${currency1?.symbol}`,
children: paymentDetails ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$formik.Formik), {
validationSchema: (0, $ac9ad45b25632a31$export$2e2bcd8739ae039),
initialValues: initialValues,
onSubmit: handleSubmit,
children: ({ values: values , setFieldValue: setFieldValue })=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$formik.Form), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("div", {
children: [
values.canChangePrice ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "customPrice",
fieldName: "customPrice",
label: "Name your own price",
prefix: currency1?.sign,
suffix: currency1 && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $63b0e6be8c84e053$export$b1e5d8175a0e1e0d), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("p", {
children: currency1.symbol
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2b13d0f7ab480d4$export$2e2bcd8739ae039), {
gradient: true,
iconName: currency1?.symbol || ""
})
]
})
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $63b0e6be8c84e053$export$8bde14b5d6dc4df9), {
children: [
"Total price:",
" ",
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("b", {
children: [
formatTotalPrice(normalizedPrice, values.quantity),
" ",
currency1?.symbol
]
})
]
}),
paymentDetails?.canChangeQuantity && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $184901a51e3c15e1$export$2e2bcd8739ae039), {
fieldId: "quantity",
fieldName: "quantity",
setFieldValue: setFieldValue,
value: values.quantity,
placeholder: "Quantity",
label: "Quantity"
}),
isCustomerDetailsRequired() && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $8zHUo$reactjsxruntime.Fragment), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $63b0e6be8c84e053$export$270ecda204b9b7b), {
children: "Information required"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $63b0e6be8c84e053$export$5557f2b9bd9ba52a), {
children: "We need some information from you to deliver the product."
})
]
}),
paymentDetails.requireFullName && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "fullName",
fieldName: "fullName",
placeholder: "Full name",
label: "Full name"
}),
paymentDetails.requireEmail && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "email",
fieldName: "email",
placeholder: "john@helio.co",
label: "E-mail address"
}),
paymentDetails.requireTwitterUsername && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "twitterUsername",
fieldName: "twitterUsername",
placeholder: "@helio_pay",
label: "Twitter username"
}),
paymentDetails.requireDiscordUsername && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "discordUsername",
fieldName: "discordUsername",
placeholder: "Helio#1234",
label: "Discord username"
}),
paymentDetails.requireCountry && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $49d9e1b0fc001918$export$2e2bcd8739ae039), {
options: countryOptions,
placeholder: "Select country",
value: values.country,
showValidations: true,
fieldName: "country",
label: "Country",
onChange: (option)=>setFieldValue("country", option.label)
}),
paymentDetails.requireDeliveryAddress && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b6f0dafea9b9d36c$export$2e2bcd8739ae039), {
fieldId: "deliveryAddress",
fieldName: "deliveryAddress",
fieldAs: "textarea",
placeholder: "Shipping address",
label: "Shipping address"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $092b6831bbf3b794$export$2e2bcd8739ae039), {
type: "submit",
children: "PAY"
})
]
})
})
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("h2", {
children: "Failed to load payment details."
})
})
}), document.body);
};
var $3e3de281221554cd$export$2e2bcd8739ae039 = $3e3de281221554cd$var$CustomerDetailsFormModal;
class $3086fd81a93e65cd$export$64ace85f638f5149 extends Error {
constructor(message){
super(message);
}
extractSignature() {
return (0, $d7167569386d0d4c$export$d255a53dfa808aa7)(this.message, "signature", "using");
}
}
class $a8370c494b23842e$export$bba808db88f96979 extends Error {
constructor(message){
super(message);
}
}
const $90ced30ac1adafa0$var$SOL_SYMBOL = "SOL";
const $90ced30ac1adafa0$var$approveTransaction = async (reqBody)=>{
const HELIO_BASE_API_URL = (0, $45e184d90a0e847e$export$c93407251c80de24)(reqBody.cluster);
const res = await fetch(`${HELIO_BASE_API_URL}/approve-transaction`, {
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(reqBody)
});
const result = await res.json();
if (res.status === (0, $17b52f92b27b101e$export$a5bc4a64e9e6804a).SUCCESS && result.content != null) return result.content;
if (res.status === (0, $17b52f92b27b101e$export$a5bc4a64e9e6804a).FAILED_DEPENDENCY) throw new (0, $a8370c494b23842e$export$bba808db88f96979)(result.message);
throw new Error(result.message);
};
const $90ced30ac1adafa0$var$sendTransaction = async (symbol, request, provider)=>{
try {
if (symbol === $90ced30ac1adafa0$var$SOL_SYMBOL) return await (0, $8zHUo$heliofisolanaadapter.singleSolPaymentSC)(provider, request);
return await (0, $8zHUo$heliofisolanaadapter.singlePaymentSC)(provider, request);
} catch (e) {
return new (0, $3086fd81a93e65cd$export$64ace85f638f5149)(String(e)).extractSignature();
}
};
const $90ced30ac1adafa0$var$retryCallback = async (callback, count, delay, onError)=>{
if (count < 0) {
onError("Unable to verify the transaction.");
return;
}
try {
await callback();
} catch (e) {
if (e instanceof (0, $a8370c494b23842e$export$bba808db88f96979)) setTimeout(async ()=>{
await $90ced30ac1adafa0$var$retryCallback(callback, count - 1, delay, onError);
}, delay);
else onError(String(e));
}
};
const $90ced30ac1adafa0$export$dee13898ce686e = async ({ anchorProvider: anchorProvider , recipientPK: recipientPK , symbol: symbol , amount: amount , paymentRequestId: paymentRequestId , customerDetails: customerDetails , quantity: quantity , onSuccess: onSuccess , onError: onError , onPending: onPending , cluster: cluster })=>{
const mintAddress = (0, $d60209765fa3b57f$export$2684242beaf2882f).getCurrencyBySymbol(symbol).mintAddress;
const signature = await $90ced30ac1adafa0$var$sendTransaction(symbol, {
amount: amount,
sender: anchorProvider.provider.wallet.publicKey,
recipient: new (0, $8zHUo$solanaweb3js.PublicKey)(recipientPK),
mintAddress: new (0, $8zHUo$solanaweb3js.PublicKey)(mintAddress),
cluster: cluster
}, anchorProvider);
if (signature === undefined) {
onError({
errorMessage: "Failed to send transaction"
});
return;
}
const approveTransactionPayload = {
transactionSignature: signature,
paymentRequestId: paymentRequestId,
amount: amount,
sender: anchorProvider.provider.wallet.publicKey.toBase58(),
recipient: recipientPK,
currency: symbol,
cluster: cluster,
customerDetails: customerDetails,
quantity: quantity
};
try {
approveTransactionPayload.transactionSignature = signature;
const content = await $90ced30ac1adafa0$var$approveTransaction(approveTransactionPayload);
onSuccess({
transaction: signature,
content: content
});
} catch (e) {
const errorHandler = (message)=>{
onError({
errorMessage: message,
transaction: signature
});
};
if (e instanceof (0, $a8370c494b23842e$export$bba808db88f96979)) {
onPending({
transaction: signature
});
await $90ced30ac1adafa0$var$retryCallback(async ()=>{
const content = await $90ced30ac1adafa0$var$approveTransaction(approveTransactionPayload);
onSuccess({
transaction: signature,
content: content
});
}, 20, 5000, errorHandler);
} else errorHandler(String(e));
}
};
const $1d08a74aa8d05d24$var$CheckMarkIcon = ()=>/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)("svg", {
width: "68",
height: "68",
viewBox: "0 0 68 68",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M33.9998 7.33342C19.2722 7.33342 7.33317 19.2725 7.33317 34.0001C7.33317 48.7277 19.2722 60.6668 33.9998 60.6668C48.7274 60.6668 60.6665 48.7277 60.6665 34.0001C60.6665 19.2725 48.7274 7.33342 33.9998 7.33342ZM0.666504 34.0001C0.666504 15.5906 15.5903 0.666748 33.9998 0.666748C52.4093 0.666748 67.3332 15.5906 67.3332 34.0001C67.3332 52.4096 52.4093 67.3334 33.9998 67.3334C15.5903 67.3334 0.666504 52.4096 0.666504 34.0001Z",
fill: "#F76C1B"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M49.7133 23.3333C51.0021 24.6478 50.9812 26.7583 49.6666 28.0471L32.6666 44.7137C31.4293 45.9268 29.469 45.9896 28.1566 44.8582L18.4899 36.5249C17.0956 35.3228 16.9397 33.2181 18.1417 31.8237C19.3437 30.4293 21.4485 30.2734 22.8429 31.4755L30.1881 37.8076L44.9995 23.2866C46.3141 21.9978 48.4245 22.0187 49.7133 23.3333Z",
fill: "#F76C1B"
})
]
});
var $1d08a74aa8d05d24$export$2e2bcd8739ae039 = $1d08a74aa8d05d24$var$CheckMarkIcon;
class $307c59a6244e64fb$export$624f9366c72d6edb {
static getSolanaExplorerTransactionURL(transactionID, cluster) {
return `https://solscan.io/tx/${transactionID}?cluster=${cluster}`;
}
static getSolanaExplorerAddressURL(address, cluster) {
return `https://solscan.io/address/${address}?cluster=${cluster}`;
}
}
const $d4a55e12688595ae$var$ExplorerLink = ({ transaction: transaction })=>{
const { cluster: cluster } = (0, $2f138ba4c0da2b96$export$78de68c6948c799f)();
if (transaction == null) return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("span", {
children: "Transaction is not available"
});
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("a", {
href: (0, $307c59a6244e64fb$export$624f9366c72d6edb).getSolanaExplorerTransactionURL(transaction, cluster),
target: "_blank",
rel: "noreferrer",
children: "View transaction"
});
};
var $d4a55e12688595ae$export$2e2bcd8739ae039 = $d4a55e12688595ae$var$ExplorerLink;
const $2baa3a9924b8c45a$export$b5324ecb86d442c8 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div``;
const $2baa3a9924b8c45a$export$5d6f8138c2328b16 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
background: #fff;
box-shadow: 0px 8px 10px rgba(195, 200, 209, 0.2);
border-radius: 8px;
width: 400px;
max-width: 100%;
height: 315px;
max-height: 100%;
`;
const $2baa3a9924b8c45a$export$5af44149176fc9f9 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
background: ${({ error: error })=>error ? "#F87272" : "linear-gradient( 89.94deg,#d8d9f5 -2.46%,#feeef6 27.73%,#feede3 63.77%,#fffdf5 103.56%)"};
border-radius: 8px 8px 0px 0px;
height: 8px;
width: 100%;
`;
const $2baa3a9924b8c45a$export$55145b6bab897ac5 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
padding: 12px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
`;
const $2baa3a9924b8c45a$export$5ba32687d59ea01f = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
width: 120px;
height: 120px;
border-radius: 50%;
margin-bottom: 16px;
background: ${({ error: error })=>error ? "#FEE3E3" : "#FFF4ED"};
display: flex;
align-items: center;
justify-content: center;
svg {
width: 80px;
height: 80px;
}
`;
const $2baa3a9924b8c45a$export$8a2d997798d9a8c1 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 700;
font-size: 14px;
line-height: 125%;
margin-bottom: 4px;
color: ${({ error: error })=>error ? "#f87272" : "#8E522E"};
`;
const $2baa3a9924b8c45a$export$e84d889eeb4852c3 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
color: #8e522e;
margin-bottom: 4px;
`;
const $2baa3a9924b8c45a$export$8bb7c3fec569fe11 = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 125%;
text-align: center;
text-decoration-line: underline;
color: #f76c1b;
cursor: pointer;
text-underline-offset: 2px;
a {
text-decoration: none;
color: inherit;
font-weight: inherit;
font-style: inherit;
}
`;
const $2baa3a9924b8c45a$export$82cf702313b9ea7f = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
margin-top: 16px;
`;
const $2baa3a9924b8c45a$export$1140811e02ffd98a = (0, ($parcel$interopDefault($8zHUo$styledcomponents))).div`
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 140%;
letter-spacing: -0.02em;
color: #9ca3af;
a {
text-decoration: underline;
color: #f76c1b;
cursor: pointer;
text-underline-offset: 2px;
}
`;
const $092c213e1ce7efa7$var$PaymentResult = ({ result: result })=>{
const hasError = result?.errorMessage;
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $2baa3a9924b8c45a$export$b5324ecb86d442c8), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $2baa3a9924b8c45a$export$5d6f8138c2328b16), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$5af44149176fc9f9), {
error: !!hasError
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $2baa3a9924b8c45a$export$55145b6bab897ac5), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$5ba32687d59ea01f), {
error: !!hasError,
children: hasError ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$heliofihelioicons.WarningTriangleIcon), {}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $1d08a74aa8d05d24$export$2e2bcd8739ae039), {})
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$8a2d997798d9a8c1), {
error: !!hasError,
children: hasError ? "Transaction failed" : "Success!"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$e84d889eeb4852c3), {
children: hasError ? `We couldn't process this transaction.` : "Transaction confirmed"
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$e84d889eeb4852c3), {
children: result?.errorMessage
}),
hasError ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$8bb7c3fec569fe11), {
onClick: ()=>window.location.reload(),
children: "Try again"
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$8bb7c3fec569fe11), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $d4a55e12688595ae$export$2e2bcd8739ae039), {
transaction: result?.transaction
})
})
]
})
]
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $2baa3a9924b8c45a$export$82cf702313b9ea7f), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $2baa3a9924b8c45a$export$1140811e02ffd98a), {
children: [
"Need help?",
" ",
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("a", {
href: "https://www.hel.io/",
target: "_blank",
rel: "noreferrer",
children: "Contact Helio"
})
]
})
})
]
});
};
var $092c213e1ce7efa7$export$2e2bcd8739ae039 = $092c213e1ce7efa7$var$PaymentResult;
const $945dd0b309c216cf$export$28af31de918e53f5 = ({ onStartPayment: onStartPayment , onSuccess: onSuccess , paymentRequestId: paymentRequestId , onError: onError , onPending: onPending , cluster: cluster , })=>{
const wallet = (0, $8zHUo$solanawalletadapterreact.useAnchorWallet)();
const helioProvider = (0, $7b0da4c5826b088d$export$dd8c890eb4723001)();
const [result, setResult] = (0, $8zHUo$react.useState)(null);
const { currencyList: currencyList , paymentDetails: paymentDetails , getCurrencyList: getCurrencyList , getPaymentDetails: getPaymentDetails , initCluster: initCluster , cluster: mainCluster , } = (0, $2f138ba4c0da2b96$export$78de68c6948c799f)();
const [showFormModal, setShowFormModal] = (0, $8zHUo$react.useState)(false);
const [showLoadingModal, setShowLoadingModal] = (0, $8zHUo$react.useState)(false);
(0, $8zHUo$react.useEffect)(()=>{
initCluster(cluster);
}, [
cluster
]);
(0, $8zHUo$react.useEffect)(()=>{
getCurrencyList();
}, []);
(0, $8zHUo$react.useEffect)(()=>{
if (mainCluster) getPaymentDetails(paymentRequestId);
}, [
paymentRequestId,
mainCluster
]);
const getCurrency = (currency)=>{
if (!currency) return;
return currencyList.find((c)=>c.symbol === currency);
};
const isCustomerDetailsRequired = ()=>{
if (!paymentDetails) return false;
return paymentDetails.requireEmail || paymentDetails.requireFullName || paymentDetails.requireDiscordUsername || paymentDetails.requireTwitterUsername || paymentDetails.requireCountry || paymentDetails.requireDeliveryAddress || paymentDetails.canChangeQuantity || paymentDetails.canChangePrice;
};
const handleSuccessPayment = (event)=>{
onSuccess(event);
setResult(event);
setShowLoadingModal(false);
};
const handleErrorPayment = (event)=>{
onError(event);
setResult(event);
setShowLoadingModal(false);
};
const submitPayment = async ({ amount: amount , quantity: quantity , customerDetails: customerDetails })=>{
if (helioProvider) {
onStartPayment?.();
setShowLoadingModal(true);
setShowFormModal(false);
const recipient = paymentDetails?.owner?.wallets?.items?.[0]?.publicKey;
const payload = {
anchorProvider: helioProvider,
recipientPK: recipient,
symbol: getCurrency(paymentDetails?.currency)?.symbol,
amount: amount * (quantity || 1),
paymentRequestId: paymentRequestId,
onSuccess: handleSuccessPayment,
onError: handleErrorPayment,
onPending: onPending,
customerDetails: customerDetails,
quantity: Number(quantity) ?? 1,
cluster: cluster
};
try {
await (0, $90ced30ac1adafa0$export$dee13898ce686e)(payload);
} catch (error) {
console.log({
error: error
});
}
}
};
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $b2ec992c8303f413$export$1f99da106a398c44), {
children: [
!result ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $8zHUo$reactjsxruntime.Fragment), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $b2ec992c8303f413$export$81761b52b04ea573), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2ec992c8303f413$export$221f581ac9e6dce), {
children: wallet ? /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)("div", {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $092b6831bbf3b794$export$2e2bcd8739ae039), {
onClick: ()=>{
if (isCustomerDetailsRequired()) setShowFormModal(true);
else submitPayment({
amount: paymentDetails?.normalizedPrice,
quantity: 1,
customerDetails: undefined
});
},
disabled: !paymentDetails?.id,
children: "PAY"
})
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$reactjsxruntime.Fragment), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $17bf6ea4f99be17e$export$2e2bcd8739ae039), {})
})
}),
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $b2ec992c8303f413$export$ced921df2f20b82), {
children: [
"Powered by",
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsxs)((0, $b2ec992c8303f413$export$f81d233d83b4f9e7), {
children: [
/*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2ec992c8303f413$export$28be41ac4e8a64c4), {
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $f8673c9442cde184$export$2e2bcd8739ae039), {})
}),
cluster === (0, $2a2b81c25ae8d7fe$export$aad5b37c780fee8b).Devnet && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2ec992c8303f413$export$40edfd27ba0f9274), {
children: "DEVNET"
})
]
})
]
})
]
}),
paymentDetails?.message && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $b2ec992c8303f413$export$7e30077cd8dfa6f4), {
children: paymentDetails.message
}),
wallet && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $bf3a1cd4c32738d7$export$2e2bcd8739ae039), {})
]
}) : /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $092c213e1ce7efa7$export$2e2bcd8739ae039), {
result: result
}),
showFormModal && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $3e3de281221554cd$export$2e2bcd8739ae039), {
onHide: ()=>setShowFormModal(false),
onSubmit: submitPayment
}),
showLoadingModal && /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $50eae0a3751f928b$export$a530fe7a272dd531), {
onHide: ()=>setShowLoadingModal(false)
})
]
});
};
var $945dd0b309c216cf$export$2e2bcd8739ae039 = $945dd0b309c216cf$export$28af31de918e53f5;
const $67d8bd73256b8650$export$164de7ab8df77ef0 = {
colors: {
primary: "#f76c1b"
}
};
const $65ec508d08439ab7$export$1c90827ac4b58be8 = ({ paymentRequestId: paymentRequestId , onSuccess: onSuccess , onError: onError , onPending: onPending , onStartPayment: onStartPayment , theme: theme , cluster: cluster })=>{
const [currentTheme, setCurrentTheme] = (0, $8zHUo$react.useState)((0, $67d8bd73256b8650$export$164de7ab8df77ef0));
(0, $8zHUo$react.useEffect)(()=>{
const mergedTheme = (0, $d7167569386d0d4c$export$6969335ea1e4e77c)((0, $67d8bd73256b8650$export$164de7ab8df77ef0), theme || {});
setCurrentTheme(mergedTheme);
}, [
theme
]);
return /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $8zHUo$styledcomponents.ThemeProvider), {
theme: currentTheme,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $1f35fb592a369309$export$c5409cdf1943e1a3), {
cluster: cluster,
children: /*#__PURE__*/ (0, $8zHUo$reactjsxruntime.jsx)((0, $945dd0b309c216cf$export$2e2bcd8739ae039), {
paymentRequestId: paymentRequestId,
onStartPayment: onStartPayment,
onSuccess: onSuccess,
onError: onError,
onPending: onPending,
cluster: cluster
})
})
});
};
var $65ec508d08439ab7$export$2e2bcd8739ae039 = $65ec508d08439ab7$export$1c90827ac4b58be8;
$parcel$exportWildcard(module.exports, $5dcc767f924b770d$exports);
$parcel$exportWildcard(module.exports, $9701ba2273add435$exports);
//# sourceMappingURL=index.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment