@selfcommunity/react-ui 0.10.5-payments.152 → 0.10.5-payments.155

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 (78) hide show
  1. package/lib/cjs/components/BuyButton/BuyButton.js +22 -3
  2. package/lib/cjs/components/Category/Category.d.ts +5 -0
  3. package/lib/cjs/components/Category/Category.js +2 -2
  4. package/lib/cjs/components/CategoryFollowButton/CategoryFollowButton.js +5 -1
  5. package/lib/cjs/components/Checkout/Checkout.d.ts +1 -1
  6. package/lib/cjs/components/Checkout/Checkout.js +2 -3
  7. package/lib/cjs/components/Checkout/Skeleton.js +10 -10
  8. package/lib/cjs/components/CheckoutReturnDialog/CheckoutReturnDialog.js +43 -11
  9. package/lib/cjs/components/CommunityPaywall/CommunityPaywall.d.ts +1 -0
  10. package/lib/cjs/components/CommunityPaywall/CommunityPaywall.js +7 -5
  11. package/lib/cjs/components/Course/Course.d.ts +5 -0
  12. package/lib/cjs/components/Course/Course.js +2 -2
  13. package/lib/cjs/components/Event/Event.d.ts +5 -0
  14. package/lib/cjs/components/Event/Event.js +2 -2
  15. package/lib/cjs/components/Group/Group.d.ts +5 -0
  16. package/lib/cjs/components/Group/Group.js +2 -2
  17. package/lib/cjs/components/PaymentProduct/PaymentProduct.d.ts +3 -0
  18. package/lib/cjs/components/PaymentProduct/PaymentProduct.js +3 -2
  19. package/lib/cjs/components/PaymentProductPrice/PaymentProductPrice.d.ts +1 -0
  20. package/lib/cjs/components/PaymentProductPrice/PaymentProductPrice.js +3 -3
  21. package/lib/cjs/components/PaymentProducts/PaymentProducts.js +1 -1
  22. package/lib/cjs/components/Paywalls/Paywalls.d.ts +10 -0
  23. package/lib/cjs/components/Paywalls/Paywalls.js +71 -0
  24. package/lib/cjs/components/Paywalls/Skeleton.d.ts +21 -0
  25. package/lib/cjs/components/Paywalls/Skeleton.js +47 -0
  26. package/lib/cjs/components/Paywalls/constants.d.ts +1 -0
  27. package/lib/cjs/components/Paywalls/constants.js +4 -0
  28. package/lib/cjs/components/Paywalls/index.d.ts +3 -0
  29. package/lib/cjs/components/Paywalls/index.js +5 -0
  30. package/lib/cjs/components/PaywallsDialog/PaywallsDialog.d.ts +8 -0
  31. package/lib/cjs/components/{PaymentProductsDialog/PaymentProductsDialog.js → PaywallsDialog/PaywallsDialog.js} +7 -6
  32. package/lib/cjs/components/PaywallsDialog/index.d.ts +3 -0
  33. package/lib/cjs/components/PaywallsDialog/index.js +5 -0
  34. package/lib/cjs/index.d.ts +2 -2
  35. package/lib/cjs/index.js +3 -3
  36. package/lib/esm/components/BuyButton/BuyButton.js +22 -3
  37. package/lib/esm/components/Category/Category.d.ts +5 -0
  38. package/lib/esm/components/Category/Category.js +2 -2
  39. package/lib/esm/components/CategoryFollowButton/CategoryFollowButton.js +5 -1
  40. package/lib/esm/components/Checkout/Checkout.d.ts +1 -1
  41. package/lib/esm/components/Checkout/Checkout.js +2 -3
  42. package/lib/esm/components/Checkout/Skeleton.js +10 -10
  43. package/lib/esm/components/CheckoutReturnDialog/CheckoutReturnDialog.js +40 -8
  44. package/lib/esm/components/CommunityPaywall/CommunityPaywall.d.ts +1 -0
  45. package/lib/esm/components/CommunityPaywall/CommunityPaywall.js +8 -6
  46. package/lib/esm/components/Course/Course.d.ts +5 -0
  47. package/lib/esm/components/Course/Course.js +2 -2
  48. package/lib/esm/components/Event/Event.d.ts +5 -0
  49. package/lib/esm/components/Event/Event.js +2 -2
  50. package/lib/esm/components/Group/Group.d.ts +5 -0
  51. package/lib/esm/components/Group/Group.js +2 -2
  52. package/lib/esm/components/PaymentProduct/PaymentProduct.d.ts +3 -0
  53. package/lib/esm/components/PaymentProduct/PaymentProduct.js +3 -2
  54. package/lib/esm/components/PaymentProductPrice/PaymentProductPrice.d.ts +1 -0
  55. package/lib/esm/components/PaymentProductPrice/PaymentProductPrice.js +3 -3
  56. package/lib/esm/components/PaymentProducts/PaymentProducts.js +1 -1
  57. package/lib/esm/components/Paywalls/Paywalls.d.ts +10 -0
  58. package/lib/esm/components/Paywalls/Paywalls.js +68 -0
  59. package/lib/esm/components/Paywalls/Skeleton.d.ts +21 -0
  60. package/lib/esm/components/Paywalls/Skeleton.js +44 -0
  61. package/lib/esm/components/Paywalls/constants.d.ts +1 -0
  62. package/lib/esm/components/Paywalls/constants.js +1 -0
  63. package/lib/esm/components/Paywalls/index.d.ts +3 -0
  64. package/lib/esm/components/Paywalls/index.js +2 -0
  65. package/lib/esm/components/PaywallsDialog/PaywallsDialog.d.ts +8 -0
  66. package/lib/esm/components/{PaymentProductsDialog/PaymentProductsDialog.js → PaywallsDialog/PaywallsDialog.js} +6 -5
  67. package/lib/esm/components/PaywallsDialog/index.d.ts +3 -0
  68. package/lib/esm/components/PaywallsDialog/index.js +2 -0
  69. package/lib/esm/index.d.ts +2 -2
  70. package/lib/esm/index.js +2 -2
  71. package/lib/umd/react-ui.js +1 -1
  72. package/package.json +8 -8
  73. package/lib/cjs/components/PaymentProductsDialog/PaymentProductsDialog.d.ts +0 -8
  74. package/lib/cjs/components/PaymentProductsDialog/index.d.ts +0 -3
  75. package/lib/cjs/components/PaymentProductsDialog/index.js +0 -5
  76. package/lib/esm/components/PaymentProductsDialog/PaymentProductsDialog.d.ts +0 -8
  77. package/lib/esm/components/PaymentProductsDialog/index.d.ts +0 -3
  78. package/lib/esm/components/PaymentProductsDialog/index.js +0 -2
