@bytexbyte/ike-app-api 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Incode/index.d.ts +13 -0
- package/lib/Incode/index.js +90 -0
- package/lib/Incode/type.d.ts +4 -0
- package/lib/Incode/type.js +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
+
import { GetOcrDataBody } from './type';
|
|
3
|
+
declare class IKEAppIncodeApi extends BxBApi {
|
|
4
|
+
constructor({ host, secretKey, secret, onSuccess, onError, }: {
|
|
5
|
+
host: string;
|
|
6
|
+
secretKey?: string;
|
|
7
|
+
secret?: string;
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
onError?: (error: any) => void;
|
|
10
|
+
});
|
|
11
|
+
getOcrData(form: GetOcrDataBody): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
export default IKEAppIncodeApi;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
var bxb_api_1 = require("@bytexbyte/bxb-api");
|
|
55
|
+
var config_1 = require("../config");
|
|
56
|
+
var IKEAppIncodeApi = /** @class */ (function (_super) {
|
|
57
|
+
__extends(IKEAppIncodeApi, _super);
|
|
58
|
+
function IKEAppIncodeApi(_a) {
|
|
59
|
+
var host = _a.host, secretKey = _a.secretKey, secret = _a.secret, onSuccess = _a.onSuccess, onError = _a.onError;
|
|
60
|
+
return _super.call(this, {
|
|
61
|
+
host: host,
|
|
62
|
+
secretKey: secretKey !== null && secretKey !== void 0 ? secretKey : config_1.localSecretKey,
|
|
63
|
+
secret: secret !== null && secret !== void 0 ? secret : '',
|
|
64
|
+
moduleName: 'incode',
|
|
65
|
+
onSuccess: onSuccess,
|
|
66
|
+
onError: onError,
|
|
67
|
+
}) || this;
|
|
68
|
+
}
|
|
69
|
+
IKEAppIncodeApi.prototype.getOcrData = function (form) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var response;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
75
|
+
method: 'POST',
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify(form),
|
|
80
|
+
}, 'getOcrData')];
|
|
81
|
+
case 1:
|
|
82
|
+
response = _a.sent();
|
|
83
|
+
return [2 /*return*/, response.json()];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
return IKEAppIncodeApi;
|
|
89
|
+
}(bxb_api_1.default));
|
|
90
|
+
exports.default = IKEAppIncodeApi;
|
package/lib/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import IKEAppRegisterDeviceCodeApi from './RegisterDeviceCode';
|
|
|
11
11
|
import IKEAppScanApi from './Scan';
|
|
12
12
|
import IKEAppTagsApi from './Tags';
|
|
13
13
|
import IKEAppUserApi from './User';
|
|
14
|
+
import IKEAppIncodeApi from './Incode';
|
|
14
15
|
declare class IKEAppApi {
|
|
15
16
|
host: string;
|
|
16
17
|
env: string;
|
|
@@ -27,6 +28,7 @@ declare class IKEAppApi {
|
|
|
27
28
|
digitalCustomization: IKEAppDigitalCustomizationApi;
|
|
28
29
|
contract: IKEAppContractApi;
|
|
29
30
|
inAppNotification: IKEApInAppNotificationApi;
|
|
31
|
+
incode: IKEAppIncodeApi;
|
|
30
32
|
constructor({ host, env, secretKey, secret, onSuccess, onError, }: {
|
|
31
33
|
host: string;
|
|
32
34
|
env: string;
|
package/lib/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var RegisterDeviceCode_1 = require("./RegisterDeviceCode");
|
|
|
60
60
|
var Scan_1 = require("./Scan");
|
|
61
61
|
var Tags_1 = require("./Tags");
|
|
62
62
|
var User_1 = require("./User");
|
|
63
|
+
var Incode_1 = require("./Incode");
|
|
63
64
|
var IKEAppApi = /** @class */ (function () {
|
|
64
65
|
function IKEAppApi(_a) {
|
|
65
66
|
var host = _a.host, env = _a.env, secretKey = _a.secretKey, secret = _a.secret, onSuccess = _a.onSuccess, onError = _a.onError;
|
|
@@ -91,6 +92,7 @@ var IKEAppApi = /** @class */ (function () {
|
|
|
91
92
|
this.digitalCustomization = new DigitalCustomization_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
92
93
|
this.contract = new Contract_1.default({ host: host, onSuccess: onSuccess, onError: onError });
|
|
93
94
|
this.inAppNotification = new InAppNotification_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
|
|
95
|
+
this.incode = new Incode_1.default({ host: host, secretKey: secretKey, secret: secret, onSuccess: onSuccess, onError: onError });
|
|
94
96
|
}
|
|
95
97
|
return IKEAppApi;
|
|
96
98
|
}());
|
package/package.json
CHANGED