Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit a1f44b8
Author: Kalista Payne <[email protected]>
Date:   Wed Dec 4 15:28:54 2024 -0600

    fix(g1g1): pass promo data thru profile flow

commit a9923f8
Merge: 0579392 75c9731
Author: Kalista Payne <[email protected]>
Date:   Tue Dec 3 13:53:28 2024 -0600

    Merge branch 'develop' into sabrecat/g1g1-success

commit 0579392
Merge: b0bbc10 d6c47e7
Author: Kalista Payne <[email protected]>
Date:   Tue Nov 19 12:21:42 2024 -0600

    Merge branch 'develop' into sabrecat/g1g1-success

commit b0bbc10
Author: Kalista Payne <[email protected]>
Date:   Mon Nov 4 16:26:30 2024 -0600

    feat(gifts): add dynamic G1G1 success text
    also clean out some more Amazon code
  • Loading branch information
SabreCat committed Dec 12, 2024
1 parent 75c9731 commit 54617f8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
4 changes: 3 additions & 1 deletion website/client/src/components/payments/selectUserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
id="selectUser"
v-model="userSearchTerm"
:is-valid="foundUser._id"

:placeholder="$t('usernameOrUserId')"
:invalid-issues="userInputInvalidIssues"
/>
Expand Down Expand Up @@ -318,6 +317,7 @@ export default {
computed: {
...mapState({
currentEventList: 'worldState.data.currentEventList',
user: 'user.data',
}),
currentEvent () {
return find(this.currentEventList, event => Boolean(event.gemsPromo) || Boolean(event.promo));
Expand Down Expand Up @@ -399,6 +399,8 @@ export default {
this.foundUser = result;
}, 500),
selectUser () {
this.foundUser.g1g1 = this.currentEvent?.promo === 'g1g1'
&& this.foundUser._id !== this.user._id;
this.$root.$emit('habitica::send-gift', this.foundUser);
this.close();
},
Expand Down
6 changes: 6 additions & 0 deletions website/client/src/components/payments/successModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
<template v-if="paymentData.paymentType === 'gift-subscription'">
<div>
<span
v-if="paymentData.g1g1"
v-html="$t('paymentYouSentSubscriptionG1G1', {
name: paymentData.giftReceiver, months: paymentData.subscription.months})"
></span>
<span
v-else
v-html="$t('paymentYouSentSubscription', {
name: paymentData.giftReceiver, months: paymentData.subscription.months})"
></span>
Expand Down
12 changes: 10 additions & 2 deletions website/client/src/components/settings/subscriptionOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,17 @@
<payments-buttons
v-if="userReceivingGift?._id"
:disabled="!subscription.key"
:stripe-fn="() => redirectToStripe({gift, uuid: userReceivingGift._id, receiverName})"
:stripe-fn="() => redirectToStripe({
gift,
uuid: userReceivingGift._id,
receiverName,
g1g1: userReceivingGift.g1g1,
})"
:paypal-fn="() => openPaypalGift({
gift: gift, giftedTo: userReceivingGift._id, receiverName,
gift: gift,
giftedTo: userReceivingGift._id,
receiverName,
g1g1: userReceivingGift.g1g1,
})"
/>
<payments-buttons
Expand Down
6 changes: 6 additions & 0 deletions website/client/src/components/userMenu/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@
import moment from 'moment';
import axios from 'axios';
import each from 'lodash/each';
import find from 'lodash/find';
import cloneDeep from 'lodash/cloneDeep';
import achievementsLib from '@/../../common/script/libs/achievements';
import Content from '@/../../common/script/content';
Expand Down Expand Up @@ -1062,8 +1063,12 @@ export default {
},
computed: {
...mapState({
currentEventList: 'worldState.data.currentEventList',
flatGear: 'content.gear.flat',
}),
currentEvent () {
return find(this.currentEventList, event => Boolean(event.promo));
},
userJoinedDate () {
return moment(this.user.auth.timestamps.created)
.format(this.userLoggedIn.preferences.dateFormat.toUpperCase());
Expand Down Expand Up @@ -1257,6 +1262,7 @@ export default {
},
openSendGemsModal () {
this.user.g1g1 = this.currentEvent?.promo === 'g1g1';
this.$store.state.giftModalOptions.startingPage = 'buyGems';
this.$root.$emit('habitica::send-gift', this.user);
},
Expand Down
8 changes: 8 additions & 0 deletions website/client/src/mixins/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default {
giftData,
gemsBlock,
sku,
g1g1,
} = data;
let { url } = data;

Expand All @@ -80,6 +81,10 @@ export default {
paymentType: type,
};

if (type === 'gift-subscription') {
appState.g1g1 = g1g1;
}

if (type === 'subscription') {
appState.subscriptionKey = this.subscriptionPlan || this.subscription.key;
}
Expand Down Expand Up @@ -164,6 +169,9 @@ export default {
paymentCompleted: false,
paymentType,
};
if (paymentType === 'gift-subscription') {
appState.g1g1 = data.g1g1;
}
if (paymentType === 'subscription') {
appState.subscriptionKey = sub.key;
} else if (paymentType === 'groupPlan') {
Expand Down
1 change: 1 addition & 0 deletions website/common/locales/en/npc.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"paymentYouReceived": "You received:",
"paymentYouSentGems": "You sent <strong><%- name %></strong>:",
"paymentYouSentSubscription": "You sent <strong><%- name %></strong><br> a <%= months %> month(s) Habitica subscription.",
"paymentYouSentSubscriptionG1G1": "You sent <strong><%- name %></strong><br> a <%= months %> month(s) Habitica subscription, and the same subscription was applied to your account for our Gift One Get One promotion!",
"paymentSubBilling": "Your subscription will be billed <strong>$<%= amount %></strong> every <strong><%= months %> months</strong>.",
"groupsPaymentSubBilling": "Your next billing date is <strong><%= renewalDate %></strong>.",
"paymentSubBillingWithMethod": "Your subscription will be billed<br><strong>$<%= amount %>.00 USD</strong> every <strong><%= months %> months</strong> via <strong><%= paymentMethod %></strong>",
Expand Down

0 comments on commit 54617f8

Please sign in to comment.