Skip to content
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
89352bf
Merge remote-tracking branch 'origin/master' into development
al-af Sep 19, 2024
87774e4
PurchaseConnector Models and RN wrapper and native bridge
al-af Sep 30, 2024
2a293ee
Separated callbacks to onSuccess onFailure, modified native impl acco…
al-af Oct 6, 2024
c5005a2
Updated index.d.ts
al-af Oct 6, 2024
1dc0def
WIP Commit
al-af Oct 10, 2024
e611717
Adding fromJson support to listeners and parsing them to JS objects
al-af Oct 14, 2024
e9976b3
Handling opting in/out the PC module, Reverting demo app to default s…
al-af Oct 20, 2024
36b9d84
Update import
al-af Oct 21, 2024
9835995
Merge remote-tracking branch 'origin/master' into feature/DELIVERY-70…
al-af Nov 6, 2024
fc7c8d9
Merge branch 'feature/DELIVERY-70584/PurchaseConnectorRN' into develo…
al-af Nov 6, 2024
593d755
Merge branch 'development' into feature/DELIVERY-70584/PurchaseConnec…
al-af Nov 6, 2024
dd0624b
Fixed minor changes
al-af Nov 6, 2024
2f1fcf7
update kt version
al-af Nov 6, 2024
3bfd90c
update imports and onResponse
al-af Nov 6, 2024
81d0e31
minor fix
al-af Nov 6, 2024
5ec2486
commit
al-af Nov 6, 2024
13f79f8
new MappedValidationResultListener class
al-af Nov 6, 2024
2a5bdfe
update inApp on response to first entry
al-af Nov 7, 2024
9a44dcb
Updating handling callbacks from Android
al-af Nov 10, 2024
b75af73
Updating JS callbacks handling
al-af Nov 10, 2024
4bc7494
Handling failureData undefined case
al-af Nov 10, 2024
7675278
Handling iOS callbacks
al-af Nov 10, 2024
a8b707f
handle multiple entries in validation result map for subscription an…
al-af Nov 12, 2024
99cd680
PC iOS Fix
al-af Dec 29, 2024
5f529a8
Adding SK2 option
al-af Mar 2, 2025
b1e2a84
Working logConsumable function
al-af Mar 4, 2025
f4cfdd5
Duplication fix
al-af Mar 5, 2025
e9ebb8a
Update ts configuration and typo fix
al-af Mar 12, 2025
d505360
align versions
al-af Mar 12, 2025
4accaa6
.
al-af Mar 12, 2025
7f9e4c5
.
al-af Mar 12, 2025
cc2c523
wip - android and ios
al-af May 5, 2025
060e732
Android working
al-af May 6, 2025
59b687d
Working Android and iOS Custom data params
al-af May 8, 2025
25494f6
Merge branch 'development' into dev/DELIVERY-89774/custom-params-dele…
al-af May 12, 2025
b6f65b8
Small fixes
al-af May 18, 2025
a99397d
Merge pull request #621 from AppsFlyerSDK/dev/DELIVERY-89774/custom-p…
al-af May 18, 2025
e21a145
Enum locale fix
al-af May 29, 2025
805d7d2
Merge pull request #623 from AppsFlyerSDK/dev/DELIVERY-88361/mediatio…
al-af May 29, 2025
1966ef1
update android to 6.16.2
al-af Jun 4, 2025
4c3485b
Update iOS & Android to 6.17.0
al-af Jun 5, 2025
8e8b115
Merge pull request #610 from AppsFlyerSDK/feature/PC-SK2-Update
al-af Jun 15, 2025
5eb6978
Update .gitignore
al-af Jun 15, 2025
4cf63d5
6.17.0-rc1
amit-kremer93 Jun 15, 2025
949be37
Merge branch 'master' into releases/6.x.x/6.17.x/6.17.0-rc1
al-af Jun 15, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm install
run: npm install --legacy-peer-deps
- name: Run jest tests
run: npm run test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ android/gradlew.bat
android/gradle
android/gradlew
android/.project
android/.settings

# node.js
#
Expand Down Expand Up @@ -66,4 +67,7 @@ demos/appsflyer-expo-app/.expo
demos/appsflyer-expo-app/node_modules
demos/appsflyer-expo-app/yarn.lock

demos/appsflyer-react-native-app/ios/.xcode.env
demos/appsflyer-react-native-app/ios/AppsFlyerExample.xcodeproj/project.pbxproj

