Squashed commit of the following:

commit a1f44b855cff2b54992cdca81b9dd2f67c5de20a
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Wed Dec 4 15:28:54 2024 -0600

    fix(g1g1): pass promo data thru profile flow

commit a9923f882f3294ba22e1dff9497e6f74b0d12eab
Merge: 05793922b2 75c9731ca4
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Tue Dec 3 13:53:28 2024 -0600

    Merge branch 'develop' into sabrecat/g1g1-success

commit 05793922b2a3c0f9dd206b61beefb927b00859e4
Merge: b0bbc10457 d6c47e7e81
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Tue Nov 19 12:21:42 2024 -0600

    Merge branch 'develop' into sabrecat/g1g1-success

commit b0bbc10457b0558faeaf02305210c8b0d5ed5839
Author: Kalista Payne <sabrecat@gmail.com>
Date:   Mon Nov 4 16:26:30 2024 -0600

    feat(gifts): add dynamic G1G1 success text
    also clean out some more Amazon code
This commit is contained in:
Kalista Payne
2024-12-12 12:45:14 -06:00
parent 75c9731ca4
commit 54617f8583
6 changed files with 34 additions and 3 deletions

View File

@@ -71,7 +71,6 @@
id="selectUser"
v-model="userSearchTerm"
:is-valid="foundUser._id"
:placeholder="$t('usernameOrUserId')"
:invalid-issues="userInputInvalidIssues"
/>
@@ -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));
@@ -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();
},

View File

@@ -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>

View File

@@ -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

View File

@@ -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';
@@ -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());
@@ -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);
},

View File

@@ -71,6 +71,7 @@ export default {
giftData,
gemsBlock,
sku,
g1g1,
} = data;
let { url } = data;
@@ -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;
}
@@ -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') {

View File

@@ -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>",