feat(CP-2836): enforce free product options before quick checkout - #1022
feat(CP-2836): enforce free product options before quick checkout#1022aelzakzouk wants to merge 6 commits into
Conversation
…illed Add salla-add-product-button validate hook that scrolls to the options section and shows a soft info hint when optional options are unselected; checkout is not blocked (required options are validated server-side). Add optional_options_hint i18n key in Arabic and English. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Not up to standards ⛔🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
1101c24 to
55d1489
Compare
…heckout
- Two-path gate on salla-add-product-button validate hook:
PDP: blocks + scrolls when required advance=0 options are missing; injects
filled selections into cart::before.add.item
Non-PDP: calls product/options API, opens salla-order-options-modal with free
options as steps (product preview + options form); blocks on dismiss
- Add cart::before.add.item listener to inject _pendingFreeOptions as `options`
- Add required_free_options_message locale key (AR + EN)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ick buy - Always call product/options API before quick buy (even on PDP page) - Priority 1: if offer_options returned (Y has required options) → open modal showing Y's thumbnail + name + options as steps - Priority 2: if X itself has free options → PDP: validate in-place, non-PDP: open modal for X - _pendingOfferFreeOptions injected as free_product_options[Y.id] in cart::before.add.item so backend receives Y's selections alongside X Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ns-quick-checkout
…k checkout
- Fix API key: read advance_free_product (array) instead of offer_options
- Replace single-offer handler with _handleOfferFreeOptionsSteps that loops
each entry sequentially, opening one salla-order-options-modal per Y
- Pending offer options stored as [{productId, options}] array instead of
single object
- Cart injection promotes X to products[0] and appends each Y as products[N]
with bracket-notation keys so MiniCheckoutRequest parses them correctly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… DOM The modal is injected by salla-add-product-button at runtime, so querySelector returns null when our hook fires. Create and attach it ourselves, then await customElements.whenDefined() before calling open(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Closing as superseded by https://github.com/SallaApp/twilight/pull/2191, which implements this behaviour in The reasoning, so it's on the record:
One thing deliberately not carried over: Reopen if you disagree — happy to be wrong here. |
No description provided.