@jolibox/demos 1.2.5-beta.3 → 1.3.3
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/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/demos",
|
|
3
3
|
"description": "This project is common demos for development",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@jolibox/sdk": "1.
|
|
11
|
-
"@jolibox/implement": "1.
|
|
10
|
+
"@jolibox/sdk": "1.3.3",
|
|
11
|
+
"@jolibox/implement": "1.3.3",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"react-dom": "18.2.0"
|
|
14
14
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@types/react": "18.2.0",
|
|
18
18
|
"@types/react-dom": "18.2.0",
|
|
19
19
|
"typescript": "5.7.3",
|
|
20
|
-
"@jolibox/eslint-config": "1.0.1-beta.
|
|
20
|
+
"@jolibox/eslint-config": "1.0.1-beta.16",
|
|
21
21
|
"@types/jest": "28.1.1",
|
|
22
22
|
"rimraf": "6.0.1",
|
|
23
23
|
"vite": "5.1.4",
|
package/src/App.tsx
CHANGED
|
@@ -311,6 +311,33 @@ export const App = () => {
|
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
+
const getSubscriptionPlans = useCallback(async () => {
|
|
315
|
+
try {
|
|
316
|
+
const res = await jolibox.payment.getSubscriptionPlans();
|
|
317
|
+
setResult(JSON.stringify(res ?? {}));
|
|
318
|
+
} catch (error) {
|
|
319
|
+
setResult(JSON.stringify(error ?? {}));
|
|
320
|
+
}
|
|
321
|
+
}, [jolibox]);
|
|
322
|
+
|
|
323
|
+
const flushSubInfoCache = useCallback(async () => {
|
|
324
|
+
try {
|
|
325
|
+
const res = await jolibox.payment.flushSubInfoCache();
|
|
326
|
+
setResult(JSON.stringify(res ?? {}));
|
|
327
|
+
} catch (error) {
|
|
328
|
+
setResult(JSON.stringify(error ?? {}));
|
|
329
|
+
}
|
|
330
|
+
}, [jolibox]);
|
|
331
|
+
|
|
332
|
+
const subscribe = useCallback(async () => {
|
|
333
|
+
try {
|
|
334
|
+
const res = await jolibox.payment.subscribe({ productId: 'P32477113212850250733691206557' });
|
|
335
|
+
setResult(JSON.stringify(res ?? {}));
|
|
336
|
+
} catch (error) {
|
|
337
|
+
setResult(JSON.stringify(error ?? {}));
|
|
338
|
+
}
|
|
339
|
+
}, [jolibox]);
|
|
340
|
+
|
|
314
341
|
return (
|
|
315
342
|
<div>
|
|
316
343
|
{/* 测试音频播放器 */}
|
|
@@ -334,10 +361,10 @@ export const App = () => {
|
|
|
334
361
|
>
|
|
335
362
|
Test isNativeSupport API
|
|
336
363
|
</button>
|
|
337
|
-
<button onClick={isNativeSupportAPI.bind(this, {
|
|
364
|
+
<button onClick={isNativeSupportAPI.bind(this, { version: '1.2.1' })}>
|
|
338
365
|
Test isNativeSupport versionCode
|
|
339
366
|
</button>
|
|
340
|
-
<button onClick={callHostMethod.bind(this, '
|
|
367
|
+
<button onClick={callHostMethod.bind(this, 'openMiniapp')}>Test callHostMethod</button>
|
|
341
368
|
<p style={{ whiteSpace: 'pre-wrap' }}>{result}</p>
|
|
342
369
|
<p style={{ whiteSpace: 'pre-wrap' }}>Lifecycle callback: {callbackResult}</p>
|
|
343
370
|
</div>
|
|
@@ -415,6 +442,16 @@ export const App = () => {
|
|
|
415
442
|
navigate Value: <span style={{ color: '#666' }}>{`${navigateValue}`}</span>
|
|
416
443
|
</p>
|
|
417
444
|
</div>
|
|
445
|
+
{/* payment */}
|
|
446
|
+
<div style={{ marginTop: '20px', borderTop: '1px solid #eee', paddingTop: '20px' }}>
|
|
447
|
+
<h3>navigate</h3>
|
|
448
|
+
<button onClick={getSubscriptionPlans}>getSubscriptionPlans</button>
|
|
449
|
+
<button onClick={subscribe}>subscribe</button>
|
|
450
|
+
<button onClick={flushSubInfoCache}>flushSubInfoCache</button>
|
|
451
|
+
<p>
|
|
452
|
+
navigate Value: <span style={{ color: '#666' }}>{`${navigateValue}`}</span>
|
|
453
|
+
</p>
|
|
454
|
+
</div>
|
|
418
455
|
</div>
|
|
419
456
|
</div>
|
|
420
457
|
);
|