Skip to content

Commit

Permalink
added subscription model
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmesh-hemaram committed Aug 21, 2024
1 parent 70300aa commit fc3ae92
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
7 changes: 4 additions & 3 deletions apps/acf-options-page/proxy.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"/locales": {
[
{
"context": ["/locales"],
"target": "http://localhost:3333",
"secure": false,
"changeOrigin": true
}
}
]
2 changes: 1 addition & 1 deletion apps/acf-options-page/src/app/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Footer() {

let imageURL = 'https://getautoclicker.com/favicons/favicon48.png';
if (/(DEV|BETA)/.test(process.env.NX_PUBLIC_VARIANT ?? '')) {
imageURL = `https://getautoclicker.com/icons/${process.env.NX_PUBLIC_VARIANT?.toLocaleLowerCase()}_icon48.png.png`;
imageURL = `https://getautoclicker.com/icons/${process.env.NX_PUBLIC_VARIANT?.toLocaleLowerCase()}_icon48.png`;
}

return (
Expand Down
21 changes: 10 additions & 11 deletions apps/acf-options-page/src/app/header_google.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Nav, NavDropdown } from 'react-bootstrap';
import { useAppDispatch, useAppSelector } from '../hooks';
import { firebaseLogoutAPI, firebaseSelector, switchFirebaseLoginModal } from '../store/firebase';
import { switchSubscribeModal } from '../store/subscribe';

export const HeaderGoogle = () => {
const dispatch = useAppDispatch();
const { user } = useAppSelector(firebaseSelector);
const { user, role } = useAppSelector(firebaseSelector);

/*
const onPortalLink = async () => {
Expand All @@ -30,21 +31,19 @@ export const HeaderGoogle = () => {
}
};
*/

console.log(role);
return (
<div>
{user ? (
<NavDropdown title={user.displayName} id='subscription-nav-dropdown' align='end'>
{/*{role ? (
<NavDropdown.Item onClick={onPortalLink} disabled={isPortalLinkLoading}>
Manage Subscription
</NavDropdown.Item>
) : (
<NavDropdown.Item title='subscribe' onClick={() => dispatch(switchSubscribeModal())}>
Subscribe
</NavDropdown.Item>
{!role && (
<>
<NavDropdown.Item title='subscribe' onClick={() => dispatch(switchSubscribeModal())}>
Subscribe
</NavDropdown.Item>
<NavDropdown.Divider />
</>
)}
<NavDropdown.Divider />*/}
<NavDropdown.Item title='logout' onClick={() => dispatch(firebaseLogoutAPI())}>
Logout
</NavDropdown.Item>
Expand Down
11 changes: 5 additions & 6 deletions apps/acf-options-page/src/modal/subscribe.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Button, ButtonGroup, Card, CardBody, Col, Form, Modal, Row, ToggleButton } from 'react-bootstrap';
import { useAppDispatch, useAppSelector } from '../hooks';

import { subscribe, subscribeSelector, switchSubscribeModal } from '../store/subscribe';
import { subscribeSelector, switchSubscribeModal } from '../store/subscribe';

import * as React from 'react';
import { AwardFill, Discord, Fire, Star } from '../util';
Expand Down Expand Up @@ -63,18 +63,17 @@ const SubscribeModal = () => {
{yearly}
</small>
</div>
<Button variant='primary' disabled={isSubscribing} className='px-5 py-2 mt-3 w-100' onClick={() => dispatch(subscribe('asd'))}>
<Button variant='primary' href='https://getautoclicker.com/docs/4.x/about/subscription/' disabled={isSubscribing} className='px-5 py-2 mt-3 w-100'>
{isSubscribing && <span className='spinner-border spinner-border-sm me-3' aria-hidden='true'></span>}
Upgrade to Pro
</Button>
</div>
<div>
<p className='p-0 m-0'>This includes:</p>
<ul style={{ listStyle: 'none' }}>
<li>Google Sheets</li>
<li>Google Backup</li>
<li>Discord Messaging</li>
<li>Captcha resolver</li>
<li>Unlimited Google Sheets</li>
<li>Unlimited Discord Messaging</li>
<li>Captcha resolver (Coming Soon)</li>
<li>No Ads</li>
<li>
<Discord /> VIP Assistance over Discord
Expand Down
25 changes: 15 additions & 10 deletions libs/shared/google-sheets/src/lib/google-sheets-cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,23 @@ export class GoogleSheetsCS {
}

async getValues(sheets: Map<string, Set<string> | string>, spreadsheetId?: string): Promise<Sheets | undefined> {
if (spreadsheetId) {
this.transformSheets(sheets);
const result = await GoogleSheetsService.getSheets(
spreadsheetId,
Array.from(sheets, ([sheetName, range]) => `${sheetName}!${range}`)
);
if (result) {
return this.transformResult(result);
try {
if (spreadsheetId) {
this.transformSheets(sheets);
const result = await GoogleSheetsService.getSheets(
spreadsheetId,
Array.from(sheets, ([sheetName, range]) => `${sheetName}!${range}`)
);
if (result) {
return this.transformResult(result);
}
console.debug('Google Sheets', result);
return result;
}
console.debug('Google Sheets', result);
return result;
} catch (error) {
console.warn('Google Sheets', error);
}

return undefined;
}
}

0 comments on commit fc3ae92

Please sign in to comment.