@blocklet/payment-react 1.18.39 → 1.18.41

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.
@@ -633,7 +633,7 @@ function CheckoutDonateInner({
633
633
  ))
634
634
  }
635
635
  ),
636
- customers?.length > 0 && t("payment.checkout.donation.gaveTips", { count: customers?.length })
636
+ customers?.length > 0 && /* @__PURE__ */ jsx(Typography, { variant: "body2", children: t("payment.checkout.donation.gaveTips", { count: customers?.length }) })
637
637
  ] }),
638
638
  showCloseButton: false,
639
639
  disableEscapeKeyDown: true,
@@ -9,7 +9,6 @@ export default function Status(props) {
9
9
  ...props,
10
10
  sx: {
11
11
  ...props.sx || {},
12
- borderRadius: "4px",
13
12
  height: 20,
14
13
  textTransform: "capitalize"
15
14
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Tooltip } from "@mui/material";
2
+ import { Tooltip, Typography } from "@mui/material";
3
3
  import { tooltipClasses } from "@mui/material/Tooltip";
4
4
  import { styled } from "@mui/system";
5
5
  import { truncateText } from "../libs/util.js";
@@ -17,9 +17,9 @@ export default function TruncatedText({ text = "", maxLength = 100, useWidth = f
17
17
  }
18
18
  const truncatedText = truncateText(text, maxLength, useWidth);
19
19
  if (!truncatedText.endsWith("...")) {
20
- return /* @__PURE__ */ jsx("span", { children: truncatedText });
20
+ return /* @__PURE__ */ jsx(Typography, { children: truncatedText });
21
21
  }
22
- return /* @__PURE__ */ jsx(CustomTooltip, { title: text, placement: "bottom", enterTouchDelay: 0, children: /* @__PURE__ */ jsx("span", { title: text, children: truncatedText }) });
22
+ return /* @__PURE__ */ jsx(CustomTooltip, { title: text, placement: "bottom", enterTouchDelay: 0, children: /* @__PURE__ */ jsx(Typography, { children: truncatedText }) });
23
23
  }
24
24
  TruncatedText.defaultProps = {
25
25
  useWidth: false,
package/es/libs/util.d.ts CHANGED
@@ -76,7 +76,15 @@ export declare function isValidCountry(code: string): boolean;
76
76
  export declare function stopEvent(e: React.SyntheticEvent<any>): void;
77
77
  export declare function sleep(ms: number): Promise<unknown>;
78
78
  export declare function formatSubscriptionProduct(items: TSubscriptionItemExpanded[], maxLength?: number): string;
79
- export declare const getSubscriptionTimeSummary: (subscription: TSubscriptionExpanded) => string;
79
+ export declare const getLineTimeInfo: (time: number, locale?: string) => {
80
+ time: any;
81
+ isToday: any;
82
+ };
83
+ export declare const getSubscriptionTimeSummary: (subscription: TSubscriptionExpanded, locale?: string) => {
84
+ action: string;
85
+ time: any;
86
+ isToday: any;
87
+ } | null;
80
88
  export declare const getSubscriptionAction: (subscription: TSubscriptionExpanded, actionProps: ActionProps) => {
81
89
  action: string;
82
90
  variant: string;
package/es/libs/util.js CHANGED
@@ -639,27 +639,39 @@ export function formatSubscriptionProduct(items, maxLength = 2) {
639
639
  const names = items.map((x) => x.price?.product?.name).filter(Boolean);
640
640
  return names.slice(0, maxLength).join(", ") + (names.length > maxLength ? ` and ${names.length - maxLength} more` : "");
641
641
  }
642
- export const getSubscriptionTimeSummary = (subscription) => {
643
- const lines = [`Start on ${formatToDate(subscription.start_date * 1e3, "en", "YYYY-MM-DD")}`];
644
- const getLineTimeMessage = (time) => {
645
- const curDay = dayjs().isSame(dayjs(time), "day");
646
- const timeFormat = curDay ? "HH:mm:ss" : "YYYY-MM-DD";
647
- return `${curDay ? "in" : "on"} ${formatToDate(time, "en", timeFormat)}`;
642
+ export const getLineTimeInfo = (time, locale = "en") => {
643
+ const isToday = dayjs().isSame(dayjs(time), "day");
644
+ const timeFormat = isToday ? "HH:mm:ss" : "YYYY-MM-DD";
645
+ return {
646
+ time: formatToDate(time, locale, timeFormat),
647
+ isToday
648
648
  };
649
+ };
650
+ export const getSubscriptionTimeSummary = (subscription, locale = "en") => {
649
651
  if (subscription.status === "active" || subscription.status === "trialing") {
650
652
  if (subscription.cancel_at) {
651
- lines.push(`Ended ${getLineTimeMessage(subscription.cancel_at * 1e3)}`);
652
- } else if (subscription.cancel_at_period_end) {
653
- lines.push(`Ended ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
654
- } else {
655
- lines.push(`Renew ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
656
- }
657
- } else if (subscription.status === "past_due") {
658
- lines.push(`Ended ${getLineTimeMessage((subscription.cancel_at || subscription.current_period_end) * 1e3)}`);
659
- } else if (subscription.status === "canceled") {
660
- lines.push(`Ended ${getLineTimeMessage(subscription.canceled_at * 1e3)}`);
661
- }
662
- return lines.join(",");
653
+ const endTime = subscription.cancel_at * 1e3;
654
+ const { time: time2, isToday: isToday2 } = getLineTimeInfo(endTime, locale);
655
+ return { action: "willEnd", time: time2, isToday: isToday2 };
656
+ }
657
+ if (subscription.cancel_at_period_end) {
658
+ const endTime = subscription.current_period_end * 1e3;
659
+ const { time: time2, isToday: isToday2 } = getLineTimeInfo(endTime, locale);
660
+ return { action: "willEnd", time: time2, isToday: isToday2 };
661
+ }
662
+ const { time, isToday } = getLineTimeInfo(subscription.current_period_end * 1e3, locale);
663
+ return { action: "renew", time, isToday };
664
+ }
665
+ if (subscription.status === "past_due") {
666
+ const endTime = (subscription.cancel_at || subscription.current_period_end) * 1e3;
667
+ const { time, isToday } = getLineTimeInfo(endTime, locale);
668
+ return { action: "ended", time, isToday };
669
+ }
670
+ if (subscription.status === "canceled") {
671
+ const { time, isToday } = getLineTimeInfo(subscription.canceled_at * 1e3, locale);
672
+ return { action: "ended", time, isToday };
673
+ }
674
+ return null;
663
675
  };
664
676
  export const getSubscriptionAction = (subscription, actionProps) => {
665
677
  if (subscription.status === "active" || subscription.status === "trialing") {
package/es/locales/en.js CHANGED
@@ -321,17 +321,17 @@ export default flat({
321
321
  empty: "There are no invoices",
322
322
  next: "No invoices yet, next invoice will be generated on {date}",
323
323
  invoiceNumber: "Invoice Number",
324
- emptyList: "No Invoice",
324
+ emptyList: "No Invoices",
325
325
  noPaymentRequired: "No Payment Required",
326
326
  payBatch: "Pay Due Invoices"
327
327
  },
328
328
  payment: {
329
329
  empty: "There are no payments",
330
- emptyList: "No Payment"
330
+ emptyList: "No Payments"
331
331
  },
332
332
  refund: {
333
333
  empty: "There are no refunds",
334
- emptyList: "No Refund"
334
+ emptyList: "No Refunds"
335
335
  },
336
336
  subscriptions: {
337
337
  plan: "Plan",
@@ -326,7 +326,7 @@ function PaymentInner({
326
326
  },
327
327
  children: [
328
328
  /* @__PURE__ */ jsx(HelpOutlineOutlined, { sx: { fontSize: "18px" } }),
329
- /* @__PURE__ */ jsx(Typography, { children: renderBenefits() }),
329
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", children: renderBenefits() }),
330
330
  /* @__PURE__ */ jsx(ArrowForwardOutlined, { className: "benefits-arrow", sx: { fontSize: "18px" } })
331
331
  ]
332
332
  }
@@ -5,6 +5,7 @@ export default function CurrencySelector({ value, currencies, onChange }) {
5
5
  return /* @__PURE__ */ jsx(
6
6
  Root,
7
7
  {
8
+ className: "cko-currency-selector",
8
9
  count: currencies.length,
9
10
  style: {
10
11
  display: currencies.length > 1 ? "grid" : "block",
@@ -56,7 +57,7 @@ const Root = styled("section")`
56
57
  .cko-payment-card {
57
58
  position: relative;
58
59
  border: 1px solid;
59
- border-color: ${({ theme }) => theme.palette.secondary.main};
60
+ border-color: ${({ theme }) => theme.palette.primary.main};
60
61
  padding: 4px 8px;
61
62
  cursor: pointer;
62
63
  background: ${({ theme }) => theme.palette.grey[50]};
package/es/theme/index.js CHANGED
@@ -53,8 +53,7 @@ export function PaymentThemeProvider({
53
53
  border: mode === "dark" ? "#1e3a8a" : "#bfdbfe"
54
54
  }
55
55
  }
56
- },
57
- typography
56
+ }
58
57
  });
59
58
  const {
60
59
  palette,
@@ -680,8 +680,11 @@ function CheckoutDonateInner({
680
680
  src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 24),
681
681
  variant: "circular"
682
682
  }, x.id))
683
- }), customers?.length > 0 && t("payment.checkout.donation.gaveTips", {
684
- count: customers?.length
683
+ }), customers?.length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
684
+ variant: "body2",
685
+ children: t("payment.checkout.donation.gaveTips", {
686
+ count: customers?.length
687
+ })
685
688
  })]
686
689
  }),
687
690
  showCloseButton: false,
@@ -13,7 +13,6 @@ function Status(props) {
13
13
  ...props,
14
14
  sx: {
15
15
  ...(props.sx || {}),
16
- borderRadius: "4px",
17
16
  height: 20,
18
17
  textTransform: "capitalize"
19
18
  }
@@ -35,7 +35,7 @@ function TruncatedText({
35
35
  }
36
36
  const truncatedText = (0, _util.truncateText)(text, maxLength, useWidth);
37
37
  if (!truncatedText.endsWith("...")) {
38
- return /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
38
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
39
39
  children: truncatedText
40
40
  });
41
41
  }
@@ -43,8 +43,7 @@ function TruncatedText({
43
43
  title: text,
44
44
  placement: "bottom",
45
45
  enterTouchDelay: 0,
46
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
47
- title: text,
46
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
48
47
  children: truncatedText
49
48
  })
50
49
  });
@@ -76,7 +76,15 @@ export declare function isValidCountry(code: string): boolean;
76
76
  export declare function stopEvent(e: React.SyntheticEvent<any>): void;
77
77
  export declare function sleep(ms: number): Promise<unknown>;
78
78
  export declare function formatSubscriptionProduct(items: TSubscriptionItemExpanded[], maxLength?: number): string;
79
- export declare const getSubscriptionTimeSummary: (subscription: TSubscriptionExpanded) => string;
79
+ export declare const getLineTimeInfo: (time: number, locale?: string) => {
80
+ time: any;
81
+ isToday: any;
82
+ };
83
+ export declare const getSubscriptionTimeSummary: (subscription: TSubscriptionExpanded, locale?: string) => {
84
+ action: string;
85
+ time: any;
86
+ isToday: any;
87
+ } | null;
80
88
  export declare const getSubscriptionAction: (subscription: TSubscriptionExpanded, actionProps: ActionProps) => {
81
89
  action: string;
82
90
  variant: string;
package/lib/libs/util.js CHANGED
@@ -32,6 +32,7 @@ exports.getCustomerAvatar = getCustomerAvatar;
32
32
  exports.getFreeTrialTime = getFreeTrialTime;
33
33
  exports.getInvoiceDescriptionAndReason = getInvoiceDescriptionAndReason;
34
34
  exports.getInvoiceStatusColor = getInvoiceStatusColor;
35
+ exports.getLineTimeInfo = void 0;
35
36
  exports.getPaymentIntentStatusColor = getPaymentIntentStatusColor;
36
37
  exports.getPaymentKitComponent = getPaymentKitComponent;
37
38
  exports.getPayoutStatusColor = getPayoutStatusColor;
@@ -783,27 +784,75 @@ function formatSubscriptionProduct(items, maxLength = 2) {
783
784
  const names = items.map(x => x.price?.product?.name).filter(Boolean);
784
785
  return names.slice(0, maxLength).join(", ") + (names.length > maxLength ? ` and ${names.length - maxLength} more` : "");
785
786
  }
786
- const getSubscriptionTimeSummary = subscription => {
787
- const lines = [`Start on ${formatToDate(subscription.start_date * 1e3, "en", "YYYY-MM-DD")}`];
788
- const getLineTimeMessage = time => {
789
- const curDay = (0, _dayjs.default)().isSame((0, _dayjs.default)(time), "day");
790
- const timeFormat = curDay ? "HH:mm:ss" : "YYYY-MM-DD";
791
- return `${curDay ? "in" : "on"} ${formatToDate(time, "en", timeFormat)}`;
787
+ const getLineTimeInfo = (time, locale = "en") => {
788
+ const isToday = (0, _dayjs.default)().isSame((0, _dayjs.default)(time), "day");
789
+ const timeFormat = isToday ? "HH:mm:ss" : "YYYY-MM-DD";
790
+ return {
791
+ time: formatToDate(time, locale, timeFormat),
792
+ isToday
792
793
  };
794
+ };
795
+ exports.getLineTimeInfo = getLineTimeInfo;
796
+ const getSubscriptionTimeSummary = (subscription, locale = "en") => {
793
797
  if (subscription.status === "active" || subscription.status === "trialing") {
794
798
  if (subscription.cancel_at) {
795
- lines.push(`Ended ${getLineTimeMessage(subscription.cancel_at * 1e3)}`);
796
- } else if (subscription.cancel_at_period_end) {
797
- lines.push(`Ended ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
798
- } else {
799
- lines.push(`Renew ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
799
+ const endTime = subscription.cancel_at * 1e3;
800
+ const {
801
+ time: time2,
802
+ isToday: isToday2
803
+ } = getLineTimeInfo(endTime, locale);
804
+ return {
805
+ action: "willEnd",
806
+ time: time2,
807
+ isToday: isToday2
808
+ };
800
809
  }
801
- } else if (subscription.status === "past_due") {
802
- lines.push(`Ended ${getLineTimeMessage((subscription.cancel_at || subscription.current_period_end) * 1e3)}`);
803
- } else if (subscription.status === "canceled") {
804
- lines.push(`Ended ${getLineTimeMessage(subscription.canceled_at * 1e3)}`);
810
+ if (subscription.cancel_at_period_end) {
811
+ const endTime = subscription.current_period_end * 1e3;
812
+ const {
813
+ time: time2,
814
+ isToday: isToday2
815
+ } = getLineTimeInfo(endTime, locale);
816
+ return {
817
+ action: "willEnd",
818
+ time: time2,
819
+ isToday: isToday2
820
+ };
821
+ }
822
+ const {
823
+ time,
824
+ isToday
825
+ } = getLineTimeInfo(subscription.current_period_end * 1e3, locale);
826
+ return {
827
+ action: "renew",
828
+ time,
829
+ isToday
830
+ };
831
+ }
832
+ if (subscription.status === "past_due") {
833
+ const endTime = (subscription.cancel_at || subscription.current_period_end) * 1e3;
834
+ const {
835
+ time,
836
+ isToday
837
+ } = getLineTimeInfo(endTime, locale);
838
+ return {
839
+ action: "ended",
840
+ time,
841
+ isToday
842
+ };
805
843
  }
806
- return lines.join(",");
844
+ if (subscription.status === "canceled") {
845
+ const {
846
+ time,
847
+ isToday
848
+ } = getLineTimeInfo(subscription.canceled_at * 1e3, locale);
849
+ return {
850
+ action: "ended",
851
+ time,
852
+ isToday
853
+ };
854
+ }
855
+ return null;
807
856
  };
808
857
  exports.getSubscriptionTimeSummary = getSubscriptionTimeSummary;
809
858
  const getSubscriptionAction = (subscription, actionProps) => {
package/lib/locales/en.js CHANGED
@@ -328,17 +328,17 @@ module.exports = (0, _flat.default)({
328
328
  empty: "There are no invoices",
329
329
  next: "No invoices yet, next invoice will be generated on {date}",
330
330
  invoiceNumber: "Invoice Number",
331
- emptyList: "No Invoice",
331
+ emptyList: "No Invoices",
332
332
  noPaymentRequired: "No Payment Required",
333
333
  payBatch: "Pay Due Invoices"
334
334
  },
335
335
  payment: {
336
336
  empty: "There are no payments",
337
- emptyList: "No Payment"
337
+ emptyList: "No Payments"
338
338
  },
339
339
  refund: {
340
340
  empty: "There are no refunds",
341
- emptyList: "No Refund"
341
+ emptyList: "No Refunds"
342
342
  },
343
343
  subscriptions: {
344
344
  plan: "Plan",
@@ -351,6 +351,7 @@ function PaymentInner({
351
351
  fontSize: "18px"
352
352
  }
353
353
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
354
+ variant: "body2",
354
355
  children: renderBenefits()
355
356
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowForwardOutlined, {
356
357
  className: "benefits-arrow",
@@ -13,6 +13,7 @@ function CurrencySelector({
13
13
  onChange
14
14
  }) {
15
15
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
16
+ className: "cko-currency-selector",
16
17
  count: currencies.length,
17
18
  style: {
18
19
  display: currencies.length > 1 ? "grid" : "block",
@@ -76,7 +77,7 @@ const Root = (0, _system.styled)("section")`
76
77
  border: 1px solid;
77
78
  border-color: ${({
78
79
  theme
79
- }) => theme.palette.secondary.main};
80
+ }) => theme.palette.primary.main};
80
81
  padding: 4px 8px;
81
82
  cursor: pointer;
82
83
  background: ${({
@@ -70,8 +70,7 @@ function PaymentThemeProvider({
70
70
  border: mode === "dark" ? "#1e3a8a" : "#bfdbfe"
71
71
  }
72
72
  }
73
- },
74
- typography: _typography.typography
73
+ }
75
74
  });
76
75
  const {
77
76
  palette,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.18.39",
3
+ "version": "1.18.41",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -54,16 +54,16 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@arcblock/did-connect": "^2.13.23",
58
- "@arcblock/ux": "^2.13.23",
59
- "@arcblock/ws": "^1.20.6",
60
- "@blocklet/theme": "^2.13.23",
61
- "@blocklet/ui-react": "^2.13.23",
57
+ "@arcblock/did-connect": "^2.13.29",
58
+ "@arcblock/ux": "^2.13.29",
59
+ "@arcblock/ws": "^1.20.8",
60
+ "@blocklet/theme": "^2.13.29",
61
+ "@blocklet/ui-react": "^2.13.29",
62
62
  "@mui/icons-material": "^5.16.6",
63
63
  "@mui/lab": "^5.0.0-alpha.173",
64
64
  "@mui/material": "^5.16.6",
65
65
  "@mui/system": "^5.16.6",
66
- "@ocap/util": "^1.20.6",
66
+ "@ocap/util": "^1.20.8",
67
67
  "@stripe/react-stripe-js": "^2.7.3",
68
68
  "@stripe/stripe-js": "^2.4.0",
69
69
  "@vitejs/plugin-legacy": "^5.4.1",
@@ -94,7 +94,7 @@
94
94
  "@babel/core": "^7.25.2",
95
95
  "@babel/preset-env": "^7.25.2",
96
96
  "@babel/preset-react": "^7.24.7",
97
- "@blocklet/payment-types": "1.18.39",
97
+ "@blocklet/payment-types": "1.18.41",
98
98
  "@storybook/addon-essentials": "^7.6.20",
99
99
  "@storybook/addon-interactions": "^7.6.20",
100
100
  "@storybook/addon-links": "^7.6.20",
@@ -125,5 +125,5 @@
125
125
  "vite-plugin-babel": "^1.2.0",
126
126
  "vite-plugin-node-polyfills": "^0.21.0"
127
127
  },
128
- "gitHead": "9e9a5c18fc160094505e902e995f5a5a052d544f"
128
+ "gitHead": "4232e09576dd8aa8dcfb0e4dd5a1bbbb50480b7f"
129
129
  }
@@ -739,7 +739,11 @@ function CheckoutDonateInner({
739
739
  />
740
740
  ))}
741
741
  </AvatarGroup>
742
- {customers?.length > 0 && t('payment.checkout.donation.gaveTips', { count: customers?.length })}
742
+ {customers?.length > 0 && (
743
+ <Typography variant="body2">
744
+ {t('payment.checkout.donation.gaveTips', { count: customers?.length })}
745
+ </Typography>
746
+ )}
743
747
  </Box>
744
748
  )
745
749
  }
@@ -9,7 +9,6 @@ export default function Status(props: ChipProps) {
9
9
  {...props}
10
10
  sx={{
11
11
  ...(props.sx || {}),
12
- borderRadius: '4px',
13
12
  height: 20,
14
13
  textTransform: 'capitalize',
15
14
  }}
@@ -1,4 +1,4 @@
1
- import { Tooltip } from '@mui/material';
1
+ import { Tooltip, Typography } from '@mui/material';
2
2
  import type { TooltipProps } from '@mui/material';
3
3
  import { tooltipClasses } from '@mui/material/Tooltip';
4
4
  import { styled } from '@mui/system';
@@ -27,11 +27,11 @@ export default function TruncatedText({ text = '', maxLength = 100, useWidth = f
27
27
  }
28
28
  const truncatedText = truncateText(text, maxLength, useWidth);
29
29
  if (!truncatedText.endsWith('...')) {
30
- return <span>{truncatedText}</span>;
30
+ return <Typography>{truncatedText}</Typography>;
31
31
  }
32
32
  return (
33
33
  <CustomTooltip title={text} placement="bottom" enterTouchDelay={0}>
34
- <span title={text}>{truncatedText}</span>
34
+ <Typography>{truncatedText}</Typography>
35
35
  </CustomTooltip>
36
36
  );
37
37
  }
package/src/libs/util.ts CHANGED
@@ -849,30 +849,40 @@ export function formatSubscriptionProduct(items: TSubscriptionItemExpanded[], ma
849
849
  );
850
850
  }
851
851
 
852
- export const getSubscriptionTimeSummary = (subscription: TSubscriptionExpanded) => {
853
- const lines = [`Start on ${formatToDate(subscription.start_date * 1000, 'en', 'YYYY-MM-DD')}`];
854
-
855
- const getLineTimeMessage = (time: number) => {
856
- const curDay = dayjs().isSame(dayjs(time), 'day');
857
- const timeFormat = curDay ? 'HH:mm:ss' : 'YYYY-MM-DD';
858
- return `${curDay ? 'in' : 'on'} ${formatToDate(time, 'en', timeFormat)}`;
852
+ export const getLineTimeInfo = (time: number, locale = 'en') => {
853
+ const isToday = dayjs().isSame(dayjs(time), 'day');
854
+ const timeFormat = isToday ? 'HH:mm:ss' : 'YYYY-MM-DD';
855
+ return {
856
+ time: formatToDate(time, locale, timeFormat),
857
+ isToday,
859
858
  };
859
+ };
860
860
 
861
+ export const getSubscriptionTimeSummary = (subscription: TSubscriptionExpanded, locale = 'en') => {
861
862
  if (subscription.status === 'active' || subscription.status === 'trialing') {
862
863
  if (subscription.cancel_at) {
863
- lines.push(`Ended ${getLineTimeMessage(subscription.cancel_at * 1000)}`);
864
- } else if (subscription.cancel_at_period_end) {
865
- lines.push(`Ended ${getLineTimeMessage(subscription.current_period_end * 1000)}`);
866
- } else {
867
- lines.push(`Renew ${getLineTimeMessage(subscription.current_period_end * 1000)}`);
864
+ const endTime = subscription.cancel_at * 1000;
865
+ const { time, isToday } = getLineTimeInfo(endTime, locale);
866
+ return { action: 'willEnd', time, isToday };
867
+ }
868
+ if (subscription.cancel_at_period_end) {
869
+ const endTime = subscription.current_period_end * 1000;
870
+ const { time, isToday } = getLineTimeInfo(endTime, locale);
871
+ return { action: 'willEnd', time, isToday };
868
872
  }
869
- } else if (subscription.status === 'past_due') {
870
- lines.push(`Ended ${getLineTimeMessage((subscription.cancel_at || subscription.current_period_end) * 1000)}`);
871
- } else if (subscription.status === 'canceled') {
872
- lines.push(`Ended ${getLineTimeMessage(subscription.canceled_at * 1000)}`);
873
+ const { time, isToday } = getLineTimeInfo(subscription.current_period_end * 1000, locale);
874
+ return { action: 'renew', time, isToday };
873
875
  }
874
-
875
- return lines.join(',');
876
+ if (subscription.status === 'past_due') {
877
+ const endTime = (subscription.cancel_at || subscription.current_period_end) * 1000;
878
+ const { time, isToday } = getLineTimeInfo(endTime, locale);
879
+ return { action: 'ended', time, isToday };
880
+ }
881
+ if (subscription.status === 'canceled') {
882
+ const { time, isToday } = getLineTimeInfo(subscription.canceled_at * 1000, locale);
883
+ return { action: 'ended', time, isToday };
884
+ }
885
+ return null;
876
886
  };
877
887
 
878
888
  export const getSubscriptionAction = (
@@ -335,17 +335,17 @@ export default flat({
335
335
  empty: 'There are no invoices',
336
336
  next: 'No invoices yet, next invoice will be generated on {date}',
337
337
  invoiceNumber: 'Invoice Number',
338
- emptyList: 'No Invoice',
338
+ emptyList: 'No Invoices',
339
339
  noPaymentRequired: 'No Payment Required',
340
340
  payBatch: 'Pay Due Invoices',
341
341
  },
342
342
  payment: {
343
343
  empty: 'There are no payments',
344
- emptyList: 'No Payment',
344
+ emptyList: 'No Payments',
345
345
  },
346
346
  refund: {
347
347
  empty: 'There are no refunds',
348
- emptyList: 'No Refund',
348
+ emptyList: 'No Refunds',
349
349
  },
350
350
  subscriptions: {
351
351
  plan: 'Plan',
@@ -352,7 +352,7 @@ function PaymentInner({
352
352
  },
353
353
  }}>
354
354
  <HelpOutlineOutlined sx={{ fontSize: '18px' }} />
355
- <Typography>{renderBenefits()}</Typography>
355
+ <Typography variant="body2">{renderBenefits()}</Typography>
356
356
  <ArrowForwardOutlined className="benefits-arrow" sx={{ fontSize: '18px' }} />
357
357
  </Box>
358
358
  ))}
@@ -11,6 +11,7 @@ type Props = {
11
11
  export default function CurrencySelector({ value, currencies, onChange }: Props) {
12
12
  return (
13
13
  <Root
14
+ className="cko-currency-selector"
14
15
  count={currencies.length}
15
16
  style={{
16
17
  display: currencies.length > 1 ? 'grid' : 'block',
@@ -58,7 +59,7 @@ const Root = styled<any>('section')`
58
59
  .cko-payment-card {
59
60
  position: relative;
60
61
  border: 1px solid;
61
- border-color: ${({ theme }) => theme.palette.secondary.main};
62
+ border-color: ${({ theme }) => theme.palette.primary.main};
62
63
  padding: 4px 8px;
63
64
  cursor: pointer;
64
65
  background: ${({ theme }) => theme.palette.grey[50]};
@@ -65,7 +65,6 @@ export function PaymentThemeProvider({
65
65
  },
66
66
  },
67
67
  },
68
- typography,
69
68
  });
70
69
 
71
70
  const {