@@ -11,10 +11,10 @@ const types_1 = require("@selfcommunity/types");
11
11
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
12
12
  const react_1 = require("react");
13
13
  const react_intl_1 = require("react-intl");
14
- const PaymentProductsDialog_1 = tslib_1.__importDefault(require("../PaymentProductsDialog"));
15
- const PaymentProducts_1 = tslib_1.__importDefault(require("../PaymentProducts"));
14
+ const PaywallsDialog_1 = tslib_1.__importDefault(require("../PaywallsDialog"));
16
15
  const api_services_1 = require("@selfcommunity/api-services");
17
16
  const utils_1 = require("@selfcommunity/utils");
17
+ const Paywalls_1 = tslib_1.__importDefault(require("../Paywalls"));
18
18
  const PREFIX = 'SCBuyButton';
19
19
  const classes = {
20
20
  requestRoot: `${PREFIX}-request-root`,
@@ -72,6 +72,7 @@ function BuyButton(inProps) {
72
72
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
73
73
  // CONST
74
74
  const [purchased, setPurchased] = (0, react_1.useState)(null);
75
+ const [products, setProducts] = (0, react_1.useState)([]);
75
76
  const [paymentOrder, setPaymentOrder] = (0, react_1.useState)(null);
76
77
  const [btnLabel, setBtnLabel] = (0, react_1.useState)((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: `ui.buyButton.buy${contentType}`, id: `ui.buyButton.buy${(0, utils_1.capitalize)(contentType)}` }));
77
78
  // HANDLERS
@@ -108,6 +109,9 @@ function BuyButton(inProps) {
108
109
  if (data.subscription_status === types_1.SCEventSubscriptionStatusType.GOING) {
109
110
  setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.purchased", id: "ui.buyButton.purchased" }));
110
111
  }
112
+ if (data.paywalls) {
113
+ setProducts(data.paywalls);
114
+ }
111
115
  if (data.payment_order) {
112
116
  setPaymentOrder(data.payment_order);
113
117
  }
@@ -121,6 +125,9 @@ function BuyButton(inProps) {
121
125
  if (data.followed) {
122
126
  setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.subscribed", id: "ui.buyButton.subscribed" }));
123
127
  }
128
+ if (data.paywalls) {
129
+ setProducts(data.paywalls);
130
+ }
124
131
  if (data.payment_order) {
125
132
  setPaymentOrder(data.payment_order);
126
133
  }
@@ -135,6 +142,9 @@ function BuyButton(inProps) {
135
142
  if (data.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED) {
136
143
  setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.subscribed", id: "ui.buyButton.subscribed" }));
137
144
  }
145
+ if (data.paywalls) {
146
+ setProducts(data.paywalls);
147
+ }
138
148
  if (data.payment_order) {
139
149
  setPaymentOrder(data.payment_order);
140
150
  }
@@ -150,6 +160,9 @@ function BuyButton(inProps) {
150
160
  if (data.subscription_status === types_1.SCCourseJoinStatusType.JOINED) {
151
161
  setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.subscribed", id: "ui.buyButton.subscribed" }));
152
162
  }
163
+ if (data.paywalls) {
164
+ setProducts(data.paywalls);
165
+ }
153
166
  if (data.payment_order) {
154
167
  setPaymentOrder(data.payment_order);
155
168
  }
@@ -172,6 +185,12 @@ function BuyButton(inProps) {
172
185
  if (!contentId && !content) {
173
186
  return null;
174
187
  }
175
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: disabled == true ? '' : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.buyButton.disabled", defaultMessage: "ui.buyButton.disabled" }) }, { children: (0, jsx_runtime_1.jsx)(RequestRoot, Object.assign({ className: (0, classnames_1.default)(classes.requestRoot, className), variant: "contained", color: purchased ? 'inherit' : 'secondary', size: "small", startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "card_giftcard" }), loading: scUserContext.user === undefined || purchased === null, onClick: handleOpen }, rest, { children: btnLabel })) })), open && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, PaperProps: { className: classes.paper }, open: true, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", component: "div", marginBottom: 2 }, { children: (0, jsx_runtime_1.jsx)("b", { children: paymentOrder ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paymentProductsDialog.title.purchased", defaultMessage: "ui.paymentProductsDialog.title.purchased" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paymentProductsDialog.title", defaultMessage: "ui.paymentProductsDialog.title" })) }) })), (0, jsx_runtime_1.jsx)(PaymentProducts_1.default, Object.assign({ contentType: contentType }, (content ? { content } : { contentId }), (paymentOrder && { paymentOrder: paymentOrder, onUpdatePaymentOrder: handleUpdatePaymentOrder })))] }) }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PaymentProductsDialog_1.default, { open: true, onClose: handleClose, PaymentProductsComponentProps: Object.assign(Object.assign({ contentType }, (content ? { content } : { contentId })), (paymentOrder && { paymentOrder: paymentOrder, onUpdatePaymentOrder: handleUpdatePaymentOrder })) }) })) }))] }));
188
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: disabled == true ? (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.buyButton.disabled", defaultMessage: "ui.buyButton.disabled" }) : '' }, { children: (0, jsx_runtime_1.jsx)(RequestRoot, Object.assign({ className: (0, classnames_1.default)(classes.requestRoot, className), variant: "contained", color: purchased ? 'inherit' : 'secondary', size: "small", startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "card_giftcard" }), loading: scUserContext.user === undefined || purchased === null, onClick: handleOpen }, rest, { children: btnLabel })) })), open && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, PaperProps: { className: classes.paper }, open: true, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", component: "div", marginBottom: 2 }, { children: (0, jsx_runtime_1.jsx)("b", { children: paymentOrder ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallssDialog.title.purchased", defaultMessage: "ui.paymentProductsDialog.title.purchased" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.paywallssDialog.title", defaultMessage: "ui.paymentProductsDialog.title" })) }) })), (0, jsx_runtime_1.jsx)(Paywalls_1.default, Object.assign({ contentType: contentType }, (content ? { content } : { contentId }), { prefetchedPaymentContentStatus: {
189
+ paywalls: products,
190
+ payment_order: paymentOrder
191
+ }, onUpdatePaymentOrder: handleUpdatePaymentOrder }))] }) }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PaywallsDialog_1.default, { open: true, onClose: handleClose, PaywallsComponentProps: Object.assign(Object.assign({ contentType }, (content ? { content } : { contentId })), { prefetchedPaymentContentStatus: {
192
+ paywalls: products,
193
+ payment_order: paymentOrder
194
+ }, onUpdatePaymentOrder: handleUpdatePaymentOrder }) }) })) }))] }));
176
195
  }
177
196
  exports.default = BuyButton;
