├── .npmignore ├── example ├── .browserslistrc ├── public │ └── favicon.ico ├── src │ ├── assets │ │ ├── copy.png │ │ ├── logo.png │ │ └── workplus.png │ ├── shims-vue.d.ts │ ├── typings │ │ └── common.ts │ ├── api │ │ ├── event.ts │ │ ├── listener.ts │ │ ├── location.ts │ │ ├── network.ts │ │ ├── record.ts │ │ ├── auth.ts │ │ ├── email.ts │ │ ├── pay.ts │ │ ├── video.ts │ │ └── notification.ts │ ├── uitls │ │ └── tools.ts │ ├── store │ │ └── index.ts │ ├── shims-tsx.d.ts │ └── main.ts ├── .editorconfig ├── babel.config.js ├── .gitignore ├── README.md ├── .eslintrc.js └── tsconfig.json ├── .babelrc ├── example-pc ├── .browserslistrc ├── public │ └── favicon.ico ├── src │ ├── assets │ │ ├── copy.png │ │ ├── logo.png │ │ └── workplus.png │ ├── shims-vue.d.ts │ ├── typings │ │ └── common.ts │ ├── uitls │ │ └── tools.ts │ ├── store │ │ └── index.ts │ ├── api │ │ ├── auth.ts │ │ ├── device.ts │ │ ├── contact.ts │ │ ├── user.ts │ │ ├── image.ts │ │ └── index.ts │ ├── shims-tsx.d.ts │ └── main.ts ├── .editorconfig ├── babel.config.js ├── .gitignore ├── README.md └── .eslintrc.js ├── .DS_Store ├── .npmrc ├── modules ├── .DS_Store ├── types │ ├── email.ts │ ├── eventlistener.ts │ ├── network.ts │ ├── storage.ts │ ├── location.ts │ ├── import-cordova.ts │ ├── app.ts │ ├── config.ts │ ├── data.ts │ ├── auth.ts │ └── record.ts ├── location │ ├── index.ts │ └── getLocation.ts ├── email │ ├── index.ts │ └── openEmail.ts ├── storage │ ├── index.ts │ ├── putData.ts │ └── getData.ts ├── tsconfig.commonjs.json ├── record │ ├── index.ts │ └── voiceRecord.ts ├── video │ ├── index.ts │ └── playVideo.ts ├── eventlog │ ├── index.ts │ ├── getTodayUseDuration.ts │ └── getEventLogs.ts ├── auth │ ├── index.ts │ ├── getTenantID.ts │ ├── getServerInfo.ts │ ├── getUserTicket.ts │ └── biometric.ts ├── network │ ├── index.ts │ └── getWifiInfo.ts ├── config │ ├── index.ts │ └── ready.ts ├── app │ ├── searchInApp.ts │ ├── index.ts │ ├── showAppListById.ts │ └── showAppChatViewById.ts ├── pay │ ├── index.ts │ └── wxPay.ts ├── header │ ├── clearLeftButton.ts │ ├── clearRightButtons.ts │ ├── setTitle.ts │ ├── navigation.ts │ ├── hideSearchBar.ts │ ├── leftButton.ts │ ├── visibleLeftButton.ts │ ├── rightButtons.ts │ └── changeLeftButton.ts ├── webview │ ├── exit.ts │ ├── removeWaterMask.ts │ ├── unregisterShakeListener.ts │ ├── registerShakeListener.ts │ ├── addWaterMask.ts │ ├── changeOrientation.ts │ └── wxShare.ts ├── util │ ├── copyText.ts │ ├── tel.ts │ ├── index.ts │ ├── scanner.ts │ └── vibrate.ts ├── eventlistener │ ├── index.ts │ └── messageChannel.ts ├── image │ ├── cleanCompressImage.ts │ ├── showImages.ts │ └── actionForLongPressImage.ts ├── device │ ├── index.ts │ ├── getIpAddress.ts │ ├── getAppInfo.ts │ ├── getDeviceInfo.ts │ └── getPedometerData.ts ├── core │ └── mock-services.ts ├── file │ ├── readFile.ts │ ├── openFileDetail.ts │ ├── index.ts │ ├── isFileExist.ts │ └── getUserFilePath.ts ├── import-cordova │ ├── config.ts │ └── index.ts ├── dialog │ ├── index.ts │ ├── toast.ts │ ├── modal.ts │ ├── loading.ts │ ├── inputView.ts │ └── popNotification.ts ├── user │ └── index.ts ├── session │ ├── index.ts │ ├── createDiscussionChat.ts │ └── openDiscussionById.ts ├── contact │ ├── index.ts │ └── getMobileContacts.ts └── tsconfig.json ├── design ├── pics │ ├── j-1.jpg │ ├── j-2.jpeg │ ├── j-3.jpeg │ ├── j-4.png │ ├── j-5.jpg │ └── j-6.png ├── sdk-logo.png ├── app-logo@3x.png ├── sdk-logo.sketch ├── sdk-logo@2x.png └── sdk-logo@3x.png ├── dist ├── types │ ├── app.js │ ├── auth.js │ ├── data.js │ ├── file.js │ ├── pay.js │ ├── util.js │ ├── config.js │ ├── contact.js │ ├── device.js │ ├── dialog.js │ ├── email.js │ ├── eventlog.js │ ├── image.js │ ├── location.js │ ├── network.js │ ├── record.js │ ├── storage.js │ ├── video.js │ ├── webview.js │ ├── import-cordova.js │ ├── email.d.ts │ ├── eventlistener.js │ ├── eventlistener.d.ts │ ├── network.d.ts │ ├── storage.d.ts │ ├── import-cordova.d.ts │ ├── app.d.ts │ ├── core.js │ ├── location.d.ts │ ├── config.d.ts │ ├── data.d.ts │ ├── cordova-plugin-file.js │ ├── auth.d.ts │ ├── record.d.ts │ └── video.d.ts ├── core │ ├── mock-services.d.ts │ ├── logger.d.ts │ └── mock-services.js ├── location │ ├── index.d.ts │ ├── index.js │ ├── getLocation.d.ts │ └── getLocation.js ├── app │ ├── searchInApp.d.ts │ ├── showAppListById.d.ts │ ├── showAppChatViewById.d.ts │ ├── index.d.ts │ ├── searchInApp.js │ ├── route.d.ts │ ├── showAppListById.js │ ├── index.js │ └── showAppChatViewById.js ├── storage │ ├── index.d.ts │ ├── putData.d.ts │ ├── getData.d.ts │ └── index.js ├── email │ ├── index.d.ts │ ├── index.js │ ├── openEmail.d.ts │ ├── writeEmail.d.ts │ └── openEmail.js ├── import-cordova │ ├── config.d.ts │ ├── index.d.ts │ ├── config.js │ ├── cordovaImportInstance.d.ts │ ├── index.js │ └── utils.d.ts ├── auth │ ├── index.d.ts │ ├── index.js │ ├── getTenantID.d.ts │ ├── getUserTicket.d.ts │ ├── getServerInfo.d.ts │ ├── biometric.d.ts │ ├── getTenantID.js │ ├── getUserTicket.js │ ├── getServerInfo.js │ └── biometric.js ├── header │ ├── clearLeftButton.d.ts │ ├── clearRightButtons.d.ts │ ├── setTitle.d.ts │ ├── hideSearchBar.d.ts │ ├── navigation.d.ts │ ├── leftButton.d.ts │ ├── visibleLeftButton.d.ts │ ├── changeLeftButton.d.ts │ ├── rightButtons.d.ts │ ├── clearLeftButton.js │ ├── showSearchBar.d.ts │ ├── clearRightButtons.js │ ├── setTitle.js │ ├── navigation.js │ ├── rightButtons.js │ ├── leftButton.js │ ├── hideSearchBar.js │ ├── changeLeftButton.js │ └── visibleLeftButton.js ├── eventlistener │ ├── pause.d.ts │ ├── resume.d.ts │ ├── messageChannel.d.ts │ ├── backButton.d.ts │ ├── index.d.ts │ ├── bind.d.ts │ ├── messageChannel.js │ └── bind.js ├── network │ ├── index.d.ts │ ├── getWifiInfo.d.ts │ ├── getWifiInfo.js │ ├── assembleAuthUrl.js │ └── index.js ├── util │ ├── copyText.d.ts │ ├── scanner.d.ts │ ├── tel.js │ ├── tel.d.ts │ ├── vibrate.d.ts │ ├── copyText.js │ ├── voiceToText.d.ts │ ├── generateQrcode.d.ts │ ├── generateBarcode.d.ts │ ├── vibrate.js │ ├── scanner.js │ ├── generateQrcode.js │ ├── generateBarcode.js │ └── voiceToText.js ├── webview │ ├── exit.d.ts │ ├── removeWaterMask.d.ts │ ├── share.d.ts │ ├── unregisterShakeListener.d.ts │ ├── registerShakeListener.d.ts │ ├── wxShare.d.ts │ ├── openWebView.d.ts │ ├── addWaterMask.d.ts │ ├── changeOrientation.d.ts │ ├── exit.js │ ├── removeWaterMask.js │ ├── addWaterMask.js │ ├── openLocalURL.d.ts │ ├── unregisterShakeListener.js │ ├── registerShakeListener.js │ ├── changeOrientation.js │ ├── launchMiniProgram.d.ts │ └── wxShare.js ├── image │ ├── cleanCompressImage.d.ts │ ├── showImages.d.ts │ ├── actionForLongPressImage.d.ts │ ├── saveImages.d.ts │ ├── cleanCompressImage.js │ ├── showImages.js │ ├── actionForLongPressImage.js │ ├── takePicture.d.ts │ └── chooseImages.d.ts ├── config │ ├── index.d.ts │ ├── ready.d.ts │ ├── index.js │ ├── config.d.ts │ ├── checkApi.d.ts │ ├── ready.js │ ├── config.js │ └── checkApi.js ├── dialog │ ├── toast.d.ts │ ├── index.d.ts │ ├── modal.d.ts │ ├── inputView.d.ts │ ├── popNotification.d.ts │ ├── loading.d.ts │ ├── actionSheet.d.ts │ ├── toast.js │ ├── modal.js │ ├── popNotification.js │ ├── inputView.js │ └── actionSheet.js ├── record │ ├── index.d.ts │ ├── index.js │ ├── voiceRecord.d.ts │ ├── translateAudio.d.ts │ ├── voiceRecord.js │ └── translateAudio.js ├── video │ ├── index.d.ts │ ├── index.js │ ├── playVideo.d.ts │ ├── startVideoRecoder.d.ts │ ├── playVideo.js │ └── startVideoRecoder.js ├── pay │ ├── wxPay.d.ts │ ├── index.d.ts │ ├── index.js │ ├── chooseWxInvoice.d.ts │ ├── chooseAliInvoice.d.ts │ └── wxPay.js ├── file │ ├── readFile.d.ts │ ├── openFileDetail.d.ts │ ├── isFileExist.d.ts │ ├── getUserFilePath.d.ts │ ├── readFile.js │ ├── chooseFiles.d.ts │ ├── openFileDetail.js │ └── upload.d.ts ├── eventlog │ ├── index.d.ts │ ├── index.js │ ├── getTodayUseDuration.d.ts │ ├── getEventLogs.d.ts │ └── getTodayUseDuration.js ├── session │ ├── createDiscussionChat.d.ts │ ├── openDiscussionById.d.ts │ ├── showUserChatViewByUser.d.ts │ ├── index.d.ts │ ├── selectDiscussionMembers.d.ts │ ├── openDiscussionById.js │ └── createDiscussionChat.js ├── shared │ ├── index.d.ts │ └── platform.d.ts ├── contact │ ├── getMobileContacts.d.ts │ ├── selectContacts.d.ts │ ├── getContacts.d.ts │ ├── getSingleContact.d.ts │ ├── getEmployeesFromCurrentOrg.d.ts │ ├── index.d.ts │ └── getMobileContacts.js ├── device │ ├── getAppInfo.d.ts │ ├── getIpAddress.d.ts │ ├── getDeviceInfo.d.ts │ ├── getPedometerData.d.ts │ ├── index.d.ts │ ├── index.js │ ├── getIpAddress.js │ ├── getAppInfo.js │ ├── getDeviceInfo.js │ └── getPedometerData.js ├── user │ ├── showUserInfoByUsername.d.ts │ ├── getCurrentUserInfo.d.ts │ ├── index.d.ts │ ├── getUserInfoByUserId.d.ts │ ├── getCurrentEmployeeInfo.d.ts │ └── index.js └── package.json ├── .prettierrc.json ├── release_note ├── RELEASE_NOTE_2.0.1.md ├── RELEASE_NOTE_2.0.2.md ├── RELEASE_NOTE_2.0.0-beta.9.md ├── RELEASE_NOTE_2.0.0-beta.10.md ├── RELEASE_NOTE_2.0.4.md ├── RELEASE_NOTE_2.0.0-beta.7.md ├── RELEASE_NOTE_2.0.0-beta.8.md ├── RELEASE_NOTE_2.0.0-beta.11.md ├── RELEASE_NOTE_2.0.0-beta.6.md ├── RELEASE_NOTE_2.0.0-beta.12.md ├── RELEASE_NOTE_2.0.0.md ├── RELEASE_NOTE_2.0.0-beta.13.md └── RELEASE_NOTE_2.0.3.md ├── .prettierignore ├── .editorconfig ├── scripts ├── replaceVersion.js ├── package.json └── genReleaseNote.js ├── jest.config.js ├── .eslintrc └── .travis.yml /.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } -------------------------------------------------------------------------------- /example-pc/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/.DS_Store -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | scripts-prepend-node-path=true 2 | registry=https://registry.npmjs.org/ -------------------------------------------------------------------------------- /modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/modules/.DS_Store -------------------------------------------------------------------------------- /design/pics/j-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-1.jpg -------------------------------------------------------------------------------- /design/pics/j-2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-2.jpeg -------------------------------------------------------------------------------- /design/pics/j-3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-3.jpeg -------------------------------------------------------------------------------- /design/pics/j-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-4.png -------------------------------------------------------------------------------- /design/pics/j-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-5.jpg -------------------------------------------------------------------------------- /design/pics/j-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/pics/j-6.png -------------------------------------------------------------------------------- /design/sdk-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/sdk-logo.png -------------------------------------------------------------------------------- /design/app-logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/app-logo@3x.png -------------------------------------------------------------------------------- /design/sdk-logo.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/sdk-logo.sketch -------------------------------------------------------------------------------- /design/sdk-logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/sdk-logo@2x.png -------------------------------------------------------------------------------- /design/sdk-logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/design/sdk-logo@3x.png -------------------------------------------------------------------------------- /dist/types/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/auth.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/data.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/file.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/pay.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/util.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/contact.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/device.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/dialog.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/email.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/eventlog.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/image.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/location.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/network.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/record.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/storage.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/video.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types/webview.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example/public/favicon.ico -------------------------------------------------------------------------------- /example/src/assets/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example/src/assets/copy.png -------------------------------------------------------------------------------- /example/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example/src/assets/logo.png -------------------------------------------------------------------------------- /dist/types/import-cordova.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /example-pc/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example-pc/public/favicon.ico -------------------------------------------------------------------------------- /example-pc/src/assets/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example-pc/src/assets/copy.png -------------------------------------------------------------------------------- /example-pc/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example-pc/src/assets/logo.png -------------------------------------------------------------------------------- /example/src/assets/workplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example/src/assets/workplus.png -------------------------------------------------------------------------------- /example-pc/src/assets/workplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WorkPlusFE/js-sdk/HEAD/example-pc/src/assets/workplus.png -------------------------------------------------------------------------------- /example/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import Vue from 'vue'; 3 | 4 | export default Vue; 5 | } 6 | -------------------------------------------------------------------------------- /dist/core/mock-services.d.ts: -------------------------------------------------------------------------------- 1 | declare const services: { 2 | [key: string]: string; 3 | }; 4 | export { services }; 5 | -------------------------------------------------------------------------------- /dist/location/index.d.ts: -------------------------------------------------------------------------------- 1 | import getLocation from './getLocation'; 2 | export { 3 | /** 获取定位信息 */ 4 | getLocation, }; 5 | -------------------------------------------------------------------------------- /example-pc/src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import Vue from 'vue'; 3 | 4 | export default Vue; 5 | } 6 | -------------------------------------------------------------------------------- /modules/types/email.ts: -------------------------------------------------------------------------------- 1 | export interface WriteEmailParams { 2 | /** 发送邮箱地址, 支持多地址, 使用","分割 */ 3 | emails: string; 4 | } 5 | -------------------------------------------------------------------------------- /dist/app/searchInApp.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 打开搜索页面 3 | * @returns {void} 4 | */ 5 | export default function searchInApp(): void; 6 | -------------------------------------------------------------------------------- /dist/types/email.d.ts: -------------------------------------------------------------------------------- 1 | export interface WriteEmailParams { 2 | /** 发送邮箱地址, 支持多地址, 使用","分割 */ 3 | emails: string; 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "proseWrap": "always", 4 | "singleQuote": true, 5 | "trailingComma": "all" 6 | } 7 | -------------------------------------------------------------------------------- /dist/types/eventlistener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** Cordova 事件种类 */ 3 | Object.defineProperty(exports, "__esModule", { value: true }); 4 | -------------------------------------------------------------------------------- /example-pc/src/typings/common.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | namespace Common { 3 | export type PlainObject = { [name: string]: any } 4 | } -------------------------------------------------------------------------------- /example/src/typings/common.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | namespace Common { 3 | export type PlainObject = { [name: string]: any } 4 | } -------------------------------------------------------------------------------- /modules/location/index.ts: -------------------------------------------------------------------------------- 1 | import getLocation from './getLocation'; 2 | 3 | export { 4 | /** 获取定位信息 */ 5 | getLocation, 6 | }; 7 | -------------------------------------------------------------------------------- /modules/types/eventlistener.ts: -------------------------------------------------------------------------------- 1 | /** Cordova 事件种类 */ 2 | 3 | export type CordovaListener = 'deviceready' | 'pause' | 'resume' | 'back'; 4 | -------------------------------------------------------------------------------- /dist/storage/index.d.ts: -------------------------------------------------------------------------------- 1 | import { getData } from './getData'; 2 | import { putData } from './putData'; 3 | export { getData, putData }; 4 | -------------------------------------------------------------------------------- /dist/types/eventlistener.d.ts: -------------------------------------------------------------------------------- 1 | /** Cordova 事件种类 */ 2 | export declare type CordovaListener = 'deviceready' | 'pause' | 'resume' | 'back'; 3 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.1.md: -------------------------------------------------------------------------------- 1 | ## [2.0.1](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0...v2.0.1) (2024-02-29) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.2.md: -------------------------------------------------------------------------------- 1 | ## [2.0.2](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.1...v2.0.2) (2024-02-29) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | package.json 4 | **/*.md 5 | 6 | # build 7 | script/* 8 | 9 | # dist 10 | dist/* 11 | -------------------------------------------------------------------------------- /dist/email/index.d.ts: -------------------------------------------------------------------------------- 1 | import openEmail from './openEmail'; 2 | import writeEmail from './writeEmail'; 3 | export { openEmail, writeEmail }; 4 | -------------------------------------------------------------------------------- /modules/types/network.ts: -------------------------------------------------------------------------------- 1 | export interface WifiRes { 2 | /** wifi 接入点标识 */ 3 | bssid: string; 4 | /** wifi 名称 */ 5 | name: string; 6 | } 7 | -------------------------------------------------------------------------------- /example/src/api/event.ts: -------------------------------------------------------------------------------- 1 | // 事件监听 2 | 3 | export default { 4 | title: '* 事件监听', 5 | module: 'event', 6 | active: false, 7 | apis: [], 8 | }; 9 | -------------------------------------------------------------------------------- /modules/email/index.ts: -------------------------------------------------------------------------------- 1 | import openEmail from './openEmail'; 2 | import writeEmail from './writeEmail'; 3 | 4 | export { openEmail, writeEmail }; 5 | -------------------------------------------------------------------------------- /dist/types/network.d.ts: -------------------------------------------------------------------------------- 1 | export interface WifiRes { 2 | /** wifi 接入点标识 */ 3 | bssid: string; 4 | /** wifi 名称 */ 5 | name: string; 6 | } 7 | -------------------------------------------------------------------------------- /modules/storage/index.ts: -------------------------------------------------------------------------------- 1 | import { getData } from './getData'; 2 | import { putData } from './putData'; 3 | 4 | // iOS 未实现 5 | export { getData, putData }; 6 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.9.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.9](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.8...v2.0.0-beta.9) (2022-03-18) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = false 8 | insert_final_newline = false -------------------------------------------------------------------------------- /modules/tsconfig.commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../dist", 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.10.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.10](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.9...v2.0.0-beta.10) (2022-03-18) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /dist/import-cordova/config.d.ts: -------------------------------------------------------------------------------- 1 | import { ImportCordovaConfig } from '../types/import-cordova'; 2 | declare const config: ImportCordovaConfig; 3 | export default config; 4 | -------------------------------------------------------------------------------- /modules/record/index.ts: -------------------------------------------------------------------------------- 1 | import translateAudio from './translateAudio'; 2 | import voiceRecord from './voiceRecord'; 3 | 4 | export default { 5 | translateAudio, 6 | voiceRecord, 7 | }; 8 | -------------------------------------------------------------------------------- /modules/video/index.ts: -------------------------------------------------------------------------------- 1 | import startVideoRecoder from './startVideoRecoder'; 2 | import playVideo from './playVideo'; 3 | 4 | export default { 5 | startVideoRecoder, 6 | playVideo, 7 | }; 8 | -------------------------------------------------------------------------------- /dist/auth/index.d.ts: -------------------------------------------------------------------------------- 1 | import getUserTicket from './getUserTicket'; 2 | import biometric from './biometric'; 3 | export { 4 | /** 获取临时ticket */ 5 | getUserTicket, 6 | /** 生物认证 */ 7 | biometric, }; 8 | -------------------------------------------------------------------------------- /dist/import-cordova/index.d.ts: -------------------------------------------------------------------------------- 1 | import { ImportCordovaOptions } from '../types/import-cordova'; 2 | export default function cordovaImportInit(options?: ImportCordovaOptions, useHttp?: boolean): void; 3 | -------------------------------------------------------------------------------- /example/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | max_line_length = 100 8 | -------------------------------------------------------------------------------- /modules/eventlog/index.ts: -------------------------------------------------------------------------------- 1 | import getEventLogs from './getEventLogs'; 2 | import getTodayUseDuration from './getTodayUseDuration'; 3 | 4 | export default { 5 | getEventLogs, 6 | getTodayUseDuration, 7 | }; 8 | -------------------------------------------------------------------------------- /example-pc/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | max_line_length = 10000 8 | -------------------------------------------------------------------------------- /dist/header/clearLeftButton.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 清除左侧按钮 3 | * @description 清除左侧按钮事件和显示 4 | * @module webview 5 | * @returns 无 6 | */ 7 | declare function clearLeftButton(): void; 8 | export default clearLeftButton; 9 | -------------------------------------------------------------------------------- /modules/auth/index.ts: -------------------------------------------------------------------------------- 1 | import getUserTicket from './getUserTicket'; 2 | import biometric from './biometric'; 3 | 4 | export { 5 | /** 获取临时ticket */ 6 | getUserTicket, 7 | /** 生物认证 */ 8 | biometric, 9 | }; 10 | -------------------------------------------------------------------------------- /dist/header/clearRightButtons.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 清除右侧按钮 3 | * @description 清除右侧按钮事件和显示 4 | * @module webview 5 | * @returns 无 6 | */ 7 | declare function clearRightButtons(): void; 8 | export default clearRightButtons; 9 | -------------------------------------------------------------------------------- /dist/eventlistener/pause.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 页面离开 3 | * @description 当页面不可见时,WorkPlus 会产生回调,开发者可以监听此pause事件,并处理特定的业务逻辑 4 | * @param {Function} callback 5 | */ 6 | export declare function bindPauseEvent(callback: Function): void; 7 | -------------------------------------------------------------------------------- /modules/types/storage.ts: -------------------------------------------------------------------------------- 1 | /** Storage Type */ 2 | export type StorageType = 'localStorage' | 'sessionStorage'; 3 | 4 | export interface StorageOptions { 5 | prefix?: string; 6 | connector?: string; 7 | type: StorageType; 8 | } 9 | -------------------------------------------------------------------------------- /dist/location/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.getLocation = void 0; 4 | var getLocation_1 = require("./getLocation"); 5 | exports.getLocation = getLocation_1.default; 6 | -------------------------------------------------------------------------------- /example/src/uitls/tools.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 是否在APP内打开 3 | * @export 4 | * @returns 5 | */ 6 | // eslint-disable-next-line import/prefer-default-export 7 | export const isInWorkPlusApp = () => window.navigator.userAgent.includes('workplus'); 8 | -------------------------------------------------------------------------------- /dist/eventlistener/resume.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 页面返回 3 | * @description 当页面重新可见并可交互时,WorkPlus 会产生回调,开发者可监听此resume事件,并处理特定的业务逻辑 4 | * @param {Function} callback 5 | */ 6 | export declare function bindResumeEvent(callback: Function): void; 7 | -------------------------------------------------------------------------------- /dist/network/index.d.ts: -------------------------------------------------------------------------------- 1 | import getWifiInfo from './getWifiInfo'; 2 | import { request, authRequest } from './request'; 3 | import assembleAuthUrl from './assembleAuthUrl'; 4 | export { getWifiInfo, request, authRequest, assembleAuthUrl }; 5 | -------------------------------------------------------------------------------- /dist/util/copyText.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 复制文本 3 | * @description 复制文本 4 | * @param {string} 5 | * @module webview 6 | * @returns {void} 7 | */ 8 | declare function copyText(text: string): void; 9 | export default copyText; 10 | -------------------------------------------------------------------------------- /dist/webview/exit.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 退出webview 3 | * @description 关闭整个webview 4 | * @param {ExitOptions} [options] 5 | * @module webview 6 | * @returns 无 7 | */ 8 | declare function exit(): void; 9 | export default exit; 10 | -------------------------------------------------------------------------------- /example-pc/src/uitls/tools.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 是否在APP内打开 3 | * @export 4 | * @returns 5 | */ 6 | // eslint-disable-next-line import/prefer-default-export 7 | export const isInWorkPlusApp = () => window.navigator.userAgent.includes('workplus'); 8 | -------------------------------------------------------------------------------- /modules/network/index.ts: -------------------------------------------------------------------------------- 1 | import getWifiInfo from './getWifiInfo'; 2 | import { request, authRequest } from './request'; 3 | import assembleAuthUrl from './assembleAuthUrl'; 4 | 5 | export { getWifiInfo, request, authRequest, assembleAuthUrl }; 6 | -------------------------------------------------------------------------------- /dist/image/cleanCompressImage.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 清除压缩后的图片 3 | * @description 拍照或选择照片后都会生成压缩图片,可调用该方法进行清除 4 | * @module image 5 | * @returns 无 6 | */ 7 | declare function cleanCompressImage(): void; 8 | export default cleanCompressImage; 9 | -------------------------------------------------------------------------------- /dist/types/storage.d.ts: -------------------------------------------------------------------------------- 1 | /** Storage Type */ 2 | export declare type StorageType = 'localStorage' | 'sessionStorage'; 3 | export interface StorageOptions { 4 | prefix?: string; 5 | connector?: string; 6 | type: StorageType; 7 | } 8 | -------------------------------------------------------------------------------- /example/src/api/listener.ts: -------------------------------------------------------------------------------- 1 | /** 图片 */ 2 | 3 | export default { 4 | title: '页面事件绑定', 5 | module: 'event', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '页面事件绑定', 10 | action: 'listener', 11 | }, 12 | ], 13 | }; 14 | -------------------------------------------------------------------------------- /dist/config/index.d.ts: -------------------------------------------------------------------------------- 1 | import config from './config'; 2 | import ready from './ready'; 3 | import checkApi from './checkApi'; 4 | export { 5 | /** SDK 鉴权 */ 6 | config, 7 | /** 鉴权完成 */ 8 | ready, 9 | /** 检测方法是否存在 */ 10 | checkApi, }; 11 | -------------------------------------------------------------------------------- /dist/header/setTitle.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 更换头部title 3 | * @description 设置Webview的头部标题 4 | * @param {string} title 5 | * @module webview 6 | * @returns 无 7 | */ 8 | declare function setTitle(title: string): void; 9 | export default setTitle; 10 | -------------------------------------------------------------------------------- /dist/storage/putData.d.ts: -------------------------------------------------------------------------------- 1 | import { DataParams } from '../types/data'; 2 | /** 3 | * PutData 4 | * @description 轻应用存储轻量,非结构化的数据 5 | * @param {DataParams} 6 | * @module data 7 | */ 8 | export declare function putData(options: DataParams): void; 9 | -------------------------------------------------------------------------------- /dist/webview/removeWaterMask.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 移除水印 3 | * @description 移除水印 4 | * @param {RemoveWaterMask} [options] 5 | * @module webview 6 | * @returns 无 7 | */ 8 | declare function removeWaterMask(): void; 9 | export default removeWaterMask; 10 | -------------------------------------------------------------------------------- /modules/config/index.ts: -------------------------------------------------------------------------------- 1 | import config from './config'; 2 | import ready from './ready'; 3 | import checkApi from './checkApi'; 4 | 5 | export { 6 | /** SDK 鉴权 */ 7 | config, 8 | /** 鉴权完成 */ 9 | ready, 10 | /** 检测方法是否存在 */ 11 | checkApi, 12 | }; 13 | -------------------------------------------------------------------------------- /dist/dialog/toast.d.ts: -------------------------------------------------------------------------------- 1 | import { ToastParams } from '../types/dialog'; 2 | /** 3 | * Toast 4 | * @description 显示 Toast 小提示框,可以控制显示的标题和时长 5 | * @param {ToastParams} 6 | * @module dialog 7 | */ 8 | export declare function showToast(options: ToastParams): void; 9 | -------------------------------------------------------------------------------- /example-pc/src/store/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /example/src/store/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /dist/record/index.d.ts: -------------------------------------------------------------------------------- 1 | import translateAudio from './translateAudio'; 2 | import voiceRecord from './voiceRecord'; 3 | declare const _default: { 4 | translateAudio: typeof translateAudio; 5 | voiceRecord: typeof voiceRecord; 6 | }; 7 | export default _default; 8 | -------------------------------------------------------------------------------- /dist/video/index.d.ts: -------------------------------------------------------------------------------- 1 | import startVideoRecoder from './startVideoRecoder'; 2 | import playVideo from './playVideo'; 3 | declare const _default: { 4 | startVideoRecoder: typeof startVideoRecoder; 5 | playVideo: typeof playVideo; 6 | }; 7 | export default _default; 8 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ], 5 | plugins: [ 6 | ['import', { 7 | libraryName: 'vant', 8 | libraryDirectory: 'es', 9 | style: true, 10 | }, 'vant'], 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /dist/header/hideSearchBar.d.ts: -------------------------------------------------------------------------------- 1 | export interface HideSearchBar { 2 | visible: boolean; 3 | } 4 | /** 5 | * 隐藏搜索栏 6 | * @description 针对 "显示搜索栏" 接口,用于隐藏搜索栏。 7 | * @module webview 8 | * @version 4.10.0+ 9 | */ 10 | export default function hideSearchBar(): void; 11 | -------------------------------------------------------------------------------- /dist/pay/wxPay.d.ts: -------------------------------------------------------------------------------- 1 | import { PayOption, WxPay, WxPayRes } from '../types/pay'; 2 | /** 3 | * 微信支付 4 | * @description 提供微信支付的能力。 5 | * @param {WxPay>} options 6 | * @module wxPay 7 | */ 8 | export default function wxPay(options: WxPay & PayOption): Promise; 9 | -------------------------------------------------------------------------------- /example-pc/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ], 5 | plugins: [ 6 | ['import', { 7 | libraryName: 'vant', 8 | libraryDirectory: 'es', 9 | style: true, 10 | }, 'vant'], 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /dist/file/readFile.d.ts: -------------------------------------------------------------------------------- 1 | import { FilePathParams } from '../types/file'; 2 | /** 3 | * 本地打开文件 4 | * @description 原生打开文件(pdf, excel, word, ppt 等) 5 | * @param {FilePathParams} [options] 6 | * @returns {void} 7 | */ 8 | export default function readFile(options: FilePathParams): void; 9 | -------------------------------------------------------------------------------- /dist/util/scanner.d.ts: -------------------------------------------------------------------------------- 1 | import { UitlOptions } from '../types/util'; 2 | /** 3 | * 扫描二维码 4 | * @description 调用相机扫描二维码 5 | * @param {UitlOptions} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function scanner(options?: UitlOptions): Promise; 9 | -------------------------------------------------------------------------------- /dist/webview/share.d.ts: -------------------------------------------------------------------------------- 1 | import { Share } from '../types/webview'; 2 | /** 3 | * 分享 4 | * @description 弹出分享对话框,跳转分享 5 | * @param {Share} options 传参 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function share(options: Share): void; 10 | export default share; 11 | -------------------------------------------------------------------------------- /dist/eventlog/index.d.ts: -------------------------------------------------------------------------------- 1 | import getEventLogs from './getEventLogs'; 2 | import getTodayUseDuration from './getTodayUseDuration'; 3 | declare const _default: { 4 | getEventLogs: typeof getEventLogs; 5 | getTodayUseDuration: typeof getTodayUseDuration; 6 | }; 7 | export default _default; 8 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.4.md: -------------------------------------------------------------------------------- 1 | ## [2.0.4](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.3...v2.0.4) (2025-05-06) 2 | 3 | 4 | ### Features 5 | 6 | * 增加pc接口例子(user、auth) ([69f5762](https://github.com/WorkPlusFE/js-sdk/commit/69f5762fa757c2f1339e04b11521fb8a35c8a3ed)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dist/app/showAppListById.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowAppListById } from '../types/contact'; 2 | /** 3 | * 根据组织id打开该组织下的应用列表页面 4 | * 5 | * @export 6 | * @param {ShowAppListById} [options] 7 | * @returns {void} 8 | */ 9 | export default function showAppListById(options: ShowAppListById): void; 10 | -------------------------------------------------------------------------------- /dist/webview/unregisterShakeListener.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 注销摇一摇监听 3 | * @description 注销摇一摇监听 4 | * @param {NotResOptions} [options] 5 | * @module webview 6 | * @returns {Promise} 7 | */ 8 | declare function unregisterShakeListener(): void; 9 | export default unregisterShakeListener; 10 | -------------------------------------------------------------------------------- /dist/file/openFileDetail.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowFileParams } from '../types/file'; 2 | /** 3 | * 打开文件详情 4 | * @description 通过指定 mediaId, fileName 等参数, 打开文件详情界面 5 | * @param {ShowFileParams} [options] 6 | * @returns {void} 7 | */ 8 | export default function openFileDetail(options: ShowFileParams): void; 9 | -------------------------------------------------------------------------------- /dist/session/createDiscussionChat.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 通过调用原生选人界面,选择人员,创建群组,并且返回相关群组信息 3 | * 4 | * @export 5 | * @param {boolean} [newWindow] 仅对 PC 客户端有效 6 | * @returns {void} 7 | */ 8 | export default function createDiscussionChat({ newWindow }: { 9 | newWindow?: boolean; 10 | }): void; 11 | -------------------------------------------------------------------------------- /dist/util/tel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * 打电话 5 | * @param {Options} [options] 6 | * @returns {void} 7 | */ 8 | function tel(options) { 9 | window.location.href = "tel:" + options.number; 10 | } 11 | exports.default = tel; 12 | -------------------------------------------------------------------------------- /modules/app/searchInApp.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | 3 | import { WORKPLUS_CONTACT } from '../constants'; 4 | 5 | /** 6 | * 打开搜索页面 7 | * @returns {void} 8 | */ 9 | export default function searchInApp(): void { 10 | return core.execSync<[]>(WORKPLUS_CONTACT, 'searchInApp', []); 11 | } 12 | -------------------------------------------------------------------------------- /dist/webview/registerShakeListener.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 注册摇一摇监听 3 | * @description 前端需要实现 onWorkplusShake 方法, 摇一摇后将会触发该方法 4 | * @param {NotResOptions} [options] 5 | * @module webview 6 | * @returns 无 7 | */ 8 | declare function registerShakeListener(): void; 9 | export default registerShakeListener; 10 | -------------------------------------------------------------------------------- /dist/webview/wxShare.d.ts: -------------------------------------------------------------------------------- 1 | import { WxShare } from '../types/webview'; 2 | /** 3 | * 微信分享(会话/朋友圈) 4 | * @description 根据接口直接调起微信分享页面 5 | * @param {WxShare} options 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function wxShare(options: WxShare): void; 10 | export default wxShare; 11 | -------------------------------------------------------------------------------- /dist/app/showAppChatViewById.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowAppChatView } from '../types/contact'; 2 | /** 3 | * 通过应用id和orgId的,打开改组织下某个应用聊天界面 4 | * 5 | * @export 6 | * @param {ShowAppChatView} [options] 7 | * @returns {void} 8 | */ 9 | export default function showAppChatViewById(options: ShowAppChatView): void; 10 | -------------------------------------------------------------------------------- /dist/storage/getData.d.ts: -------------------------------------------------------------------------------- 1 | import { DataParams, GetDataRes } from '../types/data'; 2 | /** 3 | * GetData 4 | * @description 轻应用存储轻量,非结构化的数据 5 | * @param {DataParams} 6 | * @module data 7 | * @returns {GetDataRes} 8 | */ 9 | export declare function getData(options: DataParams): Promise; 10 | -------------------------------------------------------------------------------- /modules/pay/index.ts: -------------------------------------------------------------------------------- 1 | // This file is auto gererated by scripts/create-api.js 2 | import wxPay from './wxPay'; 3 | import chooseWxInvoice from './chooseWxInvoice'; 4 | import chooseAliInvoice from './chooseAliInvoice'; 5 | 6 | export default { 7 | wxPay, 8 | chooseWxInvoice, 9 | chooseAliInvoice, 10 | }; 11 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.7.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.7](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.6...v2.0.0-beta.7) (2022-02-23) 2 | 3 | 4 | ### Features 5 | 6 | * 增加network模块接口 ([c0f7220](https://github.com/WorkPlusFE/js-sdk/commit/c0f7220f50b18b0b820168bd566319e09adc1a12)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.8.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.8](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.7...v2.0.0-beta.8) (2022-03-17) 2 | 3 | 4 | ### Features 5 | 6 | * 增加OpenWebView横竖屏参数 ([995671e](https://github.com/WorkPlusFE/js-sdk/commit/995671ee7f62ac17d5b19710b20195098a5e48e6)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dist/record/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var translateAudio_1 = require("./translateAudio"); 4 | var voiceRecord_1 = require("./voiceRecord"); 5 | exports.default = { 6 | translateAudio: translateAudio_1.default, 7 | voiceRecord: voiceRecord_1.default, 8 | }; 9 | -------------------------------------------------------------------------------- /example-pc/src/api/auth.ts: -------------------------------------------------------------------------------- 1 | /** 认证 */ 2 | 3 | export default { 4 | title: '认证', 5 | module: 'auth', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '获取临时 Ticket', 10 | description: '为当前登录用户获取一个临时性的 Ticket。', 11 | action: 'getUserTicket', 12 | params: {}, 13 | }, 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.11.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.11](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.10...v2.0.0-beta.11) (2023-02-11) 2 | 3 | 4 | ### Features 5 | 6 | * **demo:** 优化物理返回事件 ([1ec9b3c](https://github.com/WorkPlusFE/js-sdk/commit/1ec9b3c734c6ca6fa605e9f6c84f965c79cbfb6b)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dist/config/ready.d.ts: -------------------------------------------------------------------------------- 1 | import { ConfigAuthRes } from '../types/config'; 2 | /** 3 | * 鉴权 ready 4 | * @description 返回当前鉴权状态, 让前端用以判断是否可以正常调用方法 5 | * @param {callback} [options] 6 | * @module config 7 | * @returns {ConfigAuthRes} 8 | */ 9 | export default function ready(callback: Function): Promise; 10 | -------------------------------------------------------------------------------- /dist/core/logger.d.ts: -------------------------------------------------------------------------------- 1 | export default class Logger { 2 | private _PREFIX; 3 | private _enabled; 4 | constructor(enabled?: boolean); 5 | disable(): void; 6 | enable(): void; 7 | log(...args: unknown[]): void; 8 | warn(...args: unknown[]): void; 9 | error(...args: unknown[]): void; 10 | } 11 | -------------------------------------------------------------------------------- /dist/email/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.writeEmail = exports.openEmail = void 0; 4 | var openEmail_1 = require("./openEmail"); 5 | exports.openEmail = openEmail_1.default; 6 | var writeEmail_1 = require("./writeEmail"); 7 | exports.writeEmail = writeEmail_1.default; 8 | -------------------------------------------------------------------------------- /dist/eventlistener/messageChannel.d.ts: -------------------------------------------------------------------------------- 1 | export interface ChanelActionResType { 2 | /** 返回的事件类型 */ 3 | action: 'pause' | 'resume' | 'back'; 4 | } 5 | /** 6 | * 页面事件监听 7 | * @description ios/android 统一 resume/pause/back 事件的监听方式 8 | */ 9 | export declare function bindMessageChannel(callback: Function): void; 10 | -------------------------------------------------------------------------------- /dist/video/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var startVideoRecoder_1 = require("./startVideoRecoder"); 4 | var playVideo_1 = require("./playVideo"); 5 | exports.default = { 6 | startVideoRecoder: startVideoRecoder_1.default, 7 | playVideo: playVideo_1.default, 8 | }; 9 | -------------------------------------------------------------------------------- /dist/webview/openWebView.d.ts: -------------------------------------------------------------------------------- 1 | import { OpenWebView } from '../types/webview'; 2 | /** 3 | * 打开一个网页 4 | * @description 传入地址,打开 WorkPlus 网页 5 | * @param {OpenWebView} options 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function openWebView(options: OpenWebView): void; 10 | export default openWebView; 11 | -------------------------------------------------------------------------------- /example-pc/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /dist/email/openEmail.d.ts: -------------------------------------------------------------------------------- 1 | import { NotResOptions } from '../types/core'; 2 | /** 3 | * 打开邮箱 4 | * @description 跳转到我的邮箱,未登陆就跳转到登陆页 5 | * @param {NotResOptions} [options] 6 | * @module email 7 | * @returns 无 8 | */ 9 | declare function openEmail(options?: NotResOptions): Promise; 10 | export default openEmail; 11 | -------------------------------------------------------------------------------- /dist/header/navigation.d.ts: -------------------------------------------------------------------------------- 1 | import { NavigationParams } from '../types/webview'; 2 | /** 3 | * 锁定网页顶部栏 4 | * @description 锁定顶部栏,使得顶部栏按钮无效 5 | * @param {NavigationParams} mode 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function navigation(mode: NavigationParams): void; 10 | export default navigation; 11 | -------------------------------------------------------------------------------- /dist/shared/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './is'; 2 | /** 3 | * 休眠函数 4 | * @param time 时间,单位毫秒 5 | */ 6 | export declare const sleep: (time: number) => Promise; 7 | /** 8 | * 加载Script 9 | * @export 10 | * @param {string} url 11 | */ 12 | export declare const loadScript: (url: string) => Promise; 13 | -------------------------------------------------------------------------------- /dist/webview/addWaterMask.d.ts: -------------------------------------------------------------------------------- 1 | import { AddWaterMaskParams } from '../types/webview'; 2 | /** 3 | * 添加水印 4 | * @description 给页面添加水印 5 | * @param {AddWaterMaskParams} options 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function addWaterMask(options: AddWaterMaskParams): void; 10 | export default addWaterMask; 11 | -------------------------------------------------------------------------------- /example/src/api/location.ts: -------------------------------------------------------------------------------- 1 | /** 地理位置 */ 2 | 3 | export default { 4 | title: '地理位置', 5 | module: 'location', 6 | active: false, 7 | icon: 'location', 8 | apis: [ 9 | { 10 | title: '获取定位信息', 11 | description: '返回手机设备当前的地理位置信息', 12 | action: 'getLocation', 13 | params: {}, 14 | }, 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.6.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.6](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.5...v2.0.0-beta.6) (2021-12-21) 2 | 3 | 4 | ### Features 5 | 6 | * **build:** update release note generator ([86a155c](https://github.com/WorkPlusFE/js-sdk/commit/86a155cdbd6178f778719c1e585467b792ec7737)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dist/auth/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.biometric = exports.getUserTicket = void 0; 4 | var getUserTicket_1 = require("./getUserTicket"); 5 | exports.getUserTicket = getUserTicket_1.default; 6 | var biometric_1 = require("./biometric"); 7 | exports.biometric = biometric_1.default; 8 | -------------------------------------------------------------------------------- /dist/contact/getMobileContacts.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption } from '../types/contact'; 2 | /** 3 | * 获取手机通讯录联系人的列表 4 | * 5 | * @export 6 | * @param {ContactOption<[], unknown>} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getMobileContacts(options?: ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /example-pc/src/api/device.ts: -------------------------------------------------------------------------------- 1 | /** 设备 */ 2 | 3 | export default { 4 | title: '设备', 5 | module: 'device', 6 | active: false, 7 | icon: 'device', 8 | apis: [ 9 | { 10 | title: '获取设备信息', 11 | description: '获取当前设备和 WorkPlus 的一些信息。', 12 | action: 'getDeviceInfo', 13 | params: {}, 14 | }, 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /dist/eventlistener/backButton.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 绑定安卓物理返回按钮事件 3 | * @description 该方法只需要执行一次,一旦绑定,返回按钮的原始事件将失效,然后返回逻辑都需要在回调方法中处理 4 | * @param {Function} callback 5 | */ 6 | export declare function bindBackButtonEvent(callback: Function): void; 7 | /** 8 | * 解除安卓物理返回按钮事件 9 | */ 10 | export declare function unbindBackButtonEvent(): void; 11 | -------------------------------------------------------------------------------- /dist/eventlog/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var getEventLogs_1 = require("./getEventLogs"); 4 | var getTodayUseDuration_1 = require("./getTodayUseDuration"); 5 | exports.default = { 6 | getEventLogs: getEventLogs_1.default, 7 | getTodayUseDuration: getTodayUseDuration_1.default, 8 | }; 9 | -------------------------------------------------------------------------------- /modules/types/location.ts: -------------------------------------------------------------------------------- 1 | export interface LocationRes { 2 | /** 经度 */ 3 | longitude: number; 4 | /** 纬度 */ 5 | latitude: number; 6 | /** 具体地址信息 */ 7 | address: string; 8 | /** 城市 */ 9 | city: string; 10 | /** 区 */ 11 | district: string; 12 | /** 街道 */ 13 | street: string; 14 | /** 地址名字 */ 15 | aoiName: string; 16 | } 17 | -------------------------------------------------------------------------------- /dist/device/getAppInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { DeviceOptions, AppInfoRes } from '../types/device'; 2 | /** 3 | * 获取设备信息 4 | * @description 获取当前设备和 APP 的一些信息 5 | * @param {DeviceOptions<[], AppInfoRes>} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function getDeviceInfo(options?: DeviceOptions<[], AppInfoRes>): Promise; 9 | -------------------------------------------------------------------------------- /dist/image/showImages.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowImagesItem } from '../types/image'; 2 | /** 3 | * 图片预览 4 | * @description 传输图片地址,预览图片,支持传入 position 表示从第几张开始预览 5 | * @param {ShowImagesItem} options 6 | * @module image 7 | * @version 3.1.3版本以上 8 | */ 9 | declare function showImages(options: ShowImagesItem): void; 10 | export default showImages; 11 | -------------------------------------------------------------------------------- /modules/types/import-cordova.ts: -------------------------------------------------------------------------------- 1 | export interface ImportCordovaConfig { 2 | cordovajs: { 3 | [key in Platform]: string; 4 | }; 5 | useHttp: boolean; 6 | pcSDKUri: string; 7 | } 8 | 9 | export type Platform = 'iOS' | 'android' | 'local'; 10 | 11 | export interface ImportCordovaOptions { 12 | iOS?: string; 13 | android?: string; 14 | } 15 | -------------------------------------------------------------------------------- /example/src/api/network.ts: -------------------------------------------------------------------------------- 1 | /** 网络连接信息 */ 2 | 3 | export default { 4 | title: '网络连接信息', 5 | module: 'network', 6 | active: false, 7 | icon: 'info', 8 | apis: [ 9 | { 10 | title: '获取当前连接Wifi信息', 11 | description: '获取当前连接Wifi信息, 包括 bssid, 名字等', 12 | action: 'getWifiInfo', 13 | params: {}, 14 | }, 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /scripts/replaceVersion.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const replace = require('replace-x').default; 3 | 4 | const version = process.argv[2] || process.env.VERSION; 5 | const dist = path.resolve(__dirname, '../dist/'); 6 | 7 | replace({ 8 | paths: [dist], 9 | recursive: true, 10 | regex: '__VERSION__', 11 | replacement: `${version}`, 12 | }); 13 | -------------------------------------------------------------------------------- /dist/device/getIpAddress.d.ts: -------------------------------------------------------------------------------- 1 | import { DeviceOptions, IpAddressRes } from '../types/device'; 2 | /** 3 | * 获取IP地址 4 | * @description 获取当前连接状态下的IP地址 5 | * @param {DeviceOptions<[], IpAddressRes>} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function getIpAddress(options?: DeviceOptions<[], IpAddressRes>): Promise; 9 | -------------------------------------------------------------------------------- /dist/pay/index.d.ts: -------------------------------------------------------------------------------- 1 | import wxPay from './wxPay'; 2 | import chooseWxInvoice from './chooseWxInvoice'; 3 | import chooseAliInvoice from './chooseAliInvoice'; 4 | declare const _default: { 5 | wxPay: typeof wxPay; 6 | chooseWxInvoice: typeof chooseWxInvoice; 7 | chooseAliInvoice: typeof chooseAliInvoice; 8 | }; 9 | export default _default; 10 | -------------------------------------------------------------------------------- /dist/session/openDiscussionById.d.ts: -------------------------------------------------------------------------------- 1 | import { OpenDiscussionByIdParams } from '../types/contact'; 2 | /** 3 | * 通过群组id打开该群组的聊天页面,并且可以自定义发送应用所支持的消息 4 | * 5 | * @export 6 | * @param {OpenDiscussionByIdParams} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function openDiscussionById(options: OpenDiscussionByIdParams): void; 10 | -------------------------------------------------------------------------------- /example-pc/src/api/contact.ts: -------------------------------------------------------------------------------- 1 | /** 邮箱 */ 2 | 3 | export default { 4 | title: '联系人', 5 | module: 'contact', 6 | active: false, 7 | icon: 'envelop-o', 8 | apis: [ 9 | { 10 | title: '单选联系人', 11 | description: '打开当前组织的联系人列表,单选一个联系人。', 12 | action: 'getSingleContact', 13 | params: { 14 | }, 15 | }, 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /modules/types/app.ts: -------------------------------------------------------------------------------- 1 | export interface AppRouteParams { 2 | /** url scheme, 用于启动应用 */ 3 | schemeUrl: string; 4 | } 5 | 6 | export interface AppRouteOriginParams { 7 | /** url scheme, 用于启动应用 */ 8 | scheme_url: string; 9 | } 10 | 11 | export interface AppRouteRes { 12 | /** 状态码 */ 13 | code: number; 14 | /** 状态描述 */ 15 | message: string; 16 | } 17 | -------------------------------------------------------------------------------- /dist/eventlistener/index.d.ts: -------------------------------------------------------------------------------- 1 | import { bindBackButtonEvent, unbindBackButtonEvent } from './backbutton'; 2 | import { bindPauseEvent } from './pause'; 3 | import { bindResumeEvent } from './resume'; 4 | import { bindMessageChannel } from './messageChannel'; 5 | export { bindBackButtonEvent, bindPauseEvent, bindResumeEvent, unbindBackButtonEvent, bindMessageChannel, }; 6 | -------------------------------------------------------------------------------- /dist/device/getDeviceInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { DeviceOptions, DeviceInfoRes } from '../types/device'; 2 | /** 3 | * 获取设备信息 4 | * @description 获取当前设备和 APP 的一些信息 5 | * @param {DeviceOptions<[], DeviceInfoRes>} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function getDeviceInfo(options?: DeviceOptions<[], DeviceInfoRes>): Promise; 9 | -------------------------------------------------------------------------------- /dist/image/actionForLongPressImage.d.ts: -------------------------------------------------------------------------------- 1 | import { ImageDataItem } from '../types/image'; 2 | /** 3 | * 长按图片弹出框 4 | * @description 弹出框包括"识别二维码", "保存图片"等选项 5 | * @param {ImageDataItem} options 6 | * @module image 7 | * @returns 无 8 | */ 9 | declare function actionForLongPressImage(options: ImageDataItem): void; 10 | export default actionForLongPressImage; 11 | -------------------------------------------------------------------------------- /dist/util/tel.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | export interface TelParams { 3 | number: string | number; 4 | } 5 | export declare type TelOptions = TelParams & ExecOptions; 6 | /** 7 | * 打电话 8 | * @param {Options} [options] 9 | * @returns {void} 10 | */ 11 | export default function tel(options: TelOptions): void; 12 | -------------------------------------------------------------------------------- /dist/types/import-cordova.d.ts: -------------------------------------------------------------------------------- 1 | export interface ImportCordovaConfig { 2 | cordovajs: { 3 | [key in Platform]: string; 4 | }; 5 | useHttp: boolean; 6 | pcSDKUri: string; 7 | } 8 | export declare type Platform = 'iOS' | 'android' | 'local'; 9 | export interface ImportCordovaOptions { 10 | iOS?: string; 11 | android?: string; 12 | } 13 | -------------------------------------------------------------------------------- /example-pc/src/api/user.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 用户 */ 3 | 4 | export default { 5 | title: '用户', 6 | module: 'user', 7 | active: false, 8 | apis: [ 9 | { 10 | title: '获取登录用户详情', 11 | description: '获取当前登录用户详细信息,包括某个组织下的雇员信息。', 12 | action: 'getCurrentUserInfo', 13 | params: { 14 | needEmpInfo: true, 15 | }, 16 | }, 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /dist/eventlog/getTodayUseDuration.d.ts: -------------------------------------------------------------------------------- 1 | import { EventlogOptions, TodayUseDurationRes } from '../types/eventlog'; 2 | /** 3 | * 获取当前登陆用户今天在线时长 4 | * @param {EventlogOptions} [options] 5 | * @returns {Promise} 6 | */ 7 | export default function getTodayUseDuration(options?: EventlogOptions): Promise; 8 | -------------------------------------------------------------------------------- /dist/types/app.d.ts: -------------------------------------------------------------------------------- 1 | export interface AppRouteParams { 2 | /** url scheme, 用于启动应用 */ 3 | schemeUrl: string; 4 | } 5 | export interface AppRouteOriginParams { 6 | /** url scheme, 用于启动应用 */ 7 | scheme_url: string; 8 | } 9 | export interface AppRouteRes { 10 | /** 状态码 */ 11 | code: number; 12 | /** 状态描述 */ 13 | message: string; 14 | } 15 | -------------------------------------------------------------------------------- /example/src/shims-tsx.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue'; 2 | 3 | declare global { 4 | namespace JSX { 5 | // tslint:disable no-empty-interface 6 | interface Element extends VNode {} 7 | // tslint:disable no-empty-interface 8 | interface ElementClass extends Vue {} 9 | interface IntrinsicElements { 10 | [elem: string]: any 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dist/types/core.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // 0 success 通用调用成功 4 | // -1 wrong 通用调用失败 5 | // -2 cancel 取消操作 6 | // -3 no auth 没有鉴权就直接使用 7 | // -10 invalid arguments 传入参数异常 8 | // -20 no system permissions 通用没有系统权限等, 如拍照, 地理位置, 9 | // -999 service not found 找不到该cordova service定义 10 | // -1000 action not found 找不到该cordova 方法 11 | -------------------------------------------------------------------------------- /example-pc/src/shims-tsx.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue'; 2 | 3 | declare global { 4 | namespace JSX { 5 | // tslint:disable no-empty-interface 6 | interface Element extends VNode {} 7 | // tslint:disable no-empty-interface 8 | interface ElementClass extends Vue {} 9 | interface IntrinsicElements { 10 | [elem: string]: any 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dist/app/index.d.ts: -------------------------------------------------------------------------------- 1 | import route from './route'; 2 | import searchInApp from './searchInApp'; 3 | import showAppChatViewById from './showAppChatViewById'; 4 | import showAppListById from './showAppListById'; 5 | export { 6 | /** 路由跳转 */ 7 | route, 8 | /** 打开搜索页面 */ 9 | searchInApp, 10 | /** 打开应用聊天界面 */ 11 | showAppChatViewById, 12 | /** 打开App列表页面 */ 13 | showAppListById, }; 14 | -------------------------------------------------------------------------------- /dist/app/searchInApp.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 打开搜索页面 7 | * @returns {void} 8 | */ 9 | function searchInApp() { 10 | return core.execSync(constants_1.WORKPLUS_CONTACT, 'searchInApp', []); 11 | } 12 | exports.default = searchInApp; 13 | -------------------------------------------------------------------------------- /dist/header/leftButton.d.ts: -------------------------------------------------------------------------------- 1 | export interface LeftButtonOptions { 2 | /** 执行的JS全局函数名 */ 3 | method: string; 4 | } 5 | /** 6 | * 更换左侧按钮动作 7 | * @description 传入一个全局的函数名,点击左侧按钮时时执行 8 | * @param {LeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | declare function leftButton(options: LeftButtonOptions): void; 13 | export default leftButton; 14 | -------------------------------------------------------------------------------- /dist/header/visibleLeftButton.d.ts: -------------------------------------------------------------------------------- 1 | import { VisibleLeftButtonParams } from '../types/webview'; 2 | /** 3 | * 是否隐藏或显示左侧的按钮和关闭字样 4 | * @description 是否隐藏或显示左侧的按钮和关闭字样 5 | * @param {VisibleLeftButtonOptions} options 6 | * @module webview 7 | * @returns 无 8 | */ 9 | declare function visibleLeftButton(options: VisibleLeftButtonParams): void; 10 | export default visibleLeftButton; 11 | -------------------------------------------------------------------------------- /dist/types/location.d.ts: -------------------------------------------------------------------------------- 1 | export interface LocationRes { 2 | /** 经度 */ 3 | longitude: number; 4 | /** 纬度 */ 5 | latitude: number; 6 | /** 具体地址信息 */ 7 | address: string; 8 | /** 城市 */ 9 | city: string; 10 | /** 区 */ 11 | district: string; 12 | /** 街道 */ 13 | street: string; 14 | /** 地址名字 */ 15 | aoiName: string; 16 | } 17 | -------------------------------------------------------------------------------- /modules/header/clearLeftButton.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 清除左侧按钮 6 | * @description 清除左侧按钮事件和显示 7 | * @module webview 8 | * @returns 无 9 | */ 10 | function clearLeftButton(): void { 11 | return core.execSync<[]>(WORKPLUS_WEBVIEW, 'clearLeftButton', []); 12 | } 13 | 14 | export default clearLeftButton; 15 | -------------------------------------------------------------------------------- /modules/webview/exit.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 退出webview 6 | * @description 关闭整个webview 7 | * @param {ExitOptions} [options] 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function exit(): void { 12 | return core.execSync(WORKPLUS_WEBVIEW, 'exit', []); 13 | } 14 | 15 | export default exit; 16 | -------------------------------------------------------------------------------- /modules/header/clearRightButtons.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 清除右侧按钮 6 | * @description 清除右侧按钮事件和显示 7 | * @module webview 8 | * @returns 无 9 | */ 10 | function clearRightButtons(): void { 11 | return core.execSync<[]>(WORKPLUS_WEBVIEW, 'clearRightButtons', []); 12 | } 13 | 14 | export default clearRightButtons; 15 | -------------------------------------------------------------------------------- /modules/util/copyText.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 复制文本 6 | * @description 复制文本 7 | * @param {string} 8 | * @module webview 9 | * @returns {void} 10 | */ 11 | function copyText(text: string): void { 12 | return core.execSync(WORKPLUS_WEBVIEW, 'copyText', [{ text }]); 13 | } 14 | 15 | export default copyText; 16 | -------------------------------------------------------------------------------- /dist/util/vibrate.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { VibrateRes } from '../types/util'; 3 | export declare type Options = ExecOptions; 4 | /** 5 | * 震动 6 | * @param {} [options] 7 | * @module util 8 | * @returns {Promise} 9 | */ 10 | declare function vibrate(options?: Options): Promise; 11 | export default vibrate; 12 | -------------------------------------------------------------------------------- /modules/app/index.ts: -------------------------------------------------------------------------------- 1 | import route from './route'; 2 | import searchInApp from './searchInApp'; 3 | import showAppChatViewById from './showAppChatViewById'; 4 | import showAppListById from './showAppListById'; 5 | 6 | export { 7 | /** 路由跳转 */ 8 | route, 9 | /** 打开搜索页面 */ 10 | searchInApp, 11 | /** 打开应用聊天界面 */ 12 | showAppChatViewById, 13 | /** 打开App列表页面 */ 14 | showAppListById, 15 | }; 16 | -------------------------------------------------------------------------------- /dist/config/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkApi = exports.ready = exports.config = void 0; 4 | var config_1 = require("./config"); 5 | exports.config = config_1.default; 6 | var ready_1 = require("./ready"); 7 | exports.ready = ready_1.default; 8 | var checkApi_1 = require("./checkApi"); 9 | exports.checkApi = checkApi_1.default; 10 | -------------------------------------------------------------------------------- /dist/contact/selectContacts.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, SelectContactsParams } from '../types/contact'; 2 | /** 3 | * 打开通用选择人员界面, 多选用户或者雇员 4 | * 5 | * @export 6 | * @param {SelectContactsParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function selectContacts(options?: SelectContactsParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/device/getPedometerData.d.ts: -------------------------------------------------------------------------------- 1 | import { DeviceOptions, PedometerDataRes } from '../types/device'; 2 | /** 3 | * 获取设备的运动数据 4 | * @description 获取设备当天凌晨0点至当前时间的运动数据 (从版本3.12.1起提供) 5 | * @param {DeviceOptions<[], PedometerDataRes>} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function getPedometerData(options?: DeviceOptions<[], PedometerDataRes>): Promise; 9 | -------------------------------------------------------------------------------- /modules/eventlistener/index.ts: -------------------------------------------------------------------------------- 1 | import { bindBackButtonEvent, unbindBackButtonEvent } from './backbutton'; 2 | import { bindPauseEvent } from './pause'; 3 | import { bindResumeEvent } from './resume'; 4 | import { bindMessageChannel } from './messageChannel'; 5 | 6 | export { 7 | bindBackButtonEvent, 8 | bindPauseEvent, 9 | bindResumeEvent, 10 | unbindBackButtonEvent, 11 | bindMessageChannel, 12 | }; 13 | -------------------------------------------------------------------------------- /modules/header/setTitle.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 更换头部title 6 | * @description 设置Webview的头部标题 7 | * @param {string} title 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function setTitle(title: string): void { 12 | return core.execSync(WORKPLUS_WEBVIEW, 'title', [title]); 13 | } 14 | 15 | export default setTitle; 16 | -------------------------------------------------------------------------------- /modules/image/cleanCompressImage.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_IMAGE } from '../constants'; 3 | 4 | /** 5 | * 清除压缩后的图片 6 | * @description 拍照或选择照片后都会生成压缩图片,可调用该方法进行清除 7 | * @module image 8 | * @returns 无 9 | */ 10 | function cleanCompressImage(): void { 11 | return core.execSync(WORKPLUS_IMAGE, 'cleanCompressImage', []); 12 | } 13 | 14 | export default cleanCompressImage; 15 | -------------------------------------------------------------------------------- /modules/util/tel.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | export interface TelParams { 3 | number: string | number; 4 | } 5 | export type TelOptions = TelParams & ExecOptions; 6 | 7 | /** 8 | * 打电话 9 | * @param {Options} [options] 10 | * @returns {void} 11 | */ 12 | export default function tel(options: TelOptions) { 13 | window.location.href = `tel:${options.number}`; 14 | } 15 | -------------------------------------------------------------------------------- /dist/record/voiceRecord.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { VoiceRecordRes } from '../types/record'; 3 | export declare type Options = ExecOptions; 4 | /** 5 | * @description 语音录制 6 | * @param {Options} options 7 | * @module record 8 | * @returns {voiceRecordRes} 9 | */ 10 | export default function voiceRecord(options: Options): Promise; 11 | -------------------------------------------------------------------------------- /modules/storage/putData.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DATA } from '../constants'; 3 | import { DataParams } from '../types/data'; 4 | 5 | /** 6 | * PutData 7 | * @description 轻应用存储轻量,非结构化的数据 8 | * @param {DataParams} 9 | * @module data 10 | */ 11 | export function putData(options: DataParams): void { 12 | return core.execSync(WORKPLUS_DATA, 'putData', [{ ...options }]); 13 | } 14 | -------------------------------------------------------------------------------- /dist/eventlog/getEventLogs.d.ts: -------------------------------------------------------------------------------- 1 | import { EventlogOptions, EventLogsParams, EventLogsRes } from '../types/eventlog'; 2 | /** 3 | * 获取事件日志数据 4 | * @description 根据传参条件, 返回对应的事件日志数据 5 | * @param {EventLogsParams & EventlogOptions} [options] 6 | * @returns {Promise} 7 | */ 8 | export default function getEventLogs(options: EventLogsParams & EventlogOptions): Promise; 9 | -------------------------------------------------------------------------------- /dist/webview/changeOrientation.d.ts: -------------------------------------------------------------------------------- 1 | import { ChangeOrientationParams } from '../types/webview'; 2 | /** 3 | * 控制屏幕旋转 4 | * @description 根据参数控制屏幕横屏显示或者竖屏显示 5 | * @param {ChangeOrientationParams} options 6 | * @module webview 7 | * @version 3.1.3+ 8 | * @returns {Promise} 9 | */ 10 | declare function changeOrientation(options: ChangeOrientationParams): void; 11 | export default changeOrientation; 12 | -------------------------------------------------------------------------------- /modules/device/index.ts: -------------------------------------------------------------------------------- 1 | import getDeviceInfo from './getDeviceInfo'; 2 | import getIpAddress from './getIpAddress'; 3 | import getPedometerData from './getPedometerData'; 4 | import getAppInfo from './getAppInfo'; 5 | 6 | export default { 7 | /** 获取设备信息 */ 8 | getDeviceInfo, 9 | /** 获取 IP 地址 */ 10 | getIpAddress, 11 | /** 获取运动数据 */ 12 | getPedometerData, 13 | /** 获取 App 信息 */ 14 | getAppInfo, 15 | }; 16 | -------------------------------------------------------------------------------- /dist/dialog/index.d.ts: -------------------------------------------------------------------------------- 1 | import { showLoading, hideLoading } from './loading'; 2 | import { showToast } from './toast'; 3 | import { showActionSheet } from './actionSheet'; 4 | import { showModal } from './modal'; 5 | import { showInputView } from './inputView'; 6 | import { popNotification } from './popNotification'; 7 | export { showLoading, hideLoading, showToast, showActionSheet, showModal, showInputView, popNotification, }; 8 | -------------------------------------------------------------------------------- /modules/webview/removeWaterMask.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 移除水印 6 | * @description 移除水印 7 | * @param {RemoveWaterMask} [options] 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function removeWaterMask(): void { 12 | return core.execSync<[]>(WORKPLUS_WEBVIEW, 'removeWaterMask', []); 13 | } 14 | 15 | export default removeWaterMask; 16 | -------------------------------------------------------------------------------- /dist/dialog/modal.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { ModalParams, ModalRes } from '../types/dialog'; 3 | export declare type Options = ModalParams & ExecOptions; 4 | /** 5 | * Modal 6 | * @description 弹出确认框,可以只定义标题和按钮 7 | * @param {Options} 8 | * @module dialog 9 | * @returns {ModalRes} 10 | */ 11 | export declare function showModal(options: Options): Promise; 12 | -------------------------------------------------------------------------------- /modules/types/config.ts: -------------------------------------------------------------------------------- 1 | export interface ConfigAuthParams { 2 | /** 申请下来的access_key */ 3 | access_key: string; 4 | /** 六位随机数 */ 5 | nonce: string; 6 | /** 时间戳 */ 7 | timestamp: string | number; 8 | /** 签名, 具体签名算法请参考文档 */ 9 | signature: string; 10 | /** debug 模式,仅在调试包可用,正式包无效 */ 11 | debug?: boolean; 12 | } 13 | 14 | export interface ConfigAuthRes { 15 | code: 0 | -1 | -2; 16 | message?: string; 17 | } 18 | -------------------------------------------------------------------------------- /dist/file/isFileExist.d.ts: -------------------------------------------------------------------------------- 1 | import { FileOptions, FilePathParams, FileExistRes } from '../types/file'; 2 | export declare type FileExistOptions = FilePathParams & FileOptions; 3 | /** 4 | * 判断文件是否存在 5 | * @description 判断指定路径的文件是否存在 6 | * @param {FileExistOptions} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function isFileExist(options: FileExistOptions): Promise; 10 | -------------------------------------------------------------------------------- /dist/video/playVideo.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { PlayVideoRes, PlayVideoParams } from '../types/video'; 3 | export declare type Options = PlayVideoParams & ExecOptions; 4 | /** 5 | * @description 视频录制 6 | * @param {Options} options 7 | * @module video 8 | * @returns {PlayVideoRes} 9 | */ 10 | export default function playVideo(options: Options): Promise; 11 | -------------------------------------------------------------------------------- /example-pc/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | yarn lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | yarn lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /dist/contact/getContacts.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, ContactsParams, ContactsRes } from '../types/contact'; 2 | export declare type ContactsOptions = ContactsParams & ContactOption; 3 | /** 4 | * 打开当前组织的联系人列表,选择多个联系人 5 | * 6 | * @export 7 | * @param {ContactsOptions} [options] 8 | * @returns {Promise} 9 | */ 10 | export default function getContacts(options?: ContactsOptions): Promise; 11 | -------------------------------------------------------------------------------- /dist/user/showUserInfoByUsername.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, ShowUserInfoByUsernameParams } from '../types/contact'; 2 | /** 3 | * 通过用户username展示这个用户的详情页面 4 | * 5 | * @export 6 | * @param {ShowUserInfoByUsernameParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function showUserInfoByUsername(options: ShowUserInfoByUsernameParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /modules/types/data.ts: -------------------------------------------------------------------------------- 1 | export interface DataParams { 2 | /** app的Id */ 3 | app_id: string; 4 | /** 具体自定义的存储数据的key值 */ 5 | key: string; 6 | /** 具体自定义的存储数据的value值 */ 7 | value?: string; 8 | /** 拓展 */ 9 | [key: string]: unknown; 10 | } 11 | 12 | export interface GetDataRes { 13 | /** app的Id */ 14 | app_id: string; 15 | /** 具体自定义的存储数据的key值 */ 16 | key: string; 17 | /** 具体自定义的存储数据的value值 */ 18 | value: string; 19 | } 20 | -------------------------------------------------------------------------------- /dist/contact/getSingleContact.d.ts: -------------------------------------------------------------------------------- 1 | import { SingleContactRes, ContactOption, SingleContactParams } from '../types/contact'; 2 | /** 3 | * 单选联系人 4 | * 5 | * @export 6 | * @param {SingleContactParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getSingleContact(options?: SingleContactParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/dialog/inputView.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { ModalParams, ModalRes } from '../types/dialog'; 3 | export declare type Options = ModalParams & ExecOptions; 4 | /** 5 | * inputView 6 | * @description 弹出带输入框的确认弹窗,可以传入默认值 7 | * @param {Options} 8 | * @module dialog 9 | * @returns {ModalRes} 10 | */ 11 | export declare function showInputView(options: Options): Promise; 12 | -------------------------------------------------------------------------------- /dist/file/getUserFilePath.d.ts: -------------------------------------------------------------------------------- 1 | import { FileOptions, GetUserFilePathParams } from '../types/file'; 2 | export declare type FileExistOptions = GetUserFilePathParams & FileOptions; 3 | /** 4 | * 获取文件目录路径 5 | * @description 获取设备的文件存在目录,包括下载文件夹及网盘(如果有)及用户自定义目录。 6 | * @param {FileExistOptions} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function isFileExist(options: FileExistOptions): Promise; 10 | -------------------------------------------------------------------------------- /dist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@w6s/sdk", 3 | "version": "2.0.4", 4 | "description": "WorkPlusFE JavaScript SDK.", 5 | "main": "index.js", 6 | "typings": "index.d.ts", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "keywords": [ 11 | "WorkPlusFE", 12 | "w6s", 13 | "sdk" 14 | ], 15 | "author": "WorkPlusFE", 16 | "license": "MIT", 17 | "engines": { 18 | "node": ">= 10.16.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dist/header/changeLeftButton.d.ts: -------------------------------------------------------------------------------- 1 | import { ButtonsItem } from '../types/webview'; 2 | export interface ChangeLeftButtonOptions { 3 | items: ButtonsItem[]; 4 | } 5 | /** 6 | * 更换左侧按钮和定义动作 7 | * @description 设置左侧按钮的选项 8 | * @param {ChangeLeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | declare function changeLeftButton(options: ChangeLeftButtonOptions): void; 13 | export default changeLeftButton; 14 | -------------------------------------------------------------------------------- /dist/header/rightButtons.d.ts: -------------------------------------------------------------------------------- 1 | import { ButtonsItem } from '../types/webview'; 2 | export interface RightButtonsOptions { 3 | /** 右侧按钮列表 */ 4 | items: ButtonsItem[][]; 5 | } 6 | /** 7 | * 更换右侧按钮动作 8 | * @description 设置右侧按钮的选项 9 | * @param {RightButtonsOptions} options 10 | * @module webview 11 | * @returns 无 12 | */ 13 | declare function rightButtons(options: RightButtonsOptions): void; 14 | export default rightButtons; 15 | -------------------------------------------------------------------------------- /dist/auth/getTenantID.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { GetTenantIDRes } from '../types/auth'; 3 | export declare type TenantIdOptions = ExecOptions; 4 | /** 5 | * 获取当前租户id,即域id 6 | * @description 获取当前租户id,即域id 7 | * @param {TenantIdOptions} [options] 8 | * @module auth 9 | * @returns 域ID 10 | */ 11 | export default function getTenantID(options?: TenantIdOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/location/getLocation.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { LocationRes } from '../types/location'; 3 | export declare type LocationOptions = ExecOptions; 4 | /** 5 | * 获取定位信息 6 | * @description 返回手机设备当前的地理位置信息 7 | * @param {LocationOptions} [options] 8 | * @module location 9 | * @returns 定位信息 10 | */ 11 | export default function getLocation(options?: LocationOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/storage/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.putData = exports.getData = void 0; 4 | var getData_1 = require("./getData"); 5 | Object.defineProperty(exports, "getData", { enumerable: true, get: function () { return getData_1.getData; } }); 6 | var putData_1 = require("./putData"); 7 | Object.defineProperty(exports, "putData", { enumerable: true, get: function () { return putData_1.putData; } }); 8 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@w6s/sdk", 3 | "version": "__VERSION__", 4 | "description": "WorkPlusFE JavaScript SDK.", 5 | "main": "index.js", 6 | "typings": "index.d.ts", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "keywords": [ 11 | "WorkPlusFE", 12 | "w6s", 13 | "sdk" 14 | ], 15 | "author": "WorkPlusFE", 16 | "license": "MIT", 17 | "engines": { 18 | "node": ">= 10.16.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dist/app/route.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { AppRouteParams, AppRouteRes } from '../types/app'; 3 | export declare type AppRouteOptions = AppRouteParams & ExecOptions; 4 | /** 5 | * 路由跳转 6 | * @description 根据参数跳转到指定的 App。 7 | * @param {AppRouteParams} [options] 8 | * @module app 9 | * @version 3.18.0 10 | */ 11 | export default function route(options: AppRouteOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/header/clearLeftButton.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 清除左侧按钮 7 | * @description 清除左侧按钮事件和显示 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function clearLeftButton() { 12 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'clearLeftButton', []); 13 | } 14 | exports.default = clearLeftButton; 15 | -------------------------------------------------------------------------------- /dist/types/config.d.ts: -------------------------------------------------------------------------------- 1 | export interface ConfigAuthParams { 2 | /** 申请下来的access_key */ 3 | access_key: string; 4 | /** 六位随机数 */ 5 | nonce: string; 6 | /** 时间戳 */ 7 | timestamp: string | number; 8 | /** 签名, 具体签名算法请参考文档 */ 9 | signature: string; 10 | /** debug 模式,仅在调试包可用,正式包无效 */ 11 | debug?: boolean; 12 | } 13 | export interface ConfigAuthRes { 14 | code: 0 | -1 | -2; 15 | message?: string; 16 | } 17 | -------------------------------------------------------------------------------- /dist/webview/exit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 退出webview 7 | * @description 关闭整个webview 8 | * @param {ExitOptions} [options] 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function exit() { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'exit', []); 14 | } 15 | exports.default = exit; 16 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'jsdom', 4 | moduleNameMapper: { 5 | '@modules/(.*)': '/modules/$1', 6 | }, 7 | coveragePathIgnorePatterns: ['/node_modules/', '/test/'], 8 | coverageThreshold: { 9 | global: { 10 | branches: 90, 11 | functions: 95, 12 | lines: 95, 13 | statements: 95, 14 | }, 15 | }, 16 | collectCoverageFrom: ['src/*.{js,ts}'], 17 | }; 18 | -------------------------------------------------------------------------------- /dist/header/showSearchBar.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowSearch, ShowSearchRes } from '../types/webview'; 2 | import { ExecOptions } from '../types/core'; 3 | /** 4 | * 显示搜索栏 5 | * @description 让原生头部变成一个搜索框。 6 | * @param {ShowSearch} [options] 7 | * @module webview 8 | * @version 4.10.0+ 9 | * @returns {Promise} 10 | */ 11 | export default function showSearchBar(options?: ShowSearch & ExecOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/session/showUserChatViewByUser.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, ShowUserChatViewByUserParams } from '../types/contact'; 2 | /** 3 | * 轻应用输入userId,domianId, 跳转到workplus与该用户的聊天页面 4 | * 5 | * @export 6 | * @param {ShowUserChatViewByUserParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function showUserChatViewByUser(options: ShowUserChatViewByUserParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/user/getCurrentUserInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, CurrentUserInfoParams, CurrentUserInfoRes } from '../types/contact'; 2 | /** 3 | * 获取当前登录用户详细信息 4 | * 5 | * @export 6 | * @param {CurrentUserInfoParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getCurrentUserInfo(options?: CurrentUserInfoParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /modules/storage/getData.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DATA } from '../constants'; 3 | import { DataParams, GetDataRes } from '../types/data'; 4 | 5 | /** 6 | * GetData 7 | * @description 轻应用存储轻量,非结构化的数据 8 | * @param {DataParams} 9 | * @module data 10 | * @returns {GetDataRes} 11 | */ 12 | export function getData(options: DataParams): Promise { 13 | return core.exec(WORKPLUS_DATA, 'getData', [{ ...options }]); 14 | } 15 | -------------------------------------------------------------------------------- /dist/header/clearRightButtons.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 清除右侧按钮 7 | * @description 清除右侧按钮事件和显示 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function clearRightButtons() { 12 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'clearRightButtons', []); 13 | } 14 | exports.default = clearRightButtons; 15 | -------------------------------------------------------------------------------- /dist/import-cordova/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var config = { 4 | // 不同平台的 CordovaJs 5 | cordovajs: { 6 | // 必须是完整的路径,默认使用local模式 7 | local: 'applocal://www/cordova.min.js', 8 | iOS: '', 9 | android: '', 10 | }, 11 | // 是否使用 http 模式,若为 true,将强制使用 http 模式 12 | useHttp: false, 13 | // =.=! 14 | pcSDKUri: '', 15 | }; 16 | exports.default = config; 17 | -------------------------------------------------------------------------------- /dist/util/copyText.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 复制文本 7 | * @description 复制文本 8 | * @param {string} 9 | * @module webview 10 | * @returns {void} 11 | */ 12 | function copyText(text) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'copyText', [{ text: text }]); 14 | } 15 | exports.default = copyText; 16 | -------------------------------------------------------------------------------- /example/src/api/record.ts: -------------------------------------------------------------------------------- 1 | // 音频 2 | export default { 3 | title: '音频', 4 | module: 'record', 5 | active: false, 6 | apis: [ 7 | { 8 | title: '语音录制', 9 | description: '语音录制', 10 | action: 'voiceRecord', 11 | params: {}, 12 | }, 13 | { 14 | title: '音频转mp3格式', 15 | description: '音频转mp3格式', 16 | action: 'translateAudio', 17 | params: { 18 | file_path: '', 19 | }, 20 | }, 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /modules/core/mock-services.ts: -------------------------------------------------------------------------------- 1 | import * as SERVICES_KEYS from '../constants'; 2 | 3 | const services: { [key: string]: string } = {}; 4 | 5 | const serviceKeys = SERVICES_KEYS as { [key: string]: string }; 6 | 7 | Object.keys(serviceKeys).map(key => { 8 | if (key.includes('WORKPLUS_')) { 9 | const serviceName = key.replace('WORKPLUS_', '').toLocaleLowerCase(); 10 | services[serviceKeys[key]] = serviceName; 11 | } 12 | }); 13 | 14 | export { services }; 15 | -------------------------------------------------------------------------------- /modules/file/readFile.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_FILE } from '../constants'; 3 | import { FilePathParams } from '../types/file'; 4 | 5 | /** 6 | * 本地打开文件 7 | * @description 原生打开文件(pdf, excel, word, ppt 等) 8 | * @param {FilePathParams} [options] 9 | * @returns {void} 10 | */ 11 | export default function readFile(options: FilePathParams): void { 12 | return core.execSync(WORKPLUS_FILE, 'readFile', [options]); 13 | } 14 | -------------------------------------------------------------------------------- /modules/import-cordova/config.ts: -------------------------------------------------------------------------------- 1 | import { ImportCordovaConfig } from '../types/import-cordova'; 2 | 3 | const config: ImportCordovaConfig = { 4 | // 不同平台的 CordovaJs 5 | cordovajs: { 6 | // 必须是完整的路径,默认使用local模式 7 | local: 'applocal://www/cordova.min.js', 8 | iOS: '', 9 | android: '', 10 | }, 11 | 12 | // 是否使用 http 模式,若为 true,将强制使用 http 模式 13 | useHttp: false, 14 | 15 | // =.=! 16 | pcSDKUri: '', 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.12.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.12](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.11...v2.0.0-beta.12) (2023-02-13) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * 注入cordova移除env判断 ([9239fef](https://github.com/WorkPlusFE/js-sdk/commit/9239fefde2458f9fc33f9184549e255fa026adb4)) 7 | 8 | 9 | ### Features 10 | 11 | * 增加页面通用事件绑定接口 ([92aff05](https://github.com/WorkPlusFE/js-sdk/commit/92aff0577ec0667129347271a1c176e7dd00671c)) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "project": "./**/*/tsconfig.json" 5 | }, 6 | "plugins": ["@typescript-eslint"], 7 | "extends": ["plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"], 8 | "rules": { 9 | "@typescript-eslint/camelcase": "off", 10 | "@typescript-eslint/explicit-function-return-type": "off", 11 | "@typescript-eslint/no-empty-function": "off" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dist/email/writeEmail.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { WriteEmailParams } from '../types/email'; 3 | export declare type WriteEmailOptions = WriteEmailParams & ExecOptions; 4 | /** 5 | * 写邮件 6 | * @description 跳转到写邮件的页面 7 | * @param {WriteEmailOptions} [options] 8 | * @module email 9 | * @returns 无 10 | */ 11 | declare function writeEmail(options: WriteEmailOptions): Promise; 12 | export default writeEmail; 13 | -------------------------------------------------------------------------------- /dist/header/setTitle.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 更换头部title 7 | * @description 设置Webview的头部标题 8 | * @param {string} title 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function setTitle(title) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'title', [title]); 14 | } 15 | exports.default = setTitle; 16 | -------------------------------------------------------------------------------- /dist/image/saveImages.d.ts: -------------------------------------------------------------------------------- 1 | import { SaveImageItem } from '../types/image'; 2 | import { ExecOptions } from '../types/core'; 3 | export declare type SaveImagesOptions = SaveImageItem & ExecOptions; 4 | /** 5 | * 保存图片 6 | * @description 传输图片地址,保存图片 7 | * @param {SaveImagesOptions} options 8 | * @module image 9 | * @returns 无 10 | */ 11 | declare function saveImages(options: SaveImagesOptions): Promise; 12 | export default saveImages; 13 | -------------------------------------------------------------------------------- /modules/webview/unregisterShakeListener.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 注销摇一摇监听 6 | * @description 注销摇一摇监听 7 | * @param {NotResOptions} [options] 8 | * @module webview 9 | * @returns {Promise} 10 | */ 11 | function unregisterShakeListener(): void { 12 | return core.execSync<[]>(WORKPLUS_WEBVIEW, 'unregisterShakeListener', []); 13 | } 14 | 15 | export default unregisterShakeListener; 16 | -------------------------------------------------------------------------------- /dist/auth/getUserTicket.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { GetUserTicketRes } from '../types/auth'; 3 | export declare type UserTicketOptions = ExecOptions; 4 | /** 5 | * 获取临时ticket 6 | * @description 为当前登录用户获取一个临时性的ticket 7 | * @param {UserTicketOptions} [options] 8 | * @module auth 9 | * @returns ticket 10 | */ 11 | export default function getUserTicket(options?: UserTicketOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/dialog/popNotification.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { PopNotificationParams, PopNotificationRes } from '../types/dialog'; 3 | export declare type Options = PopNotificationParams & ExecOptions; 4 | /** 5 | * @description 消息通知 6 | * @param {Options} 7 | * @module dialog 8 | * @returns {PopNotificationRes} 9 | */ 10 | export declare function popNotification(options: Options): Promise; 11 | -------------------------------------------------------------------------------- /dist/types/data.d.ts: -------------------------------------------------------------------------------- 1 | export interface DataParams { 2 | /** app的Id */ 3 | app_id: string; 4 | /** 具体自定义的存储数据的key值 */ 5 | key: string; 6 | /** 具体自定义的存储数据的value值 */ 7 | value?: string; 8 | /** 拓展 */ 9 | [key: string]: unknown; 10 | } 11 | export interface GetDataRes { 12 | /** app的Id */ 13 | app_id: string; 14 | /** 具体自定义的存储数据的key值 */ 15 | key: string; 16 | /** 具体自定义的存储数据的value值 */ 17 | value: string; 18 | } 19 | -------------------------------------------------------------------------------- /dist/auth/getServerInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { GetServerInfoRes } from '../types/auth'; 3 | export declare type ServerInfoOptions = ExecOptions; 4 | /** 5 | * 获取当前app请求后台api地址 6 | * @description 获取当前app请求后台api地址 7 | * @param {ServerInfoOptions} [options] 8 | * @module auth 9 | * @returns api_url 10 | */ 11 | export default function getServerInfo(options?: ServerInfoOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/dialog/loading.d.ts: -------------------------------------------------------------------------------- 1 | export interface LoadingParams { 2 | /** loading的描述文字,非必需 */ 3 | title?: string; 4 | /** 锁住屏幕,默认为 false */ 5 | block?: boolean; 6 | } 7 | /** 8 | * Loading 9 | * @description 显示 loading 提示框,可以添加文本 10 | * @param LoadingParams 11 | * @module dialog 12 | * @returns 无 13 | */ 14 | declare function showLoading(options?: LoadingParams): void; 15 | declare function hideLoading(): void; 16 | export { showLoading, hideLoading }; 17 | -------------------------------------------------------------------------------- /dist/file/readFile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 本地打开文件 7 | * @description 原生打开文件(pdf, excel, word, ppt 等) 8 | * @param {FilePathParams} [options] 9 | * @returns {void} 10 | */ 11 | function readFile(options) { 12 | return core.execSync(constants_1.WORKPLUS_FILE, 'readFile', [options]); 13 | } 14 | exports.default = readFile; 15 | -------------------------------------------------------------------------------- /dist/image/cleanCompressImage.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 清除压缩后的图片 7 | * @description 拍照或选择照片后都会生成压缩图片,可调用该方法进行清除 8 | * @module image 9 | * @returns 无 10 | */ 11 | function cleanCompressImage() { 12 | return core.execSync(constants_1.WORKPLUS_IMAGE, 'cleanCompressImage', []); 13 | } 14 | exports.default = cleanCompressImage; 15 | -------------------------------------------------------------------------------- /dist/pay/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // This file is auto gererated by scripts/create-api.js 4 | var wxPay_1 = require("./wxPay"); 5 | var chooseWxInvoice_1 = require("./chooseWxInvoice"); 6 | var chooseAliInvoice_1 = require("./chooseAliInvoice"); 7 | exports.default = { 8 | wxPay: wxPay_1.default, 9 | chooseWxInvoice: chooseWxInvoice_1.default, 10 | chooseAliInvoice: chooseAliInvoice_1.default, 11 | }; 12 | -------------------------------------------------------------------------------- /dist/record/translateAudio.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { TranslateAudiodRes, TranslateAudiodParams } from '../types/record'; 3 | export declare type Options = TranslateAudiodParams & ExecOptions; 4 | /** 5 | * @description 音频转mp3格式 6 | * @param {Options} options 7 | * @module record 8 | * @returns {voiceRecordRes} 9 | */ 10 | export default function translateAudio(options: Options): Promise; 11 | -------------------------------------------------------------------------------- /modules/dialog/index.ts: -------------------------------------------------------------------------------- 1 | import { showLoading, hideLoading } from './loading'; 2 | import { showToast } from './toast'; 3 | import { showActionSheet } from './actionSheet'; 4 | import { showModal } from './modal'; 5 | import { showInputView } from './inputView'; 6 | import { popNotification } from './popNotification'; 7 | 8 | export { 9 | showLoading, 10 | hideLoading, 11 | showToast, 12 | showActionSheet, 13 | showModal, 14 | showInputView, 15 | popNotification, 16 | }; 17 | -------------------------------------------------------------------------------- /modules/file/openFileDetail.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_FILE } from '../constants'; 3 | import { ShowFileParams } from '../types/file'; 4 | 5 | /** 6 | * 打开文件详情 7 | * @description 通过指定 mediaId, fileName 等参数, 打开文件详情界面 8 | * @param {ShowFileParams} [options] 9 | * @returns {void} 10 | */ 11 | export default function openFileDetail(options: ShowFileParams): void { 12 | return core.execSync(WORKPLUS_FILE, 'showFile', [options]); 13 | } 14 | -------------------------------------------------------------------------------- /modules/webview/registerShakeListener.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | /** 5 | * 注册摇一摇监听 6 | * @description 前端需要实现 onWorkplusShake 方法, 摇一摇后将会触发该方法 7 | * @param {NotResOptions} [options] 8 | * @module webview 9 | * @returns 无 10 | */ 11 | function registerShakeListener(): void { 12 | return core.execSync<[]>(WORKPLUS_WEBVIEW, 'registerShakeListener', []); 13 | } 14 | 15 | export default registerShakeListener; 16 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0.md: -------------------------------------------------------------------------------- 1 | # [2.0.0](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.13...v2.0.0) (2024-02-29) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * 拍照水印接口处理time_enable、location_enable参数 ([c1ad8cf](https://github.com/WorkPlusFE/js-sdk/commit/c1ad8cfffbb1ad80b5909f925d76e9e5ebdeb349)) 7 | 8 | 9 | ### Performance Improvements 10 | 11 | * sdk兼容Vue3 版本 ([858ca4a](https://github.com/WorkPlusFE/js-sdk/commit/858ca4a6669577aecd222a459f094c28bf00037c)) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dist/header/navigation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 锁定网页顶部栏 7 | * @description 锁定顶部栏,使得顶部栏按钮无效 8 | * @param {NavigationParams} mode 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function navigation(mode) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'navigation', [mode]); 14 | } 15 | exports.default = navigation; 16 | -------------------------------------------------------------------------------- /dist/network/getWifiInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { WifiRes } from '../types/network'; 3 | export declare type GetWifiOptions = ExecOptions; 4 | /** 5 | * 获取当前连接Wifi信息 6 | * @description 获取当前连接Wifi信息, 包括 bssid, 名字等 7 | * @param {GetWifiOptions>} [options] 8 | * @module network 9 | * @returns 当前连接的Wifi信息 10 | */ 11 | declare function getWifiInfo(options?: GetWifiOptions): Promise; 12 | export default getWifiInfo; 13 | -------------------------------------------------------------------------------- /dist/user/index.d.ts: -------------------------------------------------------------------------------- 1 | import getCurrentUserInfo from './getCurrentUserInfo'; 2 | import getCurrentEmployeeInfo from './getCurrentEmployeeInfo'; 3 | import getUserInfoByUserId from './getUserInfoByUserId'; 4 | import showUserInfoByUsername from './showUserInfoByUsername'; 5 | export { 6 | /** 获取登录用户详情 */ 7 | getCurrentUserInfo, 8 | /** 获取用户的雇员信息 */ 9 | getCurrentEmployeeInfo, 10 | /** 获取用户信息 */ 11 | getUserInfoByUserId, 12 | /** 打开用户详情页面 */ 13 | showUserInfoByUsername, }; 14 | -------------------------------------------------------------------------------- /example/src/api/auth.ts: -------------------------------------------------------------------------------- 1 | /** 认证 */ 2 | 3 | export default { 4 | title: '认证', 5 | module: 'auth', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '获取临时 Ticket', 10 | description: '为当前登录用户获取一个临时性的 Ticket。', 11 | action: 'getUserTicket', 12 | params: {}, 13 | }, 14 | { 15 | title: '生物认证', 16 | description: '需要设备具备指纹或者FACE_ID解锁功能,解锁后触发回调,适用于对安全性要求较高的操作。', 17 | action: 'biometric', 18 | params: {}, 19 | }, 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | cache: 3 | directories: 4 | - $HOME/.yarn-cache 5 | language: node_js 6 | node_js: stable 7 | os: 8 | - osx 9 | branches: 10 | only: 11 | - master # build master branch only 12 | install: 13 | - yarn 14 | script: 15 | - yarn lint 16 | - yarn build 17 | notifications: 18 | slack: 19 | if: branch = master 20 | email: 21 | recipients: 22 | - hejianxian@foreverht.com 23 | on_success: change 24 | on_failure: always 25 | 26 | -------------------------------------------------------------------------------- /dist/session/index.d.ts: -------------------------------------------------------------------------------- 1 | import openDiscussionById from './openDiscussionById'; 2 | import createDiscussionChat from './createDiscussionChat'; 3 | import selectDiscussionMembers from './selectDiscussionMembers'; 4 | import showUserChatViewByUser from './showUserChatViewByUser'; 5 | export { 6 | /** 打开用户聊天页面 */ 7 | showUserChatViewByUser, 8 | /** 打开群组聊天页面 */ 9 | openDiscussionById, 10 | /** 创建群组 */ 11 | createDiscussionChat, 12 | /** 打开群组选人界面 */ 13 | selectDiscussionMembers, }; 14 | -------------------------------------------------------------------------------- /dist/types/cordova-plugin-file.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // Type definitions for Apache Cordova FileTransfer plugin 3 | // Project: https://github.com/apache/cordova-plugin-file-transfer 4 | // Definitions by: Microsoft Open Technologies Inc. 5 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 6 | // 7 | // Copyright (c) Microsoft Open Technologies Inc 8 | // Licensed under the MIT license 9 | Object.defineProperty(exports, "__esModule", { value: true }); 10 | -------------------------------------------------------------------------------- /dist/video/startVideoRecoder.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { StartVideoRecoderRes, StartVideoRecoderParams } from '../types/video'; 3 | export declare type Options = StartVideoRecoderParams & ExecOptions; 4 | /** 5 | * @description 视频录制 6 | * @param {Options} options 7 | * @module video 8 | * @returns {voiceRecordRes} 9 | */ 10 | export default function startVideoRecoder(options: Options): Promise; 11 | -------------------------------------------------------------------------------- /dist/webview/removeWaterMask.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 移除水印 7 | * @description 移除水印 8 | * @param {RemoveWaterMask} [options] 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function removeWaterMask() { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'removeWaterMask', []); 14 | } 15 | exports.default = removeWaterMask; 16 | -------------------------------------------------------------------------------- /dist/auth/biometric.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { BiometricRes } from '../types/auth'; 3 | export declare type BiometricOptions = ExecOptions; 4 | /** 5 | * 生物认证 6 | * @description 需要设备具备指纹或者FACE_ID解锁功能,解锁后触发回调,适用于对安全性要求较高的操作。 7 | * @param {BiometricOptions} [options] 8 | * @module auth 9 | * @version 3.15.0 10 | * @returns code 11 | */ 12 | export default function biometric(options?: BiometricOptions): Promise; 13 | -------------------------------------------------------------------------------- /dist/config/config.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { ConfigAuthParams, ConfigAuthRes } from '../types/config'; 3 | export declare type ConfigOptions = ConfigAuthParams & ExecOptions; 4 | /** 5 | * SDK 鉴权 6 | * @description 所有接口都需要先经过鉴权才能够使用 7 | * @param {ConfigOptions} [options] 8 | * @module config 9 | * @returns {ConfigAuthRes} 10 | */ 11 | export default function config(options: ConfigOptions): Promise; 12 | -------------------------------------------------------------------------------- /dist/dialog/actionSheet.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { ActionSheetParams, ActionSheetRes } from '../types/dialog'; 3 | export declare type Options = ActionSheetParams & ExecOptions; 4 | /** 5 | * ActionSheet 6 | * @description 弹出 ActionSheet,可以自定义每个item的名字 7 | * @param {Options} 8 | * @module dialog 9 | * @returns {ActionSheetRes} 10 | */ 11 | export declare function showActionSheet(options: Options): Promise; 12 | -------------------------------------------------------------------------------- /dist/webview/addWaterMask.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 添加水印 7 | * @description 给页面添加水印 8 | * @param {AddWaterMaskParams} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function addWaterMask(options) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'addWaterMask', [options]); 14 | } 15 | exports.default = addWaterMask; 16 | -------------------------------------------------------------------------------- /modules/dialog/toast.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DIALOG } from '../constants'; 3 | import { ToastParams } from '../types/dialog'; 4 | 5 | /** 6 | * Toast 7 | * @description 显示 Toast 小提示框,可以控制显示的标题和时长 8 | * @param {ToastParams} 9 | * @module dialog 10 | */ 11 | export function showToast(options: ToastParams): void { 12 | if (!options.duration) { 13 | options.duration = 3000; 14 | } 15 | return core.execSync(WORKPLUS_DIALOG, 'showToast', [options]); 16 | } 17 | -------------------------------------------------------------------------------- /modules/user/index.ts: -------------------------------------------------------------------------------- 1 | import getCurrentUserInfo from './getCurrentUserInfo'; 2 | import getCurrentEmployeeInfo from './getCurrentEmployeeInfo'; 3 | import getUserInfoByUserId from './getUserInfoByUserId'; 4 | import showUserInfoByUsername from './showUserInfoByUsername'; 5 | 6 | export { 7 | /** 获取登录用户详情 */ 8 | getCurrentUserInfo, 9 | /** 获取用户的雇员信息 */ 10 | getCurrentEmployeeInfo, 11 | /** 获取用户信息 */ 12 | getUserInfoByUserId, 13 | /** 打开用户详情页面 */ 14 | showUserInfoByUsername, 15 | }; 16 | -------------------------------------------------------------------------------- /dist/file/chooseFiles.d.ts: -------------------------------------------------------------------------------- 1 | import { FileOptions, ChooseFiles, ChooseFilesRes } from '../types/file'; 2 | export declare type ChooseFilesOptions = ChooseFiles & FileOptions; 3 | /** 4 | * 文件选择接口(返回带mediaId方式) 5 | * @description 打开WorkPlus文件选择管理器,根据参数状态决定单选或多选文件,并上传该文件到后台,返回值带mediaId 6 | * @param {ChooseFilesOptions} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function chooseFiles(options?: ChooseFilesOptions): Promise; 10 | -------------------------------------------------------------------------------- /dist/file/openFileDetail.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 打开文件详情 7 | * @description 通过指定 mediaId, fileName 等参数, 打开文件详情界面 8 | * @param {ShowFileParams} [options] 9 | * @returns {void} 10 | */ 11 | function openFileDetail(options) { 12 | return core.execSync(constants_1.WORKPLUS_FILE, 'showFile', [options]); 13 | } 14 | exports.default = openFileDetail; 15 | -------------------------------------------------------------------------------- /dist/util/voiceToText.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { VoiceToTextRes } from '../types/webview'; 3 | export declare type VoiceToTextOptions = ExecOptions; 4 | /** 5 | * 语音转文本 6 | * @description 语音转文本 7 | * @param {VoiceToTextOptions} [options] 8 | * @module webview 9 | * @returns {Promise} 10 | */ 11 | declare function voiceToText(options?: VoiceToTextOptions): Promise; 12 | export default voiceToText; 13 | -------------------------------------------------------------------------------- /modules/session/index.ts: -------------------------------------------------------------------------------- 1 | import openDiscussionById from './openDiscussionById'; 2 | import createDiscussionChat from './createDiscussionChat'; 3 | import selectDiscussionMembers from './selectDiscussionMembers'; 4 | import showUserChatViewByUser from './showUserChatViewByUser'; 5 | 6 | export { 7 | /** 打开用户聊天页面 */ 8 | showUserChatViewByUser, 9 | /** 打开群组聊天页面 */ 10 | openDiscussionById, 11 | /** 创建群组 */ 12 | createDiscussionChat, 13 | /** 打开群组选人界面 */ 14 | selectDiscussionMembers, 15 | }; 16 | -------------------------------------------------------------------------------- /dist/header/rightButtons.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 更换右侧按钮动作 7 | * @description 设置右侧按钮的选项 8 | * @param {RightButtonsOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function rightButtons(options) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'rightButtons', options.items); 14 | } 15 | exports.default = rightButtons; 16 | -------------------------------------------------------------------------------- /dist/user/getUserInfoByUserId.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, GetUserInfoByUserIdParams, GetUserInfoByUserIdRes } from '../types/contact'; 2 | /** 3 | * 通过用户域id和用户id获取这个用户的详细信息 4 | * 5 | * @export 6 | * @param {GetUserInfoByUserIdParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getUserInfoByUserId(options: GetUserInfoByUserIdParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /modules/header/navigation.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { NavigationParams } from '../types/webview'; 4 | 5 | /** 6 | * 锁定网页顶部栏 7 | * @description 锁定顶部栏,使得顶部栏按钮无效 8 | * @param {NavigationParams} mode 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function navigation(mode: NavigationParams): void { 13 | return core.execSync(WORKPLUS_WEBVIEW, 'navigation', [mode]); 14 | } 15 | 16 | export default navigation; 17 | -------------------------------------------------------------------------------- /dist/contact/getEmployeesFromCurrentOrg.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, EmployeesFromOrgParams, CurrentEmployeeInfoRes } from '../types/contact'; 2 | /** 3 | * 打开当前组织的联系人列表,选择多个联系人 4 | * 5 | * @export 6 | * @param {EmployeesFromOrgParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getEmployeesFromCurrentOrg(options?: EmployeesFromOrgParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/header/leftButton.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 更换左侧按钮动作 7 | * @description 传入一个全局的函数名,点击左侧按钮时时执行 8 | * @param {LeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function leftButton(options) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'leftButton', [options.method]); 14 | } 15 | exports.default = leftButton; 16 | -------------------------------------------------------------------------------- /dist/user/getCurrentEmployeeInfo.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, CurrentEmployeeInfoParams, CurrentEmployeeInfoRes } from '../types/contact'; 2 | /** 3 | * 获取当前登录用户的某个组织里的雇员信息 4 | * 5 | * @export 6 | * @param {CurrentEmployeeInfoParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function getCurrentEmployeeInfo(options?: CurrentEmployeeInfoParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/util/generateQrcode.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { GenerateQrcodeRes, GenerateQrcodeParams } from '../types/util'; 3 | export declare type Options = GenerateQrcodeParams & ExecOptions; 4 | /** 5 | * 生成条形码 6 | * @param {GenerateQrcodeParams} [options] 7 | * @module util 8 | * @returns {Promise} 9 | */ 10 | declare function generateQrcode(options: Options): Promise; 11 | export default generateQrcode; 12 | -------------------------------------------------------------------------------- /modules/image/showImages.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_IMAGE } from '../constants'; 3 | import { ShowImagesItem } from '../types/image'; 4 | 5 | /** 6 | * 图片预览 7 | * @description 传输图片地址,预览图片,支持传入 position 表示从第几张开始预览 8 | * @param {ShowImagesItem} options 9 | * @module image 10 | * @version 3.1.3版本以上 11 | */ 12 | function showImages(options: ShowImagesItem): void { 13 | return core.execSync(WORKPLUS_IMAGE, 'showImages', [options]); 14 | } 15 | 16 | export default showImages; 17 | -------------------------------------------------------------------------------- /modules/types/auth.ts: -------------------------------------------------------------------------------- 1 | export interface GetUserTicketRes { 2 | /** 申请到的用户ticket */ 3 | user_ticket: string; 4 | } 5 | 6 | export interface GetServerInfoRes { 7 | /** app后台地址 */ 8 | api_url: string; 9 | } 10 | 11 | export interface GetTenantIDRes { 12 | /** 当前的域id */ 13 | domain_id?: string; 14 | /** 当前的域id, v2数据 */ 15 | tenant_id?: string; 16 | } 17 | 18 | export interface BiometricRes { 19 | /** 0 表示生物认证成功, 2 表示用户取消了设置 */ 20 | code: number; 21 | /** 描述信息 */ 22 | message: string; 23 | } 24 | -------------------------------------------------------------------------------- /dist/image/showImages.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 图片预览 7 | * @description 传输图片地址,预览图片,支持传入 position 表示从第几张开始预览 8 | * @param {ShowImagesItem} options 9 | * @module image 10 | * @version 3.1.3版本以上 11 | */ 12 | function showImages(options) { 13 | return core.execSync(constants_1.WORKPLUS_IMAGE, 'showImages', [options]); 14 | } 15 | exports.default = showImages; 16 | -------------------------------------------------------------------------------- /example/src/api/email.ts: -------------------------------------------------------------------------------- 1 | /** 邮箱 */ 2 | 3 | export default { 4 | title: '邮箱', 5 | module: 'email', 6 | active: false, 7 | icon: 'envelop-o', 8 | apis: [ 9 | { 10 | title: '写邮件', 11 | description: '跳转到写邮件的页面', 12 | action: 'writeEmail', 13 | params: { 14 | emails: 'test@163.com', 15 | }, 16 | }, 17 | { 18 | title: '打开邮箱', 19 | description: '跳转到我的邮箱(未登陆就跳转到登陆页)', 20 | action: 'openEmail', 21 | params: {}, 22 | }, 23 | ], 24 | }; 25 | -------------------------------------------------------------------------------- /dist/core/mock-services.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.services = void 0; 4 | var SERVICES_KEYS = require("../constants"); 5 | var services = {}; 6 | exports.services = services; 7 | var serviceKeys = SERVICES_KEYS; 8 | Object.keys(serviceKeys).map(function (key) { 9 | if (key.includes('WORKPLUS_')) { 10 | var serviceName = key.replace('WORKPLUS_', '').toLocaleLowerCase(); 11 | services[serviceKeys[key]] = serviceName; 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /dist/util/generateBarcode.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { GenerateBarcodeRes, GenerateBarcodeParams } from '../types/util'; 3 | export declare type Options = GenerateBarcodeParams & ExecOptions; 4 | /** 5 | * 生成条形码 6 | * @param {GenerateBarcodeParams} [options] 7 | * @module util 8 | * @returns {Promise} 9 | */ 10 | declare function generateBarcode(options: Options): Promise; 11 | export default generateBarcode; 12 | -------------------------------------------------------------------------------- /dist/webview/openLocalURL.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { OpenLocalURLParams } from '../types/webview'; 3 | export declare type OpenLocalURLOptions = OpenLocalURLParams & ExecOptions; 4 | /** 5 | * 打开WorkPlus里已有的html 6 | * @description 传入相对地址,打开WorkPlus里已有的网页 7 | * @param {OpenLocalURLOptions} [options] 8 | * @module webview 9 | * @returns 无 10 | */ 11 | declare function openLocalURL(options: OpenLocalURLOptions): Promise; 12 | export default openLocalURL; 13 | -------------------------------------------------------------------------------- /example-pc/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | '@vue/airbnb', 9 | '@vue/typescript', 10 | ], 11 | rules: { 12 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 13 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 14 | 'class-methods-use-this': 'off', 15 | }, 16 | parserOptions: { 17 | parser: '@typescript-eslint/parser', 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | '@vue/airbnb', 9 | '@vue/typescript', 10 | ], 11 | rules: { 12 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 13 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 14 | 'class-methods-use-this': 'off', 15 | }, 16 | parserOptions: { 17 | parser: '@typescript-eslint/parser', 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /modules/webview/addWaterMask.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { AddWaterMaskParams } from '../types/webview'; 4 | 5 | /** 6 | * 添加水印 7 | * @description 给页面添加水印 8 | * @param {AddWaterMaskParams} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function addWaterMask(options: AddWaterMaskParams): void { 13 | return core.execSync(WORKPLUS_WEBVIEW, 'addWaterMask', [options]); 14 | } 15 | 16 | export default addWaterMask; 17 | -------------------------------------------------------------------------------- /dist/header/hideSearchBar.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 隐藏搜索栏 7 | * @description 针对 "显示搜索栏" 接口,用于隐藏搜索栏。 8 | * @module webview 9 | * @version 4.10.0+ 10 | */ 11 | function hideSearchBar() { 12 | var args = { 13 | visible: false, 14 | }; 15 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'searchBar', [args]); 16 | } 17 | exports.default = hideSearchBar; 18 | -------------------------------------------------------------------------------- /modules/header/hideSearchBar.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | export interface HideSearchBar { 5 | visible: boolean; 6 | } 7 | 8 | /** 9 | * 隐藏搜索栏 10 | * @description 针对 "显示搜索栏" 接口,用于隐藏搜索栏。 11 | * @module webview 12 | * @version 4.10.0+ 13 | */ 14 | export default function hideSearchBar(): void { 15 | const args: HideSearchBar = { 16 | visible: false, 17 | }; 18 | return core.execSync(WORKPLUS_WEBVIEW, 'searchBar', [args]); 19 | } 20 | -------------------------------------------------------------------------------- /dist/header/changeLeftButton.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 更换左侧按钮和定义动作 7 | * @description 设置左侧按钮的选项 8 | * @param {ChangeLeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function changeLeftButton(options) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'changeLeftButton', [options.items]); 14 | } 15 | exports.default = changeLeftButton; 16 | -------------------------------------------------------------------------------- /scripts/genReleaseNote.js: -------------------------------------------------------------------------------- 1 | const cc = require('conventional-changelog'); 2 | 3 | const version = process.argv[2] || process.env.VERSION; 4 | const file = `./release_note/RELEASE_NOTE_${version}.md`; 5 | const fileStream = require('fs').createWriteStream(file); 6 | 7 | cc({ 8 | preset: 'angular', 9 | pkg: { 10 | transform (pkg) { 11 | pkg.version = `v${version}`; 12 | return pkg; 13 | }, 14 | }, 15 | }).pipe(fileStream).on('close', () => { 16 | console.log(`Generated release note at ${file}`); 17 | }); 18 | -------------------------------------------------------------------------------- /dist/types/auth.d.ts: -------------------------------------------------------------------------------- 1 | export interface GetUserTicketRes { 2 | /** 申请到的用户ticket */ 3 | user_ticket: string; 4 | } 5 | export interface GetServerInfoRes { 6 | /** app后台地址 */ 7 | api_url: string; 8 | } 9 | export interface GetTenantIDRes { 10 | /** 当前的域id */ 11 | domain_id?: string; 12 | /** 当前的域id, v2数据 */ 13 | tenant_id?: string; 14 | } 15 | export interface BiometricRes { 16 | /** 0 表示生物认证成功, 2 表示用户取消了设置 */ 17 | code: number; 18 | /** 描述信息 */ 19 | message: string; 20 | } 21 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.0-beta.13.md: -------------------------------------------------------------------------------- 1 | # [2.0.0-beta.13](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.0-beta.12...v2.0.0-beta.13) (2023-07-18) 2 | 3 | 4 | ### Features 5 | 6 | * 发票接口参数调整 ([2f45780](https://github.com/WorkPlusFE/js-sdk/commit/2f457804b811744d34cad89a4b203daa4953eb3e)) 7 | * 发票接口调整 ([ad1fea2](https://github.com/WorkPlusFE/js-sdk/commit/ad1fea235fd428547ba9d5153360d5f65468a105)) 8 | * 支付宝、微信选择发票接口 ([dec6219](https://github.com/WorkPlusFE/js-sdk/commit/dec621945bf7df2025077e065ef7334a3609e360)) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /dist/webview/unregisterShakeListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 注销摇一摇监听 7 | * @description 注销摇一摇监听 8 | * @param {NotResOptions} [options] 9 | * @module webview 10 | * @returns {Promise} 11 | */ 12 | function unregisterShakeListener() { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'unregisterShakeListener', []); 14 | } 15 | exports.default = unregisterShakeListener; 16 | -------------------------------------------------------------------------------- /modules/image/actionForLongPressImage.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_IMAGE } from '../constants'; 3 | import { ImageDataItem } from '../types/image'; 4 | 5 | /** 6 | * 长按图片弹出框 7 | * @description 弹出框包括"识别二维码", "保存图片"等选项 8 | * @param {ImageDataItem} options 9 | * @module image 10 | * @returns 无 11 | */ 12 | function actionForLongPressImage(options: ImageDataItem): void { 13 | return core.execSync(WORKPLUS_IMAGE, 'actionForLongPressImage', [options]); 14 | } 15 | 16 | export default actionForLongPressImage; 17 | -------------------------------------------------------------------------------- /dist/header/visibleLeftButton.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 是否隐藏或显示左侧的按钮和关闭字样 7 | * @description 是否隐藏或显示左侧的按钮和关闭字样 8 | * @param {VisibleLeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function visibleLeftButton(options) { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'visibleLeftButton', [options]); 14 | } 15 | exports.default = visibleLeftButton; 16 | -------------------------------------------------------------------------------- /dist/contact/index.d.ts: -------------------------------------------------------------------------------- 1 | import getSingleContact from './getSingleContact'; 2 | import getContacts from './getContacts'; 3 | import getEmployeesFromCurrentOrg from './getEmployeesFromCurrentOrg'; 4 | import selectContacts from './selectContacts'; 5 | import getMobileContacts from './getMobileContacts'; 6 | export { 7 | /** 单选联系人 */ 8 | getSingleContact, 9 | /** 多选联系人 */ 10 | getContacts, 11 | /** 多选当前组织的雇员列表 */ 12 | getEmployeesFromCurrentOrg, 13 | /** 打开通用选择人员界面 */ 14 | selectContacts, 15 | /** 获取手机通讯录 */ 16 | getMobileContacts, }; 17 | -------------------------------------------------------------------------------- /dist/image/actionForLongPressImage.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 长按图片弹出框 7 | * @description 弹出框包括"识别二维码", "保存图片"等选项 8 | * @param {ImageDataItem} options 9 | * @module image 10 | * @returns 无 11 | */ 12 | function actionForLongPressImage(options) { 13 | return core.execSync(constants_1.WORKPLUS_IMAGE, 'actionForLongPressImage', [options]); 14 | } 15 | exports.default = actionForLongPressImage; 16 | -------------------------------------------------------------------------------- /dist/pay/chooseWxInvoice.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { WxChooseInvoiceParams, WxChooseInvoiceItem } from '../types/pay'; 3 | export declare type WxChooseInvoiceOptions = WxChooseInvoiceParams & ExecOptions; 4 | /** 5 | * 微信选择发票 6 | * @description 使用发票前,请先判断是否已安微信 7 | * @param {WxChooseInvoiceOptions} [options] 8 | * @returns {Promise} 9 | */ 10 | export default function chooseWxInvoice(options?: WxChooseInvoiceOptions): Promise; 11 | -------------------------------------------------------------------------------- /dist/session/selectDiscussionMembers.d.ts: -------------------------------------------------------------------------------- 1 | import { ContactOption, SelectDiscussionMembersParams, SelectDiscussionMembersRes } from '../types/contact'; 2 | /** 3 | * 根据群组 id, 打开群组成员界面, 并进行选择 4 | * 5 | * @export 6 | * @param {SelectDiscussionMembersParams & ContactOption} [options] 7 | * @returns {Promise} 8 | */ 9 | export default function selectDiscussionMembers(options: SelectDiscussionMembersParams & ContactOption): Promise; 10 | -------------------------------------------------------------------------------- /dist/webview/registerShakeListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 注册摇一摇监听 7 | * @description 前端需要实现 onWorkplusShake 方法, 摇一摇后将会触发该方法 8 | * @param {NotResOptions} [options] 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function registerShakeListener() { 13 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'registerShakeListener', []); 14 | } 15 | exports.default = registerShakeListener; 16 | -------------------------------------------------------------------------------- /example/src/api/pay.ts: -------------------------------------------------------------------------------- 1 | // 支付 2 | 3 | export default { 4 | title: '支付', 5 | module: 'pay', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '选择微信发票', 10 | description: '选择微信发票', 11 | action: 'chooseWxInvoice', 12 | params: { 13 | }, 14 | }, 15 | { 16 | title: '选择支付宝发票', 17 | description: '选择支付宝发票', 18 | action: 'chooseAliInvoice', 19 | params: { 20 | isvUrl: 'https://dctest.mideadc.com', 21 | einvMerchantId: 9131000074027, 22 | }, 23 | }, 24 | ], 25 | }; 26 | -------------------------------------------------------------------------------- /modules/contact/index.ts: -------------------------------------------------------------------------------- 1 | import getSingleContact from './getSingleContact'; 2 | import getContacts from './getContacts'; 3 | import getEmployeesFromCurrentOrg from './getEmployeesFromCurrentOrg'; 4 | import selectContacts from './selectContacts'; 5 | import getMobileContacts from './getMobileContacts'; 6 | 7 | export { 8 | /** 单选联系人 */ 9 | getSingleContact, 10 | /** 多选联系人 */ 11 | getContacts, 12 | /** 多选当前组织的雇员列表 */ 13 | getEmployeesFromCurrentOrg, 14 | /** 打开通用选择人员界面 */ 15 | selectContacts, 16 | /** 获取手机通讯录 */ 17 | getMobileContacts, 18 | }; 19 | -------------------------------------------------------------------------------- /modules/types/record.ts: -------------------------------------------------------------------------------- 1 | export interface VoiceRecordRes { 2 | /** 调用返回信息 */ 3 | message: number; 4 | /** 如果当前设备计步器不可用,返回-10001 */ 5 | code?: number; 6 | /** 录音信息 */ 7 | info: { 8 | voice_path: string; 9 | }; 10 | } 11 | 12 | export interface TranslateAudiodRes { 13 | /** 调用返回信息 */ 14 | message: number; 15 | /** 如果当前设备计步器不可用,返回-10001 */ 16 | code?: number; 17 | /** 转换数据 */ 18 | info: { 19 | video_path: string; 20 | }; 21 | } 22 | 23 | export interface TranslateAudiodParams { 24 | /** 转换地址 */ 25 | file_path: string; 26 | } 27 | -------------------------------------------------------------------------------- /dist/app/showAppListById.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 根据组织id打开该组织下的应用列表页面 7 | * 8 | * @export 9 | * @param {ShowAppListById} [options] 10 | * @returns {void} 11 | */ 12 | function showAppListById(options) { 13 | var args = { 14 | org_id: options.orgId, 15 | }; 16 | return core.execSync(constants_1.WORKPLUS_APP_STORE, 'showAppListById', [args]); 17 | } 18 | exports.default = showAppListById; 19 | -------------------------------------------------------------------------------- /dist/device/index.d.ts: -------------------------------------------------------------------------------- 1 | import getDeviceInfo from './getDeviceInfo'; 2 | import getIpAddress from './getIpAddress'; 3 | import getPedometerData from './getPedometerData'; 4 | import getAppInfo from './getAppInfo'; 5 | declare const _default: { 6 | /** 获取设备信息 */ 7 | getDeviceInfo: typeof getDeviceInfo; 8 | /** 获取 IP 地址 */ 9 | getIpAddress: typeof getIpAddress; 10 | /** 获取运动数据 */ 11 | getPedometerData: typeof getPedometerData; 12 | /** 获取 App 信息 */ 13 | getAppInfo: typeof getAppInfo; 14 | }; 15 | export default _default; 16 | -------------------------------------------------------------------------------- /dist/pay/chooseAliInvoice.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { AliChooseInvoiceParams, AliChooseInvoiceResult } from '../types/pay'; 3 | export declare type AliChooseInvoiceOptions = AliChooseInvoiceParams & ExecOptions; 4 | /** 5 | * 支付宝选择发票 6 | * @description 使用发票前,请先判断是否已安装支付宝 7 | * @param {AliChooseInvoiceOptions} [options] 8 | * @returns {Promise} 9 | */ 10 | export default function chooseAliInvoice(options: AliChooseInvoiceOptions): Promise; 11 | -------------------------------------------------------------------------------- /modules/header/leftButton.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | export interface LeftButtonOptions { 5 | /** 执行的JS全局函数名 */ 6 | method: string; 7 | } 8 | 9 | /** 10 | * 更换左侧按钮动作 11 | * @description 传入一个全局的函数名,点击左侧按钮时时执行 12 | * @param {LeftButtonOptions} options 13 | * @module webview 14 | * @returns 无 15 | */ 16 | function leftButton(options: LeftButtonOptions): void { 17 | return core.execSync(WORKPLUS_WEBVIEW, 'leftButton', [options.method]); 18 | } 19 | 20 | export default leftButton; 21 | -------------------------------------------------------------------------------- /modules/session/createDiscussionChat.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | 3 | import { WORKPLUS_CONTACT } from '../constants'; 4 | 5 | /** 6 | * 通过调用原生选人界面,选择人员,创建群组,并且返回相关群组信息 7 | * 8 | * @export 9 | * @param {boolean} [newWindow] 仅对 PC 客户端有效 10 | * @returns {void} 11 | */ 12 | export default function createDiscussionChat({ newWindow }: { newWindow?: boolean }): void { 13 | const options = core.isPCPlatform && typeof newWindow !== 'undefined' ? [{ newWindow }] : []; 14 | return core.execSync(WORKPLUS_CONTACT, 'createDiscussionChat', options); 15 | } 16 | -------------------------------------------------------------------------------- /dist/util/vibrate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 震动 7 | * @param {} [options] 8 | * @module util 9 | * @returns {Promise} 10 | */ 11 | function vibrate(options) { 12 | return core.exec(constants_1.WORKPLUS_DEVICE, 'vibrate', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = vibrate; 15 | -------------------------------------------------------------------------------- /dist/webview/changeOrientation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 控制屏幕旋转 7 | * @description 根据参数控制屏幕横屏显示或者竖屏显示 8 | * @param {ChangeOrientationParams} options 9 | * @module webview 10 | * @version 3.1.3+ 11 | * @returns {Promise} 12 | */ 13 | function changeOrientation(options) { 14 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'changeOrientation', [options]); 15 | } 16 | exports.default = changeOrientation; 17 | -------------------------------------------------------------------------------- /dist/dialog/toast.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showToast = void 0; 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * Toast 8 | * @description 显示 Toast 小提示框,可以控制显示的标题和时长 9 | * @param {ToastParams} 10 | * @module dialog 11 | */ 12 | function showToast(options) { 13 | if (!options.duration) { 14 | options.duration = 3000; 15 | } 16 | return core.execSync(constants_1.WORKPLUS_DIALOG, 'showToast', [options]); 17 | } 18 | exports.showToast = showToast; 19 | -------------------------------------------------------------------------------- /dist/shared/platform.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 检测当前是否在 WorkPlus 环境下 3 | * @export 4 | * @returns {boolean} 5 | */ 6 | export declare function detectInWorkPlus(): boolean; 7 | /** 8 | * 检测当前是否为 Android 平台 9 | * @export 10 | * @returns {boolean} 11 | */ 12 | export declare function isAndroid(): boolean; 13 | /** 14 | * 检测当前是否为 IPhone 平台 15 | * @export 16 | * @returns {boolean} 17 | */ 18 | export declare function isIPhone(): boolean; 19 | /** 20 | * 检测当前是否在浏览器环境 21 | * @export 22 | * @returns {boolean} 23 | */ 24 | export declare function isBrowser(): boolean; 25 | -------------------------------------------------------------------------------- /example-pc/src/api/image.ts: -------------------------------------------------------------------------------- 1 | /** 图片 */ 2 | 3 | export default { 4 | title: '图像', 5 | module: 'image', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '图片预览', 10 | description: '传入图片地址进行图片预览,支持传入 position 表示从第几张开始预览。', 11 | action: 'showImages', 12 | params: { 13 | urls: [ 14 | 'https://open.workplus.io/static/pics/j-2.jpeg', 15 | 'https://open.workplus.io/static/pics/j-1.jpg', 16 | 'https://open.workplus.io/static/pics/j-3.jpeg', 17 | ], 18 | position: 0, 19 | }, 20 | }, 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /modules/header/visibleLeftButton.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { VisibleLeftButtonParams } from '../types/webview'; 4 | 5 | /** 6 | * 是否隐藏或显示左侧的按钮和关闭字样 7 | * @description 是否隐藏或显示左侧的按钮和关闭字样 8 | * @param {VisibleLeftButtonOptions} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function visibleLeftButton(options: VisibleLeftButtonParams): void { 13 | return core.execSync(WORKPLUS_WEBVIEW, 'visibleLeftButton', [options]); 14 | } 15 | 16 | export default visibleLeftButton; 17 | -------------------------------------------------------------------------------- /modules/email/openEmail.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_EMAIL } from '../constants'; 3 | import { NotResOptions } from '../types/core'; 4 | 5 | /** 6 | * 打开邮箱 7 | * @description 跳转到我的邮箱,未登陆就跳转到登陆页 8 | * @param {NotResOptions} [options] 9 | * @module email 10 | * @returns 无 11 | */ 12 | function openEmail(options?: NotResOptions): Promise { 13 | return core.exec<[], void, void>( 14 | WORKPLUS_EMAIL, 15 | 'openEmail', 16 | [], 17 | options?.success, 18 | options?.fail, 19 | false, 20 | ); 21 | } 22 | 23 | export default openEmail; 24 | -------------------------------------------------------------------------------- /modules/import-cordova/index.ts: -------------------------------------------------------------------------------- 1 | import { inWorkPlus, scriptGenerator } from './utils'; 2 | import { ImportCordovaOptions } from '../types/import-cordova'; 3 | import CordovaImportInstance from './cordovaImportInstance'; 4 | 5 | export default function cordovaImportInit(options?: ImportCordovaOptions, useHttp?: boolean): void { 6 | try { 7 | if (!inWorkPlus()) return; 8 | 9 | const lib = new CordovaImportInstance(options, useHttp); 10 | const importUri = lib.getImportUri(); 11 | scriptGenerator(importUri); 12 | } catch (error) { 13 | console.log(error); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modules/util/index.ts: -------------------------------------------------------------------------------- 1 | import scanner from './scanner'; 2 | import voiceToText from './voiceToText'; 3 | import copyText from './copyText'; 4 | import tel from './tel'; 5 | import vibrate from './vibrate'; 6 | import generateBarcode from './generateBarcode'; 7 | import generateQrcode from './generateQrcode'; 8 | 9 | export default { 10 | /** 扫描二维码 */ 11 | scanner, 12 | /** 语音转文本 */ 13 | voiceToText, 14 | /** 复制文本 */ 15 | copyText, 16 | /** 打电话 */ 17 | tel, 18 | /** 震动 */ 19 | vibrate, 20 | /** 生成条形码 */ 21 | generateBarcode, 22 | /** 生成二维码 */ 23 | generateQrcode, 24 | }; 25 | -------------------------------------------------------------------------------- /dist/util/scanner.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 扫描二维码 7 | * @description 调用相机扫描二维码 8 | * @param {UitlOptions} [options] 9 | * @returns {Promise} 10 | */ 11 | function scanner(options) { 12 | return core.exec(constants_1.WORKPLUS_BARCODE_SCANNER, 'scanner', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = scanner; 15 | -------------------------------------------------------------------------------- /modules/app/showAppListById.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { ShowAppListByIdParams, ShowAppListById } from '../types/contact'; 3 | 4 | import { WORKPLUS_APP_STORE } from '../constants'; 5 | 6 | /** 7 | * 根据组织id打开该组织下的应用列表页面 8 | * 9 | * @export 10 | * @param {ShowAppListById} [options] 11 | * @returns {void} 12 | */ 13 | export default function showAppListById(options: ShowAppListById): void { 14 | const args: ShowAppListByIdParams = { 15 | org_id: options.orgId, 16 | }; 17 | return core.execSync(WORKPLUS_APP_STORE, 'showAppListById', [args]); 18 | } 19 | -------------------------------------------------------------------------------- /modules/util/scanner.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_BARCODE_SCANNER } from '../constants'; 3 | import { UitlOptions, ScannerParams } from '../types/util'; 4 | 5 | /** 6 | * 扫描二维码 7 | * @description 调用相机扫描二维码 8 | * @param {UitlOptions} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function scanner(options?: UitlOptions): Promise { 12 | return core.exec( 13 | WORKPLUS_BARCODE_SCANNER, 14 | 'scanner', 15 | [], 16 | options?.success, 17 | options?.fail, 18 | false, 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /dist/types/record.d.ts: -------------------------------------------------------------------------------- 1 | export interface VoiceRecordRes { 2 | /** 调用返回信息 */ 3 | message: number; 4 | /** 如果当前设备计步器不可用,返回-10001 */ 5 | code?: number; 6 | /** 录音信息 */ 7 | info: { 8 | voice_path: string; 9 | }; 10 | } 11 | export interface TranslateAudiodRes { 12 | /** 调用返回信息 */ 13 | message: number; 14 | /** 如果当前设备计步器不可用,返回-10001 */ 15 | code?: number; 16 | /** 转换数据 */ 17 | info: { 18 | video_path: string; 19 | }; 20 | } 21 | export interface TranslateAudiodParams { 22 | /** 转换地址 */ 23 | file_path: string; 24 | } 25 | -------------------------------------------------------------------------------- /dist/video/playVideo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * @description 视频录制 7 | * @param {Options} options 8 | * @module video 9 | * @returns {PlayVideoRes} 10 | */ 11 | function playVideo(options) { 12 | return core.exec(constants_1.WORKPLUS_AUDIO_AND_VIDEO, 'playVideo', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = playVideo; 15 | -------------------------------------------------------------------------------- /example/src/api/video.ts: -------------------------------------------------------------------------------- 1 | // 视频 2 | 3 | export default { 4 | title: '视频', 5 | module: 'video', 6 | active: false, 7 | apis: [ 8 | { 9 | title: '视频录制', 10 | description: '视频录制', 11 | action: 'startVideoRecoder', 12 | params: { 13 | duration: '60.0', 14 | quality: '0', 15 | sync_system_album: true, 16 | }, 17 | }, 18 | { 19 | title: '播放视频', 20 | description: '播放视频', 21 | action: 'playVideo', 22 | params: { url: 'https://23550369.s21v.faiusr.com/58/2/ABUIABA6GAAggb-q-wUokKWtuwE.mp4' }, 23 | }, 24 | ], 25 | }; 26 | -------------------------------------------------------------------------------- /example/src/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | // @ts-ignore 3 | import VueClipboard from 'vue-clipboard2'; 4 | // @ts-ignore 5 | import JsonViewer from 'vue-json-viewer'; 6 | import 'vue-json-viewer/style.css'; 7 | 8 | import VConsole from 'vconsole'; 9 | new VConsole(); 10 | 11 | import App from './App.vue'; 12 | import router from './router'; 13 | import store from './store'; 14 | import 'normalize.css'; 15 | 16 | Vue.use(VueClipboard); 17 | Vue.use(JsonViewer); 18 | 19 | Vue.config.productionTip = false; 20 | 21 | new Vue({ 22 | router, 23 | store, 24 | render: h => h(App), 25 | }).$mount('#app'); 26 | -------------------------------------------------------------------------------- /modules/contact/getMobileContacts.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { ContactOption } from '../types/contact'; 3 | import { WORKPLUS_CONTACT } from '../constants'; 4 | 5 | /** 6 | * 获取手机通讯录联系人的列表 7 | * 8 | * @export 9 | * @param {ContactOption<[], unknown>} [options] 10 | * @returns {Promise} 11 | */ 12 | export default function getMobileContacts(options?: ContactOption): Promise { 13 | return core.exec<[], unknown, unknown>( 14 | WORKPLUS_CONTACT, 15 | 'getMobileContacts', 16 | [], 17 | options?.success, 18 | options?.fail, 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /modules/webview/changeOrientation.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { ChangeOrientationParams } from '../types/webview'; 4 | 5 | /** 6 | * 控制屏幕旋转 7 | * @description 根据参数控制屏幕横屏显示或者竖屏显示 8 | * @param {ChangeOrientationParams} options 9 | * @module webview 10 | * @version 3.1.3+ 11 | * @returns {Promise} 12 | */ 13 | function changeOrientation(options: ChangeOrientationParams): void { 14 | return core.execSync(WORKPLUS_WEBVIEW, 'changeOrientation', [options]); 15 | } 16 | 17 | export default changeOrientation; 18 | -------------------------------------------------------------------------------- /dist/email/openEmail.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 打开邮箱 7 | * @description 跳转到我的邮箱,未登陆就跳转到登陆页 8 | * @param {NotResOptions} [options] 9 | * @module email 10 | * @returns 无 11 | */ 12 | function openEmail(options) { 13 | return core.exec(constants_1.WORKPLUS_EMAIL, 'openEmail', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 14 | } 15 | exports.default = openEmail; 16 | -------------------------------------------------------------------------------- /dist/import-cordova/cordovaImportInstance.d.ts: -------------------------------------------------------------------------------- 1 | import { ImportCordovaOptions, Platform } from '../types/import-cordova'; 2 | export default class CordovaImportInstance { 3 | private config; 4 | constructor(options?: ImportCordovaOptions, useHttp?: boolean); 5 | get userAgent(): string; 6 | /** 7 | * 返回注入的地址 8 | * 9 | * 默认使用 local模式, 10 | * 当检测到是 https协议 (安卓) 或在 iframe 中打开时, 11 | * 若iOS或安卓的 cordovajs 地址存在,强制使用 http 模式 12 | */ 13 | getImportUri(): string; 14 | mustUseHttpModel(): boolean; 15 | getCurrentPlatformByUserAgent(): Platform; 16 | } 17 | -------------------------------------------------------------------------------- /dist/record/voiceRecord.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * @description 语音录制 7 | * @param {Options} options 8 | * @module record 9 | * @returns {voiceRecordRes} 10 | */ 11 | function voiceRecord(options) { 12 | return core.exec(constants_1.WORKPLUS_AUDIO_AND_VIDEO, 'voiceRecord', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = voiceRecord; 15 | -------------------------------------------------------------------------------- /example-pc/src/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | // @ts-ignore 3 | import VueClipboard from 'vue-clipboard2'; 4 | // @ts-ignore 5 | import JsonViewer from 'vue-json-viewer'; 6 | import 'vue-json-viewer/style.css'; 7 | 8 | import VConsole from 'vconsole'; 9 | new VConsole(); 10 | 11 | import App from './App.vue'; 12 | import router from './router'; 13 | import store from './store'; 14 | import 'normalize.css'; 15 | 16 | Vue.use(VueClipboard); 17 | Vue.use(JsonViewer); 18 | 19 | Vue.config.productionTip = false; 20 | 21 | new Vue({ 22 | router, 23 | store, 24 | render: h => h(App), 25 | }).$mount('#app'); 26 | -------------------------------------------------------------------------------- /dist/app/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showAppListById = exports.showAppChatViewById = exports.searchInApp = exports.route = void 0; 4 | var route_1 = require("./route"); 5 | exports.route = route_1.default; 6 | var searchInApp_1 = require("./searchInApp"); 7 | exports.searchInApp = searchInApp_1.default; 8 | var showAppChatViewById_1 = require("./showAppChatViewById"); 9 | exports.showAppChatViewById = showAppChatViewById_1.default; 10 | var showAppListById_1 = require("./showAppListById"); 11 | exports.showAppListById = showAppListById_1.default; 12 | -------------------------------------------------------------------------------- /dist/auth/getTenantID.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取当前租户id,即域id 7 | * @description 获取当前租户id,即域id 8 | * @param {TenantIdOptions} [options] 9 | * @module auth 10 | * @returns 域ID 11 | */ 12 | function getTenantID(options) { 13 | return core.exec(constants_1.WORKPLUS_AUTH, 'getTenantID', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getTenantID; 16 | -------------------------------------------------------------------------------- /dist/config/checkApi.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions, CommonApiRes } from '../types/core'; 2 | export interface CheckApiParams { 3 | /** 插件名称 */ 4 | service: string; 5 | /** 插件方法 */ 6 | method: string; 7 | } 8 | export declare type CheckApiOptions = CheckApiParams & ExecOptions; 9 | /** 10 | * 接口检测 11 | * @description 检验是否存在 Cordova 插件和方法,该方面不能直接检查 SDK 的方法,需要使用原始 Cordova 接口文档的接口命名参数。 12 | * @param {ConfigOptions} [options] 13 | * @module config 14 | * @returns {CommonApiRes} 15 | */ 16 | export default function checkApi(options: CheckApiOptions): Promise; 17 | -------------------------------------------------------------------------------- /dist/config/ready.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 鉴权 ready 7 | * @description 返回当前鉴权状态, 让前端用以判断是否可以正常调用方法 8 | * @param {callback} [options] 9 | * @module config 10 | * @returns {ConfigAuthRes} 11 | */ 12 | function ready(callback) { 13 | return core.exec(constants_1.WORKPLUS_CONFIG, 'ready', [], function (res) { 14 | core.logger.warn('SDK 已就绪!(ready 事件被触发)'); 15 | callback(res); 16 | }, function () { }, false); 17 | } 18 | exports.default = ready; 19 | -------------------------------------------------------------------------------- /modules/file/index.ts: -------------------------------------------------------------------------------- 1 | import chooseFiles from './chooseFiles'; 2 | import isFileExist from './isFileExist'; 3 | import openFileDetail from './openFileDetail'; 4 | import readFile from './readFile'; 5 | import download from './download'; 6 | import upload from './upload'; 7 | import getFilePath from './getUserFilePath'; 8 | 9 | export default { 10 | /** 选择文件 */ 11 | chooseFiles, 12 | /** 判断文件是否存在 */ 13 | isFileExist, 14 | /** 打开文件详情 */ 15 | openFileDetail, 16 | /** 本地打开文件 */ 17 | readFile, 18 | /** 文件下载 */ 19 | download, 20 | /** 文件上传 */ 21 | upload, 22 | /** 获取文件目录 */ 23 | getFilePath, 24 | }; 25 | -------------------------------------------------------------------------------- /dist/config/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * SDK 鉴权 7 | * @description 所有接口都需要先经过鉴权才能够使用 8 | * @param {ConfigOptions} [options] 9 | * @module config 10 | * @returns {ConfigAuthRes} 11 | */ 12 | function config(options) { 13 | return core.exec(constants_1.WORKPLUS_CONFIG, 'config', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 14 | } 15 | exports.default = config; 16 | -------------------------------------------------------------------------------- /dist/location/getLocation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取定位信息 7 | * @description 返回手机设备当前的地理位置信息 8 | * @param {LocationOptions} [options] 9 | * @module location 10 | * @returns 定位信息 11 | */ 12 | function getLocation(options) { 13 | return core.exec(constants_1.WORKPLUS_LOCATION, 'getLocation', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getLocation; 16 | -------------------------------------------------------------------------------- /dist/webview/launchMiniProgram.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | export interface LaunchMiniProgramParams { 3 | user_name: string; 4 | path: string; 5 | miniprogram_type: 0 | 1 | 2; 6 | } 7 | export declare type LaunchMiniProgramOptions = LaunchMiniProgramParams & ExecOptions; 8 | /** 9 | * 调用小程序 10 | * @description 该接口用来调用小程序,获取小程序返回信息 11 | * @param {LaunchMiniProgramOptions} [options] 12 | * @module webview 13 | * @returns 无 14 | */ 15 | declare function launchMiniProgram(options: LaunchMiniProgramOptions): Promise; 16 | export default launchMiniProgram; 17 | -------------------------------------------------------------------------------- /dist/device/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var getDeviceInfo_1 = require("./getDeviceInfo"); 4 | var getIpAddress_1 = require("./getIpAddress"); 5 | var getPedometerData_1 = require("./getPedometerData"); 6 | var getAppInfo_1 = require("./getAppInfo"); 7 | exports.default = { 8 | /** 获取设备信息 */ 9 | getDeviceInfo: getDeviceInfo_1.default, 10 | /** 获取 IP 地址 */ 11 | getIpAddress: getIpAddress_1.default, 12 | /** 获取运动数据 */ 13 | getPedometerData: getPedometerData_1.default, 14 | /** 获取 App 信息 */ 15 | getAppInfo: getAppInfo_1.default, 16 | }; 17 | -------------------------------------------------------------------------------- /dist/session/openDiscussionById.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 通过群组id打开该群组的聊天页面,并且可以自定义发送应用所支持的消息 7 | * 8 | * @export 9 | * @param {OpenDiscussionByIdParams} [options] 10 | * @returns {Promise} 11 | */ 12 | function openDiscussionById(options) { 13 | if (!core.isPCPlatform) { 14 | delete options.newWindow; 15 | } 16 | return core.execSync(constants_1.WORKPLUS_CONTACT, 'openDiscussionById', [options]); 17 | } 18 | exports.default = openDiscussionById; 19 | -------------------------------------------------------------------------------- /dist/util/generateQrcode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 生成条形码 7 | * @param {GenerateQrcodeParams} [options] 8 | * @module util 9 | * @returns {Promise} 10 | */ 11 | function generateQrcode(options) { 12 | return core.exec(constants_1.WORKPLUS_SCAN, 'generateQrcode', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = generateQrcode; 15 | -------------------------------------------------------------------------------- /modules/header/rightButtons.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { ButtonsItem } from '../types/webview'; 4 | 5 | export interface RightButtonsOptions { 6 | /** 右侧按钮列表 */ 7 | items: ButtonsItem[][]; 8 | } 9 | 10 | /** 11 | * 更换右侧按钮动作 12 | * @description 设置右侧按钮的选项 13 | * @param {RightButtonsOptions} options 14 | * @module webview 15 | * @returns 无 16 | */ 17 | function rightButtons(options: RightButtonsOptions): void { 18 | return core.execSync(WORKPLUS_WEBVIEW, 'rightButtons', options.items); 19 | } 20 | 21 | export default rightButtons; 22 | -------------------------------------------------------------------------------- /dist/auth/getUserTicket.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取临时ticket 7 | * @description 为当前登录用户获取一个临时性的ticket 8 | * @param {UserTicketOptions} [options] 9 | * @module auth 10 | * @returns ticket 11 | */ 12 | function getUserTicket(options) { 13 | return core.exec(constants_1.WORKPLUS_AUTH, 'getUserTicket', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getUserTicket; 16 | -------------------------------------------------------------------------------- /dist/device/getIpAddress.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取IP地址 7 | * @description 获取当前连接状态下的IP地址 8 | * @param {DeviceOptions<[], IpAddressRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | function getIpAddress(options) { 12 | return core.exec(constants_1.WORKPLUS_DEVICE, 'getIpAddress', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 13 | } 14 | exports.default = getIpAddress; 15 | -------------------------------------------------------------------------------- /dist/record/translateAudio.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * @description 音频转mp3格式 7 | * @param {Options} options 8 | * @module record 9 | * @returns {voiceRecordRes} 10 | */ 11 | function translateAudio(options) { 12 | return core.exec(constants_1.WORKPLUS_AUDIO_AND_VIDEO, 'translateAudio', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = translateAudio; 15 | -------------------------------------------------------------------------------- /dist/auth/getServerInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取当前app请求后台api地址 7 | * @description 获取当前app请求后台api地址 8 | * @param {ServerInfoOptions} [options] 9 | * @module auth 10 | * @returns api_url 11 | */ 12 | function getServerInfo(options) { 13 | return core.exec(constants_1.WORKPLUS_AUTH, 'getServerInfo', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getServerInfo; 16 | -------------------------------------------------------------------------------- /dist/device/getAppInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取设备信息 7 | * @description 获取当前设备和 APP 的一些信息 8 | * @param {DeviceOptions<[], AppInfoRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | function getDeviceInfo(options) { 12 | return core.exec(constants_1.WORKPLUS_PUBLIC_CLOUND, 'getAppInfo', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 13 | } 14 | exports.default = getDeviceInfo; 15 | -------------------------------------------------------------------------------- /dist/import-cordova/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var utils_1 = require("./utils"); 4 | var cordovaImportInstance_1 = require("./cordovaImportInstance"); 5 | function cordovaImportInit(options, useHttp) { 6 | try { 7 | if (!utils_1.inWorkPlus()) 8 | return; 9 | var lib = new cordovaImportInstance_1.default(options, useHttp); 10 | var importUri = lib.getImportUri(); 11 | utils_1.scriptGenerator(importUri); 12 | } 13 | catch (error) { 14 | console.log(error); 15 | } 16 | } 17 | exports.default = cordovaImportInit; 18 | -------------------------------------------------------------------------------- /dist/util/generateBarcode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 生成条形码 7 | * @param {GenerateBarcodeParams} [options] 8 | * @module util 9 | * @returns {Promise} 10 | */ 11 | function generateBarcode(options) { 12 | return core.exec(constants_1.WORKPLUS_SCAN, 'generateBarcode', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = generateBarcode; 15 | -------------------------------------------------------------------------------- /dist/util/voiceToText.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 语音转文本 7 | * @description 语音转文本 8 | * @param {VoiceToTextOptions} [options] 9 | * @module webview 10 | * @returns {Promise} 11 | */ 12 | function voiceToText(options) { 13 | return core.exec(constants_1.WORKPLUS_WEBVIEW, 'voiceToText', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 14 | } 15 | exports.default = voiceToText; 16 | -------------------------------------------------------------------------------- /dist/video/startVideoRecoder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * @description 视频录制 7 | * @param {Options} options 8 | * @module video 9 | * @returns {voiceRecordRes} 10 | */ 11 | function startVideoRecoder(options) { 12 | return core.exec(constants_1.WORKPLUS_AUDIO_AND_VIDEO, 'startVideoRecoder', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 13 | } 14 | exports.default = startVideoRecoder; 15 | -------------------------------------------------------------------------------- /modules/header/changeLeftButton.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | import { ButtonsItem } from '../types/webview'; 4 | 5 | export interface ChangeLeftButtonOptions { 6 | items: ButtonsItem[]; 7 | } 8 | 9 | /** 10 | * 更换左侧按钮和定义动作 11 | * @description 设置左侧按钮的选项 12 | * @param {ChangeLeftButtonOptions} options 13 | * @module webview 14 | * @returns 无 15 | */ 16 | function changeLeftButton(options: ChangeLeftButtonOptions): void { 17 | return core.execSync(WORKPLUS_WEBVIEW, 'changeLeftButton', [options.items]); 18 | } 19 | 20 | export default changeLeftButton; 21 | -------------------------------------------------------------------------------- /modules/session/openDiscussionById.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { OpenDiscussionByIdParams } from '../types/contact'; 3 | 4 | import { WORKPLUS_CONTACT } from '../constants'; 5 | 6 | /** 7 | * 通过群组id打开该群组的聊天页面,并且可以自定义发送应用所支持的消息 8 | * 9 | * @export 10 | * @param {OpenDiscussionByIdParams} [options] 11 | * @returns {Promise} 12 | */ 13 | export default function openDiscussionById(options: OpenDiscussionByIdParams): void { 14 | if (!core.isPCPlatform) { 15 | delete options.newWindow; 16 | } 17 | return core.execSync(WORKPLUS_CONTACT, 'openDiscussionById', [options]); 18 | } 19 | -------------------------------------------------------------------------------- /dist/contact/getMobileContacts.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取手机通讯录联系人的列表 7 | * 8 | * @export 9 | * @param {ContactOption<[], unknown>} [options] 10 | * @returns {Promise} 11 | */ 12 | function getMobileContacts(options) { 13 | return core.exec(constants_1.WORKPLUS_CONTACT, 'getMobileContacts', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getMobileContacts; 16 | -------------------------------------------------------------------------------- /dist/device/getDeviceInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取设备信息 7 | * @description 获取当前设备和 APP 的一些信息 8 | * @param {DeviceOptions<[], DeviceInfoRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | function getDeviceInfo(options) { 12 | return core.exec(constants_1.WORKPLUS_DEVICE, 'getDeviceInfo', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 13 | } 14 | exports.default = getDeviceInfo; 15 | -------------------------------------------------------------------------------- /dist/dialog/modal.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showModal = void 0; 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * Modal 8 | * @description 弹出确认框,可以只定义标题和按钮 9 | * @param {Options} 10 | * @module dialog 11 | * @returns {ModalRes} 12 | */ 13 | function showModal(options) { 14 | return core.exec(constants_1.WORKPLUS_DIALOG, 'showModal', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 15 | } 16 | exports.showModal = showModal; 17 | -------------------------------------------------------------------------------- /dist/eventlistener/bind.d.ts: -------------------------------------------------------------------------------- 1 | import { CordovaListener } from '../types/eventlistener'; 2 | /** 3 | * 添加Cordova监听事件 4 | * @param {CordovaListener} type 5 | * @param {(ev: Event) => {}} listener 6 | * @param {boolean} [useCapture] 7 | */ 8 | export declare function on(type: CordovaListener, listener: (ev: Event) => {}, useCapture?: boolean): void; 9 | /** 10 | * 取消Cordova监听事件 11 | * @export 12 | * @param {CordovaListener} type 13 | * @param {(ev: Event) => {}} listener 14 | * @param {boolean} [useCapture] 15 | */ 16 | export declare function off(type: CordovaListener, listener: (ev: Event) => {}, useCapture?: boolean): void; 17 | -------------------------------------------------------------------------------- /dist/eventlog/getTodayUseDuration.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取当前登陆用户今天在线时长 7 | * @param {EventlogOptions} [options] 8 | * @returns {Promise} 9 | */ 10 | function getTodayUseDuration(options) { 11 | return core.exec(constants_1.WORKPLUS_EVENTLOG, 'getTodayUseDuration', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 12 | } 13 | exports.default = getTodayUseDuration; 14 | -------------------------------------------------------------------------------- /dist/network/getWifiInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取当前连接Wifi信息 7 | * @description 获取当前连接Wifi信息, 包括 bssid, 名字等 8 | * @param {GetWifiOptions>} [options] 9 | * @module network 10 | * @returns 当前连接的Wifi信息 11 | */ 12 | function getWifiInfo(options) { 13 | return core.exec(constants_1.WORKPLUS_NETINFO, 'getWifiInfo', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = getWifiInfo; 16 | -------------------------------------------------------------------------------- /modules/device/getIpAddress.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DEVICE } from '../constants'; 3 | import { DeviceOptions, IpAddressRes } from '../types/device'; 4 | 5 | /** 6 | * 获取IP地址 7 | * @description 获取当前连接状态下的IP地址 8 | * @param {DeviceOptions<[], IpAddressRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function getIpAddress( 12 | options?: DeviceOptions<[], IpAddressRes>, 13 | ): Promise { 14 | return core.exec<[], IpAddressRes, never>( 15 | WORKPLUS_DEVICE, 16 | 'getIpAddress', 17 | [], 18 | options?.success, 19 | options?.fail, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /dist/image/takePicture.d.ts: -------------------------------------------------------------------------------- 1 | import { PhotoInfoAndMediaId } from '../types/image'; 2 | import { ExecOptions } from '../types/core'; 3 | export interface PictureOptions extends ExecOptions { 4 | /** 返回是否进行裁剪: true 裁剪 false 不裁剪 */ 5 | editable?: boolean; 6 | } 7 | /** 8 | * 调起拍照,返回mediaId的图片 9 | * @description 拍照返回,根据传入参数决定是否可以进行裁剪编辑, 同时会将图片上传后台,返回mediaId 10 | * @param {PictureOptions} options 11 | * @module image 12 | * @version 3.1.3以上版本支持 13 | * @returns 带有mediaId的图片信息 14 | */ 15 | declare function takePicture(options?: PictureOptions): Promise; 16 | export default takePicture; 17 | -------------------------------------------------------------------------------- /modules/device/getAppInfo.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_PUBLIC_CLOUND } from '../constants'; 3 | import { DeviceOptions, AppInfoRes } from '../types/device'; 4 | 5 | /** 6 | * 获取设备信息 7 | * @description 获取当前设备和 APP 的一些信息 8 | * @param {DeviceOptions<[], AppInfoRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function getDeviceInfo( 12 | options?: DeviceOptions<[], AppInfoRes>, 13 | ): Promise { 14 | return core.exec<[], AppInfoRes, never>( 15 | WORKPLUS_PUBLIC_CLOUND, 16 | 'getAppInfo', 17 | [], 18 | options?.success, 19 | options?.fail, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "moduleResolution": "node", 5 | "target": "es5", 6 | "module": "es2015", 7 | "lib": ["es2015", "es2016", "es2017", "dom"], 8 | "strict": true, 9 | "noImplicitAny": true, 10 | "sourceMap": false, 11 | "allowSyntheticDefaultImports": true, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata": true, 14 | "typeRoots": ["../node_modules/@types", "./**/*/typings"], 15 | "paths": { 16 | "tslib": ["../node_modules/tslib/tslib.d.ts"] 17 | } 18 | }, 19 | "include": ["**/*.ts", "**/*.tsx", "./**/*/typings"] 20 | } 21 | -------------------------------------------------------------------------------- /release_note/RELEASE_NOTE_2.0.3.md: -------------------------------------------------------------------------------- 1 | ## [2.0.3](https://github.com/WorkPlusFE/js-sdk/compare/v2.0.2...v2.0.3) (2024-10-18) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * 调整pc端掉用代码 ([f6bbb7d](https://github.com/WorkPlusFE/js-sdk/commit/f6bbb7d8efc2ddefe5de44f95d8a77bd44872402)) 7 | * 添加新窗口打开参数 ([6b56d78](https://github.com/WorkPlusFE/js-sdk/commit/6b56d78b693bac876faceaca787f51611e7888f9)) 8 | * pc例子添加 ([19d7c6a](https://github.com/WorkPlusFE/js-sdk/commit/19d7c6a1b5187b2b35103b56515cb65319bff46d)) 9 | 10 | 11 | ### Features 12 | 13 | * 调整平台api定义 ([5e08d12](https://github.com/WorkPlusFE/js-sdk/commit/5e08d12308a220f82825a7ef3f1d457239b3b140)) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /example-pc/src/api/index.ts: -------------------------------------------------------------------------------- 1 | import Session from './session'; 2 | import Contact from './contact'; 3 | import Device from './device'; 4 | import Image from './image'; 5 | import Auth from './auth'; 6 | import User from './user'; 7 | 8 | 9 | interface ApiModule { 10 | title: string; 11 | module: string; 12 | active: boolean; 13 | icon: string; 14 | apis: ApiItem[]; 15 | } 16 | 17 | interface ApiItem { 18 | title: string; 19 | action: string; 20 | description: string; 21 | params: Common.PlainObject; 22 | } 23 | 24 | export default [ 25 | Auth, 26 | User, 27 | Contact, 28 | Session, 29 | Image, 30 | Device, 31 | ] as ApiModule[]; 32 | -------------------------------------------------------------------------------- /dist/dialog/popNotification.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.popNotification = void 0; 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * @description 消息通知 8 | * @param {Options} 9 | * @module dialog 10 | * @returns {PopNotificationRes} 11 | */ 12 | function popNotification(options) { 13 | return core.exec(constants_1.WORKPLUS_NOTIFICATION, 'pop', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 14 | } 15 | exports.popNotification = popNotification; 16 | -------------------------------------------------------------------------------- /modules/device/getDeviceInfo.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DEVICE } from '../constants'; 3 | import { DeviceOptions, DeviceInfoRes } from '../types/device'; 4 | 5 | /** 6 | * 获取设备信息 7 | * @description 获取当前设备和 APP 的一些信息 8 | * @param {DeviceOptions<[], DeviceInfoRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function getDeviceInfo( 12 | options?: DeviceOptions<[], DeviceInfoRes>, 13 | ): Promise { 14 | return core.exec<[], DeviceInfoRes, never>( 15 | WORKPLUS_DEVICE, 16 | 'getDeviceInfo', 17 | [], 18 | options?.success, 19 | options?.fail, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /modules/util/vibrate.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DEVICE } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { VibrateRes } from '../types/util'; 5 | 6 | export type Options = ExecOptions; 7 | 8 | /** 9 | * 震动 10 | * @param {} [options] 11 | * @module util 12 | * @returns {Promise} 13 | */ 14 | function vibrate(options?: Options): Promise { 15 | return core.exec( 16 | WORKPLUS_DEVICE, 17 | 'vibrate', 18 | [], 19 | options?.success, 20 | options?.fail, 21 | false, 22 | ); 23 | } 24 | 25 | export default vibrate; 26 | -------------------------------------------------------------------------------- /dist/config/checkApi.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 接口检测 7 | * @description 检验是否存在 Cordova 插件和方法,该方面不能直接检查 SDK 的方法,需要使用原始 Cordova 接口文档的接口命名参数。 8 | * @param {ConfigOptions} [options] 9 | * @module config 10 | * @returns {CommonApiRes} 11 | */ 12 | function checkApi(options) { 13 | return core.exec(constants_1.WORKPLUS_CONFIG, 'checkApi', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = checkApi; 16 | -------------------------------------------------------------------------------- /dist/dialog/inputView.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showInputView = void 0; 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * inputView 8 | * @description 弹出带输入框的确认弹窗,可以传入默认值 9 | * @param {Options} 10 | * @module dialog 11 | * @returns {ModalRes} 12 | */ 13 | function showInputView(options) { 14 | return core.exec(constants_1.WORKPLUS_DIALOG, 'showInputView', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 15 | } 16 | exports.showInputView = showInputView; 17 | -------------------------------------------------------------------------------- /dist/eventlistener/messageChannel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.bindMessageChannel = void 0; 4 | var core_1 = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * 页面事件监听 8 | * @description ios/android 统一 resume/pause/back 事件的监听方式 9 | */ 10 | function bindMessageChannel(callback) { 11 | core_1.deviceready().then(function () { 12 | cordova.exec(function (result) { 13 | callback && callback(result); 14 | }, function () { }, constants_1.WORKPLUS_WEBVIEW, 'messageChannel', []); 15 | }); 16 | } 17 | exports.bindMessageChannel = bindMessageChannel; 18 | -------------------------------------------------------------------------------- /dist/import-cordova/utils.d.ts: -------------------------------------------------------------------------------- 1 | import { ImportCordovaConfig, Platform } from '../types/import-cordova'; 2 | export declare const isHttpsProtocol: () => boolean; 3 | export declare const inIframe: () => boolean; 4 | export declare const isiOSPlatform: (userAgent: string) => boolean; 5 | export declare const isAndroidPlatform: (userAgent: string) => boolean; 6 | export declare const isX5Webview: (userAgent?: string | undefined) => boolean; 7 | export declare const getCordovaJsUriByPlatform: (config: ImportCordovaConfig, platform: Platform) => string; 8 | export declare const inWorkPlus: () => boolean; 9 | export declare const scriptGenerator: (uri: string) => void; 10 | -------------------------------------------------------------------------------- /dist/session/createDiscussionChat.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 通过调用原生选人界面,选择人员,创建群组,并且返回相关群组信息 7 | * 8 | * @export 9 | * @param {boolean} [newWindow] 仅对 PC 客户端有效 10 | * @returns {void} 11 | */ 12 | function createDiscussionChat(_a) { 13 | var newWindow = _a.newWindow; 14 | var options = core.isPCPlatform && typeof newWindow !== 'undefined' ? [{ newWindow: newWindow }] : []; 15 | return core.execSync(constants_1.WORKPLUS_CONTACT, 'createDiscussionChat', options); 16 | } 17 | exports.default = createDiscussionChat; 18 | -------------------------------------------------------------------------------- /dist/device/getPedometerData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 获取设备的运动数据 7 | * @description 获取设备当天凌晨0点至当前时间的运动数据 (从版本3.12.1起提供) 8 | * @param {DeviceOptions<[], PedometerDataRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | function getPedometerData(options) { 12 | return core.exec(constants_1.WORKPLUS_DEVICE, 'getPedometerData', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 13 | } 14 | exports.default = getPedometerData; 15 | -------------------------------------------------------------------------------- /dist/image/chooseImages.d.ts: -------------------------------------------------------------------------------- 1 | import { ExecOptions } from '../types/core'; 2 | import { PhotoInfoAndMediaId, ChooseImages } from '../types/image'; 3 | export declare type ChooseImagesOptions = ChooseImages & ExecOptions; 4 | /** 5 | * 调用图片相册,选择图片 6 | * @description 调用图片相册,根据用户参数决定是否选择多张图片或单张图片, 7 | * 支持编辑剪裁(编辑剪裁功能仅仅限于单张图片功能),并且支持选过图片的传输, 8 | * 选择完后会进行后台上传,返回值中带有上传后的mediaId 9 | * @param {ChooseImagesOptions>} options 10 | * @module image 11 | * @version 3.1.3版本以上 12 | * @returns 带有mediaId的图片信息 13 | */ 14 | declare function chooseImages(options?: ChooseImagesOptions): Promise; 15 | export default chooseImages; 16 | -------------------------------------------------------------------------------- /dist/auth/biometric.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 生物认证 7 | * @description 需要设备具备指纹或者FACE_ID解锁功能,解锁后触发回调,适用于对安全性要求较高的操作。 8 | * @param {BiometricOptions} [options] 9 | * @module auth 10 | * @version 3.15.0 11 | * @returns code 12 | */ 13 | function biometric(options) { 14 | return core.exec(constants_1.WORKPLUS_LIGHT_APP, 'routeBiometricAuthenticationLock', [], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 15 | } 16 | exports.default = biometric; 17 | -------------------------------------------------------------------------------- /dist/network/assembleAuthUrl.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * url 鉴权处理 7 | * @description 该接口主要用于 url 做签名参数处理, 使 WorkPlus 平台的 url 可以合法访问。 8 | * @param {AssembleAuthUrlParams} [options] 9 | * @module network 10 | * @returns 转换后的链接 11 | */ 12 | function assembleAuthUrl(options) { 13 | return core.exec(constants_1.WORKPLUS_NETWORK, 'assembleAuthUrl', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail); 14 | } 15 | exports.default = assembleAuthUrl; 16 | -------------------------------------------------------------------------------- /dist/network/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.assembleAuthUrl = exports.authRequest = exports.request = exports.getWifiInfo = void 0; 4 | var getWifiInfo_1 = require("./getWifiInfo"); 5 | exports.getWifiInfo = getWifiInfo_1.default; 6 | var request_1 = require("./request"); 7 | Object.defineProperty(exports, "request", { enumerable: true, get: function () { return request_1.request; } }); 8 | Object.defineProperty(exports, "authRequest", { enumerable: true, get: function () { return request_1.authRequest; } }); 9 | var assembleAuthUrl_1 = require("./assembleAuthUrl"); 10 | exports.assembleAuthUrl = assembleAuthUrl_1.default; 11 | -------------------------------------------------------------------------------- /modules/eventlistener/messageChannel.ts: -------------------------------------------------------------------------------- 1 | import { deviceready } from '../core'; 2 | import { WORKPLUS_WEBVIEW } from '../constants'; 3 | 4 | export interface ChanelActionResType { 5 | /** 返回的事件类型 */ 6 | action: 'pause' | 'resume' | 'back'; 7 | } 8 | 9 | /** 10 | * 页面事件监听 11 | * @description ios/android 统一 resume/pause/back 事件的监听方式 12 | */ 13 | export function bindMessageChannel(callback: Function): void { 14 | deviceready().then(() => { 15 | cordova.exec( 16 | (result: ChanelActionResType) => { 17 | callback && callback(result); 18 | }, 19 | () => {}, 20 | WORKPLUS_WEBVIEW, 21 | 'messageChannel', 22 | [], 23 | ); 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /modules/eventlog/getTodayUseDuration.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_EVENTLOG } from '../constants'; 3 | import { EventlogOptions, TodayUseDurationRes } from '../types/eventlog'; 4 | 5 | /** 6 | * 获取当前登陆用户今天在线时长 7 | * @param {EventlogOptions} [options] 8 | * @returns {Promise} 9 | */ 10 | export default function getTodayUseDuration( 11 | options?: EventlogOptions, 12 | ): Promise { 13 | return core.exec<[], TodayUseDurationRes, unknown>( 14 | WORKPLUS_EVENTLOG, 15 | 'getTodayUseDuration', 16 | [], 17 | options?.success, 18 | options?.fail, 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /dist/dialog/actionSheet.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showActionSheet = void 0; 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * ActionSheet 8 | * @description 弹出 ActionSheet,可以自定义每个item的名字 9 | * @param {Options} 10 | * @module dialog 11 | * @returns {ActionSheetRes} 12 | */ 13 | function showActionSheet(options) { 14 | return core.exec(constants_1.WORKPLUS_DIALOG, 'showActionSheet', [options], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 15 | } 16 | exports.showActionSheet = showActionSheet; 17 | -------------------------------------------------------------------------------- /modules/config/ready.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_CONFIG } from '../constants'; 3 | import { ConfigAuthRes } from '../types/config'; 4 | 5 | /** 6 | * 鉴权 ready 7 | * @description 返回当前鉴权状态, 让前端用以判断是否可以正常调用方法 8 | * @param {callback} [options] 9 | * @module config 10 | * @returns {ConfigAuthRes} 11 | */ 12 | export default function ready(callback: Function): Promise { 13 | return core.exec<[], ConfigAuthRes, ConfigAuthRes>( 14 | WORKPLUS_CONFIG, 15 | 'ready', 16 | [], 17 | (res: ConfigAuthRes) => { 18 | core.logger.warn('SDK 已就绪!(ready 事件被触发)'); 19 | callback(res); 20 | }, 21 | () => {}, 22 | false, 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /dist/app/showAppChatViewById.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 通过应用id和orgId的,打开改组织下某个应用聊天界面 7 | * 8 | * @export 9 | * @param {ShowAppChatView} [options] 10 | * @returns {void} 11 | */ 12 | function showAppChatViewById(options) { 13 | var args = { 14 | app_id: options.appId, 15 | domain_id: options.domainId, 16 | org_id: options.orgId, 17 | session_type: options.sessionType, 18 | }; 19 | return core.execSync(constants_1.WORKPLUS_CONTACT, 'showAppChatView', [args]); 20 | } 21 | exports.default = showAppChatViewById; 22 | -------------------------------------------------------------------------------- /dist/file/upload.d.ts: -------------------------------------------------------------------------------- 1 | import { FileTransfer, FileUploadOptions, FileUploadResult } from '../types/cordova-plugin-file'; 2 | interface UploadOptions { 3 | fileURL: string; 4 | server: string; 5 | success?: Function; 6 | fail?: Function; 7 | progress?: Function; 8 | trustAllHosts?: boolean; 9 | } 10 | declare let FileTransfer: { 11 | new (): FileTransfer; 12 | }; 13 | declare class FileUpload { 14 | fileTransferInstance: FileTransfer; 15 | fileUploadOptions: FileUploadOptions; 16 | constructor(options: FileUploadOptions); 17 | upload(options: UploadOptions): Promise; 18 | abort(): void; 19 | } 20 | export default FileUpload; 21 | -------------------------------------------------------------------------------- /modules/device/getPedometerData.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DEVICE } from '../constants'; 3 | import { DeviceOptions, PedometerDataRes } from '../types/device'; 4 | 5 | /** 6 | * 获取设备的运动数据 7 | * @description 获取设备当天凌晨0点至当前时间的运动数据 (从版本3.12.1起提供) 8 | * @param {DeviceOptions<[], PedometerDataRes>} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function getPedometerData( 12 | options?: DeviceOptions<[], PedometerDataRes>, 13 | ): Promise { 14 | return core.exec<[], PedometerDataRes, never>( 15 | WORKPLUS_DEVICE, 16 | 'getPedometerData', 17 | [], 18 | options?.success, 19 | options?.fail, 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /modules/dialog/modal.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DIALOG } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { ModalParams, ModalRes } from '../types/dialog'; 5 | 6 | export type Options = ModalParams & ExecOptions; 7 | 8 | /** 9 | * Modal 10 | * @description 弹出确认框,可以只定义标题和按钮 11 | * @param {Options} 12 | * @module dialog 13 | * @returns {ModalRes} 14 | */ 15 | export function showModal(options: Options): Promise { 16 | return core.exec( 17 | WORKPLUS_DIALOG, 18 | 'showModal', 19 | [options], 20 | options?.success, 21 | options?.fail, 22 | false, 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /modules/dialog/loading.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DIALOG } from '../constants'; 3 | 4 | export interface LoadingParams { 5 | /** loading的描述文字,非必需 */ 6 | title?: string; 7 | /** 锁住屏幕,默认为 false */ 8 | block?: boolean; 9 | } 10 | 11 | /** 12 | * Loading 13 | * @description 显示 loading 提示框,可以添加文本 14 | * @param LoadingParams 15 | * @module dialog 16 | * @returns 无 17 | */ 18 | function showLoading(options?: LoadingParams): void { 19 | return core.execSync(WORKPLUS_DIALOG, 'showLoading', [{ ...options }]); 20 | } 21 | 22 | function hideLoading(): void { 23 | return core.execSync(WORKPLUS_DIALOG, 'hideLoading', []); 24 | } 25 | 26 | export { showLoading, hideLoading }; 27 | -------------------------------------------------------------------------------- /modules/record/voiceRecord.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_AUDIO_AND_VIDEO } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { VoiceRecordRes } from '../types/record'; 5 | 6 | export type Options = ExecOptions; 7 | 8 | /** 9 | * @description 语音录制 10 | * @param {Options} options 11 | * @module record 12 | * @returns {voiceRecordRes} 13 | */ 14 | export default function voiceRecord(options: Options): Promise { 15 | return core.exec<[], VoiceRecordRes, void>( 16 | WORKPLUS_AUDIO_AND_VIDEO, 17 | 'voiceRecord', 18 | [], 19 | options?.success, 20 | options?.fail, 21 | false, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /modules/auth/getTenantID.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_AUTH } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { GetTenantIDRes } from '../types/auth'; 5 | 6 | export type TenantIdOptions = ExecOptions; 7 | 8 | /** 9 | * 获取当前租户id,即域id 10 | * @description 获取当前租户id,即域id 11 | * @param {TenantIdOptions} [options] 12 | * @module auth 13 | * @returns 域ID 14 | */ 15 | export default function getTenantID(options?: TenantIdOptions): Promise { 16 | return core.exec( 17 | WORKPLUS_AUTH, 18 | 'getTenantID', 19 | [], 20 | options?.success, 21 | options?.fail, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /modules/location/getLocation.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_LOCATION } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { LocationRes } from '../types/location'; 5 | 6 | export type LocationOptions = ExecOptions; 7 | 8 | /** 9 | * 获取定位信息 10 | * @description 返回手机设备当前的地理位置信息 11 | * @param {LocationOptions} [options] 12 | * @module location 13 | * @returns 定位信息 14 | */ 15 | export default function getLocation(options?: LocationOptions): Promise { 16 | return core.exec<[], LocationRes, void>( 17 | WORKPLUS_LOCATION, 18 | 'getLocation', 19 | [], 20 | options?.success, 21 | options?.fail, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /modules/app/showAppChatViewById.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { ShowAppChatViewParams, ShowAppChatView } from '../types/contact'; 3 | import { WORKPLUS_CONTACT } from '../constants'; 4 | 5 | /** 6 | * 通过应用id和orgId的,打开改组织下某个应用聊天界面 7 | * 8 | * @export 9 | * @param {ShowAppChatView} [options] 10 | * @returns {void} 11 | */ 12 | export default function showAppChatViewById(options: ShowAppChatView): void { 13 | const args: ShowAppChatViewParams = { 14 | app_id: options.appId, 15 | domain_id: options.domainId, 16 | org_id: options.orgId, 17 | session_type: options.sessionType, 18 | }; 19 | return core.execSync(WORKPLUS_CONTACT, 'showAppChatView', [args]); 20 | } 21 | -------------------------------------------------------------------------------- /modules/dialog/inputView.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_DIALOG } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { ModalParams, ModalRes } from '../types/dialog'; 5 | 6 | export type Options = ModalParams & ExecOptions; 7 | 8 | /** 9 | * inputView 10 | * @description 弹出带输入框的确认弹窗,可以传入默认值 11 | * @param {Options} 12 | * @module dialog 13 | * @returns {ModalRes} 14 | */ 15 | export function showInputView(options: Options): Promise { 16 | return core.exec( 17 | WORKPLUS_DIALOG, 18 | 'showInputView', 19 | [options], 20 | options?.success, 21 | options?.fail, 22 | false, 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /dist/pay/wxPay.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // This file is auto gererated by scripts/create-api.js 4 | var core = require("../core"); 5 | var constants_1 = require("../constants"); 6 | /** 7 | * 微信支付 8 | * @description 提供微信支付的能力。 9 | * @param {WxPay>} options 10 | * @module wxPay 11 | */ 12 | function wxPay(options) { 13 | var args = { 14 | app_id: options.appId, 15 | request_data: options.requestData, 16 | }; 17 | return core.exec(constants_1.WORKPLUS_PAY, 'wxPay', [args], options === null || options === void 0 ? void 0 : options.success, options === null || options === void 0 ? void 0 : options.fail, false); 18 | } 19 | exports.default = wxPay; 20 | -------------------------------------------------------------------------------- /example/src/api/notification.ts: -------------------------------------------------------------------------------- 1 | // 提示框 2 | 3 | export default { 4 | title: '* 通知', 5 | module: 'notification', 6 | active: false, 7 | icon: 'photo-o', 8 | apis: [{ 9 | title: 'Toast', 10 | description: '', 11 | action: 'toast', 12 | params: {}, 13 | }, { 14 | title: 'Loading', 15 | description: '', 16 | action: 'loading', 17 | params: {}, 18 | }, { 19 | title: 'Alert', 20 | description: '', 21 | action: 'alert', 22 | params: {}, 23 | }, { 24 | title: 'Confirm', 25 | description: '', 26 | action: 'confirm', 27 | params: {}, 28 | }, { 29 | title: 'Action Sheet', 30 | description: '', 31 | action: 'actionSheet', 32 | params: {}, 33 | }], 34 | }; 35 | -------------------------------------------------------------------------------- /modules/auth/getServerInfo.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_AUTH } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { GetServerInfoRes } from '../types/auth'; 5 | 6 | export type ServerInfoOptions = ExecOptions; 7 | 8 | /** 9 | * 获取当前app请求后台api地址 10 | * @description 获取当前app请求后台api地址 11 | * @param {ServerInfoOptions} [options] 12 | * @module auth 13 | * @returns api_url 14 | */ 15 | export default function getServerInfo(options?: ServerInfoOptions): Promise { 16 | return core.exec<[], GetServerInfoRes, void>( 17 | WORKPLUS_AUTH, 18 | 'getServerInfo', 19 | [], 20 | options?.success, 21 | options?.fail, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /modules/auth/getUserTicket.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_AUTH } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { GetUserTicketRes } from '../types/auth'; 5 | 6 | export type UserTicketOptions = ExecOptions; 7 | 8 | /** 9 | * 获取临时ticket 10 | * @description 为当前登录用户获取一个临时性的ticket 11 | * @param {UserTicketOptions} [options] 12 | * @module auth 13 | * @returns ticket 14 | */ 15 | export default function getUserTicket(options?: UserTicketOptions): Promise { 16 | return core.exec<[], GetUserTicketRes, void>( 17 | WORKPLUS_AUTH, 18 | 'getUserTicket', 19 | [], 20 | options?.success, 21 | options?.fail, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /modules/network/getWifiInfo.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { ExecOptions } from '../types/core'; 3 | import { WifiRes } from '../types/network'; 4 | import { WORKPLUS_NETINFO } from '../constants'; 5 | 6 | export type GetWifiOptions = ExecOptions; 7 | 8 | /** 9 | * 获取当前连接Wifi信息 10 | * @description 获取当前连接Wifi信息, 包括 bssid, 名字等 11 | * @param {GetWifiOptions>} [options] 12 | * @module network 13 | * @returns 当前连接的Wifi信息 14 | */ 15 | function getWifiInfo(options?: GetWifiOptions): Promise { 16 | return core.exec<[], WifiRes, void>( 17 | WORKPLUS_NETINFO, 18 | 'getWifiInfo', 19 | [], 20 | options?.success, 21 | options?.fail, 22 | ); 23 | } 24 | 25 | export default getWifiInfo; 26 | -------------------------------------------------------------------------------- /dist/types/video.d.ts: -------------------------------------------------------------------------------- 1 | export interface StartVideoRecoderRes { 2 | /** 调用返回信息 */ 3 | message: number; 4 | /** 如果当前设备计步器不可用,返回-10001 */ 5 | code?: number; 6 | /** 录制信息 */ 7 | info: { 8 | video_path: string; 9 | video_duration: string; 10 | video_size: string; 11 | video_thumbnail: string; 12 | }; 13 | } 14 | export declare type Quality = '0' | '1' | '2'; 15 | export interface StartVideoRecoderParams { 16 | duration: number; 17 | quality: Quality; 18 | sync_system_album: boolean; 19 | front: boolean; 20 | } 21 | export interface PlayVideoRes { 22 | [key: string]: unknown; 23 | } 24 | export interface PlayVideoParams { 25 | url: string; 26 | } 27 | -------------------------------------------------------------------------------- /modules/video/playVideo.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_AUDIO_AND_VIDEO } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { PlayVideoRes, PlayVideoParams } from '../types/video'; 5 | 6 | export type Options = PlayVideoParams & ExecOptions; 7 | 8 | /** 9 | * @description 视频录制 10 | * @param {Options} options 11 | * @module video 12 | * @returns {PlayVideoRes} 13 | */ 14 | export default function playVideo(options: Options): Promise { 15 | return core.exec( 16 | WORKPLUS_AUDIO_AND_VIDEO, 17 | 'playVideo', 18 | [options], 19 | options?.success, 20 | options?.fail, 21 | false, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /dist/eventlistener/bind.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.off = exports.on = void 0; 4 | /** 5 | * 添加Cordova监听事件 6 | * @param {CordovaListener} type 7 | * @param {(ev: Event) => {}} listener 8 | * @param {boolean} [useCapture] 9 | */ 10 | function on(type, listener, useCapture) { 11 | document.addEventListener(type, listener, useCapture); 12 | } 13 | exports.on = on; 14 | /** 15 | * 取消Cordova监听事件 16 | * @export 17 | * @param {CordovaListener} type 18 | * @param {(ev: Event) => {}} listener 19 | * @param {boolean} [useCapture] 20 | */ 21 | function off(type, listener, useCapture) { 22 | document.removeEventListener(type, listener, useCapture); 23 | } 24 | exports.off = off; 25 | -------------------------------------------------------------------------------- /modules/file/isFileExist.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_FILE } from '../constants'; 3 | import { FileOptions, FilePathParams, FileExistRes } from '../types/file'; 4 | 5 | export type FileExistOptions = FilePathParams & FileOptions; 6 | 7 | /** 8 | * 判断文件是否存在 9 | * @description 判断指定路径的文件是否存在 10 | * @param {FileExistOptions} [options] 11 | * @returns {Promise} 12 | */ 13 | export default function isFileExist(options: FileExistOptions): Promise { 14 | const { success, fail, ...args } = options; 15 | return core.exec( 16 | WORKPLUS_FILE, 17 | 'isFileExist', 18 | [args], 19 | success, 20 | fail, 21 | false, 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /dist/webview/wxShare.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var core = require("../core"); 4 | var constants_1 = require("../constants"); 5 | /** 6 | * 微信分享(会话/朋友圈) 7 | * @description 根据接口直接调起微信分享页面 8 | * @param {WxShare} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function wxShare(options) { 13 | var args = { 14 | app_id: options.appId, 15 | title: options.title, 16 | type: options.type, 17 | description: options.description, 18 | thumb: options.thumb, 19 | scene: options.scene, 20 | data: options.data, 21 | }; 22 | return core.execSync(constants_1.WORKPLUS_WEBVIEW, 'wxShare', [args]); 23 | } 24 | exports.default = wxShare; 25 | -------------------------------------------------------------------------------- /modules/file/getUserFilePath.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_FILE } from '../constants'; 3 | import { FileOptions, GetUserFilePathParams } from '../types/file'; 4 | 5 | export type FileExistOptions = GetUserFilePathParams & FileOptions; 6 | 7 | /** 8 | * 获取文件目录路径 9 | * @description 获取设备的文件存在目录,包括下载文件夹及网盘(如果有)及用户自定义目录。 10 | * @param {FileExistOptions} [options] 11 | * @returns {Promise} 12 | */ 13 | export default function isFileExist(options: FileExistOptions): Promise { 14 | const { success, fail, ...args } = options; 15 | return core.exec( 16 | WORKPLUS_FILE, 17 | 'getUserFilePath', 18 | [args], 19 | success, 20 | fail, 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /modules/pay/wxPay.ts: -------------------------------------------------------------------------------- 1 | // This file is auto gererated by scripts/create-api.js 2 | import * as core from '../core'; 3 | import { PayOption, WxPayParams, WxPay, WxPayRes } from '../types/pay'; 4 | import { WORKPLUS_PAY } from '../constants'; 5 | 6 | /** 7 | * 微信支付 8 | * @description 提供微信支付的能力。 9 | * @param {WxPay>} options 10 | * @module wxPay 11 | */ 12 | export default function wxPay(options: WxPay & PayOption): Promise { 13 | const args: WxPayParams = { 14 | app_id: options.appId, 15 | request_data: options.requestData, 16 | }; 17 | return core.exec( 18 | WORKPLUS_PAY, 19 | 'wxPay', 20 | [args], 21 | options?.success, 22 | options?.fail, 23 | false, 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /modules/webview/wxShare.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WxShareParams, WxShare } from '../types/webview'; 3 | import { WORKPLUS_WEBVIEW } from '../constants'; 4 | 5 | /** 6 | * 微信分享(会话/朋友圈) 7 | * @description 根据接口直接调起微信分享页面 8 | * @param {WxShare} options 9 | * @module webview 10 | * @returns 无 11 | */ 12 | function wxShare(options: WxShare): void { 13 | const args: WxShareParams = { 14 | app_id: options.appId, 15 | title: options.title, 16 | type: options.type, 17 | description: options.description, 18 | thumb: options.thumb, 19 | scene: options.scene, 20 | data: options.data, 21 | }; 22 | return core.execSync(WORKPLUS_WEBVIEW, 'wxShare', [args]); 23 | } 24 | 25 | export default wxShare; 26 | -------------------------------------------------------------------------------- /modules/eventlog/getEventLogs.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_EVENTLOG } from '../constants'; 3 | import { EventlogOptions, EventLogsParams, EventLogsRes } from '../types/eventlog'; 4 | 5 | /** 6 | * 获取事件日志数据 7 | * @description 根据传参条件, 返回对应的事件日志数据 8 | * @param {EventLogsParams & EventlogOptions} [options] 9 | * @returns {Promise} 10 | */ 11 | export default function getEventLogs( 12 | options: EventLogsParams & EventlogOptions, 13 | ): Promise { 14 | const { success, fail, ...args } = options; 15 | return core.exec( 16 | WORKPLUS_EVENTLOG, 17 | 'getEventLogs', 18 | [args], 19 | success, 20 | fail, 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /dist/user/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.showUserInfoByUsername = exports.getUserInfoByUserId = exports.getCurrentEmployeeInfo = exports.getCurrentUserInfo = void 0; 4 | var getCurrentUserInfo_1 = require("./getCurrentUserInfo"); 5 | exports.getCurrentUserInfo = getCurrentUserInfo_1.default; 6 | var getCurrentEmployeeInfo_1 = require("./getCurrentEmployeeInfo"); 7 | exports.getCurrentEmployeeInfo = getCurrentEmployeeInfo_1.default; 8 | var getUserInfoByUserId_1 = require("./getUserInfoByUserId"); 9 | exports.getUserInfoByUserId = getUserInfoByUserId_1.default; 10 | var showUserInfoByUsername_1 = require("./showUserInfoByUsername"); 11 | exports.showUserInfoByUsername = showUserInfoByUsername_1.default; 12 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "experimentalDecorators": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "baseUrl": ".", 14 | "types": ["webpack-env"], 15 | "paths": { 16 | "@/*": ["src/*"] 17 | }, 18 | "lib": ["esnext", "dom", "dom.iterable", "scripthost"] 19 | }, 20 | "include": [ 21 | "../dist/typings", 22 | "src/**/*.ts", 23 | "src/**/*.tsx", 24 | "src/**/*.vue", 25 | "tests/**/*.ts", 26 | "tests/**/*.tsx" 27 | ], 28 | "exclude": ["node_modules"] 29 | } 30 | -------------------------------------------------------------------------------- /modules/auth/biometric.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_LIGHT_APP } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { BiometricRes } from '../types/auth'; 5 | 6 | export type BiometricOptions = ExecOptions; 7 | 8 | /** 9 | * 生物认证 10 | * @description 需要设备具备指纹或者FACE_ID解锁功能,解锁后触发回调,适用于对安全性要求较高的操作。 11 | * @param {BiometricOptions} [options] 12 | * @module auth 13 | * @version 3.15.0 14 | * @returns code 15 | */ 16 | export default function biometric(options?: BiometricOptions): Promise { 17 | return core.exec<[], BiometricRes, void>( 18 | WORKPLUS_LIGHT_APP, 19 | 'routeBiometricAuthenticationLock', 20 | [], 21 | options?.success, 22 | options?.fail, 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /modules/dialog/popNotification.ts: -------------------------------------------------------------------------------- 1 | import * as core from '../core'; 2 | import { WORKPLUS_NOTIFICATION } from '../constants'; 3 | import { ExecOptions } from '../types/core'; 4 | import { PopNotificationParams, PopNotificationRes } from '../types/dialog'; 5 | 6 | export type Options = PopNotificationParams & ExecOptions; 7 | 8 | /** 9 | * @description 消息通知 10 | * @param {Options} 11 | * @module dialog 12 | * @returns {PopNotificationRes} 13 | */ 14 | export function popNotification(options: Options): Promise { 15 | return core.exec( 16 | WORKPLUS_NOTIFICATION, 17 | 'pop', 18 | [options], 19 | options?.success, 20 | options?.fail, 21 | false, 22 | ); 23 | } 24 | --------------------------------------------------------------------------------