@easypayment/medusa-paypal-ui 1.2.2 → 1.2.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.
@@ -1,19 +1,24 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import type { PayPalConfig } from "../client/types"
5
-
6
- export function PayPalCurrencyNotice({ config }: { config: PayPalConfig }) {
7
- if (config.currency_supported) return null
8
-
9
- return (
10
- <div role="alert" style={{ padding: 12, border: "1px solid #ddd", borderRadius: 10 }}>
11
- <div style={{ fontWeight: 600, marginBottom: 6 }}>PayPal currency issue</div>
12
- <ul style={{ margin: 0, paddingLeft: 18 }}>
13
- {(config.currency_errors || []).map((e) => (
14
- <li key={e}>{e}</li>
15
- ))}
16
- </ul>
17
- </div>
18
- )
19
- }
1
+ "use client"
2
+
3
+ import React from "react"
4
+ import type { PayPalConfig } from "../client/types"
5
+
6
+ export function PayPalCurrencyNotice({ config }: { config: PayPalConfig }) {
7
+ if (config.currency_supported) return null
8
+
9
+ return (
10
+ <div
11
+ role="alert"
12
+ style={{ padding: 12, border: "1px solid #ddd", borderRadius: 10 }}
13
+ >
14
+ <div style={{ fontWeight: 600, marginBottom: 6 }}>
15
+ PayPal currency issue
16
+ </div>
17
+ <ul style={{ margin: 0, paddingLeft: 18 }}>
18
+ {(config.currency_errors || []).map((e) => (
19
+ <li key={e}>{e}</li>
20
+ ))}
21
+ </ul>
22
+ </div>
23
+ )
24
+ }
@@ -10,7 +10,11 @@ import {
10
10
 
11
11
  // Re-exported for backward compatibility — these have always been part of this
12
12
  // module's public API. The canonical definitions live in ../constants.
13
- export { PAYPAL_WALLET_PROVIDER_ID, PAYPAL_CARD_PROVIDER_ID, isPayPalProviderId }
13
+ export {
14
+ PAYPAL_WALLET_PROVIDER_ID,
15
+ PAYPAL_CARD_PROVIDER_ID,
16
+ isPayPalProviderId,
17
+ }
14
18
 
15
19
  const SPIN_STYLE = `@keyframes _pp_section_spin { to { transform: rotate(360deg) } }`
16
20
 
@@ -1,38 +1,44 @@
1
- "use client"
2
-
3
- import React, { useMemo } from "react"
4
- import { PayPalScriptProvider } from "@paypal/react-paypal-js"
5
- import type { ReactPayPalScriptOptions } from "@paypal/react-paypal-js"
6
- import type { PayPalConfig } from "../client/types"
7
-
8
- const BN_CODE = "MBJTechnolabs_SI_SPB"
9
-
10
- export function PayPalProvider(props: {
11
- config: PayPalConfig
12
- intent?: "capture" | "authorize"
13
- disableFunding?: string
14
- children: React.ReactNode
15
- }) {
16
- const { config, intent = "capture", disableFunding, children } = props
17
-
18
- const options = useMemo((): ReactPayPalScriptOptions => {
19
- return {
20
- clientId: config.client_id,
21
- currency: config.currency,
22
- intent,
23
- components: config.client_token ? "buttons,card-fields" : "buttons",
24
- "data-client-token": config.client_token || undefined,
25
- "disable-funding": disableFunding,
26
- "data-partner-attribution-id": BN_CODE,
27
- }
28
- }, [config.client_id, config.currency, config.client_token, intent, disableFunding])
29
-
30
- return (
31
- <PayPalScriptProvider
32
- key={`${options.clientId}-${options["data-client-token"] ?? "no-token"}`}
33
- options={options}
34
- >
35
- {children}
36
- </PayPalScriptProvider>
37
- )
38
- }
1
+ "use client"
2
+
3
+ import React, { useMemo } from "react"
4
+ import { PayPalScriptProvider } from "@paypal/react-paypal-js"
5
+ import type { ReactPayPalScriptOptions } from "@paypal/react-paypal-js"
6
+ import type { PayPalConfig } from "../client/types"
7
+
8
+ const BN_CODE = "MBJTechnolabs_SI_SPB"
9
+
10
+ export function PayPalProvider(props: {
11
+ config: PayPalConfig
12
+ intent?: "capture" | "authorize"
13
+ disableFunding?: string
14
+ children: React.ReactNode
15
+ }) {
16
+ const { config, intent = "capture", disableFunding, children } = props
17
+
18
+ const options = useMemo((): ReactPayPalScriptOptions => {
19
+ return {
20
+ clientId: config.client_id,
21
+ currency: config.currency,
22
+ intent,
23
+ components: config.client_token ? "buttons,card-fields" : "buttons",
24
+ "data-client-token": config.client_token || undefined,
25
+ "disable-funding": disableFunding,
26
+ "data-partner-attribution-id": BN_CODE,
27
+ }
28
+ }, [
29
+ config.client_id,
30
+ config.currency,
31
+ config.client_token,
32
+ intent,
33
+ disableFunding,
34
+ ])
35
+
36
+ return (
37
+ <PayPalScriptProvider
38
+ key={`${options.clientId}-${options["data-client-token"] ?? "no-token"}`}
39
+ options={options}
40
+ >
41
+ {children}
42
+ </PayPalScriptProvider>
43
+ )
44
+ }