@@ -1,4 +1,5 @@
1
1
  import { SCCategoryType } from '@selfcommunity/types';
2
+ import { CacheStrategies } from '@selfcommunity/utils';
2
3
  import { CategoryFollowButtonProps } from '../CategoryFollowButton';
3
4
  import { WidgetProps } from '../Widget';
4
5
  export interface CategoryProps extends WidgetProps {
@@ -32,6 +33,10 @@ export interface CategoryProps extends WidgetProps {
32
33
  * @default false
33
34
  */
34
35
  showTooltip?: boolean;
36
+ /**
37
+ * Override default cache strategy on fetch element
38
+ */
39
+ cacheStrategy?: CacheStrategies;
35
40
  /**
36
41
  * Any other properties
37
42
  */
@@ -69,11 +69,11 @@ function Category(inProps) {
69
69
  props: inProps,
70
70
  name: constants_1.PREFIX
71
71
  });
72
- const { categoryId = null, category = null, className = null, elevation, autoHide = false, categoryFollowButtonProps = {}, showFollowers = true, showTooltip = false, ButtonBaseProps = null } = props, rest = tslib_1.__rest(props, ["categoryId", "category", "className", "elevation", "autoHide", "categoryFollowButtonProps", "showFollowers", "showTooltip", "ButtonBaseProps"]);
72
+ const { categoryId = null, category = null, className = null, elevation, autoHide = false, categoryFollowButtonProps = {}, showFollowers = true, showTooltip = false, ButtonBaseProps = null, cacheStrategy } = props, rest = tslib_1.__rest(props, ["categoryId", "category", "className", "elevation", "autoHide", "categoryFollowButtonProps", "showFollowers", "showTooltip", "ButtonBaseProps", "cacheStrategy"]);
73
73
  // CONTEXT
74
74
  const scRoutingContext = (0, react_core_1.useSCRouting)();
75
75
  // STATE
76
- const { scCategory, setSCCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
76
+ const { scCategory, setSCCategory } = (0, react_core_1.useSCFetchCategory)(Object.assign({ id: categoryId, category }, (cacheStrategy && { cacheStrategy })));
77
77
  // MEMO
78
78
  const _ButtonBaseProps = (0, react_1.useMemo)(() => (ButtonBaseProps ? ButtonBaseProps : { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.CATEGORY_ROUTE_NAME, scCategory) }), [ButtonBaseProps, scRoutingContext, scCategory]);
79
79
  // HOOKS
@@ -105,7 +105,11 @@ function CategoryFollowButton(inProps) {
105
105
  /**
106
106
  * if the category is a paid content and it isn't followed show the Buy button
107
107
  */
108
- if (scCategory && scUserContext.user && isPaymentsEnabled && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 && !followed) {
108
+ if (scCategory &&
109
+ scUserContext.user &&
110
+ isPaymentsEnabled &&
111
+ ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
112
+ (!followed || scCategoriesManager.isLoading(scCategory))) {
109
113
  return (0, jsx_runtime_1.jsx)(BuyButton_1.default, { contentType: types_1.SCContentType.CATEGORY, content: scCategory, disabled: disableBuyContentIfPaidContent });
110
114
  }
111
115
  return ((0, jsx_runtime_1.jsx)(FollowButton, Object.assign({ size: "small", variant: "outlined", onClick: handleFollowAction, loading: scUserContext.user ? followed === null || scCategoriesManager.isLoading(scCategory) : null, className: (0, classnames_1.default)(classes.root, className), disabled: isActionFollowDisabled }, rest, { children: followed && scUserContext.user ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.categoryFollowButton.unfollow", id: "ui.categoryFollowButton.unfollow" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.categoryFollowButton.follow", id: "ui.categoryFollowButton.follow" })) })));
@@ -1,5 +1,5 @@
1
- import { SCCheckoutSessionUIMode, SCContentType, SCPurchasableContent } from '@selfcommunity/types';
2
1
  import * as stripeJs from '@stripe/stripe-js';
2
+ import { SCCheckoutSessionUIMode, SCContentType, SCPurchasableContent } from '@selfcommunity/types';
3
3
  export interface CheckoutProps {
4
4
  className?: string;
5
5
  clientSecret?: string;
@@ -22,7 +22,6 @@ const Course_1 = tslib_1.__importDefault(require("../Course"));
22
22
  const Group_1 = tslib_1.__importDefault(require("../Group"));
23
23
  const event_1 = require("../../types/event");
24
24
  const course_1 = require("../../types/course");
25
- const react_core_2 = require("@selfcommunity/react-core");
26
25
  const classes = {
27
26
  root: `${constants_1.PREFIX}-root`,
28
27
  content: `${constants_1.PREFIX}-content`,
@@ -48,7 +47,7 @@ function Checkout(inProps) {
48
47
  const scUserContext = (0, react_core_1.useSCUser)();
49
48
  const intl = (0, react_intl_1.useIntl)();
50
49
  // HOOKS
51
- const { isPaymentsEnabled, stripePublicKey, stripeConnectedAccountId } = (0, react_core_2.useSCPaymentsEnabled)();
50
+ const { isPaymentsEnabled, stripePublicKey, stripeConnectedAccountId } = (0, react_core_1.useSCPaymentsEnabled)();
52
51
  const stripePromise = isPaymentsEnabled && stripePublicKey && stripeConnectedAccountId && stripe_js_1.loadStripe
53
52
  ? (0, stripe_js_1.loadStripe)(stripePublicKey, { stripeAccount: stripeConnectedAccountId, locale: (0, payment_1.getDefaultLocale)(intl).locale })
54
53
  : null;
@@ -109,6 +108,6 @@ function Checkout(inProps) {
109
108
  }
110
109
  return _c;
111
110
  };
112
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [isContentObject && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: renderContentObject() })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.contentDesc }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", mb: 1 }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkout.contentDesc.title", defaultMessage: "ui.checkout.contentDesc.title" }) }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkout.contentDesc.subTitle", defaultMessage: "ui.checkout.contentDesc.subTitle" }) }))] }))] }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ id: "checkout", className: classes.checkout }, { children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.EmbeddedCheckoutProvider, Object.assign({ stripe: stripePromise, options: providerOptions }, { children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.EmbeddedCheckout, {}) })) }))] })));
111
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [isContentObject && contentType !== types_1.SCContentType.COMMUNITY && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: renderContentObject() })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.contentDesc }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", mb: 1 }, { children: (0, jsx_runtime_1.jsx)("b", { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkout.contentDesc.title", defaultMessage: "ui.checkout.contentDesc.title" }) }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkout.contentDesc.subTitle", defaultMessage: "ui.checkout.contentDesc.subTitle" }) }))] }))] }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ id: "checkout", className: classes.checkout }, { children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.EmbeddedCheckoutProvider, Object.assign({ stripe: stripePromise, options: providerOptions }, { children: (0, jsx_runtime_1.jsx)(react_stripe_js_1.EmbeddedCheckout, {}) })) }))] })));
113
112
  }
