@jolibox/implement 1.2.4 → 1.2.5
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/.rush/temp/package-deps_build.json +24 -18
- package/dist/common/cache/__tests__/request-cache-service.test.d.ts +1 -0
- package/dist/common/cache/request-cache-service.d.ts +111 -0
- package/dist/common/report/base-tracker.d.ts +2 -1
- package/dist/common/rewards/cached-fetch-reward.d.ts +46 -0
- package/dist/common/rewards/cached-reward-service.d.ts +24 -0
- package/dist/common/rewards/fetch-reward.d.ts +2 -3
- package/dist/common/rewards/index.d.ts +2 -0
- package/dist/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.d.ts +34 -0
- package/dist/common/rewards/registers/utils/coins/jolicoin/fetch-balance.d.ts +2 -1
- package/dist/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.d.ts +34 -0
- package/dist/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.d.ts +2 -1
- package/dist/index.js +9 -9
- package/dist/index.native.js +33 -33
- package/dist/native/payment/payment-service.d.ts +36 -30
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/cache/__tests__/request-cache-service.test.ts +686 -0
- package/src/common/cache/request-cache-service.ts +393 -0
- package/src/common/report/base-tracker.ts +2 -2
- package/src/common/rewards/cached-fetch-reward.ts +241 -0
- package/src/common/rewards/cached-reward-service.ts +255 -0
- package/src/common/rewards/fetch-reward.ts +17 -93
- package/src/common/rewards/index.ts +3 -0
- package/src/common/rewards/registers/utils/coins/commands/use-payment.ts +8 -0
- package/src/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.ts +177 -0
- package/src/common/rewards/registers/utils/coins/jolicoin/fetch-balance.ts +13 -1
- package/src/common/rewards/registers/utils/coins/jolicoin/jolicoin-handler.ts +2 -0
- package/src/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.ts +181 -0
- package/src/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.ts +13 -1
- package/src/common/rewards/registers/utils/coins/joligem/gem-handler.ts +2 -0
- package/src/h5/api/ads.ts +5 -0
- package/src/h5/api/storage.ts +2 -2
- package/src/h5/http/index.ts +2 -2
- package/src/h5/report/event-tracker.ts +2 -2
- package/src/native/api/ads.ts +7 -1
- package/src/native/api/payment.ts +4 -4
- package/src/native/payment/__tests__/payment-service-simple.test.ts +97 -31
- package/src/native/payment/payment-service.ts +224 -210
- package/src/native/rewards/ui/payment-modal.ts +14 -7
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
import { IPaymentChoice } from '@/common/rewards/reward-emitter';
|
|
2
2
|
import type { PaymentResult } from './payment-helper';
|
|
3
|
+
import { RequestCacheService } from '@/common/cache/request-cache-service';
|
|
3
4
|
type PaymentPurchaseType = 'JOLI_COIN' | 'JOLI_GEM';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
type PaymentRequest = Record<string, never>;
|
|
6
|
+
interface PaymentResponse {
|
|
7
|
+
balance: number;
|
|
8
|
+
enableAutoDeduct: boolean;
|
|
9
|
+
paymentChoices: IPaymentChoice[];
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
interface PaymentCacheData {
|
|
12
|
+
paymentChoices: IPaymentChoice[];
|
|
13
|
+
}
|
|
14
|
+
interface PaymentRealTimeData {
|
|
15
|
+
balance: number;
|
|
16
|
+
enableAutoDeduct: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class BasePaymentService extends RequestCacheService<PaymentRequest, PaymentResponse, PaymentCacheData, PaymentRealTimeData> {
|
|
19
|
+
private apiEndpoint;
|
|
20
|
+
private paymentType;
|
|
21
|
+
private static failureCounters;
|
|
22
|
+
private static readonly MAX_FAILURE_COUNT;
|
|
23
|
+
constructor(apiEndpoint: string, paymentType: PaymentPurchaseType);
|
|
24
|
+
getProductsInfo(): Promise<PaymentResponse | undefined>;
|
|
25
|
+
purchase(productId: string): Promise<PaymentResult<{
|
|
16
26
|
totalAmount: string;
|
|
17
27
|
}>>;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private static arraysEqual;
|
|
29
|
-
private static updateChoicesWithServerData;
|
|
30
|
-
static clearPaymentChoicesCache(apiEndpoint?: string): void;
|
|
31
|
-
static getPaymentChoicesCacheStats(): {
|
|
32
|
-
cacheCount: number;
|
|
33
|
-
validCount: number;
|
|
34
|
-
expiredCount: number;
|
|
35
|
-
};
|
|
36
|
-
static clearExpiredPaymentChoicesCache(): void;
|
|
28
|
+
getProductsInfoWithBalance(): Promise<PaymentResponse | undefined>;
|
|
29
|
+
refreshProductsInfo(): Promise<PaymentResponse | undefined>;
|
|
30
|
+
static resetFailureCounters(): void;
|
|
31
|
+
static getFailureCount(endpoint: string): number;
|
|
32
|
+
}
|
|
33
|
+
export declare class JoliCoinPaymentService extends BasePaymentService {
|
|
34
|
+
constructor();
|
|
35
|
+
}
|
|
36
|
+
export declare class JoliGemPaymentService extends BasePaymentService {
|
|
37
|
+
constructor();
|
|
37
38
|
}
|
|
39
|
+
export declare const createJoliCoinPaymentService: () => JoliCoinPaymentService;
|
|
40
|
+
export declare const createJoliGemPaymentService: () => JoliGemPaymentService;
|
|
41
|
+
export declare const clearNativePriceCache: () => void;
|
|
42
|
+
export declare const resetFailureCounters: () => void;
|
|
43
|
+
export declare const getFailureCount: (endpoint: string) => number;
|
|
38
44
|
export {};
|
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.2.
|
|
3
|
+
> @jolibox/implement@1.2.5 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.2.
|
|
7
|
+
> @jolibox/implement@1.2.5 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.5",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.2.
|
|
10
|
-
"@jolibox/types": "1.2.
|
|
11
|
-
"@jolibox/native-bridge": "1.2.
|
|
12
|
-
"@jolibox/ads": "1.2.
|
|
9
|
+
"@jolibox/common": "1.2.5",
|
|
10
|
+
"@jolibox/types": "1.2.5",
|
|
11
|
+
"@jolibox/native-bridge": "1.2.5",
|
|
12
|
+
"@jolibox/ads": "1.2.5",
|
|
13
13
|
"localforage": "1.10.0",
|
|
14
14
|
"@jolibox/ui": "1.0.0",
|
|
15
15
|
"web-vitals": "4.2.4"
|