@napps/component-extension.
Use the Services guides for behavior-oriented examples.
NAPPS
NAPPS is the proxy object used when you prefer an explicit object over ambient globals.
Storefront and customer calls
Both APIs return a typed GraphQL envelope. The optionalproperties object is passed as the
request properties/variables object supported by the host.
query, pass request values in the second properties object, and read
data and errors from the returned envelope. Do not depend on older positional overloads.
App utilities
country and locale describe the current app context. formatCurrency returns a localized
display string; it does not change the input amount.
Cart service
CartOperations when you
need to return a batch of mutations from an extension.
App navigation
navigateToExternalPage.
Product and metaobject services
null when no matching object exists. A missing product is not an
error, so handle null instead of catching a rejection.
Customer context
Safe-area insets
subscribe invokes the callback immediately with the
current snapshot and returns an ID for cleanup. For applying safe-area spacing to UI nodes, see
n-safe-* theme classes.
App theme
AppTheme exposes theme values that do not map to reusable style classes. Use the n-* classes
described in App theme styles for colors, typography, borders, radii, and spacing.
AppTheme.get(). subscribe calls the callback immediately with
the current snapshot, then again when the exposed theme values change. Keep the returned ID and
pass it to unsubscribe when you no longer need updates. The version field identifies the
shape of the snapshot.
Storage access
sessionStorage is synchronous and in-memory. For persistent scoped storage, see Runtime APIs
and the AppStorage declarations in @napps/nodes runtime.