114
113
  exports.default = Checkout;
@@ -33,6 +33,15 @@ const Root = (0, styles_1.styled)(material_1.Grid, {
33
33
  },
34
34
  padding: theme.spacing(1, 5)
35
35
  },
36
+ [`& .${classes.header}`]: {
37
+ display: 'flex',
38
+ flexGrow: 1,
39
+ justifyContent: 'center',
40
+ paddingTop: theme.spacing(2),
41
+ '& span.MuiSkeleton-root': {
42
+ maxWidth: 450
43
+ }
44
+ },
36
45
  [`& .${classes.right}`]: {
37
46
  display: 'flex',
38
47
  justifyContent: 'center',
@@ -42,15 +51,6 @@ const Root = (0, styles_1.styled)(material_1.Grid, {
42
51
  },
43
52
  padding: theme.spacing(1, 5)
44
53
  },
45
- [`& .${classes.header}`]: {
46
- display: 'flex',
47
- flexGrow: 1,
48
- justifyContent: 'center',
49
- paddingTop: theme.spacing(2),
50
- '& div': {
51
- maxWidth: 515
52
- }
53
- },
54
54
  [`& .${classes.content}`]: {
55
55
  position: 'relative',
56
56
  [theme.breakpoints.up('md')]: {
@@ -84,6 +84,6 @@ function CheckoutSkeleton(inProps) {
84
84
  const { className = {} } = inProps, rest = tslib_1.__rest(inProps, ["className"]);
85
85
  // HOOKS
86
86
  const theme = (0, material_1.useTheme)();
87
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true, xs: 12, className: classes.header }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: (0, classnames_1.default)(classes.left, classes.paper) }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 150, width: '100%' }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: classes.right }, { children: (0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ mdDown: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, pt: 2 }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 20, width: 190 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 90, width: '100%' })] })) })) }))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: (0, classnames_1.default)(classes.left, classes.paper) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 30, width: 140 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 110 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 150 }), (0, jsx_runtime_1.jsxs)(material_1.Hidden, Object.assign({ mdDown: true }, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 200 })] }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: classes.right }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 110 }), (0, jsx_runtime_1.jsxs)(material_1.Hidden, Object.assign({ mdDown: true }, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 70 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 340 })] }))] })) }))] })));
87
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: (0, classnames_1.default)(classes.left, classes.paper, classes.header) }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 150, width: '100%' }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: (0, classnames_1.default)(classes.right, classes.header) }, { children: (0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ mdDown: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, pt: 2 }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 20, width: 190 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 90, width: '100%' })] })) })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: (0, classnames_1.default)(classes.left, classes.paper) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 30, width: 140 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 110 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 150 }), (0, jsx_runtime_1.jsxs)(material_1.Hidden, Object.assign({ mdDown: true }, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 200 })] }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 6, className: classes.right }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 110 }), (0, jsx_runtime_1.jsxs)(material_1.Hidden, Object.assign({ mdDown: true }, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 70 }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", height: 340 })] }))] })) }))] })));
88
88
  }
89
89
  exports.default = CheckoutSkeleton;
@@ -11,7 +11,6 @@ const react_intl_1 = require("react-intl");
11
11
  const types_1 = require("@selfcommunity/types");
12
12
  const clapping_1 = require("../../assets/courses/clapping");
13
13
  const react_core_1 = require("@selfcommunity/react-core");
14
- const react_core_2 = require("@selfcommunity/react-core");
15
14
  const Event_1 = tslib_1.__importDefault(require("../Event"));
16
15
  const event_1 = require("../../types/event");
17
16
  const course_1 = require("../../types/course");
@@ -22,6 +21,7 @@ const Category_1 = tslib_1.__importDefault(require("../Category"));
22
21
  const Course_1 = tslib_1.__importDefault(require("../Course"));
23
22
  const Group_1 = tslib_1.__importDefault(require("../Group"));
24
23
  const Grow_1 = tslib_1.__importDefault(require("@mui/material/Grow"));
24
+ const PaymentProduct_1 = tslib_1.__importDefault(require("../PaymentProduct"));
25
25
  const PREFIX = 'SCCheckoutReturnDialog';
26
26
  const classes = {
27
27
  root: `${PREFIX}-root`,
@@ -47,15 +47,18 @@ function CheckoutReturnDialog(inProps) {
47
47
  name: PREFIX
48
48
  });
49
49
  const { className, checkoutSessionId, disableInitialTransition = false, onHandleViewContentPurchased } = props, rest = tslib_1.__rest(props, ["className", "checkoutSessionId", "disableInitialTransition", "onHandleViewContentPurchased"]);
50
+ // STATE
50
51
  const [loading, setLoading] = (0, react_1.useState)(true);
51
52
  const [contentType, setContentType] = (0, react_1.useState)(null);
52
53
  const [contentId, setContentId] = (0, react_1.useState)(null);
53
54
  const [content, setContent] = (0, react_1.useState)(null);
55
+ const [paymentProduct, setPaymentProduct] = (0, react_1.useState)(null);
54
56
  // HOOKS
55
57
  const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
56
58
  const intl = (0, react_intl_1.useIntl)();
57
59
  // CONTEXT
58
- const scRoutingContext = (0, react_core_2.useSCRouting)();
60
+ const scRoutingContext = (0, react_core_1.useSCRouting)();
61
+ const scUserContext = (0, react_core_1.useSCUser)();
59
62
  /**
60
63
  * Handle view new object purchased
61
64
  */
@@ -63,16 +66,16 @@ function CheckoutReturnDialog(inProps) {
63
66
  let _redirectUrl;
64
67
  switch (contentType) {
65
68
  case types_1.SCContentType.GROUP:
66
- _redirectUrl = scRoutingContext.url(react_core_2.SCRoutes.GROUP_ROUTE_NAME, content);
69
+ _redirectUrl = scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, content);
67
70
  break;
68
71
  case types_1.SCContentType.EVENT:
69
- _redirectUrl = scRoutingContext.url(react_core_2.SCRoutes.EVENT_ROUTE_NAME, content);
72
+ _redirectUrl = scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, content);
70
73
  break;
71
74
  case types_1.SCContentType.CATEGORY:
72
- _redirectUrl = scRoutingContext.url(react_core_2.SCRoutes.CATEGORY_ROUTE_NAME, content);
75
+ _redirectUrl = scRoutingContext.url(react_core_1.SCRoutes.CATEGORY_ROUTE_NAME, content);
73
76
  break;
