@tap-payments/apple-pay-button 0.0.54-development → 0.0.55-development
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.
|
@@ -40,7 +40,7 @@ import appService from '../api/app.service';
|
|
|
40
40
|
var EVENT_NAME = 'TAP_BUTTON::APPLE_PAY_ON_PAYMENT_AUTHORIZED';
|
|
41
41
|
export var useMerchantApplePay = function (_a) {
|
|
42
42
|
var isIframeIntegration = _a.isIframeIntegration, onError = _a.onError, onSuccess = _a.onSuccess, scope = _a.scope, profileData = _a.profileData, order = _a.order, customer = _a.customer, transaction = _a.transaction, operator = _a.operator, redirect = _a.redirect, post = _a.post;
|
|
43
|
-
var onMessageReceived = function (_a) {
|
|
43
|
+
var onMessageReceived = React.useCallback(function (_a) {
|
|
44
44
|
var message = _a.data;
|
|
45
45
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
46
46
|
var _b, event, data, _c, response, tokenId, supportCurrency, transactionRequest, transactionResponse, _d, e_1;
|
|
@@ -151,11 +151,11 @@ export var useMerchantApplePay = function (_a) {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
|
-
};
|
|
154
|
+
}, [onError, onSuccess, scope, profileData, order, customer, transaction, operator, redirect, post]);
|
|
155
155
|
React.useEffect(function () {
|
|
156
156
|
if (!isIframeIntegration)
|
|
157
157
|
return;
|
|
158
158
|
window.addEventListener('message', onMessageReceived);
|
|
159
159
|
return function () { return window.removeEventListener('message', onMessageReceived); };
|
|
160
|
-
}, [isIframeIntegration]);
|
|
160
|
+
}, [isIframeIntegration, onMessageReceived]);
|
|
161
161
|
};
|