@dotted-labs/ngx-supabase-stripe 0.2.3 → 0.3.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/README.md CHANGED
@@ -1,19 +1,18 @@
1
- # ngx-supabase-stripe: Angular library for integrating Supabase and Stripe
1
+ # ngx-supabase-stripe
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40dotted-labs%2Fngx-supabase-auth.svg)](https://badge.fury.io/js/%40dotted-labs%2Fngx-supabase-auth)
3
+ [![npm version](https://badge.fury.io/js/%40dotted-labs%2Fngx-supabase-stripe.svg)](https://badge.fury.io/js/%40dotted-labs%2Fngx-supabase-stripe)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- An Angular proyect for integrating Supabase and Stripe into your applications, providing ready-to-use components that simplify the implementation of payments and subscriptions.
6
+ An Angular library for integrating Supabase and Stripe into your applications, providing ready-to-use components and Supabase Edge Functions that simplify the implementation of payments and subscriptions.
7
7
 
8
- ## Proyects
8
+ ## Projects
9
9
 
10
- - [supabase-stripe-core](./projects/supabase-stripe-core)
11
- - [supabase-stripe-angular](./projects/supabase-stripe-angular)
10
+ | Project | Description |
11
+ |---|---|
12
+ | [`projects/ngx-supabase-stripe`](./projects/ngx-supabase-stripe) | Angular library with components, stores and services |
13
+ | [`projects/supabase`](./projects/supabase) | Supabase project with Edge Functions and configuration |
12
14
 
13
- ## Supabase-stripe-core
14
15
 
15
- A library for integrating Supabase and Stripe into your applications, providing ready-to-use components that simplify the implementation of payments and subscriptions.
16
+ ## Quick Start
16
17
 
17
- ## Supabase-stripe-angular
18
-
19
- A library for integrating Supabase and Stripe into your Angular applications, providing ready-to-use components that simplify the implementation of payments and subscriptions.
18
+ See the full setup guide in [`projects/ngx-supabase-stripe/README.md`](./projects/ngx-supabase-stripe/README.md).
@@ -1473,6 +1473,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
1473
1473
  args: [{ selector: 'stripe-product-list', standalone: true, imports: [CommonModule, ProductItemComponent, ProductItemSkeletonComponent], template: "@if (productsStore.isStatusLoading()) {\n <div class=\"flex justify-start gap-8\">\n @for (item of [1,2,3]; track item) {\n <lib-product-item-skeleton></lib-product-item-skeleton>\n }\n </div>\n}\n\n@if (productsStore.isStatusError() && !productsStore.isStatusLoading()) {\n <div class=\"alert alert-error\">\n <span>{{ productsStore.error() }}</span>\n </div>\n}\n\n@if (!productsStore.hasProducts() && !productsStore.isStatusLoading()) {\n <div class=\"alert alert-info\">\n <span>No products available</span>\n </div>\n}\n\n@if (productsStore.hasProducts()) {\n <div class=\"flex justify-start gap-8\">\n @for (product of products(); track product.id) {\n <lib-product-item\n [product]=\"product\"\n [currency]=\"currency()\"\n (productSelected)=\"onProductSelect($event)\"\n (priceSelected)=\"onPriceSelect($event)\">\n </lib-product-item>\n }\n </div>\n} \n\n\n" }]
1474
1474
  }] });
1475
1475
 