74
77
  case types_1.SCContentType.COURSE:
75
- _redirectUrl = scRoutingContext.url(react_core_2.SCRoutes.COURSE_ROUTE_NAME, content);
78
+ _redirectUrl = scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, content);
76
79
  break;
77
80
  default:
78
81
  break;
@@ -84,6 +87,27 @@ function CheckoutReturnDialog(inProps) {
84
87
  window.location.href = _redirectUrl;
85
88
  }
86
89
  }, [scRoutingContext, onHandleViewContentPurchased, content, contentType]);
90
+ /**
91
+ * Handle refresh content status
92
+ */
93
+ const refreshContentStatus = (0, react_1.useCallback)(() => {
94
+ switch (contentType) {
95
+ case types_1.SCContentType.GROUP:
96
+ scUserContext.managers.groups.refresh();
97
+ break;
98
+ case types_1.SCContentType.EVENT:
99
+ scUserContext.managers.events.refresh();
100
+ break;
101
+ case types_1.SCContentType.CATEGORY:
102
+ scUserContext.managers.categories.refresh();
103
+ break;
104
+ case types_1.SCContentType.COURSE:
105
+ scUserContext.managers.courses.refresh();
106
+ break;
107
+ default:
108
+ break;
109
+ }
110
+ }, [scUserContext, content, contentType]);
87
111
  (0, react_1.useEffect)(() => {
88
112
  api_services_1.PaymentApiClient.getCheckoutSession({ session_id: checkoutSessionId })
89
113
  .then((r) => {
@@ -92,6 +116,11 @@ function CheckoutReturnDialog(inProps) {
92
116
  setContentType(r.content_type);
93
117
  setContentId(r.content_id);
94
118
  setContent(r[r.content_type]);
119
+ if (r.payment_price.payment_product) {
120
+ setPaymentProduct(r.payment_price.payment_product);
121
+ }
122
+ // Refresh subscription status
123
+ refreshContentStatus();
95
124
  setLoading(false);
96
125
  });
97
126
  }
@@ -109,21 +138,24 @@ function CheckoutReturnDialog(inProps) {
109
138
  const renderContent = () => {
110
139
  let footer;
111
140
  if (contentType === types_1.SCContentType.EVENT) {
112
- footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, { event: content, template: event_1.SCEventTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_2.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.event.button", defaultMessage: "ui.checkoutReturnDialog.event.button" }) }))] }));
141
+ footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, { event: content, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY, template: event_1.SCEventTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_1.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.event.button", defaultMessage: "ui.checkoutReturnDialog.event.button" }) }))] }));
113
142
  }
114
143
  else if (contentType === types_1.SCContentType.CATEGORY) {
115
- footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Category_1.default, { category: content, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_2.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.category.button", defaultMessage: "ui.checkoutReturnDialog.category.button" }) }))] }));
144
+ footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Category_1.default, { category: content, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_1.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.category.button", defaultMessage: "ui.checkoutReturnDialog.category.button" }) }))] }));
116
145
  }
117
146
  else if (contentType === types_1.SCContentType.COURSE) {
118
- footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Course_1.default, { course: content, template: course_1.SCCourseTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), hideEventParticipants: true, hideEventPlanner: true, variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_2.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.course.button", defaultMessage: "ui.checkoutReturnDialog.course.button" }) }))] }));
147
+ footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Course_1.default, { course: content, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY, template: course_1.SCCourseTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), hideEventParticipants: true, hideEventPlanner: true, variant: "outlined", className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_1.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.course.button", defaultMessage: "ui.checkoutReturnDialog.course.button" }) }))] }));
119
148
  }
120
149
  else if (contentType === types_1.SCContentType.GROUP) {
121
- footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Group_1.default, { group: content, hideActions: true, variant: "outlined", hideEventParticipants: true, hideEventPlanner: true, className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_2.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.category.button", defaultMessage: "ui.checkoutReturnDialog.category.button" }) }))] }));
150
+ footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(Group_1.default, { group: content, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY, hideActions: true, variant: "outlined", hideEventParticipants: true, hideEventPlanner: true, className: classes.object }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_1.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.category.button", defaultMessage: "ui.checkoutReturnDialog.category.button" }) }))] }));
151
+ }
152
+ else if (contentType === types_1.SCContentType.COMMUNITY) {
153
+ footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [paymentProduct && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.contentObject }, { children: (0, jsx_runtime_1.jsx)(PaymentProduct_1.default, { hidePaymentProductPrices: true, paymentProduct: paymentProduct }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: react_core_1.Link, className: classes.btn }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.community.button", defaultMessage: "ui.checkoutReturnDialog.community.button" }) }))] }));
122
154
  }
123
155
  return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ spacing: 2, justifyContent: "center", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Grow_1.default, Object.assign({ in: true, style: { transitionDelay: '300ms' } }, { children: (0, jsx_runtime_1.jsx)("img", { src: clapping_1.CLAPPING, className: classes.img, alt: intl.formatMessage({
124
156
  id: 'ui.checkoutReturnDialog.buy',
125
157
  defaultMessage: 'ui.checkoutReturnDialog.buy'
126
- }), width: 100, height: 100 }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), footer] })));
158
+ }), width: 100, height: 100 }) })), footer] })));
127
159
  };
128
160
  if (!isPaymentsEnabled) {
129
161
  return null;
@@ -4,5 +4,6 @@ export interface CommunityPaywallProps {
4
4
  prefetchedProducts?: SCPaymentProduct[];
5
5
  paymentOrder?: SCPaymentOrder;
6
6
  onUpdatePaymentOrder?: (price: SCPaymentPrice, contentType?: SCContentType, contentId?: string | number) => void;
7
+ callBackUrl?: string;
7
8
  }
8
9
  export default function CommunityPaywall(inProps: CommunityPaywallProps): JSX.Element;
@@ -28,7 +28,7 @@ function CommunityPaywall(inProps) {
28
28
  props: inProps,
29
29
  name: constants_1.PREFIX
30
30
  });
31
- const { className, prefetchedProducts = [], paymentOrder = null, onUpdatePaymentOrder } = props, rest = tslib_1.__rest(props, ["className", "prefetchedProducts", "paymentOrder", "onUpdatePaymentOrder"]);
31
+ const { className, prefetchedProducts = [], paymentOrder = null, onUpdatePaymentOrder, callBackUrl } = props, rest = tslib_1.__rest(props, ["className", "prefetchedProducts", "paymentOrder", "onUpdatePaymentOrder", "callBackUrl"]);
32
32
  // STATE
33
33
  const [products, setProducts] = (0, react_1.useState)([]);
