@deltabreen/help-nativescript

中文文档
0.1.1发布于 2026/11/01MITTypeScriptES Module零依赖

Help by DeltaBreen for NativeScript: a helpdesk in your app. The support form and a user's own tickets on a screen of your app, with logged-in users, a key per phone, and the form's events handed back. Plain, Angular, Vue, Svelte and React.

原始使用文档
文档目录5 节
  1. On your website's page
  2. Logged-in users
  3. Your app has no website
  4. Events
  5. Your own web view

Help by DeltaBreen for NativeScript

A helpdesk in your app: the support form and a user's own tickets, with your team's replies, on a screen of your NativeScript app, in plain NativeScript, Angular, Vue, Svelte or React. It shows Help's own form in a web view, so your app gets our fixes without a release of yours, and hands its events back to your code.

npm install @deltabreen/help-nativescript

On Android it adds androidx.webkit to your app, which keeps who the user is and the form's events to your own page's origin.

On your website's page

Make a page on your website that holds only the form and the user's own tickets, at an address like https://acme.com/app-support (your site's Install tab has it, with your key, when the site is a Mobile app). Then show it with HelpView:

<!-- Plain NativeScript: support-page.xml -->
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:help="@deltabreen/help-nativescript">
  <help:HelpView src="https://acme.com/app-support" token="{{ token }}" sent="{{ onSent }}" />
</Page>

In a framework, register the view once, then use it as any other:

// Angular, in main.ts; the component that shows it lists NO_ERRORS_SCHEMA in its schemas
import { registerElement } from '@nativescript/angular'
import { HelpView } from '@deltabreen/help-nativescript'
registerElement('HelpView', () => HelpView)
// <HelpView src="https://acme.com/app-support" [token]="token" (sent)="onSent($event)"></HelpView>

// Vue, in app.js
import { registerElement } from 'nativescript-vue'
import { HelpView } from '@deltabreen/help-nativescript'
registerElement('HelpView', () => HelpView)
// <HelpView src="https://acme.com/app-support" :token="token" @sent="onSent" />

// Svelte Native, in app.ts
import { registerNativeViewElement } from 'svelte-native/dom'
import { HelpView } from '@deltabreen/help-nativescript'
registerNativeViewElement('helpView', () => HelpView)
// <helpView src="https://acme.com/app-support" token={token} on:sent={onSent} />

// React NativeScript
import { registerElement } from 'react-nativescript'
import { HelpView } from '@deltabreen/help-nativescript'
registerElement('helpView', () => HelpView)
// <helpView src="https://acme.com/app-support" token={token} onSent={onSent} />

Give it the height it should fill, as any view: a row of a GridLayout with *, or the whole page. Your website's verified domain is what lets your live key work, as it does on the website itself. Links to your site stay in the app; anything else, like a file in one of your team's replies, opens in the phone's browser. The form's button for adding a file opens the phone's own picker.

On an iPhone that picker offers Take Photo, and iOS closes an app that opens the camera without saying why. Add this to App_Resources/iOS/Info.plist, with the words iOS should show when it asks:

<key>NSCameraUsageDescription</key>
<string>To send a photo to support.</string>

Logged-in users

A user who is logged in to your app writes in without typing their email, and sees their own tickets and your replies. Your server signs a short token that says who they are, with your site's secret (the guide has the code). Ask your server for one each time the screen opens and set it as token; it is handed to the page before its scripts run, and to no other site. Without one, the form treats them as a guest.

Your app has no website

Leave src out and give your site's key: the view carries the page itself. In the portal, choose My app has no website for the site. Your live key then works for people logged in to your app, and, if you switch it on, for anyone with your app, by a key made for the phone the first time support opens:

import { deviceKey } from '@deltabreen/help-nativescript'

export const help = { siteKey: 'pk_live_…', deviceKey: deviceKey() }
// <help:HelpView siteKey="{{ help.siteKey }}" deviceKey="{{ help.deviceKey }}" />

deviceKey() makes the key once and keeps it in the app's settings. To keep it in the Keychain or the Keystore instead, hand it new SecureStorage() from @nativescript/secure-storage. Give a logged-in user's token instead where you have one: we recommend signing your users in through your own server where you can, since a key inside an app can be taken out of it, and only logged-in users can't be made up.

With no website, show picks the form, the tickets or both (the default), and lang, accent, labels, subject and fields are the elements' own, as in the embed's guide. A deviceKey of null waits: the page loads once it is set.

pageCss is your own CSS for that page, after ours: its background and type, and the form through its custom properties and parts. Put a screen of tickets elsewhere with a second view, show="tickets":

<help:HelpView siteKey="pk_live_…" show="form" pageCss="body { background: #0f1115; color: #e8e8e8 } db-help-form { --dbh-accent: #7c5cff; --dbh-radius: 14px }" />
<help:HelpView siteKey="pk_live_…" show="tickets" pageCss="db-help-tickets::part(ticket-preview) { opacity: .6 }" />

Events

Each event's detail says what happened:

EventWhen
sentA message was sent: { number }
errorIt could not be: { code }
repliedThey replied to a ticket: { number }
closedThey marked a ticket solved: { number }
ratedThey rated one: { number, stars }
unreadHow many of your team's replies they haven't read: { unread }
viewThe ticket they opened, or null for the list: { ticket }
helpView.on('unread', ({ detail }) => (badge.text = String(detail.unread)))

To tell people of a reply while the screen is closed, a webhook (Pro and higher) can send your app's own notification.

Your own web view

helpPage({ siteKey, … }, { token, deviceKey }) is the page an app with no website shows, and helpScript({ token, deviceKey }) what runs before a website's page's scripts. The page's events arrive as JSON with deltahelp naming each, posted to window.webkit.messageHandlers.deltahelp on an iPhone or to window.DeltaHelpBridge on Android.

版本与发布记录

@deltabreen/help-nativescript 共发布 3 个版本,首次发布于 2026/11/01;过去 12 个月发布了 3 个版本。

版本发布日期距今
0.1.1latest2026/11/012 天前
0.1.02026/11/012 天前
0.0.0-stage2026/11/012 天前

关于 @deltabreen/help-nativescript 的常见问题

@deltabreen/help-nativescript 是什么?

DeltaBreen为NativeScript提供的帮助:应用程序中的帮助台。应用程序屏幕上的支持表单和用户自己的票证,登录用户,每部手机的钥匙,以及表单的事件。Plain, Angular, Vue, Svelte和React。

如何安装 @deltabreen/help-nativescript?

在项目目录运行 npm install @deltabreen/help-nativescript,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@nativescript/core(>=8.6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@deltabreen/help-nativescript 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@deltabreen/help-nativescript 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@deltabreen/help-nativescript 可以商用吗?

@deltabreen/help-nativescript 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@deltabreen/help-nativescript 还在维护吗?

最新版本 0.1.1 发布于 2026/11/01(2 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/11/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。