@shopify/ui-extensions 2024.4.0 → 2024.4.2

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.
Files changed (43) hide show
  1. package/build/cjs/surfaces/checkout/components/Sheet/Sheet.js +16 -0
  2. package/build/cjs/surfaces/checkout.js +2 -0
  3. package/build/esm/surfaces/checkout/components/Sheet/Sheet.mjs +12 -0
  4. package/build/esm/surfaces/checkout.mjs +1 -0
  5. package/build/esnext/surfaces/checkout/components/Sheet/Sheet.esnext +12 -0
  6. package/build/esnext/surfaces/checkout.esnext +1 -0
  7. package/build/ts/surfaces/checkout/api/address-autocomplete/format-suggestion.d.ts +20 -0
  8. package/build/ts/surfaces/checkout/api/address-autocomplete/format-suggestion.d.ts.map +1 -0
  9. package/build/ts/surfaces/checkout/api/address-autocomplete/shared.d.ts +51 -0
  10. package/build/ts/surfaces/checkout/api/address-autocomplete/shared.d.ts.map +1 -0
  11. package/build/ts/surfaces/checkout/api/address-autocomplete/standard.d.ts +236 -0
  12. package/build/ts/surfaces/checkout/api/address-autocomplete/standard.d.ts.map +1 -0
  13. package/build/ts/surfaces/checkout/api/address-autocomplete/suggest.d.ts +56 -0
  14. package/build/ts/surfaces/checkout/api/address-autocomplete/suggest.d.ts.map +1 -0
  15. package/build/ts/surfaces/checkout/api/checkout/checkout.d.ts +1 -1
  16. package/build/ts/surfaces/checkout/api/standard/standard.d.ts +126 -51
  17. package/build/ts/surfaces/checkout/api/standard/standard.d.ts.map +1 -1
  18. package/build/ts/surfaces/checkout/components/Sheet/Sheet.d.ts +55 -0
  19. package/build/ts/surfaces/checkout/components/Sheet/Sheet.d.ts.map +1 -0
  20. package/build/ts/surfaces/checkout/components/Sheet/Sheet.doc.d.ts +4 -0
  21. package/build/ts/surfaces/checkout/components/Sheet/Sheet.doc.d.ts.map +1 -0
  22. package/build/ts/surfaces/checkout/components.d.ts +2 -0
  23. package/build/ts/surfaces/checkout/components.d.ts.map +1 -1
  24. package/build/ts/surfaces/checkout/helper.docs.d.ts.map +1 -1
  25. package/build/ts/surfaces/checkout/targets.d.ts +22 -8
  26. package/build/ts/surfaces/checkout/targets.d.ts.map +1 -1
  27. package/build/ts/surfaces/checkout.d.ts +5 -2
  28. package/build/ts/surfaces/checkout.d.ts.map +1 -1
  29. package/build/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +1 -1
  31. package/src/surfaces/checkout/api/address-autocomplete/format-suggestion.ts +24 -0
  32. package/src/surfaces/checkout/api/address-autocomplete/shared.ts +59 -0
  33. package/src/surfaces/checkout/api/address-autocomplete/standard.ts +289 -0
  34. package/src/surfaces/checkout/api/address-autocomplete/suggest.ts +61 -0
  35. package/src/surfaces/checkout/api/checkout/checkout.ts +1 -1
  36. package/src/surfaces/checkout/api/standard/standard.ts +128 -51
  37. package/src/surfaces/checkout/components/Sheet/Sheet.doc.ts +69 -0
  38. package/src/surfaces/checkout/components/Sheet/Sheet.ts +56 -0
  39. package/src/surfaces/checkout/components/Sheet/examples/basic-sheet.example.ts +29 -0
  40. package/src/surfaces/checkout/components.ts +3 -0
  41. package/src/surfaces/checkout/helper.docs.ts +39 -0
  42. package/src/surfaces/checkout/targets.ts +31 -9
  43. package/src/surfaces/checkout.ts +18 -2
@@ -72,7 +72,7 @@ export type Capability =
72
72
  | 'collect_buyer_consent.customer_privacy';
73
73
 
74
74
  /**
75
- * Meta information about an extension target.
75
+ * The meta information about an extension target.
76
76
  */
77
77
  export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
