react-easy-wall 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/paywall/Paywall.js +3 -5
- package/dist/cjs/components/paywall/Paywall.js.map +1 -1
- package/dist/cjs/components/paywall/PaywallSubscription.js +1 -0
- package/dist/cjs/components/paywall/PaywallSubscription.js.map +1 -1
- package/dist/esm/components/paywall/Paywall.js +3 -5
- package/dist/esm/components/paywall/Paywall.js.map +1 -1
- package/dist/esm/components/paywall/PaywallSubscription.js +1 -0
- package/dist/esm/components/paywall/PaywallSubscription.js.map +1 -1
- package/dist/esm/types/components/paywall/Paywall.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var session_hooks = require('../session/session.hooks.js');
|
|
6
|
-
var PaywallSubscription = require('./PaywallSubscription.js');
|
|
7
5
|
|
|
8
|
-
const Paywall = ({ children, post, postTypeField, postType }) => {
|
|
6
|
+
const Paywall = ({ children, post, postTypeField, postType, PaywallSubscriptionComponent, PaywallRegisterComponent, }) => {
|
|
9
7
|
const { user, subscription } = session_hooks.useSession();
|
|
10
8
|
const postTypeValue = post[postTypeField];
|
|
11
9
|
if (!subscription && post && postTypeValue && postTypeValue === postType) {
|
|
12
|
-
return
|
|
10
|
+
return PaywallSubscriptionComponent;
|
|
13
11
|
}
|
|
14
12
|
if (!user && post && postTypeValue && postTypeValue === postType) {
|
|
15
|
-
return
|
|
13
|
+
return PaywallRegisterComponent;
|
|
16
14
|
}
|
|
17
15
|
return children;
|
|
18
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paywall.js","sources":["../../../../src/components/paywall/Paywall.tsx"],"sourcesContent":["'use client';\nimport React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Paywall.js","sources":["../../../../src/components/paywall/Paywall.tsx"],"sourcesContent":["'use client';\nimport React from 'react';\nimport { useSession } from '../session/session.hooks';\nimport { PaywallSubscription } from './PaywallSubscription';\n\nexport interface PaywallProps {\n children?: React.ReactNode;\n PaywallSubscriptionComponent?: React.ReactNode;\n PaywallRegisterComponent?: React.ReactNode;\n post?: any;\n postTypeField?: string;\n postType?: string;\n}\n\nexport const Paywall: React.FC<PaywallProps> = ({\n children,\n post,\n postTypeField,\n postType,\n PaywallSubscriptionComponent,\n PaywallRegisterComponent,\n}) => {\n const { user, subscription } = useSession();\n const postTypeValue = post[postTypeField as string];\n if (!subscription && post && postTypeValue && postTypeValue === postType) {\n return PaywallSubscriptionComponent;\n }\n\n if (!user && post && postTypeValue && postTypeValue === postType) {\n return PaywallRegisterComponent;\n }\n\n return children;\n};\n"],"names":[],"mappings":";;;;;AAcO;;AASL;;AAEE;;;AAIA;;AAGF;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaywallSubscription.js","sources":["../../../../src/components/paywall/PaywallSubscription.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"PaywallSubscription.js","sources":["../../../../src/components/paywall/PaywallSubscription.tsx"],"sourcesContent":["'use client'\nimport React from 'react';\nimport { Box, BoxProps, Typography, TypographyProps, ButtonProps, Button } from '@mui/material';\nimport { PAYWALL_AUTH_ENDPOINT } from './paywall.constants';\n\nexport interface PaywallSubscriptionProps {\n post?: any;\n containerProps?: BoxProps;\n titleProps?: TypographyProps;\n subtitleProps?: TypographyProps;\n buttonProps?: ButtonProps;\n buttonText?: string;\n secondaryButtonProps?: ButtonProps;\n secondaryButtonText?: string;\n title?: string;\n subtitle?: string;\n withCaption?: boolean;\n}\n\nexport const PaywallSubscription: React.FC<PaywallSubscriptionProps> = ({\n containerProps = {},\n subtitleProps = {},\n buttonProps = {},\n titleProps = {},\n secondaryButtonText = 'Ya soy suscriptor',\n secondaryButtonProps = {},\n withCaption = false,\n title = 'Este artículo es exclusivo para suscriptores',\n subtitle = 'Tu contribución nos ayuda a cubrir costos de investigación, tecnología y ofrecerte servicios de valor agregado.',\n post,\n buttonText = 'Suscríbete',\n}) => {\n const { sx: sxContainerProps, ...containerPropRest } = containerProps;\n const { sx: sxSubtitleProps, ...subtitlePropRest } = subtitleProps;\n const { sx: sxTitleProps, ...titlePropRest } = titleProps;\n const { sx: sxButtonProps, ...buttonPropsRest } = buttonProps;\n const { sx: sxSecondaryButtonProps, ...secondaryButtonPropsRest } = secondaryButtonProps;\n\n const handleButton = () => {\n if (!PAYWALL_AUTH_ENDPOINT) {\n console.error('PAYWALL_AUTH_ENDPOINT is required!');\n return null;\n }\n\n return (window.location.href = `${PAYWALL_AUTH_ENDPOINT}/planes?post_url=${window.location.href}`);\n };\n\n const handleSecondaryButton = () => {\n if (!PAYWALL_AUTH_ENDPOINT) {\n console.error('PAYWALL_AUTH_ENDPOINT is required!');\n return null;\n }\n\n return (window.location.href = `${PAYWALL_AUTH_ENDPOINT}/autenticacion?action=AUTH_LOGIN?post_url=${window.location.href}`);\n };\n\n return (\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n border: '1px solid #707070',\n justifyContent: 'center',\n alignItems: 'center',\n flexDirection: 'column',\n background: 'white',\n paddingTop: '80px',\n paddingBottom: '80px',\n borderRadius: '20px',\n boxShadow: '0px 0px 32px #00000029',\n ...sxContainerProps,\n }}\n {...containerPropRest}>\n <Box\n sx={{\n width: {\n xs: 360,\n md: 460,\n },\n justifyContent: 'center',\n alignItems: 'center',\n flexDirection: 'column',\n display: 'flex',\n }}>\n <Typography\n sx={{\n fontWeight: 700,\n lineHeight: '34px',\n fontSize: '34px',\n textAlign: 'center',\n marginBottom: '1.5rem',\n ...sxTitleProps,\n }}\n {...titlePropRest}>\n {title}\n </Typography>\n <Typography\n sx={{ textAlign: 'center', marginBottom: '1.5rem', ...sxSubtitleProps }}\n {...subtitlePropRest}>\n {subtitle}\n </Typography>\n <Button\n disableElevation\n disableRipple\n disableTouchRipple\n disableFocusRipple\n sx={{\n background: '#f75957',\n '&:hover': {\n backgroundColor: '#f75957',\n },\n fontWeight: 700,\n textTransform: 'uppercase',\n marginBottom: '.5rem',\n color: 'white',\n fontSize: '18px',\n paddingTop: '.5rem',\n paddingBottom: '.5rem',\n paddingLeft: '.75rem',\n paddingRight: '.75rem',\n borderRadius: '0.25rem',\n ...sxButtonProps,\n }}\n onClick={() => handleButton()}\n {...buttonPropsRest}>\n {buttonText}\n </Button>\n <Button\n disableElevation\n disableRipple\n disableTouchRipple\n disableFocusRipple\n sx={{\n textDecoration: 'underline',\n background: 'transparent',\n textTransform: 'none',\n fontWeight: 700,\n textAlign: 'center',\n fontSize: '16px',\n paddingTop: '.5rem',\n paddingBottom: '.5rem',\n paddingLeft: '.75rem',\n paddingRight: '.75rem',\n color: 'black',\n ...sxSecondaryButtonProps,\n }}\n onClick={() => handleSecondaryButton()}\n {...secondaryButtonPropsRest}>\n {secondaryButtonText}\n </Button>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwCM;AACA;;AAGF;AACF;;;AAII;AACA;;AAGF;AACF;AAEA;AAGM;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAIG;AACE;AACA;AACD;AACD;AACA;AACA;AACA;AACD;AAGG;AACA;AACA;AACA;AACA;AACA;AACD;AAeC;AACA;AACE;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAQX;;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useSession } from '../session/session.hooks.js';
|
|
4
|
-
import { PaywallSubscription } from './PaywallSubscription.js';
|
|
5
3
|
|
|
6
|
-
const Paywall = ({ children, post, postTypeField, postType }) => {
|
|
4
|
+
const Paywall = ({ children, post, postTypeField, postType, PaywallSubscriptionComponent, PaywallRegisterComponent, }) => {
|
|
7
5
|
const { user, subscription } = useSession();
|
|
8
6
|
const postTypeValue = post[postTypeField];
|
|
9
7
|
if (!subscription && post && postTypeValue && postTypeValue === postType) {
|
|
10
|
-
return
|
|
8
|
+
return PaywallSubscriptionComponent;
|
|
11
9
|
}
|
|
12
10
|
if (!user && post && postTypeValue && postTypeValue === postType) {
|
|
13
|
-
return
|
|
11
|
+
return PaywallRegisterComponent;
|
|
14
12
|
}
|
|
15
13
|
return children;
|
|
16
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paywall.js","sources":["../../../../src/components/paywall/Paywall.tsx"],"sourcesContent":["'use client';\nimport React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Paywall.js","sources":["../../../../src/components/paywall/Paywall.tsx"],"sourcesContent":["'use client';\nimport React from 'react';\nimport { useSession } from '../session/session.hooks';\nimport { PaywallSubscription } from './PaywallSubscription';\n\nexport interface PaywallProps {\n children?: React.ReactNode;\n PaywallSubscriptionComponent?: React.ReactNode;\n PaywallRegisterComponent?: React.ReactNode;\n post?: any;\n postTypeField?: string;\n postType?: string;\n}\n\nexport const Paywall: React.FC<PaywallProps> = ({\n children,\n post,\n postTypeField,\n postType,\n PaywallSubscriptionComponent,\n PaywallRegisterComponent,\n}) => {\n const { user, subscription } = useSession();\n const postTypeValue = post[postTypeField as string];\n if (!subscription && post && postTypeValue && postTypeValue === postType) {\n return PaywallSubscriptionComponent;\n }\n\n if (!user && post && postTypeValue && postTypeValue === postType) {\n return PaywallRegisterComponent;\n }\n\n return children;\n};\n"],"names":[],"mappings":";;;AAcO;;AASL;;AAEE;;;AAIA;;AAGF;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaywallSubscription.js","sources":["../../../../src/components/paywall/PaywallSubscription.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"PaywallSubscription.js","sources":["../../../../src/components/paywall/PaywallSubscription.tsx"],"sourcesContent":["'use client'\nimport React from 'react';\nimport { Box, BoxProps, Typography, TypographyProps, ButtonProps, Button } from '@mui/material';\nimport { PAYWALL_AUTH_ENDPOINT } from './paywall.constants';\n\nexport interface PaywallSubscriptionProps {\n post?: any;\n containerProps?: BoxProps;\n titleProps?: TypographyProps;\n subtitleProps?: TypographyProps;\n buttonProps?: ButtonProps;\n buttonText?: string;\n secondaryButtonProps?: ButtonProps;\n secondaryButtonText?: string;\n title?: string;\n subtitle?: string;\n withCaption?: boolean;\n}\n\nexport const PaywallSubscription: React.FC<PaywallSubscriptionProps> = ({\n containerProps = {},\n subtitleProps = {},\n buttonProps = {},\n titleProps = {},\n secondaryButtonText = 'Ya soy suscriptor',\n secondaryButtonProps = {},\n withCaption = false,\n title = 'Este artículo es exclusivo para suscriptores',\n subtitle = 'Tu contribución nos ayuda a cubrir costos de investigación, tecnología y ofrecerte servicios de valor agregado.',\n post,\n buttonText = 'Suscríbete',\n}) => {\n const { sx: sxContainerProps, ...containerPropRest } = containerProps;\n const { sx: sxSubtitleProps, ...subtitlePropRest } = subtitleProps;\n const { sx: sxTitleProps, ...titlePropRest } = titleProps;\n const { sx: sxButtonProps, ...buttonPropsRest } = buttonProps;\n const { sx: sxSecondaryButtonProps, ...secondaryButtonPropsRest } = secondaryButtonProps;\n\n const handleButton = () => {\n if (!PAYWALL_AUTH_ENDPOINT) {\n console.error('PAYWALL_AUTH_ENDPOINT is required!');\n return null;\n }\n\n return (window.location.href = `${PAYWALL_AUTH_ENDPOINT}/planes?post_url=${window.location.href}`);\n };\n\n const handleSecondaryButton = () => {\n if (!PAYWALL_AUTH_ENDPOINT) {\n console.error('PAYWALL_AUTH_ENDPOINT is required!');\n return null;\n }\n\n return (window.location.href = `${PAYWALL_AUTH_ENDPOINT}/autenticacion?action=AUTH_LOGIN?post_url=${window.location.href}`);\n };\n\n return (\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n border: '1px solid #707070',\n justifyContent: 'center',\n alignItems: 'center',\n flexDirection: 'column',\n background: 'white',\n paddingTop: '80px',\n paddingBottom: '80px',\n borderRadius: '20px',\n boxShadow: '0px 0px 32px #00000029',\n ...sxContainerProps,\n }}\n {...containerPropRest}>\n <Box\n sx={{\n width: {\n xs: 360,\n md: 460,\n },\n justifyContent: 'center',\n alignItems: 'center',\n flexDirection: 'column',\n display: 'flex',\n }}>\n <Typography\n sx={{\n fontWeight: 700,\n lineHeight: '34px',\n fontSize: '34px',\n textAlign: 'center',\n marginBottom: '1.5rem',\n ...sxTitleProps,\n }}\n {...titlePropRest}>\n {title}\n </Typography>\n <Typography\n sx={{ textAlign: 'center', marginBottom: '1.5rem', ...sxSubtitleProps }}\n {...subtitlePropRest}>\n {subtitle}\n </Typography>\n <Button\n disableElevation\n disableRipple\n disableTouchRipple\n disableFocusRipple\n sx={{\n background: '#f75957',\n '&:hover': {\n backgroundColor: '#f75957',\n },\n fontWeight: 700,\n textTransform: 'uppercase',\n marginBottom: '.5rem',\n color: 'white',\n fontSize: '18px',\n paddingTop: '.5rem',\n paddingBottom: '.5rem',\n paddingLeft: '.75rem',\n paddingRight: '.75rem',\n borderRadius: '0.25rem',\n ...sxButtonProps,\n }}\n onClick={() => handleButton()}\n {...buttonPropsRest}>\n {buttonText}\n </Button>\n <Button\n disableElevation\n disableRipple\n disableTouchRipple\n disableFocusRipple\n sx={{\n textDecoration: 'underline',\n background: 'transparent',\n textTransform: 'none',\n fontWeight: 700,\n textAlign: 'center',\n fontSize: '16px',\n paddingTop: '.5rem',\n paddingBottom: '.5rem',\n paddingLeft: '.75rem',\n paddingRight: '.75rem',\n color: 'black',\n ...sxSecondaryButtonProps,\n }}\n onClick={() => handleSecondaryButton()}\n {...secondaryButtonPropsRest}>\n {secondaryButtonText}\n </Button>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwCM;AACA;;AAGF;AACF;;;AAII;AACA;;AAGF;AACF;AAEA;AAGM;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAIG;AACE;AACA;AACD;AACD;AACA;AACA;AACA;AACD;AAGG;AACA;AACA;AACA;AACA;AACA;AACD;AAeC;AACA;AACE;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAQX;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,8 @@ declare const PAYWALL_AUTH_ENDPOINT: string;
|
|
|
115
115
|
|
|
116
116
|
interface PaywallProps {
|
|
117
117
|
children?: React.ReactNode;
|
|
118
|
+
PaywallSubscriptionComponent?: React.ReactNode;
|
|
119
|
+
PaywallRegisterComponent?: React.ReactNode;
|
|
118
120
|
post?: any;
|
|
119
121
|
postTypeField?: string;
|
|
120
122
|
postType?: string;
|