@getpara/react-common 1.8.0 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/classes/ParaInternal.d.ts +16 -16
  2. package/dist/components/UserIdentifier.d.ts +4 -2
  3. package/dist/components/common.d.ts +3 -3
  4. package/dist/index.js +1279 -5
  5. package/dist/index.js.br +0 -0
  6. package/dist/index.js.gz +0 -0
  7. package/dist/types/externalWalletCommon.d.ts +79 -0
  8. package/dist/types/index.d.ts +3 -2
  9. package/dist/utils/index.d.ts +0 -1
  10. package/package.json +5 -6
  11. package/dist/chunk-IV3L3JVM.js +0 -46
  12. package/dist/classes/ParaInternal.js +0 -25
  13. package/dist/classes/index.js +0 -2
  14. package/dist/components/HeroSpinner.js +0 -55
  15. package/dist/components/KnownDevices.js +0 -60
  16. package/dist/components/MoonPayEmbed.js +0 -195
  17. package/dist/components/QRCode.js +0 -80
  18. package/dist/components/RampEmbed.js +0 -103
  19. package/dist/components/StripeEmbed.js +0 -138
  20. package/dist/components/UserIdentifier.js +0 -73
  21. package/dist/components/common.js +0 -54
  22. package/dist/components/index.js +0 -9
  23. package/dist/constants/aaguiMetadata.js +0 -145
  24. package/dist/hooks/index.js +0 -2
  25. package/dist/hooks/useCopyToClipboard.js +0 -36
  26. package/dist/package.json +0 -6
  27. package/dist/types/index.js +0 -1
  28. package/dist/utils/formatBiometricHints.js +0 -51
  29. package/dist/utils/formatPhoneNumber.d.ts +0 -1
  30. package/dist/utils/formatPhoneNumber.js +0 -25
  31. package/dist/utils/getBrowserName.js +0 -7
  32. package/dist/utils/getDeviceLogo.js +0 -36
  33. package/dist/utils/getDeviceModelName.js +0 -21
  34. package/dist/utils/getExternalWalletDisplayName.js +0 -22
  35. package/dist/utils/index.js +0 -113
  36. package/dist/utils/offRampSend.js +0 -71
Binary file
Binary file
@@ -0,0 +1,79 @@
1
+ import { AuthStateLogin, AuthStateVerify, WalletType } from '@getpara/web-sdk';
2
+ export type WalletMetadata = {
3
+ id: string;
4
+ name: string;
5
+ iconUrl: string;
6
+ rdns?: string;
7
+ installed?: boolean;
8
+ isExtension?: boolean;
9
+ isMobile?: boolean;
10
+ isWeb?: boolean;
11
+ downloadUrl?: string;
12
+ getQrUri?: () => Promise<string>;
13
+ downloadUrls?: {
14
+ android?: string;
15
+ ios?: string;
16
+ mobile?: string;
17
+ qrCode?: string;
18
+ chrome?: string;
19
+ edge?: string;
20
+ firefox?: string;
21
+ opera?: string;
22
+ safari?: string;
23
+ browserExtension?: string;
24
+ macos?: string;
25
+ windows?: string;
26
+ linux?: string;
27
+ desktop?: string;
28
+ };
29
+ };
30
+ export type CommonWallet = {
31
+ connect: () => Promise<{
32
+ address?: string;
33
+ bufferAddress?: string;
34
+ error?: string;
35
+ authState?: AuthStateLogin | AuthStateVerify;
36
+ }>;
37
+ connectMobile: (isManualWalletConnect?: boolean) => Promise<{
38
+ address?: string;
39
+ bufferAddress?: string;
40
+ error?: string;
41
+ authState?: AuthStateLogin | AuthStateVerify;
42
+ }>;
43
+ type: WalletType;
44
+ } & WalletMetadata;
45
+ export type CommonChain = {
46
+ id: string | number;
47
+ name: string;
48
+ };
49
+ export declare enum EvmWallet {
50
+ METAMASK = "METAMASK",
51
+ RAINBOW = "RAINBOW",
52
+ COINBASE = "COINBASE",
53
+ WALLETCONNECT = "WALLETCONNECT",
54
+ ZERION = "ZERION",
55
+ RABBY = "RABBY"
56
+ }
57
+ export declare enum SolanaWallet {
58
+ PHANTOM = "PHANTOM",
59
+ GLOW = "GLOW",
60
+ BACKPACK = "BACKPACK"
61
+ }
62
+ export declare enum CosmosWallet {
63
+ KEPLR = "KEPLR",
64
+ LEAP = "LEAP"
65
+ }
66
+ export declare const ExternalWallet: {
67
+ KEPLR: CosmosWallet.KEPLR;
68
+ LEAP: CosmosWallet.LEAP;
69
+ PHANTOM: SolanaWallet.PHANTOM;
70
+ GLOW: SolanaWallet.GLOW;
71
+ BACKPACK: SolanaWallet.BACKPACK;
72
+ METAMASK: EvmWallet.METAMASK;
73
+ RAINBOW: EvmWallet.RAINBOW;
74
+ COINBASE: EvmWallet.COINBASE;
75
+ WALLETCONNECT: EvmWallet.WALLETCONNECT;
76
+ ZERION: EvmWallet.ZERION;
77
+ RABBY: EvmWallet.RABBY;
78
+ };
79
+ export type TExternalWallet = keyof typeof ExternalWallet;
@@ -1,5 +1,6 @@
1
- import { ExtractAuth } from '@getpara/user-management-client';
1
+ import { AuthInfo } from '@getpara/user-management-client';
2
2
  import ParaWeb, { type OnRampConfig, type OnRampPurchase } from '@getpara/web-sdk';
