@@ -22,14 +22,11 @@ import type {SubscribableSignalLike} from '../../shared';
2222export type { ApiVersion , Capability } from '../../../../shared' ;
2323
2424/**
25- * A key-value storage object for the extension.
26- *
27- * Stored data is available only to this specific extension
28- * and any of its instances.
29- *
30- * The storage backend is implemented with `localStorage` and
31- * should persist across the buyer's checkout session.
32- * However, data persistence isn't guaranteed.
25+ * Persists key-value data across the buyer's session for a specific extension.
26+ * Use storage to save preferences, dismiss states, or cached data that should
27+ * survive page reloads without requiring a backend call. Stored data is only
28+ * available to this specific extension. The storage backend is implemented with
29+ * `localStorage` and data persistence isn't guaranteed.
3330 */
3431export interface Storage {
3532 /**
@@ -50,13 +47,16 @@ export interface Storage {
5047 write ( key : string , data : any ) : Promise < void > ;
5148
5249 /**
53- * Delete stored data by key.
50+ * Delete a previously stored value by key. Use this instead of writing `null`
51+ * or an empty string to cleanly remove an entry from storage.
5452 */
5553 delete ( key : string ) : Promise < void > ;
5654}
5755
5856/**
59- * The meta information about an extension target.
57+ * Metadata about the running extension, including its API version, target,
58+ * capabilities, and editor context. Use this to read configuration details or
59+ * conditionally render content based on where the extension is running.
6060 */
6161export interface Extension < Target extends ExtensionTarget = ExtensionTarget > {
6262 /**
@@ -130,6 +130,11 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
130130 version ?: string ;
131131}
132132
133+ /**
134+ * Information about the editor environment when an extension is rendered
135+ * inside the editor. The value is `undefined` when the extension is not
136+ * rendering in an editor.
137+ */
133138export interface Editor {
134139 /**
135140 * Indicates whether the extension is rendering in the [checkout editor](https://shopify.dev/docs/apps/checkout). Always `'checkout'`.
@@ -294,9 +299,9 @@ export type Version = string;
294299export type CheckoutToken = string ;
295300
296301/**
297- * This returns a translated string matching a key in a locale file .
298- *
299- * @example translate("banner.title")
302+ * Translates a key from your extension's locale files into a localized string .
303+ * Supports interpolation with placeholder replacements and pluralization
304+ * via the special `count` option.
300305 */
301306export interface I18nTranslate {
302307 < ReplacementType = string > (
@@ -307,6 +312,11 @@ export interface I18nTranslate {
307312 : ( string | ReplacementType ) [ ] ;
308313}
309314
315+ /**
316+ * Utilities for translating strings, formatting currencies, numbers,
317+ * and dates according to the buyer's locale. Use the I18n API alongside
318+ * the Localization API to build fully localized extensions.
319+ */
310320export interface I18n {
311321 /**
312322 * Returns a localized number.
@@ -389,6 +399,11 @@ export interface Market {
389399 handle : string ;
390400}
391401
402+ /**
403+ * The buyer's language, country, and locale context. Properties on this
404+ * interface are subscribable and update automatically when the buyer's
405+ * locale changes.
406+ */
392407export interface Localization {
393408 /**
394409 * The currency that the buyer sees for money amounts in the checkout. Use this value to format prices and totals in the buyer's expected currency.
@@ -539,7 +554,10 @@ export interface BuyerJourneyStep {
539554
540555export interface StandardApi < Target extends ExtensionTarget = ExtensionTarget > {
541556 /**
542- * The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
557+ * Methods for publishing custom events to [Web Pixels](https://shopify.dev/docs/apps/marketing) and
558+ * submitting visitor contact details to the shop backend. Use `publish()` to
559+ * emit events that web pixels can listen to, and `visitor()` to send buyer
560+ * contact information for attribution.
543561 */
544562 analytics : Analytics ;
545563
@@ -639,7 +657,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
639657 discountAllocations : SubscribableSignalLike < CartDiscountAllocation [ ] > ;
640658
641659 /**
642- * The meta information about the extension.
660+ * Metadata about the running extension, including the current target, API version,
661+ * granted capabilities, and editor context. Use this to check permissions, detect
662+ * the editor preview, or read the published version.
643663 */
644664 extension : Extension < Target > ;
645665
@@ -657,12 +677,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
657677 extensionPoint : Target ;
658678
659679 /**
660- * Utilities for translating content and formatting values according to the current
680+ * Utilities for translating strings, formatting currencies, numbers, and dates
681+ * according to the buyer's locale. Use alongside
661682 * [`localization`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization)
662- * of the checkout.
663- *
664- * Refer to [`localization` examples](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#examples)
665- * for more information.
683+ * to build fully localized extensions.
666684 */
667685 i18n : I18n ;
668686
@@ -672,10 +690,11 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
672690 lines : SubscribableSignalLike < CartLine [ ] > ;
673691
674692 /**
675- * The details about the location, language, and currency of the customer. For utilities to easily
676- * format and translate content based on these details, you can use the
693+ * The buyer's language, country, currency, market, and timezone context. Properties
694+ * are subscribable and update when the buyer changes their shipping address. For
695+ * formatting and translation helpers, use
677696 * [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
678- * object instead.
697+ * instead.
679698 */
680699 localization : Localization ;
681700
@@ -761,18 +780,21 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
761780 */
762781 billingAddress ?: SubscribableSignalLike < MailingAddress | undefined > ;
763782
764- /** The shop where the checkout is taking place. */
783+ /**
784+ * The store where the checkout is taking place, including the shop name,
785+ * primary domain, `.myshopify.com` subdomain, and globally-unique ID.
786+ * Use this to display store branding or route backend requests by shop.
787+ */
765788 shop : Shop ;
766789
767790 /**
768- * The key-value storage for the extension.
769- *
770- * It uses `localStorage` and should persist across the customer's current checkout session.
791+ * Key-value storage that persists across page loads within the current checkout
792+ * session. Use this to save dismissed states, form progress, or cached data
793+ * without a backend call. Data is shared across all activated extension targets
794+ * of this extension.
771795 *
772- * > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
773- *
774- * Data is shared across all activated extension targets of this extension. In versions 2023-07 and earlier,
775- * each activated extension target had its own storage.
796+ * > Caution: Data persistence isn't guaranteed. The storage backend uses
797+ * `localStorage` and is cleared when the buyer starts a new checkout.
776798 */
777799 storage : Storage ;
778800
@@ -803,6 +825,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
803825 localizedFields ?: SubscribableSignalLike < LocalizedField [ ] > ;
804826}
805827
828+ /**
829+ * Authenticates requests between your extension and your app backend.
830+ * Use session tokens to verify the identity of the customer and the shop
831+ * context when making server-side API calls. The token is a signed JWT
832+ * that contains claims such as the customer ID, shop domain, and expiration.
833+ */
806834export interface SessionToken {
807835 /**
808836 * Requests a session token that hasn't expired. You should call this method every
@@ -930,6 +958,10 @@ export interface AppliedGiftCard {
930958 balance : Money ;
931959}
932960
961+ /**
962+ * Read-only metadata about the merchant's store, including its name, primary
963+ * domain, `.myshopify.com` subdomain, and globally-unique ID.
964+ */
933965export interface Shop {
934966 /**
935967 * A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -1568,14 +1600,24 @@ export type ExtensionSettings = Record<
15681600 string | number | boolean | undefined
15691601> ;
15701602
1603+ /**
1604+ * Methods for interacting with Shopify's analytics framework. Use `publish()` to
1605+ * emit custom events that all registered [Web Pixels](https://shopify.dev/docs/apps/marketing) on
1606+ * the page can listen to, and `visitor()` to submit buyer contact details
1607+ * directly to the shop backend for attribution.
1608+ */
15711609export interface Analytics {
15721610 /**
1573- * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1611+ * Emits a custom event to all [Web Pixels](https://shopify.dev/docs/apps/marketing) registered
1612+ * on the page. The event isn't sent to the shop backend. Returns `true` when
1613+ * the event is successfully dispatched.
15741614 */
15751615 publish ( name : string , data : Record < string , unknown > ) : Promise < boolean > ;
15761616
15771617 /**
1578- * A method for capturing details about a visitor on the online store.
1618+ * Submits buyer contact details to the shop backend for attribution and
1619+ * analytics purposes. Unlike `publish()`, this data isn't forwarded to
1620+ * web pixels on the page.
15791621 */
15801622 visitor ( data : { email ?: string ; phone ?: string } ) : Promise < VisitorResult > ;
15811623}
0 commit comments