Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/KlaviyoCore/AppLifeCycleEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public enum LifeCycleEvents {
public struct AppLifeCycleEvents {
public var lifeCycleEvents: () -> AnyPublisher<LifeCycleEvents, Never>

@_spi(KlaviyoPrivate)
public init(lifeCycleEvents: @escaping () -> AnyPublisher<LifeCycleEvents, Never> = {
let terminated = environment
.notificationCenterPublisher(UIApplication.willTerminateNotification)
Expand Down
16 changes: 15 additions & 1 deletion Sources/KlaviyoCore/KlaviyoEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ import CoreLocation
import Foundation
import UIKit

public var environment = KlaviyoEnvironment.production
@_spi(KlaviyoPrivate)
public enum KlaviyoEnv {
#if compiler(>=5.10)
public nonisolated(unsafe) static var current = KlaviyoEnvironment.production
#else
public static var current = KlaviyoEnvironment.production
#endif
}

@_spi(KlaviyoPrivate)
@available(*, deprecated, renamed: "KlaviyoEnv.current")
public var environment: KlaviyoEnvironment {
get { KlaviyoEnv.current }
set { KlaviyoEnv.current = newValue }
}

public struct KlaviyoEnvironment {
public init(
Expand Down
1 change: 1 addition & 0 deletions Sources/KlaviyoCore/Networking/KlaviyoAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Foundation
public struct KlaviyoAPI {
public var send: (KlaviyoRequest, RequestAttemptInfo) async -> Result<Data, KlaviyoAPIError>

@_spi(KlaviyoPrivate)
public init(send: @escaping (KlaviyoRequest, RequestAttemptInfo) async -> Result<Data, KlaviyoAPIError> = { request, requestAttemptInfo in
let start = environment.date()

Expand Down
1 change: 1 addition & 0 deletions Sources/KlaviyoCore/Networking/KlaviyoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public struct KlaviyoRequest: Identifiable, Equatable, Codable {
/// - Parameters:
/// - id: A unique identifier for this request. If not provided, a UUID will be generated.
/// - endpoint: The endpoint this request will target.
@_spi(KlaviyoPrivate)
public init(
id: String = environment.uuid().uuidString,
endpoint: KlaviyoEndpoint
Expand Down
1 change: 0 additions & 1 deletion Sources/KlaviyoCore/Utils/LoggerClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public struct LoggerClient {
public static let production = Self(error: { message in os_log("%{public}s", type: .error, message) })
}

@usableFromInline
@inline(__always)
func runtimeWarn(
_ message: @autoclosure () -> String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoForms/InAppForms/IAFWebViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog
import WebKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#if DEBUG
import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import WebKit

// ViewModel for testing the KlaviyoWebViewController & KlaviyoWebViewModeling protocol in Xcode previews only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Combine
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import OSLog
import UIKit
import WebKit
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoLocation/GeofenceService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import CoreLocation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import CoreLocation
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoLocation/KlaviyoLocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Combine
import CoreLocation
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import OSLog

Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoLocation/Models/Geofence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import CoreLocation
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift

/// Represents a Klaviyo geofence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift

/// Manages geofence transition cooldown periods to prevent duplicate
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/Klaviyo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AnyCodable
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import OSLog
import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/KlaviyoInternal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

/// The internal interface for the Klaviyo SDK.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/Models/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AnyCodable
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

public struct Event: Equatable {
public enum EventName: Equatable, Hashable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

extension LifeCycleEvents {
var transformToKlaviyoAction: KlaviyoAction {
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/Models/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AnyCodable
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

public struct Profile: Equatable, Codable {
public enum ProfileKey: Equatable, Hashable, Codable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/Models/ProfileAPIExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

extension String {
internal func trimWhiteSpaceOrReturnNilIfEmpty() -> String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore

enum ErrorHandlingConstants {
static let maxBackoff = 60 * 3 // 3 minutes
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/StateManagement/KlaviyoState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AnyCodable
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import UIKit

typealias DeviceMetadata = PushTokenPayload.PushToken.Attributes.MetaData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import AnyCodable
import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import OSLog
import UIKit
import UserNotifications
Expand Down
2 changes: 1 addition & 1 deletion Sources/KlaviyoSwift/Utilities/EventBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Combine
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import OSLog

// MARK: - Logger
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/ArchivalUtilsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Combine
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import XCTest

class ArchivalUtilsTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/DeepLinkHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Claude on 9/17/25.
//

@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

final class DeepLinkHandlerTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/Dictionary+MetadataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Ajay Subramanya on 10/10/25.
//

import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import XCTest

final class DictionaryMetadataTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/EncodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Noah Durell on 11/14/22.
//

import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import SnapshotTesting
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/FileUtilsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Noah Durell on 9/29/22.
//

@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

class FileUtilsTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/KlaviyoAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Noah Durell on 11/16/22.
//

import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import SnapshotTesting
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/KlaviyoEndpointTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

final class KlaviyoEndpointTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/KlaviyoRequestTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

final class KlaviyoRequestTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/NetworkSessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Noah Durell on 11/18/22.
//

@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import SnapshotTesting
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/RequestAttemptInfoTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

final class RequestAttemptInfoTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/TestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Ajay Subramanya on 8/15/24.
//

@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import Combine
import CoreLocation
import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoCoreTests/WithTimeoutTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import XCTest

final class WithTimeoutTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@testable import KlaviyoForms
@testable import KlaviyoSwift
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import WebKit
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoFormsTests/IAFWebViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@testable import KlaviyoForms
@testable import KlaviyoSwift
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import WebKit
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/KlaviyoFormsTests/KlaviyoFormsTestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Isobelle Lim on 5/6/25.
//

@testable import KlaviyoCore
@_spi(KlaviyoPrivate) @testable import KlaviyoCore
import Combine
import CoreLocation
import Foundation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testable import KlaviyoForms
@testable import KlaviyoSwift
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import OSLog
import UIKit
import WebKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@testable import KlaviyoLocation
import Foundation
import KlaviyoCore
@_spi(KlaviyoPrivate) import KlaviyoCore
import KlaviyoSwift
import XCTest

Expand Down
Loading
Loading