@pixels-online/pixels-client-js-sdk 1.20.0 → 2.0.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/README.md +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/core/OfferStore.d.ts +10 -11
- package/dist/core/OfferwallClient.d.ts +5 -6
- package/dist/index.d.ts +0 -9
- package/dist/index.esm.js +24 -1500
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -1544
- package/dist/index.js.map +1 -1
- package/dist/offerwall-sdk.umd.js +50 -1544
- package/dist/offerwall-sdk.umd.js.map +1 -1
- package/dist/types/events.d.ts +4 -5
- package/dist/types/hooks.d.ts +4 -5
- package/dist/types/index.d.ts +3 -6
- package/dist/utils/assets.d.ts +5 -4
- package/dist/utils/env.d.ts +1 -1
- package/package.json +5 -1
- package/dist/types/blockchain/user_wallet.d.ts +0 -19
- package/dist/types/offer.d.ts +0 -274
- package/dist/types/player.d.ts +0 -481
- package/dist/types/reward.d.ts +0 -39
- package/dist/types/user.d.ts +0 -62
- package/dist/types/user_wallet.d.ts +0 -36
- package/dist/utils/blockchain_utils.d.ts +0 -5
- package/dist/utils/conditions.d.ts +0 -148
- package/dist/utils/dynamic.d.ts +0 -2
- package/dist/utils/template.d.ts +0 -20
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { ISurfacingCondition, IPlayerSnapshot, ICompletionCondition, IBaseCondition, ICompletionTrackers, IConditionEvaluationData } from '../types/player';
|
|
2
|
-
import { IDynamicGroup, IDynamicCondition } from '../types/player';
|
|
3
|
-
import { IClientOffer, IOffer, IPlayerOffer, IPlayerOfferTrackers, IStrippedSnapshot } from '../types/offer';
|
|
4
|
-
export declare const meetsBaseConditions: ({ conditions, playerSnap, addDetails, playerOffer, additionalData, }: {
|
|
5
|
-
conditions: IBaseCondition;
|
|
6
|
-
playerSnap: IPlayerSnapshot | IStrippedSnapshot;
|
|
7
|
-
addDetails?: boolean;
|
|
8
|
-
playerOffer?: {
|
|
9
|
-
createdAt?: Date | number;
|
|
10
|
-
claimedCount?: number;
|
|
11
|
-
trackers?: Record<string, any>;
|
|
12
|
-
};
|
|
13
|
-
additionalData?: IConditionEvaluationData;
|
|
14
|
-
}) => {
|
|
15
|
-
isValid: boolean;
|
|
16
|
-
conditionData?: undefined;
|
|
17
|
-
} | {
|
|
18
|
-
isValid: boolean;
|
|
19
|
-
conditionData: {
|
|
20
|
-
isMet: boolean;
|
|
21
|
-
kind?: keyof IBaseCondition;
|
|
22
|
-
trackerAmount?: number;
|
|
23
|
-
text: string;
|
|
24
|
-
}[] | undefined;
|
|
25
|
-
};
|
|
26
|
-
export declare const meetsSurfacingConditions: ({ surfacingConditions, playerSnap, context, playerOffers, additionalData, }: {
|
|
27
|
-
surfacingConditions: ISurfacingCondition;
|
|
28
|
-
playerSnap: IPlayerSnapshot;
|
|
29
|
-
context?: string;
|
|
30
|
-
playerOffers?: Map<string, IPlayerOffer>;
|
|
31
|
-
additionalData?: IConditionEvaluationData;
|
|
32
|
-
}) => {
|
|
33
|
-
isValid: boolean;
|
|
34
|
-
conditionData?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
isValid: boolean;
|
|
37
|
-
conditionData: {
|
|
38
|
-
isMet: boolean;
|
|
39
|
-
kind?: keyof IBaseCondition;
|
|
40
|
-
trackerAmount?: number;
|
|
41
|
-
text: string;
|
|
42
|
-
}[] | undefined;
|
|
43
|
-
};
|
|
44
|
-
export declare const hasConditions: (conditions: ICompletionCondition | ISurfacingCondition) => boolean;
|
|
45
|
-
export declare const meetsLinkedEntityOffersCondition: ({ linkedEntityOffers, matchingLinks, linkedPOfferMap, }: {
|
|
46
|
-
linkedEntityOffers: {
|
|
47
|
-
kind?: string;
|
|
48
|
-
offer_id?: string;
|
|
49
|
-
link?: boolean;
|
|
50
|
-
};
|
|
51
|
-
matchingLinks: Array<{
|
|
52
|
-
playerId: string;
|
|
53
|
-
kind?: string;
|
|
54
|
-
}>;
|
|
55
|
-
linkedPOfferMap: Map<string, IPlayerOffer>;
|
|
56
|
-
}) => {
|
|
57
|
-
isValid: boolean;
|
|
58
|
-
linkedPlayerOffer_ids?: string[];
|
|
59
|
-
};
|
|
60
|
-
export declare const offerMeetsCompletionConditions: (offer: IClientOffer, snapshot: IPlayerSnapshot, additionalData?: IConditionEvaluationData) => {
|
|
61
|
-
isValid: boolean;
|
|
62
|
-
availableClaimsNow: number;
|
|
63
|
-
conditionData?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
isValid: boolean;
|
|
66
|
-
conditionData: {
|
|
67
|
-
isMet: boolean;
|
|
68
|
-
kind?: keyof ICompletionCondition | "context";
|
|
69
|
-
trackerAmount?: number;
|
|
70
|
-
text: string;
|
|
71
|
-
}[];
|
|
72
|
-
availableClaimsNow: number;
|
|
73
|
-
};
|
|
74
|
-
export declare const meetsCompletionConditions: ({ completionConditions, completionTrackers, playerSnap, playerOffer, addDetails, maxClaimCount, additionalData, }: {
|
|
75
|
-
completionConditions: ICompletionCondition;
|
|
76
|
-
completionTrackers?: ICompletionTrackers;
|
|
77
|
-
playerSnap: IPlayerSnapshot | IStrippedSnapshot;
|
|
78
|
-
playerOffer: {
|
|
79
|
-
createdAt?: Date | number;
|
|
80
|
-
trackers?: IPlayerOfferTrackers;
|
|
81
|
-
};
|
|
82
|
-
addDetails?: boolean;
|
|
83
|
-
maxClaimCount?: number;
|
|
84
|
-
additionalData?: IConditionEvaluationData;
|
|
85
|
-
}) => {
|
|
86
|
-
isValid: boolean;
|
|
87
|
-
availableClaimsNow: number;
|
|
88
|
-
conditionData?: undefined;
|
|
89
|
-
} | {
|
|
90
|
-
isValid: boolean;
|
|
91
|
-
conditionData: {
|
|
92
|
-
isMet: boolean;
|
|
93
|
-
kind?: keyof ICompletionCondition | "context";
|
|
94
|
-
trackerAmount?: number;
|
|
95
|
-
text: string;
|
|
96
|
-
}[];
|
|
97
|
-
availableClaimsNow: number;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Checks if completion conditions were met before a specific expiry time.
|
|
101
|
-
* Returns true if all relevant condition fields were updated before expiryTime.
|
|
102
|
-
*
|
|
103
|
-
* @param completionConditions - The completion conditions to check
|
|
104
|
-
* @param completionTrackers - The completion trackers (for buyItem, spendCurrency, etc.)
|
|
105
|
-
* @param playerSnap - The player snapshot with field timestamps
|
|
106
|
-
* @returns true if all conditions were met before expiry, false otherwise
|
|
107
|
-
*/
|
|
108
|
-
export declare const meetsCompletionConditionsBeforeExpiry: ({ completionConditions, completionTrackers, playerSnap, playerOffer, maxClaimCount, }: {
|
|
109
|
-
completionConditions: ICompletionCondition;
|
|
110
|
-
completionTrackers?: ICompletionTrackers;
|
|
111
|
-
playerSnap: IPlayerSnapshot;
|
|
112
|
-
playerOffer: {
|
|
113
|
-
createdAt?: Date | number;
|
|
114
|
-
claimedCount?: number;
|
|
115
|
-
trackers?: Record<string, any>;
|
|
116
|
-
expiresAt?: Date | number | string;
|
|
117
|
-
};
|
|
118
|
-
maxClaimCount?: number;
|
|
119
|
-
}) => boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Calculates the maximum number of claims supported by a single dynamic condition.
|
|
122
|
-
*/
|
|
123
|
-
export declare function getMaxClaimsForDynamicCondition(dynamicObj: Record<string, string | number | boolean>, cond: IDynamicCondition): number;
|
|
124
|
-
/**
|
|
125
|
-
* Calculates the maximum number of claims supported by a group of dynamic conditions.
|
|
126
|
-
*/
|
|
127
|
-
export declare function getMaxClaimsForDynamicGroup(dynamicObj: Record<string, string | number | boolean>, dynamicGroup: IDynamicGroup, currentClaimCount?: number): number;
|
|
128
|
-
/**
|
|
129
|
-
* Evaluates a group of dynamic conditions with logical links (AND, OR, AND NOT).
|
|
130
|
-
* @param dynamicObj - The player's dynamic object with any key and string or number value.
|
|
131
|
-
* @param dynamicGroup - The group of conditions and links to check.
|
|
132
|
-
* @param claimMultiplier - Multiplier to scale conditions (used for numeric comparisons).
|
|
133
|
-
* @returns true if the group evaluates to true, false otherwise.
|
|
134
|
-
*/
|
|
135
|
-
export declare function meetsDynamicConditions(dynamicObj: Record<string, string | number | boolean> | undefined, dynamicGroup: IDynamicGroup, claimMultiplier?: number): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Checks if a PlayerOffer meets its claimable conditions (completed -> claimable transition).
|
|
138
|
-
* @param claimableConditions - The offer's claimableConditions (from IOffer)
|
|
139
|
-
* @param claimableTrackers - The player offer's claimableTrackers
|
|
140
|
-
*/
|
|
141
|
-
export declare function meetsClaimableConditions({ claimableConditions, playerOfferTrackers, claimableTrackers, }: {
|
|
142
|
-
claimableConditions?: IOffer['claimableConditions'];
|
|
143
|
-
playerOfferTrackers?: IPlayerOfferTrackers;
|
|
144
|
-
claimableTrackers?: IPlayerOffer['claimableTrackers'];
|
|
145
|
-
}): {
|
|
146
|
-
isValid: boolean;
|
|
147
|
-
};
|
|
148
|
-
export declare function aggregateTokenBalances(data?: IConditionEvaluationData): Record<string, number>;
|
package/dist/utils/dynamic.d.ts
DELETED
package/dist/utils/template.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IDynamicCondition } from '../types/player';
|
|
2
|
-
export declare function extractTemplateKeys(template: string | undefined): Set<string>;
|
|
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
|
-
intervalHr?: number;
|
|
20
|
-
}[];
|