@skedulo/mexwex-bridge 0.0.2 → 0.0.4

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 CHANGED
@@ -14,6 +14,8 @@ declare const BridgeMethods: {
14
14
  readonly sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus";
15
15
  readonly exit: "exit";
16
16
  readonly collectTapToPayPayment: "collectTapToPayPayment";
17
+ readonly captureSignature: "captureSignature";
18
+ readonly addSignature: "addSignature";
17
19
  };
18
20
  /** Available attachment picker sources */
19
21
  type AttachmentSource = 'camera' | 'photoLibrary' | 'files';
@@ -77,6 +79,32 @@ interface TapToPayResult {
77
79
  paymentIntentId?: string;
78
80
  error?: string;
79
81
  }
82
+ /** Parameters for capturing a signature via the native signature screen */
83
+ interface CaptureSignatureOptions {
84
+ /** Show the full-name field on the native screen. Defaults to false. */
85
+ enableFullName?: boolean;
86
+ }
87
+ /** Result of a successful signature capture */
88
+ interface CaptureSignatureResult {
89
+ /** Local file path to the captured signature image */
90
+ uri: string;
91
+ /** Generated file name, e.g. "signature-<uuid>.png". Informational only — addSignature ignores it. */
92
+ fileName: string;
93
+ /** Full name entered by the signer. Only present when CaptureSignatureOptions.enableFullName === true. */
94
+ fullName?: string;
95
+ }
96
+ /** Parameters for persisting a captured signature to the native layer */
97
+ interface AddSignatureParams {
98
+ /** The captured signature to persist */
99
+ signature: {
100
+ uri: string;
101
+ fullName?: string;
102
+ };
103
+ /** The parent object ID to associate the signature with */
104
+ parentContextId: string;
105
+ /** Optional category name for the signature */
106
+ categoryName?: string;
107
+ }
80
108
 
