@digilogiclabs/create-saas-app 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/generators/template-generator.d.ts.map +1 -1
- package/dist/generators/template-generator.js +2 -11
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/templates/mobile/base/template/App.tsx +8 -13
- package/dist/templates/mobile/base/template/app/(auth)/login.tsx +1 -2
- package/dist/templates/mobile/base/template/app/(auth)/signup.tsx +1 -2
- package/dist/templates/mobile/base/template/app/checkout.tsx +2 -2
- package/dist/templates/mobile/base/template/package.json +0 -2
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +4 -14
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments/template/package.json +1 -3
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +4 -14
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai/template/package.json +0 -2
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +5 -15
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -2
- package/dist/templates/web/ai-platform/template/package.json +0 -2
- package/dist/templates/web/base/template/package.json +0 -2
- package/dist/templates/web/base/template/src/app/checkout/page.tsx +2 -2
- package/dist/templates/web/base/template/src/app/dashboard/page.tsx +1 -1
- package/dist/templates/web/base/template/src/app/login/page.tsx +1 -2
- package/dist/templates/web/base/template/src/app/page.tsx +1 -1
- package/dist/templates/web/base/template/src/app/signup/page.tsx +1 -2
- package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +14 -19
- package/dist/templates/web/base/template/src/components/shared/header.tsx +1 -1
- package/dist/templates/web/base/template/src/lib/platform.ts +0 -25
- package/dist/templates/web/base/template/src/test/setup.ts +3 -8
- package/dist/templates/web/iot-dashboard/template/package.json +0 -1
- package/dist/templates/web/marketplace/template/package.json +0 -2
- package/dist/templates/web/micro-saas/template/package.json +0 -1
- package/dist/templates/web/ui-auth/template/.claude +1 -1
- package/dist/templates/web/ui-auth/template/context.md +5 -5
- package/dist/templates/web/ui-auth/template/package.json +0 -1
- package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +3 -3
- package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +1 -1
- package/dist/templates/web/ui-auth/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +1 -1
- package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +3 -3
- package/dist/templates/web/ui-auth/template/src/lib/platform.ts +0 -16
- package/dist/templates/web/ui-auth/template/src/test/setup.ts +3 -8
- package/dist/templates/web/ui-auth-ai/template/package.json +0 -1
- package/dist/templates/web/ui-auth-payments/template/package.json +0 -2
- package/dist/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +3 -3
- package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +7 -10
- package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/lib/platform.ts +0 -25
- package/dist/templates/web/ui-auth-payments/template/src/test/setup.ts +3 -8
- package/dist/templates/web/ui-auth-payments-ai/template/.claude +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/context.md +11 -11
- package/dist/templates/web/ui-auth-payments-ai/template/package.json +0 -2
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +3 -3
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +7 -10
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/platform.ts +0 -18
- package/dist/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +3 -8
- package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -2
- package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/package.json +0 -2
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +7 -10
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +3 -8
- package/dist/templates/web/ui-auth-payments-video/template/package.json +0 -2
- package/dist/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +2 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +7 -10
- package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/test/setup.ts +3 -8
- package/dist/templates/web/ui-only/template/src/test/setup.ts +3 -8
- package/package.json +1 -1
- package/src/templates/mobile/base/template/App.tsx +8 -13
- package/src/templates/mobile/base/template/app/(auth)/login.tsx +1 -2
- package/src/templates/mobile/base/template/app/(auth)/signup.tsx +1 -2
- package/src/templates/mobile/base/template/app/checkout.tsx +2 -2
- package/src/templates/mobile/base/template/package.json +0 -2
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +4 -14
- package/src/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments/template/package.json +1 -3
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +4 -14
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +1 -1
- package/src/templates/mobile/ui-auth-payments-ai/template/package.json +0 -2
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +5 -15
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -2
- package/src/templates/web/ai-platform/template/package.json +0 -2
- package/src/templates/web/base/template/package.json +0 -2
- package/src/templates/web/base/template/src/app/checkout/page.tsx +2 -2
- package/src/templates/web/base/template/src/app/dashboard/page.tsx +1 -1
- package/src/templates/web/base/template/src/app/login/page.tsx +1 -2
- package/src/templates/web/base/template/src/app/page.tsx +1 -1
- package/src/templates/web/base/template/src/app/signup/page.tsx +1 -2
- package/src/templates/web/base/template/src/components/providers/app-providers.tsx +14 -19
- package/src/templates/web/base/template/src/components/shared/header.tsx +1 -1
- package/src/templates/web/base/template/src/lib/platform.ts +0 -25
- package/src/templates/web/base/template/src/test/setup.ts +3 -8
- package/src/templates/web/iot-dashboard/template/package.json +0 -1
- package/src/templates/web/marketplace/template/package.json +0 -2
- package/src/templates/web/micro-saas/template/package.json +0 -1
- package/src/templates/web/ui-auth/template/.claude +1 -1
- package/src/templates/web/ui-auth/template/context.md +5 -5
- package/src/templates/web/ui-auth/template/package.json +0 -1
- package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +3 -3
- package/src/templates/web/ui-auth/template/src/app/login/page.tsx +1 -1
- package/src/templates/web/ui-auth/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth/template/src/app/signup/page.tsx +1 -1
- package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +3 -3
- package/src/templates/web/ui-auth/template/src/lib/platform.ts +0 -16
- package/src/templates/web/ui-auth/template/src/test/setup.ts +3 -8
- package/src/templates/web/ui-auth-ai/template/package.json +0 -1
- package/src/templates/web/ui-auth-payments/template/package.json +0 -2
- package/src/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +3 -3
- package/src/templates/web/ui-auth-payments/template/src/app/login/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +7 -10
- package/src/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +1 -1
- package/src/templates/web/ui-auth-payments/template/src/lib/platform.ts +0 -25
- package/src/templates/web/ui-auth-payments/template/src/test/setup.ts +3 -8
- package/src/templates/web/ui-auth-payments-ai/template/.claude +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/context.md +11 -11
- package/src/templates/web/ui-auth-payments-ai/template/package.json +0 -2
- package/src/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +3 -3
- package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +7 -10
- package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/platform.ts +0 -18
- package/src/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +3 -8
- package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -2
- package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/package.json +0 -2
- package/src/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +7 -10
- package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +3 -8
- package/src/templates/web/ui-auth-payments-video/template/package.json +0 -2
- package/src/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +2 -1
- package/src/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +7 -10
- package/src/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/test/setup.ts +3 -8
- package/src/templates/web/ui-only/template/src/test/setup.ts +3 -8
- package/src/templates/web/base/template.backup/.env.example +0 -15
- package/src/templates/web/ui-auth/template.backup/.env.example +0 -15
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.backup +0 -391
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.bak +0 -391
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.backup +0 -391
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.bak +0 -391
- package/src/templates/web/ui-only/template.backup/.env.example +0 -15
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
NetworkAwareContent,
|
|
8
8
|
OfflineWrapper
|
|
9
9
|
} from '@digilogiclabs/saas-factory-ui';
|
|
10
|
-
import { AuthProvider } from '@digilogiclabs/saas-factory-auth';
|
|
11
10
|
import { createBrowserClient } from '@supabase/ssr';
|
|
12
11
|
import React from 'react';
|
|
13
12
|
|
|
@@ -54,7 +53,7 @@ export default function SignupPage() {
|
|
|
54
53
|
<SignupForm
|
|
55
54
|
onSubmit={handleSignup}
|
|
56
55
|
onGoogleSignIn={handleGoogleSignup}
|
|
57
|
-
authProvider=
|
|
56
|
+
authProvider="supabase"
|
|
58
57
|
mobileOptimized={true}
|
|
59
58
|
touchFriendly={true}
|
|
60
59
|
/>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import { DLLProvider } from '@digilogiclabs/app-sdk'
|
|
5
5
|
import { ThemeProvider } from 'next-themes'
|
|
6
|
-
import { StripeProvider } from '@digilogiclabs/saas-factory-payments'
|
|
7
6
|
import { Toaster } from '@digilogiclabs/saas-factory-ui'
|
|
8
7
|
import { AppThemeProvider } from './theme-provider'
|
|
9
8
|
|
|
@@ -13,23 +12,19 @@ interface AppProvidersProps {
|
|
|
13
12
|
|
|
14
13
|
export function AppProviders({ children }: AppProvidersProps) {
|
|
15
14
|
return (
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
15
|
+
<DLLProvider>
|
|
16
|
+
<ThemeProvider
|
|
17
|
+
attribute="class"
|
|
18
|
+
defaultTheme="{{defaultTheme}}"
|
|
19
|
+
enableSystem
|
|
20
|
+
disableTransitionOnChange
|
|
21
|
+
storageKey="{{packageName}}-theme"
|
|
19
22
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
>
|
|
27
|
-
<AppThemeProvider themeColor="{{themeColor}}">
|
|
28
|
-
{children}
|
|
29
|
-
<Toaster />
|
|
30
|
-
</AppThemeProvider>
|
|
31
|
-
</ThemeProvider>
|
|
32
|
-
</StripeProvider>
|
|
33
|
-
</AuthProvider>
|
|
23
|
+
<AppThemeProvider themeColor="{{themeColor}}">
|
|
24
|
+
{children}
|
|
25
|
+
<Toaster />
|
|
26
|
+
</AppThemeProvider>
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
</DLLProvider>
|
|
34
29
|
)
|
|
35
30
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Link from 'next/link';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
6
|
import { Button } from '@/components/ui/button';
|
|
7
7
|
import { ThemeToggle } from '@/components/ui/theme-toggle';
|
|
8
8
|
import { ResponsiveHeader, MobileNavigation } from '@digilogiclabs/saas-factory-ui';
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { createPlatform, createPlatformAsync, type IPlatform } from '@digilogiclabs/platform-core';
|
|
18
|
-
import { setPlatform as setAuthPlatform } from '@digilogiclabs/saas-factory-auth';
|
|
19
|
-
import { setPlatform as setPaymentsPlatform } from '@digilogiclabs/saas-factory-payments';
|
|
20
18
|
|
|
21
19
|
// Singleton platform instance
|
|
22
20
|
let platformInstance: IPlatform | null = null;
|
|
@@ -36,7 +34,6 @@ let platformInstance: IPlatform | null = null;
|
|
|
36
34
|
export function getPlatform(): IPlatform {
|
|
37
35
|
if (!platformInstance) {
|
|
38
36
|
platformInstance = createPlatform();
|
|
39
|
-
initializePackageIntegrations(platformInstance);
|
|
40
37
|
}
|
|
41
38
|
return platformInstance;
|
|
42
39
|
}
|
|
@@ -61,32 +58,10 @@ export async function initializePlatform(): Promise<IPlatform> {
|
|
|
61
58
|
// Use createPlatformAsync for production adapters
|
|
62
59
|
// Falls back to memory adapters if env vars are not set
|
|
63
60
|
platformInstance = await createPlatformAsync();
|
|
64
|
-
initializePackageIntegrations(platformInstance);
|
|
65
61
|
|
|
66
62
|
return platformInstance;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
/**
|
|
70
|
-
* Initialize package integrations with platform services
|
|
71
|
-
*/
|
|
72
|
-
function initializePackageIntegrations(platform: IPlatform): void {
|
|
73
|
-
// Connect saas-factory-auth to platform-core
|
|
74
|
-
// Enables: logging, metrics, and email for auth events
|
|
75
|
-
setAuthPlatform({
|
|
76
|
-
email: platform.email,
|
|
77
|
-
logger: platform.logger,
|
|
78
|
-
metrics: platform.metrics,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Connect saas-factory-payments to platform-core
|
|
82
|
-
// Enables: logging, metrics, and caching for payment events
|
|
83
|
-
setPaymentsPlatform({
|
|
84
|
-
logger: platform.logger,
|
|
85
|
-
metrics: platform.metrics,
|
|
86
|
-
cache: platform.cache,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
65
|
/**
|
|
91
66
|
* Reset platform instance (useful for testing)
|
|
92
67
|
*/
|
|
@@ -15,8 +15,8 @@ vi.mock('next/navigation', () => ({
|
|
|
15
15
|
usePathname: () => '/',
|
|
16
16
|
}))
|
|
17
17
|
|
|
18
|
-
// Mock
|
|
19
|
-
vi.mock('@digilogiclabs/
|
|
18
|
+
// Mock App SDK (optional - only if testing auth/payment components)
|
|
19
|
+
vi.mock('@digilogiclabs/app-sdk', () => ({
|
|
20
20
|
useAuth: () => ({
|
|
21
21
|
user: null,
|
|
22
22
|
loading: false,
|
|
@@ -26,18 +26,13 @@ vi.mock('@digilogiclabs/saas-factory-auth', () => ({
|
|
|
26
26
|
signOut: vi.fn(),
|
|
27
27
|
signInWithOAuth: vi.fn(),
|
|
28
28
|
}),
|
|
29
|
-
AuthProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
30
|
-
}))
|
|
31
|
-
|
|
32
|
-
// Mock SaaS Factory Payments (optional - only if testing payment components)
|
|
33
|
-
vi.mock('@digilogiclabs/saas-factory-payments', () => ({
|
|
34
29
|
usePayments: () => ({
|
|
35
30
|
createCheckoutSession: vi.fn(),
|
|
36
31
|
createPortalSession: vi.fn(),
|
|
37
32
|
subscription: null,
|
|
38
33
|
loading: false,
|
|
39
34
|
}),
|
|
40
|
-
|
|
35
|
+
DLLProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
41
36
|
}))
|
|
42
37
|
|
|
43
38
|
// Global test utilities
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
"react-dom": "^19.0.0",
|
|
19
19
|
"@digilogiclabs/platform-core": "^1.13.0",
|
|
20
20
|
"@digilogiclabs/app-sdk": "^1.0.0",
|
|
21
|
-
"@digilogiclabs/saas-factory-auth": "^1.0.7",
|
|
22
|
-
"@digilogiclabs/saas-factory-payments": "^1.2.9",
|
|
23
21
|
"@digilogiclabs/saas-factory-ui": "^1.4.0",
|
|
24
22
|
"stripe": "^16.12.0",
|
|
25
23
|
"@stripe/react-stripe-js": "^2.8.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"*.log",
|
|
18
18
|
".claude"
|
|
19
19
|
],
|
|
20
|
-
"instructions": "You are helping develop an Authentication Platform using Next.js 15, TypeScript, and Digi Logic Labs packages.\n\n## Project Architecture\n- **Framework**: Next.js 15.3 with App Router\n- **Database**: Supabase (PostgreSQL with real-time features)\n- **Styling**: Tailwind CSS v4 with glassmorphism design system\n- **Authentication**: Supabase Auth with @digilogiclabs/
|
|
20
|
+
"instructions": "You are helping develop an Authentication Platform using Next.js 15, TypeScript, and Digi Logic Labs packages.\n\n## Project Architecture\n- **Framework**: Next.js 15.3 with App Router\n- **Database**: Supabase (PostgreSQL with real-time features)\n- **Styling**: Tailwind CSS v4 with glassmorphism design system\n- **Authentication**: Supabase Auth with @digilogiclabs/app-sdk\n\n## Key Packages\n- **@digilogiclabs/app-sdk**: Authentication components and hooks with Supabase integration\n- **@digilogiclabs/saas-factory-ui**: Modern UI components with glassmorphism and responsive design\n\n## Development Guidelines\n1. Follow Next.js 15 best practices with Server Components by default\n2. Use TypeScript strictly - all components should be typed\n3. Implement proper error boundaries and loading states\n4. Follow the glassmorphism design system from saas-factory-ui\n5. Use Server Actions for mutations and API routes for complex logic\n6. Always check authentication state with useAuth hook\n\n## File Organization\n- Components in /src/components with feature-based folders\n- Server actions in /src/server/actions\n- API routes in /src/app/api\n- Database queries in /src/server/queries\n- Types in /src/types\n\n## Testing\n- Use Vitest for unit tests\n- Test business logic and error states\n- Mock external services (Supabase)\n\nRemember to consult the context.md file for detailed package documentation and examples."
|
|
21
21
|
}
|
|
@@ -12,11 +12,11 @@ This project is an Authentication Platform built with modern technologies and Di
|
|
|
12
12
|
|
|
13
13
|
### Package Integration
|
|
14
14
|
|
|
15
|
-
#### @digilogiclabs/
|
|
16
|
-
|
|
15
|
+
#### @digilogiclabs/app-sdk
|
|
16
|
+
Unified application SDK with auth and payments hooks
|
|
17
17
|
|
|
18
|
-
**Key Exports**: useAuth,
|
|
19
|
-
**Documentation**: https://docs.digilogiclabs.com/packages/
|
|
18
|
+
**Key Exports**: useAuth, usePayments, DLLProvider, usePlatform
|
|
19
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/app-sdk
|
|
20
20
|
|
|
21
21
|
#### @digilogiclabs/saas-factory-ui
|
|
22
22
|
Modern UI components with glassmorphism and responsive design
|
|
@@ -42,7 +42,7 @@ Key tables:
|
|
|
42
42
|
|
|
43
43
|
### Authentication Flow
|
|
44
44
|
```typescript
|
|
45
|
-
import { useAuth } from '@digilogiclabs/
|
|
45
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
46
46
|
|
|
47
47
|
export function ProtectedComponent() {
|
|
48
48
|
const { user, loading } = useAuth()
|
|
@@ -201,7 +201,7 @@ ${hasVideo ? '- **video_content**: Generated video files and metadata' : ''}
|
|
|
201
201
|
|
|
202
202
|
### Authentication Flow
|
|
203
203
|
${hasAuth ? `\`\`\`typescript
|
|
204
|
-
import { useAuth } from '@digilogiclabs/
|
|
204
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
205
205
|
|
|
206
206
|
export function ProtectedComponent() {
|
|
207
207
|
const { user, loading } = useAuth()
|
|
@@ -237,10 +237,10 @@ export function ExampleComponent() {
|
|
|
237
237
|
|
|
238
238
|
${hasPayments ? `### Payment Integration
|
|
239
239
|
\`\`\`typescript
|
|
240
|
-
import {
|
|
240
|
+
import { usePayments } from '@digilogiclabs/app-sdk'
|
|
241
241
|
|
|
242
242
|
export function CheckoutPage() {
|
|
243
|
-
const { createCheckoutSession, loading } =
|
|
243
|
+
const { createCheckoutSession, loading } = usePayments()
|
|
244
244
|
|
|
245
245
|
const handlePayment = async (priceId: string) => {
|
|
246
246
|
const { url } = await createCheckoutSession({ priceId })
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
|
|
8
8
|
export default function LoginPage() {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useOfflineState
|
|
15
15
|
} from '@digilogiclabs/saas-factory-ui'
|
|
16
16
|
import { ArrowRight, Zap, Shield, Rocket, CheckCircle, LogOut, User, Wifi, WifiOff, Smartphone } from 'lucide-react'
|
|
17
|
-
import { useAuth } from '@digilogiclabs/
|
|
17
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
18
18
|
import Link from 'next/link'
|
|
19
19
|
|
|
20
20
|
export default function Home() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
|
|
8
8
|
export default function SignupPage() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { ThemeProvider } from 'next-themes'
|
|
5
|
-
import {
|
|
5
|
+
import { DLLProvider } from '@digilogiclabs/app-sdk'
|
|
6
6
|
import { Toaster } from '@digilogiclabs/saas-factory-ui'
|
|
7
7
|
import { AppThemeProvider } from './theme-provider'
|
|
8
8
|
|
|
@@ -19,12 +19,12 @@ export function AppProviders({ children }: AppProvidersProps) {
|
|
|
19
19
|
disableTransitionOnChange
|
|
20
20
|
storageKey="{{packageName}}-theme"
|
|
21
21
|
>
|
|
22
|
-
<
|
|
22
|
+
<DLLProvider>
|
|
23
23
|
<AppThemeProvider themeColor="{{themeColor}}">
|
|
24
24
|
{children}
|
|
25
25
|
<Toaster />
|
|
26
26
|
</AppThemeProvider>
|
|
27
|
-
</
|
|
27
|
+
</DLLProvider>
|
|
28
28
|
</ThemeProvider>
|
|
29
29
|
)
|
|
30
30
|
}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { createPlatform, createPlatformAsync, type IPlatform } from '@digilogiclabs/platform-core';
|
|
18
|
-
import { setPlatform as setAuthPlatform } from '@digilogiclabs/saas-factory-auth';
|
|
19
18
|
|
|
20
19
|
// Singleton platform instance
|
|
21
20
|
let platformInstance: IPlatform | null = null;
|
|
@@ -35,7 +34,6 @@ let platformInstance: IPlatform | null = null;
|
|
|
35
34
|
export function getPlatform(): IPlatform {
|
|
36
35
|
if (!platformInstance) {
|
|
37
36
|
platformInstance = createPlatform();
|
|
38
|
-
initializePackageIntegrations(platformInstance);
|
|
39
37
|
}
|
|
40
38
|
return platformInstance;
|
|
41
39
|
}
|
|
@@ -60,24 +58,10 @@ export async function initializePlatform(): Promise<IPlatform> {
|
|
|
60
58
|
// Use createPlatformAsync for production adapters
|
|
61
59
|
// Falls back to memory adapters if env vars are not set
|
|
62
60
|
platformInstance = await createPlatformAsync();
|
|
63
|
-
initializePackageIntegrations(platformInstance);
|
|
64
61
|
|
|
65
62
|
return platformInstance;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
/**
|
|
69
|
-
* Initialize package integrations with platform services
|
|
70
|
-
*/
|
|
71
|
-
function initializePackageIntegrations(platform: IPlatform): void {
|
|
72
|
-
// Connect saas-factory-auth to platform-core
|
|
73
|
-
// Enables: logging, metrics, and email for auth events
|
|
74
|
-
setAuthPlatform({
|
|
75
|
-
email: platform.email,
|
|
76
|
-
logger: platform.logger,
|
|
77
|
-
metrics: platform.metrics,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
65
|
/**
|
|
82
66
|
* Reset platform instance (useful for testing)
|
|
83
67
|
*/
|
|
@@ -15,8 +15,8 @@ vi.mock('next/navigation', () => ({
|
|
|
15
15
|
usePathname: () => '/',
|
|
16
16
|
}))
|
|
17
17
|
|
|
18
|
-
// Mock
|
|
19
|
-
vi.mock('@digilogiclabs/
|
|
18
|
+
// Mock App SDK (optional - only if testing auth/payment components)
|
|
19
|
+
vi.mock('@digilogiclabs/app-sdk', () => ({
|
|
20
20
|
useAuth: () => ({
|
|
21
21
|
user: null,
|
|
22
22
|
loading: false,
|
|
@@ -26,18 +26,13 @@ vi.mock('@digilogiclabs/saas-factory-auth', () => ({
|
|
|
26
26
|
signOut: vi.fn(),
|
|
27
27
|
signInWithOAuth: vi.fn(),
|
|
28
28
|
}),
|
|
29
|
-
AuthProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
30
|
-
}))
|
|
31
|
-
|
|
32
|
-
// Mock SaaS Factory Payments (optional - only if testing payment components)
|
|
33
|
-
vi.mock('@digilogiclabs/saas-factory-payments', () => ({
|
|
34
29
|
usePayments: () => ({
|
|
35
30
|
createCheckoutSession: vi.fn(),
|
|
36
31
|
createPortalSession: vi.fn(),
|
|
37
32
|
subscription: null,
|
|
38
33
|
loading: false,
|
|
39
34
|
}),
|
|
40
|
-
|
|
35
|
+
DLLProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
41
36
|
}))
|
|
42
37
|
|
|
43
38
|
// Global test utilities
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
"react-dom": "^19.0.0",
|
|
20
20
|
"@digilogiclabs/platform-core": "^1.13.0",
|
|
21
21
|
"@digilogiclabs/saas-factory-ui": "^1.4.0",
|
|
22
|
-
"@digilogiclabs/saas-factory-auth": "^1.0.6",
|
|
23
|
-
"@digilogiclabs/saas-factory-payments": "^1.2.8",
|
|
24
22
|
"stripe": "^14.0.0",
|
|
25
23
|
"@stripe/react-stripe-js": "^2.0.0",
|
|
26
24
|
"@stripe/stripe-js": "^2.0.0",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { usePayments
|
|
4
|
+
import { usePayments } from '@digilogiclabs/app-sdk';
|
|
5
|
+
import { formatCurrency, formatDate } from '@/lib/utils';
|
|
5
6
|
import { Button, Card } from '@digilogiclabs/saas-factory-ui';
|
|
6
7
|
|
|
7
8
|
export default function BillingPage() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { usePayments
|
|
4
|
+
import { usePayments } from '@digilogiclabs/app-sdk';
|
|
5
|
+
import { formatCurrency } from '@/lib/utils';
|
|
5
6
|
import {
|
|
6
7
|
Button,
|
|
7
8
|
Card,
|
|
@@ -201,7 +201,7 @@ ${hasVideo ? '- **video_content**: Generated video files and metadata' : ''}
|
|
|
201
201
|
|
|
202
202
|
### Authentication Flow
|
|
203
203
|
${hasAuth ? `\`\`\`typescript
|
|
204
|
-
import { useAuth } from '@digilogiclabs/
|
|
204
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
205
205
|
|
|
206
206
|
export function ProtectedComponent() {
|
|
207
207
|
const { user, loading } = useAuth()
|
|
@@ -237,10 +237,10 @@ export function ExampleComponent() {
|
|
|
237
237
|
|
|
238
238
|
${hasPayments ? `### Payment Integration
|
|
239
239
|
\`\`\`typescript
|
|
240
|
-
import {
|
|
240
|
+
import { usePayments } from '@digilogiclabs/app-sdk'
|
|
241
241
|
|
|
242
242
|
export function CheckoutPage() {
|
|
243
|
-
const { createCheckoutSession, loading } =
|
|
243
|
+
const { createCheckoutSession, loading } = usePayments()
|
|
244
244
|
|
|
245
245
|
const handlePayment = async (priceId: string) => {
|
|
246
246
|
const { url } = await createCheckoutSession({ priceId })
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
|
|
8
8
|
export default function LoginPage() {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useOfflineState
|
|
17
17
|
} from '@digilogiclabs/saas-factory-ui'
|
|
18
18
|
import { ArrowRight, Zap, Shield, Rocket, CheckCircle, LogOut, User, Wifi, WifiOff, CreditCard, Smartphone } from 'lucide-react'
|
|
19
|
-
import { useAuth } from '@digilogiclabs/
|
|
19
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
20
20
|
import Link from 'next/link'
|
|
21
21
|
import { useState } from 'react'
|
|
22
22
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
|
|
8
8
|
export default function SignupPage() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Button } from '@digilogiclabs/saas-factory-ui'
|
|
4
4
|
import { LogOut, User } from 'lucide-react'
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
6
6
|
import Link from 'next/link'
|
|
7
7
|
|
|
8
8
|
export function AuthStatus() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, useActionState } from 'react'
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui'
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
6
6
|
import { useRouter } from 'next/navigation'
|
|
7
7
|
import { signInAction } from '@/lib/actions/auth'
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, useActionState } from 'react'
|
|
4
4
|
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui'
|
|
5
|
-
import { useAuth } from '@digilogiclabs/
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk'
|
|
6
6
|
import { useRouter } from 'next/navigation'
|
|
7
7
|
import { signUpAction } from '@/lib/actions/auth'
|
|
8
8
|
|
package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { ThemeProvider } from 'next-themes'
|
|
5
|
-
import {
|
|
6
|
-
import { PaymentsProvider } from '@digilogiclabs/saas-factory-payments'
|
|
5
|
+
import { DLLProvider } from '@digilogiclabs/app-sdk'
|
|
7
6
|
import { Toaster } from '@digilogiclabs/saas-factory-ui'
|
|
8
7
|
import { AppThemeProvider } from './theme-provider'
|
|
9
8
|
|
|
@@ -20,14 +19,12 @@ export function AppProviders({ children }: AppProvidersProps) {
|
|
|
20
19
|
disableTransitionOnChange
|
|
21
20
|
storageKey="{{packageName}}-theme"
|
|
22
21
|
>
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</PaymentsProvider>
|
|
30
|
-
</AuthProvider>
|
|
22
|
+
<DLLProvider>
|
|
23
|
+
<AppThemeProvider themeColor="{{themeColor}}">
|
|
24
|
+
{children}
|
|
25
|
+
<Toaster />
|
|
26
|
+
</AppThemeProvider>
|
|
27
|
+
</DLLProvider>
|
|
31
28
|
</ThemeProvider>
|
|
32
29
|
)
|
|
33
30
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import { LogOut, CreditCard, User, Settings, Home, Menu, X, Info } from 'lucide-react';
|
|
6
|
-
import { useAuth } from '@digilogiclabs/
|
|
6
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
7
7
|
import {
|
|
8
8
|
ResponsiveHeader,
|
|
9
9
|
MobileNavigation,
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { createPlatform, createPlatformAsync, type IPlatform } from '@digilogiclabs/platform-core';
|
|
18
|
-
import { setPlatform as setAuthPlatform } from '@digilogiclabs/saas-factory-auth';
|
|
19
|
-
import { setPlatform as setPaymentsPlatform } from '@digilogiclabs/saas-factory-payments';
|
|
20
18
|
|
|
21
19
|
// Singleton platform instance
|
|
22
20
|
let platformInstance: IPlatform | null = null;
|
|
@@ -36,7 +34,6 @@ let platformInstance: IPlatform | null = null;
|
|
|
36
34
|
export function getPlatform(): IPlatform {
|
|
37
35
|
if (!platformInstance) {
|
|
38
36
|
platformInstance = createPlatform();
|
|
39
|
-
initializePackageIntegrations(platformInstance);
|
|
40
37
|
}
|
|
41
38
|
return platformInstance;
|
|
42
39
|
}
|
|
@@ -61,32 +58,10 @@ export async function initializePlatform(): Promise<IPlatform> {
|
|
|
61
58
|
// Use createPlatformAsync for production adapters
|
|
62
59
|
// Falls back to memory adapters if env vars are not set
|
|
63
60
|
platformInstance = await createPlatformAsync();
|
|
64
|
-
initializePackageIntegrations(platformInstance);
|
|
65
61
|
|
|
66
62
|
return platformInstance;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
/**
|
|
70
|
-
* Initialize package integrations with platform services
|
|
71
|
-
*/
|
|
72
|
-
function initializePackageIntegrations(platform: IPlatform): void {
|
|
73
|
-
// Connect saas-factory-auth to platform-core
|
|
74
|
-
// Enables: logging, metrics, and email for auth events
|
|
75
|
-
setAuthPlatform({
|
|
76
|
-
email: platform.email,
|
|
77
|
-
logger: platform.logger,
|
|
78
|
-
metrics: platform.metrics,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Connect saas-factory-payments to platform-core
|
|
82
|
-
// Enables: logging, metrics, and caching for payment events
|
|
83
|
-
setPaymentsPlatform({
|
|
84
|
-
logger: platform.logger,
|
|
85
|
-
metrics: platform.metrics,
|
|
86
|
-
cache: platform.cache,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
65
|
/**
|
|
91
66
|
* Reset platform instance (useful for testing)
|
|
92
67
|
*/
|
|
@@ -15,8 +15,8 @@ vi.mock('next/navigation', () => ({
|
|
|
15
15
|
usePathname: () => '/',
|
|
16
16
|
}))
|
|
17
17
|
|
|
18
|
-
// Mock
|
|
19
|
-
vi.mock('@digilogiclabs/
|
|
18
|
+
// Mock App SDK (optional - only if testing auth/payment components)
|
|
19
|
+
vi.mock('@digilogiclabs/app-sdk', () => ({
|
|
20
20
|
useAuth: () => ({
|
|
21
21
|
user: null,
|
|
22
22
|
loading: false,
|
|
@@ -26,18 +26,13 @@ vi.mock('@digilogiclabs/saas-factory-auth', () => ({
|
|
|
26
26
|
signOut: vi.fn(),
|
|
27
27
|
signInWithOAuth: vi.fn(),
|
|
28
28
|
}),
|
|
29
|
-
AuthProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
30
|
-
}))
|
|
31
|
-
|
|
32
|
-
// Mock SaaS Factory Payments (optional - only if testing payment components)
|
|
33
|
-
vi.mock('@digilogiclabs/saas-factory-payments', () => ({
|
|
34
29
|
usePayments: () => ({
|
|
35
30
|
createCheckoutSession: vi.fn(),
|
|
36
31
|
createPortalSession: vi.fn(),
|
|
37
32
|
subscription: null,
|
|
38
33
|
loading: false,
|
|
39
34
|
}),
|
|
40
|
-
|
|
35
|
+
DLLProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
41
36
|
}))
|
|
42
37
|
|
|
43
38
|
// Global test utilities
|