34
34
  const [payment, setPayment] = (0, react_1.useState)(null);
@@ -46,11 +46,13 @@ function CommunityPaywall(inProps) {
46
46
  setLoading(false);
47
47
  }
48
48
  else {
49
- api_services_1.PaymentApiClient.getCommunityPaymentProducts()
49
+ api_services_1.CommunityApiClient.getCommunities()
50
50
  .then((data) => {
51
51
  if (isMountedRef.current) {
52
- setProducts(data.paywalls);
53
- setPayment(data.payment_order);
52
+ if (data.count && data.results.length) {
53
+ setProducts(data.results[0].paywalls);
54
+ setPayment(data.results[0].payment_order);
55
+ }
54
56
  setLoading(false);
55
57
  }
56
58
  })
@@ -65,6 +67,6 @@ function CommunityPaywall(inProps) {
65
67
  if (loading) {
66
68
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
67
69
  }
68
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true, spacing: 4 }, rest, { children: products.map((p, i) => ((0, jsx_runtime_1.jsx)(Unstable_Grid2_1.default, Object.assign({ xs: 4 }, { children: (0, jsx_runtime_1.jsx)(PaymentProduct_1.default, Object.assign({ expanded: true, paymentProduct: p, contentType: types_1.SCContentType.COMMUNITY, contentId: p.id }, (paymentOrder && { paymentOrder, onUpdatePaymentOrder }))) }), i))) })));
70
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true, spacing: 4 }, rest, { children: products.map((p, i) => ((0, jsx_runtime_1.jsx)(Unstable_Grid2_1.default, Object.assign({ xs: 4 }, { children: (0, jsx_runtime_1.jsx)(PaymentProduct_1.default, Object.assign({ expanded: true, paymentProduct: p, contentType: types_1.SCContentType.COMMUNITY, contentId: p.id }, (paymentOrder && { paymentOrder, onUpdatePaymentOrder }), (paymentOrder && { paymentOrder, onUpdatePaymentOrder }), (callBackUrl && { PaymentProductPriceComponentProps: { returnUrlParams: { callBackUrl } } }))) }), i))) })));
69
71
  }
70
72
  exports.default = CommunityPaywall;
@@ -4,6 +4,7 @@ import { SCCourseTemplateType } from '../../types/course';
4
4
  import { CourseParticipantsButtonProps } from '../CourseParticipantsButton';
5
5
  import { WidgetProps } from '../Widget';
6
6
  import { CourseSkeletonProps } from './Skeleton';
7
+ import { CacheStrategies } from '@selfcommunity/utils/src/utils/cache';
7
8
  export interface CourseProps extends WidgetProps {
8
9
  /**
9
10
  * Course Object
@@ -35,6 +36,10 @@ export interface CourseProps extends WidgetProps {
35
36
  * @default {}
36
37
  */
37
38
  CourseSkeletonComponentProps?: CourseSkeletonProps;
39
+ /**
40
+ * Override default cache strategy on fetch element
41
+ */
42
+ cacheStrategy?: CacheStrategies;
38
43
  /**
39
44
  * Any other properties
40
45
  */
@@ -111,9 +111,9 @@ function Course(inProps) {
111
111
  props: inProps,
112
112
  name: constants_1.PREFIX
113
113
  });
114
- const { id = `course_object_${props.courseId ? props.courseId : props.course ? props.course.id : ''}`, courseId = null, course = null, className = null, template = course_1.SCCourseTemplateType.PREVIEW, actions, CourseParticipantsButtonComponentProps = {}, CourseSkeletonComponentProps = {} } = props, rest = tslib_1.__rest(props, ["id", "courseId", "course", "className", "template", "actions", "CourseParticipantsButtonComponentProps", "CourseSkeletonComponentProps"]);
114
+ const { id = `course_object_${props.courseId ? props.courseId : props.course ? props.course.id : ''}`, courseId = null, course = null, className = null, template = course_1.SCCourseTemplateType.PREVIEW, actions, CourseParticipantsButtonComponentProps = {}, CourseSkeletonComponentProps = {}, cacheStrategy } = props, rest = tslib_1.__rest(props, ["id", "courseId", "course", "className", "template", "actions", "CourseParticipantsButtonComponentProps", "CourseSkeletonComponentProps", "cacheStrategy"]);
115
115
  // STATE
116
- const { scCourse } = (0, react_core_1.useSCFetchCourse)({ id: courseId, course });
116
+ const { scCourse } = (0, react_core_1.useSCFetchCourse)(Object.assign({ id: courseId, course }, (cacheStrategy && { cacheStrategy })));
117
117
  // CONTEXT
118
118
  const scRoutingContext = (0, react_core_1.useSCRouting)();
119
119
  const isCourseAdmin = (0, react_1.useMemo)(() => scCourse && (scCourse.join_status === types_1.SCCourseJoinStatusType.CREATOR || scCourse.join_status === types_1.SCCourseJoinStatusType.MANAGER), [scCourse]);
@@ -1,4 +1,5 @@
1
1
  import { SCEventType } from '@selfcommunity/types';
2
+ import { CacheStrategies } from '@selfcommunity/utils';
2
3
  import React from 'react';
3
4
  import { SCEventTemplateType } from '../../types/event';
4
5
  import { EventParticipantsButtonProps } from '../EventParticipantsButton';
@@ -50,6 +51,10 @@ export interface EventProps extends WidgetProps {
50
51
  * @default {}
51
52
  */
52
53
  EventSkeletonComponentProps?: EventSkeletonProps;
54
+ /**
55
+ * Override default cache strategy on fetch element
56
+ */
57
+ cacheStrategy?: CacheStrategies;
53
58
  /**
54
59
  * Any other properties
55
60
  */
@@ -106,9 +106,9 @@ function Event(inProps) {
106
106
  props: inProps,
107
107
  name: constants_1.PREFIX
108
108
  });
109
- const { id = `event_object_${props.eventId ? props.eventId : props.event ? props.event.id : ''}`, eventId = null, event = null, className = null, template = event_1.SCEventTemplateType.SNIPPET, hideInProgress = false, hideEventParticipants = false, hideEventPlanner = false, actions, EventParticipantsButtonComponentProps = {}, EventSkeletonComponentProps = {} } = props, rest = tslib_1.__rest(props, ["id", "eventId", "event", "className", "template", "hideInProgress", "hideEventParticipants", "hideEventPlanner", "actions", "EventParticipantsButtonComponentProps", "EventSkeletonComponentProps"]);
109
+ const { id = `event_object_${props.eventId ? props.eventId : props.event ? props.event.id : ''}`, eventId = null, event = null, className = null, template = event_1.SCEventTemplateType.SNIPPET, hideInProgress = false, hideEventParticipants = false, hideEventPlanner = false, actions, EventParticipantsButtonComponentProps = {}, EventSkeletonComponentProps = {}, cacheStrategy } = props, rest = tslib_1.__rest(props, ["id", "eventId", "event", "className", "template", "hideInProgress", "hideEventParticipants", "hideEventPlanner", "actions", "EventParticipantsButtonComponentProps", "EventSkeletonComponentProps", "cacheStrategy"]);
110
110
  // STATE
