@weapp-container/react-native 0.1.0-preview.7.1 → 0.1.0-preview.7.2
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.en.md +16 -53
- package/README.md +16 -53
- package/android/build.gradle +1 -1
- package/lib/index.d.ts +0 -15
- package/lib/index.js +0 -31
- package/package.json +1 -1
- package/sdk-artifact.json +25 -25
- package/src/index.tsx +0 -42
package/README.en.md
CHANGED
|
@@ -5,60 +5,28 @@
|
|
|
5
5
|
<a id="公开发行候选preview7"></a>
|
|
6
6
|
## Public distribution candidate: preview.7
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
`0.1.0-preview.7.2` is published to npm, and its Android Maven dependency resolves anonymously. It remains a prerelease, with no stable version available. The iOS SDK archive referenced by the React Native Pod is unavailable, so the published release currently supports Android native builds only. iOS support depends on publication of the matching archive. See the [SDK release status](https://github.com/weapp-container/weapp-container/blob/main/docs/public-sdk-release.en.md).
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Version `0.1.0-preview.7.1` targets React Native 0.88 with the New Architecture, Android API 26+ / Java 17, and iOS 16+. Install the public preview:
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
npm install @weapp-container/react-native@0.1.0-preview.7.1
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Android resolves `io.github.weapp-container:weapp-container-android:0.1.0-preview.7.1` from Maven Central. Add these sources to the iOS Podfile:
|
|
19
|
-
|
|
20
|
-
```ruby
|
|
21
|
-
source 'https://github.com/weapp-container/Specs.git'
|
|
22
|
-
source 'https://cdn.cocoapods.org/'
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Then run `pod install`. The bridge depends on the matching `WeappContainer` Pod without embedding a second runtime. Installation needs no preparation script, Rust or sibling SDK checkout.
|
|
26
|
-
|
|
27
|
-
<a id="已复核的源码构建版本"></a>
|
|
28
|
-
### Reviewed source-build checkout
|
|
10
|
+
Version `0.1.0-preview.7.2` targets React Native 0.88 with the New Architecture, Android API 26+ / Java 17, and iOS 16+. Install the public preview:
|
|
29
11
|
|
|
30
12
|
```sh
|
|
31
|
-
|
|
32
|
-
cd sdk-react-native-source
|
|
33
|
-
git checkout 7565c32125b8e4a76ec4e17213f773ef6fc64e93
|
|
13
|
+
npm install @weapp-container/react-native@0.1.0-preview.7.2
|
|
34
14
|
```
|
|
35
15
|
|
|
36
|
-
|
|
16
|
+
Android resolves `io.github.weapp-container:weapp-container-android:0.1.0-preview.7.2` from Maven Central. The npm package is installable, but its iOS Pod depends on an unavailable fixed SDK archive, so an iOS native build cannot complete. Use the current prerelease for Android only. Android installation needs no Rust or sibling SDK checkout.
|
|
37
17
|
|
|
38
18
|
[Documentation](https://container.weapp.dev/en/docs/) · [Source builds](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.en.md) · [APIs and protocols](https://github.com/weapp-container/sdk-contract/blob/main/README.en.md)
|
|
39
19
|
|
|
40
20
|
Embed a native mini-program container in React Native applications on Android and iOS, using a Fabric component and TurboModule. A TypeScript Controller handles packs, navigation, messages and session ownership.
|
|
41
21
|
|
|
42
|
-
Package: `@weapp-container/react-native`;
|
|
22
|
+
Package: `@weapp-container/react-native`; example and npm prerelease version: `0.1.0-preview.7.2`; native ABI: `1`. This repository contains the Apache-2.0 integration layer. Applications use the published prerelease and Android Maven dependency; source builds and archive preparation are SDK maintenance workflows.
|
|
43
23
|
|
|
44
|
-
> Current source and the default public lock both use preview.7.
|
|
24
|
+
> Current source and the default public lock both use preview.7.2. Preparation reads `runtime-artifacts.0.1.0-preview.7.2.lock.json` by default; `runtime-artifacts.lock.json` retains historical preview.5.3 inputs only. Custom local archives still require a reviewed same-version lock selected with `--manifest`. The npm and Android Maven prereleases are public; the iOS native archive is not.
|
|
45
25
|
|
|
46
26
|
<a id="从当前源码开始"></a>
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
For a new integration, use the public core repository and its pinned SDK revisions. This path needs no historical archive download token:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
git clone --recurse-submodules https://github.com/weapp-container/weapp-container.git
|
|
53
|
-
cd weapp-container
|
|
54
|
-
corepack enable
|
|
55
|
-
pnpm install --frozen-lockfile
|
|
56
|
-
node sdk/contract/fixtures/make-acceptance-pack.mjs --out artifacts/hello-pack
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Follow the [source build guide](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.en.md) to prepare the target runtime and notices, then use this SDK's packaging tools. Platform toolchains remain prerequisites. Public source does not imply that prebuilt packages are available from a public registry. Native mini-program directories and existing framework builds can be packaged independently; weapp-vite is optional.
|
|
27
|
+
## Maintainer source builds
|
|
60
28
|
|
|
61
|
-
|
|
29
|
+
Normal Android applications should install the npm package above. SDK maintainers generating the iOS native dependency or updating release manifests should follow the [source build guide](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.en.md) from a prepared checkout. The npm `.7.2` package and Android Maven dependency are available, while the SDK archive referenced by the iOS Podspec is unavailable.
|
|
62
30
|
|
|
63
31
|
<a id="环境要求"></a>
|
|
64
32
|
## Requirements
|
|
@@ -71,20 +39,20 @@ The remaining sections describe standalone SDK installation, views, and lifecycl
|
|
|
71
39
|
| Android | API 26+; arm64-v8a, x86_64; Android SDK, JDK and Gradle toolchain |
|
|
72
40
|
| iOS | iOS 16+; arm64 device, arm64/x86_64 simulator; macOS, Xcode and CocoaPods |
|
|
73
41
|
|
|
42
|
+
The published prerelease cannot currently build an iOS application because the matching SDK archive referenced by its Podspec has not been published.
|
|
43
|
+
|
|
74
44
|
<a id="1-安装-sdk"></a>
|
|
75
45
|
## 1. Install the SDK
|
|
76
46
|
|
|
77
|
-
|
|
47
|
+
Install the published npm prerelease in your React Native application:
|
|
78
48
|
|
|
79
49
|
```sh
|
|
80
|
-
npm install
|
|
81
|
-
cd ios
|
|
82
|
-
pod install
|
|
50
|
+
npm install @weapp-container/react-native@0.1.0-preview.7.2
|
|
83
51
|
```
|
|
84
52
|
|
|
85
|
-
|
|
53
|
+
Android resolves its native dependency from the public Maven artifact and can be built using the example below. The iOS Pod depends on an unavailable archive, so do not run `pod install` to integrate this prerelease on iOS. Enable only `arm64-v8a,x86_64` in Android.
|
|
86
54
|
|
|
87
|
-
To generate a distribution
|
|
55
|
+
To generate a custom distribution, follow “Build a distribution from source” below as a maintainer workflow.
|
|
88
56
|
|
|
89
57
|
<a id="2-创建会话与注册宿主方法"></a>
|
|
90
58
|
## 2. Create a session and register host methods
|
|
@@ -166,15 +134,10 @@ Host methods accept and return JSON-compatible values. Asynchronous work should
|
|
|
166
134
|
|
|
167
135
|
For login, accounts, networking or device APIs, call `configureHostServices`, then optionally `installNativeDeviceApis`, before `load()`. The host controls network origin allowlists and OS permissions. Restricted Showcase runtimes continue to enforce their compiled policy. See [src/index.tsx](src/index.tsx) and [CONTRACT.md](CONTRACT.en.md) for configuration, account switching and full types.
|
|
168
136
|
|
|
169
|
-
Register standard mini-program payment with `controller.installWxRequestPayment(handler)`. The SDK validates `timeStamp`, `nonceStr`, `package`, `signType`, and `paySign`. The handler must call the host's configured official payment SDK and resolve only after the terminal callback and server-side order confirmation; success is returned as `requestPayment:ok`, while cancellation or channel errors should throw `HostError`. The SDK never accepts merchant secrets from the guest or treats UI completion as proof that an order is paid.
|
|
170
|
-
|
|
171
137
|
<a id="从源码生成分发包"></a>
|
|
172
138
|
## Build a distribution from source
|
|
173
139
|
|
|
174
140
|
```sh
|
|
175
|
-
git clone https://github.com/weapp-container/sdk-react-native.git
|
|
176
|
-
cd sdk-react-native
|
|
177
|
-
git checkout 7565c32125b8e4a76ec4e17213f773ef6fc64e93
|
|
178
141
|
npm install --ignore-scripts
|
|
179
142
|
npm run typecheck
|
|
180
143
|
node tools/prepare-native.mjs --platform android --arch universal \
|
|
@@ -193,7 +156,7 @@ Create an independent application with a test pack from that archive:
|
|
|
193
156
|
|
|
194
157
|
```sh
|
|
195
158
|
node tools/create-consumer.mjs \
|
|
196
|
-
--package /absolute/new-sdk-packages/weapp-container-react-native-0.1.0-preview.7.
|
|
159
|
+
--package /absolute/new-sdk-packages/weapp-container-react-native-0.1.0-preview.7.2.tgz \
|
|
197
160
|
--out /absolute/new-rn-consumer
|
|
198
161
|
```
|
|
199
162
|
|
|
@@ -204,7 +167,7 @@ The generator uses a pinned React Native template, installs the SDK and prepares
|
|
|
204
167
|
|
|
205
168
|
| Symptom | Check |
|
|
206
169
|
| --- | --- |
|
|
207
|
-
| Default preparation rejects the version | Use the current preview.7.
|
|
170
|
+
| Default preparation rejects the version | Use the current preview.7.2 public lock; a custom manifest must match the wrapper and archives |
|
|
208
171
|
| Missing AAR / XCFramework | Prepare matching native SDKs; a source checkout does not include the runtime |
|
|
209
172
|
| Android linking or installation fails | API 26+, arm64-v8a and x86_64 only |
|
|
210
173
|
| Native component is unavailable | Use the new architecture, prepare native dependencies, install CocoaPods and rebuild |
|
package/README.md
CHANGED
|
@@ -5,60 +5,28 @@
|
|
|
5
5
|
<a id="public-distribution-candidate-preview7"></a>
|
|
6
6
|
## 公开发行候选:preview.7
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
`0.1.0-preview.7.2` 已发布到 npm,Android Maven 依赖也可匿名解析。它仍是预览版,没有稳定版。当前 React Native iOS Pod 所依赖的 iOS SDK 归档 URL 不可用,因此已发布版本目前仅支持 Android 原生构建;iOS 支持需等待配套归档发布。发行渠道状态见[SDK 发行状态](https://github.com/weapp-container/weapp-container/blob/main/docs/public-sdk-release.md)。
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
版本 `0.1.0-preview.7.1`;React Native 0.88 新架构,Android API 26+ / Java 17,iOS 16+。安装公开预览:
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
npm install @weapp-container/react-native@0.1.0-preview.7.1
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Android 从 Maven Central 获取 `io.github.weapp-container:weapp-container-android:0.1.0-preview.7.1`。iOS Podfile 添加:
|
|
19
|
-
|
|
20
|
-
```ruby
|
|
21
|
-
source 'https://github.com/weapp-container/Specs.git'
|
|
22
|
-
source 'https://cdn.cocoapods.org/'
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
随后在 iOS 工程运行 `pod install`。桥接包依赖同版本 `WeappContainer` Pod,不重复捆绑运行库。普通安装无需 Node 准备命令、Rust 或兄弟 SDK checkout。
|
|
26
|
-
|
|
27
|
-
<a id="reviewed-source-build-checkout"></a>
|
|
28
|
-
### 已复核的源码构建版本
|
|
10
|
+
版本 `0.1.0-preview.7.2`;React Native 0.88 新架构,Android API 26+ / Java 17,iOS 16+。安装公开预览:
|
|
29
11
|
|
|
30
12
|
```sh
|
|
31
|
-
|
|
32
|
-
cd sdk-react-native-source
|
|
33
|
-
git checkout 7565c32125b8e4a76ec4e17213f773ef6fc64e93
|
|
13
|
+
npm install @weapp-container/react-native@0.1.0-preview.7.2
|
|
34
14
|
```
|
|
35
15
|
|
|
36
|
-
|
|
16
|
+
Android 从 Maven Central 获取 `io.github.weapp-container:weapp-container-android:0.1.0-preview.7.2`。npm 包可以安装,但其 iOS Pod 依赖的固定 SDK 归档当前不可用,不能完成 iOS 原生构建。普通应用应只在 Android 使用当前预览版;iOS 原生支持尚未发布。Android 普通安装无需 Rust 或兄弟 SDK checkout。
|
|
37
17
|
|
|
38
18
|
[开发文档](https://container.weapp.dev/docs/) · [源码构建](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.md) · [API 与协议](https://github.com/weapp-container/sdk-contract/blob/main/README.md)
|
|
39
19
|
|
|
40
20
|
在 React Native 应用中嵌入原生小程序容器,支持 Android 与 iOS,使用 Fabric 组件和 TurboModule。通过 TypeScript Controller 加载 pack、导航、收发消息和管理会话。
|
|
41
21
|
|
|
42
|
-
包名:`@weapp-container/react-native
|
|
22
|
+
包名:`@weapp-container/react-native`;示例与 npm 预览版本:`0.1.0-preview.7.2`;原生 ABI:`1`。本仓库提供 Apache-2.0 许可的接入层。普通应用使用公开预览包和 Android Maven 依赖;源码构建与归档准备属于 SDK 维护流程。
|
|
43
23
|
|
|
44
|
-
> 当前源码与默认公开锁均使用 preview.7.
|
|
24
|
+
> 当前源码与默认公开锁均使用 preview.7.2。准备工具默认读取 `runtime-artifacts.0.1.0-preview.7.2.lock.json`;`runtime-artifacts.lock.json` 仅保留历史 preview.5.3 输入。自定义本地归档仍须通过 `--manifest` 指定同版本审核锁。npm 与 Android Maven 预览包已公开,iOS 原生归档尚未发布。
|
|
45
25
|
|
|
46
26
|
<a id="start-from-current-source"></a>
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
首次接入优先使用公开的核心仓库及其固定 SDK 提交,不需要历史归档的下载 token:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
git clone --recurse-submodules https://github.com/weapp-container/weapp-container.git
|
|
53
|
-
cd weapp-container
|
|
54
|
-
corepack enable
|
|
55
|
-
pnpm install --frozen-lockfile
|
|
56
|
-
node sdk/contract/fixtures/make-acceptance-pack.mjs --out artifacts/hello-pack
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
随后按[源码构建说明](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.md)准备目标平台的运行库和 notices,再用本仓库的构建工具生成接入包。平台工具链仍是必要依赖;源码公开不表示公共包仓库已有可下载的二进制。已有原生小程序或框架构建产物可以由独立 portable pack 工具打包,不要求 weapp-vite。
|
|
27
|
+
## 维护者源码构建
|
|
60
28
|
|
|
61
|
-
|
|
29
|
+
普通 Android 应用直接安装上面的 npm 包。只有维护 SDK、生成 iOS 配套原生依赖或更新发行清单时,才按[源码构建说明](https://github.com/weapp-container/weapp-container/blob/main/docs/sdk-source-build.md)准备源码和目标工具链。npm `.7.2` 与 Android Maven 依赖可获取,但 iOS Podspec 引用的 SDK 归档当前不可用。
|
|
62
30
|
|
|
63
31
|
<a id="requirements"></a>
|
|
64
32
|
## 环境要求
|
|
@@ -71,20 +39,20 @@ node sdk/contract/fixtures/make-acceptance-pack.mjs --out artifacts/hello-pack
|
|
|
71
39
|
| Android | API 26+;arm64-v8a、x86_64;Android SDK、JDK、Gradle 工具链 |
|
|
72
40
|
| iOS | iOS 16+;arm64 真机、arm64/x86_64 模拟器;macOS、Xcode、CocoaPods |
|
|
73
41
|
|
|
42
|
+
当前公开预览尚不能构建 iOS 原生应用,因为 Podspec 引用的配套 SDK 归档尚未发布。
|
|
43
|
+
|
|
74
44
|
<a id="1-install-the-sdk"></a>
|
|
75
45
|
## 1. 安装 SDK
|
|
76
46
|
|
|
77
|
-
|
|
47
|
+
在 React Native 应用中安装已发布的 npm 预览包:
|
|
78
48
|
|
|
79
49
|
```sh
|
|
80
|
-
npm install
|
|
81
|
-
cd ios
|
|
82
|
-
pod install
|
|
50
|
+
npm install @weapp-container/react-native@0.1.0-preview.7.2
|
|
83
51
|
```
|
|
84
52
|
|
|
85
|
-
|
|
53
|
+
Android 使用公开 Maven 依赖并可按下方示例构建。当前预览的 iOS Pod 依赖归档尚不可用,因此不要在 iOS 上执行 `pod install` 来接入此版本。Android 应用只启用 `arm64-v8a,x86_64`。
|
|
86
54
|
|
|
87
|
-
|
|
55
|
+
需要生成自定义分发包时,请先阅读文末面向维护者的“从源码生成分发包”。
|
|
88
56
|
|
|
89
57
|
<a id="2-create-a-session-and-register-host-methods"></a>
|
|
90
58
|
## 2. 创建会话与注册宿主方法
|
|
@@ -166,15 +134,10 @@ await controller.close();
|
|
|
166
134
|
|
|
167
135
|
需要登录、账号、网络或设备 API 时,在 `load()` 前调用 `configureHostServices`,再按需调用 `installNativeDeviceApis`。宿主负责网络 origin 白名单和系统权限,受限 Showcase 的编译时策略继续生效。配置、账号切换和完整类型见 [src/index.tsx](src/index.tsx) 与 [CONTRACT.md](CONTRACT.md)。
|
|
168
136
|
|
|
169
|
-
标准微信支付可使用 `controller.installWxRequestPayment(handler)` 注册。SDK 会校验 `timeStamp`、`nonceStr`、`package`、`signType` 和 `paySign`,handler 应调用宿主配置的官方支付 SDK,并在终结回调与服务端验单完成后返回;成功结果固定为 `requestPayment:ok`,取消或渠道错误应抛出 `HostError`。SDK 不接受 guest 自带商户密钥,也不会把 UI 已完成当作订单已支付。
|
|
170
|
-
|
|
171
137
|
<a id="build-a-distribution-from-source"></a>
|
|
172
138
|
## 从源码生成分发包
|
|
173
139
|
|
|
174
140
|
```sh
|
|
175
|
-
git clone https://github.com/weapp-container/sdk-react-native.git
|
|
176
|
-
cd sdk-react-native
|
|
177
|
-
git checkout 7565c32125b8e4a76ec4e17213f773ef6fc64e93
|
|
178
141
|
npm install --ignore-scripts
|
|
179
142
|
npm run typecheck
|
|
180
143
|
node tools/prepare-native.mjs --platform android --arch universal \
|
|
@@ -193,7 +156,7 @@ node tools/package.mjs --out /absolute/new-sdk-packages \
|
|
|
193
156
|
|
|
194
157
|
```sh
|
|
195
158
|
node tools/create-consumer.mjs \
|
|
196
|
-
--package /absolute/new-sdk-packages/weapp-container-react-native-0.1.0-preview.7.
|
|
159
|
+
--package /absolute/new-sdk-packages/weapp-container-react-native-0.1.0-preview.7.2.tgz \
|
|
197
160
|
--out /absolute/new-rn-consumer
|
|
198
161
|
```
|
|
199
162
|
|
|
@@ -204,7 +167,7 @@ node tools/create-consumer.mjs \
|
|
|
204
167
|
|
|
205
168
|
| 现象 | 检查项 |
|
|
206
169
|
| --- | --- |
|
|
207
|
-
| 默认准备命令拒绝版本 | 确认使用当前 preview.7.
|
|
170
|
+
| 默认准备命令拒绝版本 | 确认使用当前 preview.7.2 公开锁;自定义 manifest 必须与包装层和归档一致 |
|
|
208
171
|
| 找不到 AAR / XCFramework | 先准备同版本原生 SDK;单独安装源码不会附带运行库 |
|
|
209
172
|
| Android 链接或安装失败 | API 26+,仅启用 arm64-v8a、x86_64 |
|
|
210
173
|
| 原生组件不可用 | 使用新架构,完成原生依赖准备、CocoaPods 安装和应用重新构建 |
|
package/android/build.gradle
CHANGED
|
@@ -33,5 +33,5 @@ rootProject.allprojects {
|
|
|
33
33
|
}
|
|
34
34
|
dependencies {
|
|
35
35
|
implementation "com.facebook.react:react-android"
|
|
36
|
-
implementation 'io.github.weapp-container:weapp-container-android:0.1.0-preview.7.
|
|
36
|
+
implementation 'io.github.weapp-container:weapp-container-android:0.1.0-preview.7.2'
|
|
37
37
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -90,14 +90,6 @@ export type HostHandler = (payload: JSONValue, context: {
|
|
|
90
90
|
cancelToken?: string;
|
|
91
91
|
apiContext?: HostApiCallContext;
|
|
92
92
|
}) => JSONValue | Promise<JSONValue>;
|
|
93
|
-
export type WxRequestPaymentOptions = {
|
|
94
|
-
timeStamp: string;
|
|
95
|
-
nonceStr: string;
|
|
96
|
-
package: string;
|
|
97
|
-
signType: 'MD5' | 'HMAC-SHA256' | 'RSA';
|
|
98
|
-
paySign: string;
|
|
99
|
-
};
|
|
100
|
-
export type WxRequestPaymentHandler = (options: WxRequestPaymentOptions, context: Parameters<HostHandler>[1]) => void | Promise<void>;
|
|
101
93
|
export type AccountCleanupHandler = (context: {
|
|
102
94
|
operationId: string;
|
|
103
95
|
signal: AbortSignal;
|
|
@@ -126,13 +118,6 @@ export declare class WeappContainerController {
|
|
|
126
118
|
registerHostMethod(name: string, handler: HostHandler): Promise<void>;
|
|
127
119
|
configureHostServices(configuration: HostServicesConfiguration): Promise<void>;
|
|
128
120
|
registerApiHandler(name: string, handler: HostHandler): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Install the standard mini-program JSAPI payment boundary.
|
|
131
|
-
* The handler must call the configured official payment SDK and resolve only
|
|
132
|
-
* after its terminal callback; backend order confirmation remains the host's
|
|
133
|
-
* responsibility.
|
|
134
|
-
*/
|
|
135
|
-
installWxRequestPayment(handler: WxRequestPaymentHandler): Promise<void>;
|
|
136
121
|
/** Await custom resources before a new account owner can start. */
|
|
137
122
|
registerAccountCleanupHandler(handler: AccountCleanupHandler): () => void;
|
|
138
123
|
installNativeDeviceApis(options?: NativeDeviceApiOptions): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -107,37 +107,6 @@ export class WeappContainerController {
|
|
|
107
107
|
throw error;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Install the standard mini-program JSAPI payment boundary.
|
|
112
|
-
* The handler must call the configured official payment SDK and resolve only
|
|
113
|
-
* after its terminal callback; backend order confirmation remains the host's
|
|
114
|
-
* responsibility.
|
|
115
|
-
*/
|
|
116
|
-
async installWxRequestPayment(handler) {
|
|
117
|
-
await this.registerApiHandler('wx.requestPayment', async (payload, context) => {
|
|
118
|
-
if (payload === null || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
119
|
-
throw new HostError('invalid_request', 'wx.requestPayment options are required');
|
|
120
|
-
}
|
|
121
|
-
const value = payload;
|
|
122
|
-
const fields = ['timeStamp', 'nonceStr', 'package', 'signType', 'paySign'];
|
|
123
|
-
for (const field of fields) {
|
|
124
|
-
if (typeof value[field] !== 'string' || value[field].trim().length === 0) {
|
|
125
|
-
throw new HostError('invalid_request', `wx.requestPayment requires non-empty ${field}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (!['MD5', 'HMAC-SHA256', 'RSA'].includes(value.signType)) {
|
|
129
|
-
throw new HostError('invalid_request', 'wx.requestPayment signType must be MD5, HMAC-SHA256, or RSA');
|
|
130
|
-
}
|
|
131
|
-
await handler({
|
|
132
|
-
timeStamp: value.timeStamp,
|
|
133
|
-
nonceStr: value.nonceStr,
|
|
134
|
-
package: value.package,
|
|
135
|
-
signType: value.signType,
|
|
136
|
-
paySign: value.paySign,
|
|
137
|
-
}, context);
|
|
138
|
-
return { errMsg: 'requestPayment:ok' };
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
110
|
/** Await custom resources before a new account owner can start. */
|
|
142
111
|
registerAccountCleanupHandler(handler) {
|
|
143
112
|
if (this.closed || this.closeRequested)
|
package/package.json
CHANGED
package/sdk-artifact.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"sourceCommit": "
|
|
3
|
+
"sourceCommit": "b7bdc454f8a6c1065ed4ef1aba901cb28610717a",
|
|
4
4
|
"sourceDirty": false,
|
|
5
5
|
"nativeDependencies": {
|
|
6
6
|
"ios": {
|
|
7
7
|
"schemaVersion": 1,
|
|
8
8
|
"repository": "weapp-container/sdk-ios",
|
|
9
|
-
"sdkVersion": "0.1.0-preview.7.
|
|
10
|
-
"tag": "v0.1.0-preview.7.
|
|
11
|
-
"sourceCommit": "
|
|
9
|
+
"sdkVersion": "0.1.0-preview.7.2",
|
|
10
|
+
"tag": "v0.1.0-preview.7.2",
|
|
11
|
+
"sourceCommit": "06eb7937c82eb15bfd5605f132bbc6f2c3e7dae6",
|
|
12
12
|
"sourceDirty": false,
|
|
13
13
|
"assets": [
|
|
14
14
|
{
|
|
15
15
|
"component": "swiftpm-native",
|
|
16
|
-
"fileName": "WeappContainerNative-0.1.0-preview.7.
|
|
17
|
-
"size":
|
|
18
|
-
"sha256": "
|
|
16
|
+
"fileName": "WeappContainerNative-0.1.0-preview.7.2.xcframework.zip",
|
|
17
|
+
"size": 77012323,
|
|
18
|
+
"sha256": "81ea51bee342679983260ce38ddfd2c6039b4a27e2c6ff6070e6abeb6e9a73b3"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"component": "cocoapods-sdk",
|
|
22
|
-
"fileName": "WeappContainer-0.1.0-preview.7.
|
|
23
|
-
"size":
|
|
24
|
-
"sha256": "
|
|
22
|
+
"fileName": "WeappContainer-0.1.0-preview.7.2.zip",
|
|
23
|
+
"size": 80228770,
|
|
24
|
+
"sha256": "61195dba53d69f5070d58b15078282f8832f265fce704a5f2b40810731082ffe"
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
|
-
"packagingSourceCommit": "
|
|
27
|
+
"packagingSourceCommit": "bc39fe4fb7293987017b2125d05e80429153ebc8"
|
|
28
28
|
},
|
|
29
29
|
"android": {
|
|
30
30
|
"schemaVersion": 1,
|
|
31
31
|
"repository": "weapp-container/sdk-android",
|
|
32
|
-
"sdkVersion": "0.1.0-preview.7.
|
|
33
|
-
"tag": "v0.1.0-preview.7.
|
|
34
|
-
"sourceCommit": "
|
|
32
|
+
"sdkVersion": "0.1.0-preview.7.2",
|
|
33
|
+
"tag": "v0.1.0-preview.7.2",
|
|
34
|
+
"sourceCommit": "c3cd1b8123ad2c2b6a41aea11fba089369b3013e",
|
|
35
35
|
"sourceDirty": false,
|
|
36
36
|
"assets": [
|
|
37
37
|
{
|
|
38
38
|
"component": "maven-central",
|
|
39
|
-
"coordinate": "io.github.weapp-container:weapp-container-android:0.1.0-preview.7.
|
|
40
|
-
"fileName": "weapp-container-android-0.1.0-preview.7.
|
|
41
|
-
"size":
|
|
42
|
-
"sha256": "
|
|
39
|
+
"coordinate": "io.github.weapp-container:weapp-container-android:0.1.0-preview.7.2",
|
|
40
|
+
"fileName": "weapp-container-android-0.1.0-preview.7.2-central.zip",
|
|
41
|
+
"size": 25202700,
|
|
42
|
+
"sha256": "6401e3efd1e20cb569991eb381bc87c7ac262e945eebfd501853f6ce04d51c9f"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"files": {
|
|
48
|
-
"android/build.gradle": "
|
|
48
|
+
"android/build.gradle": "9b95295faa9561eaaa4bc408908b2e7dfe7b47da2559c2a85007b7b3009760d3",
|
|
49
49
|
"android/src/main/AndroidManifest.xml": "343d5be1ac17cdd45d1a2f2ddc616c509290e655869125a9422a96d88aa66066",
|
|
50
50
|
"android/src/main/java/com/sonofmagic/weapp/container/reactnative/WeappContainerModule.kt": "0d9dc6287233517546355d659b64cdf41bc1e46fc37c9a93c8056c038e58008d",
|
|
51
51
|
"android/src/main/java/com/sonofmagic/weapp/container/reactnative/WeappContainerPackage.kt": "1926bbccb29a1cb6babf8ff266ff09037dc0ccc675799d05e0523a76e9b0969f",
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"ios/WCRNInstance.swift": "0f42f6074008449c822d1500571cd8283789efc575c2f450fbdebb33fffab8a1",
|
|
56
56
|
"ios/WCRNModule.h": "d56dbf86e1aeeb1395c254eb06d3bf1ccce4ec2fcdfe400fac67f4827ff1dcdb",
|
|
57
57
|
"ios/WCRNModule.mm": "98b6a0c70ce746f7ef47a37df2715f3089969852dccae140e2299db6fcc3c85d",
|
|
58
|
-
"lib/index.d.ts": "
|
|
59
|
-
"lib/index.js": "
|
|
58
|
+
"lib/index.d.ts": "5681ed42ad306854e118c664eeeae14dc6455f915ed49f90e384ed4af9462f1f",
|
|
59
|
+
"lib/index.js": "a5f721f7123f7ce2b5ad46d9d099a6d4f187bac1c5a4c8aa10d9abde6a1b9506",
|
|
60
60
|
"lib/specs/NativeWeappContainer.d.ts": "9457d91796f72cdd413573affa2377d4899c942829d210f98eb47a03e5c5b8a1",
|
|
61
61
|
"lib/specs/NativeWeappContainer.js": "b50593c75735bd3cda3485162f6801f0f3113308f9a1dd3c4885ac78bad6c42a",
|
|
62
62
|
"lib/specs/WeappContainerNativeComponent.d.ts": "81fd59ef184cd9db907530e2a53c2a19169e420bd239fd286947192d820742f5",
|
|
63
63
|
"lib/specs/WeappContainerNativeComponent.js": "0bd137393ead6206f0c16fb3968429f2f3f1157e15e65ef5c668fa717e946d8c",
|
|
64
64
|
"LICENSE": "a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2",
|
|
65
|
-
"package.json": "
|
|
65
|
+
"package.json": "775cb6c60f10b4d1497ac7df777b1cb567dc09ce2a648d5f03f9260e3b016776",
|
|
66
66
|
"react-native.config.js": "b781e240c12b2ecbd0f6ae1bbe64138e113da030a0595e95a6e92d3911b870e0",
|
|
67
|
-
"README.en.md": "
|
|
68
|
-
"README.md": "
|
|
69
|
-
"src/index.tsx": "
|
|
67
|
+
"README.en.md": "78d51f033f8f990a94cfc839bb8b605c48287168056e061e26016df27a328e59",
|
|
68
|
+
"README.md": "620875b4ec31c7956b4f4952af8710a9b0056a1cc60c6eb68c9094bd8b13e281",
|
|
69
|
+
"src/index.tsx": "71b493abf1c0a3d401600177ea69ed800273345c39efebfd16b2d01b0be7192d",
|
|
70
70
|
"src/specs/NativeWeappContainer.ts": "e979e6afb3120f06b3451ee38842383b48e53f7d83fa662f11744eb8bb1dc1a7",
|
|
71
71
|
"src/specs/WeappContainerNativeComponent.ts": "cdfef5677c3a4d34cd10afbfe28c831eb010e8aac1e22489d6f8833e1f376f96",
|
|
72
72
|
"WeappContainerReactNative.podspec": "dd522048d824d5ea487a18d0acca2339875c6cd9714c02a130c463a6a118d6ee"
|
package/src/index.tsx
CHANGED
|
@@ -24,17 +24,6 @@ export class HostError extends Error {
|
|
|
24
24
|
constructor(public readonly code: HostErrorCode, message: string, public readonly retryable = false, public readonly details:JSONObject={}) { super(message); }
|
|
25
25
|
}
|
|
26
26
|
export type HostHandler = (payload: JSONValue, context: {signal: AbortSignal;callId:string;method:string;deadlineNs?:string;cancelToken?:string;apiContext?:HostApiCallContext}) => JSONValue | Promise<JSONValue>;
|
|
27
|
-
export type WxRequestPaymentOptions = {
|
|
28
|
-
timeStamp: string;
|
|
29
|
-
nonceStr: string;
|
|
30
|
-
package: string;
|
|
31
|
-
signType: 'MD5' | 'HMAC-SHA256' | 'RSA';
|
|
32
|
-
paySign: string;
|
|
33
|
-
};
|
|
34
|
-
export type WxRequestPaymentHandler = (
|
|
35
|
-
options: WxRequestPaymentOptions,
|
|
36
|
-
context: Parameters<HostHandler>[1],
|
|
37
|
-
) => void | Promise<void>;
|
|
38
27
|
export type AccountCleanupHandler = (context: {operationId:string;signal:AbortSignal}) => void | Promise<void>;
|
|
39
28
|
export type ContainerEvent = {type: 'accountCleanupRequired' | 'ready' | 'navigation' | 'message' | 'error' | 'closed' | 'presented' | 'accountSwitch' | 'hostApiEvent'; payload: JSONValue};
|
|
40
29
|
|
|
@@ -101,37 +90,6 @@ export class WeappContainerController {
|
|
|
101
90
|
this.apiHandlers.set(name,handler);
|
|
102
91
|
try { await this.command('registerApiHandler',{name}); } catch(error) { this.apiHandlers.delete(name); throw error; }
|
|
103
92
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Install the standard mini-program JSAPI payment boundary.
|
|
106
|
-
* The handler must call the configured official payment SDK and resolve only
|
|
107
|
-
* after its terminal callback; backend order confirmation remains the host's
|
|
108
|
-
* responsibility.
|
|
109
|
-
*/
|
|
110
|
-
async installWxRequestPayment(handler: WxRequestPaymentHandler): Promise<void> {
|
|
111
|
-
await this.registerApiHandler('wx.requestPayment', async (payload, context) => {
|
|
112
|
-
if (payload === null || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
113
|
-
throw new HostError('invalid_request', 'wx.requestPayment options are required');
|
|
114
|
-
}
|
|
115
|
-
const value = payload as Record<string, unknown>;
|
|
116
|
-
const fields = ['timeStamp', 'nonceStr', 'package', 'signType', 'paySign'] as const;
|
|
117
|
-
for (const field of fields) {
|
|
118
|
-
if (typeof value[field] !== 'string' || value[field].trim().length === 0) {
|
|
119
|
-
throw new HostError('invalid_request', `wx.requestPayment requires non-empty ${field}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (!['MD5', 'HMAC-SHA256', 'RSA'].includes(value.signType as string)) {
|
|
123
|
-
throw new HostError('invalid_request', 'wx.requestPayment signType must be MD5, HMAC-SHA256, or RSA');
|
|
124
|
-
}
|
|
125
|
-
await handler({
|
|
126
|
-
timeStamp: value.timeStamp as string,
|
|
127
|
-
nonceStr: value.nonceStr as string,
|
|
128
|
-
package: value.package as string,
|
|
129
|
-
signType: value.signType as WxRequestPaymentOptions['signType'],
|
|
130
|
-
paySign: value.paySign as string,
|
|
131
|
-
}, context);
|
|
132
|
-
return {errMsg: 'requestPayment:ok'};
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
93
|
/** Await custom resources before a new account owner can start. */
|
|
136
94
|
registerAccountCleanupHandler(handler:AccountCleanupHandler):()=>void {
|
|
137
95
|
if(this.closed || this.closeRequested) throw new Error('Container is closing or closed');
|