expo-upi 1.0.3 → 1.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/build/ReactNativeUpi.types.js +4 -1
- package/build/ReactNativeUpi.types.js.map +1 -1
- package/build/ReactNativeUpiModule.js +13 -7
- package/build/ReactNativeUpiModule.js.map +1 -1
- package/build/ReactNativeUpiModule.web.js +13 -7
- package/build/ReactNativeUpiModule.web.js.map +1 -1
- package/build/index.js +23 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpiApps = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Package names of popular UPI apps, for use with `pay({ app })` and `isUpiAppInstalled()`.
|
|
3
6
|
* Any other UPI app's package name works too.
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
exports.UpiApps = {
|
|
6
9
|
GOOGLE_PAY: 'com.google.android.apps.nbu.paisa.user',
|
|
7
10
|
PHONEPE: 'com.phonepe.app',
|
|
8
11
|
PAYTM: 'net.one97.paytm',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeUpi.types.js","sourceRoot":"","sources":["../src/ReactNativeUpi.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"ReactNativeUpi.types.js","sourceRoot":"","sources":["../src/ReactNativeUpi.types.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,OAAO,GAAG;IACrB,UAAU,EAAE,wCAAwC;IACpD,OAAO,EAAE,iBAAiB;IAC1B,KAAK,EAAE,iBAAiB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,UAAU,EAAE,kCAAkC;IAC9C,IAAI,EAAE,0BAA0B;CACxB,CAAC","sourcesContent":["/**\n * Package names of popular UPI apps, for use with `pay({ app })` and `isUpiAppInstalled()`.\n * Any other UPI app's package name works too.\n */\nexport const UpiApps = {\n GOOGLE_PAY: 'com.google.android.apps.nbu.paisa.user',\n PHONEPE: 'com.phonepe.app',\n PAYTM: 'net.one97.paytm',\n BHIM: 'in.org.npci.upiapp',\n AMAZON_PAY: 'in.amazon.mShop.android.shopping',\n CRED: 'com.dreamplug.androidapp',\n} as const;\n\nexport type UpiApp = {\n packageName: string;\n name: string;\n};\n\n/**\n * A personal (P2P) UPI payment. Sent as:\n * `upi://pay?pa=<pa>&pn=<pn>&am=<amount>&cu=INR`\n */\nexport type UpiPaymentRequest = {\n /** Payee UPI ID (VPA), e.g. `name@okaxis`. */\n pa: string;\n /** Payee name. */\n pn: string;\n /** Amount in INR, e.g. `\"1.00\"`. Normalized to 2 decimals. */\n amount: string;\n /** Package name of the UPI app to open. When omitted, Android's app chooser is shown. */\n app?: string;\n /** Title of the app chooser. Defaults to \"Pay with\". */\n chooserTitle?: string;\n};\n\nexport type UpiPaymentResult = {\n status: 'SUCCESS' | 'FAILURE' | 'SUBMITTED' | 'CANCELLED' | 'UNKNOWN';\n /** The exact UPI URI that was sent to the UPI app. */\n uri?: string | null;\n response?: string | null;\n approvalRefNo?: string | null;\n txnRef?: string | null;\n txnId?: string | null;\n code?: string | null;\n resultCode?: number;\n responseData?: string | null;\n};\n"]}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInstalledUpiApps = getInstalledUpiApps;
|
|
4
|
+
exports.isUpiAppInstalled = isUpiAppInstalled;
|
|
5
|
+
exports.buildUpiUri = buildUpiUri;
|
|
6
|
+
exports.pay = pay;
|
|
7
|
+
const expo_1 = require("expo");
|
|
8
|
+
const ReactNativeUpi = (0, expo_1.requireNativeModule)('ReactNativeUpi');
|
|
3
9
|
/** Returns the UPI apps installed on the device. */
|
|
4
|
-
|
|
10
|
+
function getInstalledUpiApps() {
|
|
5
11
|
return ReactNativeUpi.getInstalledUpiApps();
|
|
6
12
|
}
|
|
7
13
|
/** Returns true if the given app is installed and can handle UPI payments. */
|
|
8
|
-
|
|
14
|
+
function isUpiAppInstalled(packageName) {
|
|
9
15
|
return ReactNativeUpi.isUpiAppInstalled(packageName);
|
|
10
16
|
}
|
|
11
17
|
/** Returns the exact UPI URI `pay()` would send, without opening any app. Useful for debugging. */
|
|
12
|
-
|
|
18
|
+
function buildUpiUri(request) {
|
|
13
19
|
return ReactNativeUpi.buildUpiUri(request);
|
|
14
20
|
}
|
|
15
21
|
/** Opens a UPI app to make the payment and resolves with the result. */
|
|
16
|
-
|
|
22
|
+
function pay(request) {
|
|
17
23
|
return ReactNativeUpi.pay(request);
|
|
18
24
|
}
|
|
19
|
-
|
|
25
|
+
exports.default = ReactNativeUpi;
|
|
20
26
|
//# sourceMappingURL=ReactNativeUpiModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeUpiModule.js","sourceRoot":"","sources":["../src/ReactNativeUpiModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ReactNativeUpiModule.js","sourceRoot":"","sources":["../src/ReactNativeUpiModule.ts"],"names":[],"mappings":";;AAcA,kDAEC;AAGD,8CAEC;AAGD,kCAEC;AAGD,kBAEC;AA/BD,+BAAyD;AAWzD,MAAM,cAAc,GAAG,IAAA,0BAAmB,EAAuB,gBAAgB,CAAC,CAAC;AAEnF,oDAAoD;AACpD,SAAgB,mBAAmB;IACjC,OAAO,cAAc,CAAC,mBAAmB,EAAE,CAAC;AAC9C,CAAC;AAED,8EAA8E;AAC9E,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,OAAO,cAAc,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;AACvD,CAAC;AAED,mGAAmG;AACnG,SAAgB,WAAW,CAAC,OAA0B;IACpD,OAAO,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,wEAAwE;AACxE,SAAgB,GAAG,CAAC,OAA0B;IAC5C,OAAO,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED,kBAAe,cAAc,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport type { UpiApp, UpiPaymentRequest, UpiPaymentResult } from './ReactNativeUpi.types';\n\ndeclare class ReactNativeUpiModule extends NativeModule<{}> {\n getInstalledUpiApps(): UpiApp[];\n isUpiAppInstalled(packageName: string): boolean;\n buildUpiUri(request: UpiPaymentRequest): string;\n pay(request: UpiPaymentRequest): Promise<UpiPaymentResult>;\n}\n\nconst ReactNativeUpi = requireNativeModule<ReactNativeUpiModule>('ReactNativeUpi');\n\n/** Returns the UPI apps installed on the device. */\nexport function getInstalledUpiApps(): UpiApp[] {\n return ReactNativeUpi.getInstalledUpiApps();\n}\n\n/** Returns true if the given app is installed and can handle UPI payments. */\nexport function isUpiAppInstalled(packageName: string): boolean {\n return ReactNativeUpi.isUpiAppInstalled(packageName);\n}\n\n/** Returns the exact UPI URI `pay()` would send, without opening any app. Useful for debugging. */\nexport function buildUpiUri(request: UpiPaymentRequest): string {\n return ReactNativeUpi.buildUpiUri(request);\n}\n\n/** Opens a UPI app to make the payment and resolves with the result. */\nexport function pay(request: UpiPaymentRequest): Promise<UpiPaymentResult> {\n return ReactNativeUpi.pay(request);\n}\n\nexport default ReactNativeUpi;\n"]}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInstalledUpiApps = getInstalledUpiApps;
|
|
4
|
+
exports.isUpiAppInstalled = isUpiAppInstalled;
|
|
5
|
+
exports.buildUpiUri = buildUpiUri;
|
|
6
|
+
exports.pay = pay;
|
|
7
|
+
const expo_1 = require("expo");
|
|
2
8
|
// UPI intents only exist on Android, so web never has UPI apps available.
|
|
3
|
-
class ReactNativeUpiModule extends NativeModule {
|
|
9
|
+
class ReactNativeUpiModule extends expo_1.NativeModule {
|
|
4
10
|
}
|
|
5
|
-
|
|
11
|
+
function getInstalledUpiApps() {
|
|
6
12
|
return [];
|
|
7
13
|
}
|
|
8
|
-
|
|
14
|
+
function isUpiAppInstalled(_packageName) {
|
|
9
15
|
return false;
|
|
10
16
|
}
|
|
11
|
-
|
|
17
|
+
function buildUpiUri(_request) {
|
|
12
18
|
throw new Error('UPI payments are not supported on web');
|
|
13
19
|
}
|
|
14
|
-
|
|
20
|
+
async function pay(_request) {
|
|
15
21
|
throw new Error('UPI payments are not supported on web');
|
|
16
22
|
}
|
|
17
|
-
|
|
23
|
+
exports.default = (0, expo_1.registerWebModule)(ReactNativeUpiModule, 'ReactNativeUpi');
|
|
18
24
|
//# sourceMappingURL=ReactNativeUpiModule.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeUpiModule.web.js","sourceRoot":"","sources":["../src/ReactNativeUpiModule.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ReactNativeUpiModule.web.js","sourceRoot":"","sources":["../src/ReactNativeUpiModule.web.ts"],"names":[],"mappings":";;AAOA,kDAEC;AAED,8CAEC;AAED,kCAEC;AAED,kBAEC;AArBD,+BAAuD;AAIvD,0EAA0E;AAC1E,MAAM,oBAAqB,SAAQ,mBAAgB;CAAG;AAEtD,SAAgB,mBAAmB;IACjC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,WAAW,CAAC,QAA2B;IACrD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AAC3D,CAAC;AAEM,KAAK,UAAU,GAAG,CAAC,QAA2B;IACnD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;AAC3D,CAAC;AAED,kBAAe,IAAA,wBAAiB,EAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { registerWebModule, NativeModule } from 'expo';\n\nimport type { UpiApp, UpiPaymentRequest, UpiPaymentResult } from './ReactNativeUpi.types';\n\n// UPI intents only exist on Android, so web never has UPI apps available.\nclass ReactNativeUpiModule extends NativeModule<{}> {}\n\nexport function getInstalledUpiApps(): UpiApp[] {\n return [];\n}\n\nexport function isUpiAppInstalled(_packageName: string): boolean {\n return false;\n}\n\nexport function buildUpiUri(_request: UpiPaymentRequest): string {\n throw new Error('UPI payments are not supported on web');\n}\n\nexport async function pay(_request: UpiPaymentRequest): Promise<UpiPaymentResult> {\n throw new Error('UPI payments are not supported on web');\n}\n\nexport default registerWebModule(ReactNativeUpiModule, 'ReactNativeUpi');\n"]}
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.pay = exports.isUpiAppInstalled = exports.getInstalledUpiApps = exports.buildUpiUri = void 0;
|
|
1
18
|
// Reexport the native module. On web, it will be resolved to ReactNativeUpiModule.web.ts
|
|
2
19
|
// and on native platforms to ReactNativeUpiModule.ts
|
|
3
|
-
|
|
4
|
-
|
|
20
|
+
var ReactNativeUpiModule_1 = require("./ReactNativeUpiModule");
|
|
21
|
+
Object.defineProperty(exports, "buildUpiUri", { enumerable: true, get: function () { return ReactNativeUpiModule_1.buildUpiUri; } });
|
|
22
|
+
Object.defineProperty(exports, "getInstalledUpiApps", { enumerable: true, get: function () { return ReactNativeUpiModule_1.getInstalledUpiApps; } });
|
|
23
|
+
Object.defineProperty(exports, "isUpiAppInstalled", { enumerable: true, get: function () { return ReactNativeUpiModule_1.isUpiAppInstalled; } });
|
|
24
|
+
Object.defineProperty(exports, "pay", { enumerable: true, get: function () { return ReactNativeUpiModule_1.pay; } });
|
|
25
|
+
__exportStar(require("./ReactNativeUpi.types"), exports);
|
|
5
26
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,qDAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yFAAyF;AACzF,qDAAqD;AACrD,+DAAkG;AAAzF,mHAAA,WAAW,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,yHAAA,iBAAiB,OAAA;AAAE,2GAAA,GAAG,OAAA;AACjE,yDAAuC","sourcesContent":["// Reexport the native module. On web, it will be resolved to ReactNativeUpiModule.web.ts\n// and on native platforms to ReactNativeUpiModule.ts\nexport { buildUpiUri, getInstalledUpiApps, isUpiAppInstalled, pay } from './ReactNativeUpiModule';\nexport * from './ReactNativeUpi.types';\n"]}
|