78
78
  /**
@@ -90,31 +90,31 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
90
90
  *
91
91
  * * [`network_access`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access): the extension can make external network calls.
92
92
  *
93
- * * [`block_progress`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#block-progress): the extension can block a buyer's progress and the merchant has allowed this blocking behavior.
93
+ * * [`block_progress`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#block-progress): the extension can block a customer's progress and the merchant has allowed this blocking behavior.
94
94
  *
95
- * * [`collect_buyer_consent.sms_marketing`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can collect buyer consent for SMS marketing.
95
+ * * [`collect_buyer_consent.sms_marketing`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can collect customer consent for SMS marketing.
96
96
  *
97
- * * [`collect_buyer_consent.customer_privacy`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can register buyer consent decisions that will be honored on Shopify-managed services.
97
+ * * [`collect_buyer_consent.customer_privacy`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can register customer consent decisions that will be honored on Shopify-managed services.
98
98
  */
99
99
  capabilities: StatefulRemoteSubscribable<Capability[]>;
100
100
 
101
101
  /**
102
102
  * Information about the editor where the extension is being rendered.
103
103
  *
104
- * The value is undefined if the extension is not rendering in an editor.
104
+ * If the value is undefined, then the extension is not running in an editor.
105
105
  */
106
106
  editor?: Editor;
107
107
 
108
108
  /**
109
- * Whether your extension is currently rendered to the screen.
109
+ * A Boolean to show whether your extension is currently rendered to the screen.
110
110
  *
111
111
  * Shopify might render your extension before it's visible in the UI,
112
112
  * typically to pre-render extensions that will appear on a later step of the
113
113
  * checkout.
114
114
  *
115
- * Your extension might also continue to run after the buyer has navigated away
115
+ * Your extension might also continue to run after the customer has navigated away
116
116
  * from where it was rendered. The extension continues running so that
117
- * your extension is immediately available to render if the buyer navigates back.
117
+ * your extension is immediately available to render if the customer navigates back.
118
118
  */
119
119
  rendered: StatefulRemoteSubscribable<boolean>;
120
120
 