.cursor/*
541 changes: 541 additions & 0 deletions Docs/RN_PurchaseConnector.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions PurchaseConnector/constants/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AppsFlyerConstants {
// Adding method constants
static readonly SUBSCRIPTION_VALIDATION_SUCCESS: string = 'subscriptionValidationSuccess';
static readonly SUBSCRIPTION_VALIDATION_FAILURE: string = 'subscriptionValidationFailure';
static readonly IN_APP_PURCHASE_VALIDATION_SUCCESS: string = 'inAppPurchaseValidationSuccess';
static readonly IN_APP_PURCHASE_VALIDATION_FAILURE: string = 'inAppPurchaseValidationFailure';
static readonly DID_RECEIVE_PURCHASE_REVENUE_VALIDATION_INFO: string =
"onDidReceivePurchaseRevenueValidationInfo";

// Adding key constants
static readonly RESULT: string = "result";
static readonly ERROR: string = "error";
}

export default AppsFlyerConstants;
34 changes: 34 additions & 0 deletions PurchaseConnector/models/auto_renewing_plan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SubscriptionItemPriceChangeDetailsJson, SubscriptionItemPriceChangeDetails } from "./subscription_item_price_change_details";

export type AutoRenewingPlanJson = {
autoRenewEnabled?: boolean;
priceChangeDetails?: SubscriptionItemPriceChangeDetailsJson;
};

export class AutoRenewingPlan {
autoRenewEnabled?: boolean;
priceChangeDetails?: SubscriptionItemPriceChangeDetails;

constructor(
autoRenewEnabled?: boolean,
priceChangeDetails?: SubscriptionItemPriceChangeDetails
) {
this.autoRenewEnabled = autoRenewEnabled;
this.priceChangeDetails = priceChangeDetails;
}

static fromJson(json: AutoRenewingPlanJson): AutoRenewingPlan {
return new AutoRenewingPlan(
json.autoRenewEnabled,
json.priceChangeDetails &&
SubscriptionItemPriceChangeDetails.fromJson(json.priceChangeDetails)
);
}

toJson(): AutoRenewingPlanJson {
return {
autoRenewEnabled: this.autoRenewEnabled,
priceChangeDetails: this.priceChangeDetails?.toJson(),
};
}
}
141 changes: 141 additions & 0 deletions PurchaseConnector/models/canceled_state_context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
export class CanceledStateContext {
developerInitiatedCancellation?: DeveloperInitiatedCancellation;
replacementCancellation?: ReplacementCancellation;
systemInitiatedCancellation?: SystemInitiatedCancellation;
userInitiatedCancellation?: UserInitiatedCancellation;

constructor(
developerInitiatedCancellation?: DeveloperInitiatedCancellation,
replacementCancellation?: ReplacementCancellation,
systemInitiatedCancellation?: SystemInitiatedCancellation,
userInitiatedCancellation?: UserInitiatedCancellation
) {
this.developerInitiatedCancellation = developerInitiatedCancellation;
this.replacementCancellation = replacementCancellation;
this.systemInitiatedCancellation = systemInitiatedCancellation;
this.userInitiatedCancellation = userInitiatedCancellation;
}

static fromJson(json: any): CanceledStateContext {
return new CanceledStateContext(
json.developerInitiatedCancellation != null
? DeveloperInitiatedCancellation.fromJson(
json.developerInitiatedCancellation
)
: undefined,
json.replacementCancellation != null
? ReplacementCancellation.fromJson(json.replacementCancellation)
: undefined,
json.systemInitiatedCancellation != null
? SystemInitiatedCancellation.fromJson(json.systemInitiatedCancellation)
: undefined,
json.userInitiatedCancellation != null
? UserInitiatedCancellation.fromJson(json.userInitiatedCancellation)
: undefined
);
}

toJson(): Record<string, any> {
return {
developerInitiatedCancellation:
this.developerInitiatedCancellation?.toJson(),
replacementCancellation: this.replacementCancellation?.toJson(),
systemInitiatedCancellation: this.systemInitiatedCancellation?.toJson(),
userInitiatedCancellation: this.userInitiatedCancellation?.toJson(),
};
}
}

/**
* TODO: Need to check each state context further...
*/
class DeveloperInitiatedCancellation {
constructor() {}

static fromJson(json: any): DeveloperInitiatedCancellation {
// Here you would implement the conversion from JSON to DeveloperInitiatedCancellation instance
return new DeveloperInitiatedCancellation();
}

toJson(): Record<string, unknown> {
// Here you would implement the conversion from DeveloperInitiatedCancellation instance to JSON
return {};
}
}

class ReplacementCancellation {
constructor() {}

static fromJson(json: any): ReplacementCancellation {
// Here you would implement the conversion from JSON to ReplacementCancellation instance
return new ReplacementCancellation();
}

toJson(): Record<string, unknown> {
return {};
}
}

class SystemInitiatedCancellation {
constructor() {}

static fromJson(json: any): SystemInitiatedCancellation {
// Here you would implement the conversion from JSON to SystemInitiatedCancellation instance
return new SystemInitiatedCancellation();
}

toJson(): Record<string, unknown> {
// Here you would implement the conversion from SystemInitiatedCancellation instance to JSON
return {};
}
}

class UserInitiatedCancellation {
cancelSurveyResult?: CancelSurveyResult; // Made optional as per Dart's CancelSurveyResult? declaration
cancelTime: string;

constructor(
cancelSurveyResult: CancelSurveyResult | undefined,
cancelTime: string
) {
this.cancelSurveyResult = cancelSurveyResult;
this.cancelTime = cancelTime;
}

static fromJson(json: any): UserInitiatedCancellation {
return new UserInitiatedCancellation(
json.cancelSurveyResult != null
? CancelSurveyResult.fromJson(json.cancelSurveyResult)
: undefined,
json.cancelTime
);
}

toJson(): Record<string, unknown> {
return {
cancelSurveyResult: this.cancelSurveyResult?.toJson(),
cancelTime: this.cancelTime,
};
}
}

