@tapayadot/accept-react-native 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAkBhE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,KAAK,EAAiB,EAAE;IACjE,OAAO,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAiB,EAAE;IAC3D,OAAO,oBAAoB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAuB,EAAE;IAChD,OAAO,oBAAoB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,eAAuB,EAAwE,EAAE;IAChI,IAAI,GAAG,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAEjE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,CAAsB,CAAC;YAChC,KAAK,QAAQ;gBACX,OAAO,CAAwB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Result,\n type CertisPaymentResult,\n type CardPaymentIntent,\n type CertisPaymentIntent,\n type SepaPaymentIntent,\n type KybPrefillData,\n type SdkStatus,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n Currency,\n} from './AcceptSdkReactNative.types';\nimport AcceptSdkReactNative from './AcceptSdkReactNativeModule';\n\nexport type {\n CardPaymentResult,\n SepaPaymentResult,\n CertisPaymentResult,\n CardPaymentIntent,\n SepaPaymentIntent,\n CertisPaymentIntent,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n SdkStatus,\n KybPrefillData,\n};\n\nexport { Currency };\n\n/**\n * Initializes the SDK. Must be called before any other method.\n * @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).\n */\nexport const initialize = (demo: boolean = false): Promise<void> => {\n return AcceptSdkReactNative.initialize(demo).then(() => Promise.resolve(undefined));\n};\n\n/**\n * Authenticates a merchant session using a token obtained from your backend.\n * Call after {@link initialize}.\n * @param token - Merchant authentication token.\n * @throws If authentication fails (invalid token, network error, etc.).\n */\nexport const authenticate = (token: string): Promise<void> => {\n return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));\n};\n\n/**\n * Returns the current SDK status.\n * - `IDLE` — not initialized\n * - `INITIALIZED` — initialized, not authenticated\n * - `LOGGED_IN` — authenticated and ready\n */\nexport const getStatus = (): Promise<SdkStatus> => {\n return AcceptSdkReactNative.getStatus();\n};\n\n/**\n * Fetches the current status and details of a payment by its intent ID.\n * @param paymentIntentId - The payment intent identifier.\n * @returns The payment result typed to the appropriate payment method.\n * @throws If the payment intent is not found or the request fails.\n */\nexport const getPaymentStatus = (paymentIntentId: string): Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult> => {\n let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);\n\n return obj.then((o) => {\n let r = JSON.parse(o);\n\n switch (r.type) {\n case \"card\":\n return r as CardPaymentResult;\n case \"certis\":\n return r as CertisPaymentResult;\n case \"sepa\":\n return r as SepaPaymentResult;\n default:\n throw new Error(\"Unknown payment result\");\n }\n });\n};\n\n/**\n * Logs out the current merchant session.\n * The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.\n */\nexport const logOut = (): Promise<void> => {\n return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));\n};\n\n/**\n * Requests fine and coarse location permissions required for card (tap-to-pay) payments.\n * @returns `true` if all location permissions were granted.\n */\nexport const requestLocationPermission = (): Promise<boolean> => {\n return AcceptSdkReactNative.requestLocationPermission();\n};\n\n/**\n * Pairs the merchant app with the Tapaya companion app via deep link.\n * @platform ios\n */\nexport const pairWithCompanionApp = (): Promise<void> => {\n return AcceptSdkReactNative.pairWithCompanionApp();\n};\n\n/**\n * Returns whether the Tapaya companion app is installed on the device.\n * @platform ios\n */\nexport const isCompanionAppInstalled = (): Promise<boolean> => {\n return AcceptSdkReactNative.isCompanionAppInstalled();\n};\n\n/**\n * Presents the App Store product page sheet for the Tapaya companion app.\n * Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.\n * @platform ios\n */\nexport const presentCompanionAppSheet = (): Promise<void> => {\n return AcceptSdkReactNative.presentCompanionAppSheet();\n};\n\n/** Identity and onboarding methods. */\nexport const identity = {\n /**\n * Presents the KYB (Know Your Business) onboarding flow.\n * Fire-and-forget — resolves as soon as the flow is presented.\n * @param prefilling - Optional data to pre-populate the onboarding form.\n */\n presentKyb: (prefilling?: KybPrefillData): Promise<void> => {\n return AcceptSdkReactNative.presentKyb(prefilling);\n },\n};\n\n/** Payment methods for card and bank transfer terminals. */\nexport const payments = {\n /**\n * Starts a card (tap-to-pay) payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCardPayment: async (\n paymentIntent: CardPaymentIntent,\n statusCallback: (status: CardPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CardPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status: any) => {\n statusCallback(status.data as CardPaymentStatus)})\n\n AcceptSdkReactNative.addListener('onCardPaymentException', (map: any) => {\n errorCallback(map.message, map.exception)})\n\n let result = AcceptSdkReactNative.startCardPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a SEPA Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startSepaPayment: async (\n paymentIntent: SepaPaymentIntent,\n statusCallback: (status: SepaInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<SepaPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status: any) =>\n statusCallback(status.data as SepaInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onSepaPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a Certis Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCertisPayment: async (\n paymentIntent: CertisPaymentIntent,\n statusCallback: (status: CertisInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CertisPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status: any) =>\n statusCallback(status.data as CertisInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onCertisPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n};\n\nconst AcceptSDK = {\n initialize,\n authenticate,\n getStatus,\n getPaymentStatus,\n logOut,\n requestLocationPermission,\n pairWithCompanionApp,\n isCompanionAppInstalled,\n presentCompanionAppSheet,\n identity,\n payments,\n};\n\nexport default AcceptSDK;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAgChE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,KAAK,EAAE,KAAgC,EAAiB,EAAE;IACnG,OAAO,oBAAoB,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAA+B,EAAiB,EAAE;IACzE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA0B,EAAiB,EAAE;IACzE,OAAO,oBAAoB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,Y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;IACtD,SAAS,EAAE,GAAqB,EAAE;QAChC,OAAO,oBAAoB,CAAC,UAAU,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,UAAU;IACV,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,MAAM;IACN,yBAAyB;IACzB,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,QAAQ;IACR,QAAQ;IACR,IAAI;CACL,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n type AcceptThemeConfiguration,\n type AcceptColorTheme,\n type AcceptImageTheme,\n type AcceptUiBehavior,\n type NfcIndicator,\n type NfcPosition,\n type NfcZone,\n type GradientColors,\n type CardPaymentResult,\n type SepaPaymentResult,\n type CertisPaymentResult,\n type CardPaymentIntent,\n type CertisPaymentIntent,\n type SepaPaymentIntent,\n type KybPrefillData,\n type SdkStatus,\n type AcceptOnboardingStatus,\n type AcceptPaymentMethodStatus,\n type PaymentMethod,\n type PaymentMethodStatus,\n type RefundIntent,\n type RefundResult,\n type RefundReason,\n type TransactionStatus,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n} from './AcceptSdkReactNative.types';\nimport AcceptSdkReactNative from './AcceptSdkReactNativeModule';\n\nexport type {\n AcceptThemeConfiguration,\n AcceptColorTheme,\n AcceptImageTheme,\n AcceptUiBehavior,\n NfcIndicator,\n NfcPosition,\n NfcZone,\n GradientColors,\n CardPaymentResult,\n SepaPaymentResult,\n CertisPaymentResult,\n CardPaymentIntent,\n SepaPaymentIntent,\n CertisPaymentIntent,\n CardPaymentStatus,\n SepaInstantPaymentStatus,\n CertisInstantPaymentStatus,\n SdkStatus,\n KybPrefillData,\n AcceptOnboardingStatus,\n AcceptPaymentMethodStatus,\n PaymentMethod,\n PaymentMethodStatus,\n RefundIntent,\n RefundResult,\n RefundReason,\n TransactionStatus,\n};\n\n/**\n * Initializes the SDK. Must be called before any other method.\n * @param demo - If `true`, connects to the sandbox environment. Defaults to `false` (production).\n * @param theme - Optional UI theme overrides applied at startup.\n */\nexport const initialize = (demo: boolean = false, theme?: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.initialize(demo, theme);\n};\n\n/**\n * Applies a UI theme after initialization. Can be called any time after {@link initialize}.\n * @param theme - UI theme overrides. Omit `colors` or `images` to keep SDK defaults for those slots.\n */\nexport const setTheme = (theme: AcceptThemeConfiguration): Promise<void> => {\n return AcceptSdkReactNative.setTheme(theme);\n};\n\n/**\n * Configures SDK-owned UI behavior around a transaction —\n * result-screen visibility/duration and Tap-to-Pay NFC zone overrides.\n * No-op on iOS.\n * @platform android\n */\nexport const setUiBehavior = (behavior: AcceptUiBehavior): Promise<void> => {\n return AcceptSdkReactNative.setUiBehavior(behavior);\n};\n\n/**\n * Authenticates a merchant session using a token obtained from your backend.\n * Call after {@link initialize}.\n * @param token - Merchant authentication token.\n * @throws If authentication fails (invalid token, network error, etc.).\n */\nexport const authenticate = (token: string): Promise<void> => {\n return AcceptSdkReactNative.authenticate(token).then(() => Promise.resolve(undefined));\n};\n\n/**\n * Returns the current SDK status.\n * - `IDLE` — not initialized\n * - `INITIALIZED` — initialized, not authenticated\n * - `LOGGED_IN` — authenticated and ready\n */\nexport const getStatus = (): Promise<SdkStatus> => {\n return AcceptSdkReactNative.getStatus();\n};\n\n/**\n * Fetches the current status and details of a payment by its intent ID.\n * @param paymentIntentId - The payment intent identifier.\n * @returns The payment result typed to the appropriate payment method.\n * @throws If the payment intent is not found or the request fails.\n */\nexport const getPaymentStatus = (paymentIntentId: string): Promise<CardPaymentResult | SepaPaymentResult | CertisPaymentResult> => {\n let obj = AcceptSdkReactNative.getPaymentStatus(paymentIntentId);\n\n return obj.then((o) => {\n let r = JSON.parse(o);\n\n switch (r.type) {\n case \"card\":\n return r as CardPaymentResult;\n case \"certis\":\n return r as CertisPaymentResult;\n case \"sepa\":\n return r as SepaPaymentResult;\n default:\n throw new Error(\"Unknown payment result\");\n }\n });\n};\n\n/**\n * Logs out the current merchant session.\n * The SDK remains initialized — call {@link authenticate} again to sign in a different merchant.\n */\nexport const logOut = (): Promise<void> => {\n return AcceptSdkReactNative.logOut().then(() => Promise.resolve(undefined));\n};\n\n/**\n * Requests fine and coarse location permissions required for card (tap-to-pay) payments.\n * @returns `true` if all location permissions were granted.\n */\nexport const requestLocationPermission = (): Promise<boolean> => {\n return AcceptSdkReactNative.requestLocationPermission();\n};\n\n/**\n * Pairs the merchant app with the Tapaya companion app via deep link.\n * @platform ios\n */\nexport const pairWithCompanionApp = (): Promise<void> => {\n return AcceptSdkReactNative.pairWithCompanionApp();\n};\n\n/**\n * Returns whether the Tapaya companion app is installed on the device.\n * @platform ios\n */\nexport const isCompanionAppInstalled = (): Promise<boolean> => {\n return AcceptSdkReactNative.isCompanionAppInstalled();\n};\n\n/**\n * Presents the App Store product page sheet for the Tapaya companion app.\n * Use this to prompt the user to install the companion app when {@link isCompanionAppInstalled} returns `false`.\n * @platform ios\n */\nexport const presentCompanionAppSheet = (): Promise<void> => {\n return AcceptSdkReactNative.presentCompanionAppSheet();\n};\n\n/** Identity and onboarding methods. */\nexport const identity = {\n /**\n * Presents the KYB (Know Your Business) onboarding flow.\n * Fire-and-forget — resolves as soon as the flow is presented.\n * @param prefilling - Optional data to pre-populate the onboarding form.\n */\n presentKyb: (prefilling?: KybPrefillData): Promise<void> => {\n return AcceptSdkReactNative.presentKyb(prefilling);\n },\n\n /**\n * Returns the merchant's aggregate onboarding status and per-method statuses.\n * Requires an authenticated session.\n */\n getOnboardingStatus: (): Promise<AcceptOnboardingStatus> => {\n return AcceptSdkReactNative.getOnboardingStatus();\n },\n\n /**\n * Returns the onboarding status for a single payment method.\n * Requires an authenticated session.\n * @param method - The payment method to query.\n */\n getPaymentMethodStatus: (method: PaymentMethod): Promise<PaymentMethodStatus> => {\n return AcceptSdkReactNative.getPaymentMethodStatus(method);\n },\n};\n\n/** Payment methods for card and bank transfer terminals. */\nexport const payments = {\n /**\n * Starts a card (tap-to-pay) payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCardPayment: async (\n paymentIntent: CardPaymentIntent,\n statusCallback: (status: CardPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CardPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCardPaymentStatusChange', (status: any) => {\n statusCallback(status.data as CardPaymentStatus)})\n\n AcceptSdkReactNative.addListener('onCardPaymentException', (map: any) => {\n errorCallback(map.message, map.exception)})\n\n let result = AcceptSdkReactNative.startCardPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a SEPA Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startSepaPayment: async (\n paymentIntent: SepaPaymentIntent,\n statusCallback: (status: SepaInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<SepaPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onSepaPaymentStatusChange', (status: any) =>\n statusCallback(status.data as SepaInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onSepaPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startSepaPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Starts a Certis Instant bank transfer payment flow.\n * Resolves with the final result when the payment completes or fails.\n * @param paymentIntent - Payment details.\n * @param statusCallback - Called with intermediate status updates during the payment flow.\n * @param errorCallback - Called with error details if the terminal encounters an exception.\n * @throws If a payment is already in progress, or if the payment flow fails critically.\n */\n startCertisPayment: async (\n paymentIntent: CertisPaymentIntent,\n statusCallback: (status: CertisInstantPaymentStatus) => void,\n errorCallback: (message: string, exception: string) => void,\n ): Promise<CertisPaymentResult> => {\n let isPaymentPending = await AcceptSdkReactNative.isPaymentPending();\n\n if (isPaymentPending) {\n throw Error(\"Payment is already pending, cancel payment first.\")\n }\n\n let eventStatus = AcceptSdkReactNative.addListener('onCertisPaymentStatusChange', (status: any) =>\n statusCallback(status.data as CertisInstantPaymentStatus))\n\n AcceptSdkReactNative.addListener('onCertisPaymentException', (map: any) =>\n errorCallback(map.message, map.exception))\n\n let result = AcceptSdkReactNative.startCertisPayment(paymentIntent);\n\n result.then(() => {\n eventStatus.remove();\n });\n\n return result\n },\n\n /**\n * Refunds a previously completed card payment.\n *\n * Runs headlessly — no UI is shown.\n * @param intent - Refund details.\n * @returns The refund result. On iOS, fully populated. On Android, only `status` and `refundReason` are guaranteed —\n * call {@link getPaymentStatus} on the source payment for richer state.\n * @throws If the source payment is not found, the refund is in conflict (already refunded, wrong state),\n * or the SDK is not initialized / authenticated.\n */\n refund: (intent: RefundIntent): Promise<RefundResult> => {\n return AcceptSdkReactNative.refund(intent);\n },\n\n /**\n * Cancels the currently active payment flow.\n *\n * Dismisses any payment UI and — if still pending — cancels the transaction server-side.\n * The in-flight `startCardPayment` / `startSepaPayment` / `startCertisPayment` promise resolves\n * to an aborted result.\n * @throws If no payment flow is currently in progress.\n */\n cancelActivePayment: (): Promise<void> => {\n return AcceptSdkReactNative.cancelActivePayment();\n },\n};\n\n/**\n * Demo mode toggles. When enabled, payment flows bypass real terminals and return\n * synthetic results — useful for development and screenshots.\n */\nexport const demo = {\n /** Enables demo mode. Subsequent payments will be simulated. */\n enable: (): Promise<void> => {\n return AcceptSdkReactNative.enableDemoMode();\n },\n\n /** Disables demo mode and returns to real terminal flows. */\n disable: (): Promise<void> => {\n return AcceptSdkReactNative.disableDemoMode();\n },\n\n /** Returns whether demo mode is currently enabled. */\n isEnabled: (): Promise<boolean> => {\n return AcceptSdkReactNative.isDemoMode();\n },\n};\n\nconst Accept = {\n initialize,\n setTheme,\n setUiBehavior,\n authenticate,\n getStatus,\n getPaymentStatus,\n logOut,\n requestLocationPermission,\n pairWithCompanionApp,\n isCompanionAppInstalled,\n presentCompanionAppSheet,\n identity,\n payments,\n demo,\n};\n\nexport default Accept;\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Resolves a React Native asset reference (from `require('./image.png')`) to a base64 string.
3
+ *
4
+ * Requires `expo-asset` and `expo-file-system` to be installed. Both are included in
5
+ * managed Expo projects by default. Bare React Native consumers must install them manually.
6
+ *
7
+ * @param source - Asset reference returned by `require('./image.png')`.
8
+ * @returns Base64-encoded image data.
9
+ */
10
+ export declare function assetToBase64(source: number): Promise<string>;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUnE"}
package/build/utils.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Resolves a React Native asset reference (from `require('./image.png')`) to a base64 string.
3
+ *
4
+ * Requires `expo-asset` and `expo-file-system` to be installed. Both are included in
5
+ * managed Expo projects by default. Bare React Native consumers must install them manually.
6
+ *
7
+ * @param source - Asset reference returned by `require('./image.png')`.
8
+ * @returns Base64-encoded image data.
9
+ */
10
+ export async function assetToBase64(source) {
11
+ // Dynamic imports so the SDK core has no hard dependency on these packages.
12
+ const { Asset } = await import('expo-asset');
13
+ const { File } = await import('expo-file-system');
14
+ const asset = Asset.fromModule(source);
15
+ await asset.downloadAsync();
16
+ const uri = asset.localUri ?? asset.uri;
17
+ if (!uri)
18
+ throw new Error(`assetToBase64: could not resolve URI for asset ${source}`);
19
+ return new File(uri).base64();
20
+ }
21
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAChD,4EAA4E;IAC5E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;IACxC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Resolves a React Native asset reference (from `require('./image.png')`) to a base64 string.\n *\n * Requires `expo-asset` and `expo-file-system` to be installed. Both are included in\n * managed Expo projects by default. Bare React Native consumers must install them manually.\n *\n * @param source - Asset reference returned by `require('./image.png')`.\n * @returns Base64-encoded image data.\n */\nexport async function assetToBase64(source: number): Promise<string> {\n // Dynamic imports so the SDK core has no hard dependency on these packages.\n const { Asset } = await import('expo-asset');\n const { File } = await import('expo-file-system');\n\n const asset = Asset.fromModule(source);\n await asset.downloadAsync();\n const uri = asset.localUri ?? asset.uri;\n if (!uri) throw new Error(`assetToBase64: could not resolve URI for asset ${source}`);\n return new File(uri).base64();\n}\n"]}