Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for profile key enums mismatching #143

Merged
merged 2 commits into from
Apr 9, 2024
Merged
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
11 changes: 10 additions & 1 deletion ios/KlaviyoBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,16 @@ public class KlaviyoBridge: NSObject {

@objc
public static func setProfileAttribute(_ key: String, value: String) {
KlaviyoSDK().set(profileAttribute: getProfileKey(key), value: value)
switch key {
case "external_id":
setExternalId(value)
case "email":
setEmail(value)
case "phone_number":
setPhoneNumber(value)
default:
KlaviyoSDK().set(profileAttribute: getProfileKey(key), value: value)
}
}

@objc
Expand Down
3 changes: 3 additions & 0 deletions src/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,19 @@ export interface KlaviyoProfileApi {
export enum ProfileProperty {
/**
* A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.
* @deprecated Setting identifiers via setProfileAttribute is deprecated, and this enum will be removed in an upcoming release. Use the corresponding setter function instead.
*/
EXTERNAL_ID = PROFILE_KEYS.EXTERNAL_ID ?? 'external_id',

/**
* Individual's email address
* @deprecated Setting identifiers via setProfileAttribute is deprecated, and this enum will be removed in an upcoming release. Use the corresponding setter function instead.
*/
EMAIL = PROFILE_KEYS.EMAIL ?? 'email',

/**
* Individual's phone number in E.164 format
* @deprecated Setting identifiers via setProfileAttribute is deprecated, and this enum will be removed in an upcoming release. Use the corresponding setter function instead.
*/
PHONE_NUMBER = PROFILE_KEYS.PHONE_NUMBER ?? 'phone_number',

Expand Down