@bytexbyte/ike-app-api 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.
Files changed (42) hide show
  1. package/README.md +17 -0
  2. package/lib/App.d.ts +23 -0
  3. package/lib/App.js +126 -0
  4. package/lib/Auth/index.d.ts +156 -0
  5. package/lib/Auth/index.js +392 -0
  6. package/lib/Auth/type.d.ts +73 -0
  7. package/lib/Auth/type.js +2 -0
  8. package/lib/Batch/index.d.ts +26 -0
  9. package/lib/Batch/index.js +136 -0
  10. package/lib/Contract/index.d.ts +26 -0
  11. package/lib/Contract/index.js +109 -0
  12. package/lib/DigitalCustomization/index.d.ts +34 -0
  13. package/lib/DigitalCustomization/index.js +128 -0
  14. package/lib/DigitalCustomization/shopifyType.d.ts +72 -0
  15. package/lib/DigitalCustomization/shopifyType.js +2 -0
  16. package/lib/File/UploadFileType.d.ts +5 -0
  17. package/lib/File/UploadFileType.js +16 -0
  18. package/lib/File/index.d.ts +34 -0
  19. package/lib/File/index.js +131 -0
  20. package/lib/InAppNotification/index.d.ts +23 -0
  21. package/lib/InAppNotification/index.js +89 -0
  22. package/lib/InAppNotification/type.d.ts +1 -0
  23. package/lib/InAppNotification/type.js +2 -0
  24. package/lib/Mfa/index.d.ts +47 -0
  25. package/lib/Mfa/index.js +139 -0
  26. package/lib/Redeem/index.d.ts +23 -0
  27. package/lib/Redeem/index.js +90 -0
  28. package/lib/RegisterDeviceCode/index.d.ts +18 -0
  29. package/lib/RegisterDeviceCode/index.js +88 -0
  30. package/lib/Scan/index.d.ts +39 -0
  31. package/lib/Scan/index.js +121 -0
  32. package/lib/Tags/index.d.ts +75 -0
  33. package/lib/Tags/index.js +264 -0
  34. package/lib/User/index.d.ts +140 -0
  35. package/lib/User/index.js +478 -0
  36. package/lib/config.d.ts +3 -0
  37. package/lib/config.js +8 -0
  38. package/lib/index.d.ts +42 -0
  39. package/lib/index.js +98 -0
  40. package/lib/types.d.ts +587 -0
  41. package/lib/types.js +64 -0
  42. package/package.json +79 -0
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ Authenticate your products that have IKE Tags with our app and unlock special user engagement contents such as videos,
2
+ product info, special promos, NFT, giveaways and more.
3
+ This documentation contains a list of the APIs used in the IKE app.
4
+
5
+ ## Getting Started
6
+ 1. In terminal, type ' npm i @bytexbyte/berify-app-api ' to install.
7
+ 2. Import the package to your project by doing the following:
8
+ import IKEAppApi from '@bytexbyte/berify-app-api'
9
+ ......
10
+ const ikeAppApi = new IKEAppApi({
11
+  secretKey: 'App-IKE-Secret',
12
+  secret: [You unique API secret key here]
13
+ });
14
+ 3. View Documentation for details on individual APIs. (https://app.swaggerhub.com/apis/terry1022/ike-app/1.0.0)
15
+
16
+ ## Learn More
17
+ To Learn more about IKE, check out https://ike.com/
package/lib/App.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import BxBApi from '@bytexbyte/bxb-api';
2
+ declare type GetVersionResult = {
3
+ version: string;
4
+ };
5
+ declare type GetMaintenanceVersionResult = {
6
+ version: string;
7
+ };
8
+ declare type GetCheckNetwork = {
9
+ message: string;
10
+ };
11
+ declare class IKEAppApi extends BxBApi {
12
+ constructor({ host, onSuccess, onError }: {
13
+ host: string;
14
+ onSuccess?: () => void;
15
+ onError?: (error: any) => void;
16
+ });
17
+ getVersion(): Promise<GetVersionResult>;
18
+ getMaintenanceVersion(): Promise<GetMaintenanceVersionResult>;
19
+ getCheckNetwork(init?: {
20
+ signal?: AbortSignal;
21
+ }): Promise<GetCheckNetwork>;
22
+ }
23
+ export default IKEAppApi;
package/lib/App.js ADDED
@@ -0,0 +1,126 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (_) try {
44
+ 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;
45
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ var bxb_api_1 = require("@bytexbyte/bxb-api");
66
+ var config_1 = require("./config");
67
+ var IKEAppApi = /** @class */ (function (_super) {
68
+ __extends(IKEAppApi, _super);
69
+ function IKEAppApi(_a) {
70
+ var host = _a.host, onSuccess = _a.onSuccess, onError = _a.onError;
71
+ return _super.call(this, {
72
+ host: host,
73
+ secretKey: config_1.localSecretKey, secret: '',
74
+ moduleName: 'app',
75
+ onSuccess: onSuccess,
76
+ onError: onError
77
+ }) || this;
78
+ }
79
+ IKEAppApi.prototype.getVersion = function () {
80
+ return __awaiter(this, void 0, void 0, function () {
81
+ var response;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0: return [4 /*yield*/, this.bxbFetch({
85
+ method: 'GET',
86
+ headers: { 'Content-Type': 'application/json' }
87
+ }, 'version')];
88
+ case 1:
89
+ response = _a.sent();
90
+ return [2 /*return*/, response.json()];
91
+ }
92
+ });
93
+ });
94
+ };
95
+ IKEAppApi.prototype.getMaintenanceVersion = function () {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var response;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0: return [4 /*yield*/, this.bxbFetch({
101
+ method: 'GET',
102
+ headers: { 'Content-Type': 'application/json' }
103
+ }, 'maintenance-version')];
104
+ case 1:
105
+ response = _a.sent();
106
+ return [2 /*return*/, response.json()];
107
+ }
108
+ });
109
+ });
110
+ };
111
+ IKEAppApi.prototype.getCheckNetwork = function (init) {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ var response;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0: return [4 /*yield*/, this.bxbFetch(__assign({ method: 'GET', headers: { 'Content-Type': 'application/json' } }, init), 'check-network')];
117
+ case 1:
118
+ response = _a.sent();
119
+ return [2 /*return*/, response.json()];
120
+ }
121
+ });
122
+ });
123
+ };
124
+ return IKEAppApi;
125
+ }(bxb_api_1.default));
126
+ exports.default = IKEAppApi;
@@ -0,0 +1,156 @@
1
+ import BxBApi from '@bytexbyte/bxb-api';
2
+ import { SignInAppleMobile, SignInEmailBiometrics, SignInEmailPassword, SignInFacebookMobile, SignInGoogleAndroid, SignInGoogleIos } from './type';
3
+ declare type User = {
4
+ id: string;
5
+ image: string | null;
6
+ email: string | null;
7
+ phone: string | null;
8
+ firstName: string | null;
9
+ lastName: string | null;
10
+ emailVerified: Date | null;
11
+ isAdmin: boolean;
12
+ isPasswordLogin: boolean;
13
+ webUserId: string | null;
14
+ accounts: {
15
+ provider: string;
16
+ }[];
17
+ };
18
+ declare type Session = {
19
+ expires: Date;
20
+ user: User;
21
+ } | null;
22
+ declare class IKEAppAuthApi extends BxBApi {
23
+ constructor({ host, secretKey, secret, onSuccess, onError }: {
24
+ host: string;
25
+ secretKey?: string;
26
+ secret?: string;
27
+ onSuccess?: () => void;
28
+ onError?: (error: any) => void;
29
+ });
30
+ getCsrfToken(): Promise<{
31
+ csrfToken: string;
32
+ }>;
33
+ checkVerify(body: {
34
+ email: string;
35
+ }): Promise<{
36
+ verify: boolean;
37
+ error?: undefined;
38
+ } | {
39
+ verify?: undefined;
40
+ error: 'Field(s) cannot be empty.';
41
+ }>;
42
+ signUp(provider: 'email-password', form: {
43
+ email: string;
44
+ phone: string;
45
+ firstName: string;
46
+ lastName: string;
47
+ password: string;
48
+ }): Promise<{
49
+ id: string;
50
+ error?: undefined;
51
+ } | {
52
+ id?: undefined;
53
+ error: 'Field(s) cannot be empty.' | 'user already created.' | 'Password requires at least 8 characters.' | 'Password requires one upper case and lower case letter' | 'Password must be in ASCII characters.' | 'Password requires at least one number';
54
+ }>;
55
+ createBiometrics(form: {
56
+ publicKey: string;
57
+ id: string;
58
+ signature: string;
59
+ }): Promise<{
60
+ id: string;
61
+ error?: undefined;
62
+ } | {
63
+ id?: undefined;
64
+ error: 'Field(s) cannot be empty.' | 'id not found.' | 'Email not verified.' | 'Biometrics setting does not match this phone.' | 'Biometrics signature error.';
65
+ }>;
66
+ deleteBiometrics(): Promise<{
67
+ error?: 'You are not logged in.';
68
+ }>;
69
+ sendVerify(provider: 'email-password', body: {
70
+ identifier: string;
71
+ }): Promise<{
72
+ error: 'Field(s) cannot be empty.' | 'User not found.';
73
+ expires?: undefined;
74
+ } | {
75
+ error?: undefined;
76
+ expires: Date;
77
+ }>;
78
+ verify(provider: 'email-password', body: {
79
+ identifier: string;
80
+ token: string;
81
+ }): Promise<{
82
+ id: string;
83
+ error?: undefined;
84
+ } | {
85
+ id?: undefined;
86
+ error: 'Field(s) cannot be empty.' | 'verificationToken not found.' | 'identifier does not match.' | 'User not found.';
87
+ }>;
88
+ forgetPassword(provider: 'email-password', body: {
89
+ identifier: string;
90
+ }): Promise<{
91
+ error: 'Field(s) cannot be empty.' | 'User not found.';
92
+ expires?: undefined;
93
+ } | {
94
+ error?: undefined;
95
+ expires: Date;
96
+ }>;
97
+ resetPassword(provider: 'email-password', body: {
98
+ tokenId?: string;
99
+ password: string;
100
+ }): Promise<{
101
+ id: string;
102
+ error?: undefined;
103
+ } | {
104
+ id?: undefined;
105
+ error: 'Field(s) cannot be empty.' | 'token not found.' | 'User not found.' | 'Request has expired.' | "Password requires at least 8 characters." | "Password requires at least one uppercase and one lowercase letter." | "Password must be in ASCII characters." | "Password requires at least one number.";
106
+ }>;
107
+ signIn(provider: Parameters<SignInEmailPassword>[0], form: Parameters<SignInEmailPassword>[1]): Promise<Awaited<ReturnType<SignInEmailPassword>>>;
108
+ signIn(provider: Parameters<SignInGoogleIos>[0], form: Parameters<SignInGoogleIos>[1]): Promise<Awaited<ReturnType<SignInGoogleIos>>>;
109
+ signIn(provider: Parameters<SignInGoogleAndroid>[0], form: Parameters<SignInGoogleAndroid>[1]): Promise<Awaited<ReturnType<SignInGoogleAndroid>>>;
110
+ signIn(provider: Parameters<SignInFacebookMobile>[0], form: Parameters<SignInFacebookMobile>[1]): Promise<Awaited<ReturnType<SignInFacebookMobile>>>;
111
+ signIn(provider: Parameters<SignInAppleMobile>[0], form: Parameters<SignInAppleMobile>[1]): Promise<Awaited<ReturnType<SignInAppleMobile>>>;
112
+ signIn(provider: Parameters<SignInEmailBiometrics>[0], form: Parameters<SignInEmailBiometrics>[1]): Promise<Awaited<ReturnType<SignInEmailBiometrics>>>;
113
+ signOut(): Promise<any>;
114
+ getSession(): Promise<Session>;
115
+ createToken(): Promise<{
116
+ token: string;
117
+ error?: undefined;
118
+ } | {
119
+ token?: undefined;
120
+ error: 'Authentication type error.' | 'User not found.';
121
+ }>;
122
+ deleteToken(body: {
123
+ token: string;
124
+ }): Promise<{
125
+ user: {
126
+ id: string;
127
+ email: string | null;
128
+ phone: string | null;
129
+ } | null;
130
+ error?: undefined;
131
+ } | {
132
+ user?: undefined;
133
+ error: 'Authentication type error.';
134
+ }>;
135
+ facebookToEmail(body: {
136
+ email: string;
137
+ password: string;
138
+ }): Promise<{
139
+ user: {
140
+ id: string;
141
+ } | null;
142
+ error?: undefined;
143
+ } | {
144
+ user?: undefined;
145
+ error: 'We couldn’t recognize a Facebook Login account with this email.' | "Password requires at least 8 characters." | "Password requires at least one uppercase and one lowercase letter." | "Password must be in ASCII characters." | "Password requires at least one number." | "Email associated with other third-party logins.";
146
+ }>;
147
+ resetWalletPasscode(form: {
148
+ email: string;
149
+ resetCode: string;
150
+ }): Promise<{
151
+ email: string;
152
+ url: string;
153
+ error?: undefined;
154
+ }>;
155
+ }
156
+ export default IKEAppAuthApi;