1import { Controller } from "@hotwired/stimulus" 2 3// Clears the locally-saved checkout form data once an order has actually been 4// placed. The checkout controller (ecommerce--checkout) persists every field to 5// localStorage as the customer types and restores it on reconnect, so a payment 6// problem that bounces them back to checkout doesn't wipe what they entered. The 7// only safe moment to forget that data is here â on the order confirmation page, 8// which we only reach after the order is genuinely created. 9// 10// Key MUST match ecommerce--checkout's storageKey getter ("checkout_form_data"). 11export default class extends Controller { 12 static values = { storageKey: { type: String, default: "checkout_form_data" } } 13 14 connect() { 15 try { 16 localStorage.removeItem(this.storageKeyValue) 17 } catch { 18 // localStorage unavailable (private mode / disabled) â nothing to clear. 19 } 20 } 21}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.