capacitor-record360sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ export interface Record360Identity {
2
+ username: string;
3
+ password: string;
4
+ userId: String;
5
+ userToken: String;
6
+ }
7
+ export interface CapacitorRecord360SDKPlugin {
8
+ launchRecord360(identity: Record360Identity): Promise<void>;
9
+ launchReferenceCapture(options: {
10
+ referenceNumber: string;
11
+ workOrderId: number;
12
+ workOrderLabel: string;
13
+ identity: Record360Identity;
14
+ }): Promise<void>;
15
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Record360Identity {\n username: string,\n password: string,\n userId: String,\n userToken: String\n}\n\nexport interface CapacitorRecord360SDKPlugin {\n launchRecord360(identity: Record360Identity): Promise<void>\n\n launchReferenceCapture(options: {\n referenceNumber: string,\n workOrderId: number,\n workOrderLabel: string,\n identity: Record360Identity\n }): Promise<void>\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CapacitorRecord360SDKPlugin } from './definitions';
2
+ declare const CapacitorRecord360SDK: CapacitorRecord360SDKPlugin;
3
+ export * from './definitions';
4
+ export { CapacitorRecord360SDK };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {
3
+ web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { CapacitorRecord360SDK };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,qBAAqB,GAAG,cAAc,CAA8B,uBAAuB,EAAE;IACjG,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;CACvE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorRecord360SDKPlugin } from './definitions';\n\nconst CapacitorRecord360SDK = registerPlugin<CapacitorRecord360SDKPlugin>('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n"]}
@@ -0,0 +1,11 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { CapacitorRecord360SDKPlugin, Record360Identity } from './definitions';
3
+ export declare class CapacitorRecord360SDKWeb extends WebPlugin implements CapacitorRecord360SDKPlugin {
4
+ launchRecord360(_: Record360Identity): Promise<void>;
5
+ launchReferenceCapture(_: {
6
+ referenceNumber: string;
7
+ workOrderId: number;
8
+ workOrderLabel: string;
9
+ identity: Record360Identity;
10
+ }): Promise<void>;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class CapacitorRecord360SDKWeb extends WebPlugin {
3
+ launchRecord360(_) {
4
+ throw new Error("Not available on web.");
5
+ }
6
+ launchReferenceCapture(_) {
7
+ throw new Error("Not available on web.");
8
+ }
9
+ }
10
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACrD,eAAe,CAAC,CAAoB;QAClC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,sBAAsB,CAAC,CAAyG;QAC9H,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorRecord360SDKPlugin, Record360Identity } from './definitions';\n\nexport class CapacitorRecord360SDKWeb extends WebPlugin implements CapacitorRecord360SDKPlugin {\n launchRecord360(_: Record360Identity): Promise<void> {\n throw new Error(\"Not available on web.\");\n }\n\n launchReferenceCapture(_: { referenceNumber: string; workOrderId: number; workOrderLabel: string; identity: Record360Identity; }): Promise<void> {\n throw new Error(\"Not available on web.\");\n }\n}"]}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const CapacitorRecord360SDK = core.registerPlugin('CapacitorRecord360SDK', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorRecord360SDKWeb()),
7
+ });
8
+
9
+ class CapacitorRecord360SDKWeb extends core.WebPlugin {
10
+ launchRecord360(_) {
11
+ throw new Error("Not available on web.");
12
+ }
13
+ launchReferenceCapture(_) {
14
+ throw new Error("Not available on web.");
15
+ }
16
+ }
17
+
18
+ var web = /*#__PURE__*/Object.freeze({
19
+ __proto__: null,
20
+ CapacitorRecord360SDKWeb: CapacitorRecord360SDKWeb
21
+ });
22
+
23
+ exports.CapacitorRecord360SDK = CapacitorRecord360SDK;
24
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC1E,CAAC;;ACFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,eAAe,CAAC,CAAC,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;AAChD;AACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;AAChD;AACA;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,27 @@
1
+ var capacitorCapacitorRecord360SDK = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const CapacitorRecord360SDK = core.registerPlugin('CapacitorRecord360SDK', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorRecord360SDKWeb()),
6
+ });
7
+
8
+ class CapacitorRecord360SDKWeb extends core.WebPlugin {
9
+ launchRecord360(_) {
10
+ throw new Error("Not available on web.");
11
+ }
12
+ launchReferenceCapture(_) {
13
+ throw new Error("Not available on web.");
14
+ }
15
+ }
16
+
17
+ var web = /*#__PURE__*/Object.freeze({
18
+ __proto__: null,
19
+ CapacitorRecord360SDKWeb: CapacitorRecord360SDKWeb
20
+ });
21
+
22
+ exports.CapacitorRecord360SDK = CapacitorRecord360SDK;
23
+
24
+ return exports;
25
+
26
+ })({}, capacitorExports);
27
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorRecord360SDK = registerPlugin('CapacitorRecord360SDK', {\n web: () => import('./web').then(m => new m.CapacitorRecord360SDKWeb()),\n});\nexport * from './definitions';\nexport { CapacitorRecord360SDK };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorRecord360SDKWeb extends WebPlugin {\n launchRecord360(_) {\n throw new Error(\"Not available on web.\");\n }\n launchReferenceCapture(_) {\n throw new Error(\"Not available on web.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;IACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;IAC1E,CAAC;;ICFM,MAAM,wBAAwB,SAASC,cAAS,CAAC;IACxD,IAAI,eAAe,CAAC,CAAC,EAAE;IACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;IAChD;IACA,IAAI,sBAAsB,CAAC,CAAC,EAAE;IAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;IAChD;IACA;;;;;;;;;;;;;;;"}
@@ -0,0 +1,170 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import Record360SDK
4
+
5
+ @objc(CapacitorRecord360SDKPlugin)
6
+ public class CapacitorRecord360SDKPlugin: CAPPlugin, CAPBridgedPlugin, Record360Delegate, Record360ViewControllerDelegate {
7
+ public let identifier = "CapacitorRecord360SDKPlugin"
8
+ public let jsName = "CapacitorRecord360SDK"
9
+ public let pluginMethods: [CAPPluginMethod] = [
10
+ CAPPluginMethod(name: "launchRecord360", returnType: CAPPluginReturnNone),
11
+ CAPPluginMethod(name: "launchReferenceCapture", returnType: CAPPluginReturnNone)
12
+ ]
13
+
14
+ public var record360: Record360?
15
+ public var record360ViewController: Record360ViewController?
16
+
17
+ public override init() {
18
+ super.init()
19
+ self.record360 = Record360(delegate: self);
20
+ }
21
+
22
+ @objc
23
+ func launchRecord360(_ call: CAPPluginCall) {
24
+ guard let presentingVC = bridge?.viewController else {
25
+ return
26
+ }
27
+
28
+ let username = call.getString("username")
29
+ let password = call.getString("password")
30
+ let userId = call.getString("userId")
31
+ let userToken = call.getString("userToken")
32
+
33
+ if (username != nil && password != nil) {
34
+ loadR360SDK(username: username!, password: password!, presentingVC: presentingVC)
35
+ } else if (userId != nil && userToken != nil) {
36
+ loadR360SDK(userID: userId!, userToken: userToken!, presentingVC: presentingVC)
37
+ } else {
38
+ loadR360SDKLogin(referenceNumber: nil, workOrderId: nil, workOrderLabel: nil, presentingVC: presentingVC)
39
+ }
40
+ }
41
+
42
+ @objc
43
+ func launchReferenceCapture(_ call: CAPPluginCall) {
44
+ guard let presentingVC = bridge?.viewController else {
45
+ return
46
+ }
47
+
48
+ let referenceNumber = call.getString("referenceNumber")
49
+
50
+ if (referenceNumber == nil || referenceNumber!.isEmpty) {
51
+ call.reject("Reference number is required")
52
+ }
53
+
54
+ let workOrderId = call.getInt("workOrderId") as NSNumber?
55
+ let workOrderLabel = call.getString("workOrderLabel")
56
+ let identityObj = call.getObject("identity")
57
+ let username = identityObj?["username"] as? String
58
+ let password = identityObj?["password"] as? String
59
+ let userId = identityObj?["userId"] as? String
60
+ let userToken = identityObj?["userToken"] as? String
61
+
62
+ if (username != nil && password != nil) {
63
+ loadR360SDKForInspection(username: username!, password: password!, referenceNumber: referenceNumber!, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
64
+ } else if (userId != nil && userToken != nil) {
65
+ loadR360SDKForInspection(userID: userId!, userToken: userToken!, referenceNumber: referenceNumber!, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
66
+ } else {
67
+ loadR360SDKLogin(referenceNumber: referenceNumber, workOrderId: workOrderId, workOrderLabel: workOrderLabel, presentingVC: presentingVC)
68
+ }
69
+ }
70
+
71
+ private func loadR360SDKLogin(referenceNumber: String?, workOrderId: NSNumber?, workOrderLabel: String?, presentingVC: UIViewController) {
72
+ self.record360ViewController?.dismiss()
73
+ DispatchQueue.main.async {
74
+ if (referenceNumber != nil) {
75
+ self.record360ViewController = Record360ViewController.loadLoginAndSend(to: self.record360!, withReferenceNumber: referenceNumber, workOrderId: workOrderId, workOrderLabel: workOrderLabel, displayOn: presentingVC, withLoginUsername: nil)
76
+ } else {
77
+ self.record360ViewController = Record360ViewController.loadLoginAndSend(to: self.record360!, displayOn: presentingVC, withLoginUsername: nil)
78
+ }
79
+ self.record360ViewController?.delegate = self
80
+ }
81
+ }
82
+
83
+ private func loadR360SDK(username: String, password: String, presentingVC: UIViewController) {
84
+ self.record360ViewController?.dismiss()
85
+ DispatchQueue.main.async {
86
+ self.record360ViewController = Record360ViewController.load(withUserName: username, andPassword: password, sendTo: self.record360!, displayOn: presentingVC)
87
+ self.record360ViewController?.delegate = self
88
+ }
89
+ }
90
+
91
+ private func loadR360SDK(userID: String, userToken: String, presentingVC: UIViewController) {
92
+ self.record360ViewController?.dismiss()
93
+ DispatchQueue.main.async {
94
+ self.record360ViewController = Record360ViewController.load(withUserToken: userToken, andUserId: userID, sendTo: self.record360!, displayOn: presentingVC)
95
+ self.record360ViewController?.delegate = self
96
+ }
97
+ }
98
+
99
+ private func loadR360SDKForInspection(userID: String, userToken: String, referenceNumber: String, workOrderId: NSNumber?, workOrderLabel: String?, presentingVC: UIViewController) {
100
+ self.record360ViewController?.dismiss()
101
+ DispatchQueue.main.async {
102
+ self.record360ViewController = Record360ViewController.load(
103
+ withUserToken: userToken, userId: userID,
104
+ referenceNumber: referenceNumber,
105
+ workOrderId: nil,
106
+ workOrderLabel: nil,
107
+ andIsOneTimeLink: false,
108
+ sendTo: self.record360!,
109
+ displayOn: presentingVC)
110
+ self.record360ViewController?.delegate = self
111
+ }
112
+ }
113
+
114
+ private func loadR360SDKForInspection(username: String, password: String, referenceNumber: String, workOrderId: NSNumber?, workOrderLabel: String?, presentingVC: UIViewController) {
115
+ self.record360ViewController?.dismiss()
116
+ DispatchQueue.main.async {
117
+ self.record360ViewController = Record360ViewController.load(
118
+ withUserName: username, andPassword: password,
119
+ andReferenceNumber: referenceNumber,
120
+ workOrderId: workOrderId,
121
+ workOrderLabel: workOrderLabel,
122
+ sendTo: self.record360!, displayOn: presentingVC)
123
+ self.record360ViewController?.delegate = self
124
+ }
125
+ }
126
+
127
+ public func onSuccessfulAuthentication(withToken userToken: String, andUserId userId: String) {
128
+ var data = JSObject()
129
+ data["type"] = "onUserAuthenticated"
130
+ data["userId"] = userId
131
+
132
+ notifyListeners("Record360Event", data: data)
133
+ }
134
+
135
+ public func onFailedAuthentication(_ error: any Error) {
136
+ var data = JSObject()
137
+ data["type"] = "onFailedToAuthenticate"
138
+ notifyListeners("Record360Event", data: data)
139
+ }
140
+
141
+ public func onInspectionComplete() {
142
+ var data = JSObject()
143
+ data["type"] = "onInspectionComplete"
144
+ notifyListeners("Record360Event", data: data)
145
+ }
146
+
147
+ public func onInspectionCanceled() {
148
+ var data = JSObject()
149
+ data["type"] = "onInspectionCancelled"
150
+ notifyListeners("Record360Event", data: data)
151
+ }
152
+
153
+ public func onInspectionUploadDeleted(forReferenceNumber referenceNumber: String) {
154
+
155
+ }
156
+
157
+ public func onInspectionUploaded(forReferenceNumber referenceNumber: String) {
158
+ var data = JSObject()
159
+ data["type"] = "onInspectionUploaded"
160
+ data["referenceNumber"] = referenceNumber
161
+ notifyListeners("Record360Event", data: data)
162
+ }
163
+
164
+ public func onInspectionUploadFailed(forReferenceNumber referenceNumber: String) {
165
+ var data = JSObject()
166
+ data["type"] = "onInspectionUploadFailed"
167
+ data["referenceNumber"] = referenceNumber
168
+ notifyListeners("Record360Event", data: data)
169
+ }
170
+ }
@@ -0,0 +1,15 @@
1
+ import XCTest
2
+ @testable import CapacitorRecord360SDKPlugin
3
+
4
+ class CapacitorRecord360SDKTests: XCTestCase {
5
+ func testEcho() {
6
+ // This is an example of a functional test case for a plugin.
7
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
8
+
9
+ let implementation = CapacitorRecord360SDK()
10
+ let value = "Hello, World!"
11
+ let result = implementation.echo(value)
12
+
13
+ XCTAssertEqual(value, result)
14
+ }
15
+ }
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "capacitor-record360sdk",
3
+ "version": "1.0.0",
4
+ "description": "Capacitor wrapper for Record360SDK",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
16
+ "CapacitorRecord360sdk.podspec"
17
+ ],
18
+ "author": "Record360",
19
+ "license": "Apache-2.0",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Record360/record360-capacitor-plugin.git.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Record360/record360-capacitor-plugin.git/issues"
26
+ },
27
+ "keywords": [
28
+ "capacitor",
29
+ "plugin",
30
+ "native"
31
+ ],
32
+ "scripts": {
33
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
34
+ "verify:ios": "xcodebuild -scheme CapacitorRecord360sdk -workspace example-app/ios/app/App.xcworkspace -destination generic/platform=iOS",
35
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
36
+ "verify:web": "npm run build",
37
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
38
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
39
+ "eslint": "eslint . --ext ts",
40
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41
+ "swiftlint": "node-swiftlint",
42
+ "docgen": "docgen --api CapacitorRecord360SDKPlugin --output-readme README.md --output-json dist/docs.json",
43
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
44
+ "clean": "rimraf ./dist",
45
+ "watch": "tsc --watch",
46
+ "prepublishOnly": "npm run build"
47
+ },
48
+ "devDependencies": {
49
+ "@capacitor/android": "^6.0.0",
50
+ "@capacitor/core": "^6.0.0",
51
+ "@capacitor/docgen": "^0.2.2",
52
+ "@capacitor/ios": "^6.0.0",
53
+ "@ionic/eslint-config": "^0.4.0",
54
+ "@ionic/prettier-config": "^4.0.0",
55
+ "@ionic/swiftlint-config": "^2.0.0",
56
+ "eslint": "^8.57.0",
57
+ "prettier": "^3.3.3",
58
+ "prettier-plugin-java": "^2.6.4",
59
+ "rimraf": "^6.0.1",
60
+ "rollup": "^4.24.0",
61
+ "swiftlint": "^2.0.0",
62
+ "typescript": "~4.1.5"
63
+ },
64
+ "peerDependencies": {
65
+ "@capacitor/core": "^6.0.0"
66
+ },
67
+ "prettier": "@ionic/prettier-config",
68
+ "swiftlint": "@ionic/swiftlint-config",
69
+ "eslintConfig": {
70
+ "extends": "@ionic/eslint-config/recommended"
71
+ },
72
+ "capacitor": {
73
+ "ios": {
74
+ "src": "ios"
75
+ },
76
+ "android": {
77
+ "src": "android"
78
+ }
79
+ }
80
+ }