@zkp2p/sdk 0.14.2-rc.4 → 0.14.3

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/README.md CHANGED
@@ -35,6 +35,11 @@ and chargeback-risk surface. The workspace version lives in `package.json`.
35
35
 
36
36
  ## Optional Venmo Gmail connection
37
37
 
38
+ For partner cash-out integrations, prefer stable `@zkp2p/cash@0.6.1` and its
39
+ [prepare/open/status flow](https://docs.peer.xyz/developer/peer-cash/guide#optional-venmo-receipt-linking).
40
+ It selects the matching environment and keeps linking separate from cash-out.
41
+ The direct SDK helpers below require `@zkp2p/sdk@0.14.2`.
42
+
38
43
  Open Peer's **Link your Venmo** popup for an already-registered account.
39
44
  The host passes the selected account hash; the user selects Connect Gmail,
40
45
  then chooses their receipt inbox through Google.
@@ -70,6 +75,90 @@ hosts and custom window handling with account-status polling at least ten second
70
75
  apart. Deploy the hosted page before using the SDK helper. See the
71
76
  [flow specification](https://github.com/zkp2p/zkp2p-clients/blob/main/docs/venmo-gmail-connect.md).
72
77
 
78
+ ### Native app return
79
+
80
+ SDK `0.14.3` adds optional `returnUrl` to the URL builder. Partners
81
+ supply their callback directly; no callback registration with Peer or deployment
82
+ setting is required. Deploy the hosted-page update before enabling this flow.
83
+
84
+ ```ts
85
+ import { getVenmoGmailConnectUrl } from '@zkp2p/sdk';
86
+ import * as WebBrowser from 'expo-web-browser';
87
+
88
+ // Use a callback scheme registered in your app binary.
89
+ const returnUrl = 'partner-app://venmo-linked';
90
+ const connectUrl = getVenmoGmailConnectUrl({ payeeDetails, returnUrl });
91
+ await WebBrowser.openAuthSessionAsync(connectUrl, returnUrl);
92
+ // Re-check your backend's seller-credential/status after return or dismissal.
93
+ ```
94
+
95
+ Use a scheme registered in your Expo app binary; Expo Go is not a substitute
96
+ for testing your app's callback. See Expo's
97
+ [`openAuthSessionAsync` documentation](https://docs.expo.dev/versions/latest/sdk/webbrowser/#webbrowseropenauthsessionasyncurl-redirecturl-options).
98
+ The browser popup helper remains browser-only; native hosts use the URL builder.
99
+
100
+ Peer keeps Google's OAuth callback on Peer and verifies the selected account
101
+ before navigating to `returnUrl` unchanged. No Google codes, tokens, email,
102
+ account hash, or success flag are appended. If automatic navigation is blocked,
103
+ select **Return to your app**. Consent or verification errors stay visible and
104
+ also offer a manual return. A return, dismissal, or cancellation is not proof of
105
+ linking: only an active `google_oauth` credential from the status API is linked.
106
+
107
+ Apps that need no SDK can build the same URL themselves:
108
+ `https://app.peer.xyz/connect/venmo?returnUrl=<URL-encoded-callback>#<payeeDetails>`.
109
+ The query parameter must precede the account hash fragment. Malformed URLs,
110
+ unsafe schemes, embedded credentials, and duplicate parameters are rejected
111
+ before consent or credential upload.
112
+
113
+ Omit `returnUrl` or leave it empty to keep the existing behavior: Peer attempts
114
+ `window.close()` after verification. Script-opened desktop popups can close;
115
+ mobile browser tabs that disallow closure keep the success message visible.
116
+
117
+ ### Popup customization
118
+
119
+ Pass `appearance` to either hosted-link helper and `popup` to the browser opener:
120
+
121
+ ```ts
122
+ await openVenmoGmailConnect({
123
+ payeeDetails,
124
+ popup: { width: 500, height: 620 },
125
+ appearance: {
126
+ logoUrl: 'https://your-app.example/logo.png',
127
+ logoAlt: 'Your app',
128
+ backgroundColor: '#FFFFFF',
129
+ textColor: '#172033',
130
+ secondaryTextColor: '#636B7A',
131
+ buttonColor: '#6246EA',
132
+ buttonTextColor: '#FFFFFF',
133
+ buttonHoverColor: '#5035CC',
134
+ focusColor: '#6246EA',
135
+ fontFamily: 'Arial, sans-serif',
136
+ headingFontFamily: 'Arial, sans-serif',
137
+ headingTextTransform: 'none',
138
+ buttonTextTransform: 'none',
139
+ headingFontSize: 30,
140
+ buttonBorderRadius: 24,
141
+ buttonHeight: 52,
142
+ logoHeight: 44,
143
+ },
144
+ });
145
+ ```
146
+
147
+ The page centers your hosted logo and Venmo in equal circular frames with connection dots below the explanation, using Peer when no partner logo is supplied. `fontUrl` optionally loads a hosted WOFF/WOFF2 face (the font host must
148
+ allow CORS); a failed font uses the fallback stack. Failed partner images show Peer. Asset URLs require HTTPS, with HTTP localhost allowed for development.
149
+
150
+ `VenmoGmailAppearance` also exposes `cardBackgroundColor`, `cardBorderRadius`,
151
+ `borderColor`, `contentWidth`, `padding`, `gap`, `fontSize`, `successColor` and
152
+ `errorColor`. Colors use `#RGB` or `#RRGGBB`; sizes are pixels. Invalid options
153
+ throw `ValidationError` before the popup opens. Arbitrary CSS/HTML is not accepted.
154
+ Choose contrasting text, button and focus colors.
155
+
156
+ Popup width supports 320–1200 px and height 480–1600 px. Mobile still requests a
157
+ regular tab, whose size and presentation are controlled by the browser. Branding
158
+ and styles survive the existing Google callback; account binding, consent copy,
159
+ receipt verification and error codes remain unchanged. Google controls its own
160
+ consent page's appearance.
161
+
73
162
  ## Installation
74
163
 
75
164
  ```bash
@@ -2,11 +2,11 @@
2
2
  "schemaVersion": 2,
3
3
  "source": {
4
4
  "repository": "zkp2p/zkp2p-clients",
5
- "commitSha": "8f8238e57dadbf8c2dddc5e6a1db1bfaf2d21df2",
5
+ "commitSha": "e848bb1cab3615498514e767e43ea50ec464a633",
6
6
  "kind": "github",
7
7
  "distributable": true
8
8
  },
9
- "sdkPackageVersion": "0.14.2-rc.4",
9
+ "sdkPackageVersion": "0.14.3",
10
10
  "contractsPackageVersion": "0.4.2-rc.2",
11
11
  "indexerSchemaPackageVersion": "0.22.0",
12
12
  "activeDisputeStack": {
@@ -1,5 +1,5 @@
1
1
  import { currencyKeccak256, getCurrencyInfoFromHash } from './chunk-ZB22BZLZ.mjs';
2
- import { __export } from './chunk-U555K2CU.mjs';
2
+ import { __export } from './chunk-BY77PPIP.mjs';
3
3
  import { hexToBytes, keccak256, toBytes, bytesToHex } from 'viem';
4
4
 
5
5
  // src/utils/bigint.ts
@@ -97848,5 +97848,5 @@ function enrichPvIntentView(view, chainId, env = "production") {
97848
97848
  }
97849
97849
 
97850
97850
  export { DISPUTE_PROTECTION_POLICY_ABI, DISPUTE_PROTECTION_POLICY_ABI2, DisputeNullifierRegistry_default3 as DisputeNullifierRegistry_default, DisputeProtectionPolicy_default3 as DisputeProtectionPolicy_default, DisputeVerifier_default3 as DisputeVerifier_default, IntentLifecycleHookV1_default3 as IntentLifecycleHookV1_default, METHOD_NAME_TO_HASH, MultiAttestationVerifier_default3 as MultiAttestationVerifier_default, ORCHESTRATOR_V3_ABI2 as ORCHESTRATOR_V3_ABI, OrchestratorRegistry_default3 as OrchestratorRegistry_default, OrchestratorV3_default3 as OrchestratorV3_default, PAYMENT_PLATFORMS, STAKE_VAULT_ABI2 as STAKE_VAULT_ABI, SUPPORTED_PAYMENT_METHOD_HASHES, StakeVault_default3 as StakeVault_default, WhitelistPolicy_default3 as WhitelistPolicy_default, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, matchesPaymentMethodNameAndHash, matchesQuotePaymentMethod, parseBigIntLike, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash };
97851
- //# sourceMappingURL=chunk-4SDRVKB5.mjs.map
97852
- //# sourceMappingURL=chunk-4SDRVKB5.mjs.map
97851
+ //# sourceMappingURL=chunk-2NJU3MGV.mjs.map
97852
+ //# sourceMappingURL=chunk-2NJU3MGV.mjs.map