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" id="selectUser"
v-model="userSearchTerm" v-model="userSearchTerm"
:is-valid="foundUser._id" :is-valid="foundUser._id"
:placeholder="$t('usernameOrUserId')" :placeholder="$t('usernameOrUserId')"
:invalid-issues="userInputInvalidIssues" :invalid-issues="userInputInvalidIssues"
/> />
@@ -318,6 +317,7 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
currentEventList: 'worldState.data.currentEventList', currentEventList: 'worldState.data.currentEventList',
user: 'user.data',
}), }),
currentEvent () { currentEvent () {
return find(this.currentEventList, event => Boolean(event.gemsPromo) || Boolean(event.promo)); return find(this.currentEventList, event => Boolean(event.gemsPromo) || Boolean(event.promo));
@@ -399,6 +399,8 @@ export default {
this.foundUser = result; this.foundUser = result;
}, 500), }, 500),
selectUser () { selectUser () {
this.foundUser.g1g1 = this.currentEvent?.promo === 'g1g1'
&& this.foundUser._id !== this.user._id;
this.$root.$emit('habitica::send-gift', this.foundUser); this.$root.$emit('habitica::send-gift', this.foundUser);
this.close(); this.close();
}, },

View File

@@ -59,6 +59,12 @@
<template v-if="paymentData.paymentType === 'gift-subscription'"> <template v-if="paymentData.paymentType === 'gift-subscription'">
<div> <div>
<span <span
v-if="paymentData.g1g1"
v-html="$t('paymentYouSentSubscriptionG1G1', {
name: paymentData.giftReceiver, months: paymentData.subscription.months})"
></span>
<span
v-else
v-html="$t('paymentYouSentSubscription', { v-html="$t('paymentYouSentSubscription', {
name: paymentData.giftReceiver, months: paymentData.subscription.months})" name: paymentData.giftReceiver, months: paymentData.subscription.months})"
></span> ></span>

View File

@@ -147,9 +147,17 @@
<payments-buttons <payments-buttons
v-if="userReceivingGift?._id" v-if="userReceivingGift?._id"
:disabled="!subscription.key" :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({ :paypal-fn="() => openPaypalGift({
gift: gift, giftedTo: userReceivingGift._id, receiverName, gift: gift,
giftedTo: userReceivingGift._id,
receiverName,
g1g1: userReceivingGift.g1g1,
})" })"
/> />
<payments-buttons <payments-buttons

View File

@@ -979,6 +979,7 @@
import moment from 'moment'; import moment from 'moment';
import axios from 'axios'; import axios from 'axios';
import each from 'lodash/each'; import each from 'lodash/each';
import find from 'lodash/find';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import achievementsLib from '@/../../common/script/libs/achievements'; import achievementsLib from '@/../../common/script/libs/achievements';
import Content from '@/../../common/script/content'; import Content from '@/../../common/script/content';
@@ -1062,8 +1063,12 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
currentEventList: 'worldState.data.currentEventList',
flatGear: 'content.gear.flat', flatGear: 'content.gear.flat',
}), }),
currentEvent () {
return find(this.currentEventList, event => Boolean(event.promo));
},
userJoinedDate () { userJoinedDate () {
return moment(this.user.auth.timestamps.created) return moment(this.user.auth.timestamps.created)
.format(this.userLoggedIn.preferences.dateFormat.toUpperCase()); .format(this.userLoggedIn.preferences.dateFormat.toUpperCase());
@@ -1257,6 +1262,7 @@ export default {
}, },
openSendGemsModal () { openSendGemsModal () {
this.user.g1g1 = this.currentEvent?.promo === 'g1g1';
this.$store.state.giftModalOptions.startingPage = 'buyGems'; this.$store.state.giftModalOptions.startingPage = 'buyGems';
this.$root.$emit('habitica::send-gift', this.user); this.$root.$emit('habitica::send-gift', this.user);
}, },

View File

@@ -71,6 +71,7 @@ export default {
giftData, giftData,
gemsBlock, gemsBlock,
sku, sku,
g1g1,
} = data; } = data;
let { url } = data; let { url } = data;
@@ -80,6 +81,10 @@ export default {
paymentType: type, paymentType: type,
}; };
if (type === 'gift-subscription') {
appState.g1g1 = g1g1;
}
if (type === 'subscription') { if (type === 'subscription') {
appState.subscriptionKey = this.subscriptionPlan || this.subscription.key; appState.subscriptionKey = this.subscriptionPlan || this.subscription.key;
} }
@@ -164,6 +169,9 @@ export default {
paymentCompleted: false, paymentCompleted: false,
paymentType, paymentType,
}; };
if (paymentType === 'gift-subscription') {
appState.g1g1 = data.g1g1;
}
if (paymentType === 'subscription') { if (paymentType === 'subscription') {
appState.subscriptionKey = sub.key; appState.subscriptionKey = sub.key;
} else if (paymentType === 'groupPlan') { } else if (paymentType === 'groupPlan') {

View File

@@ -96,6 +96,7 @@
"paymentYouReceived": "You received:", "paymentYouReceived": "You received:",
"paymentYouSentGems": "You sent <strong><%- name %></strong>:", "paymentYouSentGems": "You sent <strong><%- name %></strong>:",
"paymentYouSentSubscription": "You sent <strong><%- name %></strong><br> a <%= months %> month(s) Habitica subscription.", "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>.", "paymentSubBilling": "Your subscription will be billed <strong>$<%= amount %></strong> every <strong><%= months %> months</strong>.",
"groupsPaymentSubBilling": "Your next billing date is <strong><%= renewalDate %></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>", "paymentSubBillingWithMethod": "Your subscription will be billed<br><strong>$<%= amount %>.00 USD</strong> every <strong><%= months %> months</strong> via <strong><%= paymentMethod %></strong>",