@revenuecat/purchases-js 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -786,6 +786,12 @@ export declare interface PurchaseParams {
786
786
  * to the RC transaction as metadata.
787
787
  */
788
788
  metadata?: PurchaseMetadata;
789
+ /**
790
+ * If set to true, the SDK will skip the success page and automatically
791
+ * continue the flow once the purchase completes successfully.
792
+ * Defaults to `false`.
793
+ */
794
+ skipSuccessPage?: boolean;
789
795
  }
790
796
 
791
797
  /**
@@ -828,7 +834,7 @@ export declare class Purchases {
828
834
  static setPlatformInfo(platformInfo: PlatformInfo): void;
829
835
  /**
830
836
  * Get the singleton instance of Purchases. It's preferred to use the instance
831
- * obtained from the {@link Purchases.configure} method when possible.
837
+ * obtained from the `configure` method when possible.
832
838
  * @throws {@link UninitializedPurchasesError} if the instance has not been initialized yet.
833
839
  */
834
840
  static getSharedInstance(): Purchases;
@@ -840,505 +846,557 @@ export declare class Purchases {
840
846
  * Configures the Purchases SDK. This should be called as soon as your app
841
847
  * has a unique user id for your user. You should only call this once, and
842
848
  * keep the returned instance around for use throughout your application.
843
- * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
844
- * @param appUserId - Your unique id for identifying the user.
845
- * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
846
- * @param flags - Advanced functionality configuration {@link FlagsConfig}.
849
+ * @param config - Configuration object containing apiKey, appUserId, and optional configurations.
847
850
  * @throws {@link PurchasesError} if the API key or user id are invalid.
848
851
  */
849
- static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
850
- /**
851
- * Loads and caches some optional data in the Purchases SDK.
852
- * Currently only fetching branding information.
853
- * You can call this method after configuring the SDK to speed
854
- * up the first call to {@link Purchases.purchase}.
855
- */
856
- preload(): Promise<void>;
857
- /**
858
- * Fetch the configured offerings for this user. You can configure these
859
- * in the RevenueCat dashboard.
860
- * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
861
- */
862
- getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
863
- /**
864
- * Retrieves a specific offering by a placement identifier.
865
- * For more info see https://www.revenuecat.com/docs/tools/targeting
866
- * @param placementIdentifier - The placement identifier to retrieve the offering for.
867
- * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
868
- */
869
- getCurrentOfferingForPlacement(placementIdentifier: string, params?: GetOfferingsParams): Promise<Offering | null>;
870
- private getAllOfferings;
852
+ static configure(config: PurchasesConfig): Purchases;
871
853
  /**
872
- * Convenience method to check whether a user is entitled to a specific
873
- * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
874
- * @param entitlementIdentifier - The entitlement identifier you want to check.
875
- * @returns Whether the user is entitled to the specified entitlement
876
- * @throws {@link PurchasesError} if there is an error while fetching the customer info.
877
- * @see {@link Purchases.getCustomerInfo}
854
+ * Legacy method to configure the Purchases SDK. This method is deprecated and will be removed in a future version.
855
+ * @deprecated - please use the `configure` method with a {@link PurchasesConfig} object instead.
856
+ * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
857
+ * @param appUserId - Your unique id for identifying the user.
858
+ * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
859
+ * @param flags - Advanced functionality configuration {@link FlagsConfig}.
860
+ * @throws {@link PurchasesError} if the API key or user id are invalid.
878
861
  */
879
- isEntitledTo(entitlementIdentifier: string): Promise<boolean>;
862
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
863
+ private static configureInternal;
864
+ private static validateConfig;
880
865
  /**
881
- * Method to perform a purchase for a given package. You can obtain the
882
- * package from {@link Purchases.getOfferings}. This method will present the purchase
883
- * form on your site, using the given HTML element as the mount point, if
884
- * provided, or as a modal if not.
885
- * @deprecated - please use .purchase
886
- * @param rcPackage - The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
887
- * @param customerEmail - The email of the user. If undefined, RevenueCat will ask the customer for their email.
888
- * @param htmlTarget - The HTML element where the billing view should be added. If undefined, a new div will be created at the root of the page and appended to the body.
889
- * @returns a Promise for the customer info after the purchase is completed successfully.
890
- * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
866
+ * Loads and caches some optional data in the Purchases SDK.
867
+ * Currently only fetching branding information.
868
+ * You can call this method after configuring the SDK to speed
869
+ * up the first call to {@link Purchases.purchase}.
870
+ */
871
+ preload(): Promise<void>;
872
+ /**
873
+ * Fetch the configured offerings for this user. You can configure these
874
+ * in the RevenueCat dashboard.
875
+ * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
876
+ */
877
+ getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
878
+ /**
879
+ * Retrieves a specific offering by a placement identifier.
880
+ * For more info see https://www.revenuecat.com/docs/tools/targeting
881
+ * @param placementIdentifier - The placement identifier to retrieve the offering for.
882
+ * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
883
+ */
884
+ getCurrentOfferingForPlacement(placementIdentifier: string, params?: GetOfferingsParams): Promise<Offering | null>;
885
+ private getAllOfferings;
886
+ /**
887
+ * Convenience method to check whether a user is entitled to a specific
888
+ * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
889
+ * @param entitlementIdentifier - The entitlement identifier you want to check.
890
+ * @returns Whether the user is entitled to the specified entitlement
891
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
892
+ * @see {@link Purchases.getCustomerInfo}
891
893
  */
892
- purchasePackage(rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<PurchaseResult>;
894
+ isEntitledTo(entitlementIdentifier: string): Promise<boolean>;
893
895
  /**
894
896
  * Method to perform a purchase for a given package. You can obtain the
895
897
  * package from {@link Purchases.getOfferings}. This method will present the purchase
896
898
  * form on your site, using the given HTML element as the mount point, if
897
899
  * provided, or as a modal if not.
898
- * @param params - The parameters object to customise the purchase flow. Check {@link PurchaseParams}
899
- * @returns a Promise for the customer and redemption info after the purchase is completed successfully.
900
+ * @deprecated - please use .purchase
901
+ * @param rcPackage - The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
902
+ * @param customerEmail - The email of the user. If undefined, RevenueCat will ask the customer for their email.
903
+ * @param htmlTarget - The HTML element where the billing view should be added. If undefined, a new div will be created at the root of the page and appended to the body.
904
+ * @returns a Promise for the customer info after the purchase is completed successfully.
900
905
  * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
901
906
  */
902
- purchase(params: PurchaseParams): Promise<PurchaseResult>;
907
+ purchasePackage(rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<PurchaseResult>;
903
908
  /**
904
- * Gets latest available {@link CustomerInfo}.
905
- * @returns The latest {@link CustomerInfo}.
906
- * @throws {@link PurchasesError} if there is an error while fetching the customer info.
909
+ * Method to perform a purchase for a given package. You can obtain the
910
+ * package from {@link Purchases.getOfferings}. This method will present the purchase
911
+ * form on your site, using the given HTML element as the mount point, if
912
+ * provided, or as a modal if not.
913
+ * @param params - The parameters object to customise the purchase flow. Check {@link PurchaseParams}
914
+ * @returns a Promise for the customer and redemption info after the purchase is completed successfully.
915
+ * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
907
916
  */
908
- getCustomerInfo(): Promise<CustomerInfo>;
909
- /**
910
- * Gets the current app user id.
911
- */
912
- getAppUserId(): string;
917
+ purchase(params: PurchaseParams): Promise<PurchaseResult>;
913
918
  /**
914
- * Sets attributes for the current user. Attributes are useful for storing additional, structured information on a customer that can be used elsewhere in the system.
915
- * For example, you could store your customer's email address or additional system identifiers through the applicable reserved attributes, or store arbitrary facts like onboarding survey responses, feature usage, or other dimensions as custom attributes.
916
- *
917
- * Note: Unlike our mobile SDKs, the web SDK does not cache or retry sending attributes if the request fails. If the request fails, the attributes will not be saved and you will need to retry the operation.
918
- *
919
- * @param attributes - A dictionary of attributes to set for the current user.
920
- * @throws {@link PurchasesError} if there is an error while setting the attributes or if the customer doesn't exist.
919
+ * Gets latest available {@link CustomerInfo}.
920
+ * @returns The latest {@link CustomerInfo}.
921
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
921
922
  */
922
- setAttributes(attributes: {
923
- [key: string | ReservedCustomerAttribute]: string | null;
924
- }): Promise<void>;
923
+ getCustomerInfo(): Promise<CustomerInfo>;
925
924
  /**
926
- * Change the current app user id. Returns the customer info for the new
927
- * user id.
928
- * @param newAppUserId - The user id to change to.
925
+ * Gets the current app user id.
929
926
  */
930
- changeUser(newAppUserId: string): Promise<CustomerInfo>;
927
+ getAppUserId(): string;
931
928
  /**
932
- * @returns Whether the SDK is using a sandbox API Key.
933
- */
934
- isSandbox(): boolean;
929
+ * Sets attributes for the current user. Attributes are useful for storing additional, structured information on a customer that can be used elsewhere in the system.
930
+ * For example, you could store your customer's email address or additional system identifiers through the applicable reserved attributes, or store arbitrary facts like onboarding survey responses, feature usage, or other dimensions as custom attributes.
931
+ *
932
+ * Note: Unlike our mobile SDKs, the web SDK does not cache or retry sending attributes if the request fails. If the request fails, the attributes will not be saved and you will need to retry the operation.
933
+ *
934
+ * @param attributes - A dictionary of attributes to set for the current user.
935
+ * @throws {@link PurchasesError} if there is an error while setting the attributes or if the customer doesn't exist.
936
+ */
937
+ setAttributes(attributes: {
938
+ [key: string | ReservedCustomerAttribute]: string | null;
939
+ }): Promise<void>;
940
+ /**
941
+ * Change the current app user id. Returns the customer info for the new
942
+ * user id.
943
+ * @param newAppUserId - The user id to change to.
944
+ */
945
+ changeUser(newAppUserId: string): Promise<CustomerInfo>;
946
+ /**
947
+ * @returns Whether the SDK is using a sandbox API Key.
948
+ */
949
+ isSandbox(): boolean;
950
+ /**
951
+ * @returns Whether the current user is anonymous.
952
+ */
953
+ isAnonymous(): boolean;
954
+ /**
955
+ * Closes the Purchases instance. You should never have to do this normally.
956
+ */
957
+ close(): void;
958
+ /**
959
+ * Generates an anonymous app user ID that follows RevenueCat's format.
960
+ * This can be used when you don't have a user identifier system in place.
961
+ * The generated ID will be in the format: $RCAnonymousID:\<UUID without dashes\>
962
+ * Example: $RCAnonymousID:123e4567e89b12d3a456426614174000
963
+ * @returns A new anonymous app user ID string
964
+ * @public
965
+ */
966
+ static generateRevenueCatAnonymousAppUserId(): string;
967
+ }
968
+
935
969
  /**
936
- * @returns Whether the current user is anonymous.
970
+ * Configuration object for initializing the Purchases SDK.
971
+ *
972
+ * @example
973
+ * ```typescript
974
+ * // Object-based configuration (recommended)
975
+ * const purchases = Purchases.configure({
976
+ * apiKey: "your_api_key",
977
+ * appUserId: "user_123",
978
+ * httpConfig: { additionalHeaders: { "Custom-Header": "value" } },
979
+ * flags: { autoCollectUTMAsMetadata: true }
980
+ * });
981
+ *
982
+ * // Legacy separate arguments (deprecated)
983
+ * const purchases = Purchases.configure(
984
+ * "your_api_key",
985
+ * "user_123",
986
+ * { additionalHeaders: { "Custom-Header": "value" } },
987
+ * { autoCollectUTMAsMetadata: true }
988
+ * );
989
+ * ```
990
+ *
991
+ * @public
937
992
  */
938
- isAnonymous(): boolean;
993
+ export declare interface PurchasesConfig {
994
+ /**
995
+ * RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
996
+ */
997
+ apiKey: string;
998
+ /**
999
+ * Your unique id for identifying the user.
1000
+ */
1001
+ appUserId: string;
1002
+ /**
1003
+ * Advanced http configuration to customise the SDK usage {@link HttpConfig}.
1004
+ */
1005
+ httpConfig?: HttpConfig;
1006
+ /**
1007
+ * Advanced functionality configuration {@link FlagsConfig}.
1008
+ */
1009
+ flags?: FlagsConfig;
1010
+ }
1011
+
939
1012
  /**
940
- * Closes the Purchases instance. You should never have to do this normally.
1013
+ * Error class for Purchases SDK. You should handle these errors and react
1014
+ * accordingly in your app.
1015
+ * @public
941
1016
  */
942
- close(): void;
1017
+ export declare class PurchasesError extends Error {
1018
+ /**
1019
+ * Error code for the error. This is useful to appropriately react to
1020
+ * different error situations.
1021
+ */
1022
+ readonly errorCode: ErrorCode;
1023
+ /**
1024
+ * Underlying error message. This provides more details on the error and
1025
+ * can be useful for debugging and logging.
1026
+ */
1027
+ readonly underlyingErrorMessage?: string | null | undefined;
1028
+ /**
1029
+ * Contains extra information that is available in certain types of errors.
1030
+ */
1031
+ readonly extra?: PurchasesErrorExtra | undefined;
1032
+ constructor(
1033
+ /**
1034
+ * Error code for the error. This is useful to appropriately react to
1035
+ * different error situations.
1036
+ */
1037
+ errorCode: ErrorCode,
1038
+ /**
1039
+ * Message for the error. This is useful for debugging and logging.
1040
+ */
1041
+ message?: string,
1042
+ /**
1043
+ * Underlying error message. This provides more details on the error and
1044
+ * can be useful for debugging and logging.
1045
+ */
1046
+ underlyingErrorMessage?: string | null | undefined,
1047
+ /**
1048
+ * Contains extra information that is available in certain types of errors.
1049
+ */
1050
+ extra?: PurchasesErrorExtra | undefined);
1051
+ toString: () => string;
1052
+ }
1053
+
943
1054
  /**
944
- * Generates an anonymous app user ID that follows RevenueCat's format.
945
- * This can be used when you don't have a user identifier system in place.
946
- * The generated ID will be in the format: $RCAnonymousID:\<UUID without dashes\>
947
- * Example: $RCAnonymousID:123e4567e89b12d3a456426614174000
948
- * @returns A new anonymous app user ID string
1055
+ * Extra information that is available in certain types of errors.
949
1056
  * @public
950
1057
  */
951
- static generateRevenueCatAnonymousAppUserId(): string;
952
- }
1058
+ export declare interface PurchasesErrorExtra {
1059
+ /**
1060
+ * If this is a request error, the HTTP status code of the response.
1061
+ */
1062
+ readonly statusCode?: number;
1063
+ /**
1064
+ * If this is a RevenueCat backend error, the error code from the servers.
1065
+ */
1066
+ readonly backendErrorCode?: number;
1067
+ }
953
1068
 
954
- /**
955
- * Error class for Purchases SDK. You should handle these errors and react
956
- * accordingly in your app.
957
- * @public
958
- */
959
- export declare class PurchasesError extends Error {
960
- /**
961
- * Error code for the error. This is useful to appropriately react to
962
- * different error situations.
963
- */
964
- readonly errorCode: ErrorCode;
965
- /**
966
- * Underlying error message. This provides more details on the error and
967
- * can be useful for debugging and logging.
968
- */
969
- readonly underlyingErrorMessage?: string | null | undefined;
970
- /**
971
- * Contains extra information that is available in certain types of errors.
972
- */
973
- readonly extra?: PurchasesErrorExtra | undefined;
974
- constructor(
975
- /**
976
- * Error code for the error. This is useful to appropriately react to
977
- * different error situations.
978
- */
979
- errorCode: ErrorCode,
980
- /**
981
- * Message for the error. This is useful for debugging and logging.
982
- */
983
- message?: string,
984
- /**
985
- * Underlying error message. This provides more details on the error and
986
- * can be useful for debugging and logging.
987
- */
988
- underlyingErrorMessage?: string | null | undefined,
989
- /**
990
- * Contains extra information that is available in certain types of errors.
991
- */
992
- extra?: PurchasesErrorExtra | undefined);
993
- toString: () => string;
994
- }
995
-
996
- /**
997
- * Extra information that is available in certain types of errors.
998
- * @public
999
- */
1000
- export declare interface PurchasesErrorExtra {
1001
- /**
1002
- * If this is a request error, the HTTP status code of the response.
1003
- */
1004
- readonly statusCode?: number;
1005
- /**
1006
- * If this is a RevenueCat backend error, the error code from the servers.
1007
- */
1008
- readonly backendErrorCode?: number;
1009
- }
1010
-
1011
- /**
1012
- * This object gives you access to the purchase redemption data when
1013
- * the purchase can be redeemed to a mobile user, like in the case of anonymous users.
1014
- * @public
1015
- */
1016
- export declare interface RedemptionInfo {
1017
- /**
1018
- * The redeem url.
1019
- */
1020
- readonly redeemUrl: string | null;
1021
- }
1069
+ /**
1070
+ * This object gives you access to the purchase redemption data when
1071
+ * the purchase can be redeemed to a mobile user, like in the case of anonymous users.
1072
+ * @public
1073
+ */
1074
+ export declare interface RedemptionInfo {
1075
+ /**
1076
+ * The redeem url.
1077
+ */
1078
+ readonly redeemUrl: string | null;
1079
+ }
1022
1080
 
1023
- /**
1024
- * Enumeration of reserved customer attributes.
1025
- * @public
1026
- */
1027
- export declare enum ReservedCustomerAttribute {
1028
- /**
1029
- * The display name that should be used to reference the customer.
1030
- */
1031
- DisplayName = "$displayName",
1032
- /**
1033
- * The email address of the customer.
1034
- */
1035
- Email = "$email",
1036
- /**
1037
- * The phone number of the customer.
1038
- */
1039
- PhoneNumber = "$phoneNumber",
1040
- /**
1041
- * iOS advertising identifier UUID for the customer.
1042
- */
1043
- IDFA = "$idfa",
1044
- /**
1045
- * iOS vendor identifier UUID for the customer.
1046
- */
1047
- IDFV = "$idfv",
1048
- /**
1049
- * The advertising ID that is provided by Google Play services for the customer.
1050
- */
1051
- GPSAdId = "$gpsAdId",
1052
- /**
1053
- * The Android ID of the customer.
1054
- */
1055
- AndroidId = "$androidId",
1056
- /**
1057
- * The Amazon Advertising ID of the customer.
1058
- */
1059
- AmazonAdId = "$amazonAdId",
1060
- /**
1061
- * The IP address of the customer.
1062
- */
1063
- IP = "$ip",
1064
- /**
1065
- * The unique Adjust identifier for the customer.
1066
- */
1067
- AdjustId = "$adjustId",
1068
- /**
1069
- * The Amplitude device ID of the customer.
1070
- */
1071
- AmplitudeDeviceId = "$amplitudeDeviceId",
1072
- /**
1073
- * The Amplitude user ID of the customer.
1074
- */
1075
- AmplitudeUserId = "$amplitudeUserId",
1076
- /**
1077
- * Appsflyer Id. The unique Appsflyer identifier for the customer.
1078
- */
1079
- AppsflyerId = "$appsflyerId",
1080
- /**
1081
- * The AppsFlyer sharing filter of the customer.
1082
- */
1083
- AppsflyerSharingFilter = "$appsflyerSharingFilter",
1084
- /**
1085
- * The Branch ID of the customer.
1086
- */
1087
- BranchId = "$branchId",
1088
- /**
1089
- * The Braze 'alias_name' in User Alias Object.
1090
- */
1091
- BrazeAliasName = "$brazeAliasName",
1092
- /**
1093
- * The Braze 'alias_label' in User Alias Object.
1094
- */
1095
- BrazeAliasLabel = "$brazeAliasLabel",
1096
- /**
1097
- * The CleverTap ID of the customer.
1098
- */
1099
- ClevertapId = "$clevertapId",
1100
- /**
1101
- * The Facebook anonymous ID of the customer.
1102
- */
1103
- FbAnonId = "$fbAnonId",
1104
- /**
1105
- * The unique mParticle user identifier (mpid).
1106
- */
1107
- MparticleId = "$mparticleId",
1108
- /**
1109
- * The OneSignal Player Id for the customer.
1110
- */
1111
- OnesignalId = "$onesignalId",
1112
- /**
1113
- * The OneSignal user ID of the customer.
1114
- */
1115
- OnesignalUserId = "$onesignalUserId",
1116
- /**
1117
- * The Intercom contact ID of the customer.
1118
- */
1119
- IntercomContactId = "$intercomContactId",
1120
- /**
1121
- * The media source of the customer.
1122
- */
1123
- MediaSource = "$mediaSource",
1124
- /**
1125
- * The campaign of the customer.
1126
- */
1127
- Campaign = "$campaign",
1128
- /**
1129
- * The ad group of the customer.
1130
- */
1131
- AdGroup = "$adGroup",
1132
- /**
1133
- * The Ad ID of the customer.
1134
- */
1135
- AdId = "$ad",
1136
- /**
1137
- * The keyword of the customer.
1138
- */
1139
- Keyword = "$keyword",
1140
- /**
1141
- * The creative of the customer.
1142
- */
1143
- Creative = "$creative",
1144
- /**
1145
- * Apple push notification tokens for the customer.
1146
- */
1147
- APNSTokens = "$apnsTokens",
1148
- /**
1149
- * Google push notification tokens for the customer.
1150
- */
1151
- FCMTokens = "$fcmTokens",
1152
- /**
1153
- * The Airship channel ID of the customer.
1154
- */
1155
- AirshipChannelId = "$airshipChannelId",
1156
- /**
1157
- * The segment ID of the customer.
1158
- */
1159
- SegmentId = "$segmentId",
1160
- /**
1161
- * The Iterable user ID of the customer.
1162
- */
1163
- IterableUserId = "$iterableUserId",
1164
- /**
1165
- * The Iterable campaign ID of the customer.
1166
- */
1167
- IterableCampaignId = "$iterableCampaignId",
1168
- /**
1169
- * The Iterable template ID of the customer.
1170
- */
1171
- IterableTemplateId = "$iterableTemplateId",
1172
- /**
1173
- * The Firebase app instance ID of the customer.
1174
- */
1175
- FirebaseAppInstanceId = "$firebaseAppInstanceId",
1176
- /**
1177
- * The Mixpanel distinct ID of the customer.
1178
- */
1179
- MixpanelDistinctId = "$mixpanelDistinctId",
1180
- /**
1181
- * Apple App Tracking Transparency consent status for the customer.
1182
- */
1183
- ATTConsentStatus = "$attConsentStatus",
1184
- /**
1185
- * The unique Kochava device identifier of the customer.
1186
- */
1187
- KochavaDeviceId = "$kochavaDeviceId",
1188
- /**
1189
- * The device version of the customer.
1190
- */
1191
- DeviceVersion = "$deviceVersion",
1192
- /**
1193
- * The PostHog user ID of the customer.
1194
- */
1195
- PosthogUserId = "$posthogUserId",
1196
- /**
1197
- * The Telemetry Deck user ID of the customer.
1198
- */
1199
- TelemetryDeckUserId = "$telemetryDeckUserId",
1200
- /**
1201
- * The Telemetry Deck app ID of the customer.
1202
- */
1203
- TelemetryDeckAppId = "$telemetryDeckAppId",
1204
- /**
1205
- * The Apple refund handling preference of the customer.
1206
- */
1207
- AppleRefundHandlingPreference = "$appleRefundHandlingPreference",
1208
- /**
1209
- * The customer.io ID of the customer.
1210
- */
1211
- CustomerioId = "$customerioId",
1212
- /**
1213
- * The Tenjin ID of the customer.
1214
- */
1215
- TenjinId = "$tenjinId"
1216
- }
1081
+ /**
1082
+ * Enumeration of reserved customer attributes.
1083
+ * @public
1084
+ */
1085
+ export declare enum ReservedCustomerAttribute {
1086
+ /**
1087
+ * The display name that should be used to reference the customer.
1088
+ */
1089
+ DisplayName = "$displayName",
1090
+ /**
1091
+ * The email address of the customer.
1092
+ */
1093
+ Email = "$email",
1094
+ /**
1095
+ * The phone number of the customer.
1096
+ */
1097
+ PhoneNumber = "$phoneNumber",
1098
+ /**
1099
+ * iOS advertising identifier UUID for the customer.
1100
+ */
1101
+ IDFA = "$idfa",
1102
+ /**
1103
+ * iOS vendor identifier UUID for the customer.
1104
+ */
1105
+ IDFV = "$idfv",
1106
+ /**
1107
+ * The advertising ID that is provided by Google Play services for the customer.
1108
+ */
1109
+ GPSAdId = "$gpsAdId",
1110
+ /**
1111
+ * The Android ID of the customer.
1112
+ */
1113
+ AndroidId = "$androidId",
1114
+ /**
1115
+ * The Amazon Advertising ID of the customer.
1116
+ */
1117
+ AmazonAdId = "$amazonAdId",
1118
+ /**
1119
+ * The IP address of the customer.
1120
+ */
1121
+ IP = "$ip",
1122
+ /**
1123
+ * The unique Adjust identifier for the customer.
1124
+ */
1125
+ AdjustId = "$adjustId",
1126
+ /**
1127
+ * The Amplitude device ID of the customer.
1128
+ */
1129
+ AmplitudeDeviceId = "$amplitudeDeviceId",
1130
+ /**
1131
+ * The Amplitude user ID of the customer.
1132
+ */
1133
+ AmplitudeUserId = "$amplitudeUserId",
1134
+ /**
1135
+ * Appsflyer Id. The unique Appsflyer identifier for the customer.
1136
+ */
1137
+ AppsflyerId = "$appsflyerId",
1138
+ /**
1139
+ * The AppsFlyer sharing filter of the customer.
1140
+ */
1141
+ AppsflyerSharingFilter = "$appsflyerSharingFilter",
1142
+ /**
1143
+ * The Branch ID of the customer.
1144
+ */
1145
+ BranchId = "$branchId",
1146
+ /**
1147
+ * The Braze 'alias_name' in User Alias Object.
1148
+ */
1149
+ BrazeAliasName = "$brazeAliasName",
1150
+ /**
1151
+ * The Braze 'alias_label' in User Alias Object.
1152
+ */
1153
+ BrazeAliasLabel = "$brazeAliasLabel",
1154
+ /**
1155
+ * The CleverTap ID of the customer.
1156
+ */
1157
+ ClevertapId = "$clevertapId",
1158
+ /**
1159
+ * The Facebook anonymous ID of the customer.
1160
+ */
1161
+ FbAnonId = "$fbAnonId",
1162
+ /**
1163
+ * The unique mParticle user identifier (mpid).
1164
+ */
1165
+ MparticleId = "$mparticleId",
1166
+ /**
1167
+ * The OneSignal Player Id for the customer.
1168
+ */
1169
+ OnesignalId = "$onesignalId",
1170
+ /**
1171
+ * The OneSignal user ID of the customer.
1172
+ */
1173
+ OnesignalUserId = "$onesignalUserId",
1174
+ /**
1175
+ * The Intercom contact ID of the customer.
1176
+ */
1177
+ IntercomContactId = "$intercomContactId",
1178
+ /**
1179
+ * The media source of the customer.
1180
+ */
1181
+ MediaSource = "$mediaSource",
1182
+ /**
1183
+ * The campaign of the customer.
1184
+ */
1185
+ Campaign = "$campaign",
1186
+ /**
1187
+ * The ad group of the customer.
1188
+ */
1189
+ AdGroup = "$adGroup",
1190
+ /**
1191
+ * The Ad ID of the customer.
1192
+ */
1193
+ AdId = "$ad",
1194
+ /**
1195
+ * The keyword of the customer.
1196
+ */
1197
+ Keyword = "$keyword",
1198
+ /**
1199
+ * The creative of the customer.
1200
+ */
1201
+ Creative = "$creative",
1202
+ /**
1203
+ * Apple push notification tokens for the customer.
1204
+ */
1205
+ APNSTokens = "$apnsTokens",
1206
+ /**
1207
+ * Google push notification tokens for the customer.
1208
+ */
1209
+ FCMTokens = "$fcmTokens",
1210
+ /**
1211
+ * The Airship channel ID of the customer.
1212
+ */
1213
+ AirshipChannelId = "$airshipChannelId",
1214
+ /**
1215
+ * The segment ID of the customer.
1216
+ */
1217
+ SegmentId = "$segmentId",
1218
+ /**
1219
+ * The Iterable user ID of the customer.
1220
+ */
1221
+ IterableUserId = "$iterableUserId",
1222
+ /**
1223
+ * The Iterable campaign ID of the customer.
1224
+ */
1225
+ IterableCampaignId = "$iterableCampaignId",
1226
+ /**
1227
+ * The Iterable template ID of the customer.
1228
+ */
1229
+ IterableTemplateId = "$iterableTemplateId",
1230
+ /**
1231
+ * The Firebase app instance ID of the customer.
1232
+ */
1233
+ FirebaseAppInstanceId = "$firebaseAppInstanceId",
1234
+ /**
1235
+ * The Mixpanel distinct ID of the customer.
1236
+ */
1237
+ MixpanelDistinctId = "$mixpanelDistinctId",
1238
+ /**
1239
+ * Apple App Tracking Transparency consent status for the customer.
1240
+ */
1241
+ ATTConsentStatus = "$attConsentStatus",
1242
+ /**
1243
+ * The unique Kochava device identifier of the customer.
1244
+ */
1245
+ KochavaDeviceId = "$kochavaDeviceId",
1246
+ /**
1247
+ * The device version of the customer.
1248
+ */
1249
+ DeviceVersion = "$deviceVersion",
1250
+ /**
1251
+ * The PostHog user ID of the customer.
1252
+ */
1253
+ PosthogUserId = "$posthogUserId",
1254
+ /**
1255
+ * The Telemetry Deck user ID of the customer.
1256
+ */
1257
+ TelemetryDeckUserId = "$telemetryDeckUserId",
1258
+ /**
1259
+ * The Telemetry Deck app ID of the customer.
1260
+ */
1261
+ TelemetryDeckAppId = "$telemetryDeckAppId",
1262
+ /**
1263
+ * The Apple refund handling preference of the customer.
1264
+ */
1265
+ AppleRefundHandlingPreference = "$appleRefundHandlingPreference",
1266
+ /**
1267
+ * The customer.io ID of the customer.
1268
+ */
1269
+ CustomerioId = "$customerioId",
1270
+ /**
1271
+ * The Tenjin ID of the customer.
1272
+ */
1273
+ TenjinId = "$tenjinId"
1274
+ }
1217
1275
 
1218
- /**
1219
- * The store where the user originally subscribed.
1220
- * @public
1221
- */
1222
- export declare type Store = "app_store" | "mac_app_store" | "play_store" | "amazon" | "stripe" | "rc_billing" | "promotional" | "paddle" | "unknown";
1276
+ /**
1277
+ * The store where the user originally subscribed.
1278
+ * @public
1279
+ */
1280
+ export declare type Store = "app_store" | "mac_app_store" | "play_store" | "amazon" | "stripe" | "rc_billing" | "promotional" | "paddle" | "unknown";
1223
1281
 
1224
- /**
1225
- * Subscription purchases of the Customer.
1226
- * @public
1227
- */
1228
- export declare interface SubscriptionInfo {
1229
- /**
1230
- * The product identifier.
1231
- */
1232
- readonly productIdentifier: string;
1233
- /**
1234
- * Date when the last subscription period started.
1235
- */
1236
- readonly purchaseDate: Date;
1237
- /**
1238
- * Date when this subscription first started. This property does not update with renewals.
1239
- * This property also does not update for product changes within a subscription group or
1240
- * re-subscriptions by lapsed subscribers.
1241
- */
1242
- readonly originalPurchaseDate: Date | null;
1243
- /**
1244
- * Date when the subscription expires/expired
1245
- */
1246
- readonly expiresDate: Date | null;
1247
- /**
1248
- * Store where the subscription was purchased.
1249
- */
1250
- readonly store: Store;
1251
- /**
1252
- * Date when RevenueCat detected that auto-renewal was turned off for this subscription.
1253
- * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
1254
- */
1255
- readonly unsubscribeDetectedAt: Date | null;
1256
- /**
1257
- * Whether or not the purchase was made in sandbox mode.
1258
- */
1259
- readonly isSandbox: boolean;
1260
- /**
1261
- * Date when RevenueCat detected any billing issues with this subscription.
1262
- * If and when the billing issue gets resolved, this field is set to null.
1263
- * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
1264
- */
1265
- readonly billingIssuesDetectedAt: Date | null;
1266
- /**
1267
- * Date when any grace period for this subscription expires/expired.
1268
- * null if the customer has never been in a grace period.
1269
- */
1270
- readonly gracePeriodExpiresDate: Date | null;
1271
- /**
1272
- * How the Customer received access to this subscription:
1273
- * - "PURCHASED": The customer bought the subscription.
1274
- * - "FAMILY_SHARED": The customer has access to the product via their family.
1275
- */
1276
- readonly ownershipType: OwnershipType;
1277
- /**
1278
- * Type of the current subscription period:
1279
- * - "normal": The product is in a normal period (default)
1280
- * - "trial": The product is in a free trial period
1281
- * - "intro": The product is in an introductory pricing period
1282
- * - "prepaid": The product is in a prepaid pricing period
1283
- */
1284
- readonly periodType: PeriodType;
1285
- /**
1286
- * Date when RevenueCat detected a refund of this subscription.
1287
- */
1288
- readonly refundedAt: Date | null;
1289
- /**
1290
- * The transaction id in the store of the subscription.
1291
- */
1292
- readonly storeTransactionId: string | null;
1293
- /**
1294
- * Whether the subscription is currently active
1295
- * (at the time this object was obtained).
1296
- */
1297
- readonly isActive: boolean;
1298
- /**
1299
- * Whether the subscription will renew at the next billing period.
1300
- */
1301
- readonly willRenew: boolean;
1302
- }
1282
+ /**
1283
+ * Subscription purchases of the Customer.
1284
+ * @public
1285
+ */
1286
+ export declare interface SubscriptionInfo {
1287
+ /**
1288
+ * The product identifier.
1289
+ */
1290
+ readonly productIdentifier: string;
1291
+ /**
1292
+ * Date when the last subscription period started.
1293
+ */
1294
+ readonly purchaseDate: Date;
1295
+ /**
1296
+ * Date when this subscription first started. This property does not update with renewals.
1297
+ * This property also does not update for product changes within a subscription group or
1298
+ * re-subscriptions by lapsed subscribers.
1299
+ */
1300
+ readonly originalPurchaseDate: Date | null;
1301
+ /**
1302
+ * Date when the subscription expires/expired
1303
+ */
1304
+ readonly expiresDate: Date | null;
1305
+ /**
1306
+ * Store where the subscription was purchased.
1307
+ */
1308
+ readonly store: Store;
1309
+ /**
1310
+ * Date when RevenueCat detected that auto-renewal was turned off for this subscription.
1311
+ * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
1312
+ */
1313
+ readonly unsubscribeDetectedAt: Date | null;
1314
+ /**
1315
+ * Whether or not the purchase was made in sandbox mode.
1316
+ */
1317
+ readonly isSandbox: boolean;
1318
+ /**
1319
+ * Date when RevenueCat detected any billing issues with this subscription.
1320
+ * If and when the billing issue gets resolved, this field is set to null.
1321
+ * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
1322
+ */
1323
+ readonly billingIssuesDetectedAt: Date | null;
1324
+ /**
1325
+ * Date when any grace period for this subscription expires/expired.
1326
+ * null if the customer has never been in a grace period.
1327
+ */
1328
+ readonly gracePeriodExpiresDate: Date | null;
1329
+ /**
1330
+ * How the Customer received access to this subscription:
1331
+ * - "PURCHASED": The customer bought the subscription.
1332
+ * - "FAMILY_SHARED": The customer has access to the product via their family.
1333
+ */
1334
+ readonly ownershipType: OwnershipType;
1335
+ /**
1336
+ * Type of the current subscription period:
1337
+ * - "normal": The product is in a normal period (default)
1338
+ * - "trial": The product is in a free trial period
1339
+ * - "intro": The product is in an introductory pricing period
1340
+ * - "prepaid": The product is in a prepaid pricing period
1341
+ */
1342
+ readonly periodType: PeriodType;
1343
+ /**
1344
+ * Date when RevenueCat detected a refund of this subscription.
1345
+ */
1346
+ readonly refundedAt: Date | null;
1347
+ /**
1348
+ * The transaction id in the store of the subscription.
1349
+ */
1350
+ readonly storeTransactionId: string | null;
1351
+ /**
1352
+ * Whether the subscription is currently active
1353
+ * (at the time this object was obtained).
1354
+ */
1355
+ readonly isActive: boolean;
1356
+ /**
1357
+ * Whether the subscription will renew at the next billing period.
1358
+ */
1359
+ readonly willRenew: boolean;
1360
+ }
1303
1361
 
1304
- /**
1305
- * Represents a possible option to purchase a subscription product.
1306
- * @public
1307
- */
1308
- export declare interface SubscriptionOption extends PurchaseOption {
1309
- /**
1310
- * The base phase for a SubscriptionOption, represents
1311
- * the price that the customer will be charged after all the discounts have
1312
- * been consumed and the period at which it will renew.
1313
- */
1314
- readonly base: PricingPhase;
1315
- /**
1316
- * The trial information for this subscription option if available.
1317
- */
1318
- readonly trial: PricingPhase | null;
1319
- }
1362
+ /**
1363
+ * Represents a possible option to purchase a subscription product.
1364
+ * @public
1365
+ */
1366
+ export declare interface SubscriptionOption extends PurchaseOption {
1367
+ /**
1368
+ * The base phase for a SubscriptionOption, represents
1369
+ * the price that the customer will be charged after all the discounts have
1370
+ * been consumed and the period at which it will renew.
1371
+ */
1372
+ readonly base: PricingPhase;
1373
+ /**
1374
+ * The trial information for this subscription option if available.
1375
+ */
1376
+ readonly trial: PricingPhase | null;
1377
+ }
1320
1378
 
1321
- /**
1322
- * Contains information about the targeting context used to obtain an object.
1323
- * @public
1324
- */
1325
- export declare interface TargetingContext {
1326
- /**
1327
- * The rule id from the targeting used to obtain this object.
1328
- */
1329
- readonly ruleId: string;
1330
- /**
1331
- * The revision of the targeting used to obtain this object.
1332
- */
1333
- readonly revision: number;
1334
- }
1379
+ /**
1380
+ * Contains information about the targeting context used to obtain an object.
1381
+ * @public
1382
+ */
1383
+ export declare interface TargetingContext {
1384
+ /**
1385
+ * The rule id from the targeting used to obtain this object.
1386
+ */
1387
+ readonly ruleId: string;
1388
+ /**
1389
+ * The revision of the targeting used to obtain this object.
1390
+ */
1391
+ readonly revision: number;
1392
+ }
1335
1393
 
1336
- /**
1337
- * Error indicating that the SDK was accessed before it was initialized.
1338
- * @public
1339
- */
1340
- export declare class UninitializedPurchasesError extends Error {
1341
- constructor();
1342
- }
1394
+ /**
1395
+ * Error indicating that the SDK was accessed before it was initialized.
1396
+ * @public
1397
+ */
1398
+ export declare class UninitializedPurchasesError extends Error {
1399
+ constructor();
1400
+ }
1343
1401
 
1344
- export { }
1402
+ export { }