@kizlo/woocommerce 0.11.0 → 0.13.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.
package/README.md CHANGED
@@ -44,7 +44,7 @@ See the [docs](https://kizlo.io/docs) for setup and usage.
44
44
 
45
45
  ## Billing Tax IDs
46
46
 
47
- Billing addresses expose `taxId` on customers, carts, checkout responses, and orders. The field is always a string on output and defaults to `""` when it has not been set. Billing address inputs accept an optional `taxId`; shipping addresses never expose or persist one.
47
+ Billing addresses expose `taxId` on customers, carts, checkout responses, and orders. The field is always a string on output and defaults to `""` when it has not been set. Billing address inputs accept an optional `taxId`; shipping addresses have no native `taxId`, and Kizlo discards managed shipping copies independently of the hidden UI rule.
48
48
 
49
49
  ```ts
50
50
  await kizlo.woocommerce.cart.update.call({
@@ -54,6 +54,16 @@ await kizlo.woocommerce.cart.update.call({
54
54
 
55
55
  Store administrators can make the field mandatory from **WooCommerce → Settings → Accounts & Privacy → Checkout → Require Tax ID at checkout**. It remains optional by default.
56
56
 
57
+ The native value maps to the official registered `kizlo/tax-id` address field. For example, `{ billingAddress: { taxId: "GB123" } }` becomes `{ billing_address: { "kizlo/tax-id": "GB123" } }` on the Store API wire. Partial cart/customer-address updates omit the key when `taxId` is omitted; `taxId: ""` clears it. Full confirmation/retry inputs retain the existing empty-string default. WooCommerce owns sanitization and contextual requiredness.
58
+
59
+ Raw introspection preserves `kizlo/tax-id` in both address schemas. Normalized billing `additionalFields` omits it from types and values: use the native property. Raw billing inputs using that key are rejected even when a duplicate equals `taxId`; there is no raw-only compatibility alias. Other registered and compatible unknown response extras retain their usual buckets.
60
+
61
+ Customer reads use the grouped `billing.additional_fields` adapter backed by public CheckoutFields helpers. Orders read their own snapshot, never the current profile. Storage remains `_wc_billing/kizlo/tax-id`, so existing saved values need no migration. Order admin edits set/replace/clear the order alone; profile edits affect later cart hydration. The retry validation/persistence bridge and shipping cleanup remain required on WooCommerce 11.0.1.
62
+
63
+ Consumers should deploy the matching WooCommerce plugin and regenerate their contract after upgrading; the old per-field raw `billing.tax_id` response is removed. The native API remains `customer.billing.taxId` and `billingAddress.taxId`. This feature does not validate jurisdiction-specific identifiers or calculate tax exemptions.
64
+
65
+ Storefront field definitions include SDK binding paths derived from the same address identity and native projection contract. For billing Tax ID, `bindings.billing` is `["taxId"]`; there is no shipping binding. Registered-field error targeting remains a separate SDK helper.
66
+
57
67
  ## Storefront settings
58
68
 
59
69
  `storefront.get` returns the store-wide settings a storefront renders with, so nothing has to be hardcoded:
@@ -69,11 +79,30 @@ A field's rules for a country are its default merged with that country's overrid
69
79
  const store = await kizlo.woocommerce.storefront.get.call()
70
80
 
71
81
  const country = store.address.countries.find((entry) => entry.code === "AE")
72
- const postcode = { ...store.address.fields.postcode, ...country?.locale.postcode }
82
+ const postcode = { ...store.address.fields.find((field) => field.id === "postcode"), ...country?.locale.postcode }
73
83
  // { label: "Postal code", required: false, hidden: true, ... }
74
84
  ```
75
85
 
76
- The response is cached in WordPress per locale. Changing a WooCommerce setting clears it and sends the `settings.woocommerce.updated` webhook event.
86
+ `address.fields` is an array containing every core and registered address/contact/order definition. Each entry carries its original Woo `id`, `location`, labels, control `type`, `options`, `attributes`, boolean/JSON Schema `required` and `hidden`, and a value `schema` expressed as draft-07 JSON Schema. Woo shorthand conditions are wrapped into standard `properties`. Declarative validation and supported HTML constraints survive; PHP callbacks stay on the server.
87
+
88
+ ```ts
89
+ // Example normalized definition; no shopper values are included.
90
+ {
91
+ id: "first_name", location: "address", label: "First name",
92
+ required: true, hidden: false, type: null,
93
+ attributes: { autocomplete: "given-name" }, schema: { type: "string" },
94
+ bindings: { billing: ["firstName"], shipping: ["firstName"] },
95
+ // optionalLabel, index, placeholder, options, autocomplete also accompany it.
96
+ }
97
+ ```
98
+
99
+ Address `bindings.billing` and `bindings.shipping` are relative to the address object. Contact/order `bindings.other` follow Checkout: email uses `["billingAddress", "email"]`, extras use `["additionalFields", id]`. Address extras use `["additionalFields", id]`; the complete ID is one literal segment, even if it contains dots or brackets. No separate `fieldLocations` is needed. Kizlo API values and write serialization remain unchanged.
100
+
101
+ Upgrade the matching plugin and SDK together and regenerate the consumer contract. The field-map/location-list response is replaced by the field array. Kit's group resolvers transform these definitions into form metadata and complete validation schemas; applications decide where and how to render them. Cart-dependent plugin rules remain a separate integration concern; this response does not contain a field document or shopper/session data.
102
+
103
+ `checkout.localPickup.methodIds` classifies shipping methods supporting local pickup, including plugin methods. An empty list is known empty; `null` means older or malformed producer metadata. See [checkout condition data](./docs/checkout-conditions.md) for the complete client document mapping and Kit handoff.
104
+
105
+ The response is cached in WordPress per locale. Changing a WooCommerce setting clears it and sends the `settings.woocommerce.updated` webhook event; plugin activation/deactivation also invalidates it.
77
106
 
78
107
  ## License
79
108