@salla.sa/twilight-components 2.14.533 → 2.14.535
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/dist/cjs/{Helper-B2B-kxAI.js → Helper-6RI07gZo.js} +10 -0
- package/dist/cjs/{filepond-CTU0puJK.js → filepond-DMiqAXY6.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-e2j_qdEq.js → filepond-plugin-file-poster-BVSRV0B1.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CJ2bdUHS.js → filepond-plugin-file-validate-size-pCvjseUb.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BAPOnkKm.js → filepond-plugin-file-validate-type-D092neDg.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Qg5TvRQk.js → filepond-plugin-image-edit-XbqlePV3.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-CDWu2nuZ.js → filepond-plugin-image-exif-orientation-BX82zMyc.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-D7tinAVs.js → filepond-plugin-image-preview-CD9tScCD.js} +1 -1
- package/dist/cjs/{functions-9UoEMgE8.js → functions-Df0Ggsup.js} +1 -1
- package/dist/cjs/{index-Bzkj4Mih.js → index-C5ZvHCin.js} +2 -2
- package/dist/cjs/{intlTelInput-B-ymxxq7.js → intlTelInput-CI7qauwd.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +605 -48
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +11 -11
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +2 -2
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card_2.cjs.entry.js +3 -2
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +8 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-B0bluwtb.js → tracked-promise-6lFHNFpe.js} +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/cjs/{vanilla-picker-b_58j2ys.js → vanilla-picker-DzOJP2_X.js} +1 -1
- package/dist/collection/Helpers/Helper.js +10 -0
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +7 -4
- package/dist/collection/components/salla-products-list/salla-products-list.js +6 -0
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +1 -0
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +18 -36
- package/dist/components/Helper.js +10 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-add-product-button2.js +7 -5
- package/dist/components/salla-products-list2.js +6 -0
- package/dist/components/salla-products-slider2.js +1 -0
- package/dist/components/salla-quick-buy2.js +597 -42
- package/dist/esm/{Helper-BQ9mvrt9.js → Helper-CBmYxrzX.js} +10 -0
- package/dist/esm/{filepond-cbwmiCMW.js → filepond-C4OniETR.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CnPkPMW8.js → filepond-plugin-file-poster-DoLmPZN0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DvbfP3XU.js → filepond-plugin-file-validate-size-GSTJAVro.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BmKx6JGC.js → filepond-plugin-file-validate-type-BgosaXBw.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-Bs6ewOpy.js → filepond-plugin-image-edit-CKH9ms-8.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-BHCRYCoF.js → filepond-plugin-image-exif-orientation-Dm1m6o6h.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BcBXsocw.js → filepond-plugin-image-preview-Clw-ajQg.js} +1 -1
- package/dist/esm/{functions-BDNgBQjQ.js → functions-_bjecsq1.js} +1 -1
- package/dist/esm/{index-_4UMswuA.js → index-DBZ1mmdE.js} +2 -2
- package/dist/esm/{intlTelInput-BqsfLR9B.js → intlTelInput-C8TBhLMB.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +605 -48
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +11 -11
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +2 -2
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down_2.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +2 -2
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-card_2.entry.js +3 -2
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +8 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-t43zESfb.js → tracked-promise-Ds3IkuGS.js} +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm/{vanilla-picker-Cqv-m1pV.js → vanilla-picker-7f106Jxq.js} +1 -1
- package/dist/twilight/p-024b399a.entry.js +4 -0
- package/dist/twilight/{p-3b536684.entry.js → p-0339162a.entry.js} +1 -1
- package/dist/twilight/{p-d3f13515.entry.js → p-0351e1e0.entry.js} +1 -1
- package/dist/twilight/{p-61cba9b5.entry.js → p-047ae479.entry.js} +1 -1
- package/dist/twilight/{p-853bcd69.entry.js → p-0560c569.entry.js} +1 -1
- package/dist/twilight/{p-8db35b36.entry.js → p-05d79cef.entry.js} +1 -1
- package/dist/twilight/{p-0652db81.entry.js → p-06a3fd91.entry.js} +1 -1
- package/dist/twilight/{p-a5907a8a.entry.js → p-072da339.entry.js} +1 -1
- package/dist/twilight/{p-fcdac58f.entry.js → p-0fb71700.entry.js} +1 -1
- package/dist/twilight/{p-9645a657.entry.js → p-10270922.entry.js} +1 -1
- package/dist/twilight/{p-518fd323.entry.js → p-139940cd.entry.js} +1 -1
- package/dist/twilight/{p-877ef36d.entry.js → p-15adae5b.entry.js} +1 -1
- package/dist/twilight/{p-431ddda2.entry.js → p-1acccf4f.entry.js} +1 -1
- package/dist/twilight/{p-230dbdb0.entry.js → p-1d3377c7.entry.js} +1 -1
- package/dist/twilight/{p-2a5ed2b8.entry.js → p-1e09ccf2.entry.js} +1 -1
- package/dist/twilight/{p-a89c3af1.entry.js → p-227f91cf.entry.js} +1 -1
- package/dist/twilight/{p-98e4b302.entry.js → p-31abf85b.entry.js} +1 -1
- package/dist/twilight/{p-a9d7afd4.entry.js → p-335130d7.entry.js} +1 -1
- package/dist/twilight/{p-e242ca31.entry.js → p-35c8e1fa.entry.js} +1 -1
- package/dist/twilight/{p-f020c70a.entry.js → p-37b6d115.entry.js} +1 -1
- package/dist/twilight/{p-3c5dabea.entry.js → p-3c19023a.entry.js} +1 -1
- package/dist/twilight/{p-ebab9397.entry.js → p-42abcb14.entry.js} +1 -1
- package/dist/twilight/p-433a09b4.entry.js +4 -0
- package/dist/twilight/{p-414b8e8b.entry.js → p-45931d37.entry.js} +1 -1
- package/dist/twilight/p-45b4ecd7.entry.js +4 -0
- package/dist/twilight/{p-83ec7e8a.entry.js → p-45cf57f0.entry.js} +1 -1
- package/dist/twilight/{p-a7353a2c.entry.js → p-47ab940f.entry.js} +1 -1
- package/dist/twilight/{p-fbcb213b.entry.js → p-493ed5ac.entry.js} +1 -1
- package/dist/twilight/{p-7480f7ea.entry.js → p-4bbee9fd.entry.js} +1 -1
- package/dist/twilight/{p-6a7f0db4.entry.js → p-4c4249a8.entry.js} +1 -1
- package/dist/twilight/{p-9817c793.entry.js → p-4fc6b87e.entry.js} +1 -1
- package/dist/twilight/{p-380c1d1f.entry.js → p-50233de9.entry.js} +1 -1
- package/dist/twilight/{p-CrgJZliu.js → p-510IBmXt.js} +1 -1
- package/dist/twilight/{p-4cac0554.entry.js → p-551fdbe4.entry.js} +1 -1
- package/dist/twilight/{p-8a26d45f.entry.js → p-58c14e13.entry.js} +1 -1
- package/dist/twilight/{p-b92c5be6.entry.js → p-5e19c7cb.entry.js} +1 -1
- package/dist/twilight/{p-5aa2673e.entry.js → p-6371cddf.entry.js} +1 -1
- package/dist/twilight/{p-0eb8b68f.entry.js → p-63746eed.entry.js} +1 -1
- package/dist/twilight/{p-a30a0d74.entry.js → p-6445f756.entry.js} +1 -1
- package/dist/twilight/p-67ae044e.entry.js +4 -0
- package/dist/twilight/{p-0bb747c4.entry.js → p-6c4f0341.entry.js} +1 -1
- package/dist/twilight/{p-041337bf.entry.js → p-6f667196.entry.js} +1 -1
- package/dist/twilight/{p-2fca58b7.entry.js → p-6f82c607.entry.js} +1 -1
- package/dist/twilight/{p-dcf83d8d.entry.js → p-6f843c0a.entry.js} +1 -1
- package/dist/twilight/{p-cc4694eb.entry.js → p-71d477ae.entry.js} +1 -1
- package/dist/twilight/p-73a0207a.entry.js +4 -0
- package/dist/twilight/{p-e4c11c19.entry.js → p-77013986.entry.js} +1 -1
- package/dist/twilight/{p-73865fc4.entry.js → p-782feccb.entry.js} +1 -1
- package/dist/twilight/{p-646a753d.entry.js → p-7f33ee37.entry.js} +1 -1
- package/dist/twilight/{p-a2579e15.entry.js → p-8030cbc2.entry.js} +1 -1
- package/dist/twilight/{p-cfec1c83.entry.js → p-821b09ef.entry.js} +1 -1
- package/dist/twilight/{p-7f2d5291.entry.js → p-83c8591a.entry.js} +1 -1
- package/dist/twilight/{p-aad1a140.entry.js → p-85920b90.entry.js} +1 -1
- package/dist/twilight/{p-9bdabb1a.entry.js → p-87d19251.entry.js} +1 -1
- package/dist/twilight/{p-eac49193.entry.js → p-886c7171.entry.js} +1 -1
- package/dist/twilight/{p-3d81a00f.entry.js → p-8be52c77.entry.js} +1 -1
- package/dist/twilight/{p-45db790d.entry.js → p-914696e3.entry.js} +1 -1
- package/dist/twilight/{p-731c71ae.entry.js → p-9190b2d9.entry.js} +1 -1
- package/dist/twilight/{p-56daec16.entry.js → p-9553d9df.entry.js} +1 -1
- package/dist/twilight/{p-c1fb3330.entry.js → p-9abb2fe1.entry.js} +1 -1
- package/dist/twilight/p-BLPhrBVT.js +9 -0
- package/dist/twilight/{p-NVUJ-yak.js → p-CCQS3wWC.js} +1 -1
- package/dist/twilight/{p-1DFQh6fF.js → p-CIQ6L-lP.js} +1 -1
- package/dist/twilight/{p-fBq3tL2U.js → p-CM1WZMCK.js} +1 -1
- package/dist/twilight/{p-DTy2I02l.js → p-CuQ7RhgX.js} +1 -1
- package/dist/twilight/{p-_4UMswuA.js → p-DBZ1mmdE.js} +1 -1
- package/dist/twilight/p-DOBDDG4K.js +4 -0
- package/dist/twilight/{p-6QnQGXyw.js → p-DvWr5QCU.js} +2 -2
- package/dist/twilight/{p-BbGG982X.js → p-WIBA-EsX.js} +1 -1
- package/dist/twilight/{p-0103aab1.entry.js → p-a20587d9.entry.js} +1 -1
- package/dist/twilight/{p-ed84e84a.entry.js → p-a4f499b4.entry.js} +1 -1
- package/dist/twilight/{p-64b3ec8e.entry.js → p-a7bfcc4f.entry.js} +1 -1
- package/dist/twilight/{p-7a6c2a19.entry.js → p-aacb850d.entry.js} +1 -1
- package/dist/twilight/{p-533b4ad3.entry.js → p-b03ba2e5.entry.js} +1 -1
- package/dist/twilight/{p-a5313de1.entry.js → p-b5396661.entry.js} +1 -1
- package/dist/twilight/{p-46610835.entry.js → p-ba6f546f.entry.js} +1 -1
- package/dist/twilight/{p-34a836bc.entry.js → p-bb0f2f84.entry.js} +1 -1
- package/dist/twilight/{p-8dd69b86.entry.js → p-bb5dc688.entry.js} +1 -1
- package/dist/twilight/{p-fe21d16a.entry.js → p-bcda4b49.entry.js} +1 -1
- package/dist/twilight/{p-0b18a6dd.entry.js → p-be80e8ef.entry.js} +1 -1
- package/dist/twilight/{p-012ab001.entry.js → p-bea87502.entry.js} +1 -1
- package/dist/twilight/{p-60e976c3.entry.js → p-bf75e341.entry.js} +1 -1
- package/dist/twilight/{p-1cf132f6.entry.js → p-c552412f.entry.js} +1 -1
- package/dist/twilight/{p-5dd628bf.entry.js → p-c78b079c.entry.js} +1 -1
- package/dist/twilight/{p-5e4c6345.entry.js → p-c92a44f2.entry.js} +1 -1
- package/dist/twilight/{p-8bdca313.entry.js → p-cc6013ec.entry.js} +1 -1
- package/dist/twilight/{p-8ecfb854.entry.js → p-cc896aa3.entry.js} +1 -1
- package/dist/twilight/{p-4c645ee5.entry.js → p-da20420b.entry.js} +1 -1
- package/dist/twilight/{p-8522445b.entry.js → p-db02654a.entry.js} +1 -1
- package/dist/twilight/{p-da371fb5.entry.js → p-db4d8f03.entry.js} +1 -1
- package/dist/twilight/{p-3b3d778b.entry.js → p-def672b6.entry.js} +1 -1
- package/dist/twilight/{p-0a76c201.entry.js → p-df56e678.entry.js} +1 -1
- package/dist/twilight/{p-ef02ff89.entry.js → p-e24649dd.entry.js} +1 -1
- package/dist/twilight/{p-8be62ddd.entry.js → p-e2ff9857.entry.js} +1 -1
- package/dist/twilight/{p-146bb40b.entry.js → p-e8c48ba0.entry.js} +1 -1
- package/dist/twilight/{p-452ccc3e.entry.js → p-e99e59be.entry.js} +1 -1
- package/dist/twilight/{p-941c3ffa.entry.js → p-ebc967f4.entry.js} +1 -1
- package/dist/twilight/{p-e47a4b60.entry.js → p-f167ec3e.entry.js} +1 -1
- package/dist/twilight/{p-b60c13a0.entry.js → p-f3846a26.entry.js} +1 -1
- package/dist/twilight/{p-fb52bc60.entry.js → p-f63c9b65.entry.js} +1 -1
- package/dist/twilight/{p-4c6e6aa9.entry.js → p-f8b4e119.entry.js} +1 -1
- package/dist/twilight/{p-527caf04.entry.js → p-fa54137b.entry.js} +1 -1
- package/dist/twilight/{p-85650252.entry.js → p-fa85edfd.entry.js} +1 -1
- package/dist/twilight/{p-ee6eae74.entry.js → p-fd58290a.entry.js} +1 -1
- package/dist/twilight/{p-11a92952.entry.js → p-ffc24d3a.entry.js} +1 -1
- package/dist/twilight/{p-Cukniya-.js → p-jMJhY6yy.js} +1 -1
- package/dist/twilight/{p-BYBXGGPY.js → p-uowEa6Zu.js} +1 -1
- package/dist/twilight/{p-mFNP-Qco.js → p-wNiB1gdh.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +1 -0
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +0 -4
- package/package.json +5 -5
- package/dist/twilight/p-30a9ce5f.entry.js +0 -4
- package/dist/twilight/p-336bec27.entry.js +0 -4
- package/dist/twilight/p-BeurE6_H.js +0 -9
- package/dist/twilight/p-XnA1YTjA.js +0 -4
- package/dist/twilight/p-b80d0e39.entry.js +0 -4
- package/dist/twilight/p-c1dd71f0.entry.js +0 -4
- package/dist/twilight/p-f7ab48c1.entry.js +0 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement, e as axios } from './index-
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement, e as axios } from './index-DBZ1mmdE.js';
|
|
5
5
|
import { P as PendingOrdersIcon } from './cart-DY4LZmNP.js';
|
|
6
|
-
import { H as Helper } from './Helper-
|
|
6
|
+
import { H as Helper } from './Helper-CBmYxrzX.js';
|
|
7
7
|
import { a as fetchProductCustomersAlsoBought } from './catalog-recommendations-CL7OPpYS.js';
|
|
8
8
|
import { B as BellRing } from './bell-ring-D3mWkc-3.js';
|
|
9
9
|
import { D as DisplayType } from './interfaces-CoQJOPRz.js';
|
|
@@ -18,6 +18,135 @@ var WalletIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
18
18
|
</svg>
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Shared Apple Pay support helpers: SDK loading, capability detection, merchant
|
|
23
|
+
* identifier resolution, and Payment Request method-data construction.
|
|
24
|
+
*
|
|
25
|
+
* Lives in @salla.sa/applepay (not a theme) because it is Apple Pay domain
|
|
26
|
+
* logic and is consumed by every Apple Pay entry point — the storefront
|
|
27
|
+
* components (salla-quick-buy, salla-add-product-button) and the shared
|
|
28
|
+
* SallaApplePay session in ./index.js.
|
|
29
|
+
*
|
|
30
|
+
* Apple Pay runs through two flows:
|
|
31
|
+
* - Native (Safari / Apple devices) → window.ApplePaySession
|
|
32
|
+
* - Payment Request API (other browsers) → Apple's "Scan Code with iPhone"
|
|
33
|
+
* QR sheet, which requires Apple's JS SDK to be *loaded and registered*
|
|
34
|
+
* before PaymentRequest.canMakePayment() reports the method as available.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const APPLE_PAY_METHOD$1 = 'https://apple.com/apple-pay';
|
|
38
|
+
const APPLE_PAY_SDK_ID = 'apple-pay-sdk';
|
|
39
|
+
const APPLE_PAY_SDK_SRC = 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js';
|
|
40
|
+
|
|
41
|
+
let sdkPromise = null;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Salla-native Apple merchant identifier, sourced from store settings. Returns
|
|
45
|
+
* null when the store has no Apple Pay merchant configured — callers treat that
|
|
46
|
+
* absence as the guard and skip Apple Pay entirely (no hardcoded fallback).
|
|
47
|
+
* @returns {string|null}
|
|
48
|
+
*/
|
|
49
|
+
function applePayMerchantId() {
|
|
50
|
+
return salla?.config?.get?.('store.settings.buy_now.merchant_identifier') || null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Build the W3C Payment Request `methodData` for the Apple Pay method. Callers
|
|
55
|
+
* supply the values (the probe reads them from config; the live session reads
|
|
56
|
+
* them from the transaction detail), this owns the constant scaffold so the two
|
|
57
|
+
* can't drift apart.
|
|
58
|
+
* @param {{ version: number, merchantIdentifier: string, supportedNetworks: string[], countryCode: string }} opts
|
|
59
|
+
* @returns {PaymentMethodData[]}
|
|
60
|
+
*/
|
|
61
|
+
function buildApplePayMethodData({ version, merchantIdentifier, supportedNetworks, countryCode }) {
|
|
62
|
+
return [{
|
|
63
|
+
supportedMethods: APPLE_PAY_METHOD$1,
|
|
64
|
+
data: {
|
|
65
|
+
version,
|
|
66
|
+
merchantIdentifier,
|
|
67
|
+
merchantCapabilities: ['supports3DS'],
|
|
68
|
+
supportedNetworks,
|
|
69
|
+
countryCode,
|
|
70
|
+
},
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Inject Apple's Pay JS SDK (`1.latest` ships the cross-browser / QR support)
|
|
76
|
+
* and resolve once it has loaded. Idempotent: a second call reuses the same
|
|
77
|
+
* in-flight promise and never appends a second <script>. Resolves (rather than
|
|
78
|
+
* rejects) on load error so a failed CDN fetch simply falls back to "no QR".
|
|
79
|
+
* @returns {Promise<void>}
|
|
80
|
+
*/
|
|
81
|
+
function ensureApplePaySdk() {
|
|
82
|
+
if (typeof document === 'undefined') return Promise.resolve();
|
|
83
|
+
|
|
84
|
+
if (sdkPromise) return sdkPromise;
|
|
85
|
+
|
|
86
|
+
const existing = document.getElementById(APPLE_PAY_SDK_ID);
|
|
87
|
+
if (existing) {
|
|
88
|
+
// Script already in the DOM (e.g. added before this refactor). We can't know
|
|
89
|
+
// if it finished loading, so resolve immediately — the native/PaymentRequest
|
|
90
|
+
// probe will just report unavailable until the browser registers the method.
|
|
91
|
+
sdkPromise = Promise.resolve();
|
|
92
|
+
return sdkPromise;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
sdkPromise = new Promise((resolve) => {
|
|
96
|
+
const script = document.createElement('script');
|
|
97
|
+
script.src = APPLE_PAY_SDK_SRC;
|
|
98
|
+
script.setAttribute('id', APPLE_PAY_SDK_ID);
|
|
99
|
+
script.async = true;
|
|
100
|
+
script.onload = () => resolve();
|
|
101
|
+
script.onerror = () => resolve();
|
|
102
|
+
document.body.appendChild(script);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return sdkPromise;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether Apple Pay can be completed in the current browser: natively
|
|
110
|
+
* (Safari / Apple devices) or via the Payment Request API (non-Safari browsers
|
|
111
|
+
* / non-Apple devices → QR-code fallback).
|
|
112
|
+
*
|
|
113
|
+
* For the QR path this awaits the SDK before probing, so callers get a stable
|
|
114
|
+
* answer on first load instead of racing the async script fetch.
|
|
115
|
+
* @param {string} [currency]
|
|
116
|
+
* @returns {Promise<boolean>}
|
|
117
|
+
*/
|
|
118
|
+
async function canCompleteApplePay(currency = 'SAR') {
|
|
119
|
+
try {
|
|
120
|
+
if (window.ApplePaySession?.canMakePayments?.()) return true;
|
|
121
|
+
} catch (e) { /* not supported natively */ }
|
|
122
|
+
|
|
123
|
+
if (typeof window === 'undefined' || !window.PaymentRequest) return false;
|
|
124
|
+
|
|
125
|
+
// QR path only: it can't validate the merchant without a merchant identifier,
|
|
126
|
+
// so treat a missing config key as the guard. Native (above) is unaffected —
|
|
127
|
+
// it never uses the client-side merchant id.
|
|
128
|
+
if (!applePayMerchantId()) return false;
|
|
129
|
+
|
|
130
|
+
await ensureApplePaySdk();
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
const request = new PaymentRequest(
|
|
134
|
+
buildApplePayMethodData({
|
|
135
|
+
version: 3,
|
|
136
|
+
merchantIdentifier: applePayMerchantId(),
|
|
137
|
+
supportedNetworks: salla?.config?.get?.('store.settings.buy_now.supportedNetworks')
|
|
138
|
+
|| salla?.config?.get?.('store.settings.buy_now.networks')
|
|
139
|
+
|| ['masterCard', 'visa'],
|
|
140
|
+
countryCode: salla?.config?.get?.('store.store_country') || 'SA',
|
|
141
|
+
}),
|
|
142
|
+
{ total: { label: 'Salla', amount: { currency: currency || 'SAR', value: '0.00' } } },
|
|
143
|
+
);
|
|
144
|
+
return await request.canMakePayment();
|
|
145
|
+
} catch (e) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
21
150
|
/**
|
|
22
151
|
* Order-options gate for the fast-checkout widget — keeps <salla-add-product-button> thin.
|
|
23
152
|
* Intercepts the widget click → runs the order-options modal → injects the result → re-fires the click.
|
|
@@ -301,16 +430,18 @@ const SallaAddProductButton = class {
|
|
|
301
430
|
}
|
|
302
431
|
componentWillLoad() {
|
|
303
432
|
return salla.onReady()
|
|
304
|
-
.then(() => {
|
|
433
|
+
.then(async () => {
|
|
305
434
|
// this to fix not added hydrated class to html element after components loaded
|
|
306
435
|
document.documentElement.classList.add('hydrated');
|
|
307
436
|
this.showQuickBuy = this.quickBuy
|
|
308
437
|
&& salla.config.get('store.settings.buy_now')
|
|
309
438
|
&& this.productStatus == 'sale'
|
|
310
439
|
&& this.productType !== 'booking';
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
440
|
+
// Cross-browser Apple Pay: native (Safari) OR the Payment Request API
|
|
441
|
+
// (non-Safari browsers / non-Apple devices via the QR-code fallback).
|
|
442
|
+
this.isApplePayActive = salla.config.get('store.settings.payments')?.includes('apple_pay')
|
|
443
|
+
&& salla.config.get('store.settings.is_salla_gateway', false)
|
|
444
|
+
&& await canCompleteApplePay();
|
|
314
445
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
315
446
|
if (!!this.passedLabel && this.isDesktopViewport) {
|
|
316
447
|
return this.btn?.setText(this.passedLabel);
|
|
@@ -1833,9 +1964,6 @@ const SallaProductOptions = class {
|
|
|
1833
1964
|
};
|
|
1834
1965
|
SallaProductOptions.style = sallaProductOptionsCss;
|
|
1835
1966
|
|
|
1836
|
-
// display currency (these requests use the global axios, not salla's instance). Legacy-BE stores
|
|
1837
|
-
// (isLegacyBuyNowBE) keep the old behavior — no override. Set once on the axios defaults so
|
|
1838
|
-
// every method inherits it without overriding the rest of the headers.
|
|
1839
1967
|
function setBaseCurrencyHeader() {
|
|
1840
1968
|
axios.defaults.headers.common.currency = salla?.config?.get?.('user.currency_code');
|
|
1841
1969
|
}
|
|
@@ -2221,6 +2349,14 @@ if (typeof window !== 'undefined') {
|
|
|
2221
2349
|
window.Salla.Payments = window.Salla.Payments || {};
|
|
2222
2350
|
}
|
|
2223
2351
|
|
|
2352
|
+
// Apple Pay method identifier for the W3C Payment Request API.
|
|
2353
|
+
const APPLE_PAY_METHOD = 'https://apple.com/apple-pay';
|
|
2354
|
+
|
|
2355
|
+
// Captured at module load, before the Apple Pay SDK is injected: real Safari /
|
|
2356
|
+
// Apple devices expose `ApplePaySession` natively, whereas non-Safari browsers
|
|
2357
|
+
// only get it once the SDK loads. Keeps native-vs-PaymentRequest routing stable.
|
|
2358
|
+
const HAS_NATIVE_APPLE_PAY = typeof window !== 'undefined' && !!window.ApplePaySession;
|
|
2359
|
+
|
|
2224
2360
|
/**
|
|
2225
2361
|
* Full Example
|
|
2226
2362
|
*
|
|
@@ -2264,6 +2400,11 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2264
2400
|
countryCode: null,
|
|
2265
2401
|
totals: [],
|
|
2266
2402
|
shippingCompany: null,
|
|
2403
|
+
// Set true once onCancel has fired for the current transaction, so the
|
|
2404
|
+
// QR (PaymentRequest) dismissal catch can notify on a plain sheet-close
|
|
2405
|
+
// without double-firing when a prior handler (e.g. merchant validation)
|
|
2406
|
+
// already routed through onCancel. Reset at the start of each transaction.
|
|
2407
|
+
canceled: false,
|
|
2267
2408
|
init: function () {
|
|
2268
2409
|
document.removeEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
|
|
2269
2410
|
Salla.event.addEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
|
|
@@ -2326,14 +2467,52 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2326
2467
|
return SallaApplePay.detail?.requiredShippingContactFields?.includes('postalAddress');
|
|
2327
2468
|
},
|
|
2328
2469
|
|
|
2470
|
+
/**
|
|
2471
|
+
* Whether the native Apple Pay flow (Safari / Apple devices) can run. Gated
|
|
2472
|
+
* on the module-load capture so the SDK loading later can't flip a
|
|
2473
|
+
* non-Safari browser into the native path.
|
|
2474
|
+
*/
|
|
2475
|
+
canUseNative: function () {
|
|
2476
|
+
if (!HAS_NATIVE_APPLE_PAY) {
|
|
2477
|
+
return false;
|
|
2478
|
+
}
|
|
2479
|
+
try {
|
|
2480
|
+
return ApplePaySession.canMakePayments();
|
|
2481
|
+
} catch (e) {
|
|
2482
|
+
return false;
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2485
|
+
|
|
2486
|
+
// Sourced from config (via the transaction detail). No fallback: a missing
|
|
2487
|
+
// identifier means Apple Pay isn't configured for this store, and callers
|
|
2488
|
+
// treat that null as the guard to skip Apple Pay.
|
|
2489
|
+
getMerchantIdentifier: function () {
|
|
2490
|
+
return (SallaApplePay.detail && SallaApplePay.detail.merchantIdentifier) || null;
|
|
2491
|
+
},
|
|
2492
|
+
|
|
2329
2493
|
startSession: async function (event) {
|
|
2330
2494
|
|
|
2331
2495
|
SallaApplePay.detail = event.detail || event;
|
|
2332
2496
|
|
|
2497
|
+
// Fresh transaction → clear any cancel flag from a previous attempt.
|
|
2498
|
+
SallaApplePay.canceled = false;
|
|
2499
|
+
|
|
2333
2500
|
salla.log('🍏 Pay: payments::apple-pay.start-transaction', SallaApplePay.detail);
|
|
2334
2501
|
|
|
2335
2502
|
SallaApplePay.initDefault();
|
|
2336
2503
|
|
|
2504
|
+
// Native (Safari / Apple devices) → classic ApplePaySession. Otherwise
|
|
2505
|
+
// (non-Safari / non-Apple device) → Payment Request API, which renders
|
|
2506
|
+
// Apple's "Scan Code with iPhone" QR sheet.
|
|
2507
|
+
if (!SallaApplePay.canUseNative()) {
|
|
2508
|
+
return SallaApplePay.startPaymentRequestSession(event);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
return SallaApplePay.startNativeSession(event);
|
|
2512
|
+
},
|
|
2513
|
+
|
|
2514
|
+
startNativeSession: async function (event) {
|
|
2515
|
+
|
|
2337
2516
|
let version = SallaApplePay.getApplePaySessionVersion();
|
|
2338
2517
|
// Normalize to an array: the backend can serialize the networks list as a JSON object
|
|
2339
2518
|
// (non-sequential PHP array keys). Copy it so we never mutate the shared `detail` reference.
|
|
@@ -2467,6 +2646,7 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2467
2646
|
},
|
|
2468
2647
|
|
|
2469
2648
|
onCancel: (event = {}, message = null) => {
|
|
2649
|
+
SallaApplePay.canceled = true;
|
|
2470
2650
|
SallaApplePay.detail.onError(message || salla.lang.get('pages.checkout.payment_failed'));
|
|
2471
2651
|
Salla.event.createAndDispatch('payments::apple-pay.canceled', event);
|
|
2472
2652
|
},
|
|
@@ -2683,6 +2863,400 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2683
2863
|
}
|
|
2684
2864
|
},
|
|
2685
2865
|
|
|
2866
|
+
/* -------------------------------------------------------------------------
|
|
2867
|
+
* Payment Request API flow (non-Safari browsers / non-Apple devices).
|
|
2868
|
+
* Apple renders the "Scan Code with iPhone" QR sheet. Reuses the same
|
|
2869
|
+
* backend endpoints (validate / address / shipping / recalculate / submit)
|
|
2870
|
+
* as the native flow; only the sheet-completion model differs
|
|
2871
|
+
* (event.updateWith / response.complete instead of session.completeXxx).
|
|
2872
|
+
* ---------------------------------------------------------------------- */
|
|
2873
|
+
|
|
2874
|
+
paymentRequest: null,
|
|
2875
|
+
paymentResponse: null,
|
|
2876
|
+
|
|
2877
|
+
getCurrency: () => SallaApplePay.detail.currency || 'SAR',
|
|
2878
|
+
|
|
2879
|
+
prAmount: (value) => ({ currency: SallaApplePay.getCurrency(), value: String(value) }),
|
|
2880
|
+
|
|
2881
|
+
prTotal: () => {
|
|
2882
|
+
const total = SallaApplePay.prepareTotal();
|
|
2883
|
+
return { label: total.label, amount: SallaApplePay.prAmount(total.amount) };
|
|
2884
|
+
},
|
|
2885
|
+
|
|
2886
|
+
prDisplayItems: () => SallaApplePay.prepareLineItems().map(item => ({
|
|
2887
|
+
label: item.label,
|
|
2888
|
+
amount: SallaApplePay.prAmount(item.amount),
|
|
2889
|
+
})),
|
|
2890
|
+
|
|
2891
|
+
prShippingOptions: (selectedId = null) => {
|
|
2892
|
+
const options = SallaApplePay.mappingShippingMethods(SallaApplePay.shipping_methods || []);
|
|
2893
|
+
return options.map((option, index) => ({
|
|
2894
|
+
id: option.identifier,
|
|
2895
|
+
label: option.label,
|
|
2896
|
+
amount: SallaApplePay.prAmount(option.amount),
|
|
2897
|
+
selected: selectedId ? option.identifier === selectedId : index === 0,
|
|
2898
|
+
}));
|
|
2899
|
+
},
|
|
2900
|
+
|
|
2901
|
+
prContactOptions: () => {
|
|
2902
|
+
const fields = SallaApplePay.detail.requiredShippingContactFields || [];
|
|
2903
|
+
return {
|
|
2904
|
+
requestPayerName: fields.includes('name'),
|
|
2905
|
+
requestPayerEmail: fields.includes('email'),
|
|
2906
|
+
requestPayerPhone: fields.includes('phone'),
|
|
2907
|
+
requestShipping: fields.includes('postalAddress'),
|
|
2908
|
+
shippingType: 'shipping',
|
|
2909
|
+
};
|
|
2910
|
+
},
|
|
2911
|
+
|
|
2912
|
+
startPaymentRequestSession: async function () {
|
|
2913
|
+
// No merchant identifier in config → Apple Pay isn't set up for this
|
|
2914
|
+
// store; bail rather than open a QR sheet that can't be validated.
|
|
2915
|
+
const merchantIdentifier = SallaApplePay.getMerchantIdentifier();
|
|
2916
|
+
if (!merchantIdentifier) {
|
|
2917
|
+
salla.logger.error('🍏 Pay: missing merchant identifier — skipping QR Apple Pay');
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
const version = SallaApplePay.getApplePaySessionVersion();
|
|
2922
|
+
const supportedNetworks = [...(SallaApplePay.detail.supportedNetworks || ['masterCard', 'visa'])];
|
|
2923
|
+
if (version === 5 && !supportedNetworks.includes('mada')) {
|
|
2924
|
+
supportedNetworks.push('mada');
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
const methodData = [{
|
|
2928
|
+
supportedMethods: APPLE_PAY_METHOD,
|
|
2929
|
+
data: {
|
|
2930
|
+
version,
|
|
2931
|
+
merchantIdentifier,
|
|
2932
|
+
merchantCapabilities: ['supports3DS'],
|
|
2933
|
+
supportedNetworks,
|
|
2934
|
+
countryCode: SallaApplePay.detail.countryCode || 'SA',
|
|
2935
|
+
},
|
|
2936
|
+
}];
|
|
2937
|
+
|
|
2938
|
+
const requiresShipping = SallaApplePay.isPhysical();
|
|
2939
|
+
|
|
2940
|
+
const details = {
|
|
2941
|
+
total: SallaApplePay.prTotal(),
|
|
2942
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
2943
|
+
};
|
|
2944
|
+
if (requiresShipping) {
|
|
2945
|
+
details.shippingOptions = SallaApplePay.prShippingOptions();
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
let request;
|
|
2949
|
+
try {
|
|
2950
|
+
request = new PaymentRequest(methodData, details, SallaApplePay.prContactOptions());
|
|
2951
|
+
} catch (error) {
|
|
2952
|
+
salla.logger.error('🍏 Pay: Failed to create PaymentRequest', error);
|
|
2953
|
+
SallaApplePay.detail.onError(salla.lang.get('pages.checkout.payment_failed'));
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
SallaApplePay.paymentRequest = request;
|
|
2958
|
+
|
|
2959
|
+
request.onmerchantvalidation = (event) => {
|
|
2960
|
+
event.complete(SallaApplePay.prValidateMerchant(event));
|
|
2961
|
+
};
|
|
2962
|
+
|
|
2963
|
+
if (requiresShipping) {
|
|
2964
|
+
request.onshippingaddresschange = (event) => {
|
|
2965
|
+
event.updateWith(SallaApplePay.prShippingAddressChange(request));
|
|
2966
|
+
};
|
|
2967
|
+
request.onshippingoptionchange = (event) => {
|
|
2968
|
+
event.updateWith(SallaApplePay.prShippingOptionChange(request));
|
|
2969
|
+
};
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
// Showing the sheet is the QR equivalent of ApplePaySession.begin(): it
|
|
2973
|
+
// must run inside the user gesture (transient activation). Wrapped so the
|
|
2974
|
+
// order-options deferral can drive it — the caller either calls begin()
|
|
2975
|
+
// itself (no options → open the QR sheet now) or discards this request
|
|
2976
|
+
// and the modal's own Apple Pay button starts a fresh one (options found).
|
|
2977
|
+
const beginShow = async () => {
|
|
2978
|
+
// The QR sheet is browser chrome (fixed, top layer) that overlays the
|
|
2979
|
+
// page. Signal open/closed so hosts embedding Apple Pay (e.g. the
|
|
2980
|
+
// mini-checkout modal in an iframe) can hide UI — like their own close
|
|
2981
|
+
// button — that would otherwise collide with the sheet.
|
|
2982
|
+
Salla.event.dispatch('payments::apple-pay.sheet-opened');
|
|
2983
|
+
try {
|
|
2984
|
+
const response = await request.show();
|
|
2985
|
+
SallaApplePay.paymentResponse = response;
|
|
2986
|
+
await SallaApplePay.prPaymentAuthorized(response);
|
|
2987
|
+
} catch (error) {
|
|
2988
|
+
// AbortError → the shopper dismissed the sheet / QR, or merchant
|
|
2989
|
+
// validation rejected. Mirror the native oncancel path so hosts
|
|
2990
|
+
// listening for payments::apple-pay.canceled (to reset checkout UI)
|
|
2991
|
+
// still get notified on a plain dismissal. The `canceled` guard
|
|
2992
|
+
// skips the double-fire when validation already routed through
|
|
2993
|
+
// onCancel via validateMerchant.onFailed.
|
|
2994
|
+
salla.logger.log('🍏 Pay: PaymentRequest closed', error);
|
|
2995
|
+
if (error?.name === 'AbortError' && !SallaApplePay.canceled) {
|
|
2996
|
+
SallaApplePay.onCancel({});
|
|
2997
|
+
}
|
|
2998
|
+
} finally {
|
|
2999
|
+
SallaApplePay.paymentRequest = null;
|
|
3000
|
+
SallaApplePay.paymentResponse = null;
|
|
3001
|
+
Salla.event.dispatch('payments::apple-pay.sheet-closed');
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
|
|
3005
|
+
// Mirror the native path (startNativeSession): expose a hook between
|
|
3006
|
+
// request creation and show(). Returning truthy skips the immediate
|
|
3007
|
+
// show() so the order-options modal can open first. Same shim contract
|
|
3008
|
+
// as native — the caller only needs `.begin()`.
|
|
3009
|
+
let skipBegin;
|
|
3010
|
+
if (typeof SallaApplePay.detail.onStartedSession === 'function') {
|
|
3011
|
+
skipBegin = SallaApplePay.detail.onStartedSession({ begin: beginShow });
|
|
3012
|
+
}
|
|
3013
|
+
if (!skipBegin) {
|
|
3014
|
+
await beginShow();
|
|
3015
|
+
}
|
|
3016
|
+
},
|
|
3017
|
+
|
|
3018
|
+
/** Merchant validation — resolves the promise passed to event.complete(). */
|
|
3019
|
+
prValidateMerchant: async function (event) {
|
|
3020
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.init', event);
|
|
3021
|
+
try {
|
|
3022
|
+
const { data } = await http.post(
|
|
3023
|
+
SallaApplePay.detail.validateMerchant.url.replace('{id}', SallaApplePay.id),
|
|
3024
|
+
{ validation_url: event.validationURL }
|
|
3025
|
+
);
|
|
3026
|
+
|
|
3027
|
+
// The BE can return HTTP 200 while Apple actually rejected the session
|
|
3028
|
+
// (e.g. statusCode 417 "not a registered merchant in WWDR"), with the
|
|
3029
|
+
// real session under data.data. A valid Apple session always carries a
|
|
3030
|
+
// merchantSessionIdentifier; its absence means validation failed. Without
|
|
3031
|
+
// this the QR sheet just closes silently — notify the shopper and abort.
|
|
3032
|
+
if (!data?.data?.merchantSessionIdentifier) {
|
|
3033
|
+
salla.logger.error('🍏 Pay: merchant validation failed', data?.statusMessage || data);
|
|
3034
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', { data });
|
|
3035
|
+
SallaApplePay.onCancel({});
|
|
3036
|
+
// Dismiss the sheet + paired device immediately. Rejecting
|
|
3037
|
+
// event.complete() alone leaves them spinning until Apple's own
|
|
3038
|
+
// timeout; abort() forces an instant close. Deferred a tick so it
|
|
3039
|
+
// runs after this validation update settles (abort() throws if
|
|
3040
|
+
// called while an update is still in flight).
|
|
3041
|
+
setTimeout(() => {
|
|
3042
|
+
try { SallaApplePay.paymentRequest?.abort(); } catch (e) { /* already closing */ }
|
|
3043
|
+
}, 0);
|
|
3044
|
+
const validationError = new Error('Apple Pay merchant validation failed');
|
|
3045
|
+
validationError.handled = true;
|
|
3046
|
+
throw validationError;
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.success', data);
|
|
3050
|
+
|
|
3051
|
+
if (typeof SallaApplePay.detail.validateMerchant.onSuccess === 'function') {
|
|
3052
|
+
const response = await SallaApplePay.detail.validateMerchant.onSuccess(data);
|
|
3053
|
+
if (response?.redirect) {
|
|
3054
|
+
window.location = response.redirect;
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
return data.data;
|
|
3059
|
+
} catch (error) {
|
|
3060
|
+
// Skip when the invalid-session branch above already notified via onCancel.
|
|
3061
|
+
if (!error?.handled) {
|
|
3062
|
+
const response = error?.response;
|
|
3063
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', response);
|
|
3064
|
+
if (typeof SallaApplePay.detail.validateMerchant.onFailed === 'function') {
|
|
3065
|
+
SallaApplePay.detail.validateMerchant.onFailed(response);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
// Rethrow so PaymentRequest aborts the sheet.
|
|
3069
|
+
throw error;
|
|
3070
|
+
}
|
|
3071
|
+
},
|
|
3072
|
+
|
|
3073
|
+
/**
|
|
3074
|
+
* ISO 3166 alpha-2 code → localized country name. The native path sends the
|
|
3075
|
+
* country *name* in `country` (from ApplePayPaymentContact.country) and the
|
|
3076
|
+
* ISO code in `country_code`; W3C PaymentAddress only exposes the ISO code,
|
|
3077
|
+
* so we derive the name the backend expects. Falls back to the code if
|
|
3078
|
+
* Intl.DisplayNames is unavailable or the code is unknown.
|
|
3079
|
+
*/
|
|
3080
|
+
prCountryName: (isoCode) => {
|
|
3081
|
+
if (!isoCode) {
|
|
3082
|
+
return isoCode;
|
|
3083
|
+
}
|
|
3084
|
+
try {
|
|
3085
|
+
const locale = (salla?.config?.get?.('user.language_code')) || 'en';
|
|
3086
|
+
return new Intl.DisplayNames([locale], { type: 'region' }).of(isoCode) || isoCode;
|
|
3087
|
+
} catch (e) {
|
|
3088
|
+
return isoCode;
|
|
3089
|
+
}
|
|
3090
|
+
},
|
|
3091
|
+
|
|
3092
|
+
/** Shipping address selected in the sheet → returns a PaymentDetailsUpdate. */
|
|
3093
|
+
prShippingAddressChange: async function (request) {
|
|
3094
|
+
const address = request.shippingAddress;
|
|
3095
|
+
const fallback = {
|
|
3096
|
+
total: SallaApplePay.prTotal(),
|
|
3097
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3098
|
+
shippingOptions: [],
|
|
3099
|
+
};
|
|
3100
|
+
|
|
3101
|
+
if (!address) {
|
|
3102
|
+
return fallback;
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
try {
|
|
3106
|
+
const { data } = await http.post(
|
|
3107
|
+
SallaApplePay.detail.shippingContactSelected.url.replace('{id}', SallaApplePay.id),
|
|
3108
|
+
{
|
|
3109
|
+
country: SallaApplePay.prCountryName(address.country),
|
|
3110
|
+
city: address.city,
|
|
3111
|
+
local: address.dependentLocality || address.region || address.city,
|
|
3112
|
+
description: address.region,
|
|
3113
|
+
street: (address.addressLine || []).join(', ') || address.region,
|
|
3114
|
+
country_code: address.country,
|
|
3115
|
+
postal_code: address.postalCode,
|
|
3116
|
+
}
|
|
3117
|
+
);
|
|
3118
|
+
|
|
3119
|
+
SallaApplePay.address_id = data.data.address_id;
|
|
3120
|
+
SallaApplePay.shipping_methods = data.data.shipping_methods;
|
|
3121
|
+
|
|
3122
|
+
if (!SallaApplePay.shipping_methods?.length) {
|
|
3123
|
+
return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
await SallaApplePay.selectApplePayShippingMethod(SallaApplePay.shipping_methods[0]);
|
|
3127
|
+
await SallaApplePay.recalculateTotal();
|
|
3128
|
+
|
|
3129
|
+
return {
|
|
3130
|
+
total: SallaApplePay.prTotal(),
|
|
3131
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3132
|
+
shippingOptions: SallaApplePay.prShippingOptions(),
|
|
3133
|
+
};
|
|
3134
|
+
} catch (error) {
|
|
3135
|
+
salla.logger.warn('🍏 Pay: PR shipping address change failed', error);
|
|
3136
|
+
return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
|
|
3137
|
+
}
|
|
3138
|
+
},
|
|
3139
|
+
|
|
3140
|
+
/** Shipping option selected in the sheet → returns a PaymentDetailsUpdate. */
|
|
3141
|
+
prShippingOptionChange: async function (request) {
|
|
3142
|
+
const identifier = request.shippingOption;
|
|
3143
|
+
if (!identifier) {
|
|
3144
|
+
return {
|
|
3145
|
+
total: SallaApplePay.prTotal(),
|
|
3146
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3147
|
+
shippingOptions: SallaApplePay.prShippingOptions(),
|
|
3148
|
+
};
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
const ids = identifier.split(',');
|
|
3152
|
+
const shippingMethod = {
|
|
3153
|
+
ship_id: ids[0],
|
|
3154
|
+
private_ship_id: typeof ids[1] === 'undefined' ? null : ids[1],
|
|
3155
|
+
type: typeof ids[2] === 'undefined' ? null : ids[2],
|
|
3156
|
+
route_id: typeof ids[3] === 'undefined' ? null : ids[3],
|
|
3157
|
+
};
|
|
3158
|
+
|
|
3159
|
+
try {
|
|
3160
|
+
if (SallaApplePay.shouldUpdateShippingCompany(shippingMethod)) {
|
|
3161
|
+
await SallaApplePay.selectApplePayShippingMethod(shippingMethod);
|
|
3162
|
+
await SallaApplePay.recalculateTotal();
|
|
3163
|
+
}
|
|
3164
|
+
return {
|
|
3165
|
+
total: SallaApplePay.prTotal(),
|
|
3166
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3167
|
+
shippingOptions: SallaApplePay.prShippingOptions(identifier),
|
|
3168
|
+
};
|
|
3169
|
+
} catch (error) {
|
|
3170
|
+
salla.logger.warn('🍏 Pay: PR shipping option change failed', error);
|
|
3171
|
+
return {
|
|
3172
|
+
total: SallaApplePay.prTotal(),
|
|
3173
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3174
|
+
shippingOptions: SallaApplePay.prShippingOptions(identifier),
|
|
3175
|
+
error: salla.lang.get('pages.checkout.payment_failed'),
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
},
|
|
3179
|
+
|
|
3180
|
+
/** Map the PaymentResponse payer fields to the contact shape the API expects. */
|
|
3181
|
+
prContactFromResponse: (response) => {
|
|
3182
|
+
const name = (response.payerName || '').trim();
|
|
3183
|
+
const spaceIndex = name.indexOf(' ');
|
|
3184
|
+
return {
|
|
3185
|
+
givenName: spaceIndex > -1 ? name.slice(0, spaceIndex) : name,
|
|
3186
|
+
familyName: spaceIndex > -1 ? name.slice(spaceIndex + 1) : '',
|
|
3187
|
+
emailAddress: response.payerEmail || null,
|
|
3188
|
+
phoneNumber: response.payerPhone || null,
|
|
3189
|
+
countryCode: response.shippingAddress?.country || SallaApplePay.detail.countryCode || null,
|
|
3190
|
+
};
|
|
3191
|
+
},
|
|
3192
|
+
|
|
3193
|
+
/** Authorize + submit the payment, then close the sheet. */
|
|
3194
|
+
prPaymentAuthorized: async function (response) {
|
|
3195
|
+
// Guest checkout → persist the payer contact before submitting.
|
|
3196
|
+
if (SallaApplePay.detail.guestContactSelected) {
|
|
3197
|
+
const contact = SallaApplePay.prContactFromResponse(response);
|
|
3198
|
+
|
|
3199
|
+
// Require familyName too, mirroring the native guest guard
|
|
3200
|
+
// (utils.js mutateShippingContact). Keeps the payload the backend
|
|
3201
|
+
// receives identical to the production native flow — it has only
|
|
3202
|
+
// ever been sent a non-empty last_name from Apple Pay guest checkout.
|
|
3203
|
+
if (!contact.emailAddress || !contact.givenName || !contact.familyName || !contact.phoneNumber) {
|
|
3204
|
+
await response.complete('fail');
|
|
3205
|
+
SallaApplePay.detail.onError(salla.lang.get('common.messages.required_fields'));
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
try {
|
|
3210
|
+
await http.post(
|
|
3211
|
+
SallaApplePay.detail.guestContactSelected.url.replace('{id}', SallaApplePay.id),
|
|
3212
|
+
{
|
|
3213
|
+
email: contact.emailAddress,
|
|
3214
|
+
first_name: contact.givenName,
|
|
3215
|
+
last_name: contact.familyName,
|
|
3216
|
+
phone_number: contact.phoneNumber,
|
|
3217
|
+
country_code: contact.countryCode,
|
|
3218
|
+
}
|
|
3219
|
+
);
|
|
3220
|
+
} catch (error) {
|
|
3221
|
+
await response.complete('fail');
|
|
3222
|
+
SallaApplePay.detail.onError(
|
|
3223
|
+
error?.response?.data?.error?.message || salla.lang.get('pages.checkout.payment_failed')
|
|
3224
|
+
);
|
|
3225
|
+
return;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
Salla.event.dispatch('payments::apple-pay.authorized.init', response);
|
|
3230
|
+
|
|
3231
|
+
let authorizedData;
|
|
3232
|
+
try {
|
|
3233
|
+
const { data } = await http.post(
|
|
3234
|
+
SallaApplePay.detail.authorized.url.replace('{id}', SallaApplePay.id),
|
|
3235
|
+
{ payment_method: 'apple_pay', applepay_token: JSON.stringify(response.details) }
|
|
3236
|
+
);
|
|
3237
|
+
|
|
3238
|
+
authorizedData = data;
|
|
3239
|
+
Salla.event.dispatch('payments::apple-pay.authorized.success', data);
|
|
3240
|
+
await response.complete('success');
|
|
3241
|
+
} catch (error) {
|
|
3242
|
+
const errorResponse = error?.response;
|
|
3243
|
+
Salla.event.dispatch('payments::apple-pay.authorized.failed', errorResponse);
|
|
3244
|
+
await response.complete('fail');
|
|
3245
|
+
if (typeof SallaApplePay.detail.authorized.onFailed === 'function') {
|
|
3246
|
+
SallaApplePay.detail.authorized.onFailed(errorResponse);
|
|
3247
|
+
}
|
|
3248
|
+
return;
|
|
3249
|
+
}
|
|
3250
|
+
|
|
3251
|
+
// response.complete() has already run above, and it can only be called
|
|
3252
|
+
// once. Run the merchant onSuccess callback OUTSIDE the try/catch so a
|
|
3253
|
+
// throw here (e.g. redirect handling) can't fall into the catch and fire
|
|
3254
|
+
// a second complete('fail') → InvalidStateError that masks the real error.
|
|
3255
|
+
if (typeof SallaApplePay.detail.authorized.onSuccess === 'function') {
|
|
3256
|
+
SallaApplePay.detail.authorized.onSuccess(authorizedData);
|
|
3257
|
+
}
|
|
3258
|
+
},
|
|
3259
|
+
|
|
2686
3260
|
shouldUpdateShippingCompany(shippingCompany) {
|
|
2687
3261
|
return SallaApplePay.shippingCompany?.ship_id != shippingCompany?.ship_id || SallaApplePay.shippingCompany?.private_ship_id != shippingCompany?.private_ship_id
|
|
2688
3262
|
},
|
|
@@ -2806,8 +3380,10 @@ if (typeof window !== 'undefined') {
|
|
|
2806
3380
|
}
|
|
2807
3381
|
|
|
2808
3382
|
//applePay doesn't allow iframes
|
|
2809
|
-
// SSR-safe
|
|
2810
|
-
|
|
3383
|
+
// SSR-safe (init only in the browser). Native (Safari) OR any browser with the
|
|
3384
|
+
// Payment Request API (non-Safari / QR-code fallback) can start a transaction;
|
|
3385
|
+
// capability is confirmed per-flow.
|
|
3386
|
+
if (typeof window !== 'undefined' && (SallaApplePay.canUseNative() || window.PaymentRequest)) {
|
|
2811
3387
|
SallaApplePay.init();
|
|
2812
3388
|
} else if (typeof document !== 'undefined') {
|
|
2813
3389
|
// You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
|
|
@@ -3022,16 +3598,12 @@ const SallaQuickBuy = class {
|
|
|
3022
3598
|
currency: this.currency || salla.config.get('store.settings.buy_now.currency') || 'SAR', // SAR
|
|
3023
3599
|
requiredShippingContactFields: this.getRequiredShippingContactFields(),
|
|
3024
3600
|
shippingMethods: this.isRequireShipping ? [] : undefined,
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks')),
|
|
3030
|
-
supportedCountries: this.isLegacyBuyNowBE()
|
|
3031
|
-
? salla.config.get('store.settings.buy_now.countries')
|
|
3032
|
-
: ((Array.isArray(this.supportedCountries) && this.supportedCountries.length)
|
|
3033
|
-
? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries')),
|
|
3601
|
+
supportedNetworks: (Array.isArray(this.supportedNetworks) && this.supportedNetworks.length)
|
|
3602
|
+
? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks'),
|
|
3603
|
+
supportedCountries: (Array.isArray(this.supportedCountries) && this.supportedCountries.length)
|
|
3604
|
+
? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries'),
|
|
3034
3605
|
countryCode: salla.config.get('store.store_country') || 'SA',
|
|
3606
|
+
merchantIdentifier: applePayMerchantId(),
|
|
3035
3607
|
onStartedSession: this.handleApplePaySessionStarted,
|
|
3036
3608
|
validateMerchant: {
|
|
3037
3609
|
url: this.validateHost ? `${this.validateHost}/checkout/applepay/validate` : salla.url.get('checkout/applepay/validate'),
|
|
@@ -3107,21 +3679,8 @@ const SallaQuickBuy = class {
|
|
|
3107
3679
|
}
|
|
3108
3680
|
return fields;
|
|
3109
3681
|
}
|
|
3110
|
-
/**
|
|
3111
|
-
* TEMPORARY for BE Vip sync
|
|
3112
|
-
*/
|
|
3113
|
-
isLegacyBuyNowBE() {
|
|
3114
|
-
return salla?.config?.get?.('store.settings.buy_now.multi_currency') != null;
|
|
3115
|
-
}
|
|
3116
3682
|
/** Set Apple Pay amount + currency from a price payload, always keeping the pair in one currency. */
|
|
3117
3683
|
applyBaseCurrencyPrice(data) {
|
|
3118
|
-
// Legacy BE: amount only; currency is set once in runInit.
|
|
3119
|
-
if (this.isLegacyBuyNowBE()) {
|
|
3120
|
-
if (data?.price != null) {
|
|
3121
|
-
this.amount = data.price;
|
|
3122
|
-
}
|
|
3123
|
-
return;
|
|
3124
|
-
}
|
|
3125
3684
|
const base = data?.base_currency_price;
|
|
3126
3685
|
// Unified BE base pair (regular products): charge in base currency.
|
|
3127
3686
|
if (base?.amount != null) {
|
|
@@ -3143,11 +3702,6 @@ const SallaQuickBuy = class {
|
|
|
3143
3702
|
const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
|
|
3144
3703
|
this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
|
|
3145
3704
|
const runInit = async () => {
|
|
3146
|
-
if (this.isLegacyBuyNowBE() && !this.currency && salla?.config?.get) {
|
|
3147
|
-
// Legacy BE (pre-PR): currency from the multi_currency flag. The unified BE instead
|
|
3148
|
-
// sources amount + currency from `base_currency_price` (see applyBaseCurrencyPrice).
|
|
3149
|
-
this.currency = salla.config.get('store.settings.buy_now.multi_currency') ? salla.config.get('user.currency_code') : (salla.config.get('store.settings.buy_now.currency') || 'SAR');
|
|
3150
|
-
}
|
|
3151
3705
|
if (!this.productId && salla?.config?.get && salla.url?.is_page) {
|
|
3152
3706
|
this.productId = salla.config.get('page.id');
|
|
3153
3707
|
}
|
|
@@ -3173,16 +3727,19 @@ const SallaQuickBuy = class {
|
|
|
3173
3727
|
else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
|
|
3174
3728
|
salla.product.event.onPriceUpdated(response => { this.applyBaseCurrencyPrice(response?.data); });
|
|
3175
3729
|
}
|
|
3176
|
-
|
|
3177
|
-
&& (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
|
|
3730
|
+
const storeAllowsApplePay = (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
|
|
3178
3731
|
&& (salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? isSallaGateway);
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3732
|
+
// Preload Apple's JS SDK so the rendered <apple-pay-button> upgrades on
|
|
3733
|
+
// every flow (native Safari + QR). Fire-and-forget: the element upgrades
|
|
3734
|
+
// retroactively once the script defines it.
|
|
3735
|
+
if (storeAllowsApplePay) {
|
|
3736
|
+
ensureApplePaySdk();
|
|
3737
|
+
}
|
|
3738
|
+
// Cross-browser capability: native (Safari) OR the Payment Request API
|
|
3739
|
+
// (non-Safari browsers / non-Apple devices via the QR-code fallback). The
|
|
3740
|
+
// helper loads Apple's JS SDK and awaits it before probing, so this is a
|
|
3741
|
+
// stable answer on first load (no race against the async script fetch).
|
|
3742
|
+
this.isApplePayActive = storeAllowsApplePay && await canCompleteApplePay(this.currency);
|
|
3186
3743
|
};
|
|
3187
3744
|
return new Promise((resolve) => {
|
|
3188
3745
|
if (typeof salla?.onReady === 'function') {
|
|
@@ -3194,7 +3751,7 @@ const SallaQuickBuy = class {
|
|
|
3194
3751
|
});
|
|
3195
3752
|
}
|
|
3196
3753
|
render() {
|
|
3197
|
-
return h(Host, { key: '
|
|
3754
|
+
return h(Host, { key: '100f3cd501d568084f3596f5cef7c9b744f7ec82' }, this.quickBuyButton());
|
|
3198
3755
|
}
|
|
3199
3756
|
quickBuyButton() {
|
|
3200
3757
|
return h("apple-pay-button", { locale: salla?.config?.get?.('user.language_code') || 'ar', onClick: () => this.quickBuyHandler(), "data-quick-purchase": "applepay", class: "s-quick-buy-apple-pay", "data-is-applepay": "1", buttonstyle: "black", type: this.type });
|