@selfcommunity/react-ui 0.10.5-payments.215 → 0.10.5-payments.216
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.
|
@@ -44,7 +44,7 @@ function CheckoutReturnDialog(inProps) {
|
|
|
44
44
|
const [contentType, setContentType] = (0, react_1.useState)(null);
|
|
45
45
|
const [contentId, setContentId] = (0, react_1.useState)(null);
|
|
46
46
|
const [content, setContent] = (0, react_1.useState)(null);
|
|
47
|
-
const [
|
|
47
|
+
const [paymentPrice, setPaymentPrice] = (0, react_1.useState)(null);
|
|
48
48
|
// HOOKS
|
|
49
49
|
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
50
50
|
const intl = (0, react_intl_1.useIntl)();
|
|
@@ -114,8 +114,8 @@ function CheckoutReturnDialog(inProps) {
|
|
|
114
114
|
setContentType(r.content_type);
|
|
115
115
|
setContentId(r.content_id);
|
|
116
116
|
setContent(r[r.content_type]);
|
|
117
|
-
if (r.payment_price
|
|
118
|
-
|
|
117
|
+
if (r.payment_price) {
|
|
118
|
+
setPaymentPrice(r.payment_price);
|
|
119
119
|
}
|
|
120
120
|
// Refresh subscription status
|
|
121
121
|
refreshContentStatus();
|
|
@@ -134,29 +134,28 @@ function CheckoutReturnDialog(inProps) {
|
|
|
134
134
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !loading && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.title", defaultMessage: "ui.checkoutReturnDialog.title" }) });
|
|
135
135
|
};
|
|
136
136
|
const renderContent = () => {
|
|
137
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
138
137
|
let footer;
|
|
139
138
|
if (contentType === types_1.SCContentType.EVENT) {
|
|
140
|
-
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
141
|
-
frequency: (0, checkout_1.getPaymentRecurringLabel)(
|
|
139
|
+
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.event", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.event", values: {
|
|
140
|
+
frequency: (0, checkout_1.getPaymentRecurringLabel)(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
142
141
|
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.event", defaultMessage: "ui.checkoutReturnDialog.buy.event" })) })), (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" }) }))] }));
|
|
143
142
|
}
|
|
144
143
|
else if (contentType === types_1.SCContentType.CATEGORY) {
|
|
145
144
|
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (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.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" }) }))] }));
|
|
146
145
|
}
|
|
147
146
|
else if (contentType === types_1.SCContentType.COURSE) {
|
|
148
|
-
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
149
|
-
frequency: (0, checkout_1.getPaymentRecurringLabel)(
|
|
147
|
+
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.course", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.course", values: {
|
|
148
|
+
frequency: (0, checkout_1.getPaymentRecurringLabel)(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
150
149
|
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.course", defaultMessage: "ui.checkoutReturnDialog.buy.course" })) })), (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" }) }))] }));
|
|
151
150
|
}
|
|
152
151
|
else if (contentType === types_1.SCContentType.GROUP) {
|
|
153
|
-
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
154
|
-
frequency: (0, checkout_1.getPaymentRecurringLabel)(
|
|
152
|
+
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.group", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.group", values: {
|
|
153
|
+
frequency: (0, checkout_1.getPaymentRecurringLabel)(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
155
154
|
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.group", defaultMessage: "ui.checkoutReturnDialog.buy.group" })) })), (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.group.button", defaultMessage: "ui.checkoutReturnDialog.group.button" }) }))] }));
|
|
156
155
|
}
|
|
157
156
|
else if (contentType === types_1.SCContentType.COMMUNITY) {
|
|
158
|
-
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [
|
|
159
|
-
frequency: (0, checkout_1.getPaymentRecurringLabel)(
|
|
157
|
+
footer = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [paymentPrice && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice.recurring_interval ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.community", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.community", values: {
|
|
158
|
+
frequency: (0, checkout_1.getPaymentRecurringLabel)(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
160
159
|
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.checkoutReturnDialog.buy.community", defaultMessage: "ui.checkoutReturnDialog.buy.community" })) }))] })), (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" }) }))] }));
|
|
161
160
|
}
|
|
162
161
|
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: success_1.default, className: classes.img, alt: intl.formatMessage({
|
|
@@ -42,7 +42,7 @@ export default function CheckoutReturnDialog(inProps) {
|
|
|
42
42
|
const [contentType, setContentType] = useState(null);
|
|
43
43
|
const [contentId, setContentId] = useState(null);
|
|
44
44
|
const [content, setContent] = useState(null);
|
|
45
|
-
const [
|
|
45
|
+
const [paymentPrice, setPaymentPrice] = useState(null);
|
|
46
46
|
// HOOKS
|
|
47
47
|
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
48
48
|
const intl = useIntl();
|
|
@@ -112,8 +112,8 @@ export default function CheckoutReturnDialog(inProps) {
|
|
|
112
112
|
setContentType(r.content_type);
|
|
113
113
|
setContentId(r.content_id);
|
|
114
114
|
setContent(r[r.content_type]);
|
|
115
|
-
if (r.payment_price
|
|
116
|
-
|
|
115
|
+
if (r.payment_price) {
|
|
116
|
+
setPaymentPrice(r.payment_price);
|
|
117
117
|
}
|
|
118
118
|
// Refresh subscription status
|
|
119
119
|
refreshContentStatus();
|
|
@@ -132,29 +132,28 @@ export default function CheckoutReturnDialog(inProps) {
|
|
|
132
132
|
return _jsx(_Fragment, { children: !loading && _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.title", defaultMessage: "ui.checkoutReturnDialog.title" }) });
|
|
133
133
|
};
|
|
134
134
|
const renderContent = () => {
|
|
135
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
136
135
|
let footer;
|
|
137
136
|
if (contentType === SCContentType.EVENT) {
|
|
138
|
-
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
139
|
-
frequency: getPaymentRecurringLabel(
|
|
137
|
+
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.event", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.event", values: {
|
|
138
|
+
frequency: getPaymentRecurringLabel(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
140
139
|
} })) : (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.event", defaultMessage: "ui.checkoutReturnDialog.buy.event" })) })), _jsx(Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: Link, className: classes.btn }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.event.button", defaultMessage: "ui.checkoutReturnDialog.event.button" }) }))] }));
|
|
141
140
|
}
|
|
142
141
|
else if (contentType === SCContentType.CATEGORY) {
|
|
143
142
|
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy", defaultMessage: "ui.checkoutReturnDialog.buy" }) })), _jsx(Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: Link, className: classes.btn }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.category.button", defaultMessage: "ui.checkoutReturnDialog.category.button" }) }))] }));
|
|
144
143
|
}
|
|
145
144
|
else if (contentType === SCContentType.COURSE) {
|
|
146
|
-
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
147
|
-
frequency: getPaymentRecurringLabel(
|
|
145
|
+
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.course", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.course", values: {
|
|
146
|
+
frequency: getPaymentRecurringLabel(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
148
147
|
} })) : (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.course", defaultMessage: "ui.checkoutReturnDialog.buy.course" })) })), _jsx(Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: Link, className: classes.btn }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.course.button", defaultMessage: "ui.checkoutReturnDialog.course.button" }) }))] }));
|
|
149
148
|
}
|
|
150
149
|
else if (contentType === SCContentType.GROUP) {
|
|
151
|
-
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children:
|
|
152
|
-
frequency: getPaymentRecurringLabel(
|
|
150
|
+
footer = (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice && paymentPrice.recurring_interval ? (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.group", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.group", values: {
|
|
151
|
+
frequency: getPaymentRecurringLabel(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
153
152
|
} })) : (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.group", defaultMessage: "ui.checkoutReturnDialog.buy.group" })) })), _jsx(Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: Link, className: classes.btn }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.group.button", defaultMessage: "ui.checkoutReturnDialog.group.button" }) }))] }));
|
|
154
153
|
}
|
|
155
154
|
else if (contentType === SCContentType.COMMUNITY) {
|
|
156
|
-
footer = (_jsxs(_Fragment, { children: [
|
|
157
|
-
frequency: getPaymentRecurringLabel(
|
|
155
|
+
footer = (_jsxs(_Fragment, { children: [paymentPrice && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.payment.success", defaultMessage: "ui.checkoutReturnDialog.payment.success" }) })), _jsx(Typography, Object.assign({ variant: "body2", color: "textSecondary" }, { children: paymentPrice.recurring_interval ? (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.recurrent.community", defaultMessage: "ui.checkoutReturnDialog.buy.recurrent.community", values: {
|
|
156
|
+
frequency: getPaymentRecurringLabel(paymentPrice.recurring_interval, scContext.settings.locale.default)
|
|
158
157
|
} })) : (_jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.buy.community", defaultMessage: "ui.checkoutReturnDialog.buy.community" })) }))] })), _jsx(Button, Object.assign({ size: "medium", variant: 'contained', onClick: handleViewPurchasedObject, component: Link, className: classes.btn }, { children: _jsx(FormattedMessage, { id: "ui.checkoutReturnDialog.community.button", defaultMessage: "ui.checkoutReturnDialog.community.button" }) }))] }));
|
|
159
158
|
}
|
|
160
159
|
return (_jsxs(Stack, Object.assign({ spacing: 2, justifyContent: "center", alignItems: "center" }, { children: [_jsx(Grow, Object.assign({ in: true, style: { transitionDelay: '300ms' } }, { children: _jsx("img", { src: SuccessPlaceholder, className: classes.img, alt: intl.formatMessage({
|