class CancelSurveyResult {
reason: string;
reasonUserInput: string;

constructor(reason: string, reasonUserInput: string) {
this.reason = reason;
this.reasonUserInput = reasonUserInput;
}

static fromJson(json: any): CancelSurveyResult {
return new CancelSurveyResult(json.reason, json.reasonUserInput);
}

toJson(): Record<string, string> {
return {
reason: this.reason,
reasonUserInput: this.reasonUserInput,
};
}
}
21 changes: 21 additions & 0 deletions PurchaseConnector/models/deferred_item_replacement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export type DeferredItemReplacementJson = {
productId: string;
};

export class DeferredItemReplacement {
productId: string;

constructor(productId: string) {
this.productId = productId;
}

static fromJson(json: DeferredItemReplacementJson): DeferredItemReplacement {
return new DeferredItemReplacement(json.productId);
}

toJson(): DeferredItemReplacementJson {
return {
productId: this.productId,
};
}
}
39 changes: 39 additions & 0 deletions PurchaseConnector/models/external_account_identifiers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export type ExternalAccountIdentifiersJson = {
externalAccountId: string;
obfuscatedExternalAccountId: string;
obfuscatedExternalProfileId: string;
};

export class ExternalAccountIdentifiers {
externalAccountId: string;
obfuscatedExternalAccountId: string;
obfuscatedExternalProfileId: string;

constructor(
externalAccountId: string,
obfuscatedExternalAccountId: string,
obfuscatedExternalProfileId: string
) {
this.externalAccountId = externalAccountId;
this.obfuscatedExternalAccountId = obfuscatedExternalAccountId;
this.obfuscatedExternalProfileId = obfuscatedExternalProfileId;
}

static fromJson(
json: ExternalAccountIdentifiersJson
): ExternalAccountIdentifiers {
return new ExternalAccountIdentifiers(
json.externalAccountId,
json.obfuscatedExternalAccountId,
json.obfuscatedExternalProfileId
);
}

toJson(): ExternalAccountIdentifiersJson {
return {
externalAccountId: this.externalAccountId,
obfuscatedExternalAccountId: this.obfuscatedExternalAccountId,
obfuscatedExternalProfileId: this.obfuscatedExternalProfileId,
};
}
}
34 changes: 34 additions & 0 deletions PurchaseConnector/models/in_app_purchase_validation_result.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ProductPurchase } from "./product_purchase";
import { ValidationFailureDataJson } from "./validation_failure_data";

export default class InAppPurchaseValidationResult {
success: boolean;
productPurchase?: ProductPurchase;
failureData?: ValidationFailureDataJson;

constructor(
success: boolean,
productPurchase?: ProductPurchase,
failureData?: ValidationFailureDataJson
) {
this.success = success;
this.productPurchase = productPurchase;
this.failureData = failureData;
}

static fromJson(json: any): InAppPurchaseValidationResult {
return new InAppPurchaseValidationResult(
json.success,
json.productPurchase,
json.failureData
);
}

toJson(): any {
return {
success: this.success,
productPurchase: this.productPurchase,
failureData: this.failureData,
};
}
}
52 changes: 52 additions & 0 deletions PurchaseConnector/models/ios_errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// TypeScript class for IOS Error
export class IosError {
localizedDescription: string;
domain: string;
code: number;

constructor(localizedDescription: string, domain: string, code: number) {
this.localizedDescription = localizedDescription;
this.domain = domain;
this.code = code;
}

// Converts the class instance to a JSON object
toJson(): object {
return {
localizedDescription: this.localizedDescription,
domain: this.domain,
code: this.code,
};
}

// Creates an instance of the class from a JSON object
static fromJson(json: any): IosError {
return new IosError(json.localizedDescription, json.domain, json.code);
}
}

/**
* Usage example:
* // Creating an instance of IosError
* const iosError = new IosError('An error occurred.', 'com.example.domain', 100);
*
* // Display information about the IOS error
* console.log(iosError.localizedDescription); // Outputs: An error occurred.
* console.log(iosError.domain); // Outputs: com.example.domain
* console.log(iosError.code); // Outputs: 100
*
* // Serializing IosError instance to a JSON object
* const iosErrorJson = iosError.toJson();
* console.log(iosErrorJson); // Outputs: { localizedDescription: 'An error occurred.', domain: 'com.example.domain', code: 100 }
*
* // Sample JSON objects
* const iosErrorData = {
* localizedDescription: 'A network error occurred.',
* domain: 'com.example.network',
* code: 404
* };
*
* // Deserializing the parsed JSON into instance of IosError
* const deserializedIosError = IosError.fromJson(iosErrorData);
* console.log(deserializedIosError);
*/
Loading