@@ -368,7 +368,7 @@ export interface Market {
368
368
 
369
369
  export interface Localization {
370
370
  /**
371
- * The currency that the buyer sees for money amounts in the checkout.
371
+ * The currency that the customer sees for money amounts in the checkout.
372
372
  */
373
373
  currency: StatefulRemoteSubscribable<Currency>;
374
374
 
@@ -378,19 +378,19 @@ export interface Localization {
378
378
  timezone: StatefulRemoteSubscribable<Timezone>;
379
379
 
380
380
  /**
381
- * The language the buyer sees in the checkout.
381
+ * The language the customer sees in the checkout.
382
382
  */
383
383
  language: StatefulRemoteSubscribable<Language>;
384
384
 
385
385
  /**
386
- * This is the buyer's language, as supported by the extension.
387
- * If the buyer's actual language is not supported by the extension,
388
- * this is the fallback locale used for translations.
386
+ * This is the customer's language, as supported by the extension.
387
+ * If the customer's actual language is not supported by the extension,
388
+ * then this is the language that is used for translations.
389
389
  *
390
- * For example, if the buyer's language is 'fr-CA' but your extension
390
+ * For example, if the customer's language is 'fr-CA' but your extension
391
391
  * only supports translations for 'fr', then the `isoCode` for this
392
392
  * language is 'fr'. If your extension does not provide french
393
- * translations at all, this value is the default locale for your
393
+ * translations at all, then this value is the default locale for your
394
394
  * extension (that is, the one matching your .default.json file).
395
395
  */
396
396
  extensionLanguage: StatefulRemoteSubscribable<Language>;
@@ -399,7 +399,7 @@ export interface Localization {
399
399
  * The country context of the checkout. This value carries over from the
400
400
  * context of the cart, where it was used to contextualize the storefront
401
401
  * experience. It will update if the buyer changes the country of their
402
- * shipping address. The value is undefined if unknown.
402
+ * shipping address. If the country is unknown, then the value is undefined.
403
403
  */
404
404
  country: StatefulRemoteSubscribable<Country | undefined>;
405
405
 
@@ -407,8 +407,8 @@ export interface Localization {
407
407
  * The [market](https://shopify.dev/docs/apps/markets) context of the
408
408
  * checkout. This value carries over from the context of the cart, where it
409
409
  * was used to contextualize the storefront experience. It will update if the
410
- * buyer changes the country of their shipping address. The value is undefined
411
- * if unknown.
410
+ * buyer changes the country of their shipping address. If the market is unknown,
411
+ * then the value is undefined.
412
412
  */
413
413
  market: StatefulRemoteSubscribable<Market | undefined>;
414
414
  }
@@ -500,7 +500,7 @@ export interface BuyerJourneyStep {
500
500
 
501
501
  export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
502
502
  /**
503
- * Methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
503
+ * The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
504
504
  */
505
505
  analytics: Analytics;
506
506
 
@@ -523,7 +523,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
523
523
  appMetafields: StatefulRemoteSubscribable<AppMetafieldEntry[]>;
524
524
 
525
525
  /**
526
- * Custom attributes left by the customer to the merchant, either in their cart or during checkout.
526
+ * The custom attributes left by the customer to the merchant, either in their cart or during checkout.
527
527
  */
528
528
  attributes: StatefulRemoteSubscribable<Attribute[] | undefined>;
529
529
 
@@ -542,7 +542,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
542
542
  /**
543
543
  * Provides details on the buyer's progression through the checkout.
544
544
  *
545
- * See [buyer journey](https://shopify.dev/docs/api/checkout-ui-extensions/apis/buyer-journey#examples)
545
+ * Refer to [buyer journey](https://shopify.dev/docs/api/checkout-ui-extensions/apis/buyer-journey#examples)
546
546
  * examples for more information.
547
547
  */
548
548
  buyerJourney: BuyerJourney;
@@ -553,10 +553,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
553
553
  checkoutSettings: StatefulRemoteSubscribable<CheckoutSettings>;
554
554
 
555
555
  /**
556
- * A stable id that represents the current checkout.
556
+ * A stable ID that represents the current checkout.
557
557
  *
558
558
  * Matches the `token` field in the [WebPixel checkout payload](https://shopify.dev/docs/api/pixels/customer-events#checkout)
559
- * and the `checkout_token` field in the [Admin REST API Order resource](https://shopify.dev/docs/api/admin-rest/unstable/resources/order#resource-object).
559
+ * and the `checkout_token` field in the [REST Admin API `Order` resource](https://shopify.dev/docs/api/admin-rest/unstable/resources/order#resource-object).
560
560
  */
561
561
  checkoutToken: StatefulRemoteSubscribable<CheckoutToken | undefined>;
562
562
 
@@ -581,7 +581,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
581
581
  discountAllocations: StatefulRemoteSubscribable<CartDiscountAllocation[]>;
582
582
 
583
583
  /**
584
- * Meta information about the extension.
584
+ * The meta information about the extension.
585
585
  */
586
586
  extension: Extension<Target>;
587
587
 
@@ -603,7 +603,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
603
603
  * [`localization`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization)
604
604
  * of the checkout.
605
605
  *
606
- * See [localization examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization#examples)
606
+ * Refer to [`localization` examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization#examples)
607
607
  * for more information.
608
608
  */
609
609
  i18n: I18n;
@@ -614,7 +614,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
614
614
  lines: StatefulRemoteSubscribable<CartLine[]>;
615
615
 
616
616
  /**
617
- * Details about the location, language, and currency of the buyer. For utilities to easily
617
+ * The details about the location, language, and currency of the customer. For utilities to easily
618
618
  * format and translate content based on these details, you can use the
619
619
  * [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization#standardapi-propertydetail-i18n)
620
620
  * object instead.
@@ -640,9 +640,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
640
640
  note: StatefulRemoteSubscribable<string | undefined>;
641
641
 
642
642
  /**
643
- * Used to query the Storefront GraphQL API with a prefetched token.
643
+ * The method used to query the Storefront GraphQL API with a prefetched token.
644
644
  *
645
- * See [storefront api access examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/storefront-api) for more information.
645
+ * Refer to [Storefront API access examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/storefront-api) for more information.
646
646
  */
647
647
  query: <Data = unknown, Variables = Record<string, unknown>>(
648
648
  query: string,
@@ -655,9 +655,13 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
655
655
  selectedPaymentOptions: StatefulRemoteSubscribable<SelectedPaymentOption[]>;
656
656
 
657
657
  /**
658
- * Provides access to session tokens, which can be used to verify token claims on your app's server.
658
+ * The session token providing a set of claims as a signed JSON Web Token (JWT).
659
659
  *
660
- * See [session token examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/session-token) for more information.
660
+ * The token has a TTL of 5 minutes.
661
+ *
662
+ * If the previous token expires, this value will reflect a new session token with a new signature and expiry.
663
+ *
664
+ * Refer to [session token examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/session-token) for more information.
661
665
  */
662
666
  sessionToken: SessionToken;
663
667
 
@@ -665,7 +669,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
665
669
  * The settings matching the settings definition written in the
666
670
  * [`shopify.extension.toml`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) file.
667
671
  *
668
- * See [settings examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/settings) for more information.
672
+ * Refer to [settings examples](https://shopify.dev/docs/api/checkout-ui-extensions/apis/settings#examples) for more information.
669
673
  *
670
674
  * > Note: When an extension is being installed in the editor, the settings will be empty until
671
675
  * a merchant sets a value. In that case, this object will be updated in real time as a merchant fills in the settings.
@@ -673,7 +677,7 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
673
677
  settings: StatefulRemoteSubscribable<ExtensionSettings>;
674
678
 
675
679
  /**
676
- * The proposed buyer shipping address. During the information step, the address
680
+ * The proposed customer shipping address. During the information step, the address
677
681
  * updates when the field is committed (on change) rather than every keystroke.
678
682
  * An address value is only present if delivery is required. Otherwise, the
679
683
  * subscribable value is undefined.
@@ -683,22 +687,24 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
683
687
  shippingAddress?: StatefulRemoteSubscribable<MailingAddress | undefined>;
684
688
 
685
689
  /**
686
- * The proposed buyer billing address. The address updates when the field is
690
+ * The proposed customer billing address. The address updates when the field is
687
691
  * committed (on change) rather than every keystroke.
688
692
  *
689
693
  * {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
690
694
  */
691
695
  billingAddress?: StatefulRemoteSubscribable<MailingAddress | undefined>;
692
696
 
693
- /** Shop where the checkout is taking place. */
697
+ /** The shop where the checkout is taking place. */
694
698
  shop: Shop;
695
699
 
696
700
  /**
697
- * Key-value storage for the extension.
698
- * Uses `localStorage` and should persist across the buyer's current checkout session.
699
- * However, data persistence isn't guaranteed and storage is reset when the buyer starts a new checkout.
701
+ * The key-value storage for the extension.
702
+ *
703
+ * It uses `localStorage` and should persist across the customer's current checkout session.
700
704
  *
701
- * Data is shared across all activated extension targets of this extension. In versions `<=2023-07`,
705
+ * > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
706
+ *
707
+ * Data is shared across all activated extension targets of this extension. In versions 2023-07 and earlier,
702
708
  * each activated extension target had its own storage.
703
709
  */
704
710
  storage: Storage;
@@ -716,12 +722,16 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
716
722
  version: Version;
717
723
 
718
724
  /**
719
- * Customer cookie consent settings and a flag denoting if consent has previously been collected.
725
+ * Customer privacy consent settings and a flag denoting if consent has previously been collected.
720
726
  */
721
727
  customerPrivacy: StatefulRemoteSubscribable<CustomerPrivacy>;
722
728
 
723
729
  /**
724
- * Allows setting and updating customer cookie consent settings.
730
+ * Allows setting and updating customer privacy consent settings and tracking consent metafields.
731
+ *
732
+ * > Note: Requires the [`customer_privacy` capability](https://shopify.dev/docs/api/checkout-ui-extensions/unstable/configuration#collect-buyer-consent) to be set to `true`.
733
+ *
734
+ * {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
725
735
  */
726
736
  applyTrackingConsentChange: ApplyTrackingConsentChangeType;
727
737
  }
@@ -778,7 +788,7 @@ export interface BuyerIdentity {
778
788
  }
779
789
 
780
790
  /**
781
- * Information about a company that the business customer is purchasing on behalf of.
791
+ * The information about a company that the business customer is purchasing on behalf of.
782
792
  */
783
793
  export interface PurchasingCompany {
784
794
  /**
@@ -1149,7 +1159,7 @@ export interface SelectedPaymentOption {
1149
1159
  /**
1150
1160
  * The unique handle referencing `PaymentOption.handle`.
1151
1161
  *
1152
- * See [availablePaymentOptions](https://shopify.dev/docs/api/checkout-ui-extensions/apis/payments#standardapi-propertydetail-availablepaymentoptions).
1162
+ * Refer to [availablePaymentOptions](https://shopify.dev/docs/api/checkout-ui-extensions/apis/payments#standardapi-propertydetail-availablepaymentoptions).
1153
1163
  */
1154
1164
  handle: string;
1155
1165
  }
@@ -1413,7 +1423,7 @@ export interface PaymentTermsTemplate {
1413
1423
  */
1414
1424
  id: string;
1415
1425
  /**
1416
- * The name of the payment terms translated to the buyer's current language. See [localization.language](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization#standardapi-propertydetail-localization).
1426
+ * The name of the payment terms translated to the buyer's current language. Refer to [localization.language](https://shopify.dev/docs/api/checkout-ui-extensions/apis/localization#standardapi-propertydetail-localization).
1417
1427
  */
1418
1428
  name: string;
1419
1429
  /**
@@ -1734,28 +1744,81 @@ export interface DeliveryGroupDetails extends DeliveryGroup {
1734
1744
  targetedCartLines: CartLine[];
1735
1745
  }
1736
1746
 
1747
+ export interface AllowedProcessing {
1748
+ /**
1749
+ * Can collect customer analytics about how the shop was used and interactions made on the shop.
1750
+ */
1751
+ analytics: boolean;
1752
+ /**
1753
+ * Can collect customer preference for marketing, attribution and targeted advertising from the merchant.
1754
+ */
1755
+ marketing: boolean;
1756
+ /**
1757
+ * Can collect customer preferences such as language, currency, size, and more.
1758
+ */
1759
+ preferences: boolean;
1760
+ /**
1761
+ * Can collect customer preference for sharing data with third parties, usually for behavioral advertising.
1762
+ */
1763
+ saleOfData: boolean;
1764
+ }
1765
+
1737
1766
  export interface VisitorConsent {
1738
1767
  /**
1739
- * Cookies to understand how customers interact with the site.
1768
+ * Visitor consents to recording data to understand how customers interact with the site.
1740
1769
  */
1741
1770
  analytics?: boolean;
1742
1771
  /**
1743
- * Cookies to provide ads and marketing communications based on customer interests.
1772
+ * Visitor consents to ads and marketing communications based on customer interests.
1744
1773
  */
1745
1774
  marketing?: boolean;
1746
1775
  /**
1747
- * Cookies that remember customer preferences, such as country or language, to personalize visits to the website.
1776
+ * Visitor consent to remembering customer preferences, such as country or language, to personalize visits to the website.
1748
1777
  */
1749
1778
  preferences?: boolean;
1750
1779
  /**
1751
- * Opts the customer out of data sharing / sales.
1780
+ * Opts the visitor out of data sharing / sales.
1752
1781
  */
1753
1782
  saleOfData?: boolean;
1754
1783
  }
1755
1784
 
1756
- type PartialVisitorConsent = Partial<VisitorConsent>;
1785
+ export interface TrackingConsentMetafield {
1786
+ /**
1787
+ * The name of the metafield. It must be between 3 and 30 characters in
1788
+ * length (inclusive).
1789
+ */
1790
+ key: string;
1791
+ /**
1792
+ * The information to be stored as metadata.
1793
+ *
1794
+ * @example 'any string', '', or a stringified JSON object
1795
+ */
1796
+ value: string;
1797
+ }
1798
+
1799
+ export interface TrackingConsentMetafieldChange {
1800
+ /**
1801
+ * The name of the metafield. It must be between 3 and 30 characters in
1802
+ * length (inclusive).
1803
+ */
1804
+ key: string;
1805
+ /**
1806
+ * The information to be stored as metadata. If the value is `null`, the metafield will be deleted.
1807
+ *
1808
+ * @example 'any string', `null`, or a stringified JSON object
1809
+ */
1810
+ value: string | null;
1811
+ }
1757
1812
 
1758
- export interface VisitorConsentChange extends PartialVisitorConsent {
1813
+ export interface VisitorConsentChange extends VisitorConsent {
1814
+ /**
1815
+ * Tracking consent metafield data to be saved.
1816
+ *
1817
+ * If the value is `null`, the metafield will be deleted.
1818
+ *
1819
+ * @example `[{key: 'granularAnalytics', value: 'true'}, {key: 'granularMarketing', value: 'false'}]`
1820
+ */
1821
+ metafields?: TrackingConsentMetafieldChange[];
1759
1822
  type: 'changeVisitorConsent';
1760
1823
  }
1761
1824
 
@@ -1786,11 +1849,25 @@ export interface CustomerPrivacyRegion {
1786
1849
 
1787
1850
  export interface CustomerPrivacy {
1788
1851
  /**
1789
- * An object containing the customer's current cookie consent settings.
1852
+ * An object containing flags for each consent property denoting whether they can be processed based on visitor consent, merchant configuration, and user location.
1853
+ */
1854
+ allowedProcessing: AllowedProcessing;
1855
+ /**
1856
+ * Stored tracking consent metafield data.
1857
+ *
1858
+ * @example `[{key: 'analyticsType', value: 'granular'}, {key: 'marketingType', value: 'granular'}]`, or `[]`
1859
+ */
1860
+ metafields: TrackingConsentMetafield[];
1861
+ /**
1862
+ * An object containing the customer's current privacy consent settings.
1863
+ * *
1864
+ * @example `true` — the customer has actively granted consent, `false` — the customer has actively denied consent, or `undefined` — the customer has not yet made a decision.
1790
1865
  */
1791
1866
  visitorConsent: VisitorConsent;
1792
1867
  /**
1793
- * Whether a consent banner should be displayed.
1868
+ * Whether a consent banner should be displayed by default when the page loads. Use this as the initial open/expanded state of the consent banner.
1869
+ *
1870
+ * This is determined by the visitor's current privacy consent, the shop's [region visibility configuration](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings#add-a-cookie-banner) settings, and the region in which the visitor is located.
1794
1871
  */
1795
1872
  shouldShowBanner: boolean;
1796
1873
  /**
@@ -0,0 +1,69 @@
1
+ import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
2
+
3
+ import {getExample} from '../../helper.docs';
4
+
5
+ const data: ReferenceEntityTemplateSchema = {
6
+ name: 'Sheet',
7
+ description:
8
+ 'The Sheet component displays essential information for customers at the bottom of the screen, appearing above other elements. Use it sparingly to avoid distracting customers during checkout. This component requires access to [Customer Privacy API](/docs/api/checkout-ui-extensions/unstable/configuration#collect-buyer-consent) to be rendered. \n\nThe library automatically applies the [WAI-ARIA Dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/) to both the activator and the sheet content.',
9
+ requires:
10
+ 'configuration of the [Customer Privacy](/docs/api/checkout-ui-extensions/unstable/configuration#collect-buyer-consent) capability to be rendered.',
11
+ thumbnail: 'sheet-thumbnail.png',
12
+ isVisualComponent: true,
13
+ type: '',
14
+ definitions: [
15
+ {
16
+ title: 'SheetProps',
17
+ description: '',
18
+ type: 'SheetProps',
19
+ },
20
+ ],
21
+ category: 'Components',
22
+ subCategory: 'Overlays',
23
+ defaultExample: {
24
+ image: 'sheet-default.png',
25
+ codeblock: {
26
+ title: 'Basic Sheet',
27
+ tabs: [
28
+ {
29
+ title: 'React',
30
+ code: '../../../../../../ui-extensions-react/src/surfaces/checkout/components/Sheet/examples/basic-sheet.example.tsx',
31
+ language: 'tsx',
32
+ },
33
+ {
34
+ title: 'JS',
35
+ code: './examples/basic-sheet.example.ts',
36
+ language: 'js',
37
+ },
38
+ ],
39
+ },
40
+ },
41
+ subSections: [
42
+ {
43
+ type: 'Generic',
44
+ anchorLink: 'shopify-controlled-surfaces',
45
+ title: 'Shopify-controlled surfaces',
46
+ sectionContent:
47
+ 'To prevent disruptions during checkout, we maintain strict design control over key areas of the Sheet component. These Shopify-controlled elements include: \n\n<h3>Locations of elements</h3>\n\nThe Sheet elements (header, content, action buttons, and dismiss button) are strategically positioned and sized to present vital information upfront.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces1.png" />\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces2.png" />\n\n<br>\n\n<h3>Padding and spacing</h3>\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces3.png" />\n\n<br>\n\n<h3>Maximum height</h3>\n\nTo balance customer attention and task completion, a maximum height is set for the Sheet component.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces4.png" />\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces5.png" />\n\nWhen content pushes the sheet to exceed this limit, the following UI behaviors are triggered:\n\n<br>\n\n<h3>Heading and content are scrollable</h3>\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces6.png" />\n\n<br>\n\n<h3>Expand pill appears to allow customers to view the entire content</h3>\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces7.png" />\n\n<br>\n\n<h3>Actions slot and dismiss button remain fixed</h3>\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-controlled-surfaces8.png" />',
48
+ },
49
+ {
50
+ type: 'Generic',
51
+ anchorLink: 'privacy-consent-requirements',
52
+ title: 'Privacy consent requirements',
53
+ sectionContent:
54
+ '<h3>Content</h3>\n\nFor the best customer experience, ensure content is brief and to the point.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations1.png" />\n\nVarious strategies can be employed to avoid content scrolling.\n\n<br>\n\n<h4>Use short content</h4>\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations2.png" />\n\n<br>\n\n<h4>Use small text size</h4>\n\n <img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations3.png" />\n\n<br>\n\n<h4>Remove the header</h4>\n\n <img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations4.png" />\n\n<br>\n\n<h3>Actions slot</h3>\n\nThe actions slots allows customers to make decisions and is split into primary and secondary sections.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations5.png" />\n\n<br>\n\n<h3>Primary section</h3>\n\n Contains primary actions for customer decisions on the sheet’s prompt. Up to two buttons are allowed. Keep the button’s content brief so that it doesn’t wrap to more than one line.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations6.png" />\n\n<br>\n\n<h3>Secondary section</h3>\n\nContains action that is unrelated to the sheet’s prompt. Only one button is allowed. A modal can be activated when engaging with the secondary action. Keep the button’s content brief so that it doesn’t wrap to more than one line.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations7.png" />\n\n<br>\n\n<h3>Consent, denial of consent, and sheet dismissal</h3>\n\n <h4>Consent</h4>\n\nWhen a customer expresses consent by pressing the acceptance button, cookies will load and the sheet should not re-appear on refresh.\n\n<br>\n\n<h4>Denial of consent</h4>\n\nWhen a customer expresses denial of consent by pressing the rejection button, cookies will not load and the sheet will not re-appear on refresh.\n\n<br>\n\n<h4>Sheet dismissal</h4>\n\nWhen a customer neither grants nor denies consent by pressing the dismiss button, cookies will not load and the sheet will re-appear on refresh.\n\n<img src="/assets/landing-pages/templated-apis/checkout-ui-extensions/ui-components/sheet-content-recommendations8.png" />',
55
+ },
56
+ ],
57
+ examples: {
58
+ description: '',
59
+ examples: [
60
+ getExample('ui-components/sheet-consent', ['jsx', 'js']),
61
+ getExample('ui-components/sheet-description-preferences', ['jsx', 'js']),
62
+ getExample('ui-components/sheet-icon-button-preferences', ['jsx', 'js']),
63
+ getExample('ui-components/sheet-layout-content', ['jsx', 'js']),
64
+ ],
65
+ },
66
+ related: [],
67
+ };
68
+
69
+ export default data;
@@ -0,0 +1,56 @@
1
+ import type {RemoteFragment} from '@remote-ui/core';
2
+ import {createRemoteComponent} from '@remote-ui/core';
3
+
4
+ import type {IdProps} from '../shared';
5
+
6
+ export interface SheetProps extends IdProps {
7
+ /**
8
+ * A label to describe the purpose of the sheet that is announced by screen readers.
9
+ * If not set, it will use the value of `heading`.
10
+ */
11
+ accessibilityLabel?: string;
12
+
13
+ /**
14
+ * Indicates whether the sheet should be open by default.
15
+ *
16
+ * This property is necessary in some cases, but its usage is generally discouraged due to potential negative impacts on user experience.
17
+ *
18
+ * Developers should:
19
+ * - Only set this property to true when there are vitally important behaviors of the application that depend on the user interacting with the sheet.
20
+ * - Make every effort to conditionally hide the sheet based on the state of checkout. An explicit example is custom privacy consent, where the sheet should only be displayed when consent is necessary and has not yet been explicitly given by the user.
21
+ *
22
+ * This property is useful for when the Sheet needs to be rendered on the page load and not triggered by a user action.
23
+ * The property should only take effect when the `Sheet` is rendered for the first time.
24
+ */
25
+ defaultOpen?: boolean;
26
+
27
+ /** A heading rendered at the top of the sheet. */
28
+ heading?: string;
29
+
30
+ /** Callback fired when the sheet is opened. */
31
+ onShow?(): void;
32
+
33
+ /** Callback fired when the sheet is closed. */
34
+ onHide?(): void;
35
+
36
+ /**
37
+ * The primary action to perform, provided as a `Button` component.
38
+ * The property allows up to two buttons to be rendered.
39
+ */
40
+ primaryAction?: RemoteFragment;
41
+
42
+ /**
43
+ * The secondary action to perform, provided as a `Button` component.
44
+ * The property allows only one button to be rendered.
45
+ */
46
+ secondaryAction?: RemoteFragment;
47
+ }
48
+
49
+ /**
50
+ * Sheet is designed to be used on top of other elements in a user interface and is typically bound to the bottom of a page.
51
+ * Sheet can contain and display various types of content such as forms, or informational messages.
52
+ * Unlike a Modal, which interrupts user flow, a Sheet offers a less intrusive, fluid experience.
53
+ *
54
+ * The library automatically applies the [WAI-ARIA Dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/) to both the activator and the sheet content.
55
+ */
56
+ export const Sheet = createRemoteComponent<'Sheet', SheetProps>('Sheet');
@@ -0,0 +1,29 @@
1
+ import {
2
+ extension,
3
+ Link,
4
+ Sheet,
5
+ TextBlock,
6
+ } from '@shopify/ui-extensions/checkout';
7
+
8
+ // This component requires access to Customer Privacy API to be rendered.
9
+
10
+ export default extension('purchase.checkout.block.render', (root) => {
11
+ const sheetFragment = root.createFragment();
12
+ const sheet = root.createComponent(
13
+ Sheet,
14
+ {
15
+ id: 'basic-sheet',
16
+ heading: 'Basic Sheet',
17
+ accessibilityLabel: 'A sheet with text content',
18
+ },
19
+ [root.createComponent(TextBlock, undefined, 'Basic Sheet Content')],
20
+ );
21
+ sheetFragment.appendChild(sheet);
22
+ const link = root.createComponent(
23
+ Link,
24
+ {overlay: sheetFragment},
25
+ 'Open sheet',
26
+ );
27
+
28
+ root.appendChild(link);
29
+ });
@@ -140,6 +140,9 @@ export type {
140
140
  export {Select} from './components/Select/Select';
141
141
  export type {SelectProps, SelectOptionProps} from './components/Select/Select';
142
142
 
143
+ export {Sheet} from './components/Sheet/Sheet';
144
+ export type {SheetProps} from './components/Sheet/Sheet';
145
+
143
146
  export {SkeletonImage} from './components/SkeletonImage/SkeletonImage';
144
147
  export type {SkeletonImageProps} from './components/SkeletonImage/SkeletonImage';
145
148
 
@@ -110,6 +110,45 @@ export function getExamples(
110
110
  tabs: getExtensionCodeTabs('ui-components/choicelist-time-picking'),
111
111
  },
112
112
  },
113
+ 'ui-components/sheet-consent': {
114
+ description:
115
+ 'The Sheet component can be used to display privacy consent preferences in the Checkout interface. Sheet can be defaulted to open for this use case.\n\n This component requires access to [Customer Privacy API](/docs/api/checkout-ui-extensions/unstable/apis/customer-privacy) to be rendered.',
116
+ codeblock: {
117
+ title: 'Using Sheet to display consent preferences',
118
+ tabs: getExtensionCodeTabs('ui-components/sheet-consent'),
119
+ },
120
+ },
121
+ 'ui-components/sheet-description-preferences': {
122
+ description:
123
+ 'In order to save space in the action slot, secondary actions can be placed in the content area.',
124
+ image: 'sheet-description-preferences.png',
125
+ codeblock: {
126
+ title: 'Preferences button is in the description as a link',
127
+ tabs: getExtensionCodeTabs(
128
+ 'ui-components/sheet-description-preferences',
129
+ ),
130
+ },
131
+ },
132
+ 'ui-components/sheet-layout-content': {
133
+ description:
134
+ 'The description can take in layout components to allow for different types of content to be structured in specific ways.',
135
+ image: 'sheet-layout-content.png',
136
+ codeblock: {
137
+ title: 'Using layout component in the description ',
138
+ tabs: getExtensionCodeTabs('ui-components/sheet-layout-content'),
139
+ },
140
+ },
141
+ 'ui-components/sheet-icon-button-preferences': {
142
+ description:
143
+ 'An icon button can be used in the secondary actions area to allow for more space for the primary actions.',
144
+ image: 'sheet-icon-button-preferences.png',
145
+ codeblock: {
146
+ title: 'Icon button used for preferences',
147
+ tabs: getExtensionCodeTabs(
148
+ 'ui-components/sheet-icon-button-preferences',
149
+ ),
150
+ },
151
+ },
113
152
  };
114
153
  }
115
154