@sudobility/subscription-components-rn 1.0.3 → 1.0.5
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/dist/PlatformIcon.d.ts +9 -0
- package/dist/PlatformIcon.d.ts.map +1 -0
- package/dist/SegmentedControl.d.ts.map +1 -1
- package/dist/SubscriptionLayout.d.ts.map +1 -1
- package/dist/index.js +178 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -60
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/PlatformIcon.tsx +34 -0
- package/src/SegmentedControl.tsx +143 -70
- package/src/SubscriptionLayout.tsx +21 -4
- package/src/types.ts +5 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$0, { createContext, useState, useCallback, useContext } from "react";
|
|
2
|
-
import { Pressable, View, Text, ScrollView, ActivityIndicator } from "react-native";
|
|
2
|
+
import { Pressable, View, Text, ScrollView, ActivityIndicator, StyleSheet } from "react-native";
|
|
3
3
|
var jsxRuntime = { exports: {} };
|
|
4
4
|
var reactJsxRuntime_production_min = {};
|
|
5
5
|
/**
|
|
@@ -1190,6 +1190,24 @@ function SubscriptionTile({
|
|
|
1190
1190
|
}
|
|
1191
1191
|
);
|
|
1192
1192
|
}
|
|
1193
|
+
const PLATFORM_ICONS = {
|
|
1194
|
+
web: "🌐",
|
|
1195
|
+
ios: "",
|
|
1196
|
+
android: "🤖",
|
|
1197
|
+
macos: ""
|
|
1198
|
+
};
|
|
1199
|
+
const PLATFORM_DISPLAY_NAMES = {
|
|
1200
|
+
web: "Web",
|
|
1201
|
+
ios: "iOS",
|
|
1202
|
+
android: "Android",
|
|
1203
|
+
macos: "macOS"
|
|
1204
|
+
};
|
|
1205
|
+
function PlatformIcon({ platform, className }) {
|
|
1206
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className, children: PLATFORM_ICONS[platform] });
|
|
1207
|
+
}
|
|
1208
|
+
function platformDisplayName(platform) {
|
|
1209
|
+
return PLATFORM_DISPLAY_NAMES[platform];
|
|
1210
|
+
}
|
|
1193
1211
|
function SubscriptionLayout({
|
|
1194
1212
|
title,
|
|
1195
1213
|
children,
|
|
@@ -1208,7 +1226,7 @@ function SubscriptionLayout({
|
|
|
1208
1226
|
trackingLabel,
|
|
1209
1227
|
componentName = "SubscriptionLayout"
|
|
1210
1228
|
}) {
|
|
1211
|
-
var _a, _b, _c, _d;
|
|
1229
|
+
var _a, _b, _c, _d, _e;
|
|
1212
1230
|
const showActionButtons = variant === "selection" && primaryAction;
|
|
1213
1231
|
const shouldShowFreeTile = variant === "cta" && freeTileConfig;
|
|
1214
1232
|
const handlePrimaryPress = () => {
|
|
@@ -1229,23 +1247,36 @@ function SubscriptionLayout({
|
|
|
1229
1247
|
headerContent,
|
|
1230
1248
|
currentStatus && /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "mb-6", children: [
|
|
1231
1249
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-2xl font-bold text-gray-900 dark:text-gray-100 mb-4", children: currentStatusLabel }),
|
|
1232
|
-
currentStatus.isActive ? /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "bg-
|
|
1250
|
+
currentStatus.isActive ? /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "bg-gray-50 dark:bg-gray-800/30 border border-gray-200 dark:border-gray-700 rounded-lg p-4", children: [
|
|
1233
1251
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "flex-row items-center mb-2", children: [
|
|
1234
1252
|
/* @__PURE__ */ jsxRuntimeExports.jsx(View, { className: "w-3 h-3 bg-green-500 rounded-full mr-3" }),
|
|
1235
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-
|
|
1253
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-gray-800 dark:text-gray-200", children: ((_a = currentStatus.activeContent) == null ? void 0 : _a.title) || "Active Subscription" })
|
|
1236
1254
|
] }),
|
|
1237
1255
|
((_b = currentStatus.activeContent) == null ? void 0 : _b.fields) && currentStatus.activeContent.fields.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(View, { className: "mt-4 gap-4", children: currentStatus.activeContent.fields.map(
|
|
1238
1256
|
(field, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { children: [
|
|
1239
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-sm text-
|
|
1240
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-
|
|
1257
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-sm text-gray-500 dark:text-gray-400", children: field.label }),
|
|
1258
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-gray-700 dark:text-gray-300", children: field.value })
|
|
1241
1259
|
] }, index)
|
|
1242
|
-
) })
|
|
1260
|
+
) }),
|
|
1261
|
+
((_c = currentStatus.activeContent) == null ? void 0 : _c.platform) && /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "mt-4", children: [
|
|
1262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-sm text-gray-500 dark:text-gray-400", children: currentStatus.activeContent.platform.label }),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "flex-row items-center gap-1.5 mt-0.5", children: [
|
|
1264
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1265
|
+
PlatformIcon,
|
|
1266
|
+
{
|
|
1267
|
+
platform: currentStatus.activeContent.platform.value,
|
|
1268
|
+
className: "text-gray-600 dark:text-gray-300"
|
|
1269
|
+
}
|
|
1270
|
+
),
|
|
1271
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-gray-700 dark:text-gray-300", children: platformDisplayName(currentStatus.activeContent.platform.value) })
|
|
1272
|
+
] })
|
|
1273
|
+
] })
|
|
1243
1274
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4", children: [
|
|
1244
1275
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(View, { className: "flex-row items-center mb-2", children: [
|
|
1245
1276
|
/* @__PURE__ */ jsxRuntimeExports.jsx(View, { className: "w-3 h-3 bg-yellow-500 rounded-full mr-3" }),
|
|
1246
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-yellow-800 dark:text-yellow-300", children: ((
|
|
1277
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "font-semibold text-yellow-800 dark:text-yellow-300", children: ((_d = currentStatus.inactiveContent) == null ? void 0 : _d.title) || "No Active Subscription" })
|
|
1247
1278
|
] }),
|
|
1248
|
-
((
|
|
1279
|
+
((_e = currentStatus.inactiveContent) == null ? void 0 : _e.message) && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-yellow-700 dark:text-yellow-400", children: currentStatus.inactiveContent.message })
|
|
1249
1280
|
] })
|
|
1250
1281
|
] }),
|
|
1251
1282
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-2xl font-bold text-gray-900 dark:text-gray-100 mb-4", children: title }),
|
|
@@ -1355,26 +1386,6 @@ function SubscriptionFooter({
|
|
|
1355
1386
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-xs text-gray-400 dark:text-gray-500 text-center px-4", children: "Subscriptions will automatically renew unless canceled at least 24 hours before the end of the current period." })
|
|
1356
1387
|
] });
|
|
1357
1388
|
}
|
|
1358
|
-
const sizeClasses = {
|
|
1359
|
-
sm: {
|
|
1360
|
-
container: "p-1 rounded-lg",
|
|
1361
|
-
segment: "px-3 py-1.5 rounded-md",
|
|
1362
|
-
text: "text-xs",
|
|
1363
|
-
badge: "text-xs px-1.5 py-0.5"
|
|
1364
|
-
},
|
|
1365
|
-
md: {
|
|
1366
|
-
container: "p-1 rounded-lg",
|
|
1367
|
-
segment: "px-4 py-2 rounded-md",
|
|
1368
|
-
text: "text-sm",
|
|
1369
|
-
badge: "text-xs px-2 py-0.5"
|
|
1370
|
-
},
|
|
1371
|
-
lg: {
|
|
1372
|
-
container: "p-1 rounded-lg",
|
|
1373
|
-
segment: "px-6 py-3 rounded-lg",
|
|
1374
|
-
text: "text-base",
|
|
1375
|
-
badge: "text-sm px-2 py-1"
|
|
1376
|
-
}
|
|
1377
|
-
};
|
|
1378
1389
|
function SegmentedControl({
|
|
1379
1390
|
options,
|
|
1380
1391
|
value,
|
|
@@ -1385,34 +1396,22 @@ function SegmentedControl({
|
|
|
1385
1396
|
fullWidth = true,
|
|
1386
1397
|
accessibilityLabel
|
|
1387
1398
|
}) {
|
|
1388
|
-
const sizes = sizeClasses[size];
|
|
1389
|
-
const containerClasses = [
|
|
1390
|
-
"flex-row bg-gray-100 dark:bg-gray-800",
|
|
1391
|
-
sizes.container,
|
|
1392
|
-
fullWidth ? "w-full" : "",
|
|
1393
|
-
disabled ? "opacity-50" : "",
|
|
1394
|
-
className
|
|
1395
|
-
].filter(Boolean).join(" ");
|
|
1396
1399
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1397
1400
|
View,
|
|
1398
1401
|
{
|
|
1399
|
-
|
|
1402
|
+
style: [
|
|
1403
|
+
styles.container,
|
|
1404
|
+
fullWidth && styles.fullWidth,
|
|
1405
|
+
disabled && styles.disabled,
|
|
1406
|
+
size === "sm" && styles.containerSm,
|
|
1407
|
+
size === "md" && styles.containerMd,
|
|
1408
|
+
size === "lg" && styles.containerLg
|
|
1409
|
+
],
|
|
1400
1410
|
accessibilityRole: "tablist",
|
|
1401
1411
|
accessibilityLabel,
|
|
1402
1412
|
children: options.map((option) => {
|
|
1403
1413
|
const isSelected = value === option.value;
|
|
1404
1414
|
const isDisabled = disabled || option.disabled;
|
|
1405
|
-
const segmentClasses = [
|
|
1406
|
-
sizes.segment,
|
|
1407
|
-
"flex-1 items-center justify-center flex-row gap-2",
|
|
1408
|
-
isSelected ? "bg-white dark:bg-gray-700 shadow-sm" : "bg-transparent",
|
|
1409
|
-
isDisabled ? "opacity-50" : ""
|
|
1410
|
-
].filter(Boolean).join(" ");
|
|
1411
|
-
const textClasses = [
|
|
1412
|
-
sizes.text,
|
|
1413
|
-
"font-medium",
|
|
1414
|
-
isSelected ? "text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"
|
|
1415
|
-
].join(" ");
|
|
1416
1415
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1417
1416
|
Pressable,
|
|
1418
1417
|
{
|
|
@@ -1424,24 +1423,45 @@ function SegmentedControl({
|
|
|
1424
1423
|
disabled: isDisabled
|
|
1425
1424
|
},
|
|
1426
1425
|
accessibilityLabel: option.label + (option.badge ? ", " + option.badge : ""),
|
|
1427
|
-
|
|
1426
|
+
style: [
|
|
1427
|
+
styles.segment,
|
|
1428
|
+
size === "sm" && styles.segmentSm,
|
|
1429
|
+
size === "md" && styles.segmentMd,
|
|
1430
|
+
size === "lg" && styles.segmentLg,
|
|
1431
|
+
isSelected && styles.segmentSelected,
|
|
1432
|
+
isDisabled && styles.disabled
|
|
1433
|
+
],
|
|
1428
1434
|
children: [
|
|
1429
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1435
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1436
|
+
Text,
|
|
1437
|
+
{
|
|
1438
|
+
style: [
|
|
1439
|
+
styles.text,
|
|
1440
|
+
size === "sm" && styles.textSm,
|
|
1441
|
+
size === "md" && styles.textMd,
|
|
1442
|
+
size === "lg" && styles.textLg,
|
|
1443
|
+
isSelected ? styles.textSelected : styles.textUnselected
|
|
1444
|
+
],
|
|
1445
|
+
children: option.label
|
|
1446
|
+
}
|
|
1447
|
+
),
|
|
1430
1448
|
option.badge && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1431
1449
|
View,
|
|
1432
1450
|
{
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
"
|
|
1436
|
-
|
|
1437
|
-
|
|
1451
|
+
style: [
|
|
1452
|
+
styles.badge,
|
|
1453
|
+
size === "sm" && styles.badgeSm,
|
|
1454
|
+
size === "md" && styles.badgeMd,
|
|
1455
|
+
size === "lg" && styles.badgeLg,
|
|
1456
|
+
isSelected ? styles.badgeSelected : styles.badgeUnselected
|
|
1457
|
+
],
|
|
1438
1458
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1439
1459
|
Text,
|
|
1440
1460
|
{
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
isSelected ?
|
|
1444
|
-
]
|
|
1461
|
+
style: [
|
|
1462
|
+
styles.badgeText,
|
|
1463
|
+
isSelected ? styles.badgeTextSelected : styles.badgeTextUnselected
|
|
1464
|
+
],
|
|
1445
1465
|
children: option.badge
|
|
1446
1466
|
}
|
|
1447
1467
|
)
|
|
@@ -1482,6 +1502,105 @@ function PeriodSelector({
|
|
|
1482
1502
|
}
|
|
1483
1503
|
);
|
|
1484
1504
|
}
|
|
1505
|
+
const styles = StyleSheet.create({
|
|
1506
|
+
container: {
|
|
1507
|
+
flexDirection: "row",
|
|
1508
|
+
backgroundColor: "#f3f4f6",
|
|
1509
|
+
borderRadius: 8,
|
|
1510
|
+
padding: 4
|
|
1511
|
+
},
|
|
1512
|
+
fullWidth: {
|
|
1513
|
+
width: "100%"
|
|
1514
|
+
},
|
|
1515
|
+
disabled: {
|
|
1516
|
+
opacity: 0.5
|
|
1517
|
+
},
|
|
1518
|
+
containerSm: {
|
|
1519
|
+
borderRadius: 8
|
|
1520
|
+
},
|
|
1521
|
+
containerMd: {
|
|
1522
|
+
borderRadius: 8
|
|
1523
|
+
},
|
|
1524
|
+
containerLg: {
|
|
1525
|
+
borderRadius: 12
|
|
1526
|
+
},
|
|
1527
|
+
segment: {
|
|
1528
|
+
flex: 1,
|
|
1529
|
+
alignItems: "center",
|
|
1530
|
+
justifyContent: "center",
|
|
1531
|
+
flexDirection: "row"
|
|
1532
|
+
},
|
|
1533
|
+
segmentSm: {
|
|
1534
|
+
paddingHorizontal: 12,
|
|
1535
|
+
paddingVertical: 6,
|
|
1536
|
+
borderRadius: 6,
|
|
1537
|
+
gap: 8
|
|
1538
|
+
},
|
|
1539
|
+
segmentMd: {
|
|
1540
|
+
paddingHorizontal: 16,
|
|
1541
|
+
paddingVertical: 8,
|
|
1542
|
+
borderRadius: 6,
|
|
1543
|
+
gap: 8
|
|
1544
|
+
},
|
|
1545
|
+
segmentLg: {
|
|
1546
|
+
paddingHorizontal: 24,
|
|
1547
|
+
paddingVertical: 12,
|
|
1548
|
+
borderRadius: 8,
|
|
1549
|
+
gap: 8
|
|
1550
|
+
},
|
|
1551
|
+
segmentSelected: {
|
|
1552
|
+
backgroundColor: "#ffffff"
|
|
1553
|
+
},
|
|
1554
|
+
text: {
|
|
1555
|
+
fontWeight: "500"
|
|
1556
|
+
},
|
|
1557
|
+
textSm: {
|
|
1558
|
+
fontSize: 12
|
|
1559
|
+
},
|
|
1560
|
+
textMd: {
|
|
1561
|
+
fontSize: 14
|
|
1562
|
+
},
|
|
1563
|
+
textLg: {
|
|
1564
|
+
fontSize: 16
|
|
1565
|
+
},
|
|
1566
|
+
textSelected: {
|
|
1567
|
+
color: "#111827"
|
|
1568
|
+
},
|
|
1569
|
+
textUnselected: {
|
|
1570
|
+
color: "#4b5563"
|
|
1571
|
+
},
|
|
1572
|
+
badge: {
|
|
1573
|
+
borderRadius: 999
|
|
1574
|
+
},
|
|
1575
|
+
badgeSm: {
|
|
1576
|
+
paddingHorizontal: 6,
|
|
1577
|
+
paddingVertical: 2
|
|
1578
|
+
},
|
|
1579
|
+
badgeMd: {
|
|
1580
|
+
paddingHorizontal: 8,
|
|
1581
|
+
paddingVertical: 2
|
|
1582
|
+
},
|
|
1583
|
+
badgeLg: {
|
|
1584
|
+
paddingHorizontal: 8,
|
|
1585
|
+
paddingVertical: 4
|
|
1586
|
+
},
|
|
1587
|
+
badgeSelected: {
|
|
1588
|
+
backgroundColor: "#dcfce7"
|
|
1589
|
+
},
|
|
1590
|
+
badgeUnselected: {
|
|
1591
|
+
backgroundColor: "#e5e7eb"
|
|
1592
|
+
},
|
|
1593
|
+
badgeText: {
|
|
1594
|
+
fontSize: 12,
|
|
1595
|
+
fontWeight: "600"
|
|
1596
|
+
},
|
|
1597
|
+
badgeTextSelected: {
|
|
1598
|
+
color: "#15803d"
|
|
1599
|
+
},
|
|
1600
|
+
badgeTextUnselected: {
|
|
1601
|
+
color: "#4b5563"
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1485
1604
|
const SubscriptionContext = createContext(
|
|
1486
1605
|
void 0
|
|
1487
1606
|
);
|