@dotted-labs/ngx-supabase-stripe 0.6.2 → 0.6.4

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.
@@ -157,6 +157,12 @@ class SupabaseClientService {
157
157
  .rpc('get_stripe_products')
158
158
  .select('*');
159
159
  }
160
+ async selectStripeProductsByIds(ids) {
161
+ return this.client
162
+ .schema(this.config.supabaseSchema)
163
+ .rpc('get_stripe_products_by_ids', { product_ids: ids })
164
+ .select('*');
165
+ }
160
166
  /**
161
167
  * Select a Stripe product
162
168
  * @param productId The product ID
@@ -720,7 +726,6 @@ const ProductsStore = signalStore({ providedIn: 'root' }, withState(initialProdu
720
726
  * Get products by IDs from the current loaded products
721
727
  */
722
728
  getProductsByIds(ids) {
723
- console.log('🎮 [ProductsStore] Loading products by ids: ', ids);
724
729
  return store.products()?.filter(product => product.id && ids.includes(product.id)) || [];
725
730
  },
726
731
  /**
@@ -792,6 +797,22 @@ const ProductsStore = signalStore({ providedIn: 'root' }, withState(initialProdu
792
797
  });
793
798
  }
794
799
  },
800
+ async loadProductsByIds(ids) {
801
+ patchState(store, { status: 'loading', error: null });
802
+ try {
803
+ const { data: products, error: productsError } = await supabaseService.selectStripeProductsByIds(ids);
804
+ if (productsError) {
805
+ console.error('🎮 [ProductsStore]: Error loading products', productsError);
806
+ patchState(store, { status: 'error', error: productsError.message });
807
+ }
808
+ if (products) {
809
+ const products = [];
810
+ }
811
+ }
812
+ catch (error) {
813
+ patchState(store, { status: 'error', error: error.message });
814
+ }
815
+ },
795
816
  /**
796
817
  * Reset the store to initial state
797
818
  */