@civic/common-gateway-react
Advanced tools
Comparing version 0.13.0-beta.1 to 0.13.0-beta.2
@@ -9,2 +9,3 @@ "use strict"; | ||
const actionCreator_1 = require("../actionCreator"); | ||
const payer_1 = require("../utils/payer"); | ||
const logDebug = (0, logger_1.prefixLogger)('PassOrchestrator').debug; | ||
@@ -208,3 +209,3 @@ const logError = (0, logger_1.prefixLogger)('PassOrchestrator').error; | ||
// if there's a payer then we don't need confifrmation from the user before sending to the gatekeeper | ||
if (!this.state.payer) { | ||
if ((0, payer_1.payerIsWalletOwner)(this.state)) { | ||
await this.hookFns.waitForTransactionConfirm(); | ||
@@ -253,2 +254,3 @@ } | ||
gatewayToken, | ||
payer, | ||
}); | ||
@@ -255,0 +257,0 @@ if (gatewayToken) { |
@@ -13,2 +13,3 @@ "use strict"; | ||
const analytics_1 = require("../utils/analytics"); | ||
const payer_1 = require("../utils/payer"); | ||
const logDebug = (0, logger_1.prefixLogger)('useCivicPass').debug; | ||
@@ -48,3 +49,3 @@ const logError = (0, logger_1.prefixLogger)('useCivicPass').error; | ||
var _a, _b; | ||
const { redirectUrl, gatekeeperNetworkAddress, stage, walletAddress, civicPass, chainType, chainNetwork, payer, partnerAppId, instanceId, signedTx, flowId, did, gatekeeperSendsTransaction, } = state; | ||
const { redirectUrl, gatekeeperNetworkAddress, stage, walletAddress, civicPass, chainType, chainNetwork, partnerAppId, instanceId, signedTx, flowId, did, gatekeeperSendsTransaction, } = state; | ||
const errorResponseIfExists = (errorResponse || civicPass.requestPayload); | ||
@@ -62,3 +63,3 @@ logDebug('getCivicPassSrcUrl', { errorResponseIfExists, civicPass, state }); | ||
const action = gatewayStatusToCivicPassAction[status]; | ||
const filteredParams = (0, generalUtils_1.objectToURLParams)(Object.assign(Object.assign({}, civicPass.requestPayload), { redirectUrl, networkAddress: gatekeeperNetworkAddress, action, wallet: walletAddress, chain: chainType, chainNetwork: chainNetwork === null || chainNetwork === void 0 ? void 0 : chainNetwork.toString(), ownerSigns: payer === walletAddress, gatekeeperSendsTransaction, errorCode: errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.errorCode, payload: (errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) ? JSON.stringify(errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) : undefined, partnerAppId, | ||
const filteredParams = (0, generalUtils_1.objectToURLParams)(Object.assign(Object.assign({}, civicPass.requestPayload), { redirectUrl, networkAddress: gatekeeperNetworkAddress, action, wallet: walletAddress, chain: chainType, chainNetwork: chainNetwork === null || chainNetwork === void 0 ? void 0 : chainNetwork.toString(), ownerSigns: (0, payer_1.payerIsWalletOwner)(state), gatekeeperSendsTransaction, errorCode: errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.errorCode, payload: (errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) ? JSON.stringify(errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) : undefined, partnerAppId, | ||
instanceId, | ||
@@ -132,5 +133,5 @@ signedTx, | ||
// Show owner confirm transaction only if they are paying | ||
const gatewayStatus = state.gatekeeperSendsTransaction || payer | ||
? types_1.GatewayStatus.IN_REVIEW | ||
: types_1.ExtendedGatewayStatus.CONFIRM_OWNER_TRANSACTION; | ||
const gatewayStatus = (0, payer_1.payerIsWalletOwner)(state) | ||
? types_1.ExtendedGatewayStatus.CONFIRM_OWNER_TRANSACTION | ||
: types_1.GatewayStatus.IN_REVIEW; | ||
return Object.assign(Object.assign({}, state), { flowId, | ||
@@ -137,0 +138,0 @@ gatewayStatus, ownerTransactionConfirmed: false, renderIframe: true, iframeMinimized: false, powoRequested: 'solana', iframeSrcUrl: (0, exports.getCivicPassSrcUrl)(Object.assign(Object.assign({}, state), { flowId }), gatewayStatus), civicPass: Object.assign(Object.assign({}, state.civicPass), { status: types_1.CivicPassIssuanceStatus.VERIFIED, responsePayload: { |
@@ -6,2 +6,3 @@ import { prefixLogger } from '../logger'; | ||
import { gatewayTokenActionCreator } from '../actionCreator'; | ||
import { payerIsWalletOwner } from '../utils/payer'; | ||
const logDebug = prefixLogger('PassOrchestrator').debug; | ||
@@ -205,3 +206,3 @@ const logError = prefixLogger('PassOrchestrator').error; | ||
// if there's a payer then we don't need confifrmation from the user before sending to the gatekeeper | ||
if (!this.state.payer) { | ||
if (payerIsWalletOwner(this.state)) { | ||
await this.hookFns.waitForTransactionConfirm(); | ||
@@ -250,2 +251,3 @@ } | ||
gatewayToken, | ||
payer, | ||
}); | ||
@@ -252,0 +254,0 @@ if (gatewayToken) { |
@@ -10,2 +10,3 @@ /* eslint-disable consistent-return */ | ||
import { flowTypeFromFlowId, getFlowId } from '../utils/analytics'; | ||
import { payerIsWalletOwner } from '../utils/payer'; | ||
const logDebug = prefixLogger('useCivicPass').debug; | ||
@@ -45,3 +46,3 @@ const logError = prefixLogger('useCivicPass').error; | ||
var _a, _b; | ||
const { redirectUrl, gatekeeperNetworkAddress, stage, walletAddress, civicPass, chainType, chainNetwork, payer, partnerAppId, instanceId, signedTx, flowId, did, gatekeeperSendsTransaction, } = state; | ||
const { redirectUrl, gatekeeperNetworkAddress, stage, walletAddress, civicPass, chainType, chainNetwork, partnerAppId, instanceId, signedTx, flowId, did, gatekeeperSendsTransaction, } = state; | ||
const errorResponseIfExists = (errorResponse || civicPass.requestPayload); | ||
@@ -59,3 +60,3 @@ logDebug('getCivicPassSrcUrl', { errorResponseIfExists, civicPass, state }); | ||
const action = gatewayStatusToCivicPassAction[status]; | ||
const filteredParams = objectToURLParams(Object.assign(Object.assign({}, civicPass.requestPayload), { redirectUrl, networkAddress: gatekeeperNetworkAddress, action, wallet: walletAddress, chain: chainType, chainNetwork: chainNetwork === null || chainNetwork === void 0 ? void 0 : chainNetwork.toString(), ownerSigns: payer === walletAddress, gatekeeperSendsTransaction, errorCode: errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.errorCode, payload: (errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) ? JSON.stringify(errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) : undefined, partnerAppId, | ||
const filteredParams = objectToURLParams(Object.assign(Object.assign({}, civicPass.requestPayload), { redirectUrl, networkAddress: gatekeeperNetworkAddress, action, wallet: walletAddress, chain: chainType, chainNetwork: chainNetwork === null || chainNetwork === void 0 ? void 0 : chainNetwork.toString(), ownerSigns: payerIsWalletOwner(state), gatekeeperSendsTransaction, errorCode: errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.errorCode, payload: (errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) ? JSON.stringify(errorResponseIfExists === null || errorResponseIfExists === void 0 ? void 0 : errorResponseIfExists.payload) : undefined, partnerAppId, | ||
instanceId, | ||
@@ -128,5 +129,5 @@ signedTx, | ||
// Show owner confirm transaction only if they are paying | ||
const gatewayStatus = state.gatekeeperSendsTransaction || payer | ||
? GatewayStatus.IN_REVIEW | ||
: ExtendedGatewayStatus.CONFIRM_OWNER_TRANSACTION; | ||
const gatewayStatus = payerIsWalletOwner(state) | ||
? ExtendedGatewayStatus.CONFIRM_OWNER_TRANSACTION | ||
: GatewayStatus.IN_REVIEW; | ||
return Object.assign(Object.assign({}, state), { flowId, | ||
@@ -133,0 +134,0 @@ gatewayStatus, ownerTransactionConfirmed: false, renderIframe: true, iframeMinimized: false, powoRequested: 'solana', iframeSrcUrl: getCivicPassSrcUrl(Object.assign(Object.assign({}, state), { flowId }), gatewayStatus), civicPass: Object.assign(Object.assign({}, state.civicPass), { status: CivicPassIssuanceStatus.VERIFIED, responsePayload: { |
{ | ||
"name": "@civic/common-gateway-react", | ||
"version": "0.13.0-beta.1", | ||
"version": "0.13.0-beta.2", | ||
"main": "./dist/cjs/index.js", | ||
@@ -37,3 +37,3 @@ "module": "./dist/esm/index.js", | ||
}, | ||
"gitHead": "8d5b378d97a03cb5eca224c0c44deabe52275c47" | ||
"gitHead": "2c8694fe33e9ec3d7de7e31a93881566f32a51cb" | ||
} |
531069
195
10083