Repository navigation
PRs #124–#127, the storefront CSP fix and a review of all of it. Adds migration V7
(phoenix_kit_shop_shipments): run mix phoenix_kit.update after upgrading. V7 only creates
the table and its indexes; no existing table changes. Same dependency requirements as 0.15.0.
Upgrade notes
- Storefront CSP. The sidebar's per-filter clear button and the product image fallback no
longer use inline handlers. They run frompriv/static/assets/phoenix_kit_ecommerce.js, which
reaches the page only through core's:phoenix_kit_js_sourcescompiler
(phoenix_kit_modules.jsin the root layout). Without it, a clear button also folds its
section and broken images show the browser's icon. Core warns at compile time when the
compiler is missing. - Hosts that ran V7 from
mainbefore this release keepvarchar(255)for the shipments'
tracking_number,carrier_refandcarrier_label, because V7 only creates what is missing.
ALTER TABLE phoenix_kit_shop_shipments ALTER COLUMN … TYPE textfor each of the three brings
them in line. Hosts on Hex releases are not affected. - The shipments' tracking cron (
ShipmentTrackingWorker,7,37 * * * *) and the shipped email
run ondefault, which every host already runs.
Added
- Shipments with the carriers of the shipping providers. A paid order's shipment is
registered with its carrier, from the Shipments admin page (/admin/shop/shipments) or, with
shop_shipping_auto_createon (default off), automatically when billing reports the order
paid. Registration is idempotent per attempt, and an answer that never arrives is recovered as
unknownfor the admin rather than sent twice. - The Shipments page: orders to ship, open shipments and those that need attention, filtered
by carrier and status. It has an editor for the parcels, the recipient and the destination
before registering or retrying, batch registration, cancel, close, a manually entered tracking
number, and label printing (GET /shop-shipments/labels, paper sizeshop_shipping_label_format:
A4 by default, A5 or A6). It is behind the newshop.manage_shipmentspermission, which
includes the recipients' contact details. - Tracking: a half-hourly run sweeps shipments stuck in
creatingand asks each carrier
group for news. A status never moves backwards, and "tracking failing since" shows on the page. - The buyer's shipped email, once per shipment (
shop_order_email_shipped, default on), and
the shipments with their tracking links on the buyer's order list, order page and
confirmation page. - The shipping provider behaviour gains
create_shipment/2,cancel_shipment/2,
print_labels/3andtrack/2, withShipmentRequest,ShipmentResult,ShipmentRef,
LabelOptionsandTrackingUpdate. Recipient phones are sent in E.164, and carrier text is
masked before it is logged or stored in events. shop_show_index_breadcrumbs(default on): the shop index's one-crumb breadcrumb row can be
turned off; the storefront bar then renders alone, right-aligned (#124).
Changed
- The storefront works under a nonce Content-Security-Policy: no inline event handlers remain.
The per-filter clear button now clears its filter; the old handler stopped the click from
reaching LiveView. priv/staticships in the package.
Fixed (review of the changes since 0.15.0)
- A carrier answer with a long, non-text, NUL or invalid-UTF-8 value no longer loses a
registration: V7'stracking_number,carrier_refandcarrier_labelaretext, and
carrier strings andextraare cleaned before they are stored. Admin-typed tracking numbers
and recipient corrections are cleaned too; a tracking number over 255 characters is refused. - A tracking update is no longer lost when two runs meet: a missed write weighs the update again,
and the tracking worker is unique while a run waits or runs. - A completed no-op shipped-email job no longer blocks the one queued later.
- Automatic registration does nothing while the shop is disabled.
- The carrier context carries the buyer's checkout language, not the admin's.
- A cancel the carrier confirmed but that could not be recorded says so
(:cancelled_at_carrier_not_recorded) and leaves an event. - Shipments page: a local refusal reopens the editor with what was typed; a register or retry
whose row was written but whose submit failed is logged; the editor no longer opens after the
key is revoked; crafted params and non-UUID ids no longer crash it; a late pickup-point list of
another city is ignored. - The label download allowlists label content types (anything else is
application/octet-stream,.bin) and sendsx-content-type-options: nosniff. - The order confirmation page's status badge takes its colour from the status; a blank
tracking number renders no label.