diff --git a/libs/analytics-events/EVENTS.md b/libs/analytics-events/EVENTS.md index 8dc934fb50..667a6c1c63 100644 --- a/libs/analytics-events/EVENTS.md +++ b/libs/analytics-events/EVENTS.md @@ -301,7 +301,7 @@ No properties. ### Sent Cash -Cash was sent to a person or to several people, or a share of a payment request was paid. `Context` says which: Direct for a send to one person, Group Send for a send to several members of a group, Payment Request for paying a share. `Recipient Count` is the number of members paid and is sent for a Group Send only. +Cash was sent to a person or to several people, or a share of a payment request was paid. `Context` says which: Direct for a send to one person, Group Send for a send to several members of a group, Payment Request for paying a share, Send Back for returning a DM's opening payment. `Recipient Count` is the number of members paid and is sent for a Group Send only. | Property | Type | Optional | Values | |---|---|---|---| @@ -313,6 +313,14 @@ Cash was sent to a person or to several people, or a share of a payment request > **Drift:** iOS sends Exchange Rate and no USDC (see Amount). +### Send Back: Tapped + +The receiver of a DM's opening payment tapped Send Back. `Has Balance` is false when their balance of the payment's token is too low, so the insufficient-balance modal showed instead of the confirm sheet. + +| Property | Type | Optional | Values | +|---|---|---|---| +| Has Balance | yes/no | no | | + ### Sent Tip | Property | Type | Optional | Values | @@ -806,6 +814,7 @@ The `Context` property on Sent Cash: which send the payment came from. | Direct | `DIRECT` | | | Group Send | `GROUP_SEND` | | | Payment Request | `PAYMENT_REQUEST` | | +| Send Back | `SEND_BACK` | | ### AddMoneySource diff --git a/libs/analytics-events/events.toml b/libs/analytics-events/events.toml index 84e2c4add2..f3491567e9 100644 --- a/libs/analytics-events/events.toml +++ b/libs/analytics-events/events.toml @@ -86,6 +86,7 @@ description = "The `Context` property on Sent Cash: which send the payment came DIRECT = "Direct" GROUP_SEND = "Group Send" PAYMENT_REQUEST = "Payment Request" +SEND_BACK = "Send Back" [lists.AddMoneySource] description = "The `Source` property on Add Money: Opened: where the user opened Add Money from." @@ -595,9 +596,18 @@ properties = [ { name = "Context", type = "SendContext", optional = true }, { name = "Recipient Count", type = "count", optional = true }, ] -description = "Cash was sent to a person or to several people, or a share of a payment request was paid. `Context` says which: Direct for a send to one person, Group Send for a send to several members of a group, Payment Request for paying a share. `Recipient Count` is the number of members paid and is sent for a Group Send only." +description = "Cash was sent to a person or to several people, or a share of a payment request was paid. `Context` says which: Direct for a send to one person, Group Send for a send to several members of a group, Payment Request for paying a share, Send Back for returning a DM's opening payment. `Recipient Count` is the number of members paid and is sent for a Group Send only." drift = "iOS sends Exchange Rate and no USDC (see Amount)." +[[event]] +domain = "Transfer" +name = "Send Back: Tapped" +builder = "sendBackTapped" +properties = [ + { name = "Has Balance", type = "yes/no" }, +] +description = "The receiver of a DM's opening payment tapped Send Back. `Has Balance` is false when their balance of the payment's token is too low, so the insufficient-balance modal showed instead of the confirm sheet." + [[event]] domain = "Transfer" name = "Sent Tip" diff --git a/libs/analytics-events/src/commonTest/kotlin/com/flipcash/analytics/TransferEventsTest.kt b/libs/analytics-events/src/commonTest/kotlin/com/flipcash/analytics/TransferEventsTest.kt index 89e7277dbf..a35c3469e3 100644 --- a/libs/analytics-events/src/commonTest/kotlin/com/flipcash/analytics/TransferEventsTest.kt +++ b/libs/analytics-events/src/commonTest/kotlin/com/flipcash/analytics/TransferEventsTest.kt @@ -130,6 +130,19 @@ class TransferEventsTest { assertEquals(PropertyValue.Text("Direct"), context(SendContext.DIRECT)) assertEquals(PropertyValue.Text("Group Send"), context(SendContext.GROUP_SEND)) assertEquals(PropertyValue.Text("Payment Request"), context(SendContext.PAYMENT_REQUEST)) + assertEquals(PropertyValue.Text("Send Back"), context(SendContext.SEND_BACK)) + } + + @Test + fun sendBackTappedCarriesHasBalance() { + assertEquals( + AnalyticsEvent("Send Back: Tapped", mapOf("Has Balance" to PropertyValue.Flag(true))), + TransferEvents.sendBackTapped(true), + ) + assertEquals( + AnalyticsEvent("Send Back: Tapped", mapOf("Has Balance" to PropertyValue.Flag(false))), + TransferEvents.sendBackTapped(false), + ) } @Test