Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
SpertsyanKM authored Jan 30, 2024
2 parents 1d63669 + 65f807c commit 49a4976
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fastlane/report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@



<testcase classname="fastlane.lanes" name="0: default_platform" time="0.163287">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000499">

</testcase>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@qonversion/web-sdk",
"title": "Qonversion Web SDK",
"version": "1.0.1",
"version": "1.1.0",
"description": "Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and content using our Stripe wrapper, StoreKit wrapper and Google Play Billing wrapper.",
"main": "sdk/build/index.js",
"types": "sdk/build/index.d.ts",
Expand Down
40 changes: 40 additions & 0 deletions sdk/src/UserPropertiesBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,46 @@ export class UserPropertiesBuilder {
return this;
}

/**
* Set AppMetrica device id.
* @param deviceId device id
* @return builder instance for chain calls
*/
setAppMetricaDeviceId(deviceId: string): UserPropertiesBuilder {
this.properties[UserPropertyKey.AppMetricaDeviceId] = deviceId;
return this;
}

/**
* Set AppMetrica user profile id.
* @param userProfileId user profile id
* @return builder instance for chain calls
*/
setAppMetricaUserProfileId(userProfileId: string): UserPropertiesBuilder {
this.properties[UserPropertyKey.AppMetricaUserProfileId] = userProfileId;
return this;
}

/**
* Set PushWoosh hardware id.
* @param hwId hardware id
* @return builder instance for chain calls
*/
setPushWooshHwId(hwId: string): UserPropertiesBuilder {
this.properties[UserPropertyKey.PushWooshHwId] = hwId;
return this;
}

/**
* Set PushWoosh user id.
* @param userId user id
* @return builder instance for chain calls
*/
setPushWooshUserId(userId: string): UserPropertiesBuilder {
this.properties[UserPropertyKey.PushWooshUserId] = userId;
return this;
}

/**
* Set a user property with a custom key different from defined ones.
*
Expand Down
72 changes: 72 additions & 0 deletions sdk/src/__tests__/UserPropertiesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,78 @@ describe('UserPropertiesBuilder tests', () => {
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set app set id', () => {
// given
const appSetId = "test App Set id";
const expProperties = {'_q_app_set_id': appSetId};

// when
builder.setAppSetId(appSetId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set advertising id', () => {
// given
const advertisingId = "test advertising id";
const expProperties = {'_q_advertising_id': advertisingId};

// when
builder.setAdvertisingId(advertisingId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set AppMetrica device id', () => {
// given
const appMetricaDeviceId = "test AppMetrica device id";
const expProperties = {'_q_appmetrica_device_id': appMetricaDeviceId};

// when
builder.setAppMetricaDeviceId(appMetricaDeviceId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set AppMetrica user profile id', () => {
// given
const appMetricaUserProfileId = "test AppMetrica user profile id";
const expProperties = {'_q_appmetrica_user_profile_id': appMetricaUserProfileId};

// when
builder.setAppMetricaUserProfileId(appMetricaUserProfileId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set PushWoosh hardware id', () => {
// given
const pushWooshHwId = "test PushWoosh hw id";
const expProperties = {'_q_pushwoosh_hwid': pushWooshHwId};

// when
builder.setPushWooshHwId(pushWooshHwId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set PushWoosh user id', () => {
// given
const pushWooshUserId = "test PushWoosh user id";
const expProperties = {'_q_pushwoosh_user_id': pushWooshUserId};

// when
builder.setPushWooshUserId(pushWooshUserId);

// then
expect(builder['properties']).toStrictEqual(expProperties);
});

test('set custom user property', () => {
// given
const key = "test key";
Expand Down
10 changes: 7 additions & 3 deletions sdk/src/dto/UserPropertyKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ export enum UserPropertyKey {
AppsFlyerUserId = "_q_appsflyer_user_id",
AdjustAdId = "_q_adjust_adid",
CustomUserId = "_q_custom_user_id",
FacebookAttribution = "_q_fb_attribution",
FacebookAttribution = "_q_fb_attribution", // Android only
FirebaseAppInstanceId = "_q_firebase_instance_id",
AppSetId = "_q_app_set_id",
AdvertisingId = "_q_advertising_id",
AppSetId = "_q_app_set_id", // Android only
AdvertisingId = "_q_advertising_id", // iOS only
AppMetricaDeviceId = "_q_appmetrica_device_id",
AppMetricaUserProfileId = "_q_appmetrica_user_profile_id",
PushWooshHwId = "_q_pushwoosh_hwid",
PushWooshUserId = "_q_pushwoosh_user_id",
Custom = "",
}

0 comments on commit 49a4976

Please sign in to comment.