@skedulo/mexwex-bridge 0.0.1-pre1 → 0.0.2
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/dist/index.d.mts +16 -1
- package/dist/index.d.ts +128 -6
- package/dist/index.js +164 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -4
- package/dist/MexBridge.d.ts +0 -45
- package/dist/MexBridge.d.ts.map +0 -1
- package/dist/MexBridge.js +0 -112
- package/dist/MexBridge.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -81
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ declare const BridgeMethods: {
|
|
|
13
13
|
readonly getLocalizedString: "getLocalizedString";
|
|
14
14
|
readonly sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus";
|
|
15
15
|
readonly exit: "exit";
|
|
16
|
+
readonly collectTapToPayPayment: "collectTapToPayPayment";
|
|
16
17
|
};
|
|
17
18
|
/** Available attachment picker sources */
|
|
18
19
|
type AttachmentSource = 'camera' | 'photoLibrary' | 'files';
|
|
@@ -64,6 +65,18 @@ interface FormMetadata {
|
|
|
64
65
|
job?: Record<string, any>;
|
|
65
66
|
timezone?: Record<string, any>;
|
|
66
67
|
}
|
|
68
|
+
/** Parameters for initiating a Tap to Pay payment via Stripe Terminal */
|
|
69
|
+
interface TapToPayParams {
|
|
70
|
+
connectionToken: string;
|
|
71
|
+
clientSecret: string;
|
|
72
|
+
locationId: string;
|
|
73
|
+
}
|
|
74
|
+
/** Result of a Tap to Pay payment attempt */
|
|
75
|
+
interface TapToPayResult {
|
|
76
|
+
success: boolean;
|
|
77
|
+
paymentIntentId?: string;
|
|
78
|
+
error?: string;
|
|
79
|
+
}
|
|
67
80
|
|
|
68
81
|
declare global {
|
|
69
82
|
interface Window {
|
|
@@ -106,8 +119,10 @@ declare class MexBridge {
|
|
|
106
119
|
sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean>;
|
|
107
120
|
/** Exit the form and return to the native app */
|
|
108
121
|
exit(): Promise<void>;
|
|
122
|
+
/** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
|
|
123
|
+
collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult>;
|
|
109
124
|
}
|
|
110
125
|
|
|
111
126
|
declare const mexBridge: MexBridge;
|
|
112
127
|
|
|
113
|
-
export { type AddAttachmentsParams, type AttachmentMetadata, type AttachmentSource, type AttachmentsByParentIdResult, type AuthenticationInfo, BridgeMethods, type CaptureAttachmentsParams, type FormMetadata, MexBridge, type PickedFile, mexBridge };
|
|
128
|
+
export { type AddAttachmentsParams, type AttachmentMetadata, type AttachmentSource, type AttachmentsByParentIdResult, type AuthenticationInfo, BridgeMethods, type CaptureAttachmentsParams, type FormMetadata, MexBridge, type PickedFile, type TapToPayParams, type TapToPayResult, mexBridge };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/** Bridge method name constants — shared between web SDK and native handlers */
|
|
2
|
+
declare const BridgeMethods: {
|
|
3
|
+
readonly getInstanceData: "getInstanceData";
|
|
4
|
+
readonly getStaticData: "getStaticData";
|
|
5
|
+
readonly captureAttachments: "captureAttachments";
|
|
6
|
+
readonly addAttachments: "addAttachments";
|
|
7
|
+
readonly removeAttachment: "removeAttachment";
|
|
8
|
+
readonly getAttachment: "getAttachment";
|
|
9
|
+
readonly getAttachmentsByParentId: "getAttachmentsByParentId";
|
|
10
|
+
readonly saveInstanceData: "saveInstanceData";
|
|
11
|
+
readonly getMetadata: "getMetadata";
|
|
12
|
+
readonly getAuthenticationInfo: "getAuthenticationInfo";
|
|
13
|
+
readonly getLocalizedString: "getLocalizedString";
|
|
14
|
+
readonly sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus";
|
|
15
|
+
readonly exit: "exit";
|
|
16
|
+
readonly collectTapToPayPayment: "collectTapToPayPayment";
|
|
17
|
+
};
|
|
18
|
+
/** Available attachment picker sources */
|
|
19
|
+
type AttachmentSource = 'camera' | 'photoLibrary' | 'files';
|
|
20
|
+
/** Parameters for capturing attachments via native pickers */
|
|
21
|
+
interface CaptureAttachmentsParams {
|
|
22
|
+
/** Which picker sources to offer. Defaults to all three. If only one, opens directly without bottom sheet. */
|
|
23
|
+
sources?: AttachmentSource[];
|
|
24
|
+
}
|
|
25
|
+
/** A file picked from a native picker (camera, photo library, or file browser) */
|
|
26
|
+
interface PickedFile {
|
|
27
|
+
uri: string;
|
|
28
|
+
fileName: string;
|
|
29
|
+
}
|
|
30
|
+
/** Parameters for persisting captured attachments to the native layer */
|
|
31
|
+
interface AddAttachmentsParams {
|
|
32
|
+
/** The picked files to persist */
|
|
33
|
+
attachments: PickedFile[];
|
|
34
|
+
/** The parent object ID to associate attachments with */
|
|
35
|
+
parentContextId: string;
|
|
36
|
+
/** Optional category name for the attachments */
|
|
37
|
+
categoryName?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Metadata about a stored attachment (returned by getAttachment) */
|
|
40
|
+
interface AttachmentMetadata {
|
|
41
|
+
uid: string;
|
|
42
|
+
fileName: string;
|
|
43
|
+
downloadURL?: string;
|
|
44
|
+
status?: string;
|
|
45
|
+
contentType?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Result of getAttachmentsByParentId — matches MexAttachmentsOnParentContextChangedResult */
|
|
48
|
+
interface AttachmentsByParentIdResult {
|
|
49
|
+
attachments: AttachmentMetadata[];
|
|
50
|
+
parentId: string;
|
|
51
|
+
}
|
|
52
|
+
/** Authentication information for the current user */
|
|
53
|
+
interface AuthenticationInfo {
|
|
54
|
+
accessToken: string;
|
|
55
|
+
apiUrl: string;
|
|
56
|
+
userId?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Form metadata */
|
|
59
|
+
interface FormMetadata {
|
|
60
|
+
contextObjectId: string;
|
|
61
|
+
packageId: string;
|
|
62
|
+
formName?: string;
|
|
63
|
+
contextObject?: string;
|
|
64
|
+
user?: Record<string, any>;
|
|
65
|
+
job?: Record<string, any>;
|
|
66
|
+
timezone?: Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
/** Parameters for initiating a Tap to Pay payment via Stripe Terminal */
|
|
69
|
+
interface TapToPayParams {
|
|
70
|
+
connectionToken: string;
|
|
71
|
+
clientSecret: string;
|
|
72
|
+
locationId: string;
|
|
73
|
+
}
|
|
74
|
+
/** Result of a Tap to Pay payment attempt */
|
|
75
|
+
interface TapToPayResult {
|
|
76
|
+
success: boolean;
|
|
77
|
+
paymentIntentId?: string;
|
|
78
|
+
error?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare global {
|
|
82
|
+
interface Window {
|
|
83
|
+
ReactNativeWebView?: {
|
|
84
|
+
postMessage(message: string): void;
|
|
85
|
+
};
|
|
86
|
+
onNativeMessage?: (messageString: string) => void;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
declare class MexBridge {
|
|
90
|
+
private _callbacks;
|
|
91
|
+
private _initialized;
|
|
92
|
+
constructor();
|
|
93
|
+
private _initialize;
|
|
94
|
+
private _call;
|
|
95
|
+
private _generateId;
|
|
96
|
+
/** Fetch the current form instance data */
|
|
97
|
+
getInstanceData(): Promise<any>;
|
|
98
|
+
/** Fetch static/shared data for the form */
|
|
99
|
+
getStaticData(): Promise<any>;
|
|
100
|
+
/** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
|
|
101
|
+
captureAttachments(params?: CaptureAttachmentsParams): Promise<PickedFile[] | null>;
|
|
102
|
+
/** Persist captured attachments to the native mobile layer */
|
|
103
|
+
addAttachments(params: AddAttachmentsParams): Promise<any>;
|
|
104
|
+
/** Remove an existing attachment by ID */
|
|
105
|
+
removeAttachment(attachmentId: string): Promise<boolean>;
|
|
106
|
+
/** Retrieve attachment metadata by ID */
|
|
107
|
+
getAttachment(attachmentId: string): Promise<AttachmentMetadata>;
|
|
108
|
+
/** Get all attachments for a parent object (one-shot, not observable) */
|
|
109
|
+
getAttachmentsByParentId(parentContextId: string): Promise<AttachmentsByParentIdResult>;
|
|
110
|
+
/** Persist form data back to the engine */
|
|
111
|
+
saveInstanceData(data: any): Promise<boolean>;
|
|
112
|
+
/** Retrieve form metadata (form name, context, user info, etc.) */
|
|
113
|
+
getMetadata(): Promise<FormMetadata>;
|
|
114
|
+
/** Get the current user's auth token and identity */
|
|
115
|
+
getAuthenticationInfo(): Promise<AuthenticationInfo>;
|
|
116
|
+
/** Get a localized string by key from the form's locale files */
|
|
117
|
+
getLocalizedString(key: string): Promise<string>;
|
|
118
|
+
/** Signal whether the form's mandatory requirements are satisfied */
|
|
119
|
+
sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean>;
|
|
120
|
+
/** Exit the form and return to the native app */
|
|
121
|
+
exit(): Promise<void>;
|
|
122
|
+
/** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
|
|
123
|
+
collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare const mexBridge: MexBridge;
|
|
127
|
+
|
|
128
|
+
export { type AddAttachmentsParams, type AttachmentMetadata, type AttachmentSource, type AttachmentsByParentIdResult, type AuthenticationInfo, BridgeMethods, type CaptureAttachmentsParams, type FormMetadata, MexBridge, type PickedFile, type TapToPayParams, type TapToPayResult, mexBridge };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
BridgeMethods: () => BridgeMethods,
|
|
24
|
+
MexBridge: () => MexBridge,
|
|
25
|
+
mexBridge: () => mexBridge
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
|
|
29
|
+
// src/types.ts
|
|
30
|
+
var BridgeMethods = {
|
|
31
|
+
getInstanceData: "getInstanceData",
|
|
32
|
+
getStaticData: "getStaticData",
|
|
33
|
+
captureAttachments: "captureAttachments",
|
|
34
|
+
addAttachments: "addAttachments",
|
|
35
|
+
removeAttachment: "removeAttachment",
|
|
36
|
+
getAttachment: "getAttachment",
|
|
37
|
+
getAttachmentsByParentId: "getAttachmentsByParentId",
|
|
38
|
+
saveInstanceData: "saveInstanceData",
|
|
39
|
+
getMetadata: "getMetadata",
|
|
40
|
+
getAuthenticationInfo: "getAuthenticationInfo",
|
|
41
|
+
getLocalizedString: "getLocalizedString",
|
|
42
|
+
sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus",
|
|
43
|
+
exit: "exit",
|
|
44
|
+
collectTapToPayPayment: "collectTapToPayPayment"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/MexBridge.ts
|
|
48
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
49
|
+
var MexBridge = class {
|
|
50
|
+
constructor() {
|
|
51
|
+
this._callbacks = /* @__PURE__ */ new Map();
|
|
52
|
+
this._initialized = false;
|
|
53
|
+
this._initialize();
|
|
54
|
+
}
|
|
55
|
+
_initialize() {
|
|
56
|
+
if (this._initialized) return;
|
|
57
|
+
this._initialized = true;
|
|
58
|
+
window.onNativeMessage = (messageString) => {
|
|
59
|
+
try {
|
|
60
|
+
const message = JSON.parse(messageString);
|
|
61
|
+
if (message.type !== "bridge_response" || !message.requestId) return;
|
|
62
|
+
const pending = this._callbacks.get(message.requestId);
|
|
63
|
+
if (!pending) return;
|
|
64
|
+
clearTimeout(pending.timeoutId);
|
|
65
|
+
this._callbacks.delete(message.requestId);
|
|
66
|
+
if (message.error) {
|
|
67
|
+
pending.reject(new Error(message.error));
|
|
68
|
+
} else {
|
|
69
|
+
pending.resolve(message.result);
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.warn("[MexBridge] Failed to parse native message:", e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
_call(method, params, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
if (!window.ReactNativeWebView) {
|
|
79
|
+
reject(new Error("[MexBridge] Not running inside a React Native WebView"));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const requestId = this._generateId();
|
|
83
|
+
const timeoutId = setTimeout(() => {
|
|
84
|
+
this._callbacks.delete(requestId);
|
|
85
|
+
reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`));
|
|
86
|
+
}, timeoutMs);
|
|
87
|
+
this._callbacks.set(requestId, { resolve, reject, timeoutId });
|
|
88
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
89
|
+
type: "bridge_call",
|
|
90
|
+
method,
|
|
91
|
+
requestId,
|
|
92
|
+
params
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
_generateId() {
|
|
97
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
98
|
+
}
|
|
99
|
+
/** Fetch the current form instance data */
|
|
100
|
+
getInstanceData() {
|
|
101
|
+
return this._call(BridgeMethods.getInstanceData);
|
|
102
|
+
}
|
|
103
|
+
/** Fetch static/shared data for the form */
|
|
104
|
+
getStaticData() {
|
|
105
|
+
return this._call(BridgeMethods.getStaticData);
|
|
106
|
+
}
|
|
107
|
+
/** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
|
|
108
|
+
captureAttachments(params) {
|
|
109
|
+
return this._call(BridgeMethods.captureAttachments, params);
|
|
110
|
+
}
|
|
111
|
+
/** Persist captured attachments to the native mobile layer */
|
|
112
|
+
addAttachments(params) {
|
|
113
|
+
return this._call(BridgeMethods.addAttachments, params);
|
|
114
|
+
}
|
|
115
|
+
/** Remove an existing attachment by ID */
|
|
116
|
+
removeAttachment(attachmentId) {
|
|
117
|
+
return this._call(BridgeMethods.removeAttachment, { attachmentId });
|
|
118
|
+
}
|
|
119
|
+
/** Retrieve attachment metadata by ID */
|
|
120
|
+
getAttachment(attachmentId) {
|
|
121
|
+
return this._call(BridgeMethods.getAttachment, { attachmentId });
|
|
122
|
+
}
|
|
123
|
+
/** Get all attachments for a parent object (one-shot, not observable) */
|
|
124
|
+
getAttachmentsByParentId(parentContextId) {
|
|
125
|
+
return this._call(BridgeMethods.getAttachmentsByParentId, { parentContextId });
|
|
126
|
+
}
|
|
127
|
+
/** Persist form data back to the engine */
|
|
128
|
+
saveInstanceData(data) {
|
|
129
|
+
return this._call(BridgeMethods.saveInstanceData, { data });
|
|
130
|
+
}
|
|
131
|
+
/** Retrieve form metadata (form name, context, user info, etc.) */
|
|
132
|
+
getMetadata() {
|
|
133
|
+
return this._call(BridgeMethods.getMetadata);
|
|
134
|
+
}
|
|
135
|
+
/** Get the current user's auth token and identity */
|
|
136
|
+
getAuthenticationInfo() {
|
|
137
|
+
return this._call(BridgeMethods.getAuthenticationInfo);
|
|
138
|
+
}
|
|
139
|
+
/** Get a localized string by key from the form's locale files */
|
|
140
|
+
getLocalizedString(key) {
|
|
141
|
+
return this._call(BridgeMethods.getLocalizedString, { key });
|
|
142
|
+
}
|
|
143
|
+
/** Signal whether the form's mandatory requirements are satisfied */
|
|
144
|
+
sendExtensionMandatoryStatus(isCompleted) {
|
|
145
|
+
return this._call(BridgeMethods.sendExtensionMandatoryStatus, { isCompleted });
|
|
146
|
+
}
|
|
147
|
+
/** Exit the form and return to the native app */
|
|
148
|
+
exit() {
|
|
149
|
+
return this._call(BridgeMethods.exit);
|
|
150
|
+
}
|
|
151
|
+
/** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
|
|
152
|
+
collectTapToPayPayment(params) {
|
|
153
|
+
return this._call(BridgeMethods.collectTapToPayPayment, params, 12e4);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/index.ts
|
|
158
|
+
var mexBridge = new MexBridge();
|
|
159
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
160
|
+
0 && (module.exports = {
|
|
161
|
+
BridgeMethods,
|
|
162
|
+
MexBridge,
|
|
163
|
+
mexBridge
|
|
164
|
+
});
|
|
6
165
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAYvC,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types.ts","../src/MexBridge.ts"],"sourcesContent":["export { MexBridge } from './MexBridge'\nexport { BridgeMethods } from './types'\nexport type {\n CaptureAttachmentsParams,\n AddAttachmentsParams,\n AttachmentSource,\n PickedFile,\n AttachmentMetadata,\n AttachmentsByParentIdResult,\n AuthenticationInfo,\n FormMetadata,\n TapToPayParams,\n TapToPayResult,\n} from './types'\n\n// Singleton instance for convenience\nimport { MexBridge } from './MexBridge'\nexport const mexBridge = new MexBridge()\n","/** Bridge method name constants — shared between web SDK and native handlers */\nexport const BridgeMethods = {\n getInstanceData: 'getInstanceData',\n getStaticData: 'getStaticData',\n captureAttachments: 'captureAttachments',\n addAttachments: 'addAttachments',\n removeAttachment: 'removeAttachment',\n getAttachment: 'getAttachment',\n getAttachmentsByParentId: 'getAttachmentsByParentId',\n saveInstanceData: 'saveInstanceData',\n getMetadata: 'getMetadata',\n getAuthenticationInfo: 'getAuthenticationInfo',\n getLocalizedString: 'getLocalizedString',\n sendExtensionMandatoryStatus: 'sendExtensionMandatoryStatus',\n exit: 'exit',\n collectTapToPayPayment: 'collectTapToPayPayment',\n} as const\n\n/** Available attachment picker sources */\nexport type AttachmentSource = 'camera' | 'photoLibrary' | 'files'\n\n/** Parameters for capturing attachments via native pickers */\nexport interface CaptureAttachmentsParams {\n /** Which picker sources to offer. Defaults to all three. If only one, opens directly without bottom sheet. */\n sources?: AttachmentSource[]\n}\n\n/** A file picked from a native picker (camera, photo library, or file browser) */\nexport interface PickedFile {\n uri: string\n fileName: string\n}\n\n/** Parameters for persisting captured attachments to the native layer */\nexport interface AddAttachmentsParams {\n /** The picked files to persist */\n attachments: PickedFile[]\n /** The parent object ID to associate attachments with */\n parentContextId: string\n /** Optional category name for the attachments */\n categoryName?: string\n}\n\n/** Metadata about a stored attachment (returned by getAttachment) */\nexport interface AttachmentMetadata {\n uid: string\n fileName: string\n downloadURL?: string\n status?: string\n contentType?: string\n}\n\n/** Result of getAttachmentsByParentId — matches MexAttachmentsOnParentContextChangedResult */\nexport interface AttachmentsByParentIdResult {\n attachments: AttachmentMetadata[]\n parentId: string\n}\n\n/** Authentication information for the current user */\nexport interface AuthenticationInfo {\n accessToken: string\n apiUrl: string\n userId?: string\n}\n\n/** Form metadata */\nexport interface FormMetadata {\n contextObjectId: string\n packageId: string\n formName?: string\n contextObject?: string\n user?: Record<string, any>\n job?: Record<string, any>\n timezone?: Record<string, any>\n}\n\n/** Parameters for initiating a Tap to Pay payment via Stripe Terminal */\nexport interface TapToPayParams {\n connectionToken: string\n clientSecret: string\n locationId: string\n}\n\n/** Result of a Tap to Pay payment attempt */\nexport interface TapToPayResult {\n success: boolean\n paymentIntentId?: string\n error?: string\n}\n\n/** Internal bridge message from web to RN */\nexport interface BridgeCallMessage {\n type: 'bridge_call'\n method: string\n requestId: string\n params?: any\n}\n\n/** Internal bridge response from RN to web */\nexport interface BridgeResponseMessage {\n type: 'bridge_response'\n requestId: string\n result?: any\n error?: string\n}\n","import { BridgeMethods } from './types'\nimport type { CaptureAttachmentsParams, AddAttachmentsParams, PickedFile, AttachmentMetadata, AttachmentsByParentIdResult, AuthenticationInfo, FormMetadata, BridgeResponseMessage, TapToPayParams, TapToPayResult } from './types'\n\ntype PendingCallback = {\n resolve: (value: any) => void\n reject: (reason: any) => void\n timeoutId: ReturnType<typeof setTimeout>\n}\n\ndeclare global {\n interface Window {\n ReactNativeWebView?: {\n postMessage(message: string): void\n }\n onNativeMessage?: (messageString: string) => void\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 30_000\n\nclass MexBridge {\n private _callbacks = new Map<string, PendingCallback>()\n private _initialized = false\n\n constructor() {\n this._initialize()\n }\n\n private _initialize(): void {\n if (this._initialized) return\n this._initialized = true\n\n window.onNativeMessage = (messageString: string) => {\n try {\n const message: BridgeResponseMessage = JSON.parse(messageString)\n if (message.type !== 'bridge_response' || !message.requestId) return\n\n const pending = this._callbacks.get(message.requestId)\n if (!pending) return\n\n clearTimeout(pending.timeoutId)\n this._callbacks.delete(message.requestId)\n\n if (message.error) {\n pending.reject(new Error(message.error))\n } else {\n pending.resolve(message.result)\n }\n } catch (e) {\n console.warn('[MexBridge] Failed to parse native message:', e)\n }\n }\n }\n\n private _call<T = any>(method: string, params?: any, timeoutMs = DEFAULT_TIMEOUT_MS): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n if (!window.ReactNativeWebView) {\n reject(new Error('[MexBridge] Not running inside a React Native WebView'))\n return\n }\n\n const requestId = this._generateId()\n\n const timeoutId = setTimeout(() => {\n this._callbacks.delete(requestId)\n reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`))\n }, timeoutMs)\n\n this._callbacks.set(requestId, { resolve, reject, timeoutId })\n\n window.ReactNativeWebView.postMessage(JSON.stringify({\n type: 'bridge_call',\n method,\n requestId,\n params,\n }))\n })\n }\n\n private _generateId(): string {\n return Math.random().toString(36).substring(2) + Date.now().toString(36)\n }\n\n /** Fetch the current form instance data */\n getInstanceData(): Promise<any> {\n return this._call(BridgeMethods.getInstanceData)\n }\n\n /** Fetch static/shared data for the form */\n getStaticData(): Promise<any> {\n return this._call(BridgeMethods.getStaticData)\n }\n\n /** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */\n captureAttachments(params?: CaptureAttachmentsParams): Promise<PickedFile[] | null> {\n return this._call<PickedFile[] | null>(BridgeMethods.captureAttachments, params)\n }\n\n /** Persist captured attachments to the native mobile layer */\n addAttachments(params: AddAttachmentsParams): Promise<any> {\n return this._call(BridgeMethods.addAttachments, params)\n }\n\n /** Remove an existing attachment by ID */\n removeAttachment(attachmentId: string): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.removeAttachment, { attachmentId })\n }\n\n /** Retrieve attachment metadata by ID */\n getAttachment(attachmentId: string): Promise<AttachmentMetadata> {\n return this._call<AttachmentMetadata>(BridgeMethods.getAttachment, { attachmentId })\n }\n\n /** Get all attachments for a parent object (one-shot, not observable) */\n getAttachmentsByParentId(parentContextId: string): Promise<AttachmentsByParentIdResult> {\n return this._call<AttachmentsByParentIdResult>(BridgeMethods.getAttachmentsByParentId, { parentContextId })\n }\n\n /** Persist form data back to the engine */\n saveInstanceData(data: any): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.saveInstanceData, { data })\n }\n\n /** Retrieve form metadata (form name, context, user info, etc.) */\n getMetadata(): Promise<FormMetadata> {\n return this._call<FormMetadata>(BridgeMethods.getMetadata)\n }\n\n /** Get the current user's auth token and identity */\n getAuthenticationInfo(): Promise<AuthenticationInfo> {\n return this._call<AuthenticationInfo>(BridgeMethods.getAuthenticationInfo)\n }\n\n /** Get a localized string by key from the form's locale files */\n getLocalizedString(key: string): Promise<string> {\n return this._call<string>(BridgeMethods.getLocalizedString, { key })\n }\n\n /** Signal whether the form's mandatory requirements are satisfied */\n sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.sendExtensionMandatoryStatus, { isCompleted })\n }\n\n /** Exit the form and return to the native app */\n exit(): Promise<void> {\n return this._call<void>(BridgeMethods.exit)\n }\n\n /** Initiate a Tap to Pay payment via Stripe Terminal on the native device */\n collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult> {\n return this._call<TapToPayResult>(BridgeMethods.collectTapToPayPayment, params, 120_000)\n }\n}\n\nexport { MexBridge }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,gBAAgB;AAAA,EAC3B,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,8BAA8B;AAAA,EAC9B,MAAM;AAAA,EACN,wBAAwB;AAC1B;;;ACE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,KAAK,MAAe,cAAc,8BAA8B,EAAE,YAAY,CAAC;AAAA,EACxF;AAAA;AAAA,EAGA,OAAsB;AACpB,WAAO,KAAK,MAAY,cAAc,IAAI;AAAA,EAC5C;AAAA;AAAA,EAGA,uBAAuB,QAAiD;AACtE,WAAO,KAAK,MAAsB,cAAc,wBAAwB,QAAQ,IAAO;AAAA,EACzF;AACF;;;AFvIO,IAAM,YAAY,IAAI,UAAU;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,8 @@ var BridgeMethods = {
|
|
|
12
12
|
getAuthenticationInfo: "getAuthenticationInfo",
|
|
13
13
|
getLocalizedString: "getLocalizedString",
|
|
14
14
|
sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus",
|
|
15
|
-
exit: "exit"
|
|
15
|
+
exit: "exit",
|
|
16
|
+
collectTapToPayPayment: "collectTapToPayPayment"
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
// src/MexBridge.ts
|
|
@@ -119,6 +120,10 @@ var MexBridge = class {
|
|
|
119
120
|
exit() {
|
|
120
121
|
return this._call(BridgeMethods.exit);
|
|
121
122
|
}
|
|
123
|
+
/** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
|
|
124
|
+
collectTapToPayPayment(params) {
|
|
125
|
+
return this._call(BridgeMethods.collectTapToPayPayment, params, 12e4);
|
|
126
|
+
}
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
// src/index.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts","../src/MexBridge.ts","../src/index.ts"],"sourcesContent":["/** Bridge method name constants — shared between web SDK and native handlers */\nexport const BridgeMethods = {\n getInstanceData: 'getInstanceData',\n getStaticData: 'getStaticData',\n captureAttachments: 'captureAttachments',\n addAttachments: 'addAttachments',\n removeAttachment: 'removeAttachment',\n getAttachment: 'getAttachment',\n getAttachmentsByParentId: 'getAttachmentsByParentId',\n saveInstanceData: 'saveInstanceData',\n getMetadata: 'getMetadata',\n getAuthenticationInfo: 'getAuthenticationInfo',\n getLocalizedString: 'getLocalizedString',\n sendExtensionMandatoryStatus: 'sendExtensionMandatoryStatus',\n exit: 'exit',\n} as const\n\n/** Available attachment picker sources */\nexport type AttachmentSource = 'camera' | 'photoLibrary' | 'files'\n\n/** Parameters for capturing attachments via native pickers */\nexport interface CaptureAttachmentsParams {\n /** Which picker sources to offer. Defaults to all three. If only one, opens directly without bottom sheet. */\n sources?: AttachmentSource[]\n}\n\n/** A file picked from a native picker (camera, photo library, or file browser) */\nexport interface PickedFile {\n uri: string\n fileName: string\n}\n\n/** Parameters for persisting captured attachments to the native layer */\nexport interface AddAttachmentsParams {\n /** The picked files to persist */\n attachments: PickedFile[]\n /** The parent object ID to associate attachments with */\n parentContextId: string\n /** Optional category name for the attachments */\n categoryName?: string\n}\n\n/** Metadata about a stored attachment (returned by getAttachment) */\nexport interface AttachmentMetadata {\n uid: string\n fileName: string\n downloadURL?: string\n status?: string\n contentType?: string\n}\n\n/** Result of getAttachmentsByParentId — matches MexAttachmentsOnParentContextChangedResult */\nexport interface AttachmentsByParentIdResult {\n attachments: AttachmentMetadata[]\n parentId: string\n}\n\n/** Authentication information for the current user */\nexport interface AuthenticationInfo {\n accessToken: string\n apiUrl: string\n userId?: string\n}\n\n/** Form metadata */\nexport interface FormMetadata {\n contextObjectId: string\n packageId: string\n formName?: string\n contextObject?: string\n user?: Record<string, any>\n job?: Record<string, any>\n timezone?: Record<string, any>\n}\n\n/** Internal bridge message from web to RN */\nexport interface BridgeCallMessage {\n type: 'bridge_call'\n method: string\n requestId: string\n params?: any\n}\n\n/** Internal bridge response from RN to web */\nexport interface BridgeResponseMessage {\n type: 'bridge_response'\n requestId: string\n result?: any\n error?: string\n}\n","import { BridgeMethods } from './types'\nimport type { CaptureAttachmentsParams, AddAttachmentsParams, PickedFile, AttachmentMetadata, AttachmentsByParentIdResult, AuthenticationInfo, FormMetadata, BridgeResponseMessage } from './types'\n\ntype PendingCallback = {\n resolve: (value: any) => void\n reject: (reason: any) => void\n timeoutId: ReturnType<typeof setTimeout>\n}\n\ndeclare global {\n interface Window {\n ReactNativeWebView?: {\n postMessage(message: string): void\n }\n onNativeMessage?: (messageString: string) => void\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 30_000\n\nclass MexBridge {\n private _callbacks = new Map<string, PendingCallback>()\n private _initialized = false\n\n constructor() {\n this._initialize()\n }\n\n private _initialize(): void {\n if (this._initialized) return\n this._initialized = true\n\n window.onNativeMessage = (messageString: string) => {\n try {\n const message: BridgeResponseMessage = JSON.parse(messageString)\n if (message.type !== 'bridge_response' || !message.requestId) return\n\n const pending = this._callbacks.get(message.requestId)\n if (!pending) return\n\n clearTimeout(pending.timeoutId)\n this._callbacks.delete(message.requestId)\n\n if (message.error) {\n pending.reject(new Error(message.error))\n } else {\n pending.resolve(message.result)\n }\n } catch (e) {\n console.warn('[MexBridge] Failed to parse native message:', e)\n }\n }\n }\n\n private _call<T = any>(method: string, params?: any, timeoutMs = DEFAULT_TIMEOUT_MS): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n if (!window.ReactNativeWebView) {\n reject(new Error('[MexBridge] Not running inside a React Native WebView'))\n return\n }\n\n const requestId = this._generateId()\n\n const timeoutId = setTimeout(() => {\n this._callbacks.delete(requestId)\n reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`))\n }, timeoutMs)\n\n this._callbacks.set(requestId, { resolve, reject, timeoutId })\n\n window.ReactNativeWebView.postMessage(JSON.stringify({\n type: 'bridge_call',\n method,\n requestId,\n params,\n }))\n })\n }\n\n private _generateId(): string {\n return Math.random().toString(36).substring(2) + Date.now().toString(36)\n }\n\n /** Fetch the current form instance data */\n getInstanceData(): Promise<any> {\n return this._call(BridgeMethods.getInstanceData)\n }\n\n /** Fetch static/shared data for the form */\n getStaticData(): Promise<any> {\n return this._call(BridgeMethods.getStaticData)\n }\n\n /** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */\n captureAttachments(params?: CaptureAttachmentsParams): Promise<PickedFile[] | null> {\n return this._call<PickedFile[] | null>(BridgeMethods.captureAttachments, params)\n }\n\n /** Persist captured attachments to the native mobile layer */\n addAttachments(params: AddAttachmentsParams): Promise<any> {\n return this._call(BridgeMethods.addAttachments, params)\n }\n\n /** Remove an existing attachment by ID */\n removeAttachment(attachmentId: string): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.removeAttachment, { attachmentId })\n }\n\n /** Retrieve attachment metadata by ID */\n getAttachment(attachmentId: string): Promise<AttachmentMetadata> {\n return this._call<AttachmentMetadata>(BridgeMethods.getAttachment, { attachmentId })\n }\n\n /** Get all attachments for a parent object (one-shot, not observable) */\n getAttachmentsByParentId(parentContextId: string): Promise<AttachmentsByParentIdResult> {\n return this._call<AttachmentsByParentIdResult>(BridgeMethods.getAttachmentsByParentId, { parentContextId })\n }\n\n /** Persist form data back to the engine */\n saveInstanceData(data: any): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.saveInstanceData, { data })\n }\n\n /** Retrieve form metadata (form name, context, user info, etc.) */\n getMetadata(): Promise<FormMetadata> {\n return this._call<FormMetadata>(BridgeMethods.getMetadata)\n }\n\n /** Get the current user's auth token and identity */\n getAuthenticationInfo(): Promise<AuthenticationInfo> {\n return this._call<AuthenticationInfo>(BridgeMethods.getAuthenticationInfo)\n }\n\n /** Get a localized string by key from the form's locale files */\n getLocalizedString(key: string): Promise<string> {\n return this._call<string>(BridgeMethods.getLocalizedString, { key })\n }\n\n /** Signal whether the form's mandatory requirements are satisfied */\n sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.sendExtensionMandatoryStatus, { isCompleted })\n }\n\n /** Exit the form and return to the native app */\n exit(): Promise<void> {\n return this._call<void>(BridgeMethods.exit)\n }\n}\n\nexport { MexBridge }\n","export { MexBridge } from './MexBridge'\nexport { BridgeMethods } from './types'\nexport type {\n CaptureAttachmentsParams,\n AddAttachmentsParams,\n AttachmentSource,\n PickedFile,\n AttachmentMetadata,\n AttachmentsByParentIdResult,\n AuthenticationInfo,\n FormMetadata,\n} from './types'\n\n// Singleton instance for convenience\nimport { MexBridge } from './MexBridge'\nexport const mexBridge = new MexBridge()\n"],"mappings":";AACO,IAAM,gBAAgB;AAAA,EAC3B,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,8BAA8B;AAAA,EAC9B,MAAM;AACR;;;ACGA,IAAM,qBAAqB;AAE3B,IAAM,YAAN,MAAgB;AAAA,EAId,cAAc;AAHd,SAAQ,aAAa,oBAAI,IAA6B;AACtD,SAAQ,eAAe;AAGrB,SAAK,YAAY;AAAA,EACnB;AAAA,EAEQ,cAAoB;AAC1B,QAAI,KAAK,aAAc;AACvB,SAAK,eAAe;AAEpB,WAAO,kBAAkB,CAAC,kBAA0B;AAClD,UAAI;AACF,cAAM,UAAiC,KAAK,MAAM,aAAa;AAC/D,YAAI,QAAQ,SAAS,qBAAqB,CAAC,QAAQ,UAAW;AAE9D,cAAM,UAAU,KAAK,WAAW,IAAI,QAAQ,SAAS;AACrD,YAAI,CAAC,QAAS;AAEd,qBAAa,QAAQ,SAAS;AAC9B,aAAK,WAAW,OAAO,QAAQ,SAAS;AAExC,YAAI,QAAQ,OAAO;AACjB,kBAAQ,OAAO,IAAI,MAAM,QAAQ,KAAK,CAAC;AAAA,QACzC,OAAO;AACL,kBAAQ,QAAQ,QAAQ,MAAM;AAAA,QAChC;AAAA,MACF,SAAS,GAAG;AACV,gBAAQ,KAAK,+CAA+C,CAAC;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,MAAe,QAAgB,QAAc,YAAY,oBAAgC;AAC/F,W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mC,cAAc,0BAA0B,EAAE,gBAAgB,CAAC;AAAA,EAC5G;AAAA;AAAA,EAGA,iBAAiB,MAA6B;AAC5C,WAAO,KAAK,MAAe,cAAc,kBAAkB,EAAE,KAAK,CAAC;AAAA,EACrE;AAAA;AAAA,EAGA,cAAqC;AACnC,WAAO,KAAK,MAAoB,cAAc,WAAW;AAAA,EAC3D;AAAA;AAAA,EAGA,wBAAqD;AACnD,WAAO,KAAK,MAA0B,cAAc,qBAAqB;AAAA,EAC3E;AAAA;AAAA,EAGA,mBAAmB,KAA8B;AAC/C,WAAO,KAAK,MAAc,cAAc,oBAAoB,EAAE,IAAI,CAAC;AAAA,EACrE;AAAA;AAAA,EAGA,6BAA6B,aAAwC;AACnE,WAAO,KAAK,MAAe,cAAc,8BAA8B,EAAE,YAAY,CAAC;AAAA,EACxF;AAAA;AAAA,EAGA,OAAsB;AACpB,WAAO,KAAK,MAAY,cAAc,IAAI;AAAA,EAC5C;AACF;;;ACpIO,IAAM,YAAY,IAAI,UAAU;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts","../src/MexBridge.ts","../src/index.ts"],"sourcesContent":["/** Bridge method name constants — shared between web SDK and native handlers */\nexport const BridgeMethods = {\n getInstanceData: 'getInstanceData',\n getStaticData: 'getStaticData',\n captureAttachments: 'captureAttachments',\n addAttachments: 'addAttachments',\n removeAttachment: 'removeAttachment',\n getAttachment: 'getAttachment',\n getAttachmentsByParentId: 'getAttachmentsByParentId',\n saveInstanceData: 'saveInstanceData',\n getMetadata: 'getMetadata',\n getAuthenticationInfo: 'getAuthenticationInfo',\n getLocalizedString: 'getLocalizedString',\n sendExtensionMandatoryStatus: 'sendExtensionMandatoryStatus',\n exit: 'exit',\n collectTapToPayPayment: 'collectTapToPayPayment',\n} as const\n\n/** Available attachment picker sources */\nexport type AttachmentSource = 'camera' | 'photoLibrary' | 'files'\n\n/** Parameters for capturing attachments via native pickers */\nexport interface CaptureAttachmentsParams {\n /** Which picker sources to offer. Defaults to all three. If only one, opens directly without bottom sheet. */\n sources?: AttachmentSource[]\n}\n\n/** A file picked from a native picker (camera, photo library, or file browser) */\nexport interface PickedFile {\n uri: string\n fileName: string\n}\n\n/** Parameters for persisting captured attachments to the native layer */\nexport interface AddAttachmentsParams {\n /** The picked files to persist */\n attachments: PickedFile[]\n /** The parent object ID to associate attachments with */\n parentContextId: string\n /** Optional category name for the attachments */\n categoryName?: string\n}\n\n/** Metadata about a stored attachment (returned by getAttachment) */\nexport interface AttachmentMetadata {\n uid: string\n fileName: string\n downloadURL?: string\n status?: string\n contentType?: string\n}\n\n/** Result of getAttachmentsByParentId — matches MexAttachmentsOnParentContextChangedResult */\nexport interface AttachmentsByParentIdResult {\n attachments: AttachmentMetadata[]\n parentId: string\n}\n\n/** Authentication information for the current user */\nexport interface AuthenticationInfo {\n accessToken: string\n apiUrl: string\n userId?: string\n}\n\n/** Form metadata */\nexport interface FormMetadata {\n contextObjectId: string\n packageId: string\n formName?: string\n contextObject?: string\n user?: Record<string, any>\n job?: Record<string, any>\n timezone?: Record<string, any>\n}\n\n/** Parameters for initiating a Tap to Pay payment via Stripe Terminal */\nexport interface TapToPayParams {\n connectionToken: string\n clientSecret: string\n locationId: string\n}\n\n/** Result of a Tap to Pay payment attempt */\nexport interface TapToPayResult {\n success: boolean\n paymentIntentId?: string\n error?: string\n}\n\n/** Internal bridge message from web to RN */\nexport interface BridgeCallMessage {\n type: 'bridge_call'\n method: string\n requestId: string\n params?: any\n}\n\n/** Internal bridge response from RN to web */\nexport interface BridgeResponseMessage {\n type: 'bridge_response'\n requestId: string\n result?: any\n error?: string\n}\n","import { BridgeMethods } from './types'\nimport type { CaptureAttachmentsParams, AddAttachmentsParams, PickedFile, AttachmentMetadata, AttachmentsByParentIdResult, AuthenticationInfo, FormMetadata, BridgeResponseMessage, TapToPayParams, TapToPayResult } from './types'\n\ntype PendingCallback = {\n resolve: (value: any) => void\n reject: (reason: any) => void\n timeoutId: ReturnType<typeof setTimeout>\n}\n\ndeclare global {\n interface Window {\n ReactNativeWebView?: {\n postMessage(message: string): void\n }\n onNativeMessage?: (messageString: string) => void\n }\n}\n\nconst DEFAULT_TIMEOUT_MS = 30_000\n\nclass MexBridge {\n private _callbacks = new Map<string, PendingCallback>()\n private _initialized = false\n\n constructor() {\n this._initialize()\n }\n\n private _initialize(): void {\n if (this._initialized) return\n this._initialized = true\n\n window.onNativeMessage = (messageString: string) => {\n try {\n const message: BridgeResponseMessage = JSON.parse(messageString)\n if (message.type !== 'bridge_response' || !message.requestId) return\n\n const pending = this._callbacks.get(message.requestId)\n if (!pending) return\n\n clearTimeout(pending.timeoutId)\n this._callbacks.delete(message.requestId)\n\n if (message.error) {\n pending.reject(new Error(message.error))\n } else {\n pending.resolve(message.result)\n }\n } catch (e) {\n console.warn('[MexBridge] Failed to parse native message:', e)\n }\n }\n }\n\n private _call<T = any>(method: string, params?: any, timeoutMs = DEFAULT_TIMEOUT_MS): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n if (!window.ReactNativeWebView) {\n reject(new Error('[MexBridge] Not running inside a React Native WebView'))\n return\n }\n\n const requestId = this._generateId()\n\n const timeoutId = setTimeout(() => {\n this._callbacks.delete(requestId)\n reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`))\n }, timeoutMs)\n\n this._callbacks.set(requestId, { resolve, reject, timeoutId })\n\n window.ReactNativeWebView.postMessage(JSON.stringify({\n type: 'bridge_call',\n method,\n requestId,\n params,\n }))\n })\n }\n\n private _generateId(): string {\n return Math.random().toString(36).substring(2) + Date.now().toString(36)\n }\n\n /** Fetch the current form instance data */\n getInstanceData(): Promise<any> {\n return this._call(BridgeMethods.getInstanceData)\n }\n\n /** Fetch static/shared data for the form */\n getStaticData(): Promise<any> {\n return this._call(BridgeMethods.getStaticData)\n }\n\n /** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */\n captureAttachments(params?: CaptureAttachmentsParams): Promise<PickedFile[] | null> {\n return this._call<PickedFile[] | null>(BridgeMethods.captureAttachments, params)\n }\n\n /** Persist captured attachments to the native mobile layer */\n addAttachments(params: AddAttachmentsParams): Promise<any> {\n return this._call(BridgeMethods.addAttachments, params)\n }\n\n /** Remove an existing attachment by ID */\n removeAttachment(attachmentId: string): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.removeAttachment, { attachmentId })\n }\n\n /** Retrieve attachment metadata by ID */\n getAttachment(attachmentId: string): Promise<AttachmentMetadata> {\n return this._call<AttachmentMetadata>(BridgeMethods.getAttachment, { attachmentId })\n }\n\n /** Get all attachments for a parent object (one-shot, not observable) */\n getAttachmentsByParentId(parentContextId: string): Promise<AttachmentsByParentIdResult> {\n return this._call<AttachmentsByParentIdResult>(BridgeMethods.getAttachmentsByParentId, { parentContextId })\n }\n\n /** Persist form data back to the engine */\n saveInstanceData(data: any): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.saveInstanceData, { data })\n }\n\n /** Retrieve form metadata (form name, context, user info, etc.) */\n getMetadata(): Promise<FormMetadata> {\n return this._call<FormMetadata>(BridgeMethods.getMetadata)\n }\n\n /** Get the current user's auth token and identity */\n getAuthenticationInfo(): Promise<AuthenticationInfo> {\n return this._call<AuthenticationInfo>(BridgeMethods.getAuthenticationInfo)\n }\n\n /** Get a localized string by key from the form's locale files */\n getLocalizedString(key: string): Promise<string> {\n return this._call<string>(BridgeMethods.getLocalizedString, { key })\n }\n\n /** Signal whether the form's mandatory requirements are satisfied */\n sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean> {\n return this._call<boolean>(BridgeMethods.sendExtensionMandatoryStatus, { isCompleted })\n }\n\n /** Exit the form and return to the native app */\n exit(): Promise<void> {\n return this._call<void>(BridgeMethods.exit)\n }\n\n /** Initiate a Tap to Pay payment via Stripe Terminal on the native device */\n collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult> {\n return this._call<TapToPayResult>(BridgeMethods.collectTapToPayPayment, params, 120_000)\n }\n}\n\nexport { MexBridge }\n","export { MexBridge } from './MexBridge'\nexport { BridgeMethods } from './types'\nexport type {\n CaptureAttachmentsParams,\n AddAttachmentsParams,\n AttachmentSource,\n PickedFile,\n AttachmentMetadata,\n AttachmentsByParentIdResult,\n AuthenticationInfo,\n FormMetadata,\n TapToPayParams,\n TapToPayResult,\n} from './types'\n\n// Singleton instance for convenience\nimport { MexBridge } from './MexBridge'\nexport const mexBridge = new MexBridge()\n"],"mappings":";AACO,IAAM,gBAAgB;AAAA,EAC3B,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,8BAA8B;AAAA,EAC9B,MAAM;AAAA,EACN,wBAAwB;AAC1B;;;ACEA,IAAM,qBAAqB;AAE3B,IAAM,YAAN,MAAgB;AAAA,EAId,cAAc;AAHd,SAAQ,aAAa,oBAAI,IAA6B;AACtD,SAAQ,eAAe;AAGrB,SAAK,YAAY;AAAA,EACnB;AAAA,EAEQ,cAAoB;AAC1B,QAAI,KAAK,aAAc;AACvB,SAAK,eAAe;AAEpB,WAAO,kBAAkB,CAAC,kBAA0B;AAClD,UAAI;AACF,cAAM,UAAiC,KAAK,MAAM,aAAa;AAC/D,YAAI,QAAQ,SAAS,qBAAqB,CAAC,QAAQ,UAAW;AAE9D,cAAM,UAAU,KAAK,WAAW,IAAI,QAAQ,SAAS;AACrD,YAAI,CAAC,QAAS;AAEd,qBAAa,QAAQ,SAAS;AAC9B,aAAK,WAAW,OAAO,QAAQ,SAAS;AAExC,YAAI,QAAQ,OAAO;AACjB,kBAAQ,OAAO,IAAI,MAAM,QAAQ,KAAK,CAAC;AAAA,QACzC,OAAO;AACL,kBAAQ,QAAQ,QAAQ,MAAM;AAAA,QAChC;AAAA,MACF,SAAS,GAAG;AACV,gBAAQ,KAAK,+CA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B,cAAc,eAAe,EAAE,aAAa,CAAC;AAAA,EACrF;AAAA;AAAA,EAGA,yBAAyB,iBAA+D;AACtF,WAAO,KAAK,MAAmC,cAAc,0BAA0B,EAAE,gBAAgB,CAAC;AAAA,EAC5G;AAAA;AAAA,EAGA,iBAAiB,MAA6B;AAC5C,WAAO,KAAK,MAAe,cAAc,kBAAkB,EAAE,KAAK,CAAC;AAAA,EACrE;AAAA;AAAA,EAGA,cAAqC;AACnC,WAAO,KAAK,MAAoB,cAAc,WAAW;AAAA,EAC3D;AAAA;AAAA,EAGA,wBAAqD;AACnD,WAAO,KAAK,MAA0B,cAAc,qBAAqB;AAAA,EAC3E;AAAA;AAAA,EAGA,mBAAmB,KAA8B;AAC/C,WAAO,KAAK,MAAc,cAAc,oBAAoB,EAAE,IAAI,CAAC;AAAA,EACrE;AAAA;AAAA,EAGA,6BAA6B,aAAwC;AACnE,WAAO,KAAK,MAAe,cAAc,8BAA8B,EAAE,YAAY,CAAC;AAAA,EACxF;AAAA;AAAA,EAGA,OAAsB;AACpB,WAAO,KAAK,MAAY,cAAc,IAAI;AAAA,EAC5C;AAAA;AAAA,EAGA,uBAAuB,QAAiD;AACtE,WAAO,KAAK,MAAsB,cAAc,wBAAwB,QAAQ,IAAO;AAAA,EACzF;AACF;;;ACvIO,IAAM,YAAY,IAAI,UAAU;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skedulo/mexwex-bridge",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Communication bridge SDK between MEXWEX web apps and Skedulo mex-engine (React Native)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -22,9 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"keywords": ["skedulo", "mexwex", "bridge", "webview", "react-native"],
|
|
24
24
|
"license": "MIT",
|
|
25
|
-
"engines": {
|
|
26
|
-
"node": ">=22"
|
|
27
|
-
},
|
|
28
25
|
"publishConfig": {
|
|
29
26
|
"access": "public"
|
|
30
27
|
}
|
package/dist/MexBridge.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { CaptureAttachmentsParams, AddAttachmentsParams, PickedFile, AttachmentMetadata, AttachmentsByParentIdResult, AuthenticationInfo, FormMetadata } from './types';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
ReactNativeWebView?: {
|
|
5
|
-
postMessage(message: string): void;
|
|
6
|
-
};
|
|
7
|
-
onNativeMessage?: (messageString: string) => void;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
declare class MexBridge {
|
|
11
|
-
private _callbacks;
|
|
12
|
-
private _initialized;
|
|
13
|
-
constructor();
|
|
14
|
-
private _initialize;
|
|
15
|
-
private _call;
|
|
16
|
-
private _generateId;
|
|
17
|
-
/** Fetch the current form instance data */
|
|
18
|
-
getInstanceData(): Promise<any>;
|
|
19
|
-
/** Fetch static/shared data for the form */
|
|
20
|
-
getStaticData(): Promise<any>;
|
|
21
|
-
/** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
|
|
22
|
-
captureAttachments(params?: CaptureAttachmentsParams): Promise<PickedFile[] | null>;
|
|
23
|
-
/** Persist captured attachments to the native mobile layer */
|
|
24
|
-
addAttachments(params: AddAttachmentsParams): Promise<any>;
|
|
25
|
-
/** Remove an existing attachment by ID */
|
|
26
|
-
removeAttachment(attachmentId: string): Promise<boolean>;
|
|
27
|
-
/** Retrieve attachment metadata by ID */
|
|
28
|
-
getAttachment(attachmentId: string): Promise<AttachmentMetadata>;
|
|
29
|
-
/** Get all attachments for a parent object (one-shot, not observable) */
|
|
30
|
-
getAttachmentsByParentId(parentContextId: string): Promise<AttachmentsByParentIdResult>;
|
|
31
|
-
/** Persist form data back to the engine */
|
|
32
|
-
saveInstanceData(data: any): Promise<boolean>;
|
|
33
|
-
/** Retrieve form metadata (form name, context, user info, etc.) */
|
|
34
|
-
getMetadata(): Promise<FormMetadata>;
|
|
35
|
-
/** Get the current user's auth token and identity */
|
|
36
|
-
getAuthenticationInfo(): Promise<AuthenticationInfo>;
|
|
37
|
-
/** Get a localized string by key from the form's locale files */
|
|
38
|
-
getLocalizedString(key: string): Promise<string>;
|
|
39
|
-
/** Signal whether the form's mandatory requirements are satisfied */
|
|
40
|
-
sendExtensionMandatoryStatus(isCompleted: boolean): Promise<boolean>;
|
|
41
|
-
/** Exit the form and return to the native app */
|
|
42
|
-
exit(): Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
export { MexBridge };
|
|
45
|
-
//# sourceMappingURL=MexBridge.d.ts.map
|
package/dist/MexBridge.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MexBridge.d.ts","sourceRoot":"","sources":["../src/MexBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,UAAU,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,YAAY,EAAyB,MAAM,SAAS,CAAA;AAQnM,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,kBAAkB,CAAC,EAAE;YACnB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;SACnC,CAAA;QACD,eAAe,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAA;KAClD;CACF;AAID,cAAM,SAAS;IACb,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,YAAY,CAAQ;;IAM5B,OAAO,CAAC,WAAW;IA0BnB,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,WAAW;IAInB,2CAA2C;IAC3C,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;IAI/B,4CAA4C;IAC5C,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC;IAI7B,4GAA4G;IAC5G,kBAAkB,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC;IAInF,8DAA8D;IAC9D,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1D,0CAA0C;IAC1C,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxD,yCAAyC;IACzC,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIhE,yEAAyE;IACzE,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAIvF,2CAA2C;IAC3C,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7C,mEAAmE;IACnE,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAIpC,qDAAqD;IACrD,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIpD,iEAAiE;IACjE,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,qEAAqE;IACrE,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpE,iDAAiD;IACjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/MexBridge.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { BridgeMethods } from './types';
|
|
2
|
-
const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
|
-
class MexBridge {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._callbacks = new Map();
|
|
6
|
-
this._initialized = false;
|
|
7
|
-
this._initialize();
|
|
8
|
-
}
|
|
9
|
-
_initialize() {
|
|
10
|
-
if (this._initialized)
|
|
11
|
-
return;
|
|
12
|
-
this._initialized = true;
|
|
13
|
-
window.onNativeMessage = (messageString) => {
|
|
14
|
-
try {
|
|
15
|
-
const message = JSON.parse(messageString);
|
|
16
|
-
if (message.type !== 'bridge_response' || !message.requestId)
|
|
17
|
-
return;
|
|
18
|
-
const pending = this._callbacks.get(message.requestId);
|
|
19
|
-
if (!pending)
|
|
20
|
-
return;
|
|
21
|
-
clearTimeout(pending.timeoutId);
|
|
22
|
-
this._callbacks.delete(message.requestId);
|
|
23
|
-
if (message.error) {
|
|
24
|
-
pending.reject(new Error(message.error));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
pending.resolve(message.result);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
console.warn('[MexBridge] Failed to parse native message:', e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
_call(method, params, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
if (!window.ReactNativeWebView) {
|
|
38
|
-
reject(new Error('[MexBridge] Not running inside a React Native WebView'));
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const requestId = this._generateId();
|
|
42
|
-
const timeoutId = setTimeout(() => {
|
|
43
|
-
this._callbacks.delete(requestId);
|
|
44
|
-
reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`));
|
|
45
|
-
}, timeoutMs);
|
|
46
|
-
this._callbacks.set(requestId, { resolve, reject, timeoutId });
|
|
47
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
48
|
-
type: 'bridge_call',
|
|
49
|
-
method,
|
|
50
|
-
requestId,
|
|
51
|
-
params,
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
_generateId() {
|
|
56
|
-
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
57
|
-
}
|
|
58
|
-
/** Fetch the current form instance data */
|
|
59
|
-
getInstanceData() {
|
|
60
|
-
return this._call(BridgeMethods.getInstanceData);
|
|
61
|
-
}
|
|
62
|
-
/** Fetch static/shared data for the form */
|
|
63
|
-
getStaticData() {
|
|
64
|
-
return this._call(BridgeMethods.getStaticData);
|
|
65
|
-
}
|
|
66
|
-
/** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
|
|
67
|
-
captureAttachments(params) {
|
|
68
|
-
return this._call(BridgeMethods.captureAttachments, params);
|
|
69
|
-
}
|
|
70
|
-
/** Persist captured attachments to the native mobile layer */
|
|
71
|
-
addAttachments(params) {
|
|
72
|
-
return this._call(BridgeMethods.addAttachments, params);
|
|
73
|
-
}
|
|
74
|
-
/** Remove an existing attachment by ID */
|
|
75
|
-
removeAttachment(attachmentId) {
|
|
76
|
-
return this._call(BridgeMethods.removeAttachment, { attachmentId });
|
|
77
|
-
}
|
|
78
|
-
/** Retrieve attachment metadata by ID */
|
|
79
|
-
getAttachment(attachmentId) {
|
|
80
|
-
return this._call(BridgeMethods.getAttachment, { attachmentId });
|
|
81
|
-
}
|
|
82
|
-
/** Get all attachments for a parent object (one-shot, not observable) */
|
|
83
|
-
getAttachmentsByParentId(parentContextId) {
|
|
84
|
-
return this._call(BridgeMethods.getAttachmentsByParentId, { parentContextId });
|
|
85
|
-
}
|
|
86
|
-
/** Persist form data back to the engine */
|
|
87
|
-
saveInstanceData(data) {
|
|
88
|
-
return this._call(BridgeMethods.saveInstanceData, { data });
|
|
89
|
-
}
|
|
90
|
-
/** Retrieve form metadata (form name, context, user info, etc.) */
|
|
91
|
-
getMetadata() {
|
|
92
|
-
return this._call(BridgeMethods.getMetadata);
|
|
93
|
-
}
|
|
94
|
-
/** Get the current user's auth token and identity */
|
|
95
|
-
getAuthenticationInfo() {
|
|
96
|
-
return this._call(BridgeMethods.getAuthenticationInfo);
|
|
97
|
-
}
|
|
98
|
-
/** Get a localized string by key from the form's locale files */
|
|
99
|
-
getLocalizedString(key) {
|
|
100
|
-
return this._call(BridgeMethods.getLocalizedString, { key });
|
|
101
|
-
}
|
|
102
|
-
/** Signal whether the form's mandatory requirements are satisfied */
|
|
103
|
-
sendExtensionMandatoryStatus(isCompleted) {
|
|
104
|
-
return this._call(BridgeMethods.sendExtensionMandatoryStatus, { isCompleted });
|
|
105
|
-
}
|
|
106
|
-
/** Exit the form and return to the native app */
|
|
107
|
-
exit() {
|
|
108
|
-
return this._call(BridgeMethods.exit);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export { MexBridge };
|
|
112
|
-
//# sourceMappingURL=MexBridge.js.map
|
package/dist/MexBridge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MexBridge.js","sourceRoot":"","sources":["../src/MexBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAkBvC,MAAM,kBAAkB,GAAG,KAAM,CAAA;AAEjC,MAAM,SAAS;IAIb;QAHQ,eAAU,GAAG,IAAI,GAAG,EAA2B,CAAA;QAC/C,iBAAY,GAAG,KAAK,CAAA;QAG1B,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAEO,WAAW;QACjB,IAAI,IAAI,CAAC,YAAY;YAAE,OAAM;QAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QAExB,MAAM,CAAC,eAAe,GAAG,CAAC,aAAqB,EAAE,EAAE;YACjD,IAAI,CAAC;gBACH,MAAM,OAAO,GAA0B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;gBAChE,IAAI,OAAO,CAAC,IAAI,KAAK,iBAAiB,IAAI,CAAC,OAAO,CAAC,SAAS;oBAAE,OAAM;gBAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBACtD,IAAI,CAAC,OAAO;oBAAE,OAAM;gBAEpB,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBAC/B,IAAI,CAAC,UAAU,CAAC,MAA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BAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,mEAAmE;IACnE,WAAW;QACT,OAAO,IAAI,CAAC,KAAK,CAAe,aAAa,CAAC,WAAW,CAAC,CAAA;IAC5D,CAAC;IAED,qDAAqD;IACrD,qBAAqB;QACnB,OAAO,IAAI,CAAC,KAAK,CAAqB,aAAa,CAAC,qBAAqB,CAAC,CAAA;IAC5E,CAAC;IAED,iEAAiE;IACjE,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAS,aAAa,CAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,qEAAqE;IACrE,4BAA4B,CAAC,WAAoB;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAU,aAAa,CAAC,4BAA4B,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA;IACzF,CAAC;IAED,iDAAiD;IACjD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,kBAAkB,EAClB,YAAY,GACb,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,eAAO,MAAM,SAAS,WAAkB,CAAA"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/** Bridge method name constants — shared between web SDK and native handlers */
|
|
2
|
-
export declare const BridgeMethods: {
|
|
3
|
-
readonly getInstanceData: "getInstanceData";
|
|
4
|
-
readonly getStaticData: "getStaticData";
|
|
5
|
-
readonly captureAttachments: "captureAttachments";
|
|
6
|
-
readonly addAttachments: "addAttachments";
|
|
7
|
-
readonly removeAttachment: "removeAttachment";
|
|
8
|
-
readonly getAttachment: "getAttachment";
|
|
9
|
-
readonly getAttachmentsByParentId: "getAttachmentsByParentId";
|
|
10
|
-
readonly saveInstanceData: "saveInstanceData";
|
|
11
|
-
readonly getMetadata: "getMetadata";
|
|
12
|
-
readonly getAuthenticationInfo: "getAuthenticationInfo";
|
|
13
|
-
readonly getLocalizedString: "getLocalizedString";
|
|
14
|
-
readonly sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus";
|
|
15
|
-
readonly exit: "exit";
|
|
16
|
-
};
|
|
17
|
-
/** Available attachment picker sources */
|
|
18
|
-
export type AttachmentSource = 'camera' | 'photoLibrary' | 'files';
|
|
19
|
-
/** Parameters for capturing attachments via native pickers */
|
|
20
|
-
export interface CaptureAttachmentsParams {
|
|
21
|
-
/** Which picker sources to offer. Defaults to all three. If only one, opens directly without bottom sheet. */
|
|
22
|
-
sources?: AttachmentSource[];
|
|
23
|
-
}
|
|
24
|
-
/** A file picked from a native picker (camera, photo library, or file browser) */
|
|
25
|
-
export interface PickedFile {
|
|
26
|
-
uri: string;
|
|
27
|
-
fileName: string;
|
|
28
|
-
}
|
|
29
|
-
/** Parameters for persisting captured attachments to the native layer */
|
|
30
|
-
export interface AddAttachmentsParams {
|
|
31
|
-
/** The picked files to persist */
|
|
32
|
-
attachments: PickedFile[];
|
|
33
|
-
/** The parent object ID to associate attachments with */
|
|
34
|
-
parentContextId: string;
|
|
35
|
-
/** Optional category name for the attachments */
|
|
36
|
-
categoryName?: string;
|
|
37
|
-
}
|
|
38
|
-
/** Metadata about a stored attachment (returned by getAttachment) */
|
|
39
|
-
export interface AttachmentMetadata {
|
|
40
|
-
uid: string;
|
|
41
|
-
fileName: string;
|
|
42
|
-
downloadURL?: string;
|
|
43
|
-
status?: string;
|
|
44
|
-
contentType?: string;
|
|
45
|
-
}
|
|
46
|
-
/** Result of getAttachmentsByParentId — matches MexAttachmentsOnParentContextChangedResult */
|
|
47
|
-
export interface AttachmentsByParentIdResult {
|
|
48
|
-
attachments: AttachmentMetadata[];
|
|
49
|
-
parentId: string;
|
|
50
|
-
}
|
|
51
|
-
/** Authentication information for the current user */
|
|
52
|
-
export interface AuthenticationInfo {
|
|
53
|
-
accessToken: string;
|
|
54
|
-
apiUrl: string;
|
|
55
|
-
userId?: string;
|
|
56
|
-
}
|
|
57
|
-
/** Form metadata */
|
|
58
|
-
export interface FormMetadata {
|
|
59
|
-
contextObjectId: string;
|
|
60
|
-
packageId: string;
|
|
61
|
-
formName?: string;
|
|
62
|
-
contextObject?: string;
|
|
63
|
-
user?: Record<string, any>;
|
|
64
|
-
job?: Record<string, any>;
|
|
65
|
-
timezone?: Record<string, any>;
|
|
66
|
-
}
|
|
67
|
-
/** Internal bridge message from web to RN */
|
|
68
|
-
export interface BridgeCallMessage {
|
|
69
|
-
type: 'bridge_call';
|
|
70
|
-
method: string;
|
|
71
|
-
requestId: string;
|
|
72
|
-
params?: any;
|
|
73
|
-
}
|
|
74
|
-
/** Internal bridge response from RN to web */
|
|
75
|
-
export interface BridgeResponseMessage {
|
|
76
|
-
type: 'bridge_response';
|
|
77
|
-
requestId: string;
|
|
78
|
-
result?: any;
|
|
79
|
-
error?: string;
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;CAchB,CAAA;AAEV,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG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MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B;AAED,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,GAAG,CAAA;CACb;AAED,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
package/dist/types.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Bridge method name constants — shared between web SDK and native handlers */
|
|
2
|
-
export const BridgeMethods = {
|
|
3
|
-
getInstanceData: 'getInstanceData',
|
|
4
|
-
getStaticData: 'getStaticData',
|
|
5
|
-
captureAttachments: 'captureAttachments',
|
|
6
|
-
addAttachments: 'addAttachments',
|
|
7
|
-
removeAttachment: 'removeAttachment',
|
|
8
|
-
getAttachment: 'getAttachment',
|
|
9
|
-
getAttachmentsByParentId: 'getAttachmentsByParentId',
|
|
10
|
-
saveInstanceData: 'saveInstanceData',
|
|
11
|
-
getMetadata: 'getMetadata',
|
|
12
|
-
getAuthenticationInfo: 'getAuthenticationInfo',
|
|
13
|
-
getLocalizedString: 'getLocalizedString',
|
|
14
|
-
sendExtensionMandatoryStatus: 'sendExtensionMandatoryStatus',
|
|
15
|
-
exit: 'exit',
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,eAAe,EAAE,iBAAiB;IAClC,aAAa,EAAE,eAAe;IAC9B,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,eAAe;IAC9B,wBAAwB,EAAE,0BAA0B;IACpD,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAE,aAAa;IAC1B,qBAAqB,EAAE,uBAAuB;IAC9C,kBAAkB,EAAE,oBAAoB;IACxC,4BAA4B,EAAE,8BAA8B;IAC5D,IAAI,EAAE,MAAM;CACJ,CAAA"}
|