From 17ab8907f32d273b17064dd9e72f3eb45c28aa61 Mon Sep 17 00:00:00 2001 From: Konstantin Kostov Date: Mon, 1 Dec 2025 13:14:12 +0100 Subject: [PATCH] feat(pirate metrics): enable private helpers --- .../TelemetryDeck+Acquisition.swift | 24 ++++++++++++++++--- .../TelemetryDeck+Activation.swift | 15 ++++++++++-- .../TelemetryDeck+Referral.swift | 18 ++++++++++++-- .../PirateMetrics/TelemetryDeck+Revenue.swift | 8 ++++++- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Acquisition.swift b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Acquisition.swift index bc8668f..df2b519 100644 --- a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Acquisition.swift +++ b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Acquisition.swift @@ -1,7 +1,13 @@ import Foundation extension TelemetryDeck { - private static func acquiredUser( + /// Sends a telemetry signal indicating that a user was acquired through a specific channel. + /// + /// - Parameters: + /// - channel: The acquisition channel through which the user was acquired (e.g., "organic", "paid-search", "social-media"). + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func acquiredUser( channel: String, parameters: [String: String] = [:], customUserID: String? = nil @@ -15,7 +21,13 @@ extension TelemetryDeck { ) } - private static func leadStarted( + /// Sends a telemetry signal indicating that a lead has been initiated. + /// + /// - Parameters: + /// - leadID: A unique identifier for the lead being tracked. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func leadStarted( leadID: String, parameters: [String: String] = [:], customUserID: String? = nil @@ -29,7 +41,13 @@ extension TelemetryDeck { ) } - private static func leadConverted( + /// Sends a telemetry signal indicating that a lead has been successfully converted. + /// + /// - Parameters: + /// - leadID: A unique identifier for the lead that was converted. Should match the identifier used in `leadStarted`. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func leadConverted( leadID: String, parameters: [String: String] = [:], customUserID: String? = nil diff --git a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Activation.swift b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Activation.swift index f06b40d..f66cee1 100644 --- a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Activation.swift +++ b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Activation.swift @@ -1,7 +1,12 @@ import Foundation extension TelemetryDeck { - private static func onboardingCompleted( + /// Sends a telemetry signal indicating that a user has completed the onboarding process. + /// + /// - Parameters: + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func onboardingCompleted( parameters: [String: String] = [:], customUserID: String? = nil ) { @@ -14,7 +19,13 @@ extension TelemetryDeck { ) } - private static func coreFeatureUsed( + /// Sends a telemetry signal indicating that a core feature of the application has been used. + /// + /// - Parameters: + /// - featureName: The name of the core feature that was used. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func coreFeatureUsed( featureName: String, parameters: [String: String] = [:], customUserID: String? = nil diff --git a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Referral.swift b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Referral.swift index 91fe7fd..b08daa7 100644 --- a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Referral.swift +++ b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Referral.swift @@ -1,7 +1,14 @@ import Foundation extension TelemetryDeck { - private static func referralSent( + /// Sends a telemetry signal indicating that a referral has been sent. + /// + /// - Parameters: + /// - receiversCount: The number of recipients who received the referral. Default is `1`. + /// - kind: An optional categorization of the referral type (e.g., "email", "social", "sms"). Default is `nil`. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func referralSent( receiversCount: Int = 1, kind: String? = nil, parameters: [String: String] = [:], @@ -20,7 +27,14 @@ extension TelemetryDeck { ) } - private static func userRatingSubmitted( + /// Sends a telemetry signal indicating that a user has submitted a rating. + /// + /// - Parameters: + /// - rating: The rating value submitted by the user. Must be between 0 and 10 inclusive. + /// - comment: An optional comment or feedback text accompanying the rating. Default is `nil`. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func userRatingSubmitted( rating: Int, comment: String? = nil, parameters: [String: String] = [:], diff --git a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Revenue.swift b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Revenue.swift index e77e22f..fe9ba56 100644 --- a/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Revenue.swift +++ b/Sources/TelemetryDeck/PirateMetrics/TelemetryDeck+Revenue.swift @@ -1,7 +1,13 @@ import Foundation extension TelemetryDeck { - private static func paywallShown( + /// Sends a telemetry signal indicating that a paywall has been shown to the user. + /// + /// - Parameters: + /// - reason: The reason or context for showing the paywall (e.g., "trial-expired", "feature-locked", "onboarding"). + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + public static func paywallShown( reason: String, parameters: [String: String] = [:], customUserID: String? = nil