111
- const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event, autoSubscribe: false });
111
+ const { scEvent } = (0, react_core_1.useSCFetchEvent)(Object.assign({ id: eventId, event, autoSubscribe: false }, (cacheStrategy && { cacheStrategy })));
112
112
  const inProgress = (0, react_1.useMemo)(() => scEvent && scEvent.active && scEvent.running, [scEvent]);
113
113
  // CONTEXT
114
114
  const scRoutingContext = (0, react_core_1.useSCRouting)();
@@ -1,5 +1,6 @@
1
1
  import { ButtonBaseProps } from '@mui/material';
2
2
  import { SCGroupType } from '@selfcommunity/types';
3
+ import { CacheStrategies } from '@selfcommunity/utils/src/utils/cache';
3
4
  import { WidgetProps } from '../Widget';
4
5
  import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
5
6
  export interface GroupProps extends WidgetProps {
@@ -37,6 +38,10 @@ export interface GroupProps extends WidgetProps {
37
38
  * @default {}
38
39
  */
39
40
  buttonProps?: ButtonBaseProps;
41
+ /**
42
+ * Override default cache strategy on fetch element
43
+ */
44
+ cacheStrategy?: CacheStrategies;
40
45
  /**
41
46
  * Any other properties
42
47
  */
@@ -72,9 +72,9 @@ function Group(inProps) {
72
72
  props: inProps,
73
73
  name: constants_1.PREFIX
74
74
  });
75
- const { groupId = null, group = null, className = null, elevation, hideActions = false, actionRedirect = false, groupSubscribeButtonProps = {} } = props, rest = tslib_1.__rest(props, ["groupId", "group", "className", "elevation", "hideActions", "actionRedirect", "groupSubscribeButtonProps"]);
75
+ const { groupId = null, group = null, className = null, elevation, hideActions = false, actionRedirect = false, groupSubscribeButtonProps = {}, cacheStrategy } = props, rest = tslib_1.__rest(props, ["groupId", "group", "className", "elevation", "hideActions", "actionRedirect", "groupSubscribeButtonProps", "cacheStrategy"]);
76
76
  // STATE
77
- const { scGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
77
+ const { scGroup } = (0, react_core_1.useSCFetchGroup)(Object.assign({ id: groupId, group }, (cacheStrategy && { cacheStrategy })));
78
78
  // CONTEXT
79
79
  const scRoutingContext = (0, react_core_1.useSCRouting)();
80
80
  const scUserContext = (0, react_core_1.useSCUser)();
@@ -1,5 +1,6 @@
1
1
  import { AccordionProps } from '@mui/material';
2
2
  import { SCPaymentProduct, SCContentType, SCPurchasableContent, SCPaymentOrder, SCPaymentPrice, SCPaymentProductTemplateType } from '@selfcommunity/types';
3
+ import { PaymentProductPriceProps } from '../PaymentProductPrice';
3
4
  export interface PaymentProductProps extends Pick<AccordionProps, Exclude<keyof AccordionProps, 'children' | 'expanded'>> {
4
5
  className?: string;
5
6
  paymentProductId?: number;
@@ -11,5 +12,7 @@ export interface PaymentProductProps extends Pick<AccordionProps, Exclude<keyof
11
12
  onUpdatePaymentOrder?: (price: SCPaymentPrice, contentType?: SCContentType, contentId?: string | number) => void;
12
13
  template?: SCPaymentProductTemplateType;
13
14
  expanded?: boolean;
15
+ hidePaymentProductPrices?: boolean;
16
+ PaymentProductPriceComponentProps?: PaymentProductPriceProps;
14
17
  }
15
18
  export default function PaymentProduct(inProps: PaymentProductProps): JSX.Element;
@@ -26,7 +26,7 @@ function PaymentProduct(inProps) {
26
26
  props: inProps,
27
27
  name: constants_1.PREFIX
28
28
  });
29
- const { className, paymentProductId, paymentProduct, contentType, contentId, content, paymentOrder, onUpdatePaymentOrder, template = types_1.SCPaymentProductTemplateType.DETAIL, expanded } = props, rest = tslib_1.__rest(props, ["className", "paymentProductId", "paymentProduct", "contentType", "contentId", "content", "paymentOrder", "onUpdatePaymentOrder", "template", "expanded"]);
29
+ const { className, paymentProductId, paymentProduct, contentType, contentId, content, paymentOrder, onUpdatePaymentOrder, template = types_1.SCPaymentProductTemplateType.DETAIL, expanded, hidePaymentProductPrices = false, PaymentProductPriceComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "paymentProductId", "paymentProduct", "contentType", "contentId", "content", "paymentOrder", "onUpdatePaymentOrder", "template", "expanded", "hidePaymentProductPrices", "PaymentProductPriceComponentProps"]);
30
30
  // HOOKS
31
31
  const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
32
32
  const { scPaymentProduct } = (0, react_core_1.useSCFetchPaymentProduct)({ id: paymentProductId, paymentProduct });
@@ -44,6 +44,7 @@ function PaymentProduct(inProps) {
44
44
  if (!scPaymentProduct) {
45
45
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
46
46
  }
47
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ disabled: !productPaymentPriceIds.length, defaultExpanded: isProductExpanded && productPaymentPriceIds.length > 0, square: true, className: (0, classnames_1.default)(classes.root, className) }, (expanded && { expanded }), rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.AccordionSummary, Object.assign({ "aria-controls": "panel1-content", id: "panel1-header" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", component: "div" }, { children: (0, jsx_runtime_1.jsx)("b", { children: scPaymentProduct.name }) })), scPaymentProduct.description && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", component: "div" }, { children: scPaymentProduct.description })))] })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: scPaymentProduct.payment_prices.map((price, index) => ((0, jsx_runtime_1.jsx)(PaymentProductPrice_1.default, Object.assign({ price: price }, (contentType && { contentType }), (content ? { content } : { contentId }), (paymentOrder && { paymentOrder, onHandleActionBuy: onUpdatePaymentOrder })), index))) })] })));
47
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ disabled: !productPaymentPriceIds.length, defaultExpanded: isProductExpanded && productPaymentPriceIds.length > 0, square: true, className: (0, classnames_1.default)(classes.root, className) }, (expanded && { expanded }), rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.AccordionSummary, Object.assign({ "aria-controls": "panel1-content", id: "panel1-header" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", component: "div" }, { children: (0, jsx_runtime_1.jsx)("b", { children: scPaymentProduct.name && scPaymentProduct.name }) })), scPaymentProduct.description && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", component: "div" }, { children: scPaymentProduct.description })))] })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: !hidePaymentProductPrices &&
48
+ scPaymentProduct.payment_prices.map((price, index) => ((0, jsx_runtime_1.jsx)(PaymentProductPrice_1.default, Object.assign({ price: price }, PaymentProductPriceComponentProps, (contentType && { contentType }), (content ? { content } : { contentId }), (paymentOrder && { paymentOrder, onHandleActionBuy: onUpdatePaymentOrder })), index))) })] })));
48
49
  }
