autumn-js 0.0.83 → 0.0.92-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/dist/libraries/backend/better-auth.d.mts +764 -4
- package/dist/libraries/backend/better-auth.d.ts +764 -4
- package/dist/libraries/backend/better-auth.js +341 -19184
- package/dist/libraries/backend/better-auth.mjs +232 -19135
- package/dist/libraries/backend/{chunk-XGB3TDIC.mjs → chunk-6DZX6EAA.mjs} +0 -5
- package/dist/libraries/backend/{chunk-J3QM5KFT.mjs → chunk-7QSJB2C5.mjs} +1 -1
- package/dist/libraries/backend/{chunk-UJQBHXII.mjs → chunk-FCEB2GBS.mjs} +1 -1
- package/dist/libraries/backend/{chunk-A46IKTLH.mjs → chunk-JPNRDMMC.mjs} +1 -1
- package/dist/libraries/backend/{chunk-52OTZ4SQ.mjs → chunk-NTFR7Z2G.mjs} +8 -8
- package/dist/libraries/backend/{chunk-DG3FZZQH.mjs → chunk-U7335VZS.mjs} +1 -1
- package/dist/libraries/backend/{chunk-VCEQ3QBX.mjs → chunk-V6M7KRGN.mjs} +57 -0
- package/dist/libraries/backend/{chunk-WDRHQJKV.mjs → chunk-VFTHGJ5N.mjs} +1 -1
- package/dist/libraries/backend/constants.mjs +1 -1
- package/dist/libraries/backend/convex.d.mts +10 -0
- package/dist/libraries/backend/convex.d.ts +10 -0
- package/dist/libraries/backend/convex.js +1045 -0
- package/dist/libraries/backend/convex.mjs +80 -0
- package/dist/libraries/backend/express.d.mts +2 -1
- package/dist/libraries/backend/express.d.ts +2 -1
- package/dist/libraries/backend/express.js +57 -0
- package/dist/libraries/backend/express.mjs +8 -8
- package/dist/libraries/backend/fastify.js +57 -0
- package/dist/libraries/backend/fastify.mjs +8 -8
- package/dist/libraries/backend/hono.js +57 -0
- package/dist/libraries/backend/hono.mjs +8 -8
- package/dist/libraries/backend/next.js +59 -2
- package/dist/libraries/backend/next.mjs +8 -8
- package/dist/libraries/backend/react-router.js +57 -0
- package/dist/libraries/backend/react-router.mjs +8 -8
- package/dist/libraries/backend/{referralTypes-BZ4WOVK5.d.ts → referralTypes-BAYl5TR1.d.ts} +101 -36
- package/dist/libraries/backend/{referralTypes-C6ao6j-_.d.mts → referralTypes-ecz_wESO.d.mts} +101 -36
- package/dist/libraries/backend/remix_dep.js +57 -0
- package/dist/libraries/backend/remix_dep.mjs +8 -8
- package/dist/libraries/backend/routes/backendRouter.js +57 -0
- package/dist/libraries/backend/routes/backendRouter.mjs +8 -8
- package/dist/libraries/backend/routes/entityRoutes.js +57 -0
- package/dist/libraries/backend/routes/entityRoutes.mjs +4 -4
- package/dist/libraries/backend/routes/genRoutes.js +57 -0
- package/dist/libraries/backend/routes/genRoutes.mjs +4 -4
- package/dist/libraries/backend/routes/productRoutes.js +57 -0
- package/dist/libraries/backend/routes/productRoutes.mjs +4 -4
- package/dist/libraries/backend/routes/referralRoutes.js +57 -0
- package/dist/libraries/backend/routes/referralRoutes.mjs +4 -4
- package/dist/libraries/backend/schemas/zod.d.mts +208 -0
- package/dist/libraries/backend/schemas/zod.d.ts +208 -0
- package/dist/libraries/backend/schemas/zod.js +100 -0
- package/dist/libraries/backend/schemas/zod.mjs +69 -0
- package/dist/libraries/backend/supabase.js +57 -0
- package/dist/libraries/backend/supabase.mjs +8 -8
- package/dist/libraries/backend/tanstack.js +57 -0
- package/dist/libraries/backend/tanstack.mjs +8 -8
- package/dist/libraries/backend/utils/backendRes.js +57 -0
- package/dist/libraries/backend/utils/backendRes.mjs +2 -2
- package/dist/libraries/backend/utils/logBackendErrors.mjs +1 -1
- package/dist/libraries/backend/utils/secretKeyCheck.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +2 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +2 -1
- package/dist/libraries/backend/utils/withAuth.js +57 -0
- package/dist/libraries/backend/utils/withAuth.mjs +3 -3
- package/dist/libraries/react/AutumnContext.d.mts +7 -6
- package/dist/libraries/react/AutumnContext.d.ts +7 -6
- package/dist/libraries/react/AutumnContext.js +59 -4
- package/dist/libraries/react/AutumnContext.mjs +2 -2
- package/dist/libraries/react/BaseAutumnProvider.d.mts +6 -7
- package/dist/libraries/react/BaseAutumnProvider.d.ts +6 -7
- package/dist/libraries/react/BaseAutumnProvider.js +149 -32
- package/dist/libraries/react/BaseAutumnProvider.mjs +7 -7
- package/dist/libraries/react/{ReactAutumnClient-DS-MPWXt.d.ts → ReactAutumnClient-BTNcA_3b.d.ts} +59 -11
- package/dist/libraries/react/{ReactAutumnClient-Cj2h9TXJ.d.mts → ReactAutumnClient-BiipnfQn.d.mts} +59 -11
- package/dist/libraries/react/ReactAutumnProvider.d.mts +3 -3
- package/dist/libraries/react/ReactAutumnProvider.d.ts +3 -3
- package/dist/libraries/react/ReactAutumnProvider.js +160 -46
- package/dist/libraries/react/ReactAutumnProvider.mjs +8 -8
- package/dist/libraries/react/{chunk-JFXBUWKA.mjs → chunk-3JJC2VU5.mjs} +22 -5
- package/dist/libraries/react/{chunk-CQMTU2M4.mjs → chunk-3WP2MI55.mjs} +25 -6
- package/dist/libraries/react/{chunk-6ULRUGQO.mjs → chunk-4AYEAAQU.mjs} +2 -2
- package/dist/libraries/react/{chunk-UO2PX7P3.mjs → chunk-67Y4DFV2.mjs} +14 -17
- package/dist/libraries/react/{chunk-EWMKQDQ6.mjs → chunk-6JOSRG5Z.mjs} +2 -2
- package/dist/libraries/react/{chunk-JOY6LN3M.mjs → chunk-CHQRTGXF.mjs} +25 -7
- package/dist/libraries/react/{chunk-KVGD37VB.mjs → chunk-G3XBGOHR.mjs} +4 -6
- package/dist/libraries/react/{chunk-S4VDT54B.mjs → chunk-GK75OJJJ.mjs} +2 -2
- package/dist/libraries/react/{chunk-MH2YTNJL.mjs → chunk-ITN754AD.mjs} +3 -5
- package/dist/libraries/react/{chunk-Z7MRLSU3.mjs → chunk-LKBUMRHE.mjs} +9 -9
- package/dist/libraries/react/{chunk-UDRQNZZS.mjs → chunk-QAHVMSK4.mjs} +57 -0
- package/dist/libraries/react/{chunk-SCT4E6YW.mjs → chunk-SJAAUTL2.mjs} +2 -2
- package/dist/libraries/react/{chunk-L55GLFAX.mjs → chunk-TBKIB6DH.mjs} +2 -2
- package/dist/libraries/react/{chunk-GEIECHWI.mjs → chunk-TINC2IR4.mjs} +24 -14
- package/dist/libraries/react/{chunk-OWFX3JFF.mjs → chunk-WVKYZYFT.mjs} +14 -0
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -5
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -5
- package/dist/libraries/react/client/ReactAutumnClient.js +57 -0
- package/dist/libraries/react/client/ReactAutumnClient.mjs +1 -1
- package/dist/libraries/react/client/clientCompMethods.d.mts +6 -5
- package/dist/libraries/react/client/clientCompMethods.d.ts +6 -5
- package/dist/libraries/react/client/clientCusMethods.d.mts +6 -5
- package/dist/libraries/react/client/clientCusMethods.d.ts +6 -5
- package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -5
- package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -5
- package/dist/libraries/react/client/clientGenMethods.d.mts +6 -5
- package/dist/libraries/react/client/clientGenMethods.d.ts +6 -5
- package/dist/libraries/react/client/clientProdMethods.d.mts +6 -5
- package/dist/libraries/react/client/clientProdMethods.d.ts +6 -5
- package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -4
- package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -4
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +136 -41
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +136 -41
- package/dist/libraries/react/client/types/clientGenTypes.js +62 -0
- package/dist/libraries/react/client/types/clientGenTypes.mjs +52 -0
- package/dist/libraries/react/client/types/clientReferralTypes.d.mts +17 -5
- package/dist/libraries/react/client/types/clientReferralTypes.d.ts +17 -5
- package/dist/libraries/react/client/types/clientReferralTypes.js +20 -0
- package/dist/libraries/react/client/types/clientReferralTypes.mjs +13 -0
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +2 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +2 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +164 -29
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +17 -17
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +2 -1
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +2 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +2 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +2 -1
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +2 -1
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +2 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +2 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +2 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +163 -30
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +17 -17
- package/dist/libraries/react/components/ui/button.d.mts +1 -1
- package/dist/libraries/react/components/ui/button.d.ts +1 -1
- package/dist/libraries/react/{cusTypes-CO4FwQ_s.d.ts → cusTypes-Bf1qr9iE.d.mts} +29 -9
- package/dist/libraries/react/{cusTypes-CO4FwQ_s.d.mts → cusTypes-Bf1qr9iE.d.ts} +29 -9
- package/dist/libraries/react/{entTypes-DPTZOorv.d.mts → entTypes-CscyyE1A.d.mts} +1 -1
- package/dist/libraries/react/{entTypes-UxZ5bRqE.d.ts → entTypes-O8YXxhrA.d.ts} +1 -1
- package/dist/libraries/react/hooks/handleAllowed.d.mts +4 -3
- package/dist/libraries/react/hooks/handleAllowed.d.ts +4 -3
- package/dist/libraries/react/hooks/handleAllowed.js +22 -5
- package/dist/libraries/react/hooks/handleAllowed.mjs +1 -1
- package/dist/libraries/react/hooks/useAutumn.d.mts +6 -5
- package/dist/libraries/react/hooks/useAutumn.d.ts +6 -5
- package/dist/libraries/react/hooks/useAutumn.js +105 -13
- package/dist/libraries/react/hooks/useAutumn.mjs +5 -5
- package/dist/libraries/react/hooks/useAutumnBase.d.mts +9 -8
- package/dist/libraries/react/hooks/useAutumnBase.d.ts +9 -8
- package/dist/libraries/react/hooks/useAutumnBase.js +105 -13
- package/dist/libraries/react/hooks/useAutumnBase.mjs +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.mts +7 -5
- package/dist/libraries/react/hooks/useCustomer.d.ts +7 -5
- package/dist/libraries/react/hooks/useCustomer.js +148 -29
- package/dist/libraries/react/hooks/useCustomer.mjs +7 -7
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +8 -4
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +8 -4
- package/dist/libraries/react/hooks/useCustomerBase.js +148 -29
- package/dist/libraries/react/hooks/useCustomerBase.mjs +6 -6
- package/dist/libraries/react/hooks/useEntity.d.mts +7 -5
- package/dist/libraries/react/hooks/useEntity.d.ts +7 -5
- package/dist/libraries/react/hooks/useEntity.js +127 -18
- package/dist/libraries/react/hooks/useEntity.mjs +7 -7
- package/dist/libraries/react/hooks/useEntityBase.d.mts +7 -7
- package/dist/libraries/react/hooks/useEntityBase.d.ts +7 -7
- package/dist/libraries/react/hooks/useEntityBase.js +127 -18
- package/dist/libraries/react/hooks/useEntityBase.mjs +6 -6
- package/dist/libraries/react/hooks/usePricingTable.d.mts +2 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +2 -1
- package/dist/libraries/react/hooks/usePricingTable.js +82 -9
- package/dist/libraries/react/hooks/usePricingTable.mjs +4 -4
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +7 -6
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +7 -6
- package/dist/libraries/react/hooks/usePricingTableBase.js +82 -9
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +3 -3
- package/dist/libraries/react/hooks/useProductsBase.js +59 -4
- package/dist/libraries/react/hooks/useProductsBase.mjs +2 -2
- package/dist/libraries/react/index.d.mts +611 -0
- package/dist/libraries/react/index.d.ts +168 -57
- package/dist/libraries/react/index.js +175 -72
- package/dist/libraries/react/index.mjs +175 -72
- package/dist/libraries/react/{response-Z4Yeokd8.d.ts → response-BHqAAnND.d.ts} +21 -5
- package/dist/libraries/react/{response-CxtkXvb4.d.mts → response-CDZ_R5pb.d.mts} +21 -5
- package/dist/libraries/react/utils/inject-styles.js +14 -0
- package/dist/libraries/react/utils/inject-styles.mjs +1 -1
- package/dist/next/{AutumnProvider-DPcEuE_Q.d.ts → AutumnProvider-DtLqoQp6.d.mts} +28 -9
- package/dist/next/{AutumnProvider-DPcEuE_Q.d.mts → AutumnProvider-DtLqoQp6.d.ts} +28 -9
- package/dist/next/AutumnProvider.d.mts +2 -1
- package/dist/next/AutumnProvider.d.ts +2 -1
- package/dist/next/client/NextAutumnClient.d.mts +60 -10
- package/dist/next/client/NextAutumnClient.d.ts +60 -10
- package/dist/next/client/NextAutumnProvider.d.mts +2 -1
- package/dist/next/client/NextAutumnProvider.d.ts +2 -1
- package/dist/next/client/clientEntTypes-BFkleT6a.d.mts +22 -0
- package/dist/next/client/clientEntTypes-BFkleT6a.d.ts +22 -0
- package/dist/next/client/clientGenTypes-B28imYzT.d.mts +195 -0
- package/dist/next/client/clientGenTypes-D46edNj5.d.ts +195 -0
- package/dist/next/client/clientUtils.d.mts +3 -2
- package/dist/next/client/clientUtils.d.ts +3 -2
- package/dist/next/client/{cusTypes-CJI8rdlY.d.mts → cusTypes-CGXuXu_Y.d.mts} +29 -9
- package/dist/next/client/{cusTypes-CJI8rdlY.d.ts → cusTypes-CGXuXu_Y.d.ts} +29 -9
- package/dist/next/client/{entTypes-okM0aeOM.d.mts → entTypes-CJx3GLTt.d.mts} +1 -1
- package/dist/next/client/{entTypes-CqHWTcCX.d.ts → entTypes-qYfQsZ9u.d.ts} +1 -1
- package/dist/next/client/hooks/useAutumn.d.mts +6 -4
- package/dist/next/client/hooks/useAutumn.d.ts +6 -4
- package/dist/next/client/hooks/useCustomer.d.mts +26 -4
- package/dist/next/client/hooks/useCustomer.d.ts +26 -4
- package/dist/next/client/hooks/useCustomer.js +3 -1
- package/dist/next/client/hooks/useCustomer.mjs +3 -1
- package/dist/next/client/hooks/useEntity.d.mts +7 -5
- package/dist/next/client/hooks/useEntity.d.ts +7 -5
- package/dist/next/client/hooks/usePricingTable.d.mts +2 -1
- package/dist/next/client/hooks/usePricingTable.d.ts +2 -1
- package/dist/next/client/types.d.mts +3 -2
- package/dist/next/client/types.d.ts +3 -2
- package/dist/next/index.d.mts +221 -65
- package/dist/next/index.d.ts +221 -65
- package/dist/next/server/auth/withNextAuth.d.mts +2 -1
- package/dist/next/server/auth/withNextAuth.d.ts +2 -1
- package/dist/next/server/componentActions.d.mts +2 -1
- package/dist/next/server/componentActions.d.ts +2 -1
- package/dist/next/server/cusActions.d.mts +93 -38
- package/dist/next/server/cusActions.d.ts +93 -38
- package/dist/next/server/{cusTypes-DuSwXVmp.d.mts → cusTypes-H4mqijcm.d.mts} +28 -8
- package/dist/next/server/{cusTypes-DuSwXVmp.d.ts → cusTypes-H4mqijcm.d.ts} +28 -8
- package/dist/next/server/genActions.d.mts +44 -49
- package/dist/next/server/genActions.d.ts +44 -49
- package/dist/sdk/index.d.mts +123 -29
- package/dist/sdk/index.d.ts +123 -29
- package/dist/sdk/index.js +60 -9
- package/dist/sdk/index.mjs +57 -10
- package/dist/styles/global.css +42 -4
- package/dist/utils/encryptUtils.js +57 -0
- package/dist/utils/encryptUtils.mjs +57 -0
- package/package.json +33 -4
- package/tsup.config.ts +1 -22
- package/components.json +0 -21
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.css +0 -1271
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.css +0 -1271
- package/dist/next/client/clientGenTypes-CAv4hwb4.d.ts +0 -108
- package/dist/next/client/clientGenTypes-Dlpw9wy_.d.mts +0 -108
- package/dist/next/client/clientReferralTypes-C9JiOk2s.d.mts +0 -20
- package/dist/next/client/clientReferralTypes-C9JiOk2s.d.ts +0 -20
- package/dist/next/server/clientEntTypes-BOVTwIKv.d.mts +0 -14
- package/dist/next/server/clientEntTypes-BOVTwIKv.d.ts +0 -14
- package/postcss.config.js +0 -25
- package/publish.sh +0 -18
- package/scripts/css-transform-plugin.js +0 -28
- package/scripts/post-build.js +0 -91
- package/scripts/sync-registry.ts +0 -190
- package/tailwind.config.ts +0 -96
- package/tsup.dev.config.ts +0 -199
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { C as CustomerData, i as CheckFeatureResult, j as CheckProductResult } from './cusTypes-CJI8rdlY.js';
|
|
2
|
-
import { A as AutumnError } from './error-DHbclCVh.js';
|
|
3
|
-
|
|
4
|
-
interface CancelResult {
|
|
5
|
-
success: boolean;
|
|
6
|
-
customer_id: string;
|
|
7
|
-
product_id: string;
|
|
8
|
-
}
|
|
9
|
-
interface AttachResult {
|
|
10
|
-
checkout_url?: string;
|
|
11
|
-
customer_id: string;
|
|
12
|
-
product_ids: string[];
|
|
13
|
-
code: string;
|
|
14
|
-
message: string;
|
|
15
|
-
customer_data?: CustomerData;
|
|
16
|
-
}
|
|
17
|
-
interface TrackResult {
|
|
18
|
-
id: string;
|
|
19
|
-
code: string;
|
|
20
|
-
customer_id: string;
|
|
21
|
-
feature_id?: string;
|
|
22
|
-
event_name?: string;
|
|
23
|
-
}
|
|
24
|
-
type CheckResult = CheckFeatureResult & CheckProductResult;
|
|
25
|
-
interface SetupPaymentResult {
|
|
26
|
-
customer_id: string;
|
|
27
|
-
url: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Success<T> = {
|
|
31
|
-
data: T;
|
|
32
|
-
error: null;
|
|
33
|
-
statusCode?: number;
|
|
34
|
-
};
|
|
35
|
-
type Failure<E> = {
|
|
36
|
-
data: null;
|
|
37
|
-
error: E;
|
|
38
|
-
statusCode?: number;
|
|
39
|
-
};
|
|
40
|
-
type Result<T, E> = Success<T> | Failure<E>;
|
|
41
|
-
type AutumnPromise<T> = Promise<Result<T, AutumnError>>;
|
|
42
|
-
|
|
43
|
-
interface CreateEntityParams {
|
|
44
|
-
id: string;
|
|
45
|
-
name?: string;
|
|
46
|
-
featureId: string;
|
|
47
|
-
}
|
|
48
|
-
interface GetEntityParams {
|
|
49
|
-
expand?: string[];
|
|
50
|
-
}
|
|
51
|
-
interface EntityDataParams {
|
|
52
|
-
name?: string;
|
|
53
|
-
featureId: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface AttachFeatureOptions {
|
|
57
|
-
featureId: string;
|
|
58
|
-
quantity: number;
|
|
59
|
-
}
|
|
60
|
-
interface AttachParams {
|
|
61
|
-
productId?: string;
|
|
62
|
-
entityId?: string;
|
|
63
|
-
options?: AttachFeatureOptions[];
|
|
64
|
-
productIds?: string[];
|
|
65
|
-
freeTrial?: boolean;
|
|
66
|
-
successUrl?: string;
|
|
67
|
-
metadata?: Record<string, string>;
|
|
68
|
-
forceCheckout?: boolean;
|
|
69
|
-
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
70
|
-
entityData?: EntityDataParams;
|
|
71
|
-
openInNewTab?: boolean;
|
|
72
|
-
reward?: string;
|
|
73
|
-
checkoutSessionParams?: Record<string, any>;
|
|
74
|
-
}
|
|
75
|
-
interface CancelParams {
|
|
76
|
-
productId: string;
|
|
77
|
-
entityId?: string;
|
|
78
|
-
cancelImmediately?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface CheckParams {
|
|
81
|
-
featureId?: string;
|
|
82
|
-
productId?: string;
|
|
83
|
-
entityId?: string;
|
|
84
|
-
requiredBalance?: number;
|
|
85
|
-
sendEvent?: boolean;
|
|
86
|
-
withPreview?: boolean;
|
|
87
|
-
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
88
|
-
entityData?: EntityDataParams;
|
|
89
|
-
}
|
|
90
|
-
interface TrackParams {
|
|
91
|
-
featureId?: string;
|
|
92
|
-
eventName?: string;
|
|
93
|
-
entityId?: string;
|
|
94
|
-
value?: number;
|
|
95
|
-
idempotencyKey?: string;
|
|
96
|
-
entityData?: EntityDataParams;
|
|
97
|
-
}
|
|
98
|
-
interface OpenBillingPortalParams {
|
|
99
|
-
returnUrl?: string;
|
|
100
|
-
openInNewTab?: boolean;
|
|
101
|
-
}
|
|
102
|
-
interface SetupPaymentParams {
|
|
103
|
-
successUrl?: string;
|
|
104
|
-
checkoutSessionParams?: Record<string, any>;
|
|
105
|
-
openInNewTab?: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type { AttachParams as A, CheckResult as C, GetEntityParams as G, OpenBillingPortalParams as O, Result as R, SetupPaymentParams as S, TrackParams as T, AttachResult as a, CheckParams as b, AutumnPromise as c, TrackResult as d, CancelParams as e, CancelResult as f, SetupPaymentResult as g, CreateEntityParams as h };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { C as CustomerData, i as CheckFeatureResult, j as CheckProductResult } from './cusTypes-CJI8rdlY.mjs';
|
|
2
|
-
import { A as AutumnError } from './error-DHbclCVh.mjs';
|
|
3
|
-
|
|
4
|
-
interface CancelResult {
|
|
5
|
-
success: boolean;
|
|
6
|
-
customer_id: string;
|
|
7
|
-
product_id: string;
|
|
8
|
-
}
|
|
9
|
-
interface AttachResult {
|
|
10
|
-
checkout_url?: string;
|
|
11
|
-
customer_id: string;
|
|
12
|
-
product_ids: string[];
|
|
13
|
-
code: string;
|
|
14
|
-
message: string;
|
|
15
|
-
customer_data?: CustomerData;
|
|
16
|
-
}
|
|
17
|
-
interface TrackResult {
|
|
18
|
-
id: string;
|
|
19
|
-
code: string;
|
|
20
|
-
customer_id: string;
|
|
21
|
-
feature_id?: string;
|
|
22
|
-
event_name?: string;
|
|
23
|
-
}
|
|
24
|
-
type CheckResult = CheckFeatureResult & CheckProductResult;
|
|
25
|
-
interface SetupPaymentResult {
|
|
26
|
-
customer_id: string;
|
|
27
|
-
url: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Success<T> = {
|
|
31
|
-
data: T;
|
|
32
|
-
error: null;
|
|
33
|
-
statusCode?: number;
|
|
34
|
-
};
|
|
35
|
-
type Failure<E> = {
|
|
36
|
-
data: null;
|
|
37
|
-
error: E;
|
|
38
|
-
statusCode?: number;
|
|
39
|
-
};
|
|
40
|
-
type Result<T, E> = Success<T> | Failure<E>;
|
|
41
|
-
type AutumnPromise<T> = Promise<Result<T, AutumnError>>;
|
|
42
|
-
|
|
43
|
-
interface CreateEntityParams {
|
|
44
|
-
id: string;
|
|
45
|
-
name?: string;
|
|
46
|
-
featureId: string;
|
|
47
|
-
}
|
|
48
|
-
interface GetEntityParams {
|
|
49
|
-
expand?: string[];
|
|
50
|
-
}
|
|
51
|
-
interface EntityDataParams {
|
|
52
|
-
name?: string;
|
|
53
|
-
featureId: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface AttachFeatureOptions {
|
|
57
|
-
featureId: string;
|
|
58
|
-
quantity: number;
|
|
59
|
-
}
|
|
60
|
-
interface AttachParams {
|
|
61
|
-
productId?: string;
|
|
62
|
-
entityId?: string;
|
|
63
|
-
options?: AttachFeatureOptions[];
|
|
64
|
-
productIds?: string[];
|
|
65
|
-
freeTrial?: boolean;
|
|
66
|
-
successUrl?: string;
|
|
67
|
-
metadata?: Record<string, string>;
|
|
68
|
-
forceCheckout?: boolean;
|
|
69
|
-
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
70
|
-
entityData?: EntityDataParams;
|
|
71
|
-
openInNewTab?: boolean;
|
|
72
|
-
reward?: string;
|
|
73
|
-
checkoutSessionParams?: Record<string, any>;
|
|
74
|
-
}
|
|
75
|
-
interface CancelParams {
|
|
76
|
-
productId: string;
|
|
77
|
-
entityId?: string;
|
|
78
|
-
cancelImmediately?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface CheckParams {
|
|
81
|
-
featureId?: string;
|
|
82
|
-
productId?: string;
|
|
83
|
-
entityId?: string;
|
|
84
|
-
requiredBalance?: number;
|
|
85
|
-
sendEvent?: boolean;
|
|
86
|
-
withPreview?: boolean;
|
|
87
|
-
dialog?: (data: any) => JSX.Element | React.ReactNode;
|
|
88
|
-
entityData?: EntityDataParams;
|
|
89
|
-
}
|
|
90
|
-
interface TrackParams {
|
|
91
|
-
featureId?: string;
|
|
92
|
-
eventName?: string;
|
|
93
|
-
entityId?: string;
|
|
94
|
-
value?: number;
|
|
95
|
-
idempotencyKey?: string;
|
|
96
|
-
entityData?: EntityDataParams;
|
|
97
|
-
}
|
|
98
|
-
interface OpenBillingPortalParams {
|
|
99
|
-
returnUrl?: string;
|
|
100
|
-
openInNewTab?: boolean;
|
|
101
|
-
}
|
|
102
|
-
interface SetupPaymentParams {
|
|
103
|
-
successUrl?: string;
|
|
104
|
-
checkoutSessionParams?: Record<string, any>;
|
|
105
|
-
openInNewTab?: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type { AttachParams as A, CheckResult as C, GetEntityParams as G, OpenBillingPortalParams as O, Result as R, SetupPaymentParams as S, TrackParams as T, AttachResult as a, CheckParams as b, AutumnPromise as c, TrackResult as d, CancelParams as e, CancelResult as f, SetupPaymentResult as g, CreateEntityParams as h };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface CreateReferralCodeResult {
|
|
2
|
-
code: string;
|
|
3
|
-
customer_id: string;
|
|
4
|
-
created_at: number;
|
|
5
|
-
}
|
|
6
|
-
interface RedeemReferralCodeResult {
|
|
7
|
-
id: string;
|
|
8
|
-
customer_id: string;
|
|
9
|
-
reward_id: string;
|
|
10
|
-
applied: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface CreateReferralCodeParams {
|
|
14
|
-
programId: string;
|
|
15
|
-
}
|
|
16
|
-
interface RedeemReferralCodeParams {
|
|
17
|
-
code: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type { CreateReferralCodeParams as C, RedeemReferralCodeParams as R, CreateReferralCodeResult as a, RedeemReferralCodeResult as b };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface CreateReferralCodeResult {
|
|
2
|
-
code: string;
|
|
3
|
-
customer_id: string;
|
|
4
|
-
created_at: number;
|
|
5
|
-
}
|
|
6
|
-
interface RedeemReferralCodeResult {
|
|
7
|
-
id: string;
|
|
8
|
-
customer_id: string;
|
|
9
|
-
reward_id: string;
|
|
10
|
-
applied: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface CreateReferralCodeParams {
|
|
14
|
-
programId: string;
|
|
15
|
-
}
|
|
16
|
-
interface RedeemReferralCodeParams {
|
|
17
|
-
code: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type { CreateReferralCodeParams as C, RedeemReferralCodeParams as R, CreateReferralCodeResult as a, RedeemReferralCodeResult as b };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface CreateEntityParams {
|
|
2
|
-
id: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
featureId: string;
|
|
5
|
-
}
|
|
6
|
-
interface GetEntityParams {
|
|
7
|
-
expand?: string[];
|
|
8
|
-
}
|
|
9
|
-
interface EntityDataParams {
|
|
10
|
-
name?: string;
|
|
11
|
-
featureId: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type { CreateEntityParams as C, EntityDataParams as E, GetEntityParams as G };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface CreateEntityParams {
|
|
2
|
-
id: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
featureId: string;
|
|
5
|
-
}
|
|
6
|
-
interface GetEntityParams {
|
|
7
|
-
expand?: string[];
|
|
8
|
-
}
|
|
9
|
-
interface EntityDataParams {
|
|
10
|
-
name?: string;
|
|
11
|
-
featureId: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type { CreateEntityParams as C, EntityDataParams as E, GetEntityParams as G };
|
package/postcss.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
tailwindcss: {},
|
|
4
|
-
autoprefixer: {},
|
|
5
|
-
"postcss-nested": {},
|
|
6
|
-
// 'postcss-prefix-selector': {
|
|
7
|
-
// prefix: '.au-root',
|
|
8
|
-
// transform: function (prefix, selector, prefixedSelector) {
|
|
9
|
-
// if (selector.match(/^(html|body)/)) {
|
|
10
|
-
// return selector.replace(/^([^\s]*)/, `$1 ${prefix}`);
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
// if (selector.match(/^(::?[\w-]+)/)) {
|
|
14
|
-
// return `${prefix}${selector}`;
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
// if (selector.includes('*')) {
|
|
18
|
-
// return prefixedSelector;
|
|
19
|
-
// }
|
|
20
|
-
|
|
21
|
-
// return prefixedSelector;
|
|
22
|
-
// },
|
|
23
|
-
// },
|
|
24
|
-
}
|
|
25
|
-
}
|
package/publish.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Copy README.md from ../ to ./
|
|
4
|
-
cp ../README.md ./
|
|
5
|
-
|
|
6
|
-
# Copy LICENSE.md from ../ to ./
|
|
7
|
-
cp ../LICENSE.md ./
|
|
8
|
-
|
|
9
|
-
npm run build
|
|
10
|
-
|
|
11
|
-
npm version patch
|
|
12
|
-
|
|
13
|
-
if [ "$1" = "--tag" ] && [ "$2" = "beta" ]; then
|
|
14
|
-
npm publish --tag beta
|
|
15
|
-
else
|
|
16
|
-
npm publish
|
|
17
|
-
fi
|
|
18
|
-
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
// esbuild plugin to transform CSS before injection
|
|
5
|
-
export function cssTransformPlugin() {
|
|
6
|
-
return {
|
|
7
|
-
name: 'css-transform',
|
|
8
|
-
setup(build) {
|
|
9
|
-
// Process CSS files before they get injected
|
|
10
|
-
build.onLoad({ filter: /\.css$/ }, async (args) => {
|
|
11
|
-
const cssContent = await fs.promises.readFile(args.path, 'utf8');
|
|
12
|
-
|
|
13
|
-
// Apply the same transformation as post-build.js
|
|
14
|
-
const transformedCss = cssContent.replace(
|
|
15
|
-
/(\*,\n::before,\n::after)/g,
|
|
16
|
-
'.au-root *,\n.au-root ::before,\n.au-root ::after'
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
console.log(`🎨 Transformed CSS: ${path.basename(args.path)}`);
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
contents: transformedCss,
|
|
23
|
-
loader: 'css'
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
package/scripts/post-build.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// Post-build processing: replace CSS selectors with .au-root prefix
|
|
5
|
-
function processCssFiles() {
|
|
6
|
-
const cssFiles = [
|
|
7
|
-
path.join(__dirname, '../dist/styles/global.css'),
|
|
8
|
-
path.join(__dirname, '../dist/libraries/react/index.css')
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
cssFiles.forEach(cssFilePath => {
|
|
12
|
-
if (fs.existsSync(cssFilePath)) {
|
|
13
|
-
console.log('📄 Processing CSS file:', cssFilePath);
|
|
14
|
-
|
|
15
|
-
const builtCss = fs.readFileSync(cssFilePath, 'utf8');
|
|
16
|
-
let updatedCss = builtCss.replace(
|
|
17
|
-
/(\*,\n::before,\n::after)/g,
|
|
18
|
-
'.au-root *,\n.au-root ::before,\n.au-root ::after'
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
// Also handle standalone * selectors (for custom base styles)
|
|
22
|
-
updatedCss = updatedCss.replace(
|
|
23
|
-
/^(\* \{[^}]*\})$/gm,
|
|
24
|
-
(match) => match.replace('* {', '.au-root * {')
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
fs.writeFileSync(cssFilePath, updatedCss);
|
|
28
|
-
console.log('✅ CSS selectors updated with .au-root prefix');
|
|
29
|
-
} else {
|
|
30
|
-
console.log('⚠️ CSS file not found:', cssFilePath);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Process injected CSS in JS files
|
|
36
|
-
function processInjectedCss() {
|
|
37
|
-
const reactDir = path.join(__dirname, '../dist/libraries/react');
|
|
38
|
-
const files = fs.readdirSync(reactDir).filter(file =>
|
|
39
|
-
file.endsWith('.js') || file.endsWith('.mjs') || file.endsWith('.cjs')
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
files.forEach(file => {
|
|
43
|
-
const filePath = path.join(reactDir, file);
|
|
44
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
45
|
-
|
|
46
|
-
// Check if this file has styleInject and CSS content
|
|
47
|
-
if (content.includes('styleInject')) {
|
|
48
|
-
let updated = false;
|
|
49
|
-
let updatedContent = content;
|
|
50
|
-
|
|
51
|
-
// Pattern 1: *,\n::before,\n::after (with newlines)
|
|
52
|
-
if (updatedContent.includes('*,\\n::before,\\n::after')) {
|
|
53
|
-
console.log('📄 Processing injected CSS pattern 1 in:', file);
|
|
54
|
-
updatedContent = updatedContent.replace(
|
|
55
|
-
/(\*,\\n::before,\\n::after)/g,
|
|
56
|
-
'.au-root *,\\n.au-root ::before,\\n.au-root ::after'
|
|
57
|
-
);
|
|
58
|
-
updated = true;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Pattern 2: *,::before,::after (without newlines)
|
|
62
|
-
if (updatedContent.includes('*,::before,::after')) {
|
|
63
|
-
console.log('📄 Processing injected CSS pattern 2 in:', file);
|
|
64
|
-
updatedContent = updatedContent.replace(
|
|
65
|
-
/(\*,::before,::after)/g,
|
|
66
|
-
'.au-root *,.au-root ::before,.au-root ::after'
|
|
67
|
-
);
|
|
68
|
-
updated = true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Pattern 3: standalone * selector (for custom base styles)
|
|
72
|
-
if (updatedContent.includes('\\* {')) {
|
|
73
|
-
console.log('📄 Processing standalone * selector in:', file);
|
|
74
|
-
updatedContent = updatedContent.replace(
|
|
75
|
-
/(\\\* \{[^}]*\})/g,
|
|
76
|
-
(match) => match.replace('\\* {', '.au-root * {')
|
|
77
|
-
);
|
|
78
|
-
updated = true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (updated) {
|
|
82
|
-
fs.writeFileSync(filePath, updatedContent);
|
|
83
|
-
console.log('✅ Injected CSS selectors updated with .au-root prefix');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Run the processing
|
|
90
|
-
processCssFiles();
|
|
91
|
-
processInjectedCss();
|
package/scripts/sync-registry.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
|
|
3
|
-
import fs from "fs/promises";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { watch } from "fs";
|
|
6
|
-
|
|
7
|
-
const UI_REGISTRY_PATH = "../ui/registry";
|
|
8
|
-
const SYNCED_COMPONENTS_PATH = "./src/libraries/react/components";
|
|
9
|
-
|
|
10
|
-
interface ComponentConfig {
|
|
11
|
-
syncedName: string;
|
|
12
|
-
registryName: string;
|
|
13
|
-
dependencies?: string[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const COMPONENTS: ComponentConfig[] = [
|
|
17
|
-
{
|
|
18
|
-
syncedName: "attach-dialog",
|
|
19
|
-
registryName: "attach-dialog",
|
|
20
|
-
dependencies: ["attach-content"],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
syncedName: "check-dialog",
|
|
24
|
-
registryName: "check-dialog",
|
|
25
|
-
dependencies: ["check-content"],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
syncedName: "pricing-table",
|
|
29
|
-
registryName: "pricing-table",
|
|
30
|
-
dependencies: ["pricing-table-content"],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Remove 'au-' prefixes from Tailwind classes
|
|
36
|
-
*/
|
|
37
|
-
function removeAuPrefixes(content: string): string {
|
|
38
|
-
// Replace all occurrences of 'au-' with empty string in className attributes
|
|
39
|
-
return content.replace(/au-/g, "");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Transform imports from synced format to registry format
|
|
44
|
-
*/
|
|
45
|
-
function transformImportsToRegistry(content: string): string {
|
|
46
|
-
// Transform path aliases back to autumn-js imports
|
|
47
|
-
content = content.replace(/from ["']@\/index["']/g, 'from "autumn-js/react"');
|
|
48
|
-
content = content.replace(/from ["']@sdk["']/g, 'from "autumn-js"');
|
|
49
|
-
|
|
50
|
-
// Transform relative lib imports to registry format (but NOT utils)
|
|
51
|
-
content = content.replace(
|
|
52
|
-
/from ["'].\/lib\/(?!utils)([^"']+)["']/g,
|
|
53
|
-
'from "@/registry/$COMPONENT_NAME/lib/$1"'
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
// Transform synced component imports back to registry format
|
|
57
|
-
content = content.replace(
|
|
58
|
-
/from ["']..\/([^\/]+)\/\1-synced["']/g,
|
|
59
|
-
'from "@/registry/$1/$1"'
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// Remove loading styles import and replace with CSS classes
|
|
63
|
-
if (content.includes('from "@/utils/inject-styles"')) {
|
|
64
|
-
// Remove the import line
|
|
65
|
-
content = content.replace(/import\s+{[^}]*loadingStyles[^}]*}\s+from\s+["']@\/utils\/inject-styles["'];?\s*\n/g, '');
|
|
66
|
-
|
|
67
|
-
// Replace inline styles with CSS classes
|
|
68
|
-
content = content.replace(/style={loadingStyles}/g, 'className="w-full h-full flex justify-center items-center min-h-[300px]"');
|
|
69
|
-
content = content.replace(/style={spinnerStyles}/g, 'className="w-6 h-6 text-zinc-400 animate-spin"');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Keep @/lib/utils and @/components/ui imports as-is
|
|
73
|
-
|
|
74
|
-
return content;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Sync a single component from synced version to registry
|
|
79
|
-
*/
|
|
80
|
-
async function syncComponentToRegistry(config: ComponentConfig): Promise<void> {
|
|
81
|
-
const syncedDir = path.join(SYNCED_COMPONENTS_PATH, config.syncedName);
|
|
82
|
-
const registryDir = path.join(UI_REGISTRY_PATH, config.registryName);
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
// Read the synced component file
|
|
86
|
-
const syncedFilePath = path.join(syncedDir, `${config.syncedName}-synced.tsx`);
|
|
87
|
-
const syncedContent = await fs.readFile(syncedFilePath, "utf-8");
|
|
88
|
-
|
|
89
|
-
// Transform content: remove au- prefixes and transform imports
|
|
90
|
-
let transformedContent = removeAuPrefixes(syncedContent);
|
|
91
|
-
transformedContent = transformImportsToRegistry(transformedContent);
|
|
92
|
-
|
|
93
|
-
// Replace the placeholder with actual component name
|
|
94
|
-
transformedContent = transformedContent.replace(/\$COMPONENT_NAME/g, config.registryName);
|
|
95
|
-
|
|
96
|
-
// Determine target path (handle subdirectory structure)
|
|
97
|
-
let targetFilePath = path.join(registryDir, `${config.registryName}.tsx`);
|
|
98
|
-
|
|
99
|
-
// Check if registry uses subdirectory structure
|
|
100
|
-
const subDirPath = path.join(registryDir, config.registryName, `${config.registryName}.tsx`);
|
|
101
|
-
try {
|
|
102
|
-
await fs.access(subDirPath);
|
|
103
|
-
targetFilePath = subDirPath;
|
|
104
|
-
} catch {
|
|
105
|
-
// Use direct path
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Write the transformed content
|
|
109
|
-
await fs.writeFile(targetFilePath, transformedContent);
|
|
110
|
-
|
|
111
|
-
// Sync lib dependencies if they exist
|
|
112
|
-
if (config.dependencies) {
|
|
113
|
-
const syncedLibDir = path.join(syncedDir, "lib");
|
|
114
|
-
const registryLibDir = path.join(registryDir, "lib");
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
for (const dep of config.dependencies) {
|
|
118
|
-
const syncedDepPath = path.join(syncedLibDir, `${dep}.tsx`);
|
|
119
|
-
const syncedDepContent = await fs.readFile(syncedDepPath, "utf-8");
|
|
120
|
-
|
|
121
|
-
// Transform the dependency content
|
|
122
|
-
let transformedDepContent = removeAuPrefixes(syncedDepContent);
|
|
123
|
-
transformedDepContent = transformImportsToRegistry(transformedDepContent);
|
|
124
|
-
transformedDepContent = transformedDepContent.replace(/\$COMPONENT_NAME/g, config.registryName);
|
|
125
|
-
|
|
126
|
-
await fs.writeFile(
|
|
127
|
-
path.join(registryLibDir, `${dep}.tsx`),
|
|
128
|
-
transformedDepContent
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.warn(`No lib directory found for synced ${config.syncedName}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
console.log(`✅ Synced ${config.syncedName} -> registry/${config.registryName}`);
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error(`❌ Failed to sync ${config.syncedName}:`, error);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Sync all components to registry
|
|
144
|
-
*/
|
|
145
|
-
async function syncAllToRegistry(): Promise<void> {
|
|
146
|
-
console.log("🔄 Syncing components to registry...");
|
|
147
|
-
|
|
148
|
-
for (const component of COMPONENTS) {
|
|
149
|
-
await syncComponentToRegistry(component);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
console.log("🎉 Registry sync complete!");
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Watch synced components for changes
|
|
157
|
-
*/
|
|
158
|
-
function watchSyncedComponents(): void {
|
|
159
|
-
console.log("👀 Watching synced components for changes...");
|
|
160
|
-
|
|
161
|
-
// Watch each component directory
|
|
162
|
-
COMPONENTS.forEach(config => {
|
|
163
|
-
const componentDir = path.join(SYNCED_COMPONENTS_PATH, config.syncedName);
|
|
164
|
-
|
|
165
|
-
watch(componentDir, { recursive: true }, (_: any, filename: any) => {
|
|
166
|
-
if (filename && filename.endsWith(".tsx")) {
|
|
167
|
-
console.log(`📝 Detected change in ${config.syncedName}: ${filename}`);
|
|
168
|
-
syncComponentToRegistry(config).catch(console.error);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// CLI interface
|
|
175
|
-
const command = process.argv[2];
|
|
176
|
-
|
|
177
|
-
switch (command) {
|
|
178
|
-
case "sync":
|
|
179
|
-
syncAllToRegistry().catch(console.error);
|
|
180
|
-
break;
|
|
181
|
-
case "watch":
|
|
182
|
-
syncAllToRegistry()
|
|
183
|
-
.then(() => watchSyncedComponents())
|
|
184
|
-
.catch(console.error);
|
|
185
|
-
break;
|
|
186
|
-
default:
|
|
187
|
-
console.log("Usage: tsx sync-registry.ts [sync|watch]");
|
|
188
|
-
console.log(" sync - Sync synced components to registry");
|
|
189
|
-
console.log(" watch - Sync and watch synced components for changes");
|
|
190
|
-
}
|