diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 29d35fb9..66d4c04b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,4 +20,75 @@ jobs: - uses: volta-cli/action@v4 - run: yarn install --frozen-lockfile - - run: npm publish + + - name: Publish to npm + id: publish + run: npm publish + + # Extract package info before cloning small-things (to avoid workspace conflicts) + - name: Extract package info + id: package_info + if: success() + run: | + echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT + + # Install Deno for small-things + - name: Install Deno + if: success() + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + # Clone small-things repository + - name: Clone small-things + if: success() + uses: actions/checkout@v6 + with: + repository: smallcase/small-things + ref: main + path: small-things + + # Track release in small-things (Slack notification) + - name: Track release in small-things + if: success() + env: + VERSION: ${{ steps.package_info.outputs.version }} + PACKAGE_NAME: ${{ steps.package_info.outputs.name }} + RELEASE_TYPE: ${{ vars.RELEASE_TYPE || 'prod' }} + run: | + # Determine SDK name from package name + SDK_NAME="scgateway" + if [[ "$PACKAGE_NAME" == *"gateway"* ]] || [[ "$PACKAGE_NAME" == *"Gateway"* ]] || [[ "$PACKAGE_NAME" == *"SCG"* ]]; then + SDK_NAME="scgateway" + elif [[ "$PACKAGE_NAME" == *"loan"* ]] || [[ "$PACKAGE_NAME" == *"Loan"* ]]; then + SDK_NAME="scloans" + else + SDK_NAME="$PACKAGE_NAME" + fi + + # Determine release type (defaults to prod, can be overridden via vars) + RELEASE_TYPE="${RELEASE_TYPE:-prod}" + + # Call small-things to track release (Slack webhook) + if [ -n "$VERSION" ] && [ -n "$SDK_NAME" ]; then + echo "Tracking release: $SDK_NAME v$VERSION (type: $RELEASE_TYPE)" + + if [ -d "small-things" ]; then + cd small-things + + deno run --allow-all main.ts gw track-release \ + --platform react-native \ + --sdkName "$SDK_NAME" \ + --version "$VERSION" \ + --publishTarget "npm" \ + --releaseType "$RELEASE_TYPE" \ + 2>&1 || { + echo "Warning: Failed to track release in small-things (non-critical - build continues)" + } + else + echo "Warning: small-things directory not found. Skipping release tracking (non-critical)." + fi + else + echo "Warning: Could not determine SDK name or version. Skipping release tracking." + fi \ No newline at end of file diff --git a/ios/SmallcaseGateway.m b/ios/SmallcaseGateway.m index bc8d7699..69ee3937 100644 --- a/ios/SmallcaseGateway.m +++ b/ios/SmallcaseGateway.m @@ -234,6 +234,21 @@ @interface RCT_EXTERN_MODULE(SmallcaseGateway, NSObject) resolve(responseDict); return; } + + //MARK: intent - mf holdings import + if ([response isKindOfClass: [ObjCTransactionIntentMfHoldingsImport class]]) { + ObjCTransactionIntentMfHoldingsImport *trxResponse = response; + // Use existing responseDict (already has success: true from line 169) + [responseDict setValue:@"MF_HOLDINGS_IMPORT" forKey:@"transaction"]; + + if (trxResponse.data != nil && trxResponse.data.length > 0) { + [responseDict setObject:trxResponse.data forKey:@"data"]; + } else { + [responseDict setObject:@"" forKey:@"data"]; + } + resolve(responseDict); + return; + } //MARK: intent - fetch funds if([response isKindOfClass: [ObjcTransactionIntentFetchFunds class]]) { diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 6b33c6ed..a06a4b0e 100644 --- a/react-native-smallcase-gateway.podspec +++ b/react-native-smallcase-gateway.podspec @@ -33,6 +33,6 @@ Pod::Spec.new do |s| s.dependency "ReactCommon/turbomodule/core" end - s.dependency 'SCGateway', '7.1.0' + s.dependency 'SCGateway-dhruv-gw-track-release-2924646', '7.1.0-19-debug' s.dependency 'SCLoans', '7.0.0' end diff --git a/smart_investing_react_native/app/apis/Functions.tsx b/smart_investing_react_native/app/apis/Functions.tsx index 10fead11..287cc9b0 100644 --- a/smart_investing_react_native/app/apis/Functions.tsx +++ b/smart_investing_react_native/app/apis/Functions.tsx @@ -127,19 +127,6 @@ async function connect(env: Environment, userId: string): Promise { } } -async function triggerMftxn(env: Environment, transactionId: string) { - try { - console.log(`Transaction ID: ${transactionId}, Intent: MF_HOLDINGS_IMPORT`); - console.log('triggerMftxn txn id: ' + transactionId); - const res = await SmallcaseGateway.triggerMfTransaction(transactionId); - console.log('triggerMftxn res: ' + JSON.stringify(res)); - await alert('triggerMftxn', JSON.stringify(res)); - } catch (error) { - console.log('triggerMftxn error - ' + error); - console.log('triggerMftxn error stringified - ' + JSON.stringify(error)); - await alert('triggerMftxn Error', getErrorString(error)); - } -} async function placeSstOrder( env: Environment, @@ -527,6 +514,20 @@ async function triggerTxn(txnId: string) { } } +async function triggerMftxn(env: Environment, transactionId: string) { + try { + console.log(`Transaction ID: ${transactionId}, Intent: MF_HOLDINGS_IMPORT`); + console.log('triggertxn for MF txn id: ' + transactionId); + const res = await SmallcaseGateway.triggerTransaction(transactionId); + console.log('triggertxn for MF res: ' + JSON.stringify(res)); + await alert('triggertxn for MF', JSON.stringify(res)); + } catch (error) { + console.log('triggertxn for MF error - ' + error); + console.log('triggertxn for MF error stringified - ' + JSON.stringify(error)); + await alert('triggertxn for MF Error', getErrorString(error)); + } +} + const sleep = (ms: number) => new Promise(resolve => setTimeout((): void => resolve(undefined), ms)); const copyToClipboard = (value: string) => { diff --git a/smart_investing_react_native/app/screens/MFHoldingsScreen.tsx b/smart_investing_react_native/app/screens/MFHoldingsScreen.tsx index ba309c0e..4af70182 100644 --- a/smart_investing_react_native/app/screens/MFHoldingsScreen.tsx +++ b/smart_investing_react_native/app/screens/MFHoldingsScreen.tsx @@ -1,7 +1,7 @@ import React, {useContext} from 'react'; import {TextInput} from 'react-native'; import {SmartButton} from './HoldingsScreen'; -import {getTransactionId, triggerMftxn, alert} from '../apis/Functions'; +import {getTransactionId, alert, triggerTxn} from '../apis/Functions'; import {EnvContext} from '../EnvProvider'; import {Environment} from '../apis/SmartInvestingService'; import {postbackSearch} from '../apis/SmartInvestingService'; @@ -27,7 +27,7 @@ async function getMfHoldings(env: Environment, txnId: string) { alert('MF Holdings Postback Response', JSON.stringify(res)); } async function importMFHoldings(env: Environment, txnId: string) { - await triggerMftxn(env, txnId); + await triggerTxn(txnId); getMfHoldings(env, txnId); }