49
50
  exports.default = PaymentProduct;
@@ -10,5 +10,6 @@ export interface PaymentProductPriceProps {
10
10
  actions?: React.ReactNode;
11
11
  paymentOrder?: SCPaymentOrder;
12
12
  onHandleActionBuy?: (price: SCPaymentPrice, contentType?: SCContentType, contentId?: string | number) => void;
13
+ returnUrlParams?: Record<string, string>;
13
14
  }
14
15
  export default function PaymentProductPrice(inProps: PaymentProductPriceProps): JSX.Element;
@@ -33,7 +33,7 @@ function PaymentProductPrice(inProps) {
33
33
  props: inProps,
34
34
  name: constants_1.PREFIX
35
35
  });
36
- const { className, id, price, contentType, contentId, content, actions, onHandleActionBuy, paymentOrder } = props, rest = tslib_1.__rest(props, ["className", "id", "price", "contentType", "contentId", "content", "actions", "onHandleActionBuy", "paymentOrder"]);
36
+ const { className, id, price, contentType, contentId, content, actions, onHandleActionBuy, paymentOrder, returnUrlParams } = props, rest = tslib_1.__rest(props, ["className", "id", "price", "contentType", "contentId", "content", "actions", "onHandleActionBuy", "paymentOrder", "returnUrlParams"]);
37
37
  // ROUTING
38
38
  const scRoutingContext = (0, react_core_1.useSCRouting)();
39
39
  // HOOKS
@@ -57,10 +57,10 @@ function PaymentProductPrice(inProps) {
57
57
  }
58
58
  return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ disableTypography: true, className: classes.root, image: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.image }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ variant: "square", alt: 'price.name', className: classes.image }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "card_giftcard" }) })) })), primary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: formattedPrice })), secondary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "p", variant: "body2", className: classes.secondary }, { children: price.description }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !isMobile && paymentOrder && paymentOrder.payment_price.id === price.id && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "p", variant: "body2", className: (0, classnames_1.default)(classes.secondary, classes.purchasedAt) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.paymentProduct.action.purchasedAt", id: "ui.paymentProduct.action.purchasedAt", values: {
59
59
  purchasedAt: intl.formatDate(new Date(), { day: 'numeric', year: 'numeric', month: 'long' })
60
- } }) }))) })] }), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.action }, { children: (0, jsx_runtime_1.jsx)(material_1.Zoom, Object.assign({ in: true, style: { transitionDelay: '200ms' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: paymentOrder && paymentOrder.payment_price.id === price.id ? 'secondary' : 'error', className: (0, classnames_1.default)(classes.button, { [classes.buttonPurchased]: paymentOrder && paymentOrder.payment_price.id === price.id }) }, (paymentOrder && { disabled: true }), { variant: "contained", component: react_core_1.Link, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "card_giftcard" }) }, (onHandleActionBuy && { onClick: handleActionBuy }), { to: scRoutingContext.url(react_core_1.SCRoutes.CHECKOUT_PAYMENT, {
60
+ } }) }))) })] }), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.action }, { children: (0, jsx_runtime_1.jsx)(material_1.Zoom, Object.assign({ in: true, style: { transitionDelay: '200ms' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: paymentOrder && paymentOrder.payment_price.id === price.id ? 'secondary' : 'error', className: (0, classnames_1.default)(classes.button, { [classes.buttonPurchased]: paymentOrder && paymentOrder.payment_price.id === price.id }) }, (paymentOrder && { disabled: true }), { variant: "contained", component: react_core_1.Link, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "card_giftcard" }) }, (onHandleActionBuy && { onClick: handleActionBuy }), { to: `${scRoutingContext.url(react_core_1.SCRoutes.CHECKOUT_PAYMENT, {
61
61
  content_type: contentType.toLowerCase(),
62
62
  content_id: content ? content.id : contentId,
63
63
  price_id: price.id
64
- }) }, { children: paymentOrder && paymentOrder.payment_price.id === price.id ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.paymentProduct.action.purchased", id: "ui.paymentProduct.action.purchased" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.paymentProduct.action.buy", id: "ui.paymentProduct.action.buy" })) })) })) }))) }, rest)));
64
+ })}?${returnUrlParams ? new URLSearchParams(returnUrlParams) : ''}` }, { children: paymentOrder && paymentOrder.payment_price.id === price.id ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.paymentProduct.action.purchased", id: "ui.paymentProduct.action.purchased" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.paymentProduct.action.buy", id: "ui.paymentProduct.action.buy" })) })) })) }))) }, rest)));
65
65
  }
66
66
  exports.default = PaymentProductPrice;
@@ -37,7 +37,7 @@ function PaymentProducts(inProps) {
37
37
  /**
38
38
  * Fetches products list
39
39
  */
40
- const fetchProducts = (next = api_services_1.Endpoints.GetContentProducts.url({})) => tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ const fetchProducts = (next = api_services_1.Endpoints.GetPaymentProducts.url({})) => tslib_1.__awaiter(this, void 0, void 0, function* () {
41
41
  const data = yield api_services_1.PaymentApiClient.getPaymentProducts(id !== undefined ? { id } : { content_id: contentId, content_type: contentType }, {
42
42
  url: next
43
43
  });
@@ -0,0 +1,10 @@
1
+ import { SCContentType, SCPurchasableContent, SCPaymentPrice } from '@selfcommunity/types';
2
+ export interface PaywallsProps {
3
+ className?: string;
4
+ contentType?: SCContentType;
5
+ contentId?: number | string;
6
+ content?: SCPurchasableContent;
7
+ prefetchedPaymentContentStatus?: SCPurchasableContent;
8
+ onUpdatePaymentOrder?: (price: SCPaymentPrice, contentType?: SCContentType, contentId?: string | number) => void;
9
+ }
10
+ export default function Paywalls(inProps: PaywallsProps): JSX.Element;