@expensify/react-native-wallet 0.1.5
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/LICENSE +20 -0
- package/README.md +259 -0
- package/android/build.gradle +103 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/expensify/wallet/Utils.kt +148 -0
- package/android/src/main/java/com/expensify/wallet/WalletModule.kt +301 -0
- package/android/src/main/java/com/expensify/wallet/WalletPackage.kt +43 -0
- package/android/src/main/java/com/expensify/wallet/error/InvalidNetworkError.kt +6 -0
- package/android/src/main/java/com/expensify/wallet/event/OnCardActivatedEvent.kt +18 -0
- package/android/src/main/java/com/expensify/wallet/model/CardData.kt +12 -0
- package/android/src/main/java/com/expensify/wallet/model/CardStatus.kt +15 -0
- package/android/src/main/java/com/expensify/wallet/model/TokenizationStatus.kt +7 -0
- package/android/src/main/java/com/expensify/wallet/model/WalletData.kt +7 -0
- package/android/src/paper/java/com/expensify/wallet/NativeWalletSpec.java +71 -0
- package/assets/buttons/android/af.svg +10 -0
- package/assets/buttons/android/am.svg +11 -0
- package/assets/buttons/android/ar.svg +16 -0
- package/assets/buttons/android/az.svg +16 -0
- package/assets/buttons/android/be.svg +16 -0
- package/assets/buttons/android/bg.svg +16 -0
- package/assets/buttons/android/bn.svg +10 -0
- package/assets/buttons/android/br.svg +16 -0
- package/assets/buttons/android/bs.svg +16 -0
- package/assets/buttons/android/ca.svg +16 -0
- package/assets/buttons/android/cs.svg +16 -0
- package/assets/buttons/android/da.svg +16 -0
- package/assets/buttons/android/de.svg +16 -0
- package/assets/buttons/android/el.svg +16 -0
- package/assets/buttons/android/en.svg +16 -0
- package/assets/buttons/android/es.svg +16 -0
- package/assets/buttons/android/et.svg +16 -0
- package/assets/buttons/android/fa.svg +11 -0
- package/assets/buttons/android/fi.svg +16 -0
- package/assets/buttons/android/fil.svg +16 -0
- package/assets/buttons/android/fr.svg +16 -0
- package/assets/buttons/android/he.svg +16 -0
- package/assets/buttons/android/hk.svg +16 -0
- package/assets/buttons/android/hr.svg +16 -0
- package/assets/buttons/android/hu.svg +16 -0
- package/assets/buttons/android/hy.svg +16 -0
- package/assets/buttons/android/id.svg +16 -0
- package/assets/buttons/android/is.svg +16 -0
- package/assets/buttons/android/it.svg +16 -0
- package/assets/buttons/android/ja.svg +16 -0
- package/assets/buttons/android/ka.svg +16 -0
- package/assets/buttons/android/kk.svg +16 -0
- package/assets/buttons/android/km.svg +10 -0
- package/assets/buttons/android/ky.svg +16 -0
- package/assets/buttons/android/lo.svg +10 -0
- package/assets/buttons/android/lt.svg +16 -0
- package/assets/buttons/android/lv.svg +16 -0
- package/assets/buttons/android/mk.svg +16 -0
- package/assets/buttons/android/mn.svg +10 -0
- package/assets/buttons/android/my.svg +10 -0
- package/assets/buttons/android/ne.svg +10 -0
- package/assets/buttons/android/nl.svg +16 -0
- package/assets/buttons/android/no.svg +16 -0
- package/assets/buttons/android/pl.svg +16 -0
- package/assets/buttons/android/pt.svg +16 -0
- package/assets/buttons/android/ro.svg +16 -0
- package/assets/buttons/android/ru.svg +16 -0
- package/assets/buttons/android/se.svg +16 -0
- package/assets/buttons/android/si.svg +10 -0
- package/assets/buttons/android/sk.svg +16 -0
- package/assets/buttons/android/sl.svg +16 -0
- package/assets/buttons/android/sq.svg +16 -0
- package/assets/buttons/android/sr.svg +16 -0
- package/assets/buttons/android/sw.svg +10 -0
- package/assets/buttons/android/th.svg +16 -0
- package/assets/buttons/android/tr.svg +16 -0
- package/assets/buttons/android/tw.svg +16 -0
- package/assets/buttons/android/uk.svg +16 -0
- package/assets/buttons/android/ur.svg +11 -0
- package/assets/buttons/android/uz.svg +16 -0
- package/assets/buttons/android/vi.svg +16 -0
- package/assets/buttons/apple/ar.svg +269 -0
- package/assets/buttons/apple/az.svg +275 -0
- package/assets/buttons/apple/bg.svg +275 -0
- package/assets/buttons/apple/cs.svg +288 -0
- package/assets/buttons/apple/da.svg +267 -0
- package/assets/buttons/apple/de.svg +282 -0
- package/assets/buttons/apple/el.svg +298 -0
- package/assets/buttons/apple/en.svg +259 -0
- package/assets/buttons/apple/es.svg +291 -0
- package/assets/buttons/apple/et.svg +279 -0
- package/assets/buttons/apple/fi.svg +287 -0
- package/assets/buttons/apple/fil.svg +292 -0
- package/assets/buttons/apple/fr.svg +295 -0
- package/assets/buttons/apple/he.svg +274 -0
- package/assets/buttons/apple/hi.svg +227 -0
- package/assets/buttons/apple/hk.svg +265 -0
- package/assets/buttons/apple/hr.svg +277 -0
- package/assets/buttons/apple/hu.svg +302 -0
- package/assets/buttons/apple/id.svg +284 -0
- package/assets/buttons/apple/it.svg +280 -0
- package/assets/buttons/apple/ja.svg +268 -0
- package/assets/buttons/apple/ko.svg +266 -0
- package/assets/buttons/apple/lt.svg +283 -0
- package/assets/buttons/apple/lv.svg +277 -0
- package/assets/buttons/apple/ms.svg +280 -0
- package/assets/buttons/apple/mt.svg +268 -0
- package/assets/buttons/apple/nl.svg +290 -0
- package/assets/buttons/apple/no.svg +284 -0
- package/assets/buttons/apple/pl.svg +280 -0
- package/assets/buttons/apple/pt.svg +290 -0
- package/assets/buttons/apple/ro.svg +290 -0
- package/assets/buttons/apple/ru.svg +279 -0
- package/assets/buttons/apple/sk.svg +288 -0
- package/assets/buttons/apple/sl.svg +269 -0
- package/assets/buttons/apple/sv.svg +287 -0
- package/assets/buttons/apple/th.svg +277 -0
- package/assets/buttons/apple/tr.svg +273 -0
- package/assets/buttons/apple/uk.svg +274 -0
- package/assets/buttons/apple/vi.svg +259 -0
- package/assets/buttons/apple/zh.svg +279 -0
- package/assets/hero-image.png +0 -0
- package/assets/signature-dark.png +0 -0
- package/assets/signature-light.png +0 -0
- package/ios/RNWallet.h +13 -0
- package/ios/RNWallet.mm +153 -0
- package/ios/WalletManager.swift +292 -0
- package/ios/stucts/AddPassResponse.swift +36 -0
- package/ios/stucts/CardInfo.swift +37 -0
- package/ios/stucts/WalletEncryptedPayload.swift +27 -0
- package/lib/commonjs/AddToWalletButton.js +47 -0
- package/lib/commonjs/AddToWalletButton.js.map +1 -0
- package/lib/commonjs/NativeWallet.js +22 -0
- package/lib/commonjs/NativeWallet.js.map +1 -0
- package/lib/commonjs/constants.js +195 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/index.js +114 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/utils.js +38 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/AddToWalletButton.js +38 -0
- package/lib/module/AddToWalletButton.js.map +1 -0
- package/lib/module/NativeWallet.js +17 -0
- package/lib/module/NativeWallet.js.map +1 -0
- package/lib/module/constants.js +188 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.js +92 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/utils.js +32 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/src/AddToWalletButton.d.ts +10 -0
- package/lib/typescript/src/AddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/NativeWallet.d.ts +64 -0
- package/lib/typescript/src/NativeWallet.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +4 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +20 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +5 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/package.json +172 -0
- package/react-native-wallet.podspec +36 -0
- package/src/AddToWalletButton.tsx +49 -0
- package/src/NativeWallet.ts +87 -0
- package/src/constants.ts +191 -0
- package/src/index.tsx +124 -0
- package/src/utils.ts +35 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["afAndroid","arAndroid","azAndroid","bgAndroid","bsAndroid","caAndroid","csAndroid","daAndroid","deAndroid","elAndroid","enAndroid","esAndroid","etAndroid","fiAndroid","frAndroid","heAndroid","hkAndroid","hrAndroid","huAndroid","hyAndroid","idAndroid","isAndroid","itAndroid","jaAndroid","kaAndroid","kkAndroid","kmAndroid","kyAndroid","ltAndroid","lvAndroid","mkAndroid","nlAndroid","noAndroid","plAndroid","ptAndroid","roAndroid","ruAndroid","skAndroid","slAndroid","sqAndroid","srAndroid","swAndroid","thAndroid","trAndroid","twAndroid","ukAndroid","urAndroid","uzAndroid","enApple","esApple","arApple","azApple","bgApple","csApple","daApple","deApple","elApple","etApple","fiApple","filApple","frApple","heApple","hiApple","hkApple","hrApple","huApple","idApple","itApple","jaApple","koApple","ltApple","lvApple","msApple","mtApple","nlApple","noApple","plApple","ptApple","roApple","ruApple","skApple","slApple","svApple","thApple","trApple","ukApple","viApple","zhApple","LOCALIZED_BUTTONS","android","af","ar","az","bg","bs","ca","cs","da","de","el","en","es","et","fi","fr","he","hk","hr","hu","hy","id","is","it","ja","ka","kk","km","ky","lt","lv","mk","nl","no","pl","pt","ro","ru","sk","sl","sq","sr","sw","th","tr","tw","uk","ur","uz","default","ios","fil","hi","ko","ms","mt","sv","vi","zh"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":"AAAA,OAAOA,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAkC;AACxD,OAAOC,SAAS,MAAM,kCAAk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E5D,OAAO;IACXmD,OAAO,EAAE1F;EACX;AACF,CAAC;AAED,eAAewC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-async-await */
|
|
2
|
+
import { NativeEventEmitter, Platform } from 'react-native';
|
|
3
|
+
import Wallet, { PACKAGE_NAME } from './NativeWallet';
|
|
4
|
+
import { getCardState, getTokenizationStatus } from './utils';
|
|
5
|
+
import AddToWalletButton from './AddToWalletButton';
|
|
6
|
+
function getModuleLinkingRejection() {
|
|
7
|
+
return Promise.reject(new Error(`Failed to load Wallet module, make sure to link ${PACKAGE_NAME} correctly`));
|
|
8
|
+
}
|
|
9
|
+
const eventEmitter = new NativeEventEmitter(Wallet);
|
|
10
|
+
function addListener(event, callback) {
|
|
11
|
+
return eventEmitter.addListener(event, callback);
|
|
12
|
+
}
|
|
13
|
+
function removeListener(subscription) {
|
|
14
|
+
subscription.remove();
|
|
15
|
+
}
|
|
16
|
+
function checkWalletAvailability() {
|
|
17
|
+
if (!Wallet) {
|
|
18
|
+
return getModuleLinkingRejection();
|
|
19
|
+
}
|
|
20
|
+
return Wallet.checkWalletAvailability();
|
|
21
|
+
}
|
|
22
|
+
async function getSecureWalletInfo() {
|
|
23
|
+
if (Platform.OS === 'ios') {
|
|
24
|
+
throw new Error('getSecureWalletInfo is not available on iOS');
|
|
25
|
+
}
|
|
26
|
+
if (!Wallet) {
|
|
27
|
+
return getModuleLinkingRejection();
|
|
28
|
+
}
|
|
29
|
+
const isWalletInitialized = await Wallet.ensureGoogleWalletInitialized();
|
|
30
|
+
if (!isWalletInitialized) {
|
|
31
|
+
throw new Error('Wallet could not be initialized');
|
|
32
|
+
}
|
|
33
|
+
return Wallet.getSecureWalletInfo();
|
|
34
|
+
}
|
|
35
|
+
async function getCardStatusBySuffix(last4Digits) {
|
|
36
|
+
if (!Wallet) {
|
|
37
|
+
return getModuleLinkingRejection();
|
|
38
|
+
}
|
|
39
|
+
const cardState = await Wallet.getCardStatusBySuffix(last4Digits);
|
|
40
|
+
return getCardState(cardState);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the state of a card based on a platform-specific identifier.
|
|
45
|
+
* @param identifier - The card identifier. On Android, it's `Token Reference ID` and on iOS, it's `Primary Account Identifier`
|
|
46
|
+
* @param tsp - The Token Service Provider, e.g. `VISA`, `MASTERCARD`
|
|
47
|
+
* @returns CardStatus - The card status
|
|
48
|
+
*/
|
|
49
|
+
async function getCardStatusByIdentifier(identifier, tsp) {
|
|
50
|
+
if (!Wallet) {
|
|
51
|
+
return getModuleLinkingRejection();
|
|
52
|
+
}
|
|
53
|
+
const tokenState = await Wallet.getCardStatusByIdentifier(identifier, tsp.toUpperCase());
|
|
54
|
+
return getCardState(tokenState);
|
|
55
|
+
}
|
|
56
|
+
async function addCardToGoogleWallet(cardData) {
|
|
57
|
+
if (Platform.OS === 'ios') {
|
|
58
|
+
throw new Error('addCardToGoogleWallet is not available on iOS');
|
|
59
|
+
}
|
|
60
|
+
if (!Wallet) {
|
|
61
|
+
return getModuleLinkingRejection();
|
|
62
|
+
}
|
|
63
|
+
const isWalletInitialized = await Wallet.ensureGoogleWalletInitialized();
|
|
64
|
+
if (!isWalletInitialized) {
|
|
65
|
+
throw new Error('Wallet could not be initialized');
|
|
66
|
+
}
|
|
67
|
+
const tokenizationStatus = await Wallet.addCardToGoogleWallet(cardData);
|
|
68
|
+
return getTokenizationStatus(tokenizationStatus);
|
|
69
|
+
}
|
|
70
|
+
async function addCardToAppleWallet(cardData, issuerEncryptPayloadCallback) {
|
|
71
|
+
if (Platform.OS === 'android') {
|
|
72
|
+
throw new Error('addCardToAppleWallet is not available on Andorid');
|
|
73
|
+
}
|
|
74
|
+
const passData = await (Wallet === null || Wallet === void 0 ? void 0 : Wallet.IOSPresentAddPaymentPassView(cardData));
|
|
75
|
+
if (!passData || passData.status !== 0) {
|
|
76
|
+
return getTokenizationStatus((passData === null || passData === void 0 ? void 0 : passData.status) || -1);
|
|
77
|
+
}
|
|
78
|
+
async function addPaymentPassToWallet(paymentPassData) {
|
|
79
|
+
const responseData = await issuerEncryptPayloadCallback(paymentPassData.nonce, paymentPassData.nonceSignature, paymentPassData.certificates);
|
|
80
|
+
const response = await (Wallet === null || Wallet === void 0 ? void 0 : Wallet.IOSHandleAddPaymentPassResponse(responseData));
|
|
81
|
+
// Response is null when a pass is successfully added to the wallet or the user cancels the process
|
|
82
|
+
// In case the user presses the `Try again` option, new pass data is returned, and it should reenter the function
|
|
83
|
+
if (response) {
|
|
84
|
+
return addPaymentPassToWallet(response);
|
|
85
|
+
}
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
const status = await addPaymentPassToWallet(passData);
|
|
89
|
+
return getTokenizationStatus(status);
|
|
90
|
+
}
|
|
91
|
+
export { AddToWalletButton, checkWalletAvailability, getSecureWalletInfo, getCardStatusBySuffix, getCardStatusByIdentifier, addCardToGoogleWallet, addCardToAppleWallet, addListener, removeListener };
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","Platform","Wallet","PACKAGE_NAME","getCardState","getTokenizationStatus","AddToWalletButton","getModuleLinkingRejection","Promise","reject","Error","eventEmitter","addListener","event","callback","removeListener","subscription","remove","checkWalletAvailability","getSecureWalletInfo","OS","isWalletInitialized","ensureGoogleWalletInitialized","getCardStatusBySuffix","last4Digits","cardState","getCardStatusByIdentifier","identifier","tsp","tokenState","toUpperCase","addCardToGoogleWallet","cardData","tokenizationStatus","addCardToAppleWallet","issuerEncryptPayloadCallback","passData","IOSPresentAddPaymentPassView","status","addPaymentPassToWallet","paymentPassData","responseData","nonce","nonceSignature","certificates","response","IOSHandleAddPaymentPassResponse"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA,SAAQA,kBAAkB,EAAEC,QAAQ,QAAO,cAAc;AAEzD,OAAOC,MAAM,IAAGC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C,EAAE;IACtC,OAAOjC,qBAAqB,CAAC,CAAA+B,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,MAAM,KAAI,CAAC,CAAC,CAAC;EACtD;EAEA,eAAeC,sBAAsBA,CAACC,eAAsC,EAAmB;IAC7F,MAAMC,YAAY,GAAG,MAAMN,4BAA4B,CAACK,eAAe,CAACE,KAAK,EAAEF,eAAe,CAACG,cAAc,EAAEH,eAAe,CAACI,YAAY,CAAC;IAC5I,MAAMC,QAAQ,GAAG,OAAM3C,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE4C,+BAA+B,CAACL,YAAY,CAAC;IAC5E;IACA;IACA,IAAII,QAAQ,EAAE;MACZ,OAAON,sBAAsB,CAACM,QAAQ,CAAC;IACzC;IACA,OAAO,CAAC;EACV;EACA,MAAMP,MAAM,GAAG,MAAMC,sBAAsB,CAACH,QAAQ,CAAC;EACrD,OAAO/B,qBAAqB,CAACiC,MAAM,CAAC;AACtC;AAGA,SACEhC,iBAAiB,EACjBY,uBAAuB,EACvBC,mBAAmB,EACnBI,qBAAqB,EACrBG,yBAAyB,EACzBK,qBAAqB,EACrBG,oBAAoB,EACpBtB,WAAW,EACXG,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function getCardState(stateId) {
|
|
2
|
+
switch (stateId) {
|
|
3
|
+
case -1:
|
|
4
|
+
return 'not found';
|
|
5
|
+
case 0:
|
|
6
|
+
return 'active';
|
|
7
|
+
case 1:
|
|
8
|
+
return 'requireActivation';
|
|
9
|
+
case 2:
|
|
10
|
+
return 'pending';
|
|
11
|
+
case 3:
|
|
12
|
+
return 'suspended';
|
|
13
|
+
case 4:
|
|
14
|
+
return 'deactivated';
|
|
15
|
+
default:
|
|
16
|
+
throw new Error(`Unknown card state: ${stateId}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getTokenizationStatus(stateId) {
|
|
20
|
+
switch (stateId) {
|
|
21
|
+
case -1:
|
|
22
|
+
return 'error';
|
|
23
|
+
case 0:
|
|
24
|
+
return 'success';
|
|
25
|
+
case 1:
|
|
26
|
+
return 'canceled';
|
|
27
|
+
default:
|
|
28
|
+
throw new Error(`Unknown tokenization status: ${stateId}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export { getCardState, getTokenizationStatus };
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getCardState","stateId","Error","getTokenizationStatus"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAEA,SAASA,YAAYA,CAACC,OAAe,EAAc;EACjD,QAAQA,OAAO;IACb,KAAK,CAAC,CAAC;MACL,OAAO,WAAW;IACpB,KAAK,CAAC;MACJ,OAAO,QAAQ;IACjB,KAAK,CAAC;MACJ,OAAO,mBAAmB;IAC5B,KAAK,CAAC;MACJ,OAAO,SAAS;IAClB,KAAK,CAAC;MACJ,OAAO,WAAW;IACpB,KAAK,CAAC;MACJ,OAAO,aAAa;IACtB;MACE,MAAM,IAAIC,KAAK,CAAC,uBAAuBD,OAAO,EAAE,CAAC;EACrD;AACF;AAEA,SAASE,qBAAqBA,CAACF,OAAe,EAAsB;EAClE,QAAQA,OAAO;IACb,KAAK,CAAC,CAAC;MACL,OAAO,OAAO;IAChB,KAAK,CAAC;MACJ,OAAO,SAAS;IAClB,KAAK,CAAC;MACJ,OAAO,UAAU;IACnB;MACE,MAAM,IAAIC,KAAK,CAAC,gCAAgCD,OAAO,EAAE,CAAC;EAC9D;AACF;AAEA,SAAQD,YAAY,EAAEG,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
3
|
+
type ButtonProps = {
|
|
4
|
+
onPress: () => void;
|
|
5
|
+
locale: string;
|
|
6
|
+
buttonStyle?: ViewStyle;
|
|
7
|
+
};
|
|
8
|
+
declare function AddToWalletButton({ onPress, locale, buttonStyle }: ButtonProps): React.JSX.Element;
|
|
9
|
+
export default AddToWalletButton;
|
|
10
|
+
//# sourceMappingURL=AddToWalletButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddToWalletButton.d.ts","sourceRoot":"","sources":["../../../src/AddToWalletButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAIF,iBAAS,iBAAiB,CAAC,EAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAC,EAAE,WAAW,qBAkBrE;AAgBD,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
type AndroidWalletData = {
|
|
3
|
+
deviceID: string;
|
|
4
|
+
walletAccountID: string;
|
|
5
|
+
};
|
|
6
|
+
type CardStatus = 'not found' | 'requireActivation' | 'pending' | 'active' | 'suspended' | 'deactivated';
|
|
7
|
+
type Platform = 'android' | 'ios';
|
|
8
|
+
type UserAddress = {
|
|
9
|
+
name: string;
|
|
10
|
+
addressOne: string;
|
|
11
|
+
addressTwo?: string;
|
|
12
|
+
administrativeArea: string;
|
|
13
|
+
locality: string;
|
|
14
|
+
countryCode: string;
|
|
15
|
+
postalCode: string;
|
|
16
|
+
phoneNumber: string;
|
|
17
|
+
};
|
|
18
|
+
type AndroidCardData = {
|
|
19
|
+
network: string;
|
|
20
|
+
opaquePaymentCard: string;
|
|
21
|
+
cardHolderName: string;
|
|
22
|
+
lastDigits: string;
|
|
23
|
+
userAddress: UserAddress;
|
|
24
|
+
};
|
|
25
|
+
type IOSCardData = {
|
|
26
|
+
network: string;
|
|
27
|
+
cardHolderName: string;
|
|
28
|
+
lastDigits: string;
|
|
29
|
+
cardDescription: string;
|
|
30
|
+
};
|
|
31
|
+
type onCardActivatedPayload = {
|
|
32
|
+
tokenId: string;
|
|
33
|
+
actionStatus: 'active' | 'canceled';
|
|
34
|
+
};
|
|
35
|
+
type IOSAddPaymentPassData = {
|
|
36
|
+
status: number;
|
|
37
|
+
nonce: string;
|
|
38
|
+
nonceSignature: string;
|
|
39
|
+
certificates: string[];
|
|
40
|
+
};
|
|
41
|
+
type IOSEncryptPayload = {
|
|
42
|
+
encryptedPassData: string;
|
|
43
|
+
activationData: string;
|
|
44
|
+
ephemeralPublicKey: string;
|
|
45
|
+
};
|
|
46
|
+
type TokenizationStatus = 'canceled' | 'success' | 'error';
|
|
47
|
+
export interface Spec extends TurboModule {
|
|
48
|
+
checkWalletAvailability(): Promise<boolean>;
|
|
49
|
+
ensureGoogleWalletInitialized(): Promise<boolean>;
|
|
50
|
+
getSecureWalletInfo(): Promise<AndroidWalletData>;
|
|
51
|
+
getCardStatusBySuffix(last4Digits: string): Promise<number>;
|
|
52
|
+
getCardStatusByIdentifier(identifier: string, tsp: string): Promise<number>;
|
|
53
|
+
addCardToGoogleWallet(cardData: AndroidCardData): Promise<number>;
|
|
54
|
+
IOSPresentAddPaymentPassView(cardData: IOSCardData): Promise<IOSAddPaymentPassData>;
|
|
55
|
+
IOSHandleAddPaymentPassResponse(payload: IOSEncryptPayload): Promise<IOSAddPaymentPassData | null>;
|
|
56
|
+
addListener: (eventType: string) => void;
|
|
57
|
+
removeListeners: (count: number) => void;
|
|
58
|
+
}
|
|
59
|
+
declare const PACKAGE_NAME = "@expensify/react-native-wallet";
|
|
60
|
+
declare let Wallet: Spec | undefined;
|
|
61
|
+
export default Wallet;
|
|
62
|
+
export { PACKAGE_NAME };
|
|
63
|
+
export type { AndroidCardData, IOSCardData, AndroidWalletData, CardStatus, UserAddress, onCardActivatedPayload, Platform, IOSAddPaymentPassData, IOSEncryptPayload, TokenizationStatus };
|
|
64
|
+
//# sourceMappingURL=NativeWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWallet.d.ts","sourceRoot":"","sources":["../../../src/NativeWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAG9C,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,UAAU,GAAG,WAAW,GAAG,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAC;AAEzG,KAAK,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;AAElC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,UAAU,CAAC;CACrC,CAAC;AAEF,KAAK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Y,EAAC,CAAC;AACtB,YAAY,EAAC,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,kBAAkB,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAyFA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAI7C,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+F/D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EmitterSubscription } from 'react-native';
|
|
2
|
+
import type { TokenizationStatus, AndroidCardData, CardStatus, IOSCardData, IOSEncryptPayload, AndroidWalletData, onCardActivatedPayload, IOSAddPaymentPassData } from './NativeWallet';
|
|
3
|
+
import AddToWalletButton from './AddToWalletButton';
|
|
4
|
+
declare function addListener(event: string, callback: (data: onCardActivatedPayload) => void): EmitterSubscription;
|
|
5
|
+
declare function removeListener(subscription: EmitterSubscription): void;
|
|
6
|
+
declare function checkWalletAvailability(): Promise<boolean>;
|
|
7
|
+
declare function getSecureWalletInfo(): Promise<AndroidWalletData>;
|
|
8
|
+
declare function getCardStatusBySuffix(last4Digits: string): Promise<CardStatus>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the state of a card based on a platform-specific identifier.
|
|
11
|
+
* @param identifier - The card identifier. On Android, it's `Token Reference ID` and on iOS, it's `Primary Account Identifier`
|
|
12
|
+
* @param tsp - The Token Service Provider, e.g. `VISA`, `MASTERCARD`
|
|
13
|
+
* @returns CardStatus - The card status
|
|
14
|
+
*/
|
|
15
|
+
declare function getCardStatusByIdentifier(identifier: string, tsp: string): Promise<CardStatus>;
|
|
16
|
+
declare function addCardToGoogleWallet(cardData: AndroidCardData): Promise<TokenizationStatus>;
|
|
17
|
+
declare function addCardToAppleWallet(cardData: IOSCardData, issuerEncryptPayloadCallback: (nonce: string, nonceSignature: string, certificate: string[]) => Promise<IOSEncryptPayload>): Promise<TokenizationStatus>;
|
|
18
|
+
export type { AndroidCardData, AndroidWalletData, CardStatus, IOSEncryptPayload, IOSCardData, IOSAddPaymentPassData, onCardActivatedPayload, TokenizationStatus };
|
|
19
|
+
export { AddToWalletButton, checkWalletAvailability, getSecureWalletInfo, getCardStatusBySuffix, getCardStatusByIdentifier, addCardToGoogleWallet, addCardToAppleWallet, addListener, removeListener, };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,gBAAgB,CAAC;AAEtL,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAQpD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,GAAG,mBAAmB,CAEzG;AAED,iBAAS,cAAc,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAE/D;AAED,iBAAS,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAKnD;AAED,iBAAe,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAc/D;AAED,iBAAe,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO7E;AAED;;;;;GAKG;AACH,iBAAe,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO7F;AAED,iBAAe,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAc3F;AAED,iBAAe,oBAAoB,CACjC,QAAQ,EAAE,WAAW,EACrB,4BAA4B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,iBAAiB,CAAC,GACzH,OAAO,CAAC,kBAAkB,CAAC,CAsB7B;AAED,YAAY,EAAC,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAC,CAAC;AAChK,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CardStatus, TokenizationStatus } from './NativeWallet';
|
|
2
|
+
declare function getCardState(stateId: number): CardStatus;
|
|
3
|
+
declare function getTokenizationStatus(stateId: number): TokenizationStatus;
|
|
4
|
+
export { getCardState, getTokenizationStatus };
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAEnE,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAiBjD;AAED,iBAAS,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAWlE;AAED,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@expensify/react-native-wallet",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "A React Native module designed for seamless integration of Card Push Provisioning into Apple Wallet and Google Wallet, enabling easy and secure addition of payment cards directly from your application.",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "lib/commonjs/index",
|
|
7
|
+
"module": "lib/module/index",
|
|
8
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
9
|
+
"react-native": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"assets",
|
|
14
|
+
"android",
|
|
15
|
+
"ios",
|
|
16
|
+
"cpp",
|
|
17
|
+
"*.podspec",
|
|
18
|
+
"react-native.config.js",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!android/build",
|
|
21
|
+
"!android/gradle",
|
|
22
|
+
"!android/gradlew",
|
|
23
|
+
"!android/gradlew.bat",
|
|
24
|
+
"!android/local.properties",
|
|
25
|
+
"!**/__tests__",
|
|
26
|
+
"!**/__fixtures__",
|
|
27
|
+
"!**/__mocks__",
|
|
28
|
+
"!**/.*"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"example": "npm run --workspace=@expensify/react-native-wallet-example",
|
|
32
|
+
"test": "jest",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"lint": "eslint . --ext .js,.ts,.tsx",
|
|
35
|
+
"lint:root": "eslint . --ext .js,.ts,.tsx --ignore-pattern '/example/**/*' --ignore-pattern '/WebExample/**/*'",
|
|
36
|
+
"lint:example": "eslint example --ext .js,.ts,.tsx",
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
38
|
+
"prepare": "bob build && sed -i.bak 's|\\..\\/assets|\\..\\/\\..\\/assets|g' lib/commonjs/constants.js && rm lib/commonjs/constants.js.bak",
|
|
39
|
+
"build:watch": "nodemon --watch src --ext .ts,.tsx,.css --exec \"rm -f .build_complete && npm run prepare && npm pack && touch .build_complete\"",
|
|
40
|
+
"release": "release-it"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react-native",
|
|
44
|
+
"ios",
|
|
45
|
+
"android"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/Expensify/react-native-wallet.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Expensify, Inc.",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/Expensify/react-native-wallet/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/Expensify/react-native-wallet#readme",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"registry": "https://registry.npmjs.org/",
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@babel/preset-env": "^7.25.3",
|
|
63
|
+
"@babel/preset-react": "^7.18.6",
|
|
64
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
65
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
66
|
+
"@lwc/eslint-plugin-lwc": "^1.7.2",
|
|
67
|
+
"@react-native-community/cli": "18.0.0",
|
|
68
|
+
"@react-native-community/cli-platform-android": "18.0.0",
|
|
69
|
+
"@react-native-community/cli-platform-ios": "18.0.0",
|
|
70
|
+
"@react-native/eslint-config": "0.79.2",
|
|
71
|
+
"@react-native/gradle-plugin": "0.79.2",
|
|
72
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
73
|
+
"@types/jest": "^29.5.14",
|
|
74
|
+
"@types/react": "^19.0.0",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
76
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
77
|
+
"del-cli": "^5.0.0",
|
|
78
|
+
"eslint": "^8.57.1",
|
|
79
|
+
"eslint-config-expensify": "^2.0.24",
|
|
80
|
+
"eslint-config-prettier": "^8.5.0",
|
|
81
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
82
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
83
|
+
"eslint-plugin-es": "^4.1.0",
|
|
84
|
+
"eslint-plugin-filenames": "^1.3.2",
|
|
85
|
+
"eslint-plugin-header": "^3.1.1",
|
|
86
|
+
"eslint-plugin-import": "^2.29.1",
|
|
87
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
88
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
89
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
90
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
91
|
+
"jest": "^29.6.3",
|
|
92
|
+
"prettier": "2.8.8",
|
|
93
|
+
"react": "^19.0.0",
|
|
94
|
+
"react-native": "0.79.2",
|
|
95
|
+
"react-native-builder-bob": "^0.20.0",
|
|
96
|
+
"release-it": "^15.0.0",
|
|
97
|
+
"turbo": "^1.10.7",
|
|
98
|
+
"typescript": "~5.3.3"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"react": "*",
|
|
102
|
+
"react-native": "*"
|
|
103
|
+
},
|
|
104
|
+
"workspaces": [
|
|
105
|
+
"./example"
|
|
106
|
+
],
|
|
107
|
+
"jest": {
|
|
108
|
+
"preset": "react-native",
|
|
109
|
+
"modulePathIgnorePatterns": [
|
|
110
|
+
"<rootDir>/example/node_modules",
|
|
111
|
+
"<rootDir>/lib/"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"commitlint": {
|
|
115
|
+
"extends": [
|
|
116
|
+
"@commitlint/config-conventional"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"release-it": {
|
|
120
|
+
"git": {
|
|
121
|
+
"commitMessage": "chore: release ${version}",
|
|
122
|
+
"tagName": "v${version}"
|
|
123
|
+
},
|
|
124
|
+
"npm": {
|
|
125
|
+
"publish": true
|
|
126
|
+
},
|
|
127
|
+
"github": {
|
|
128
|
+
"release": true
|
|
129
|
+
},
|
|
130
|
+
"plugins": {
|
|
131
|
+
"@release-it/conventional-changelog": {
|
|
132
|
+
"preset": "angular"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"react-native-builder-bob": {
|
|
137
|
+
"source": "src",
|
|
138
|
+
"output": "lib",
|
|
139
|
+
"targets": [
|
|
140
|
+
"commonjs",
|
|
141
|
+
"module",
|
|
142
|
+
[
|
|
143
|
+
"typescript",
|
|
144
|
+
{
|
|
145
|
+
"project": "tsconfig.json"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"codegenConfig": {
|
|
151
|
+
"name": "RNWalletSpec",
|
|
152
|
+
"type": "all",
|
|
153
|
+
"jsSrcsDir": "src",
|
|
154
|
+
"android": {
|
|
155
|
+
"javaPackageName": "com.expensify.wallet"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"dependencies": {
|
|
159
|
+
"expo": "*",
|
|
160
|
+
"expo-image": "*"
|
|
161
|
+
},
|
|
162
|
+
"expo": {
|
|
163
|
+
"autolinking": {
|
|
164
|
+
"exclude": [
|
|
165
|
+
"expo-application",
|
|
166
|
+
"expo-constants",
|
|
167
|
+
"expo-font",
|
|
168
|
+
"expo-keep-awake"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
$RNWallet = Object.new
|
|
6
|
+
|
|
7
|
+
def $RNWallet._add_compiler_flags(sp, extra_flags)
|
|
8
|
+
exisiting_flags = sp.attributes_hash["compiler_flags"]
|
|
9
|
+
if exisiting_flags.present?
|
|
10
|
+
sp.compiler_flags = exisiting_flags + " #{extra_flags}"
|
|
11
|
+
else
|
|
12
|
+
sp.compiler_flags = extra_flags
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Pod::Spec.new do |s|
|
|
17
|
+
s.name = "react-native-wallet"
|
|
18
|
+
s.version = package["version"]
|
|
19
|
+
s.summary = package["description"]
|
|
20
|
+
s.homepage = package["homepage"]
|
|
21
|
+
s.license = package["license"]
|
|
22
|
+
s.authors = package["author"]
|
|
23
|
+
|
|
24
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
25
|
+
s.source = { :git => "https://github.com/Expensify/react-native-wallet.git", :tag => "#{s.version}" }
|
|
26
|
+
|
|
27
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
28
|
+
|
|
29
|
+
s.dependency "React-Core"
|
|
30
|
+
|
|
31
|
+
install_modules_dependencies(s);
|
|
32
|
+
|
|
33
|
+
if ENV['USE_FRAMEWORKS']
|
|
34
|
+
$RNWallet._add_compiler_flags(s, "-DRNWallet_USE_FRAMEWORKS=1")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, {useMemo} from 'react';
|
|
2
|
+
import {StyleSheet, Pressable, Platform} from 'react-native';
|
|
3
|
+
import type {ViewStyle} from 'react-native';
|
|
4
|
+
import {Image} from 'expo-image';
|
|
5
|
+
import LOCALIZED_BUTTONS from './constants';
|
|
6
|
+
|
|
7
|
+
type ButtonProps = {
|
|
8
|
+
onPress: () => void;
|
|
9
|
+
locale: string;
|
|
10
|
+
buttonStyle?: ViewStyle;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platform = Platform.OS === 'ios' ? 'ios' : 'android';
|
|
14
|
+
|
|
15
|
+
function AddToWalletButton({onPress, locale, buttonStyle}: ButtonProps) {
|
|
16
|
+
const IconComponent = useMemo(() => {
|
|
17
|
+
const platformIcons = LOCALIZED_BUTTONS[platform];
|
|
18
|
+
return platformIcons[locale] ?? platformIcons.default;
|
|
19
|
+
}, [locale]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Pressable
|
|
23
|
+
style={[styles.button, buttonStyle]}
|
|
24
|
+
onPress={onPress}
|
|
25
|
+
>
|
|
26
|
+
<Image
|
|
27
|
+
source={IconComponent}
|
|
28
|
+
style={styles.image}
|
|
29
|
+
contentFit="contain"
|
|
30
|
+
/>
|
|
31
|
+
</Pressable>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
button: {
|
|
37
|
+
width: 200,
|
|
38
|
+
height: 70,
|
|
39
|
+
padding: 10,
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
},
|
|
43
|
+
image: {
|
|
44
|
+
width: '100%',
|
|
45
|
+
height: '100%',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default AddToWalletButton;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type {TurboModule} from 'react-native';
|
|
2
|
+
import {TurboModuleRegistry} from 'react-native';
|
|
3
|
+
|
|
4
|
+
type AndroidWalletData = {
|
|
5
|
+
deviceID: string;
|
|
6
|
+
walletAccountID: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type CardStatus = 'not found' | 'requireActivation' | 'pending' | 'active' | 'suspended' | 'deactivated';
|
|
10
|
+
|
|
11
|
+
type Platform = 'android' | 'ios';
|
|
12
|
+
|
|
13
|
+
type UserAddress = {
|
|
14
|
+
name: string;
|
|
15
|
+
addressOne: string;
|
|
16
|
+
addressTwo?: string;
|
|
17
|
+
administrativeArea: string;
|
|
18
|
+
locality: string;
|
|
19
|
+
countryCode: string;
|
|
20
|
+
postalCode: string;
|
|
21
|
+
phoneNumber: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type AndroidCardData = {
|
|
25
|
+
network: string;
|
|
26
|
+
opaquePaymentCard: string;
|
|
27
|
+
cardHolderName: string;
|
|
28
|
+
lastDigits: string;
|
|
29
|
+
userAddress: UserAddress;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type IOSCardData = {
|
|
33
|
+
network: string;
|
|
34
|
+
cardHolderName: string;
|
|
35
|
+
lastDigits: string;
|
|
36
|
+
cardDescription: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type onCardActivatedPayload = {
|
|
40
|
+
tokenId: string;
|
|
41
|
+
actionStatus: 'active' | 'canceled';
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type IOSAddPaymentPassData = {
|
|
45
|
+
status: number;
|
|
46
|
+
nonce: string;
|
|
47
|
+
nonceSignature: string;
|
|
48
|
+
certificates: string[];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type IOSEncryptPayload = {
|
|
52
|
+
encryptedPassData: string;
|
|
53
|
+
activationData: string;
|
|
54
|
+
ephemeralPublicKey: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
type TokenizationStatus = 'canceled' | 'success' | 'error';
|
|
58
|
+
|
|
59
|
+
export interface Spec extends TurboModule {
|
|
60
|
+
checkWalletAvailability(): Promise<boolean>;
|
|
61
|
+
ensureGoogleWalletInitialized(): Promise<boolean>;
|
|
62
|
+
getSecureWalletInfo(): Promise<AndroidWalletData>;
|
|
63
|
+
getCardStatusBySuffix(last4Digits: string): Promise<number>;
|
|
64
|
+
getCardStatusByIdentifier(identifier: string, tsp: string): Promise<number>;
|
|
65
|
+
addCardToGoogleWallet(cardData: AndroidCardData): Promise<number>;
|
|
66
|
+
IOSPresentAddPaymentPassView(cardData: IOSCardData): Promise<IOSAddPaymentPassData>;
|
|
67
|
+
IOSHandleAddPaymentPassResponse(payload: IOSEncryptPayload): Promise<IOSAddPaymentPassData | null>;
|
|
68
|
+
addListener: (eventType: string) => void;
|
|
69
|
+
removeListeners: (count: number) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const PACKAGE_NAME = '@expensify/react-native-wallet';
|
|
73
|
+
// Try catch block to prevent crashing in case the module is not linked.
|
|
74
|
+
// Especialy useful for builds where Google SDK is not available
|
|
75
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
76
|
+
let Wallet: Spec | undefined;
|
|
77
|
+
try {
|
|
78
|
+
Wallet = TurboModuleRegistry.getEnforcing<Spec>('RNWallet');
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof Error) {
|
|
81
|
+
// eslint-disable-next-line no-console
|
|
82
|
+
console.warn(`[${PACKAGE_NAME}] Failed to load Wallet module, ${error.message}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export default Wallet;
|
|
86
|
+
export {PACKAGE_NAME};
|
|
87
|
+
export type {AndroidCardData, IOSCardData, AndroidWalletData, CardStatus, UserAddress, onCardActivatedPayload, Platform, IOSAddPaymentPassData, IOSEncryptPayload, TokenizationStatus};
|