@edx/frontend-app-subscription-checkout 1.22.3 → 1.23.0

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.
@@ -10,8 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useEffect } from 'react';
14
- import { publish } from '@openedx/frontend-base';
15
13
  import { Alert, Col, Row } from '@openedx/paragon';
16
14
  import { Error as ErrorIcon } from '@openedx/paragon/icons';
17
15
  import { useIntl } from '@openedx/frontend-base';
@@ -25,11 +23,7 @@ import { getPlanPrice, getRenewalLabel } from '../../utils/billingDetails';
25
23
  import { getLearnerFacingCheckoutMessage } from '../../utils/checkoutErrors';
26
24
  import { getTrialDateRange } from '../../utils';
27
25
  import { SuccessScreen, BlockedScreen, ProcessingScreen } from '../StatusScreens/StatusScreens';
28
- import { CHECKOUT_PAYMENT_STATE_CHANGED } from '../CheckoutLogos';
29
26
  import messages from './Messages';
30
- const publishPaymentState = (state) => {
31
- publish(CHECKOUT_PAYMENT_STATE_CHANGED, state);
32
- };
33
27
  /** Resolve purchased cycle from subscription details, falling back to checkout selection. */
34
28
  function resolvePurchasedCycle(selectedCycle, planName, renewalType) {
35
29
  const haystack = `${planName !== null && planName !== void 0 ? planName : ''} ${renewalType !== null && renewalType !== void 0 ? renewalType : ''}`.toLowerCase();
@@ -44,11 +38,6 @@ const Checkout = (_a) => {
44
38
  var { homeUrl = '/' } = _a, props = __rest(_a, ["homeUrl"]);
45
39
  const { formatMessage } = useIntl();
46
40
  const c = useCheckout(props);
47
- const isPaid = c.phase === 'success';
48
- useEffect(() => {
49
- publishPaymentState({ isPaid });
50
- }, [isPaid]);
51
- useEffect(() => () => publishPaymentState({ isPaid: false }), []);
52
41
  const showProcessing = c.returningFromStripe
53
42
  && c.processingSubscription
54
43
  && c.phase !== 'success'
@@ -1 +1 @@
1
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Q,CAAC,EAC7D,qBAAqB,EAAE,CAAC,CAAC,qBAAqB,EAC9C,YAAY,EAAE,aAAa,EAC3B,aAAa,EAAE,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAChE,MAAM,EAAE,CAAC,CAAC,MAAM,GAChB,CACH,GACG,IACF,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React, { useEffect } from 'react';\nimport { publish } from '@openedx/frontend-base';\nimport { Alert, Col, Row } from '@openedx/paragon';\nimport { Error as ErrorIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport useCheckout from '../../data/hooks/useCheckout';\nimport type { UseCheckoutOptions } from '../../data/hooks/useCheckout';\nimport { ALLOWED_CHECKOUT_COUNTRIES, GATE_CHECK_COUNTRY } from '../../constants';\nimport CartSummary from '../CartSummary/CartSummary';\nimport EnrollmentSummary from '../EnrollmentSummary/EnrollmentSummary';\nimport PaymentForm from '../PaymentForm/PaymentForm';\nimport CountryUnavailableModal from '../CountryUnavailableModal/CountryUnavailableModal';\nimport { getPlanPrice, getRenewalLabel } from '../../utils/billingDetails';\nimport { getLearnerFacingCheckoutMessage } from '../../utils/checkoutErrors';\nimport { getTrialDateRange } from '@src/utils';\nimport { SuccessScreen, BlockedScreen, ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { BillingCycle } from '../../types';\nimport { CHECKOUT_PAYMENT_STATE_CHANGED } from '../CheckoutLogos';\nimport type { CheckoutPaymentState } from '../CheckoutLogos';\nimport messages from './Messages';\n\nconst publishPaymentState = (state: CheckoutPaymentState) => {\n publish(CHECKOUT_PAYMENT_STATE_CHANGED, state);\n};\n\n/** Resolve purchased cycle from subscription details, falling back to checkout selection. */\nfunction resolvePurchasedCycle(\n selectedCycle: BillingCycle,\n planName?: string | null,\n renewalType?: string | null,\n): BillingCycle {\n const haystack = `${planName ?? ''} ${renewalType ?? ''}`.toLowerCase();\n if (haystack.includes('annual') || haystack.includes('year')) return 'annual';\n if (haystack.includes('month')) return 'monthly';\n return selectedCycle;\n}\n\nexport type CheckoutProps = UseCheckoutOptions & {\n /** Homepage URL for the country-unavailable modal CTA. */\n homeUrl?: string,\n /** Endpoint used to look up the representative IP for a selected country. */\n geolocationUrl?: string,\n};\n\nconst Checkout = ({\n homeUrl = '/',\n ...props\n}: CheckoutProps) => {\n const { formatMessage } = useIntl();\n const c = useCheckout(props);\n const isPaid = c.phase === 'success';\n\n useEffect(() => {\n publishPaymentState({ isPaid });\n }, [isPaid]);\n\n useEffect(() => () => publishPaymentState({ isPaid: false }), []);\n\n const showProcessing\n = c.returningFromStripe\n && c.processingSubscription\n && c.phase !== 'success'\n && c.phase !== 'blocked'\n && c.phase !== 'failed';\n const showForm\n = !showProcessing\n && (c.phase === 'init'\n || c.phase === 'ready'\n || c.phase === 'failed'\n || c.phase === 'processing');\n const monthlyPrice = getPlanPrice(c.billingPlans, 'monthly');\n const annualPrice = getPlanPrice(c.billingPlans, 'annual');\n const failedMessage = getLearnerFacingCheckoutMessage(c.lastComment);\n\n const { displayStart, displayEnd } = getTrialDateRange();\n\n const isBillingCountryBlocked = GATE_CHECK_COUNTRY\n && !!c.billing.country\n && !ALLOWED_CHECKOUT_COUNTRIES.includes(c.billing.country);\n\n const selectedCycle: BillingCycle = c.selectedCycle;\n\n const purchasedCycle = resolvePurchasedCycle(\n selectedCycle,\n c.subscriptionDetails?.planName,\n c.subscriptionDetails?.renewalType,\n );\n const purchasedPrice = getPlanPrice(c.billingPlans, purchasedCycle);\n\n const handleStartCourse = () => {\n if (c.course?.tUrlCourse) {\n window.location.href = c.course.tUrlCourse;\n } else {\n window.location.href = '/subscription-search';\n }\n };\n\n const courseLabel = c.course\n ? [c.course.tBrandText, c.course.maName].filter(Boolean).join(': ')\n : null;\n\n if (showProcessing) {\n return <ProcessingScreen />;\n }\n\n return (\n <Row className=\"checkout__container bg-light-200\">\n <CountryUnavailableModal\n isOpen={isBillingCountryBlocked}\n homeUrl={homeUrl}\n />\n <Col xs={12} className=\"d-lg-none\">\n <h1 className=\"font-weight-bold text-primary-900\">Checkout</h1>\n </Col>\n <Col xs={12}>\n <Row className=\"flex-column-reverse gap-5 flex-lg-row\">\n {/* ── LEFT ── */}\n <Col xs={12} lg={7} xxl={9} className=\"payment__options\">\n <div>\n <h1 className=\"font-weight-bold text-primary-900 d-none d-lg-block\">\n Checkout\n </h1>\n {c.error && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={c.clearError}\n >\n {c.error}\n </Alert>\n )}\n\n {showForm && (\n <>\n {c.phase === 'failed' && (\n <Alert variant=\"danger\" icon={ErrorIcon} className=\"mb-3\">\n {failedMessage\n || (c.returningFromStripe\n ? formatMessage(messages.paymentVerificationFailed)\n : formatMessage(messages.paymentFailed))}\n </Alert>\n )}\n <PaymentForm\n billing={c.billing}\n setField={c.setField}\n numberMountRef={c.numberMountRef}\n expiryMountRef={c.expiryMountRef}\n cvcMountRef={c.cvcMountRef}\n cardError={c.cardError}\n stripeReady={c.stripeReady}\n sessionReady={c.sessionReady}\n submitting={c.processingSubscription}\n onPlaceOrder={c.placeOrder}\n trialEnd={selectedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={\n selectedCycle === 'monthly' ? monthlyPrice : annualPrice\n }\n cycleToShow={\n selectedCycle === 'monthly' ? 'monthly' : 'annual'\n }\n userCountry={c.userCountry}\n geolocationUrl={props.geolocationUrl}\n monthlyRegularAmount={monthlyPrice?.amount}\n />\n </>\n )}\n\n {c.phase === 'success' && (\n <SuccessScreen\n subscriptionBiId={c.subscriptionDetails?.biId || ''}\n cardLast4={c.subscriptionDetails?.cardLast4 || ''}\n purchaseDate={displayStart}\n trialStart={purchasedCycle === 'monthly' ? displayStart : undefined}\n trialEnd={purchasedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={\n purchasedCycle === 'monthly'\n ? monthlyPrice?.label\n : annualPrice?.label\n }\n cycleToShow={\n purchasedCycle === 'monthly' ? 'monthly' : 'annual'\n }\n courseLabel={courseLabel}\n onFindCourse={handleStartCourse}\n />\n )}\n\n {c.phase === 'blocked' && (\n <BlockedScreen detail={c.lastComment} />\n )}\n </div>\n </Col>\n\n {/* ── RIGHT — swaps to EnrollmentSummary on success ── */}\n <Col xs={12} lg={5} xxl={3} className=\"payment__summary\">\n {c.phase === 'success' ? (\n <EnrollmentSummary\n amount={purchasedPrice?.amount}\n monthlyRegularAmount={monthlyPrice?.amount}\n currency={purchasedPrice?.currency}\n cycleToShow={purchasedCycle}\n course={c.course}\n onStartCourse={handleStartCourse}\n />\n ) : (\n <CartSummary\n monthlyRegularAmount={monthlyPrice?.amount}\n annualAmount={annualPrice?.amount}\n currency={monthlyPrice?.currency ?? annualPrice?.currency}\n monthlyRenewalLabel={getRenewalLabel(c.billingPlans, 'monthly')}\n annualRenewalLabel={getRenewalLabel(c.billingPlans, 'annual')}\n activeSubscriberCount={c.activeSubscriberCount}\n defaultCycle={selectedCycle}\n onCycleChange={c.processingSubscription ? undefined : c.setCycle}\n course={c.course}\n />\n )}\n </Col>\n </Row>\n </Col>\n </Row>\n );\n};\n\nexport default Checkout;\n"]}
1
+ {"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../../../src/components/Checkout/Checkout.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,iBAAiB,MAAM,wCAAwC,CA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CAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EACzD,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,EAC/D,kBAAkB,EAAE,eAAe,CAAC,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,EAC7D,qBAAqB,EAAE,CAAC,CAAC,qBAAqB,EAC9C,YAAY,EAAE,aAAa,EAC3B,aAAa,EAAE,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAChE,MAAM,EAAE,CAAC,CAAC,MAAM,GAChB,CACH,GACG,IACF,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { Alert, Col, Row } from '@openedx/paragon';\nimport { Error as ErrorIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport useCheckout from '../../data/hooks/useCheckout';\nimport type { UseCheckoutOptions } from '../../data/hooks/useCheckout';\nimport { ALLOWED_CHECKOUT_COUNTRIES, GATE_CHECK_COUNTRY } from '../../constants';\nimport CartSummary from '../CartSummary/CartSummary';\nimport EnrollmentSummary from '../EnrollmentSummary/EnrollmentSummary';\nimport PaymentForm from '../PaymentForm/PaymentForm';\nimport CountryUnavailableModal from '../CountryUnavailableModal/CountryUnavailableModal';\nimport { getPlanPrice, getRenewalLabel } from '../../utils/billingDetails';\nimport { getLearnerFacingCheckoutMessage } from '../../utils/checkoutErrors';\nimport { getTrialDateRange } from '@src/utils';\nimport { SuccessScreen, BlockedScreen, ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { BillingCycle } from '../../types';\nimport messages from './Messages';\n\n/** Resolve purchased cycle from subscription details, falling back to checkout selection. */\nfunction resolvePurchasedCycle(\n selectedCycle: BillingCycle,\n planName?: string | null,\n renewalType?: string | null,\n): BillingCycle {\n const haystack = `${planName ?? ''} ${renewalType ?? ''}`.toLowerCase();\n if (haystack.includes('annual') || haystack.includes('year')) return 'annual';\n if (haystack.includes('month')) return 'monthly';\n return selectedCycle;\n}\n\nexport type CheckoutProps = UseCheckoutOptions & {\n /** Homepage URL for the country-unavailable modal CTA. */\n homeUrl?: string,\n /** Endpoint used to look up the representative IP for a selected country. */\n geolocationUrl?: string,\n};\n\nconst Checkout = ({\n homeUrl = '/',\n ...props\n}: CheckoutProps) => {\n const { formatMessage } = useIntl();\n const c = useCheckout(props);\n\n const showProcessing\n = c.returningFromStripe\n && c.processingSubscription\n && c.phase !== 'success'\n && c.phase !== 'blocked'\n && c.phase !== 'failed';\n const showForm\n = !showProcessing\n && (c.phase === 'init'\n || c.phase === 'ready'\n || c.phase === 'failed'\n || c.phase === 'processing');\n const monthlyPrice = getPlanPrice(c.billingPlans, 'monthly');\n const annualPrice = getPlanPrice(c.billingPlans, 'annual');\n const failedMessage = getLearnerFacingCheckoutMessage(c.lastComment);\n\n const { displayStart, displayEnd } = getTrialDateRange();\n\n const isBillingCountryBlocked = GATE_CHECK_COUNTRY\n && !!c.billing.country\n && !ALLOWED_CHECKOUT_COUNTRIES.includes(c.billing.country);\n\n const selectedCycle: BillingCycle = c.selectedCycle;\n\n const purchasedCycle = resolvePurchasedCycle(\n selectedCycle,\n c.subscriptionDetails?.planName,\n c.subscriptionDetails?.renewalType,\n );\n const purchasedPrice = getPlanPrice(c.billingPlans, purchasedCycle);\n\n const handleStartCourse = () => {\n if (c.course?.tUrlCourse) {\n window.location.href = c.course.tUrlCourse;\n } else {\n window.location.href = '/subscription-search';\n }\n };\n\n const courseLabel = c.course\n ? [c.course.tBrandText, c.course.maName].filter(Boolean).join(': ')\n : null;\n\n if (showProcessing) {\n return <ProcessingScreen />;\n }\n\n return (\n <Row className=\"checkout__container bg-light-200\">\n <CountryUnavailableModal\n isOpen={isBillingCountryBlocked}\n homeUrl={homeUrl}\n />\n <Col xs={12} className=\"d-lg-none\">\n <h1 className=\"font-weight-bold text-primary-900\">Checkout</h1>\n </Col>\n <Col xs={12}>\n <Row className=\"flex-column-reverse gap-5 flex-lg-row\">\n {/* ── LEFT ── */}\n <Col xs={12} lg={7} xxl={9} className=\"payment__options\">\n <div>\n <h1 className=\"font-weight-bold text-primary-900 d-none d-lg-block\">\n Checkout\n </h1>\n {c.error && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={c.clearError}\n >\n {c.error}\n </Alert>\n )}\n\n {showForm && (\n <>\n {c.phase === 'failed' && (\n <Alert variant=\"danger\" icon={ErrorIcon} className=\"mb-3\">\n {failedMessage\n || (c.returningFromStripe\n ? formatMessage(messages.paymentVerificationFailed)\n : formatMessage(messages.paymentFailed))}\n </Alert>\n )}\n <PaymentForm\n billing={c.billing}\n setField={c.setField}\n numberMountRef={c.numberMountRef}\n expiryMountRef={c.expiryMountRef}\n cvcMountRef={c.cvcMountRef}\n cardError={c.cardError}\n stripeReady={c.stripeReady}\n sessionReady={c.sessionReady}\n submitting={c.processingSubscription}\n onPlaceOrder={c.placeOrder}\n trialEnd={selectedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={\n selectedCycle === 'monthly' ? monthlyPrice : annualPrice\n }\n cycleToShow={\n selectedCycle === 'monthly' ? 'monthly' : 'annual'\n }\n userCountry={c.userCountry}\n geolocationUrl={props.geolocationUrl}\n monthlyRegularAmount={monthlyPrice?.amount}\n />\n </>\n )}\n\n {c.phase === 'success' && (\n <SuccessScreen\n subscriptionBiId={c.subscriptionDetails?.biId || ''}\n cardLast4={c.subscriptionDetails?.cardLast4 || ''}\n purchaseDate={displayStart}\n trialStart={purchasedCycle === 'monthly' ? displayStart : undefined}\n trialEnd={purchasedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={\n purchasedCycle === 'monthly'\n ? monthlyPrice?.label\n : annualPrice?.label\n }\n cycleToShow={\n purchasedCycle === 'monthly' ? 'monthly' : 'annual'\n }\n courseLabel={courseLabel}\n onFindCourse={handleStartCourse}\n />\n )}\n\n {c.phase === 'blocked' && (\n <BlockedScreen detail={c.lastComment} />\n )}\n </div>\n </Col>\n\n {/* ── RIGHT — swaps to EnrollmentSummary on success ── */}\n <Col xs={12} lg={5} xxl={3} className=\"payment__summary\">\n {c.phase === 'success' ? (\n <EnrollmentSummary\n amount={purchasedPrice?.amount}\n monthlyRegularAmount={monthlyPrice?.amount}\n currency={purchasedPrice?.currency}\n cycleToShow={purchasedCycle}\n course={c.course}\n onStartCourse={handleStartCourse}\n />\n ) : (\n <CartSummary\n monthlyRegularAmount={monthlyPrice?.amount}\n annualAmount={annualPrice?.amount}\n currency={monthlyPrice?.currency ?? annualPrice?.currency}\n monthlyRenewalLabel={getRenewalLabel(c.billingPlans, 'monthly')}\n annualRenewalLabel={getRenewalLabel(c.billingPlans, 'annual')}\n activeSubscriberCount={c.activeSubscriberCount}\n defaultCycle={selectedCycle}\n onCycleChange={c.processingSubscription ? undefined : c.setCycle}\n course={c.course}\n />\n )}\n </Col>\n </Row>\n </Col>\n </Row>\n );\n};\n\nexport default Checkout;\n"]}
package/dist/slots.js CHANGED
@@ -1,38 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { WidgetOperationTypes } from '@openedx/frontend-base';
3
- import { SubscriptionCheckoutLogo, MobileCenterCheckoutLogo, MobileLeftPaidLogo } from './components/CheckoutLogos';
4
- import { subscriptionCheckoutRole } from './constants';
5
- const slots = [
6
- {
7
- slotId: 'org.openedx.frontend.slot.header.desktopLeft.v1',
8
- id: 'org.openedx.frontend.widget.subscriptionCheckout.header.desktopLogo.v1',
9
- op: WidgetOperationTypes.REPLACE,
10
- relatedId: 'org.openedx.frontend.widget.header.desktopLogo.v1',
11
- element: _jsx(SubscriptionCheckoutLogo, {}),
12
- condition: {
13
- active: [subscriptionCheckoutRole],
14
- },
15
- },
16
- {
17
- slotId: 'org.openedx.frontend.slot.header.mobileCenter.v1',
18
- id: 'org.openedx.frontend.widget.subscriptionCheckout.header.mobileLogo.v1',
19
- op: WidgetOperationTypes.REPLACE,
20
- relatedId: 'org.openedx.frontend.widget.header.mobileLogo.v1',
21
- element: _jsx(MobileCenterCheckoutLogo, {}),
22
- condition: {
23
- active: [subscriptionCheckoutRole],
24
- },
25
- },
26
- {
27
- slotId: 'org.openedx.frontend.slot.header.mobileLeft.v1',
28
- id: 'org.openedx.frontend.widget.subscriptionCheckout.header.mobileLogoLeft.v1',
29
- op: WidgetOperationTypes.APPEND,
30
- // checkout-specific mobile-left widget: shows paid logo after payment
31
- element: _jsx(MobileLeftPaidLogo, {}),
32
- condition: {
33
- active: [subscriptionCheckoutRole],
34
- },
35
- },
36
- ];
1
+ const slots = [];
37
2
  export default slots;
38
3
  //# sourceMappingURL=slots.js.map
package/dist/slots.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"slots.js","sourceRoot":"","sources":["../src/slots.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACpH,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,KAAK,GAAoB;IAC7B;QACE,MAAM,EAAE,iDAAiD;QACzD,EAAE,EAAE,wEAAwE;QAC5E,EAAE,EAAE,oBAAoB,CAAC,OAAO;QAChC,SAAS,EAAE,mDAAmD;QAC9D,OAAO,EAAE,KAAC,wBAAwB,KAAG;QACrC,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,wBAAwB,CAAC;SACnC;KACF;IACD;QACE,MAAM,EAAE,kDAAkD;QAC1D,EAAE,EAAE,uEAAuE;QAC3E,EAAE,EAAE,oBAAoB,CAAC,OAAO;QAChC,SAAS,EAAE,kDAAkD;QAC7D,OAAO,EAAE,KAAC,wBAAwB,KAAG;QACrC,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,wBAAwB,CAAC;SACnC;KACF;IACD;QACE,MAAM,EAAE,gDAAgD;QACxD,EAAE,EAAE,2EAA2E;QAC/E,EAAE,EAAE,oBAAoB,CAAC,MAAM;QAC/B,sEAAsE;QACtE,OAAO,EAAE,KAAC,kBAAkB,KAAG;QAC/B,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,wBAAwB,CAAC;SACnC;KACF;CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { SlotOperation, WidgetOperationTypes } from '@openedx/frontend-base';\nimport { SubscriptionCheckoutLogo, MobileCenterCheckoutLogo, MobileLeftPaidLogo } from './components/CheckoutLogos';\nimport { subscriptionCheckoutRole } from './constants';\n\nconst slots: SlotOperation[] = [\n {\n slotId: 'org.openedx.frontend.slot.header.desktopLeft.v1',\n id: 'org.openedx.frontend.widget.subscriptionCheckout.header.desktopLogo.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.desktopLogo.v1',\n element: <SubscriptionCheckoutLogo />,\n condition: {\n active: [subscriptionCheckoutRole],\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileCenter.v1',\n id: 'org.openedx.frontend.widget.subscriptionCheckout.header.mobileLogo.v1',\n op: WidgetOperationTypes.REPLACE,\n relatedId: 'org.openedx.frontend.widget.header.mobileLogo.v1',\n element: <MobileCenterCheckoutLogo />,\n condition: {\n active: [subscriptionCheckoutRole],\n },\n },\n {\n slotId: 'org.openedx.frontend.slot.header.mobileLeft.v1',\n id: 'org.openedx.frontend.widget.subscriptionCheckout.header.mobileLogoLeft.v1',\n op: WidgetOperationTypes.APPEND,\n // checkout-specific mobile-left widget: shows paid logo after payment\n element: <MobileLeftPaidLogo />,\n condition: {\n active: [subscriptionCheckoutRole],\n },\n },\n];\n\nexport default slots;\n"]}
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../src/slots.tsx"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAoB,EAAE,CAAC;AAElC,eAAe,KAAK,CAAC","sourcesContent":["import { SlotOperation } from '@openedx/frontend-base';\n\nconst slots: SlotOperation[] = [];\n\nexport default slots;\n"]}
@@ -11,6 +11,7 @@ export interface CommonTrackingProps {
11
11
  current_period_end?: string | null;
12
12
  user_email?: string | null;
13
13
  payment_method?: string | null;
14
+ opt_in?: boolean | null;
14
15
  }
15
16
  export declare const setCommonTrackingProps: (props: CommonTrackingProps) => void;
16
17
  export declare const getCommonTrackingProps: () => CommonTrackingProps;
@@ -6,7 +6,7 @@ export const setCommonTrackingProps = (props) => {
6
6
  export const getCommonTrackingProps = () => commonProps;
7
7
  // Single place that maps the subs/init API response -> tracking props
8
8
  export const mapSubsInitToTrackingProps = (data) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
10
10
  return ({
11
11
  free_trial_status: (_a = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _a === void 0 ? void 0 : _a.trialActive,
12
12
  subscription_status: (_b = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _b === void 0 ? void 0 : _b.status,
@@ -20,6 +20,7 @@ export const mapSubsInitToTrackingProps = (data) => {
20
20
  current_period_end: (_g = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _g === void 0 ? void 0 : _g.currentPeriodEnd,
21
21
  user_email: (_h = getAuthenticatedUser()) === null || _h === void 0 ? void 0 : _h.email,
22
22
  payment_method: (_j = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _j === void 0 ? void 0 : _j.paymentMethod,
23
+ opt_in: (_k = data === null || data === void 0 ? void 0 : data.opt_in) !== null && _k !== void 0 ? _k : null,
23
24
  // TODO: add marketing opt-in status field from the API response that should be tracked
24
25
  });
25
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAgB9D,IAAI,WAAW,GAAwB,EAAE,CAAC;AAE1C,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\n free_trial_status?: string,\n subscription_status?: string,\n subscription_tier?: string,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\n subscription_start_date?: string | null,\n subscription_end_date?: string | null,\n subscription_trial_end_date?: string | null,\n current_period_end?: string | null,\n user_email?: string | null,\n payment_method?: string | null,\n}\n\nlet commonProps: CommonTrackingProps = {};\n\nexport const setCommonTrackingProps = (props: CommonTrackingProps) => {\n commonProps = { ...commonProps, ...props };\n};\n\nexport const getCommonTrackingProps = (): CommonTrackingProps => commonProps;\n\n// Single place that maps the subs/init API response -> tracking props\nexport const mapSubsInitToTrackingProps = (data: any): CommonTrackingProps => ({\n free_trial_status: data?.userSubscription?.trialActive,\n subscription_status: data?.userSubscription?.status,\n subscription_tier: data?.userSubscription?.billingFrequency,\n session_id: '',\n experimentation: '',\n device_type: '',\n subscription_start_date: data?.userSubscription?.startDate,\n subscription_end_date: data?.userSubscription?.endDate,\n subscription_trial_end_date: data?.userSubscription?.trialEndDate,\n current_period_end: data?.userSubscription?.currentPeriodEnd,\n user_email: getAuthenticatedUser()?.email,\n payment_method: data?.userSubscription?.paymentMethod,\n // TODO: add marketing opt-in status field from the API response that should be tracked\n});\n"]}
1
+ {"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAiB9D,IAAI,WAAW,GAAwB,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAE,EAAE;IACnE,WAAW,mCAAQ,WAAW,GAAK,KAAK,CAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAwB,EAAE,CAAC,WAAW,CAAC;AAE7E,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAS,EAAuB,EAAE;;IAAC,OAAA,CAAC;QAC7E,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,WAAW;QACtD,mBAAmB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,MAAM;QACnD,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB;QAC3D,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;QACnB,WAAW,EAAE,EAAE;QACf,uBAAuB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,SAAS;QAC1D,qBAAqB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,OAAO;QACtD,2BAA2B,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,YAAY;QACjE,kBAAkB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB;QAC5D,UAAU,EAAE,MAAA,oBAAoB,EAAE,0CAAE,KAAK;QACzC,cAAc,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,aAAa;QACrD,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,IAAI;QAC5B,uFAAuF;KACxF,CAAC,CAAA;CAAA,CAAC","sourcesContent":["import { getAuthenticatedUser } from '@openedx/frontend-base';\nexport interface CommonTrackingProps {\n free_trial_status?: string,\n subscription_status?: string,\n subscription_tier?: string,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\n subscription_start_date?: string | null,\n subscription_end_date?: string | null,\n subscription_trial_end_date?: string | null,\n current_period_end?: string | null,\n user_email?: string | null,\n payment_method?: string | null,\n opt_in?: boolean | null,\n}\n\nlet commonProps: CommonTrackingProps = {};\n\nexport const setCommonTrackingProps = (props: CommonTrackingProps) => {\n commonProps = { ...commonProps, ...props };\n};\n\nexport const getCommonTrackingProps = (): CommonTrackingProps => commonProps;\n\n// Single place that maps the subs/init API response -> tracking props\nexport const mapSubsInitToTrackingProps = (data: any): CommonTrackingProps => ({\n free_trial_status: data?.userSubscription?.trialActive,\n subscription_status: data?.userSubscription?.status,\n subscription_tier: data?.userSubscription?.billingFrequency,\n session_id: '',\n experimentation: '',\n device_type: '',\n subscription_start_date: data?.userSubscription?.startDate,\n subscription_end_date: data?.userSubscription?.endDate,\n subscription_trial_end_date: data?.userSubscription?.trialEndDate,\n current_period_end: data?.userSubscription?.currentPeriodEnd,\n user_email: getAuthenticatedUser()?.email,\n payment_method: data?.userSubscription?.paymentMethod,\n opt_in: data?.opt_in ?? null,\n // TODO: add marketing opt-in status field from the API response that should be tracked\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-checkout",
3
- "version": "1.22.3",
3
+ "version": "1.23.0",
4
4
  "description": "Subscription Checkout Frontend application",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,20 +0,0 @@
1
- <svg width="147" height="48" viewBox="0 0 147 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_9277_3372)">
3
- <path d="M39.8927 12.306L41.0971 6.78906H5.79125L0 33.3033H29.5192L27.8949 40.4174H56.1682L62.4071 12.306H39.8927Z" fill="#5A5854"/>
4
- <path d="M12.0279 29.917C11.2296 29.917 10.4728 29.7931 9.76218 29.541C9.05154 29.2888 8.42858 28.9171 7.90252 28.4305C7.37185 27.9394 6.95654 27.3377 6.64737 26.621C6.33819 25.9043 6.18591 25.0814 6.18591 24.1523C6.18591 22.8825 6.37049 21.7234 6.73966 20.6793C7.10882 19.6352 7.62104 18.7415 8.28092 17.9938C8.9408 17.2461 9.72988 16.6709 10.6482 16.2595C11.5665 15.8525 12.5771 15.6445 13.6707 15.6445C14.409 15.6445 15.1104 15.7684 15.7703 16.0162C16.4348 16.2639 17.0116 16.6223 17.51 17.0957C18.0084 17.5691 18.4052 18.1486 18.6959 18.8432C18.9913 19.5334 19.1343 20.3253 19.1343 21.2235C19.1343 21.3606 19.1297 21.5199 19.1205 21.7013C19.1112 21.8871 19.0974 22.0729 19.0789 22.2631C19.0605 22.4534 19.042 22.6436 19.0282 22.825C19.0097 23.0064 18.9867 23.1657 18.9636 23.2896H8.59932C8.59009 23.409 8.58548 23.524 8.58086 23.6346C8.57625 23.7453 8.57625 23.8603 8.57625 23.9797C8.57625 24.6876 8.68238 25.2893 8.89465 25.7892C9.10692 26.2892 9.38379 26.6962 9.72988 27.0103C10.0714 27.3244 10.459 27.5545 10.8835 27.6961C11.3081 27.8376 11.7418 27.9084 12.1756 27.9084C13.1262 27.9084 13.8922 27.7492 14.469 27.435C15.0458 27.1209 15.4888 26.6918 15.7888 26.1564H18.2299C18.0776 26.6873 17.8284 27.1784 17.4823 27.6386C17.1362 28.0987 16.6978 28.4969 16.1672 28.8331C15.6365 29.1693 15.0228 29.4348 14.326 29.625C13.6338 29.8241 12.8632 29.917 12.0279 29.917ZM16.7117 21.5155C16.7209 21.4712 16.7255 21.396 16.7301 21.2765C16.7348 21.1615 16.7348 21.0465 16.7348 20.9359C16.7348 20.4846 16.6655 20.0555 16.5271 19.6484C16.3887 19.2458 16.181 18.8875 15.9041 18.5822C15.6273 18.2769 15.2858 18.0336 14.8751 17.8522C14.4644 17.6752 13.9891 17.5823 13.4492 17.5823C12.8955 17.5823 12.3832 17.6752 11.9033 17.8655C11.4234 18.0513 10.985 18.3212 10.5974 18.6663C10.2052 19.0114 9.86832 19.4228 9.58222 19.905C9.29612 20.3873 9.07 20.9226 8.90388 21.511L16.7117 21.5155Z" fill="white"/>
5
- <path d="M25.6883 29.9199C24.9685 29.9199 24.2901 29.7916 23.6579 29.5306C23.0257 29.2696 22.472 28.8979 21.9967 28.4113C21.5214 27.9246 21.143 27.3362 20.8708 26.646C20.5939 25.9558 20.4554 25.186 20.4554 24.3322C20.4554 23.5048 20.5431 22.7129 20.7139 21.9608C20.8892 21.2087 21.1338 20.5052 21.4522 19.8637C21.7706 19.2178 22.1582 18.6382 22.6058 18.1161C23.0534 17.5941 23.5518 17.1517 24.1009 16.7845C24.6501 16.4173 25.2407 16.1341 25.8775 15.9394C26.5143 15.7448 27.1788 15.643 27.871 15.643C28.3878 15.643 28.877 15.7094 29.3431 15.8465C29.8091 15.9837 30.2337 16.1739 30.612 16.4173C30.9904 16.6606 31.3135 16.9526 31.5857 17.2977C31.858 17.6428 32.0564 18.0188 32.181 18.4303H32.3933L34.1699 10.4092H36.5048L32.2364 29.6722H30.0214L30.4367 27.7919H30.2244C29.6984 28.4467 29.0431 28.9643 28.2494 29.3448C27.4557 29.7297 26.602 29.9199 25.6883 29.9199ZM26.422 27.9379C27.1696 27.9379 27.8618 27.7698 28.4986 27.4335C29.1354 27.0973 29.6891 26.6372 30.1598 26.0532C30.6305 25.4692 30.9997 24.7834 31.2673 23.9959C31.535 23.2084 31.6688 22.3545 31.6688 21.4431C31.6688 20.8547 31.5857 20.3282 31.415 19.8549C31.2442 19.3859 31.0043 18.9877 30.6951 18.6603C30.3813 18.3329 30.0075 18.0763 29.5599 17.8994C29.1169 17.718 28.614 17.6295 28.051 17.6295C27.3127 17.6295 26.6297 17.7888 25.9975 18.1029C25.3653 18.417 24.8208 18.855 24.3547 19.4213C23.8933 19.9832 23.5287 20.6556 23.2611 21.4343C22.9934 22.213 22.8596 23.0713 22.8596 24.0003C22.8596 24.5799 22.9473 25.1108 23.1226 25.5975C23.298 26.0841 23.538 26.5 23.8517 26.8451C24.1655 27.1902 24.5347 27.4601 24.9731 27.6503C25.4022 27.8405 25.8868 27.9379 26.422 27.9379Z" fill="white"/>
6
- <path d="M65.4155 15.8049C65.1617 15.8049 64.9218 15.7607 64.7003 15.6678C64.4788 15.5749 64.2804 15.451 64.1142 15.2873C63.9435 15.1236 63.8143 14.9378 63.7174 14.7254C63.6205 14.5131 63.5743 14.283 63.5743 14.0397C63.5743 13.7963 63.6205 13.5663 63.7174 13.3539C63.8143 13.1416 63.9435 12.9513 64.1142 12.792C64.285 12.6284 64.4788 12.5045 64.7003 12.4116C64.9218 12.3187 65.1617 12.2744 65.4155 12.2744C65.6693 12.2744 65.9093 12.3187 66.1308 12.4116C66.3523 12.5045 66.5507 12.6284 66.7168 12.792C66.8876 12.9557 67.0168 13.1416 67.1137 13.3539C67.2106 13.5663 67.2567 13.7963 67.2567 14.0397C67.2567 14.283 67.2106 14.5131 67.1137 14.7254C67.0168 14.9378 66.8876 15.128 66.7168 15.2873C66.5461 15.4466 66.3523 15.5749 66.1308 15.6678C65.9093 15.7607 65.6693 15.8049 65.4155 15.8049ZM65.4155 15.4775C65.6924 15.4775 65.9462 15.4112 66.1723 15.2829C66.3984 15.1546 66.5784 14.9776 66.7168 14.7608C66.8507 14.544 66.9199 14.3007 66.9199 14.0352C66.9199 13.7698 66.8507 13.5265 66.7168 13.3097C66.583 13.0929 66.3984 12.9203 66.1723 12.7876C65.9462 12.6593 65.6924 12.593 65.4155 12.593C65.1387 12.593 64.8849 12.6593 64.6588 12.7876C64.4326 12.9159 64.2527 13.0929 64.1142 13.3097C63.9804 13.5265 63.9112 13.7698 63.9112 14.0352C63.9112 14.3007 63.9804 14.544 64.1142 14.7608C64.2481 14.9776 64.4326 15.1501 64.6588 15.2829C64.8849 15.4112 65.1387 15.4775 65.4155 15.4775ZM64.788 14.8316V13.1991H65.6047C65.6924 13.1991 65.7755 13.2168 65.8539 13.2566C65.937 13.2964 66.0016 13.3539 66.0523 13.4291C66.1077 13.5043 66.1308 13.5973 66.1308 13.7079C66.1308 13.8185 66.1031 13.9158 66.0477 13.9954C65.9924 14.0751 65.9231 14.137 65.8401 14.1812C65.757 14.2255 65.6693 14.2432 65.5817 14.2432H64.9495V14.022H65.5032C65.5817 14.022 65.6509 13.9954 65.7155 13.9423C65.7755 13.8892 65.8078 13.8096 65.8078 13.7123C65.8078 13.6105 65.7755 13.5353 65.7155 13.4911C65.6555 13.4468 65.5863 13.4247 65.5124 13.4247H65.0833V14.8316H64.788ZM65.7801 14.0751L66.2046 14.8316H65.8724L65.4617 14.0751H65.7801Z" fill="#5A5854"/>
7
- <path d="M57.4501 15.9307H52.2403L46.5644 22.6732H46.2829L43.2788 15.9307H38.0137L42.5267 25.7259L32.7808 36.7952H37.9167L44.1741 29.6811H44.594L47.9764 36.7952H53.1447L48.1472 26.2125L57.4501 15.9307Z" fill="white"/>
8
- </g>
9
- <g opacity="0.7">
10
- <path d="M136.679 23.9541L131.484 24.0955C131.491 23.7106 131.405 23.3729 131.224 23.0823C131.044 22.7839 130.789 22.5522 130.459 22.3873C130.129 22.2223 129.736 22.1399 129.281 22.1399C128.542 22.1399 127.879 22.3048 127.29 22.6347C126.708 22.9645 126.383 23.3926 126.312 23.9188C126.257 24.2015 126.335 24.4489 126.547 24.6609C126.76 24.8651 127.231 25.0458 127.961 25.2029L131.354 25.8626C133.098 26.2081 134.362 26.8089 135.147 27.665C135.941 28.5132 136.223 29.6363 135.996 31.0343C135.791 32.2281 135.265 33.2608 134.417 34.1326C133.577 35.0044 132.505 35.6798 131.201 36.1589C129.905 36.6301 128.472 36.8657 126.901 36.8657C124.246 36.8657 122.244 36.3316 120.893 35.2635C119.55 34.1876 118.921 32.7621 119.008 30.9872L124.615 30.8458C124.639 31.5134 124.863 32.016 125.287 32.3537C125.719 32.6836 126.304 32.8564 127.042 32.8721C127.851 32.8878 128.55 32.7189 129.139 32.3655C129.728 32.0121 130.058 31.5762 130.129 31.0578C130.176 30.7201 130.062 30.457 129.787 30.2685C129.52 30.08 129.021 29.9112 128.291 29.762L125.228 29.1612C123.469 28.8234 122.196 28.1873 121.411 27.2527C120.634 26.3102 120.367 25.1086 120.61 23.6478C120.814 22.4854 121.293 21.4998 122.047 20.6909C122.809 19.8741 123.803 19.2536 125.028 18.8295C126.261 18.4054 127.667 18.1934 129.245 18.1934C131.774 18.1934 133.683 18.7078 134.971 19.7366C136.267 20.7576 136.836 22.1634 136.679 23.9541Z" fill="#5A5854"/>
11
- <path d="M112.007 28.7132L113.727 18.4287H119.476L116.46 36.5238H110.97L111.524 33.1545H111.335C110.778 34.2619 109.957 35.1415 108.873 35.7934C107.789 36.4374 106.568 36.7594 105.209 36.7594C103.976 36.7594 102.939 36.4767 102.099 35.9112C101.259 35.3457 100.662 34.5564 100.308 33.5433C99.9629 32.5223 99.9001 31.3285 100.12 29.962L102.052 18.4287H107.813L106.081 28.831C105.932 29.8128 106.061 30.5864 106.47 31.1518C106.886 31.7173 107.538 32 108.425 32C108.999 32 109.537 31.8744 110.039 31.623C110.542 31.3639 110.966 30.9908 111.312 30.5039C111.665 30.0091 111.897 29.4122 112.007 28.7132Z" fill="#5A5854"/>
12
- <path d="M100.375 12.397L96.3699 36.5238H90.6091L94.6146 12.397H100.375Z" fill="#5A5854"/>
13
- <path d="M70 36.5238L74.0054 12.397H83.9719C85.7783 12.397 87.2823 12.7465 88.4839 13.4455C89.6855 14.1444 90.5377 15.1222 91.0403 16.3788C91.543 17.6354 91.6568 19.0923 91.382 20.7495C91.1149 22.4223 90.5141 23.8792 89.5795 25.1201C88.6528 26.361 87.459 27.3231 85.9982 28.0063C84.5374 28.6896 82.8763 29.0313 81.015 29.0313H74.8772L75.643 24.4368H80.7087C81.5961 24.4368 82.3619 24.2837 83.0059 23.9774C83.6578 23.6711 84.18 23.243 84.5727 22.6933C84.9654 22.1435 85.2246 21.4956 85.3502 20.7495C85.4681 20.0034 85.4209 19.3593 85.2089 18.8174C84.9968 18.2677 84.6159 17.8436 84.0662 17.5451C83.5242 17.2467 82.8174 17.0975 81.9456 17.0975H79.0711L75.8314 36.5238H70Z" fill="#5A5854"/>
14
- </g>
15
- <defs>
16
- <clipPath id="clip0_9277_3372">
17
- <rect width="67.2568" height="33.6284" fill="white" transform="translate(0 6.78906)"/>
18
- </clipPath>
19
- </defs>
20
- </svg>
@@ -1,9 +0,0 @@
1
- export declare const CHECKOUT_PAYMENT_STATE_CHANGED = "org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1";
2
- export interface CheckoutPaymentState {
3
- isPaid: boolean;
4
- }
5
- export declare const SubscriptionCheckoutLogo: () => import("react/jsx-runtime").JSX.Element;
6
- export declare const MobileCenterCheckoutLogo: () => import("react/jsx-runtime").JSX.Element;
7
- export declare const MobileLeftPaidLogo: () => import("react/jsx-runtime").JSX.Element | null;
8
- declare const _default: null;
9
- export default _default;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useCallback, useState } from 'react';
3
- import { getUrlByRouteRole, homeRole, useSiteEvent } from '@openedx/frontend-base';
4
- import { Link } from 'react-router-dom';
5
- import { Image } from '@openedx/paragon';
6
- import logoTrademark from '@openedx/brand-openedx/logo-trademark.svg';
7
- import EdxDesktop from '../assets/Unlimited-desktop.svg';
8
- export const CHECKOUT_PAYMENT_STATE_CHANGED = 'org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1';
9
- export const SubscriptionCheckoutLogo = () => {
10
- const destinationUrl = getUrlByRouteRole(homeRole) || '/';
11
- const [isPaid, setIsPaid] = useState(false);
12
- const handlePaymentStateChanged = useCallback((_topic, data) => setIsPaid(!!(data === null || data === void 0 ? void 0 : data.isPaid)), []);
13
- useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);
14
- const paidLogoUrl = EdxDesktop;
15
- const showPaidLogo = isPaid;
16
- return (_jsx(Link, { to: destinationUrl, className: "p-0", children: showPaidLogo ? (_jsx(Image, { src: paidLogoUrl, alt: "edX Plus", style: { width: '147px', height: '48px' } })) : (_jsx(Image, { src: logoTrademark, alt: "edX", style: { width: '87.37px', height: '48px' } })) }));
17
- };
18
- export const MobileCenterCheckoutLogo = () => {
19
- const destinationUrl = getUrlByRouteRole(homeRole) || '/';
20
- const [isPaid, setIsPaid] = useState(false);
21
- const handlePaymentStateChanged = useCallback((_topic, data) => setIsPaid(!!(data === null || data === void 0 ? void 0 : data.isPaid)), []);
22
- useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);
23
- if (isPaid)
24
- return _jsx(_Fragment, {});
25
- return (_jsx(Link, { to: destinationUrl, className: "p-0", children: _jsx(Image, { src: logoTrademark, alt: "edX", style: { width: '87.37px', height: '48px' } }) }));
26
- };
27
- export const MobileLeftPaidLogo = () => {
28
- const destinationUrl = getUrlByRouteRole(homeRole) || '/';
29
- const [isPaid, setIsPaid] = useState(false);
30
- const handlePaymentStateChanged = useCallback((_topic, data) => setIsPaid(!!(data === null || data === void 0 ? void 0 : data.isPaid)), []);
31
- useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);
32
- if (!isPaid)
33
- return null;
34
- return (_jsx(Link, { to: destinationUrl, className: "p-0", children: _jsx(Image, { src: EdxDesktop, alt: "edX Plus", style: { width: '147px', height: 'auto' } }) }));
35
- };
36
- export default null;
37
- //# sourceMappingURL=CheckoutLogos.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckoutLogos.js","sourceRoot":"","sources":["../../src/components/CheckoutLogos.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,UAAU,MAAM,iCAAiC,CAAC;AAEzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,wEAAwE,CAAC;AAMvH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,GA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'@openedx/frontend-base';\nimport { Link } from 'react-router-dom';\nimport { Image } from '@openedx/paragon';\nimport logoTrademark from '@openedx/brand-openedx/logo-trademark.svg';\nimport EdxDesktop from '../assets/Unlimited-desktop.svg';\n\nexport const CHECKOUT_PAYMENT_STATE_CHANGED = 'org.openedx.frontend.event.subscriptionCheckout.paymentStateChanged.v1';\n\nexport interface CheckoutPaymentState {\n isPaid: boolean,\n}\n\nexport const SubscriptionCheckoutLogo = () => {\n const destinationUrl = getUrlByRouteRole(homeRole) || '/';\n const [isPaid, setIsPaid] = useState(false);\n\n const handlePaymentStateChanged = useCallback(\n (_topic: string, data?: CheckoutPaymentState) => setIsPaid(!!data?.isPaid),\n [],\n );\n useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);\n\n const paidLogoUrl = EdxDesktop;\n const showPaidLogo = isPaid;\n\n return (\n <Link to={destinationUrl} className=\"p-0\">\n {showPaidLogo ? (\n <Image src={paidLogoUrl} alt=\"edX Plus\" style={{ width: '147px', height: '48px' }} />\n ) : (\n <Image\n src={logoTrademark}\n alt=\"edX\"\n style={{ width: '87.37px', height: '48px' }}\n />\n )}\n </Link>\n );\n};\n\nexport const MobileCenterCheckoutLogo = () => {\n const destinationUrl = getUrlByRouteRole(homeRole) || '/';\n const [isPaid, setIsPaid] = useState(false);\n\n const handlePaymentStateChanged = useCallback(\n (_topic: string, data?: CheckoutPaymentState) => setIsPaid(!!data?.isPaid),\n [],\n );\n useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);\n\n if (isPaid) return <></>;\n\n return (\n <Link to={destinationUrl} className=\"p-0\">\n <Image\n src={logoTrademark}\n alt=\"edX\"\n style={{ width: '87.37px', height: '48px' }}\n />\n </Link>\n );\n};\n\nexport const MobileLeftPaidLogo = () => {\n const destinationUrl = getUrlByRouteRole(homeRole) || '/';\n const [isPaid, setIsPaid] = useState(false);\n\n const handlePaymentStateChanged = useCallback(\n (_topic: string, data?: CheckoutPaymentState) => setIsPaid(!!data?.isPaid),\n [],\n );\n useSiteEvent(CHECKOUT_PAYMENT_STATE_CHANGED, handlePaymentStateChanged);\n\n if (!isPaid) return null;\n\n return (\n <Link to={destinationUrl} className=\"p-0\">\n <Image src={EdxDesktop} alt=\"edX Plus\" style={{ width: '147px', height: 'auto' }} />\n </Link>\n );\n};\n\nexport default null;\n"]}