@volveme/applepay-react-core
v0.3.1
Published
Shared Apple Pay Express session logic for VTEX Checkout v6 and Store Framework.
Readme
@volveme/applepay-react-core
Shared Apple Pay Express Checkout React logic for:
volve.applepay([email protected], Checkout v6 / render 7)volve.applepay-store([email protected], Store Framework minicart / render 8)
No vtex.* or react-intl imports. CSS stays in the consuming app.
Usage
import { ApplePayExpressButton, useApplePay } from '@volveme/applepay-react-core'Package version 0.3.1 (npm). The @volve npm scope is already taken by another organization, so this package uses @volveme. Publish with npm publish --access public, then pin 0.3.1 in volve.applepay and volve.applepay-store.
useApplePay returns cpfRequired from GET /_v/v0/apple-pay/public-config (Master Data CL schema requires document). The express button shows the CPF field only when that flag is true and the cart has no document yet.
Mounting ApplePayExpressButton (or useApplePay) injects the Apple Pay JS SDK (https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js) once per page. That script is what exposes ApplePaySession in Chrome. An existing storefront-pixel tag with the same URL is reused.
Local development can still use a path dependency:
"@volveme/applepay-react-core": "file:../packages/applepay-react-core"