Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subscription #365

Merged
merged 46 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0907641
add nix setup
fellnerse Dec 7, 2024
0d1789a
Refactor file structure for utility functions
Dec 8, 2024
d2c68a5
Add Firebase functions configuration and update lockfile
Dec 8, 2024
87c86b1
add first draft of firebase function
fellnerse Dec 9, 2024
df75f34
specify runtime for function
fellnerse Dec 9, 2024
822edd1
run formatting
fellnerse Dec 9, 2024
3f56dba
Add initial Firebase functions for PayPal integration
Dec 9, 2024
0e78ee3
add old paypal hook as example
Dec 9, 2024
4425ac7
add git to flakes
Dec 9, 2024
cceee15
Refactor subscription components and update webhook URLs
Dec 9, 2024
e1f131f
now everything works
fellnerse Dec 10, 2024
1623c70
use firebase sdk instead
fellnerse Dec 11, 2024
e8c9816
seems to work like this
fellnerse Dec 14, 2024
40eb2bf
firebase does not send origin, fix
fellnerse Dec 14, 2024
5432241
still works
fellnerse Dec 21, 2024
90eaa9d
works now everything
fellnerse Dec 21, 2024
b38d99b
cleanup
fellnerse Dec 21, 2024
6462d61
should run in cloud now as well
fellnerse Dec 21, 2024
4925f7b
revert-lockfile
fellnerse Dec 21, 2024
166fd5f
nix works now
fellnerse Dec 21, 2024
b50b663
last cleanup
fellnerse Dec 21, 2024
324ca62
run format
fellnerse Dec 21, 2024
efb9431
ignore nuxt config
fellnerse Dec 21, 2024
0e0d3fd
backend should also return full customer data; add tests to makefile
fellnerse Dec 22, 2024
3fa4461
fix makefile
fellnerse Dec 22, 2024
b5dc3f6
fe stuff for subscriptions
Dec 22, 2024
cdeeaee
add FE subscription flow
Jan 8, 2025
2a5e74e
fix loading for new subscriptions
Jan 8, 2025
4b52050
fix when sub empty
Jan 8, 2025
c46e364
fix subscriptions activation resetting
Jan 8, 2025
f5b7274
fix buy button not showing subscription
Jan 8, 2025
392e0d5
add subscription to buy screen
Jan 8, 2025
bb8a416
add subscription info to mobile
Jan 8, 2025
85094a4
limit which data is returned form BE. add a bit more UX
fellnerse Jan 8, 2025
4720fb8
also send email to recipient
fellnerse Jan 8, 2025
091d675
also send email to recipient
fellnerse Jan 8, 2025
f911258
Merge branch 'dev' into add-subscription
fellnerse Jan 8, 2025
07598c4
nicer email template, add bcc, make base url kind of work
fellnerse Jan 9, 2025
8bd35ec
Translations for sub added
Jan 9, 2025
202df8e
Translations for sub added
Jan 9, 2025
44e4804
added pricing tiers
Jan 10, 2025
d2ffb80
added pricing tiers and translations
Jan 10, 2025
4cdd282
fix stuff, and also store current subscription correctly
fellnerse Jan 12, 2025
c632150
add product and plan
fellnerse Jan 12, 2025
a264d18
Merge branch 'dev' into add-subscription
fellnerse Jan 12, 2025
2737844
fix global footer
fellnerse Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
jest.config.js
test/*
static/sw.js
.direnv
.idea
.nuxt
node_modules
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ sw.*
/assets/variables.css.map

Icon\r

.direnv
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
node_modules
coverage
pnpm-lock.yaml
test/*
static/sw.js
.direnv
.idea
.nuxt
node_modules
nuxt.config.js
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
base-url=localhost:5001/whatsanalyze-80665/us-central1
base=curl -H "Origin: localhost:3000"
base-post=$(base) --header "Content-Type: application/json"

test-paypalwebhook:
$(base-post) --location $(base-url)/paypalwebhook --data '{ "id": "WH-0K623039JK653552F-4YE01958GG893271P", "create_time": "2024-12-09T23:37:49.867Z", "resource_type": "sale", "event_type": "PAYMENT.SALE.COMPLETED", "summary": "Payment completed for EUR 15.0 EUR", "resource": { "billing_agreement_id": "I-XBCXVY6FXX47", "amount": { "total": "15.00", "currency": "EUR", "details": { "subtotal": "15.00" } }, "payment_mode": "INSTANT_TRANSFER", "update_time": "2024-12-09T23:37:46Z", "create_time": "2024-12-09T23:37:46Z", "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE", "transaction_fee": { "currency": "EUR", "value": "0.64" }, "protection_eligibility": "ELIGIBLE", "links": [ { "method": "GET", "rel": "self", "href": "https://api.sandbox.paypal.com/v1/payments/sale/3H059479R49575703" }, { "method": "POST", "rel": "refund", "href": "https://api.sandbox.paypal.com/v1/payments/sale/3H059479R49575703/refund" } ], "id": "3H059479R49575703", "state": "completed", "invoice_number": "" }, "status": "SUCCESS", "transmissions": [ { "webhook_url": "https://paypalwebhook-ypb2zslcea-uc.a.run.app", "http_status": 200, "reason_phrase": "HTTP/1.1 200 Connection established", "response_headers": { "X-Cloud-Trace-Context": "5df73ae1d22a76537a93d782bbcbd806;o=1", "Server": "Google Frontend", "Connection": "keep-alive", "content-type": "text/html; charset=utf-8", "Content-Length": "29", "Date": "Mon, 09 Dec 2024 23:37:56 GMT" }, "transmission_id": "9c3b9d60-b686-11ef-85fa-33b1e3dfa2fd", "status": "SUCCESS", "timestamp": "2024-12-09T23:37:53Z" } ], "links": [ { "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-0K623039JK653552F-4YE01958GG893271P", "rel": "self", "method": "GET", "encType": "application/json" }, { "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-0K623039JK653552F-4YE01958GG893271P/resend", "rel": "resend", "method": "POST", "encType": "application/json" } ], "event_version": "1.0" }' | yq

test-checksubscriberstatus-id:
$(base-post) --location $(base-url)/checksubscriberstatus --data '{"data": {"client_id":"ARYQUp4C_oNjNUNkvSPzLeaiulItDmnHUU226OANt2haCKC2c70ZrKZTmRHCPldcu4SD22LmPEuonfec","subscriptionId":"I-XBCXVY6FXX47"}}' | yq

test-checksubscriberstatus-email:
$(base-post) --location $(base-url)/checksubscriberstatus --data '{"data": {"client_id":"ARYQUp4C_oNjNUNkvSPzLeaiulItDmnHUU226OANt2haCKC2c70ZrKZTmRHCPldcu4SD22LmPEuonfec","email":"[email protected]"}}' | yq

test-helloworld:
$(base-post) --location $(base-url)/helloworld --data '{"data": {"client_id":"ARYQUp4C_oNjNUNkvSPzLeaiulItDmnHUU226OANt2haCKC2c70ZrKZTmRHCPldcu4SD22LmPEuonfec"}}' | yq

functions-local:
firebase emulators:start --only functions

deploy-functions:
firebase deploy --only functions
2 changes: 1 addition & 1 deletion assets/js/pdf.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render } from "~/functions/pdf";
import { render } from "~/utils/pdf";

self.onmessage = async (event) => {
// this generates the jspdf document
Expand Down
1 change: 1 addition & 0 deletions assets/pdf-fonts/jsPDF
Submodule jsPDF added at f60dcf
2 changes: 1 addition & 1 deletion components/Attachment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</template>

<script>
import { MimeTypeGroup } from "~/functions/attachments";
import { MimeTypeGroup } from "~/utils/attachments";
export default {
name: "Attachment",
props: {
Expand Down
6 changes: 3 additions & 3 deletions components/ChatVisualization/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
</template>

<script>
import { getDateString } from "~/functions/utils";
import { getAttachment } from "~/functions/attachments.ts";
import { GTAG_INTERACTION, gtagEvent } from "~/functions/gtagValues";
import { getDateString } from "~/utils/utils";
import { getAttachment } from "~/utils/attachments.ts";
import { GTAG_INTERACTION, gtagEvent } from "~/utils/gtagValues";

export default {
name: "Chat",
Expand Down
21 changes: 6 additions & 15 deletions components/ChatVisualization/ChatVisualization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@
:currency="currency"
:ego="ego"
:price="price"
:isValidSubscription="isValidSubscription"
/>
</v-row>
<v-row>
<Chat :attachments="attachments" :chat="chat" @setEgo="setEgo" />
</v-row>

<v-row justify="center">
<PdfDownload
:attachments="attachments"
:chat="chat"
:currency="currency"
:ego="ego"
:price="price"
/>
</v-row>
</v-col>
</template>

Expand All @@ -34,19 +25,19 @@ import PdfDownload from "~/components/ChatVisualization/PdfDownloadPopup";
export default {
name: "ChatVisualization",
components: { PdfDownload },
props: ["chat", "attachments", "results"],
props: ["chat", "attachments", "results", "isValidSubscription"],
data() {
return {
// its possible that the first person did not write any message at all
ego: this.chat.messagesPerPerson[0]?.name,
price: 4.99,
currency: "EUR",
price: 7.99,
currency: "EUR"
};
},
methods: {
setEgo(ego) {
this.ego = ego;
},
},
}
}
};
</script>
Loading
Loading