81
109
  declare global {
82
110
  interface Window {
@@ -91,6 +119,11 @@ declare class MexBridge {
91
119
  private _initialized;
92
120
  constructor();
93
121
  private _initialize;
122
+ /**
123
+ * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —
124
+ * required for user-interactive methods (e.g. captureSignature, captureAttachments)
125
+ * because the user can take arbitrarily long to interact.
126
+ */
94
127
  private _call;
95
128
  private _generateId;
96
129
  /** Fetch the current form instance data */
@@ -121,8 +154,12 @@ declare class MexBridge {
121
154
  exit(): Promise<void>;
122
155
  /** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
123
156
  collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult>;
157
+ /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */
158
+ captureSignature(options?: CaptureSignatureOptions): Promise<CaptureSignatureResult | null>;
159
+ /** Persist a captured signature to the native mobile layer */
160
+ addSignature(params: AddSignatureParams): Promise<any>;
124
161
  }
125
162
 
126
163
  declare const mexBridge: MexBridge;
127
164
 
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 };
165
+ export { type AddAttachmentsParams, type AddSignatureParams, type AttachmentMetadata, type AttachmentSource, type AttachmentsByParentIdResult, type AuthenticationInfo, BridgeMethods, type CaptureAttachmentsParams, type CaptureSignatureOptions, type CaptureSignatureResult, type FormMetadata, MexBridge, type PickedFile, type TapToPayParams, type TapToPayResult, mexBridge };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ declare const BridgeMethods: {
14
14
  readonly sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus";
15
15
  readonly exit: "exit";
16
16
  readonly collectTapToPayPayment: "collectTapToPayPayment";
17
+ readonly captureSignature: "captureSignature";
18
+ readonly addSignature: "addSignature";
17
19
  };
18
20
  /** Available attachment picker sources */
19
21
  type AttachmentSource = 'camera' | 'photoLibrary' | 'files';
@@ -77,6 +79,32 @@ interface TapToPayResult {
77
79
  paymentIntentId?: string;
78
80
  error?: string;
79
81
  }
82
+ /** Parameters for capturing a signature via the native signature screen */
83
+ interface CaptureSignatureOptions {
84
+ /** Show the full-name field on the native screen. Defaults to false. */
85
+ enableFullName?: boolean;
86
+ }
87
+ /** Result of a successful signature capture */
88
+ interface CaptureSignatureResult {
89
+ /** Local file path to the captured signature image */
90
+ uri: string;
91
+ /** Generated file name, e.g. "signature-<uuid>.png". Informational only — addSignature ignores it. */
92
+ fileName: string;
93
+ /** Full name entered by the signer. Only present when CaptureSignatureOptions.enableFullName === true. */
94
+ fullName?: string;
95
+ }
96
+ /** Parameters for persisting a captured signature to the native layer */
97
+ interface AddSignatureParams {
98
+ /** The captured signature to persist */
99
+ signature: {
100
+ uri: string;
101
+ fullName?: string;
102
+ };
103
+ /** The parent object ID to associate the signature with */
104
+ parentContextId: string;
105
+ /** Optional category name for the signature */
106
+ categoryName?: string;
107
+ }
80
108
 
81
109
  declare global {
82
110
  interface Window {
@@ -91,6 +119,11 @@ declare class MexBridge {
91
119
  private _initialized;
92
120
  constructor();
93
121
  private _initialize;
122
+ /**
123
+ * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —
124
+ * required for user-interactive methods (e.g. captureSignature, captureAttachments)
125
+ * because the user can take arbitrarily long to interact.
126
+ */
94
127
  private _call;
95
128
  private _generateId;
96
129
  /** Fetch the current form instance data */
@@ -121,8 +154,12 @@ declare class MexBridge {
121
154
  exit(): Promise<void>;
122
155
  /** Initiate a Tap to Pay payment via Stripe Terminal on the native device */
123
156
  collectTapToPayPayment(params: TapToPayParams): Promise<TapToPayResult>;
157
+ /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */
158
+ captureSignature(options?: CaptureSignatureOptions): Promise<CaptureSignatureResult | null>;
159
+ /** Persist a captured signature to the native mobile layer */
160
+ addSignature(params: AddSignatureParams): Promise<any>;
124
161
  }
125
162
 
126
163
  declare const mexBridge: MexBridge;
127
164
 
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 };
165
+ export { type AddAttachmentsParams, type AddSignatureParams, type AttachmentMetadata, type AttachmentSource, type AttachmentsByParentIdResult, type AuthenticationInfo, BridgeMethods, type CaptureAttachmentsParams, type CaptureSignatureOptions, type CaptureSignatureResult, type FormMetadata, MexBridge, type PickedFile, type TapToPayParams, type TapToPayResult, mexBridge };
package/dist/index.js CHANGED
@@ -41,7 +41,9 @@ var BridgeMethods = {
41
41
  getLocalizedString: "getLocalizedString",
42
42
  sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus",
43
43
  exit: "exit",
44
- collectTapToPayPayment: "collectTapToPayPayment"
44
+ collectTapToPayPayment: "collectTapToPayPayment",
45
+ captureSignature: "captureSignature",
46
+ addSignature: "addSignature"
45
47
  };
46
48
 
47
49
  // src/MexBridge.ts
@@ -61,7 +63,7 @@ var MexBridge = class {
61
63
  if (message.type !== "bridge_response" || !message.requestId) return;
62
64
  const pending = this._callbacks.get(message.requestId);
63
65
  if (!pending) return;
64
- clearTimeout(pending.timeoutId);
66
+ if (pending.timeoutId !== null) clearTimeout(pending.timeoutId);
65
67
  this._callbacks.delete(message.requestId);
66
68
  if (message.error) {
67
69
  pending.reject(new Error(message.error));
@@ -73,6 +75,11 @@ var MexBridge = class {
73
75
  }
74
76
  };
75
77
  }
78
+ /**
79
+ * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —
80
+ * required for user-interactive methods (e.g. captureSignature, captureAttachments)
81
+ * because the user can take arbitrarily long to interact.
82
+ */
76
83
  _call(method, params, timeoutMs = DEFAULT_TIMEOUT_MS) {
77
84
  return new Promise((resolve, reject) => {
78
85
  if (!window.ReactNativeWebView) {
@@ -80,10 +87,10 @@ var MexBridge = class {
80
87
  return;
81
88
  }
82
89
  const requestId = this._generateId();
83
- const timeoutId = setTimeout(() => {
90
+ const timeoutId = timeoutMs > 0 ? setTimeout(() => {
84
91
  this._callbacks.delete(requestId);
85
92
  reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`));
86
- }, timeoutMs);
93
+ }, timeoutMs) : null;
87
94
  this._callbacks.set(requestId, { resolve, reject, timeoutId });
88
95
  window.ReactNativeWebView.postMessage(JSON.stringify({
89
96
  type: "bridge_call",
@@ -106,7 +113,7 @@ var MexBridge = class {
106
113
  }
107
114
  /** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
108
115
  captureAttachments(params) {
109
- return this._call(BridgeMethods.captureAttachments, params);
116
+ return this._call(BridgeMethods.captureAttachments, params, 0);
110
117
  }
111
118
  /** Persist captured attachments to the native mobile layer */
112
119
  addAttachments(params) {
@@ -152,6 +159,14 @@ var MexBridge = class {
152
159
  collectTapToPayPayment(params) {
153
160
  return this._call(BridgeMethods.collectTapToPayPayment, params, 12e4);
154
161
  }
162
+ /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */
163
+ captureSignature(options) {
164
+ return this._call(BridgeMethods.captureSignature, options, 0);
165
+ }
166
+ /** Persist a captured signature to the native mobile layer */
167
+ addSignature(params) {
168
+ return this._call(BridgeMethods.addSignature, params);
169
+ }
155
170
  };
156
171
 
157
172
  // src/index.ts
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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;;;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,KAA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AAO,KAAK,MAAe,cAAc,kBAAkB,EAAE,aAAa,CAAC;AAAA,EAC7E;AAAA;AAAA,EAGA,cAAc,cAAmD;AAC/D,WAAO,KAAK,MAA0B,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;;;AFvIO,IAAM,YAAY,IAAI,UAAU;","names":[]}
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 CaptureSignatureOptions,\n CaptureSignatureResult,\n AddSignatureParams,\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 captureSignature: 'captureSignature',\n addSignature: 'addSignature',\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/** Parameters for capturing a signature via the native signature screen */\nexport interface CaptureSignatureOptions {\n /** Show the full-name field on the native screen. Defaults to false. */\n enableFullName?: boolean\n}\n\n/** Result of a successful signature capture */\nexport interface CaptureSignatureResult {\n /** Local file path to the captured signature image */\n uri: string\n /** Generated file name, e.g. \"signature-<uuid>.png\". Informational only — addSignature ignores it. */\n fileName: string\n /** Full name entered by the signer. Only present when CaptureSignatureOptions.enableFullName === true. */\n fullName?: string\n}\n\n/** Parameters for persisting a captured signature to the native layer */\nexport interface AddSignatureParams {\n /** The captured signature to persist */\n signature: {\n uri: string\n fullName?: string\n }\n /** The parent object ID to associate the signature with */\n parentContextId: string\n /** Optional category name for the signature */\n categoryName?: 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, CaptureSignatureOptions, CaptureSignatureResult, AddSignatureParams } from './types'\n\ntype PendingCallback = {\n resolve: (value: any) => void\n reject: (reason: any) => void\n timeoutId: ReturnType<typeof setTimeout> | null\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 if (pending.timeoutId !== null) 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 /**\n * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —\n * required for user-interactive methods (e.g. captureSignature, captureAttachments)\n * because the user can take arbitrarily long to interact.\n */\n private _call<T = any>(method: string, params?: any, timeoutMs: number = 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 = timeoutMs > 0\n ? setTimeout(() => {\n this._callbacks.delete(requestId)\n reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`))\n }, timeoutMs)\n : null\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, 0)\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 /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */\n captureSignature(options?: CaptureSignatureOptions): Promise<CaptureSignatureResult | null> {\n return this._call<CaptureSignatureResult | null>(BridgeMethods.captureSignature, options, 0)\n }\n\n /** Persist a captured signature to the native mobile layer */\n addSignature(params: AddSignatureParams): Promise<any> {\n return this._call(BridgeMethods.addSignature, params)\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;AAAA,EACxB,kBAAkB;AAAA,EAClB,cAAc;AAChB;;;ACAA,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,YAAI,QAAQ,cAAc,KAAM,cAAa,QAAQ,SAAS;AAC9D,aAAK,WAAW,OAAO,QAAQ,SAAS;AAExC,YAAI,QAAQ,OAAO;A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":[]}
package/dist/index.mjs CHANGED
@@ -13,7 +13,9 @@ var BridgeMethods = {
13
13
  getLocalizedString: "getLocalizedString",
14
14
  sendExtensionMandatoryStatus: "sendExtensionMandatoryStatus",
15
15
  exit: "exit",
16
- collectTapToPayPayment: "collectTapToPayPayment"
16
+ collectTapToPayPayment: "collectTapToPayPayment",
17
+ captureSignature: "captureSignature",
18
+ addSignature: "addSignature"
17
19
  };
18
20
 
19
21
  // src/MexBridge.ts
@@ -33,7 +35,7 @@ var MexBridge = class {
33
35
  if (message.type !== "bridge_response" || !message.requestId) return;
34
36
  const pending = this._callbacks.get(message.requestId);
35
37
  if (!pending) return;
36
- clearTimeout(pending.timeoutId);
38
+ if (pending.timeoutId !== null) clearTimeout(pending.timeoutId);
37
39
  this._callbacks.delete(message.requestId);
38
40
  if (message.error) {
39
41
  pending.reject(new Error(message.error));
@@ -45,6 +47,11 @@ var MexBridge = class {
45
47
  }
46
48
  };
47
49
  }
50
+ /**
51
+ * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —
52
+ * required for user-interactive methods (e.g. captureSignature, captureAttachments)
53
+ * because the user can take arbitrarily long to interact.
54
+ */
48
55
  _call(method, params, timeoutMs = DEFAULT_TIMEOUT_MS) {
49
56
  return new Promise((resolve, reject) => {
50
57
  if (!window.ReactNativeWebView) {
@@ -52,10 +59,10 @@ var MexBridge = class {
52
59
  return;
53
60
  }
54
61
  const requestId = this._generateId();
55
- const timeoutId = setTimeout(() => {
62
+ const timeoutId = timeoutMs > 0 ? setTimeout(() => {
56
63
  this._callbacks.delete(requestId);
57
64
  reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`));
58
- }, timeoutMs);
65
+ }, timeoutMs) : null;
59
66
  this._callbacks.set(requestId, { resolve, reject, timeoutId });
60
67
  window.ReactNativeWebView.postMessage(JSON.stringify({
61
68
  type: "bridge_call",
@@ -78,7 +85,7 @@ var MexBridge = class {
78
85
  }
79
86
  /** Open native picker(s) for camera, photo library, or files. Returns picked files or null if cancelled. */
80
87
  captureAttachments(params) {
81
- return this._call(BridgeMethods.captureAttachments, params);
88
+ return this._call(BridgeMethods.captureAttachments, params, 0);
82
89
  }
83
90
  /** Persist captured attachments to the native mobile layer */
84
91
  addAttachments(params) {
@@ -124,6 +131,14 @@ var MexBridge = class {
124
131
  collectTapToPayPayment(params) {
125
132
  return this._call(BridgeMethods.collectTapToPayPayment, params, 12e4);
126
133
  }
134
+ /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */
135
+ captureSignature(options) {
136
+ return this._call(BridgeMethods.captureSignature, options, 0);
137
+ }
138
+ /** Persist a captured signature to the native mobile layer */
139
+ addSignature(params) {
140
+ return this._call(BridgeMethods.addSignature, params);
141
+ }
127
142
  };
128
143
 
129
144
  // src/index.ts
@@ -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 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,+CAA+C,CAAC;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,MAAe,QAAgB,QAAc,YAAY,oBAAgC;AAC/F,WAAO,IAAI,QAAW,CAAC,SAAS,WAAW;AACz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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":[]}
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 captureSignature: 'captureSignature',\n addSignature: 'addSignature',\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/** Parameters for capturing a signature via the native signature screen */\nexport interface CaptureSignatureOptions {\n /** Show the full-name field on the native screen. Defaults to false. */\n enableFullName?: boolean\n}\n\n/** Result of a successful signature capture */\nexport interface CaptureSignatureResult {\n /** Local file path to the captured signature image */\n uri: string\n /** Generated file name, e.g. \"signature-<uuid>.png\". Informational only — addSignature ignores it. */\n fileName: string\n /** Full name entered by the signer. Only present when CaptureSignatureOptions.enableFullName === true. */\n fullName?: string\n}\n\n/** Parameters for persisting a captured signature to the native layer */\nexport interface AddSignatureParams {\n /** The captured signature to persist */\n signature: {\n uri: string\n fullName?: string\n }\n /** The parent object ID to associate the signature with */\n parentContextId: string\n /** Optional category name for the signature */\n categoryName?: 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, CaptureSignatureOptions, CaptureSignatureResult, AddSignatureParams } from './types'\n\ntype PendingCallback = {\n resolve: (value: any) => void\n reject: (reason: any) => void\n timeoutId: ReturnType<typeof setTimeout> | null\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 if (pending.timeoutId !== null) 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 /**\n * Send a bridge call. Pass `timeoutMs: 0` to disable the timeout entirely —\n * required for user-interactive methods (e.g. captureSignature, captureAttachments)\n * because the user can take arbitrarily long to interact.\n */\n private _call<T = any>(method: string, params?: any, timeoutMs: number = 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 = timeoutMs > 0\n ? setTimeout(() => {\n this._callbacks.delete(requestId)\n reject(new Error(`[MexBridge] Timeout: ${method} did not respond within ${timeoutMs}ms`))\n }, timeoutMs)\n : null\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, 0)\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 /** Open the native signature screen. Resolves with the captured signature, or null if the user cancels. */\n captureSignature(options?: CaptureSignatureOptions): Promise<CaptureSignatureResult | null> {\n return this._call<CaptureSignatureResult | null>(BridgeMethods.captureSignature, options, 0)\n }\n\n /** Persist a captured signature to the native mobile layer */\n addSignature(params: AddSignatureParams): Promise<any> {\n return this._call(BridgeMethods.addSignature, params)\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 CaptureSignatureOptions,\n CaptureSignatureResult,\n AddSignatureParams,\n} from './types'\n\n// Singleton instance for convenience\nimport { MexBridge } from './MexBridge'\nexport const mexB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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;AAAA;AAAA,EAGA,iBAAiB,SAA2E;AAC1F,WAAO,KAAK,MAAqC,cAAc,kBAAkB,SAAS,CAAC;AAAA,EAC7F;AAAA;AAAA,EAGA,aAAa,QAA0C;AACrD,WAAO,KAAK,MAAM,cAAc,cAAc,MAAM;AAAA,EACtD;AACF;;;ACrJO,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.2",
3
+ "version": "0.0.4",
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",