@dotted-labs/ngx-supabase-stripe 0.1.8 → 0.1.10
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/database.types.d.ts +187 -20
- package/fesm2022/dotted-labs-ngx-supabase-stripe.mjs +64 -35
- package/fesm2022/dotted-labs-ngx-supabase-stripe.mjs.map +1 -1
- package/lib/components/customer/subscriptions/subscriptions-list/subscription-item/subscription-item.component.d.ts +1 -1
- package/lib/components/customer/subscriptions/subscriptions.component.d.ts +1 -0
- package/lib/components/embedded-checkout/embedded-checkout.component.d.ts +4 -3
- package/lib/components/embedded-checkout/return-page/return-page.component.d.ts +3 -3
- package/lib/components/embedded-subscription/embedded-subscription.component.d.ts +2 -1
- package/lib/components/embedded-subscription/return-page/subscription-return-page.component.d.ts +32 -2
- package/lib/config/supabase.config.d.ts +4 -0
- package/lib/pages/customer/customer.component.d.ts +1 -0
- package/lib/services/stripe-client.service.d.ts +8 -0
- package/lib/services/supabase-client.service.d.ts +831 -30
- package/lib/store/checkout.store.d.ts +5 -3
- package/lib/store/customer.store.d.ts +1 -0
- package/lib/store/subscriptions.store.d.ts +2 -1
- package/package.json +1 -1
package/database.types.d.ts
CHANGED
|
@@ -10,6 +10,34 @@ export type Database = {
|
|
|
10
10
|
[_ in never]: never;
|
|
11
11
|
};
|
|
12
12
|
Functions: {
|
|
13
|
+
get_stripe_checkout_session: {
|
|
14
|
+
Args: {
|
|
15
|
+
session_id: string;
|
|
16
|
+
};
|
|
17
|
+
Returns: {
|
|
18
|
+
id: string;
|
|
19
|
+
customer: string;
|
|
20
|
+
payment_intent: string;
|
|
21
|
+
subscription: string;
|
|
22
|
+
attrs: Json;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
get_stripe_community_products: {
|
|
26
|
+
Args: {
|
|
27
|
+
p_community_id: string;
|
|
28
|
+
};
|
|
29
|
+
Returns: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
price: number;
|
|
34
|
+
image_url: string;
|
|
35
|
+
video: string;
|
|
36
|
+
payment_provider_product_id: string;
|
|
37
|
+
created_at: string;
|
|
38
|
+
updated_at: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
13
41
|
get_stripe_customer: {
|
|
14
42
|
Args: {
|
|
15
43
|
customer_email: string;
|
|
@@ -111,15 +139,42 @@ export type Database = {
|
|
|
111
139
|
}[];
|
|
112
140
|
};
|
|
113
141
|
};
|
|
114
|
-
Enums: {
|
|
115
|
-
[_ in never]: never;
|
|
116
|
-
};
|
|
117
142
|
CompositeTypes: {
|
|
118
143
|
[_ in never]: never;
|
|
119
144
|
};
|
|
120
145
|
};
|
|
121
146
|
stripe: {
|
|
122
147
|
Tables: {
|
|
148
|
+
accounts: {
|
|
149
|
+
Row: {
|
|
150
|
+
attrs: Json | null;
|
|
151
|
+
business_type: string | null;
|
|
152
|
+
country: string | null;
|
|
153
|
+
created: string | null;
|
|
154
|
+
email: string | null;
|
|
155
|
+
id: string | null;
|
|
156
|
+
type: string | null;
|
|
157
|
+
};
|
|
158
|
+
Insert: {
|
|
159
|
+
attrs?: Json | null;
|
|
160
|
+
business_type?: string | null;
|
|
161
|
+
country?: string | null;
|
|
162
|
+
created?: string | null;
|
|
163
|
+
email?: string | null;
|
|
164
|
+
id?: string | null;
|
|
165
|
+
type?: string | null;
|
|
166
|
+
};
|
|
167
|
+
Update: {
|
|
168
|
+
attrs?: Json | null;
|
|
169
|
+
business_type?: string | null;
|
|
170
|
+
country?: string | null;
|
|
171
|
+
created?: string | null;
|
|
172
|
+
email?: string | null;
|
|
173
|
+
id?: string | null;
|
|
174
|
+
type?: string | null;
|
|
175
|
+
};
|
|
176
|
+
Relationships: [];
|
|
177
|
+
};
|
|
123
178
|
checkout_sessions: {
|
|
124
179
|
Row: {
|
|
125
180
|
attrs: Json | null;
|
|
@@ -299,7 +354,134 @@ export type Database = {
|
|
|
299
354
|
[_ in never]: never;
|
|
300
355
|
};
|
|
301
356
|
Functions: {
|
|
302
|
-
|
|
357
|
+
get_stripe_checkout_session: {
|
|
358
|
+
Args: {
|
|
359
|
+
session_id: string;
|
|
360
|
+
};
|
|
361
|
+
Returns: {
|
|
362
|
+
id: string;
|
|
363
|
+
customer: string;
|
|
364
|
+
payment_intent: string;
|
|
365
|
+
subscription: string;
|
|
366
|
+
attrs: Json;
|
|
367
|
+
}[];
|
|
368
|
+
};
|
|
369
|
+
get_stripe_community_products: {
|
|
370
|
+
Args: {
|
|
371
|
+
p_community_id: string;
|
|
372
|
+
};
|
|
373
|
+
Returns: {
|
|
374
|
+
id: string;
|
|
375
|
+
name: string;
|
|
376
|
+
description: string;
|
|
377
|
+
price: number;
|
|
378
|
+
image_url: string;
|
|
379
|
+
video: string;
|
|
380
|
+
payment_provider_product_id: string;
|
|
381
|
+
created_at: string;
|
|
382
|
+
updated_at: string;
|
|
383
|
+
}[];
|
|
384
|
+
};
|
|
385
|
+
get_stripe_customer: {
|
|
386
|
+
Args: {
|
|
387
|
+
customer_email: string;
|
|
388
|
+
};
|
|
389
|
+
Returns: {
|
|
390
|
+
id: string;
|
|
391
|
+
email: string;
|
|
392
|
+
name: string;
|
|
393
|
+
description: string;
|
|
394
|
+
created: string;
|
|
395
|
+
attrs: Json;
|
|
396
|
+
}[];
|
|
397
|
+
};
|
|
398
|
+
get_stripe_customer_payment_intents: {
|
|
399
|
+
Args: {
|
|
400
|
+
customer_id: string;
|
|
401
|
+
};
|
|
402
|
+
Returns: {
|
|
403
|
+
id: string;
|
|
404
|
+
customer: string;
|
|
405
|
+
amount: number;
|
|
406
|
+
currency: string;
|
|
407
|
+
payment_method: string;
|
|
408
|
+
created: string;
|
|
409
|
+
attrs: Json;
|
|
410
|
+
}[];
|
|
411
|
+
};
|
|
412
|
+
get_stripe_customer_subscriptions: {
|
|
413
|
+
Args: {
|
|
414
|
+
customer_id: string;
|
|
415
|
+
};
|
|
416
|
+
Returns: {
|
|
417
|
+
id: string;
|
|
418
|
+
customer: string;
|
|
419
|
+
currency: string;
|
|
420
|
+
current_period_start: string;
|
|
421
|
+
current_period_end: string;
|
|
422
|
+
attrs: Json;
|
|
423
|
+
}[];
|
|
424
|
+
};
|
|
425
|
+
get_stripe_prices: {
|
|
426
|
+
Args: Record<PropertyKey, never>;
|
|
427
|
+
Returns: {
|
|
428
|
+
id: string;
|
|
429
|
+
active: boolean;
|
|
430
|
+
currency: string;
|
|
431
|
+
product: string;
|
|
432
|
+
unit_amount: number;
|
|
433
|
+
type: string;
|
|
434
|
+
attrs: Json;
|
|
435
|
+
}[];
|
|
436
|
+
};
|
|
437
|
+
get_stripe_product: {
|
|
438
|
+
Args: {
|
|
439
|
+
product_id: string;
|
|
440
|
+
};
|
|
441
|
+
Returns: {
|
|
442
|
+
id: string;
|
|
443
|
+
name: string;
|
|
444
|
+
active: boolean;
|
|
445
|
+
default_price: string;
|
|
446
|
+
description: string;
|
|
447
|
+
attrs: Json;
|
|
448
|
+
}[];
|
|
449
|
+
};
|
|
450
|
+
get_stripe_products: {
|
|
451
|
+
Args: Record<PropertyKey, never>;
|
|
452
|
+
Returns: {
|
|
453
|
+
id: string;
|
|
454
|
+
name: string;
|
|
455
|
+
active: boolean;
|
|
456
|
+
default_price: string;
|
|
457
|
+
description: string;
|
|
458
|
+
attrs: Json;
|
|
459
|
+
}[];
|
|
460
|
+
};
|
|
461
|
+
get_stripe_subscription: {
|
|
462
|
+
Args: {
|
|
463
|
+
subscription_id: string;
|
|
464
|
+
};
|
|
465
|
+
Returns: {
|
|
466
|
+
id: string;
|
|
467
|
+
customer: string;
|
|
468
|
+
currency: string;
|
|
469
|
+
current_period_start: string;
|
|
470
|
+
current_period_end: string;
|
|
471
|
+
attrs: Json;
|
|
472
|
+
}[];
|
|
473
|
+
};
|
|
474
|
+
get_stripe_subscriptions: {
|
|
475
|
+
Args: Record<PropertyKey, never>;
|
|
476
|
+
Returns: {
|
|
477
|
+
id: string;
|
|
478
|
+
customer: string;
|
|
479
|
+
currency: string;
|
|
480
|
+
current_period_start: string;
|
|
481
|
+
current_period_end: string;
|
|
482
|
+
attrs: Json;
|
|
483
|
+
}[];
|
|
484
|
+
};
|
|
303
485
|
};
|
|
304
486
|
Enums: {
|
|
305
487
|
[_ in never]: never;
|
|
@@ -309,7 +491,7 @@ export type Database = {
|
|
|
309
491
|
};
|
|
310
492
|
};
|
|
311
493
|
};
|
|
312
|
-
type DefaultSchema = Database[Extract<keyof Database, "public">];
|
|
494
|
+
type DefaultSchema = Database[Extract<keyof Database, "public" | "stripe">];
|
|
313
495
|
export type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | {
|
|
314
496
|
schema: keyof Database;
|
|
315
497
|
}, TableName extends DefaultSchemaTableNameOrOptions extends {
|
|
@@ -343,13 +525,6 @@ export type TablesUpdate<DefaultSchemaTableNameOrOptions extends keyof DefaultSc
|
|
|
343
525
|
} ? U : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
|
|
344
526
|
Update: infer U;
|
|
345
527
|
} ? U : never : never;
|
|
346
|
-
export type Enums<DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] | {
|
|
347
|
-
schema: keyof Database;
|
|
348
|
-
}, EnumName extends DefaultSchemaEnumNameOrOptions extends {
|
|
349
|
-
schema: keyof Database;
|
|
350
|
-
} ? keyof Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] : never = never> = DefaultSchemaEnumNameOrOptions extends {
|
|
351
|
-
schema: keyof Database;
|
|
352
|
-
} ? Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] : never;
|
|
353
528
|
export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] | {
|
|
354
529
|
schema: keyof Database;
|
|
355
530
|
}, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
|
|
@@ -357,12 +532,4 @@ export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof Defaul
|
|
|
357
532
|
} ? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] : never = never> = PublicCompositeTypeNameOrOptions extends {
|
|
358
533
|
schema: keyof Database;
|
|
359
534
|
} ? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] : never;
|
|
360
|
-
export declare const Constants: {
|
|
361
|
-
readonly public: {
|
|
362
|
-
readonly Enums: {};
|
|
363
|
-
};
|
|
364
|
-
readonly stripe: {
|
|
365
|
-
readonly Enums: {};
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
535
|
export {};
|
|
@@ -69,13 +69,6 @@ class SupabaseClientService {
|
|
|
69
69
|
getClient() {
|
|
70
70
|
return this.client;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Select checkout sessions
|
|
74
|
-
* @param query Optional query parameters
|
|
75
|
-
*/
|
|
76
|
-
async selectCheckoutSessions(query) {
|
|
77
|
-
return this.select('checkout_sessions', query);
|
|
78
|
-
}
|
|
79
72
|
/**
|
|
80
73
|
* Select payment intents
|
|
81
74
|
* @param query Optional query parameters
|
|
@@ -83,6 +76,20 @@ class SupabaseClientService {
|
|
|
83
76
|
async selectPaymentIntents(query) {
|
|
84
77
|
return this.select('payment_intents', query);
|
|
85
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* STRIPE CHECKOUT SESSIONS
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* Select checkout sessions
|
|
84
|
+
* @param sessionId The checkout session ID
|
|
85
|
+
*/
|
|
86
|
+
async selectCheckoutSession(sessionId) {
|
|
87
|
+
return this.client
|
|
88
|
+
.schema(this.config.supabaseSchema)
|
|
89
|
+
.rpc('get_stripe_checkout_session', { session_id: sessionId })
|
|
90
|
+
.select('*')
|
|
91
|
+
.single();
|
|
92
|
+
}
|
|
86
93
|
/**
|
|
87
94
|
* STRIPE SUBSCRIPTIONS
|
|
88
95
|
*/
|
|
@@ -91,7 +98,7 @@ class SupabaseClientService {
|
|
|
91
98
|
*/
|
|
92
99
|
getStripeSubscriptions() {
|
|
93
100
|
return this.client
|
|
94
|
-
.schema(
|
|
101
|
+
.schema(this.config.supabaseSchema)
|
|
95
102
|
.rpc('get_stripe_subscriptions')
|
|
96
103
|
.select('*');
|
|
97
104
|
}
|
|
@@ -101,7 +108,7 @@ class SupabaseClientService {
|
|
|
101
108
|
*/
|
|
102
109
|
selectStripeSubscription(subscriptionId) {
|
|
103
110
|
return this.client
|
|
104
|
-
.schema(
|
|
111
|
+
.schema(this.config.supabaseSchema)
|
|
105
112
|
.rpc('get_stripe_subscription', { subscription_id: subscriptionId })
|
|
106
113
|
.select('*');
|
|
107
114
|
}
|
|
@@ -114,7 +121,7 @@ class SupabaseClientService {
|
|
|
114
121
|
*/
|
|
115
122
|
async selectStripePrices() {
|
|
116
123
|
return this.client
|
|
117
|
-
.schema(
|
|
124
|
+
.schema(this.config.supabaseSchema)
|
|
118
125
|
.rpc('get_stripe_prices')
|
|
119
126
|
.select('*');
|
|
120
127
|
}
|
|
@@ -127,7 +134,7 @@ class SupabaseClientService {
|
|
|
127
134
|
*/
|
|
128
135
|
async selectStripeProducts() {
|
|
129
136
|
return this.client
|
|
130
|
-
.schema(
|
|
137
|
+
.schema(this.config.supabaseSchema)
|
|
131
138
|
.rpc('get_stripe_products')
|
|
132
139
|
.select('*');
|
|
133
140
|
}
|
|
@@ -137,7 +144,7 @@ class SupabaseClientService {
|
|
|
137
144
|
*/
|
|
138
145
|
async selectStripeProduct(productId) {
|
|
139
146
|
return this.client
|
|
140
|
-
.schema(
|
|
147
|
+
.schema(this.config.supabaseSchema)
|
|
141
148
|
.rpc('get_stripe_product', { product_id: productId })
|
|
142
149
|
.select('*');
|
|
143
150
|
}
|
|
@@ -164,7 +171,7 @@ class SupabaseClientService {
|
|
|
164
171
|
* @param email The customer email
|
|
165
172
|
*/
|
|
166
173
|
async getCustomerByEmail(email) {
|
|
167
|
-
return this.client.schema(
|
|
174
|
+
return this.client.schema(this.config.supabaseSchema).rpc('get_stripe_customer', { customer_email: email });
|
|
168
175
|
}
|
|
169
176
|
/**
|
|
170
177
|
* Get customer payment intents
|
|
@@ -172,7 +179,7 @@ class SupabaseClientService {
|
|
|
172
179
|
*/
|
|
173
180
|
async getCustomerPaymentIntents(customerId) {
|
|
174
181
|
return this.client
|
|
175
|
-
.schema(
|
|
182
|
+
.schema(this.config.supabaseSchema)
|
|
176
183
|
.rpc('get_stripe_customer_payment_intents', { customer_id: customerId })
|
|
177
184
|
.select('*');
|
|
178
185
|
}
|
|
@@ -182,7 +189,7 @@ class SupabaseClientService {
|
|
|
182
189
|
*/
|
|
183
190
|
async getCustomerSubscriptions(customerId) {
|
|
184
191
|
return this.client
|
|
185
|
-
.schema(
|
|
192
|
+
.schema(this.config.supabaseSchema)
|
|
186
193
|
.rpc('get_stripe_customer_subscriptions', { customer_id: customerId })
|
|
187
194
|
.select('*');
|
|
188
195
|
}
|
|
@@ -547,6 +554,27 @@ class StripeClientService {
|
|
|
547
554
|
return { url: null, error: error };
|
|
548
555
|
}
|
|
549
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Create a customer
|
|
559
|
+
* @param customerEmail The email of the customer
|
|
560
|
+
*/
|
|
561
|
+
async createCustomer(customerEmail) {
|
|
562
|
+
try {
|
|
563
|
+
const { data, error } = await this.supabase.getClient()
|
|
564
|
+
.functions.invoke('create_customer', {
|
|
565
|
+
body: {
|
|
566
|
+
customerEmail
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
if (error) {
|
|
570
|
+
throw error;
|
|
571
|
+
}
|
|
572
|
+
return { customer: data, error: null };
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
return { customer: null, error: error };
|
|
576
|
+
}
|
|
577
|
+
}
|
|
550
578
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: StripeClientService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
551
579
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: StripeClientService, providedIn: 'root' });
|
|
552
580
|
}
|
|
@@ -689,13 +717,9 @@ const SubscriptionsStore = signalStore({ providedIn: 'root' }, withState(initial
|
|
|
689
717
|
* Create a subscription
|
|
690
718
|
* @param priceId The price ID for the subscription
|
|
691
719
|
*/
|
|
692
|
-
async createSubscription(priceId, returnPath,
|
|
720
|
+
async createSubscription(priceId, returnPath, customer) {
|
|
693
721
|
patchState(store, { status: 'loading', error: null });
|
|
694
722
|
try {
|
|
695
|
-
let customer = null;
|
|
696
|
-
if (customerEmail) {
|
|
697
|
-
customer = customerStore.customer().data;
|
|
698
|
-
}
|
|
699
723
|
const { clientSecret, error } = await stripeService.createSubscription(priceId, returnPath, customer);
|
|
700
724
|
console.log('🔍 [SubscriptionsStore] created subscription', clientSecret, error);
|
|
701
725
|
if (error) {
|
|
@@ -907,7 +931,7 @@ const CustomerStore = signalStore({ providedIn: 'root' }, withState(initialCusto
|
|
|
907
931
|
firstSubscription: computed(() => state.subscriptions.data()?.[0]),
|
|
908
932
|
restSubscriptions: computed(() => state.subscriptions.data()?.slice(1)),
|
|
909
933
|
isError: computed(() => state.paymentIntents.error()),
|
|
910
|
-
})), withMethods((state, supabaseService = inject(SupabaseClientService), productsStore = inject(ProductsStore)) => ({
|
|
934
|
+
})), withMethods((state, supabaseService = inject(SupabaseClientService), stripeService = inject(StripeClientService), productsStore = inject(ProductsStore)) => ({
|
|
911
935
|
/**
|
|
912
936
|
* Load customer
|
|
913
937
|
* @param customerEmail The customer email
|
|
@@ -926,10 +950,23 @@ const CustomerStore = signalStore({ providedIn: 'root' }, withState(initialCusto
|
|
|
926
950
|
patchState(state, { customer: { data: customer, status: 'success', error: null } });
|
|
927
951
|
}
|
|
928
952
|
else {
|
|
929
|
-
|
|
953
|
+
this.createCustomer(customerEmail);
|
|
930
954
|
}
|
|
931
955
|
}
|
|
932
956
|
},
|
|
957
|
+
/**
|
|
958
|
+
* Create a customer
|
|
959
|
+
* @param customerEmail The customer email
|
|
960
|
+
*/
|
|
961
|
+
async createCustomer(customerEmail) {
|
|
962
|
+
const { customer, error } = await stripeService.createCustomer(customerEmail);
|
|
963
|
+
if (error) {
|
|
964
|
+
patchState(state, { customer: { error: error.message, status: 'error', data: null } });
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
patchState(state, { customer: { data: customer, status: 'success', error: null } });
|
|
968
|
+
}
|
|
969
|
+
},
|
|
933
970
|
/**
|
|
934
971
|
* Load payment intents
|
|
935
972
|
* @param customerId The customer ID
|
|
@@ -1275,7 +1312,7 @@ class EmbeddedSubscriptionComponent {
|
|
|
1275
1312
|
createSubscription() {
|
|
1276
1313
|
const baseUrl = window.location.origin;
|
|
1277
1314
|
const returnPath = `${baseUrl}${this.returnPagePath()}`;
|
|
1278
|
-
this.subscriptionsStore.createSubscription(this.priceId(), returnPath, this.customer()
|
|
1315
|
+
this.subscriptionsStore.createSubscription(this.priceId(), returnPath, this.customer());
|
|
1279
1316
|
}
|
|
1280
1317
|
ngOnDestroy() {
|
|
1281
1318
|
this.subscriptionsStore.destroyEmbeddedSubscription();
|
|
@@ -1293,6 +1330,7 @@ class SubscriptionReturnPageComponent {
|
|
|
1293
1330
|
router = inject(Router);
|
|
1294
1331
|
checkoutStore = inject(CheckoutStore);
|
|
1295
1332
|
subscriptionsStore = inject(SubscriptionsStore);
|
|
1333
|
+
sessionStatus = computed(() => this.checkoutStore.sessionStatus());
|
|
1296
1334
|
returnUrl = input('/');
|
|
1297
1335
|
async ngOnInit() {
|
|
1298
1336
|
this.route.queryParams.subscribe(async (params) => {
|
|
@@ -1312,11 +1350,11 @@ class SubscriptionReturnPageComponent {
|
|
|
1312
1350
|
this.router.navigateByUrl(this.returnUrl());
|
|
1313
1351
|
}
|
|
1314
1352
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SubscriptionReturnPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1315
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: SubscriptionReturnPageComponent, isStandalone: true, selector: "lib-subscription-return-page", inputs: { returnUrl: { classPropertyName: "returnUrl", publicName: "returnUrl", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"
|
|
1353
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: SubscriptionReturnPageComponent, isStandalone: true, selector: "lib-subscription-return-page", inputs: { returnUrl: { classPropertyName: "returnUrl", publicName: "returnUrl", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex justify-center min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 p-4\">\n <div class=\"hero-content text-center max-w-md\">\n <div class=\"card w-full bg-base-100 shadow-2xl\">\n <div class=\"card-body items-center text-center\">\n <!-- Success Icon -->\n <div class=\"mb-6\">\n <div class=\"avatar\">\n <div class=\"w-24 h-24 rounded-full bg-success/10 flex items-center justify-center\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"h-full w-full text-success\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n </div>\n </div>\n </div>\n\n <!-- Status Content -->\n @if (checkoutStore.isStatusLoading()) {\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <span class=\"loading loading-spinner loading-lg text-primary\"></span>\n <div class=\"alert alert-info\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" class=\"stroke-current shrink-0 w-6 h-6\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path>\n </svg>\n <span>Cargando detalles de la suscripci\u00F3n...</span>\n </div>\n </div>\n } @else if (checkoutStore.isStatusError()) {\n <div class=\"alert alert-error mb-6\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"stroke-current shrink-0 h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n <span>{{ subscriptionsStore.error() }}</span>\n </div>\n } @else if (checkoutStore.isPaymentComplete()) {\n\n <!-- Title and Description -->\n <h2 class=\"card-title text-3xl font-bold text-base-content mb-2\">{{ sessionStatus()?.amount_total }}</h2>\n\n <div class=\"alert alert-success mb-6\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"stroke-current shrink-0 h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n <span class=\"font-medium\">Tu suscripci\u00F3n est\u00E1 activa y lista para usar.</span>\n </div>\n\n <div class=\"bg-base-200 rounded-lg p-4 mb-6 w-full\">\n <h3 class=\"font-semibold text-sm text-base-content/80 mb-3\">Beneficios incluidos:</h3>\n <ul class=\"space-y-2\">\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Acceso completo a todas las funciones\n </li>\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Soporte prioritario 24/7\n </li>\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Actualizaciones autom\u00E1ticas\n </li>\n </ul>\n </div>\n }\n\n <!-- Action Buttons -->\n <div class=\"card-actions justify-center w-full\">\n <button class=\"btn btn-primary btn-wide\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-5 w-5 mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6\"\n />\n </svg>\n Ir al Panel Principal\n </button>\n </div>\n\n <!-- Additional Help -->\n <div class=\"text-center mt-4\">\n <p class=\"text-xs text-base-content/50\">\n \u00BFNecesitas ayuda?\n <a href=\"#\" class=\"link link-primary\">Contacta soporte</a>\n </p>\n </div>\n </div>\n </div>\n </div>\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1316
1354
|
}
|
|
1317
1355
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SubscriptionReturnPageComponent, decorators: [{
|
|
1318
1356
|
type: Component,
|
|
1319
|
-
args: [{ selector: 'lib-subscription-return-page', standalone: true, imports: [CommonModule], template: "<div class=\"
|
|
1357
|
+
args: [{ selector: 'lib-subscription-return-page', standalone: true, imports: [CommonModule], template: "<div class=\"flex justify-center min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 p-4\">\n <div class=\"hero-content text-center max-w-md\">\n <div class=\"card w-full bg-base-100 shadow-2xl\">\n <div class=\"card-body items-center text-center\">\n <!-- Success Icon -->\n <div class=\"mb-6\">\n <div class=\"avatar\">\n <div class=\"w-24 h-24 rounded-full bg-success/10 flex items-center justify-center\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"h-full w-full text-success\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\"\n />\n </svg>\n </div>\n </div>\n </div>\n\n <!-- Status Content -->\n @if (checkoutStore.isStatusLoading()) {\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <span class=\"loading loading-spinner loading-lg text-primary\"></span>\n <div class=\"alert alert-info\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" class=\"stroke-current shrink-0 w-6 h-6\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path>\n </svg>\n <span>Cargando detalles de la suscripci\u00F3n...</span>\n </div>\n </div>\n } @else if (checkoutStore.isStatusError()) {\n <div class=\"alert alert-error mb-6\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"stroke-current shrink-0 h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n <span>{{ subscriptionsStore.error() }}</span>\n </div>\n } @else if (checkoutStore.isPaymentComplete()) {\n\n <!-- Title and Description -->\n <h2 class=\"card-title text-3xl font-bold text-base-content mb-2\">{{ sessionStatus()?.amount_total }}</h2>\n\n <div class=\"alert alert-success mb-6\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"stroke-current shrink-0 h-6 w-6\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z\" />\n </svg>\n <span class=\"font-medium\">Tu suscripci\u00F3n est\u00E1 activa y lista para usar.</span>\n </div>\n\n <div class=\"bg-base-200 rounded-lg p-4 mb-6 w-full\">\n <h3 class=\"font-semibold text-sm text-base-content/80 mb-3\">Beneficios incluidos:</h3>\n <ul class=\"space-y-2\">\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Acceso completo a todas las funciones\n </li>\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Soporte prioritario 24/7\n </li>\n <li class=\"flex items-center text-sm\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-success mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 13l4 4L19 7\" />\n </svg>\n Actualizaciones autom\u00E1ticas\n </li>\n </ul>\n </div>\n }\n\n <!-- Action Buttons -->\n <div class=\"card-actions justify-center w-full\">\n <button class=\"btn btn-primary btn-wide\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-5 w-5 mr-2\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6\"\n />\n </svg>\n Ir al Panel Principal\n </button>\n </div>\n\n <!-- Additional Help -->\n <div class=\"text-center mt-4\">\n <p class=\"text-xs text-base-content/50\">\n \u00BFNecesitas ayuda?\n <a href=\"#\" class=\"link link-primary\">Contacta soporte</a>\n </p>\n </div>\n </div>\n </div>\n </div>\n</div>" }]
|
|
1320
1358
|
}] });
|
|
1321
1359
|
|
|
1322
1360
|
class SubscriptionItemSkeletonComponent {
|
|
@@ -1607,15 +1645,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
|
|
|
1607
1645
|
], template: "<div class=\"container flex flex-col gap-6 mx-auto\">\n <!-- Subscriptions Section -->\n <section class=\"flex flex-col\">\n <lib-subscriptions [returnUrl]=\"returnUrl()\"></lib-subscriptions>\n </section>\n\n <!-- Payment Intents Section with Tabs -->\n <section class=\"flex flex-col\">\n <header class=\"mb-4\">\n <h2 class=\"text-2xl font-bold text-gray-800\">Payment Intents</h2>\n <p class=\"text-gray-600\">Payment intents history. Select a tab to see the list or table view.</p>\n </header>\n\n <div role=\"tablist\" class=\"tabs tabs-box w-fit mb-4\">\n <a role=\"tab\" class=\"tab\" [class.tab-active]=\"activeTab() === 'list'\" (click)=\"setActiveTab('list')\">Lista</a>\n <a role=\"tab\" class=\"tab\" [class.tab-active]=\"activeTab() === 'table'\" (click)=\"setActiveTab('table')\">Tabla</a>\n </div>\n\n @if (activeTab() === 'list') {\n <lib-payment-intents-list\n [paymentIntents]=\"customerStore.paymentIntents.data()\"\n [loading]=\"customerStore.isPaymentIntentsStatusLoading()\"\n [error]=\"customerStore.paymentIntents.error()\"\n (onRefresh)=\"refreshPaymentIntents()\">\n </lib-payment-intents-list>\n } @else {\n <lib-payment-intents-table\n [paymentIntents]=\"customerStore.paymentIntents.data()\"\n [loading]=\"customerStore.isPaymentIntentsStatusLoading()\"\n [error]=\"customerStore.paymentIntents.error()\"\n (exportSelected)=\"exportSelectedPaymentIntents($event)\"\n (onRefresh)=\"refreshPaymentIntents()\">\n </lib-payment-intents-table>\n }\n </section>\n</div>\n" }]
|
|
1608
1646
|
}] });
|
|
1609
1647
|
|
|
1610
|
-
const Constants = {
|
|
1611
|
-
public: {
|
|
1612
|
-
Enums: {},
|
|
1613
|
-
},
|
|
1614
|
-
stripe: {
|
|
1615
|
-
Enums: {},
|
|
1616
|
-
},
|
|
1617
|
-
};
|
|
1618
|
-
|
|
1619
1648
|
/*
|
|
1620
1649
|
* Public API Surface of ngx-supabase-stripe
|
|
1621
1650
|
*/
|
|
@@ -1625,5 +1654,5 @@ const Constants = {
|
|
|
1625
1654
|
* Generated bundle index. Do not edit.
|
|
1626
1655
|
*/
|
|
1627
1656
|
|
|
1628
|
-
export { CheckoutStore,
|
|
1657
|
+
export { CheckoutStore, CustomerDashboardComponent, CustomerStore, EmbeddedCheckoutComponent, EmbeddedSubscriptionComponent, PaymentIntentItemComponent, PaymentIntentItemSkeletonComponent, PaymentIntentsListComponent, ProductListComponent, ProductsStore, ReturnPageComponent, STRIPE_CONFIG, SUPABASE_CONFIG, StripeClientService, SubscriptionCardComponent, SubscriptionItemComponent, SubscriptionReturnPageComponent, SubscriptionsListComponent, SubscriptionsStore, SupabaseClientService, parsePaymentIntent, parseProduct, parseSubscription, provideNgxSupabaseStripeConfig, provideStripeConfig, provideSupabaseConfig };
|
|
1629
1658
|
//# sourceMappingURL=dotted-labs-ngx-supabase-stripe.mjs.map
|