@fanfare-io/fanfare-sdk-shopify 0.18.0 → 0.20.0

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 (2) hide show
  1. package/README.md +24 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -95,6 +95,30 @@ function ProductPage({ product }: { product: { handle: string; id: string } }) {
95
95
 
96
96
  Pass onResolutionError={(error) => report(error)} to observe failed resolutions yourself; error.lookupKey is the product handle or id and error.reason is one of "network" | "http" | "malformed" | "unavailable" | "override". Without it the provider logs one console.warn per product and reason to the developer console — nothing is reported to Fanfare. Supplying a handler replaces that fallback. Separately, a request to an absolute proxy base that fails before a response gets one advisory per base naming the host and the configuration to check; that advisory is emitted by the resolver whether or not a handler is supplied, and the provider does not repeat it as a per-product warning.
97
97
 
98
+ ## Checkout identity from widget details
99
+
100
+ React's `ExperienceWidget.onCheckoutClick` receives optional
101
+ `SelectionCheckoutDetails`. When present, its product and variant are the catalogue
102
+ objects for the committed Fanfare pair, not necessarily the current PDP's pair.
103
+
104
+ For Shopify checkout, use `details.product.externalReference.id` as
105
+ `gatedLine.shopifyProductId` and `details.variant.externalReference.id` as
106
+ `gatedLine.merchandiseId`, through the existing `productGid` and `variantGid` helpers.
107
+ First require both references, `provider === "shopify"`, and the appropriate complete
108
+ Product/ProductVariant GID shapes. Those helpers normalize IDs; they are not substitutes
109
+ for validating an optional external reference. Reject missing or invalid identity
110
+ before calling `gatedCheckout`.
111
+
112
+ Do not reconstruct identity from handles, SKUs, option labels, or a local variant list.
113
+ A Shopify default variant has `optionValues: []` but still has a variant reference.
114
+ The same checkout call applies to fixed, consumer-selected, and system-assigned pairs.
115
+ The cart adapter still owns Storefront API calls; `gatedCheckout` still owns the
116
+ create-cart → claim → add-line ordering and returns the checkout result.
117
+
118
+ This requires a backend and SDK that retain external references. SDK 0.19.0 strips
119
+ the fields. Details remain optional while the catalogue is unavailable or when no
120
+ catalogue pair can be resolved; this change does not redesign catalogue readiness.
121
+
98
122
  ## Modes: `production` (default) vs `demo`
99
123
 
100
124
  `mode` defaults to `"production"`: real verify + claim through the Fanfare
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanfare-io/fanfare-sdk-shopify",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Shopify storefront adapter for Fanfare SDK: product→experience resolver, checkout verifier, and experienceIds metafield primitives",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -46,7 +46,7 @@
46
46
  "peerDependencies": {
47
47
  "react": "^18.0.0 || ^19.1.1",
48
48
  "react-dom": "^18.0.0 || ^19.1.1",
49
- "@fanfare-io/fanfare-sdk-core": "0.18.0"
49
+ "@fanfare-io/fanfare-sdk-core": "0.20.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "react": {
@@ -75,7 +75,7 @@
75
75
  "vite-plugin-dts": "^4.5.4",
76
76
  "vite-tsconfig-paths": "^5.1.4",
77
77
  "vitest": "^5.0.0",
78
- "@fanfare-io/fanfare-sdk-core": "0.18.0"
78
+ "@fanfare-io/fanfare-sdk-core": "0.20.0"
79
79
  },
80
80
  "sideEffects": false,
81
81
  "keywords": [