@stigg/react-sdk 4.3.1 → 4.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/checkout/Checkout.d.ts +5 -0
- package/dist/components/checkout/CheckoutContainer.d.ts +22 -0
- package/dist/components/checkout/CheckoutContainer.style.d.ts +26 -0
- package/dist/components/checkout/CheckoutProvider.d.ts +34 -0
- package/dist/components/checkout/components/Button.d.ts +8 -0
- package/dist/components/checkout/components/ContentLoadingSkeleton.d.ts +2 -0
- package/dist/components/checkout/components/InputField.d.ts +8 -0
- package/dist/components/checkout/components/Skeletons.style.d.ts +97 -0
- package/dist/components/checkout/components/index.d.ts +3 -0
- package/dist/components/checkout/formatting.d.ts +2 -0
- package/dist/components/checkout/hooks/index.d.ts +8 -0
- package/dist/components/checkout/hooks/useAddonsStepModel.d.ts +21 -0
- package/dist/components/checkout/hooks/useCheckoutModel.d.ts +10 -0
- package/dist/components/checkout/hooks/useCouponModel.d.ts +7 -0
- package/dist/components/checkout/hooks/useLoadCheckout.d.ts +11 -0
- package/dist/components/checkout/hooks/usePaymentStepModel.d.ts +16 -0
- package/dist/components/checkout/hooks/usePlanStepModel.d.ts +23 -0
- package/dist/components/checkout/hooks/usePreviewSubscription.d.ts +13 -0
- package/dist/components/checkout/hooks/useProgressBarModel.d.ts +26 -0
- package/dist/components/checkout/hooks/useSubscriptionModel.d.ts +5 -0
- package/dist/components/checkout/hooks/useSubscriptionState.d.ts +2 -0
- package/dist/components/checkout/index.d.ts +3 -0
- package/dist/components/checkout/planHeader/PlanHeader.d.ts +7 -0
- package/dist/components/checkout/planHeader/PlanHeader.style.d.ts +25 -0
- package/dist/components/checkout/planHeader/index.d.ts +1 -0
- package/dist/components/checkout/progressBar/CheckoutProgressBar.d.ts +2 -0
- package/dist/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +48 -0
- package/dist/components/checkout/promotionCode/AddPromotionCode.d.ts +5 -0
- package/dist/components/checkout/promotionCode/AddPromotionCodeButton.d.ts +7 -0
- package/dist/components/checkout/promotionCode/AppliedPromotionCode.d.ts +6 -0
- package/dist/components/checkout/promotionCode/PromotionCodeSection.d.ts +5 -0
- package/dist/components/checkout/promotionCode/index.d.ts +1 -0
- package/dist/components/checkout/steps/addons/CheckoutAddonsStep.d.ts +2 -0
- package/dist/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +93 -0
- package/dist/components/checkout/steps/addons/addon.utils.d.ts +15 -0
- package/dist/components/checkout/steps/addons/index.d.ts +1 -0
- package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +20 -0
- package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +117 -0
- package/dist/components/checkout/steps/payment/PaymentStep.d.ts +2 -0
- package/dist/components/checkout/steps/payment/index.d.ts +1 -0
- package/dist/components/checkout/steps/payment/stripe/StripePaymentForm.d.ts +2 -0
- package/dist/components/checkout/steps/payment/stripe/index.d.ts +3 -0
- package/dist/components/checkout/steps/payment/stripe/stripe.utils.d.ts +33 -0
- package/dist/components/checkout/steps/payment/stripe/useStripeIntegration.d.ts +5 -0
- package/dist/components/checkout/steps/payment/stripe/useSubmit.d.ts +13 -0
- package/dist/components/checkout/steps/plan/BillingPeriodPicker.d.ts +9 -0
- package/dist/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +52 -0
- package/dist/components/checkout/steps/plan/CheckoutChargeList.d.ts +16 -0
- package/dist/components/checkout/steps/plan/CheckoutPlanStep.d.ts +2 -0
- package/dist/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +12 -0
- package/dist/components/checkout/steps/plan/index.d.ts +1 -0
- package/dist/components/checkout/steps/surprise/SurpriseStep.d.ts +2 -0
- package/dist/components/checkout/summary/CheckoutSuccess.d.ts +3 -0
- package/dist/components/checkout/summary/CheckoutSummary.d.ts +16 -0
- package/dist/components/checkout/summary/CheckoutSummarySkeleton.d.ts +2 -0
- package/dist/components/checkout/summary/components/CheckoutCaptions.d.ts +11 -0
- package/dist/components/checkout/summary/components/LineItems.d.ts +36 -0
- package/dist/components/checkout/summary/components/WithSkeleton.d.ts +6 -0
- package/dist/components/checkout/summary/index.d.ts +2 -0
- package/dist/components/checkout/textOverrides.d.ts +32 -0
- package/dist/components/checkout/theme.d.ts +12 -0
- package/dist/components/common/Icon.d.ts +3 -2
- package/dist/components/common/PoweredByStigg.d.ts +1 -1
- package/dist/components/{paywall/TiersLayout.d.ts → common/TiersSelectContainer.d.ts} +2 -3
- package/dist/components/common/customIcons.d.ts +19 -5
- package/dist/components/common/mapExternalTheme.d.ts +2 -1
- package/dist/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.style.d.ts +1 -1
- package/dist/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.d.ts +1 -1
- package/dist/components/hooks/useChargeSort.d.ts +3 -0
- package/dist/components/paywall/paywallTextOverrides.d.ts +0 -4
- package/dist/components/utils/calculateDiscountRate.d.ts +1 -0
- package/dist/components/utils/currencyUtils.d.ts +1 -1
- package/dist/components/utils/getPaidPriceText.d.ts +1 -3
- package/dist/components/{paywall/planPriceTier.d.ts → utils/priceTierUtils.d.ts} +3 -1
- package/dist/components/utils/priceUtils.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/react-sdk.cjs.development.js +6935 -238
- package/dist/react-sdk.cjs.development.js.map +1 -1
- package/dist/react-sdk.cjs.production.min.js +1 -1
- package/dist/react-sdk.cjs.production.min.js.map +1 -1
- package/dist/react-sdk.esm.js +7094 -242
- package/dist/react-sdk.esm.js.map +1 -1
- package/dist/stories/Checkout.stories.d.ts +3 -0
- package/dist/stories/CustomerPortal.stories.d.ts +1 -1
- package/dist/theme/getResolvedTheme.d.ts +4 -0
- package/dist/theme/types.d.ts +4 -0
- package/package.json +11 -5
- package/src/assets/arrow-forward.svg +3 -0
- package/src/assets/arrow-right.svg +6 -0
- package/src/assets/check.svg +5 -0
- package/src/assets/close.svg +3 -0
- package/src/assets/lottie/checkout-success.json +1 -0
- package/src/assets/nyancat.svg +634 -0
- package/src/assets/outlined-checked-circle-disabled.svg +6 -0
- package/src/assets/outlined-checked-circle.svg +6 -0
- package/src/assets/outlined-circle.svg +3 -0
- package/src/assets/payment-method.svg +11 -0
- package/src/assets/plus-icon.svg +6 -0
- package/src/assets/trash.svg +8 -0
- package/src/components/checkout/Checkout.tsx +30 -0
- package/src/components/checkout/CheckoutContainer.style.ts +35 -0
- package/src/components/checkout/CheckoutContainer.tsx +99 -0
- package/src/components/checkout/CheckoutProvider.tsx +149 -0
- package/src/components/checkout/components/Button.tsx +51 -0
- package/src/components/checkout/components/ContentLoadingSkeleton.tsx +41 -0
- package/src/components/checkout/components/InputField.tsx +22 -0
- package/src/components/checkout/components/Skeletons.style.ts +27 -0
- package/src/components/checkout/components/index.ts +3 -0
- package/src/components/checkout/formatting.ts +12 -0
- package/src/components/checkout/hooks/index.ts +8 -0
- package/src/components/checkout/hooks/useAddonsStepModel.ts +96 -0
- package/src/components/checkout/hooks/useCheckoutModel.ts +32 -0
- package/src/components/checkout/hooks/useCouponModel.ts +28 -0
- package/src/components/checkout/hooks/useLoadCheckout.ts +39 -0
- package/src/components/checkout/hooks/usePaymentStepModel.ts +49 -0
- package/src/components/checkout/hooks/usePlanStepModel.ts +169 -0
- package/src/components/checkout/hooks/usePreviewSubscription.ts +82 -0
- package/src/components/checkout/hooks/useProgressBarModel.ts +89 -0
- package/src/components/checkout/hooks/useSubscriptionModel.ts +16 -0
- package/src/components/checkout/hooks/useSubscriptionState.ts +26 -0
- package/src/components/checkout/index.ts +3 -0
- package/src/components/checkout/planHeader/PlanHeader.style.tsx +23 -0
- package/src/components/checkout/planHeader/PlanHeader.tsx +59 -0
- package/src/components/checkout/planHeader/index.ts +1 -0
- package/src/components/checkout/progressBar/CheckoutProgressBar.style.ts +34 -0
- package/src/components/checkout/progressBar/CheckoutProgressBar.tsx +53 -0
- package/src/components/checkout/promotionCode/AddPromotionCode.tsx +85 -0
- package/src/components/checkout/promotionCode/AddPromotionCodeButton.tsx +39 -0
- package/src/components/checkout/promotionCode/AppliedPromotionCode.tsx +37 -0
- package/src/components/checkout/promotionCode/PromotionCodeSection.tsx +27 -0
- package/src/components/checkout/promotionCode/index.ts +1 -0
- package/src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx +24 -0
- package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +125 -0
- package/src/components/checkout/steps/addons/addon.utils.ts +68 -0
- package/src/components/checkout/steps/addons/index.ts +1 -0
- package/src/components/checkout/steps/payment/PaymentMethods.style.ts +26 -0
- package/src/components/checkout/steps/payment/PaymentMethods.tsx +86 -0
- package/src/components/checkout/steps/payment/PaymentStep.tsx +50 -0
- package/src/components/checkout/steps/payment/index.ts +1 -0
- package/src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx +45 -0
- package/src/components/checkout/steps/payment/stripe/index.ts +3 -0
- package/src/components/checkout/steps/payment/stripe/stripe.utils.ts +109 -0
- package/src/components/checkout/steps/payment/stripe/useStripeIntegration.ts +27 -0
- package/src/components/checkout/steps/payment/stripe/useSubmit.ts +104 -0
- package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +46 -0
- package/src/components/checkout/steps/plan/BillingPeriodPicker.tsx +63 -0
- package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +138 -0
- package/src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx +6 -0
- package/src/components/checkout/steps/plan/CheckoutPlanStep.tsx +20 -0
- package/src/components/checkout/steps/plan/index.ts +1 -0
- package/src/components/checkout/steps/surprise/SurpriseStep.tsx +27 -0
- package/src/components/checkout/summary/CheckoutSuccess.tsx +30 -0
- package/src/components/checkout/summary/CheckoutSummary.tsx +288 -0
- package/src/components/checkout/summary/CheckoutSummarySkeleton.tsx +40 -0
- package/src/components/checkout/summary/components/CheckoutCaptions.tsx +120 -0
- package/src/components/checkout/summary/components/LineItems.tsx +177 -0
- package/src/components/checkout/summary/components/WithSkeleton.tsx +16 -0
- package/src/components/checkout/summary/index.ts +2 -0
- package/src/components/checkout/textOverrides.ts +62 -0
- package/src/components/checkout/theme.ts +43 -0
- package/src/components/common/Icon.tsx +17 -22
- package/src/components/common/PoweredByStigg.tsx +1 -1
- package/src/components/{paywall/TiersLayout.tsx → common/TiersSelectContainer.tsx} +8 -7
- package/src/components/common/Typography.tsx +11 -1
- package/src/components/common/customIcons.ts +19 -28
- package/src/components/common/mapExternalTheme.ts +29 -9
- package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +6 -12
- package/src/components/hooks/useChargeSort.ts +17 -0
- package/src/components/paywall/Paywall.tsx +1 -1
- package/src/components/paywall/PlanOffering.tsx +1 -1
- package/src/components/paywall/PlanOfferingButton.tsx +1 -1
- package/src/components/paywall/PlanPrice.tsx +5 -13
- package/src/components/paywall/paywallTextOverrides.ts +0 -3
- package/src/components/paywall/utils/calculateUnitQuantityText.ts +9 -4
- package/src/components/utils/calculateDiscountRate.ts +1 -1
- package/src/components/utils/currencyUtils.ts +1 -1
- package/src/components/utils/getPaidPriceText.ts +4 -10
- package/src/components/utils/getPlanPrice.ts +1 -1
- package/src/components/{paywall/planPriceTier.ts → utils/priceTierUtils.ts} +25 -3
- package/src/components/utils/priceUtils.ts +10 -0
- package/src/index.ts +1 -0
- package/src/stories/Checkout.stories.tsx +62 -0
- package/src/stories/CustomerPortal.stories.tsx +1 -1
- package/src/theme/Theme.tsx +6 -6
- package/src/theme/getResolvedTheme.ts +7 -1
- package/src/theme/types.ts +4 -0
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
} from '@stigg/js-client-sdk';
|
|
8
8
|
import { currencyPriceFormatter } from './currencyUtils';
|
|
9
9
|
import { PlanPriceText } from './getPlanPrice';
|
|
10
|
-
import { calculateTierPrice } from '
|
|
11
|
-
import { PaywallLocalization } from '../paywall';
|
|
10
|
+
import { calculateTierPrice, getPriceFeatureUnit } from './priceTierUtils';
|
|
12
11
|
|
|
13
12
|
type GetPaidPriceTextParams = {
|
|
14
13
|
planPrices: Price[];
|
|
@@ -17,7 +16,6 @@ type GetPaidPriceTextParams = {
|
|
|
17
16
|
locale: string;
|
|
18
17
|
shouldShowMonthlyPriceAmount: boolean;
|
|
19
18
|
selectedTierByFeature: Record<string, PriceTierFragment>;
|
|
20
|
-
paywallLocale: PaywallLocalization;
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
export function getPaidPriceText({
|
|
@@ -27,7 +25,6 @@ export function getPaidPriceText({
|
|
|
27
25
|
locale,
|
|
28
26
|
shouldShowMonthlyPriceAmount,
|
|
29
27
|
selectedTierByFeature,
|
|
30
|
-
paywallLocale,
|
|
31
28
|
}: GetPaidPriceTextParams): PlanPriceText {
|
|
32
29
|
const { amount, currency } = paywallCalculatedPrice || planPrices[0];
|
|
33
30
|
const priceAmount = amount || 0;
|
|
@@ -38,10 +35,7 @@ export function getPaidPriceText({
|
|
|
38
35
|
|
|
39
36
|
let tiers;
|
|
40
37
|
let tierUnits;
|
|
41
|
-
|
|
42
|
-
shouldShowMonthlyPriceAmount ? BillingPeriod.Monthly : BillingPeriod.Annually,
|
|
43
|
-
);
|
|
44
|
-
let unit = pricePeriod;
|
|
38
|
+
let unit = shouldShowMonthlyPriceAmount ? '/ month' : '/ year';
|
|
45
39
|
|
|
46
40
|
for (const price of planPrices) {
|
|
47
41
|
if (price.isTieredPrice) {
|
|
@@ -50,7 +44,7 @@ export function getPaidPriceText({
|
|
|
50
44
|
currentTier = selectedTierByFeature[price.feature!.featureId] || currentTier;
|
|
51
45
|
|
|
52
46
|
tiers = price.tiers;
|
|
53
|
-
tierUnits = price
|
|
47
|
+
tierUnits = getPriceFeatureUnit(price);
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
priceNumber += calculateTierPrice(price, currentTier, selectedBillingPeriod, shouldShowMonthlyPriceAmount);
|
|
@@ -62,7 +56,7 @@ export function getPaidPriceText({
|
|
|
62
56
|
const featureUnit = price.feature?.units || '';
|
|
63
57
|
|
|
64
58
|
if (price.pricingModel === BillingModel.PerUnit && !price.isTieredPrice) {
|
|
65
|
-
unit = shouldShowMonthlyPriceAmount ? `per ${featureUnit}
|
|
59
|
+
unit = shouldShowMonthlyPriceAmount ? `per ${featureUnit} / month` : `per ${featureUnit} / year`;
|
|
66
60
|
} else if (price.pricingModel === BillingModel.UsageBased) {
|
|
67
61
|
unit = `per ${featureUnit}`;
|
|
68
62
|
}
|
|
@@ -50,7 +50,7 @@ export function getPlanPrice(
|
|
|
50
50
|
|
|
51
51
|
return paywallLocale.price.paid
|
|
52
52
|
? paywallLocale.price.paid({ ...paidParams, plan })
|
|
53
|
-
: getPaidPriceText({ ...paidParams, locale, shouldShowMonthlyPriceAmount
|
|
53
|
+
: getPaidPriceText({ ...paidParams, locale, shouldShowMonthlyPriceAmount });
|
|
54
54
|
}
|
|
55
55
|
default:
|
|
56
56
|
return {
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
import { PaywallPlan } from '
|
|
1
|
+
import { PaywallPlan } from '../paywall/types';
|
|
2
2
|
|
|
3
3
|
import { BillingModel, TiersMode, BillingPeriod, Price, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';
|
|
4
4
|
|
|
5
|
+
export function getPriceFeatureUnit(price: Price) {
|
|
6
|
+
if (!price.feature) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return (price.feature!.unitQuantity != 1 ? price.feature!.unitsPlural : price.feature!.units) || '';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getTierByQuantity(tiers: PriceTierFragment[], quantity: number) {
|
|
14
|
+
if (!tiers) return;
|
|
15
|
+
|
|
16
|
+
const ascendingTiers = [...tiers];
|
|
17
|
+
ascendingTiers.sort((a, b) => a.upTo - b.upTo);
|
|
18
|
+
|
|
19
|
+
for (const tier of ascendingTiers) {
|
|
20
|
+
if (quantity <= tier.upTo) {
|
|
21
|
+
return tier;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return ascendingTiers[ascendingTiers.length - 1];
|
|
26
|
+
}
|
|
27
|
+
|
|
5
28
|
export function calculateTierPrice(
|
|
6
29
|
price: Price,
|
|
7
30
|
currentTier: PriceTierFragment,
|
|
@@ -46,8 +69,7 @@ export function getSelectedTier(
|
|
|
46
69
|
);
|
|
47
70
|
|
|
48
71
|
if (tieredPrice) {
|
|
49
|
-
|
|
50
|
-
currentTier = customerTier || price.tiers![0];
|
|
72
|
+
currentTier = getTierByQuantity(price.tiers!, tieredPrice.feature!.unitQuantity || 1)!;
|
|
51
73
|
}
|
|
52
74
|
}
|
|
53
75
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Price } from '@stigg/js-client-sdk';
|
|
2
|
+
|
|
3
|
+
export const getValidPriceQuantity = (price: Price, quantity: number) => {
|
|
4
|
+
if (price.minUnitQuantity && quantity < price.minUnitQuantity) {
|
|
5
|
+
return price.minUnitQuantity;
|
|
6
|
+
} else if (price.maxUnitQuantity && quantity > price.maxUnitQuantity) {
|
|
7
|
+
return price.maxUnitQuantity;
|
|
8
|
+
}
|
|
9
|
+
return quantity;
|
|
10
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export {
|
|
|
29
29
|
StiggContextValue,
|
|
30
30
|
StiggContext,
|
|
31
31
|
} from './components/StiggProvider';
|
|
32
|
+
export { Checkout, CheckoutProps, CheckoutTheme } from './components/checkout';
|
|
32
33
|
export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
|
|
33
34
|
export { HorizontalAlignment, TextAlignment } from './theme/types';
|
|
34
35
|
export { CustomizedTheme as Theme } from './theme/Theme';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from '@emotion/styled/macro';
|
|
3
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
4
|
+
import { Checkout } from '../components/checkout';
|
|
5
|
+
import { StiggProvider } from '../components/StiggProvider';
|
|
6
|
+
import { defaultArgsWithCustomer } from './baseArgs';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Stigg React SDK/Checkout',
|
|
10
|
+
component: Checkout,
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story, { args }) => (
|
|
13
|
+
<StiggProvider
|
|
14
|
+
apiKey={args.apiKey}
|
|
15
|
+
customerId={args.customerId}
|
|
16
|
+
theme={args.theme}
|
|
17
|
+
locale={args.locale}
|
|
18
|
+
baseUri={args.baseUri}
|
|
19
|
+
enableEdge={args.disableEdge}>
|
|
20
|
+
<Story />
|
|
21
|
+
</StiggProvider>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
} as ComponentMeta<typeof Checkout>;
|
|
25
|
+
|
|
26
|
+
const Wrapper = styled.div`
|
|
27
|
+
width: 1000px;
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const Template: ComponentStory<any> = (args) => (
|
|
31
|
+
<Wrapper>
|
|
32
|
+
<Checkout
|
|
33
|
+
planId={args.planId}
|
|
34
|
+
preferredBillingPeriod={args.preferredBillingPeriod}
|
|
35
|
+
billingCountryCode={args.billingCountryCode}
|
|
36
|
+
resourceId={args.resourceId}
|
|
37
|
+
onCheckoutCompleted={(results) => {
|
|
38
|
+
console.log('checkout finished!', results);
|
|
39
|
+
return Promise.resolve();
|
|
40
|
+
}}
|
|
41
|
+
onCheckout={async ({ checkoutParams, checkoutAction }) => {
|
|
42
|
+
console.log('checkout started!', checkoutParams);
|
|
43
|
+
const { success, errorMessage } = await checkoutAction();
|
|
44
|
+
return { success, errorMessage };
|
|
45
|
+
}}
|
|
46
|
+
onChangePlan={({ currentPlan }) => {
|
|
47
|
+
console.log('plan changed clicked!', { currentPlan });
|
|
48
|
+
}}
|
|
49
|
+
billingInformation={{ taxPercentage: 27 }}
|
|
50
|
+
/>
|
|
51
|
+
</Wrapper>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const DefaultCheckout = Template.bind({});
|
|
55
|
+
DefaultCheckout.args = {
|
|
56
|
+
...defaultArgsWithCustomer,
|
|
57
|
+
planId: 'plan-revvenu-essentials',
|
|
58
|
+
baseUri: 'http://localhost:4000',
|
|
59
|
+
apiKey: 'client-72b058a6-0f22-4c86-adce-bf266d12e12e:9f356ceb-c94c-42a4-9572-10b12824da81',
|
|
60
|
+
// baseUri: 'https://api-staging.stigg.io',
|
|
61
|
+
// apiKey: 'client-79584f52-7ef9-4c58-b9ac-5080acf492e4:71f2274c-100a-4fa4-8a43-48fa3b16c627',
|
|
62
|
+
};
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { merge } from 'lodash';
|
|
1
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
|
+
import { ThemeProvider as StyledThemeProvider } from 'styled-components';
|
|
2
4
|
import { TypographyProps } from 'styled-typography';
|
|
3
5
|
import { css, ThemeProvider } from '@emotion/react';
|
|
4
6
|
import styled from '@emotion/styled/macro';
|
|
5
|
-
import { ThemeProvider as MuiThemeProvider
|
|
6
|
-
import { ThemeProvider as StyledThemeProvider } from 'styled-components';
|
|
7
|
-
import { merge } from 'lodash';
|
|
8
|
-
import { Fonts } from './Fonts';
|
|
9
|
-
import { DeepPartial } from '../types';
|
|
10
|
-
import { StiggTheme } from './types';
|
|
7
|
+
import { createTheme, ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
|
|
11
8
|
import { useStiggContext } from '../components/StiggProvider';
|
|
9
|
+
import { DeepPartial } from '../types';
|
|
10
|
+
import { Fonts } from './Fonts';
|
|
12
11
|
import { getResolvedTheme } from './getResolvedTheme';
|
|
12
|
+
import { StiggTheme } from './types';
|
|
13
13
|
|
|
14
14
|
export type CustomizedTheme = DeepPartial<StiggTheme>;
|
|
15
15
|
|
|
@@ -14,10 +14,13 @@ export const flexLayoutMapper = (horizontalAlignment: HorizontalAlignment) => {
|
|
|
14
14
|
export const getResolvedTheme = (customizedTheme?: CustomizedTheme): StiggTheme => {
|
|
15
15
|
const primaryColor = Color(customizedTheme?.palette?.primary || '#327EEE');
|
|
16
16
|
const textColor = Color(customizedTheme?.palette?.text?.primary || '#001E6C');
|
|
17
|
+
const successColor = Color('#4CAF50');
|
|
18
|
+
const errorColor = Color('#f44336');
|
|
17
19
|
|
|
18
20
|
const baseTheme: StiggTheme = {
|
|
19
21
|
palette: {
|
|
20
22
|
primary: primaryColor.hex(),
|
|
23
|
+
primaryDark: primaryColor.darken(0.3).hex(),
|
|
21
24
|
backgroundPaper: '#FFFFFF',
|
|
22
25
|
backgroundHighlight: '#F5F6F9',
|
|
23
26
|
backgroundSection: primaryColor.alpha(0.1).toString(),
|
|
@@ -29,7 +32,10 @@ export const getResolvedTheme = (customizedTheme?: CustomizedTheme): StiggTheme
|
|
|
29
32
|
switchFill: primaryColor.lighten(0.5).hex(),
|
|
30
33
|
switchHandle: primaryColor.hex(),
|
|
31
34
|
warning: '#ed6c02',
|
|
32
|
-
error:
|
|
35
|
+
error: errorColor.hex(),
|
|
36
|
+
errorDark: errorColor.darken(0.3).hex(),
|
|
37
|
+
success: successColor.hex(),
|
|
38
|
+
successDark: successColor.darken(0.3).hex(),
|
|
33
39
|
white: '#FFFFFF',
|
|
34
40
|
text: {
|
|
35
41
|
primary: textColor.hex(),
|
package/src/theme/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type FontVariant = {
|
|
|
8
8
|
export type StiggTheme = {
|
|
9
9
|
palette: {
|
|
10
10
|
primary: string;
|
|
11
|
+
primaryDark: string;
|
|
11
12
|
backgroundPaper: string;
|
|
12
13
|
backgroundHighlight: string;
|
|
13
14
|
backgroundSection: string;
|
|
@@ -20,7 +21,10 @@ export type StiggTheme = {
|
|
|
20
21
|
switchHandle: string;
|
|
21
22
|
warning: string;
|
|
22
23
|
error: string;
|
|
24
|
+
errorDark: string;
|
|
23
25
|
white: string;
|
|
26
|
+
success: string;
|
|
27
|
+
successDark: string;
|
|
24
28
|
text: {
|
|
25
29
|
primary: string;
|
|
26
30
|
secondary: string;
|