1476
+ class ProductItemButtonComponent {
1477
+ product = input.required();
1478
+ currency = input(Currency.EUR);
1479
+ buttonText = input('Buy now');
1480
+ buttonClass = input('btn btn-primary');
1481
+ showPrice = input(true);
1482
+ disabled = input(false);
1483
+ productSelected = output();
1484
+ priceSelected = output();
1485
+ utils = inject(UtilsService);
1486
+ price = computed(() => this.product().prices.find(price => price.details.currency === this.currency()));
1487
+ isDisabled = computed(() => this.disabled() || !this.product().active);
1488
+ displayText = computed(() => {
1489
+ if (!this.product().active) {
1490
+ return 'Inactive';
1491
+ }
1492
+ if (!this.showPrice()) {
1493
+ return this.buttonText();
1494
+ }
1495
+ const priceInfo = this.price();
1496
+ if (!priceInfo) {
1497
+ return this.buttonText();
1498
+ }
1499
+ const formattedPrice = this.utils.formatAmount(priceInfo.details?.unit_amount ?? 0, priceInfo.details?.currency ?? 'EUR');
1500
+ const suffix = priceInfo.details?.type === 'recurring'
1501
+ ? `/${priceInfo.recurringInterval === 'month' ? 'mo' : 'yr'}`
1502
+ : '';
1503
+ return `${this.buttonText()} - ${formattedPrice}${suffix}`;
1504
+ });
1505
+ onSelect() {
1506
+ if (this.isDisabled()) {
1507
+ return;
1508
+ }
1509
+ this.productSelected.emit(this.product());
1510
+ this.priceSelected.emit(this.price()?.details);
1511
+ }
1512
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProductItemButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1513
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.5", type: ProductItemButtonComponent, isStandalone: true, selector: "lib-product-item-button", inputs: { product: { classPropertyName: "product", publicName: "product", isSignal: true, isRequired: true, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, buttonText: { classPropertyName: "buttonText", publicName: "buttonText", isSignal: true, isRequired: false, transformFunction: null }, buttonClass: { classPropertyName: "buttonClass", publicName: "buttonClass", isSignal: true, isRequired: false, transformFunction: null }, showPrice: { classPropertyName: "showPrice", publicName: "showPrice", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { productSelected: "productSelected", priceSelected: "priceSelected" }, ngImport: i0, template: "<button \n [class]=\"buttonClass()\"\n [disabled]=\"isDisabled()\"\n (click)=\"onSelect()\">\n {{ displayText() }}\n</button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
1514
+ }
1515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProductItemButtonComponent, decorators: [{
1516
+ type: Component,
1517
+ args: [{ selector: 'lib-product-item-button', standalone: true, imports: [CommonModule], template: "<button \n [class]=\"buttonClass()\"\n [disabled]=\"isDisabled()\"\n (click)=\"onSelect()\">\n {{ displayText() }}\n</button>\n" }]
1518
+ }] });
1519
+
1476
1520
  class EmbeddedSubscriptionComponent {
1477
1521
  subscriptionsStore = inject(SubscriptionsStore);
1478
1522
  customerStore = inject(CustomerStore);
@@ -1954,5 +1998,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
1954
1998
  * Generated bundle index. Do not edit.
1955
1999
  */
1956
2000
 
1957
- export { CheckoutStore, Currency, CustomerDashboardComponent, CustomerStore, EmbeddedCheckoutComponent, EmbeddedSubscriptionComponent, PaymentIntentsListComponent, PaymentIntentsTableComponent, PortalAccountStore, ProductListComponent, ProductsStore, ReturnPageComponent, STRIPE_CONFIG, SUPABASE_CONFIG, StripeClientService, SubscriptionCardComponent, SubscriptionReturnPageComponent, SubscriptionsListComponent, SubscriptionsStore, SupabaseClientService, parsePaymentIntent, parseProduct, parseSubscription, provideNgxSupabaseStripeConfig, provideStripeConfig, provideSupabaseConfig };
2001
+ export { CheckoutStore, Currency, CustomerDashboardComponent, CustomerStore, EmbeddedCheckoutComponent, EmbeddedSubscriptionComponent, PaymentIntentsListComponent, PaymentIntentsTableComponent, PortalAccountStore, ProductItemButtonComponent, ProductListComponent, ProductsStore, ReturnPageComponent, STRIPE_CONFIG, SUPABASE_CONFIG, StripeClientService, SubscriptionCardComponent, SubscriptionReturnPageComponent, SubscriptionsListComponent, SubscriptionsStore, SupabaseClientService, parsePaymentIntent, parseProduct, parseSubscription, provideNgxSupabaseStripeConfig, provideStripeConfig, provideSupabaseConfig };
1958
2002
  //# sourceMappingURL=dotted-labs-ngx-supabase-stripe.mjs.map