File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ export const ccdSignInWithPopUp = async (provider: AuthProvider) => {
7373export const db = getFirestore ( app ) ;
7474
7575/* STRIPE */
76- export const addSubscription = async ( price : string ) => {
77- const userDoc = doc ( collection ( db , 'stripe-customers' ) , auth . currentUser ?. uid )
76+ export const addSubscription = async ( price : string , uid : string ) => {
77+ const userDoc = doc ( collection ( db , 'stripe-customers' ) , uid )
7878 const docRef = await addDoc ( collection ( userDoc , 'checkout_sessions' ) , {
7979 price,
8080 success_url : window . location . href ,
Original file line number Diff line number Diff line change 44 id: string ;
55 }[];
66
7+ export let uid: string | undefined ;
8+
79 import { Icon } from ' @steeze-ui/svelte-icon' ;
810 import { RocketLaunch } from ' @steeze-ui/heroicons' ;
911
1820 ref: ProModal
1921 },
2022 meta: {
21- products: products
23+ products: products ,
24+ uid
2225 }
2326 };
2427 modalStore .trigger (d );
Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { Icon } from ' @steeze-ui/svelte-icon' ;
3- import {
4- ArrowRightCircle ,
5- ArrowTopRightOnSquare ,
6- CheckCircle ,
7- RocketLaunch
8- } from ' @steeze-ui/heroicons' ;
3+ import { ArrowTopRightOnSquare , CheckCircle , RocketLaunch } from ' @steeze-ui/heroicons' ;
94
105 import KcPrimary from ' $lib/components/global/icons/KCPrimary.svelte' ;
116 import AjPrimary from ' $lib/components/global/icons/AJPrimary.svelte' ;
1914 import { toastStore } from ' @codingcatdev/blackcatui' ;
2015
2116 let redirecting = false ;
22- const onSubscribe = async (products : { role: string ; price: string }[]) => {
17+ const onSubscribe = async (products : { role: string ; price: string }[], uid : string ) => {
2318 const price = products
2419 .filter ((p ) => (monthly ? p .role === ' monthly' : p .role === ' yearly' ))
2520 .at (0 )?.price ;
3025 });
3126 } else {
3227 redirecting = true ;
33- addSubscription (price );
28+ addSubscription (price , uid );
3429 }
3530 };
3631
119114 {:else }
120115 <button
121116 class =" bcu-button variant-filled-surface flex self-end gap-2"
122- on:click |once ={() => onSubscribe ($modalStore [0 ].meta ?.products )}
117+ on:click |once ={() => onSubscribe ($modalStore [0 ].meta ?.products , $modalStore [ 0 ]. meta ?. uid )}
123118 >
124119 Continue
125120 <Icon src ={ArrowTopRightOnSquare } theme =" mini" class =" w-8" />
Original file line number Diff line number Diff line change 5050 {/if }
5151 </div >
5252 {:else }
53- <ProButton products ={data .products } />
53+ <ProButton products ={data .products } uid ={ data . user ?. uid } />
5454 {/if }
5555</LayoutWrapper >
Original file line number Diff line number Diff line change 1616 <div class =" bcu-card variant-filled" >Welcome Message</div >
1717 <div class =" bcu-card variant-filled" >Join Discord for LBT</div >
1818 </div >
19- <ProButton products ={data .products } />
19+ {#if ! data ?.user ?.stripeRole }
20+ <ProButton products ={data .products } uid ={data .user ?.uid } />
21+ {/if }
2022 </div >
2123 </section >
2224 </div >
You can’t perform that action at this time.
0 commit comments