@pixels-online/pixels-client-js-sdk 1.15.0 → 1.17.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.
- package/dist/core/OfferwallClient.d.ts +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +313 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +314 -58
- package/dist/index.js.map +1 -1
- package/dist/offerwall-sdk.umd.js +314 -58
- package/dist/offerwall-sdk.umd.js.map +1 -1
- package/dist/types/blockchain/user_wallet.d.ts +19 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/linking.d.ts +17 -0
- package/dist/types/offer.d.ts +65 -17
- package/dist/types/player.d.ts +25 -11
- package/dist/utils/conditions.d.ts +50 -9
- package/dist/utils/template.d.ts +18 -1
- package/package.json +2 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ISurfacingCondition, IPlayerSnapshot, ICompletionCondition, IBaseCondition, ICompletionTrackers } from '../types/player';
|
|
2
2
|
import { IDynamicGroup } from '../types/player';
|
|
3
|
-
import { IPlayerOffer } from '../types/offer';
|
|
4
|
-
export declare const meetsBaseConditions: ({ conditions, playerSnap, addDetails, }: {
|
|
3
|
+
import { IClientOffer, IOffer, IPlayerOffer, IPlayerOfferTrackers, IStrippedSnapshot } from '../types/offer';
|
|
4
|
+
export declare const meetsBaseConditions: ({ conditions, playerSnap, addDetails, playerOffer, }: {
|
|
5
5
|
conditions: IBaseCondition;
|
|
6
|
-
playerSnap: IPlayerSnapshot;
|
|
6
|
+
playerSnap: IPlayerSnapshot | IStrippedSnapshot;
|
|
7
7
|
addDetails?: boolean;
|
|
8
|
+
playerOffer?: {
|
|
9
|
+
createdAt?: Date | number;
|
|
10
|
+
claimedCount?: number;
|
|
11
|
+
trackers?: Record<string, any>;
|
|
12
|
+
};
|
|
8
13
|
}) => {
|
|
9
14
|
isValid: boolean;
|
|
10
15
|
conditionData?: undefined;
|
|
@@ -35,11 +40,29 @@ export declare const meetsSurfacingConditions: ({ surfacingConditions, playerSna
|
|
|
35
40
|
}[] | undefined;
|
|
36
41
|
};
|
|
37
42
|
export declare const hasConditions: (conditions: ICompletionCondition | ISurfacingCondition) => boolean;
|
|
38
|
-
export declare const
|
|
43
|
+
export declare const offerMeetsCompletionConditions: (offer: IClientOffer, snapshot: IPlayerSnapshot) => {
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
conditionData?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
isValid: boolean;
|
|
48
|
+
conditionData: {
|
|
49
|
+
isMet: boolean;
|
|
50
|
+
kind?: keyof ICompletionCondition | "context";
|
|
51
|
+
trackerAmount?: number;
|
|
52
|
+
text: string;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
export declare const meetsCompletionConditions: ({ completionConditions, completionTrackers, playerSnap, playerOffer, addDetails, maxClaimCount, }: {
|
|
39
56
|
completionConditions: ICompletionCondition;
|
|
40
57
|
completionTrackers?: ICompletionTrackers;
|
|
41
|
-
playerSnap: IPlayerSnapshot;
|
|
58
|
+
playerSnap: IPlayerSnapshot | IStrippedSnapshot;
|
|
59
|
+
playerOffer: {
|
|
60
|
+
createdAt?: Date | number;
|
|
61
|
+
claimedCount?: number;
|
|
62
|
+
trackers?: Record<string, any>;
|
|
63
|
+
};
|
|
42
64
|
addDetails?: boolean;
|
|
65
|
+
maxClaimCount?: number;
|
|
43
66
|
}) => {
|
|
44
67
|
isValid: boolean;
|
|
45
68
|
conditionData?: undefined;
|
|
@@ -59,19 +82,37 @@ export declare const meetsCompletionConditions: ({ completionConditions, complet
|
|
|
59
82
|
* @param completionConditions - The completion conditions to check
|
|
60
83
|
* @param completionTrackers - The completion trackers (for buyItem, spendCurrency, etc.)
|
|
61
84
|
* @param playerSnap - The player snapshot with field timestamps
|
|
62
|
-
* @param expiryTime - The expiry timestamp in milliseconds
|
|
63
85
|
* @returns true if all conditions were met before expiry, false otherwise
|
|
64
86
|
*/
|
|
65
|
-
export declare const meetsCompletionConditionsBeforeExpiry: ({ completionConditions, completionTrackers, playerSnap,
|
|
87
|
+
export declare const meetsCompletionConditionsBeforeExpiry: ({ completionConditions, completionTrackers, playerSnap, playerOffer, maxClaimCount, }: {
|
|
66
88
|
completionConditions: ICompletionCondition;
|
|
67
89
|
completionTrackers?: ICompletionTrackers;
|
|
68
90
|
playerSnap: IPlayerSnapshot;
|
|
69
|
-
|
|
91
|
+
playerOffer: {
|
|
92
|
+
createdAt?: Date | number;
|
|
93
|
+
claimedCount?: number;
|
|
94
|
+
trackers?: Record<string, any>;
|
|
95
|
+
expiresAt?: Date | number | string;
|
|
96
|
+
};
|
|
97
|
+
maxClaimCount?: number;
|
|
70
98
|
}) => boolean;
|
|
71
99
|
/**
|
|
72
100
|
* Evaluates a group of dynamic conditions with logical links (AND, OR, AND NOT).
|
|
73
101
|
* @param dynamicObj - The player's dynamic object with any key and string or number value.
|
|
74
102
|
* @param dynamicGroup - The group of conditions and links to check.
|
|
103
|
+
* @param claimMultiplier - Multiplier to scale conditions (used for numeric comparisons).
|
|
75
104
|
* @returns true if the group evaluates to true, false otherwise.
|
|
76
105
|
*/
|
|
77
|
-
export declare function meetsDynamicConditions(dynamicObj: Record<string, string | number
|
|
106
|
+
export declare function meetsDynamicConditions(dynamicObj: Record<string, string | number | boolean> | undefined, dynamicGroup: IDynamicGroup, claimMultiplier?: number): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Checks if a PlayerOffer meets its claimable conditions (completed -> claimable transition).
|
|
109
|
+
* @param claimableConditions - The offer's claimableConditions (from IOffer)
|
|
110
|
+
* @param claimableTrackers - The player offer's claimableTrackers
|
|
111
|
+
*/
|
|
112
|
+
export declare function meetsClaimableConditions({ claimableConditions, playerOfferTrackers, claimableTrackers, }: {
|
|
113
|
+
claimableConditions?: IOffer['claimableConditions'];
|
|
114
|
+
playerOfferTrackers?: IPlayerOfferTrackers;
|
|
115
|
+
claimableTrackers?: IPlayerOffer['claimableTrackers'];
|
|
116
|
+
}): {
|
|
117
|
+
isValid: boolean;
|
|
118
|
+
};
|
package/dist/utils/template.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
import { IDynamicCondition } from '../types/player';
|
|
1
2
|
export declare function extractTemplateKeys(template: string | undefined): Set<string>;
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* This replaces {keyName} keys from the template with corresponding values from the dynamic object.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderTemplate(template: string | undefined, dynamic: Record<string, string | number | boolean> | undefined): string;
|
|
7
|
+
/**
|
|
8
|
+
* This replaces {{keyName}} in dynamic condition keys with corresponding values from
|
|
9
|
+
* the PlayerOffer.trackers
|
|
10
|
+
*
|
|
11
|
+
* eg. a condition high_score_pet-{{surfacerPlayerId}} with high_score_pet-12345
|
|
12
|
+
*/
|
|
13
|
+
export declare function replaceDynamicConditionKey(key: string, trackers: Record<string, any>): string;
|
|
14
|
+
/** this replaces all of the dynamic conditions.keys by calling replaceDynamicConditionKey */
|
|
15
|
+
export declare function replaceDynamicConditionKeys(conditions: Array<IDynamicCondition>, trackers: Record<string, any>): {
|
|
16
|
+
key: string;
|
|
17
|
+
compareTo: string | number | boolean;
|
|
18
|
+
operator: import("../types/player").DynamicConditionOperator;
|
|
19
|
+
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixels-online/pixels-client-js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Pixels Client JS SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"prettier": "^3.6.2",
|
|
68
68
|
"rimraf": "^6.0.1",
|
|
69
69
|
"rollup": "^4.50.1",
|
|
70
|
+
"semantic-release": "25.0.2",
|
|
70
71
|
"ts-jest": "^29.4.1",
|
|
71
72
|
"ts-node": "^10.9.2",
|
|
72
73
|
"tslib": "^2.8.1",
|