3
+ export * from './externalWalletCommon.js';
3
4
  export type Props = {
4
5
  appName?: string;
5
6
  para: ParaWeb;
@@ -10,7 +11,7 @@ export type Props = {
10
11
  onRampPurchase: OnRampPurchase;
11
12
  setOnRampPurchase?: (_: OnRampPurchase) => void;
12
13
  };
13
- export type ModalAuthInfo = ExtractAuth & Partial<{
14
+ export type ModalAuthInfo = AuthInfo & Partial<{
14
15
  pfpUrl: string | null;
15
16
  displayName: string | null;
16
17
  }>;
@@ -32,5 +32,4 @@ export * from './getDeviceLogo.js';
32
32
  export * from './getDeviceModelName.js';
33
33
  export * from './getBrowserName.js';
34
34
  export * from './formatBiometricHints.js';
35
- export * from './formatPhoneNumber.js';
36
35
  export * from './getExternalWalletDisplayName.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-common",
3
- "version": "1.8.0",
3
+ "version": "2.0.0-alpha.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "*.css"
12
12
  ],
13
13
  "dependencies": {
14
- "@getpara/react-components": "1.8.0",
15
- "@getpara/web-sdk": "1.8.0",
14
+ "@getpara/react-components": "2.0.0-alpha.3",
15
+ "@getpara/web-sdk": "2.0.0-alpha.3",
16
16
  "@moonpay/moonpay-react": "^1.8.3",
17
17
  "@ramp-network/ramp-instant-sdk": "^4.0.5",
18
18
  "@stripe/crypto": "^0.0.4",
@@ -23,8 +23,7 @@
23
23
  },
24
24
  "scripts": {
25
25
  "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
26
- "typegen": "tsc --emitDeclarationOnly",
27
- "test": "vitest run --coverage"
26
+ "typegen": "tsc --emitDeclarationOnly"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@types/react": "^18.0.31",
@@ -43,5 +42,5 @@
43
42
  "resolutions": {
44
43
  "styled-components": "^6"
45
44
  },
46
- "gitHead": "ef96e79558695ccbe148d25a8e3611c4596d1954"
45
+ "gitHead": "77a1e04b06258842ca9c81e3db2a2b0092517659"
47
46
  }
@@ -1,46 +0,0 @@
1
- "use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
40
- };
41
-
42
- export {
43
- __spreadValues,
44
- __spreadProps,
45
- __async
46
- };
@@ -1,25 +0,0 @@
1
- "use client";
2
- import "../chunk-IV3L3JVM.js";
3
- import ParaWeb from "@getpara/web-sdk";
4
- class ParaInternal extends ParaWeb {
5
- constructor() {
6
- super(...arguments);
7
- this.getSupportedCreateAuthMethods = super.getSupportedCreateAuthMethods;
8
- this.isUsingExternalWallet = super.isUsingExternalWallet;
9
- this.getTransmissionKeyShares = super.getTransmissionKeyShares;
10
- this.userSetupAfterLogin = super.userSetupAfterLogin;
11
- this.setLoginEncryptionKeyPair = super.setLoginEncryptionKeyPair;
12
- this.getPortalURL = super.getPortalURL;
13
- this.isProviderModalDisabled = super.isProviderModalDisabled;
14
- this.supportedAuthMethods = super.supportedAuthMethods;
15
- this.getUserBiometricLocationHints = super.getUserBiometricLocationHints;
16
- this.exitLoops = super.exitLoops;
17
- this.exitLogin = super.exitLogin;
18
- this.exitAccountCreation = super.exitAccountCreation;
19
- this.exitOAuth = super.exitOAuth;
20
- this.exitFarcaster = super.exitFarcaster;
21
- }
22
- }
23
- export {
24
- ParaInternal
25
- };
@@ -1,2 +0,0 @@
1
- "use client";
2
- export * from "./ParaInternal.js";
@@ -1,55 +0,0 @@
1
- "use client";
2
- import "../chunk-IV3L3JVM.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
5
- import styled from "styled-components";
6
- function HeroSpinner({
7
- icon,
8
- status = "inactive",
9
- text
10
- }) {
11
- return /* @__PURE__ */ jsxs(Root, { children: [
12
- /* @__PURE__ */ jsxs(Hero, { children: [
13
- /* @__PURE__ */ jsx(Spinner, { size: 150, barWidth: 9, variant: status === "loading" ? "default" : status }),
14
- icon && /* @__PURE__ */ jsx(CpslIcon, { icon, size: "80px" })
15
- ] }),
16
- /* @__PURE__ */ jsxs(Text, { status, children: [
17
- status === "error" && /* @__PURE__ */ jsx(CpslIcon, { icon: "alertCircle", size: "16px", style: { stroke: "currentColor" } }),
18
- /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "semiBold", color: status === "error" ? "error" : "primary", children: text })
19
- ] })
20
- ] });
21
- }
22
- const Root = styled.div`
23
- height: 276px;
24
- display: flex;
25
- flex-direction: column;
26
- justify-content: center;
27
- align-items: center;
28
- gap: 16px;
29
- `;
30
- const Hero = styled.div`
31
- width: 150px;
32
- height: 150px;
33
- margin: 16px 0;
34
- display: flex;
35
- justify-content: center;
36
- align-items: center;
37
- position: relative;
38
- `;
39
- const Text = styled.div`
40
- display: flex;
41
- gap: 4px;
42
- align-items: center;
43
- color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : "auto"};
44
- `;
45
- const Spinner = styled(CpslSpinner)`
46
- position: absolute;
47
- width: 150px;
48
- height: 150px;
49
- top: 0;
50
- left: 0;
51
- right: 0;
52
- `;
53
- export {
54
- HeroSpinner
55
- };
@@ -1,60 +0,0 @@
1
- "use client";
2
- import "../chunk-IV3L3JVM.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
5
- import styled from "styled-components";
6
- import { CenteredColumnContainer, FullWidthFilledDisabledInput, CenteredText } from "./common.js";
7
- import { QRCode } from "./QRCode.js";
8
- import { getDeviceLogo, getDeviceModelName } from "../utils/index.js";
9
- import { useCopyToClipboard } from "../hooks/index.js";
10
- const KnownDevices = ({ hints, link, showCurrentDevice }) => {
11
- const [isCopied, copy] = useCopyToClipboard();
12
- const handleCopy = () => {
13
- copy(link);
14
- };
15
- return /* @__PURE__ */ jsxs(Container, { children: [
16
- /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", children: "Continue with one of your other known devices" }),
17
- !!hints.formattedHints.length && /* @__PURE__ */ jsx(DevicesContainer, { children: hints.formattedHints.map(
18
- (hint) => {
19
- var _a, _b, _c;
20
- return (showCurrentDevice && hint.isKnownDevice || !hint.isKnownDevice) && /* @__PURE__ */ jsxs(DeviceListItem, { children: [
21
- /* @__PURE__ */ jsx(DeviceLogo, { icon: getDeviceLogo(hint.device.vendor, hint.isMobile) }),
22
- /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "contrast", children: (_b = (_a = getDeviceModelName(hint.device.model)) != null ? _a : hint.device.vendor) != null ? _b : hint.os.name }),
23
- (hint.browser || hint.passwordManager) && /* @__PURE__ */ jsxs(Fragment, { children: [
24
- /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "secondary", children: "using" }),
25
- /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "contrast", children: (_c = hint.passwordManager) != null ? _c : hint.browser.name })
26
- ] })
27
- ] }, hint.key);
28
- }
29
- ) }),
30
- hints.hasMobileDevice ? /* @__PURE__ */ jsx(QRCode, { link, icon: "paraIconQr" }) : /* @__PURE__ */ jsxs(CenteredColumnContainer, { children: [
31
- /* @__PURE__ */ jsx(FullWidthFilledDisabledInput, { noAutoDisable: true, readonly: true, disabled: true, value: link, children: /* @__PURE__ */ jsx(CpslButton, { slot: "end", variant: "ghost", onClick: handleCopy, children: /* @__PURE__ */ jsx(CpslIcon, { icon: isCopied ? "check" : "copy" }) }) }),
32
- /* @__PURE__ */ jsx(CenteredText, { color: "secondary", variant: "bodyS", weight: "medium", children: "Navigate to this link using your other device" })
33
- ] })
34
- ] });
35
- };
36
- const Container = styled(CenteredColumnContainer)`
37
- gap: 16px;
38
- `;
39
- const DevicesContainer = styled.div`
40
- display: flex;
41
- flex-direction: column;
42
- gap: 8px;
43
- background: var(--cpsl-color-background-4);
44
- padding: 16px;
45
- width: 100%;
46
- border-radius: 16px;
47
- `;
48
- const DeviceListItem = styled.div`
49
- display: flex;
50
- gap: 4px;
51
- align-items: center;
52
- `;
53
- const DeviceLogo = styled(CpslIcon)`
54
- --icon-color: var(--cpsl-color-text-contrast);
55
- --height: 16px;
56
- --width: 16px;
57
- `;
58
- export {
59
- KnownDevices
60
- };
@@ -1,195 +0,0 @@
1
- "use client";
2
- import {
3
- __async,
4
- __spreadProps,
5
- __spreadValues
6
- } from "../chunk-IV3L3JVM.js";
7
- import { jsx } from "react/jsx-runtime";
8
- import { OnRampProvider, OnRampPurchaseStatus } from "@getpara/web-sdk";
9
- import { lazy, useCallback, useEffect, useMemo, useState } from "react";
10
- import { getCurrencyCodes, reverseCurrencyLookup, offRampSend } from "../utils/index.js";
11
- import styled from "styled-components";
12
- const MOONPAY_PUBLISHABLE_KEY = "pk_live_EQva4LydtNDE0Rwd9X7SG9w58wqOzbux";
13
- const MOONPAY_PUBLISHABLE_KEY_TEST = "pk_test_HYobzemmTBXxcSStVA4dSED6jT";
14
- const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase, setOnRampPurchase }) => {
15
- const [LazyMoonPayBuyWidget, setLazyMoonPayBuyWidget] = useState(null);
16
- const [LazyMoonPaySellWidget, setLazyMoonPaySellWidget] = useState(null);
17
- const [LazyMoonPayProvider, setLazyMoonPayProvider] = useState(null);
18
- useEffect(() => {
19
- const _LazyMoonPayBuyWidget = lazy(
20
- () => import("@moonpay/moonpay-react").then((mod) => ({ default: mod.MoonPayBuyWidget }))
21
- );
22
- const _LazyMoonPaySellWidget = lazy(
23
- () => import("@moonpay/moonpay-react").then((mod) => ({ default: mod.MoonPaySellWidget }))
24
- );
25
- const _LazyMoonPayProvider = lazy(
26
- () => import("@moonpay/moonpay-react").then((mod) => ({ default: mod.MoonPayProvider }))
27
- );
28
- setLazyMoonPayBuyWidget(_LazyMoonPayBuyWidget);
29
- setLazyMoonPaySellWidget(_LazyMoonPaySellWidget);
30
- setLazyMoonPayProvider(_LazyMoonPayProvider);
31
- }, []);
32
- const apiKey = onRampPurchase.testMode ? MOONPAY_PUBLISHABLE_KEY_TEST : MOONPAY_PUBLISHABLE_KEY;
33
- const onUrlSignatureRequested = useCallback(
34
- (url) => __async(void 0, null, function* () {
35
- if (!para.getUserId() || !onRampPurchase.walletType) {
36
- throw new Error("missing required fields");
37
- }
38
- const res = yield para.ctx.client.signMoonPayUrl(para.getUserId(), {
39
- url,
40
- type: onRampPurchase.walletType,
41
- cosmosPrefix: para.cosmosPrefix,
42
- testMode: onRampPurchase.testMode,
43
- walletId: onRampPurchase.walletId || void 0,
44
- externalWalletAddress: onRampPurchase.externalWalletAddress || void 0
45
- });
46
- return res.data.signature;
47
- }),
48
- [onRampPurchase.walletId, onRampPurchase.walletType, para.cosmosPrefix, onRampPurchase.testMode, para]
49
- );
50
- const { currencyCodes, defaultCurrencyCode } = useMemo(
51
- () => getCurrencyCodes(onRampConfig, {
52
- provider: OnRampProvider.MOONPAY,
53
- walletType: onRampPurchase.walletType,
54
- purchaseType: onRampPurchase.type
55
- }),
56
- [onRampPurchase.walletType, onRampPurchase.type, onRampConfig.assetInfo, onRampConfig == null ? void 0 : onRampConfig.allowedAssets]
57
- );
58
- const onTransactionCompleted = useCallback(
59
- (payload) => __async(void 0, null, function* () {
60
- try {
61
- const [network, asset] = reverseCurrencyLookup(
62
- onRampConfig.assetInfo,
63
- OnRampProvider.MOONPAY,
64
- payload.quoteCurrency.code
65
- );
66
- const updated = yield para.ctx.client.updateOnRampPurchase({
67
- userId: para.getUserId(),
68
- walletId: onRampPurchase.walletId,
69
- purchaseId: onRampPurchase.id,
70
- externalWalletAddress: onRampPurchase.externalWalletAddress,
71
- updates: {
72
- fiatQuantity: payload.baseCurrencyAmount.toString(),
73
- fiat: payload.baseCurrency.code,
74
- network,
75
- asset,
76
- assetQuantity: payload.quoteCurrencyAmount.toString(),
77
- status: OnRampPurchaseStatus.FINISHED
78
- }
79
- });
80
- setOnRampPurchase(updated);
81
- if (!isEmbedded) {
82
- setTimeout(() => {
83
- if (typeof window !== "undefined") {
84
- window.close();
85
- }
86
- }, 5e3);
87
- }
88
- } catch (e) {
89
- console.error(e);
90
- }
91
- }),
92
- [onRampPurchase.walletId, onRampPurchase.id, onRampPurchase.externalWalletAddress, isEmbedded]
93
- );
94
- const onInitiateDeposit = useCallback(
95
- (payload) => __async(void 0, null, function* () {
96
- const txHash = yield offRampSend(para, onRampPurchase, setOnRampPurchase, {
97
- assetQuantity: payload.cryptoCurrencyAmount,
98
- fiatQuantity: payload.fiatCurrencyAmount || void 0,
99
- fiat: payload.fiatCurrency.code.toUpperCase(),
100
- destinationAddress: payload.depositWalletAddress,
101
- contractAddress: payload.cryptoCurrency.contractAddress,
102
- chainId: payload.cryptoCurrency.chainId
103
- });
104
- return { depositId: txHash, cancelTransactionOnError: false };
105
- }),
106
- [
107
- para,
108
- onRampPurchase.id,
109
- onRampPurchase.testMode,
110
- onRampPurchase.walletId,
111
- onRampPurchase.walletType,
112
- setOnRampPurchase
113
- ]
114
- );
115
- const embed = useMemo(() => {
116
- if (!LazyMoonPayBuyWidget || !LazyMoonPaySellWidget) {
117
- return null;
118
- }
119
- const walletAddresses = currencyCodes.reduce((acc, code) => {
120
- return __spreadProps(__spreadValues({}, acc), { [code.toLowerCase()]: onRampPurchase.address });
121
- }, {});
122
- return onRampPurchase.type === "BUY" ? /* @__PURE__ */ jsx(
123
- LazyMoonPayBuyWidget,
124
- {
125
- variant: "embedded",
126
- baseCurrencyCode: onRampPurchase.fiat,
127
- baseCurrencyAmount: onRampPurchase.fiatQuantity,
128
- showOnlyCurrencies: currencyCodes.join(","),
129
- defaultCurrencyCode,
130
- walletAddresses: JSON.stringify(walletAddresses),
131
- visible: true,
132
- theme: isDark ? "dark" : "light",
133
- style: {
134
- height: "100%",
135
- width: "100%",
136
- border: "none",
137
- borderRadius: 0,
138
- margin: 0
139
- },
140
- onTransactionCompleted,
141
- onUrlSignatureRequested
142
- }
143
- ) : /* @__PURE__ */ jsx(
144
- LazyMoonPaySellWidget,
145
- {
146
- variant: "embedded",
147
- refundWalletAddresses: JSON.stringify(walletAddresses),
148
- visible: true,
149
- theme: isDark ? "dark" : "light",
150
- style: {
151
- height: "100%",
152
- width: "100%",
153
- border: "none",
154
- borderRadius: 0,
155
- margin: 0
156
- },
157
- showOnlyCurrencies: currencyCodes.join(","),
158
- defaultCurrencyCode: currencyCodes[0],
159
- onInitiateDeposit,
160
- onTransactionCompleted,
161
- onUrlSignatureRequested
162
- }
163
- );
164
- }, [
165
- onRampPurchase.type,
166
- onRampPurchase.address,
167
- onRampPurchase.walletId,
168
- onRampPurchase.walletType,
169
- defaultCurrencyCode,
170
- currencyCodes,
171
- onInitiateDeposit,
172
- onTransactionCompleted,
173
- onUrlSignatureRequested,
174
- isDark,
175
- LazyMoonPayBuyWidget,
176
- LazyMoonPaySellWidget
177
- ]);
178
- if (!LazyMoonPayProvider) {
179
- return null;
180
- }
181
- return /* @__PURE__ */ jsx(Container, { isEmbedded, children: /* @__PURE__ */ jsx(LazyMoonPayProvider, { apiKey, debug: onRampPurchase.testMode, children: embed }) });
182
- };
183
- var MoonPayEmbed_default = MoonPayEmbed;
184
- const Container = styled.div`
185
- width: ${({ isEmbedded }) => isEmbedded ? "100%" : "100vw"};
186
- height: ${({ isEmbedded }) => isEmbedded ? "640px" : "100vh"};
187
-
188
- iframe {
189
- border: 0 !important;
190
- }
191
- `;
192
- export {
193
- MoonPayEmbed,
194
- MoonPayEmbed_default as default
195
- };
@@ -1,80 +0,0 @@
1
- "use client";
2
- import "../chunk-IV3L3JVM.js";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
- import styled from "styled-components";
6
- import { useCopyToClipboard } from "../hooks/index.js";
7
- import { isMobile } from "@getpara/web-sdk";
8
- const QRCode = ({ link, imageSrc, icon, qrSize = 202, spinnerSize = 60 }) => {
9
- const [isCopied, copy] = useCopyToClipboard();
10
- const isMobileScreen = isMobile();
11
- const handleCopy = () => {
12
- copy(link);
13
- };
14
- return /* @__PURE__ */ jsxs(QRContainer, { $isMobile: isMobileScreen, children: [
15
- isMobileScreen && /* @__PURE__ */ jsxs(MobileCopyButton, { fullWidth: true, onClick: handleCopy, children: [
16
- /* @__PURE__ */ jsx(CopyIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
17
- /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", children: isCopied ? "Copied" : "Copy Link Instead" })
18
- ] }),
19
- !link ? /* @__PURE__ */ jsx(LoadingContainer, { $size: qrSize, children: /* @__PURE__ */ jsx(CpslSpinner, { size: spinnerSize }) }) : /* @__PURE__ */ jsx(StyledQRCode, { url: link, size: qrSize, icon, imageSrc }),
20
- !isMobileScreen && /* @__PURE__ */ jsxs(CopyButton, { size: "small", onClick: handleCopy, children: [
21
- /* @__PURE__ */ jsx(CopyIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
22
- /* @__PURE__ */ jsx(CpslText, { variant: "body2XS", children: isCopied ? "Copied" : "Copy Link Instead" })
23
- ] })
24
- ] });
25
- };
26
- const QRContainer = styled.div`
27
- display: flex;
28
- flex-direction: column;
29
- justify-content: center;
30
- align-items: center;
31
- border: 1px solid;
32
- border-color: var(--cpsl-color-background-16);
33
- border-radius: 16px;
34
- background-color: white;
35
- overflow: hidden;
36
- padding-bottom: ${({ $isMobile }) => $isMobile ? "0px" : "16px"};
37
- padding-top: ${({ $isMobile }) => $isMobile ? "16px" : "0px"};
38
- `;
39
- const StyledQRCode = styled(CpslQrCode)`
40
- --qr-box-shadow: none;
41
- --qr-border-radius: 0px;
42
- `;
43
- const CopyButton = styled(CpslButton)`
44
- --button-primary-color: var(--cpsl-color-text-contrast);
45
- --button-primary-background-color: var(--cpsl-color-background-4);
46
-
47
- --button-primary-hover-color: var(--cpsl-color-text-contrast);
48
- --button-primary-hover-background-color: var(--cpsl-color-background-16);
49
-
50
- --button-primary-active-color: var(--cpsl-color-text-contrast);
51
- --button-primary-active-background-color: var(--cpsl-color-background-4);
52
-
53
- --button-padding-start: 8px;
54
- --button-padding-end: 8px;
55
- --button-padding-top: 2px;
56
- --button-padding-bottom: 2px;
57
-
58
- --button-border-radius: 1000px;
59
- `;
60
- const MobileCopyButton = styled(CopyButton)`
61
- --button-padding-top: 4px;
62
- --button-padding-bottom: 4px;
63
-
64
- padding: 0px 12px;
65
- `;
66
- const CopyIcon = styled(CpslIcon)`
67
- --width: 16px;
68
- --height: 16px;
69
- --icon-color: var(--cpsl-color-text-contrast);
70
- `;
71
- const LoadingContainer = styled.div`
72
- display: flex;
73
- justify-content: center;
74
- align-items: center;
75
- height: ${({ $size }) => `${$size}px`};
76
- width: ${({ $size }) => `${$size}px`};
77
- `;
78
- export {
79
- QRCode
80
- };