@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
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var index = require('./index-
|
|
6
|
+
var index = require('./index-C5ZvHCin.js');
|
|
7
7
|
var cart = require('./cart-s-x1Fshk.js');
|
|
8
|
-
var Helper = require('./Helper-
|
|
8
|
+
var Helper = require('./Helper-6RI07gZo.js');
|
|
9
9
|
var catalogRecommendations = require('./catalog-recommendations-dtK9Dlfw.js');
|
|
10
10
|
var bellRing = require('./bell-ring-BfKPinNo.js');
|
|
11
11
|
var interfaces = require('./interfaces-Bh7W0bEU.js');
|
|
@@ -20,6 +20,135 @@ var WalletIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
20
20
|
</svg>
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Shared Apple Pay support helpers: SDK loading, capability detection, merchant
|
|
25
|
+
* identifier resolution, and Payment Request method-data construction.
|
|
26
|
+
*
|
|
27
|
+
* Lives in @salla.sa/applepay (not a theme) because it is Apple Pay domain
|
|
28
|
+
* logic and is consumed by every Apple Pay entry point — the storefront
|
|
29
|
+
* components (salla-quick-buy, salla-add-product-button) and the shared
|
|
30
|
+
* SallaApplePay session in ./index.js.
|
|
31
|
+
*
|
|
32
|
+
* Apple Pay runs through two flows:
|
|
33
|
+
* - Native (Safari / Apple devices) → window.ApplePaySession
|
|
34
|
+
* - Payment Request API (other browsers) → Apple's "Scan Code with iPhone"
|
|
35
|
+
* QR sheet, which requires Apple's JS SDK to be *loaded and registered*
|
|
36
|
+
* before PaymentRequest.canMakePayment() reports the method as available.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
const APPLE_PAY_METHOD$1 = 'https://apple.com/apple-pay';
|
|
40
|
+
const APPLE_PAY_SDK_ID = 'apple-pay-sdk';
|
|
41
|
+
const APPLE_PAY_SDK_SRC = 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js';
|
|
42
|
+
|
|
43
|
+
let sdkPromise = null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Salla-native Apple merchant identifier, sourced from store settings. Returns
|
|
47
|
+
* null when the store has no Apple Pay merchant configured — callers treat that
|
|
48
|
+
* absence as the guard and skip Apple Pay entirely (no hardcoded fallback).
|
|
49
|
+
* @returns {string|null}
|
|
50
|
+
*/
|
|
51
|
+
function applePayMerchantId() {
|
|
52
|
+
return salla?.config?.get?.('store.settings.buy_now.merchant_identifier') || null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Build the W3C Payment Request `methodData` for the Apple Pay method. Callers
|
|
57
|
+
* supply the values (the probe reads them from config; the live session reads
|
|
58
|
+
* them from the transaction detail), this owns the constant scaffold so the two
|
|
59
|
+
* can't drift apart.
|
|
60
|
+
* @param {{ version: number, merchantIdentifier: string, supportedNetworks: string[], countryCode: string }} opts
|
|
61
|
+
* @returns {PaymentMethodData[]}
|
|
62
|
+
*/
|
|
63
|
+
function buildApplePayMethodData({ version, merchantIdentifier, supportedNetworks, countryCode }) {
|
|
64
|
+
return [{
|
|
65
|
+
supportedMethods: APPLE_PAY_METHOD$1,
|
|
66
|
+
data: {
|
|
67
|
+
version,
|
|
68
|
+
merchantIdentifier,
|
|
69
|
+
merchantCapabilities: ['supports3DS'],
|
|
70
|
+
supportedNetworks,
|
|
71
|
+
countryCode,
|
|
72
|
+
},
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Inject Apple's Pay JS SDK (`1.latest` ships the cross-browser / QR support)
|
|
78
|
+
* and resolve once it has loaded. Idempotent: a second call reuses the same
|
|
79
|
+
* in-flight promise and never appends a second <script>. Resolves (rather than
|
|
80
|
+
* rejects) on load error so a failed CDN fetch simply falls back to "no QR".
|
|
81
|
+
* @returns {Promise<void>}
|
|
82
|
+
*/
|
|
83
|
+
function ensureApplePaySdk() {
|
|
84
|
+
if (typeof document === 'undefined') return Promise.resolve();
|
|
85
|
+
|
|
86
|
+
if (sdkPromise) return sdkPromise;
|
|
87
|
+
|
|
88
|
+
const existing = document.getElementById(APPLE_PAY_SDK_ID);
|
|
89
|
+
if (existing) {
|
|
90
|
+
// Script already in the DOM (e.g. added before this refactor). We can't know
|
|
91
|
+
// if it finished loading, so resolve immediately — the native/PaymentRequest
|
|
92
|
+
// probe will just report unavailable until the browser registers the method.
|
|
93
|
+
sdkPromise = Promise.resolve();
|
|
94
|
+
return sdkPromise;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
sdkPromise = new Promise((resolve) => {
|
|
98
|
+
const script = document.createElement('script');
|
|
99
|
+
script.src = APPLE_PAY_SDK_SRC;
|
|
100
|
+
script.setAttribute('id', APPLE_PAY_SDK_ID);
|
|
101
|
+
script.async = true;
|
|
102
|
+
script.onload = () => resolve();
|
|
103
|
+
script.onerror = () => resolve();
|
|
104
|
+
document.body.appendChild(script);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return sdkPromise;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Whether Apple Pay can be completed in the current browser: natively
|
|
112
|
+
* (Safari / Apple devices) or via the Payment Request API (non-Safari browsers
|
|
113
|
+
* / non-Apple devices → QR-code fallback).
|
|
114
|
+
*
|
|
115
|
+
* For the QR path this awaits the SDK before probing, so callers get a stable
|
|
116
|
+
* answer on first load instead of racing the async script fetch.
|
|
117
|
+
* @param {string} [currency]
|
|
118
|
+
* @returns {Promise<boolean>}
|
|
119
|
+
*/
|
|
120
|
+
async function canCompleteApplePay(currency = 'SAR') {
|
|
121
|
+
try {
|
|
122
|
+
if (window.ApplePaySession?.canMakePayments?.()) return true;
|
|
123
|
+
} catch (e) { /* not supported natively */ }
|
|
124
|
+
|
|
125
|
+
if (typeof window === 'undefined' || !window.PaymentRequest) return false;
|
|
126
|
+
|
|
127
|
+
// QR path only: it can't validate the merchant without a merchant identifier,
|
|
128
|
+
// so treat a missing config key as the guard. Native (above) is unaffected —
|
|
129
|
+
// it never uses the client-side merchant id.
|
|
130
|
+
if (!applePayMerchantId()) return false;
|
|
131
|
+
|
|
132
|
+
await ensureApplePaySdk();
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
const request = new PaymentRequest(
|
|
136
|
+
buildApplePayMethodData({
|
|
137
|
+
version: 3,
|
|
138
|
+
merchantIdentifier: applePayMerchantId(),
|
|
139
|
+
supportedNetworks: salla?.config?.get?.('store.settings.buy_now.supportedNetworks')
|
|
140
|
+
|| salla?.config?.get?.('store.settings.buy_now.networks')
|
|
141
|
+
|| ['masterCard', 'visa'],
|
|
142
|
+
countryCode: salla?.config?.get?.('store.store_country') || 'SA',
|
|
143
|
+
}),
|
|
144
|
+
{ total: { label: 'Salla', amount: { currency: currency || 'SAR', value: '0.00' } } },
|
|
145
|
+
);
|
|
146
|
+
return await request.canMakePayment();
|
|
147
|
+
} catch (e) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
23
152
|
/**
|
|
24
153
|
* Order-options gate for the fast-checkout widget — keeps <salla-add-product-button> thin.
|
|
25
154
|
* Intercepts the widget click → runs the order-options modal → injects the result → re-fires the click.
|
|
@@ -303,16 +432,18 @@ const SallaAddProductButton = class {
|
|
|
303
432
|
}
|
|
304
433
|
componentWillLoad() {
|
|
305
434
|
return salla.onReady()
|
|
306
|
-
.then(() => {
|
|
435
|
+
.then(async () => {
|
|
307
436
|
// this to fix not added hydrated class to html element after components loaded
|
|
308
437
|
document.documentElement.classList.add('hydrated');
|
|
309
438
|
this.showQuickBuy = this.quickBuy
|
|
310
439
|
&& salla.config.get('store.settings.buy_now')
|
|
311
440
|
&& this.productStatus == 'sale'
|
|
312
441
|
&& this.productType !== 'booking';
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
442
|
+
// Cross-browser Apple Pay: native (Safari) OR the Payment Request API
|
|
443
|
+
// (non-Safari browsers / non-Apple devices via the QR-code fallback).
|
|
444
|
+
this.isApplePayActive = salla.config.get('store.settings.payments')?.includes('apple_pay')
|
|
445
|
+
&& salla.config.get('store.settings.is_salla_gateway', false)
|
|
446
|
+
&& await canCompleteApplePay();
|
|
316
447
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
317
448
|
if (!!this.passedLabel && this.isDesktopViewport) {
|
|
318
449
|
return this.btn?.setText(this.passedLabel);
|
|
@@ -1835,9 +1966,6 @@ const SallaProductOptions = class {
|
|
|
1835
1966
|
};
|
|
1836
1967
|
SallaProductOptions.style = sallaProductOptionsCss;
|
|
1837
1968
|
|
|
1838
|
-
// display currency (these requests use the global axios, not salla's instance). Legacy-BE stores
|
|
1839
|
-
// (isLegacyBuyNowBE) keep the old behavior — no override. Set once on the axios defaults so
|
|
1840
|
-
// every method inherits it without overriding the rest of the headers.
|
|
1841
1969
|
function setBaseCurrencyHeader() {
|
|
1842
1970
|
index.axios.defaults.headers.common.currency = salla?.config?.get?.('user.currency_code');
|
|
1843
1971
|
}
|
|
@@ -2223,6 +2351,14 @@ if (typeof window !== 'undefined') {
|
|
|
2223
2351
|
window.Salla.Payments = window.Salla.Payments || {};
|
|
2224
2352
|
}
|
|
2225
2353
|
|
|
2354
|
+
// Apple Pay method identifier for the W3C Payment Request API.
|
|
2355
|
+
const APPLE_PAY_METHOD = 'https://apple.com/apple-pay';
|
|
2356
|
+
|
|
2357
|
+
// Captured at module load, before the Apple Pay SDK is injected: real Safari /
|
|
2358
|
+
// Apple devices expose `ApplePaySession` natively, whereas non-Safari browsers
|
|
2359
|
+
// only get it once the SDK loads. Keeps native-vs-PaymentRequest routing stable.
|
|
2360
|
+
const HAS_NATIVE_APPLE_PAY = typeof window !== 'undefined' && !!window.ApplePaySession;
|
|
2361
|
+
|
|
2226
2362
|
/**
|
|
2227
2363
|
* Full Example
|
|
2228
2364
|
*
|
|
@@ -2266,6 +2402,11 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2266
2402
|
countryCode: null,
|
|
2267
2403
|
totals: [],
|
|
2268
2404
|
shippingCompany: null,
|
|
2405
|
+
// Set true once onCancel has fired for the current transaction, so the
|
|
2406
|
+
// QR (PaymentRequest) dismissal catch can notify on a plain sheet-close
|
|
2407
|
+
// without double-firing when a prior handler (e.g. merchant validation)
|
|
2408
|
+
// already routed through onCancel. Reset at the start of each transaction.
|
|
2409
|
+
canceled: false,
|
|
2269
2410
|
init: function () {
|
|
2270
2411
|
document.removeEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
|
|
2271
2412
|
Salla.event.addEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
|
|
@@ -2328,14 +2469,52 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2328
2469
|
return SallaApplePay.detail?.requiredShippingContactFields?.includes('postalAddress');
|
|
2329
2470
|
},
|
|
2330
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* Whether the native Apple Pay flow (Safari / Apple devices) can run. Gated
|
|
2474
|
+
* on the module-load capture so the SDK loading later can't flip a
|
|
2475
|
+
* non-Safari browser into the native path.
|
|
2476
|
+
*/
|
|
2477
|
+
canUseNative: function () {
|
|
2478
|
+
if (!HAS_NATIVE_APPLE_PAY) {
|
|
2479
|
+
return false;
|
|
2480
|
+
}
|
|
2481
|
+
try {
|
|
2482
|
+
return ApplePaySession.canMakePayments();
|
|
2483
|
+
} catch (e) {
|
|
2484
|
+
return false;
|
|
2485
|
+
}
|
|
2486
|
+
},
|
|
2487
|
+
|
|
2488
|
+
// Sourced from config (via the transaction detail). No fallback: a missing
|
|
2489
|
+
// identifier means Apple Pay isn't configured for this store, and callers
|
|
2490
|
+
// treat that null as the guard to skip Apple Pay.
|
|
2491
|
+
getMerchantIdentifier: function () {
|
|
2492
|
+
return (SallaApplePay.detail && SallaApplePay.detail.merchantIdentifier) || null;
|
|
2493
|
+
},
|
|
2494
|
+
|
|
2331
2495
|
startSession: async function (event) {
|
|
2332
2496
|
|
|
2333
2497
|
SallaApplePay.detail = event.detail || event;
|
|
2334
2498
|
|
|
2499
|
+
// Fresh transaction → clear any cancel flag from a previous attempt.
|
|
2500
|
+
SallaApplePay.canceled = false;
|
|
2501
|
+
|
|
2335
2502
|
salla.log('🍏 Pay: payments::apple-pay.start-transaction', SallaApplePay.detail);
|
|
2336
2503
|
|
|
2337
2504
|
SallaApplePay.initDefault();
|
|
2338
2505
|
|
|
2506
|
+
// Native (Safari / Apple devices) → classic ApplePaySession. Otherwise
|
|
2507
|
+
// (non-Safari / non-Apple device) → Payment Request API, which renders
|
|
2508
|
+
// Apple's "Scan Code with iPhone" QR sheet.
|
|
2509
|
+
if (!SallaApplePay.canUseNative()) {
|
|
2510
|
+
return SallaApplePay.startPaymentRequestSession(event);
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
return SallaApplePay.startNativeSession(event);
|
|
2514
|
+
},
|
|
2515
|
+
|
|
2516
|
+
startNativeSession: async function (event) {
|
|
2517
|
+
|
|
2339
2518
|
let version = SallaApplePay.getApplePaySessionVersion();
|
|
2340
2519
|
// Normalize to an array: the backend can serialize the networks list as a JSON object
|
|
2341
2520
|
// (non-sequential PHP array keys). Copy it so we never mutate the shared `detail` reference.
|
|
@@ -2469,6 +2648,7 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2469
2648
|
},
|
|
2470
2649
|
|
|
2471
2650
|
onCancel: (event = {}, message = null) => {
|
|
2651
|
+
SallaApplePay.canceled = true;
|
|
2472
2652
|
SallaApplePay.detail.onError(message || salla.lang.get('pages.checkout.payment_failed'));
|
|
2473
2653
|
Salla.event.createAndDispatch('payments::apple-pay.canceled', event);
|
|
2474
2654
|
},
|
|
@@ -2685,6 +2865,400 @@ const SallaApplePay = typeof window !== 'undefined' ? {
|
|
|
2685
2865
|
}
|
|
2686
2866
|
},
|
|
2687
2867
|
|
|
2868
|
+
/* -------------------------------------------------------------------------
|
|
2869
|
+
* Payment Request API flow (non-Safari browsers / non-Apple devices).
|
|
2870
|
+
* Apple renders the "Scan Code with iPhone" QR sheet. Reuses the same
|
|
2871
|
+
* backend endpoints (validate / address / shipping / recalculate / submit)
|
|
2872
|
+
* as the native flow; only the sheet-completion model differs
|
|
2873
|
+
* (event.updateWith / response.complete instead of session.completeXxx).
|
|
2874
|
+
* ---------------------------------------------------------------------- */
|
|
2875
|
+
|
|
2876
|
+
paymentRequest: null,
|
|
2877
|
+
paymentResponse: null,
|
|
2878
|
+
|
|
2879
|
+
getCurrency: () => SallaApplePay.detail.currency || 'SAR',
|
|
2880
|
+
|
|
2881
|
+
prAmount: (value) => ({ currency: SallaApplePay.getCurrency(), value: String(value) }),
|
|
2882
|
+
|
|
2883
|
+
prTotal: () => {
|
|
2884
|
+
const total = SallaApplePay.prepareTotal();
|
|
2885
|
+
return { label: total.label, amount: SallaApplePay.prAmount(total.amount) };
|
|
2886
|
+
},
|
|
2887
|
+
|
|
2888
|
+
prDisplayItems: () => SallaApplePay.prepareLineItems().map(item => ({
|
|
2889
|
+
label: item.label,
|
|
2890
|
+
amount: SallaApplePay.prAmount(item.amount),
|
|
2891
|
+
})),
|
|
2892
|
+
|
|
2893
|
+
prShippingOptions: (selectedId = null) => {
|
|
2894
|
+
const options = SallaApplePay.mappingShippingMethods(SallaApplePay.shipping_methods || []);
|
|
2895
|
+
return options.map((option, index) => ({
|
|
2896
|
+
id: option.identifier,
|
|
2897
|
+
label: option.label,
|
|
2898
|
+
amount: SallaApplePay.prAmount(option.amount),
|
|
2899
|
+
selected: selectedId ? option.identifier === selectedId : index === 0,
|
|
2900
|
+
}));
|
|
2901
|
+
},
|
|
2902
|
+
|
|
2903
|
+
prContactOptions: () => {
|
|
2904
|
+
const fields = SallaApplePay.detail.requiredShippingContactFields || [];
|
|
2905
|
+
return {
|
|
2906
|
+
requestPayerName: fields.includes('name'),
|
|
2907
|
+
requestPayerEmail: fields.includes('email'),
|
|
2908
|
+
requestPayerPhone: fields.includes('phone'),
|
|
2909
|
+
requestShipping: fields.includes('postalAddress'),
|
|
2910
|
+
shippingType: 'shipping',
|
|
2911
|
+
};
|
|
2912
|
+
},
|
|
2913
|
+
|
|
2914
|
+
startPaymentRequestSession: async function () {
|
|
2915
|
+
// No merchant identifier in config → Apple Pay isn't set up for this
|
|
2916
|
+
// store; bail rather than open a QR sheet that can't be validated.
|
|
2917
|
+
const merchantIdentifier = SallaApplePay.getMerchantIdentifier();
|
|
2918
|
+
if (!merchantIdentifier) {
|
|
2919
|
+
salla.logger.error('🍏 Pay: missing merchant identifier — skipping QR Apple Pay');
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
const version = SallaApplePay.getApplePaySessionVersion();
|
|
2924
|
+
const supportedNetworks = [...(SallaApplePay.detail.supportedNetworks || ['masterCard', 'visa'])];
|
|
2925
|
+
if (version === 5 && !supportedNetworks.includes('mada')) {
|
|
2926
|
+
supportedNetworks.push('mada');
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
const methodData = [{
|
|
2930
|
+
supportedMethods: APPLE_PAY_METHOD,
|
|
2931
|
+
data: {
|
|
2932
|
+
version,
|
|
2933
|
+
merchantIdentifier,
|
|
2934
|
+
merchantCapabilities: ['supports3DS'],
|
|
2935
|
+
supportedNetworks,
|
|
2936
|
+
countryCode: SallaApplePay.detail.countryCode || 'SA',
|
|
2937
|
+
},
|
|
2938
|
+
}];
|
|
2939
|
+
|
|
2940
|
+
const requiresShipping = SallaApplePay.isPhysical();
|
|
2941
|
+
|
|
2942
|
+
const details = {
|
|
2943
|
+
total: SallaApplePay.prTotal(),
|
|
2944
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
2945
|
+
};
|
|
2946
|
+
if (requiresShipping) {
|
|
2947
|
+
details.shippingOptions = SallaApplePay.prShippingOptions();
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
let request;
|
|
2951
|
+
try {
|
|
2952
|
+
request = new PaymentRequest(methodData, details, SallaApplePay.prContactOptions());
|
|
2953
|
+
} catch (error) {
|
|
2954
|
+
salla.logger.error('🍏 Pay: Failed to create PaymentRequest', error);
|
|
2955
|
+
SallaApplePay.detail.onError(salla.lang.get('pages.checkout.payment_failed'));
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
SallaApplePay.paymentRequest = request;
|
|
2960
|
+
|
|
2961
|
+
request.onmerchantvalidation = (event) => {
|
|
2962
|
+
event.complete(SallaApplePay.prValidateMerchant(event));
|
|
2963
|
+
};
|
|
2964
|
+
|
|
2965
|
+
if (requiresShipping) {
|
|
2966
|
+
request.onshippingaddresschange = (event) => {
|
|
2967
|
+
event.updateWith(SallaApplePay.prShippingAddressChange(request));
|
|
2968
|
+
};
|
|
2969
|
+
request.onshippingoptionchange = (event) => {
|
|
2970
|
+
event.updateWith(SallaApplePay.prShippingOptionChange(request));
|
|
2971
|
+
};
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
// Showing the sheet is the QR equivalent of ApplePaySession.begin(): it
|
|
2975
|
+
// must run inside the user gesture (transient activation). Wrapped so the
|
|
2976
|
+
// order-options deferral can drive it — the caller either calls begin()
|
|
2977
|
+
// itself (no options → open the QR sheet now) or discards this request
|
|
2978
|
+
// and the modal's own Apple Pay button starts a fresh one (options found).
|
|
2979
|
+
const beginShow = async () => {
|
|
2980
|
+
// The QR sheet is browser chrome (fixed, top layer) that overlays the
|
|
2981
|
+
// page. Signal open/closed so hosts embedding Apple Pay (e.g. the
|
|
2982
|
+
// mini-checkout modal in an iframe) can hide UI — like their own close
|
|
2983
|
+
// button — that would otherwise collide with the sheet.
|
|
2984
|
+
Salla.event.dispatch('payments::apple-pay.sheet-opened');
|
|
2985
|
+
try {
|
|
2986
|
+
const response = await request.show();
|
|
2987
|
+
SallaApplePay.paymentResponse = response;
|
|
2988
|
+
await SallaApplePay.prPaymentAuthorized(response);
|
|
2989
|
+
} catch (error) {
|
|
2990
|
+
// AbortError → the shopper dismissed the sheet / QR, or merchant
|
|
2991
|
+
// validation rejected. Mirror the native oncancel path so hosts
|
|
2992
|
+
// listening for payments::apple-pay.canceled (to reset checkout UI)
|
|
2993
|
+
// still get notified on a plain dismissal. The `canceled` guard
|
|
2994
|
+
// skips the double-fire when validation already routed through
|
|
2995
|
+
// onCancel via validateMerchant.onFailed.
|
|
2996
|
+
salla.logger.log('🍏 Pay: PaymentRequest closed', error);
|
|
2997
|
+
if (error?.name === 'AbortError' && !SallaApplePay.canceled) {
|
|
2998
|
+
SallaApplePay.onCancel({});
|
|
2999
|
+
}
|
|
3000
|
+
} finally {
|
|
3001
|
+
SallaApplePay.paymentRequest = null;
|
|
3002
|
+
SallaApplePay.paymentResponse = null;
|
|
3003
|
+
Salla.event.dispatch('payments::apple-pay.sheet-closed');
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
|
|
3007
|
+
// Mirror the native path (startNativeSession): expose a hook between
|
|
3008
|
+
// request creation and show(). Returning truthy skips the immediate
|
|
3009
|
+
// show() so the order-options modal can open first. Same shim contract
|
|
3010
|
+
// as native — the caller only needs `.begin()`.
|
|
3011
|
+
let skipBegin;
|
|
3012
|
+
if (typeof SallaApplePay.detail.onStartedSession === 'function') {
|
|
3013
|
+
skipBegin = SallaApplePay.detail.onStartedSession({ begin: beginShow });
|
|
3014
|
+
}
|
|
3015
|
+
if (!skipBegin) {
|
|
3016
|
+
await beginShow();
|
|
3017
|
+
}
|
|
3018
|
+
},
|
|
3019
|
+
|
|
3020
|
+
/** Merchant validation — resolves the promise passed to event.complete(). */
|
|
3021
|
+
prValidateMerchant: async function (event) {
|
|
3022
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.init', event);
|
|
3023
|
+
try {
|
|
3024
|
+
const { data } = await http.post(
|
|
3025
|
+
SallaApplePay.detail.validateMerchant.url.replace('{id}', SallaApplePay.id),
|
|
3026
|
+
{ validation_url: event.validationURL }
|
|
3027
|
+
);
|
|
3028
|
+
|
|
3029
|
+
// The BE can return HTTP 200 while Apple actually rejected the session
|
|
3030
|
+
// (e.g. statusCode 417 "not a registered merchant in WWDR"), with the
|
|
3031
|
+
// real session under data.data. A valid Apple session always carries a
|
|
3032
|
+
// merchantSessionIdentifier; its absence means validation failed. Without
|
|
3033
|
+
// this the QR sheet just closes silently — notify the shopper and abort.
|
|
3034
|
+
if (!data?.data?.merchantSessionIdentifier) {
|
|
3035
|
+
salla.logger.error('🍏 Pay: merchant validation failed', data?.statusMessage || data);
|
|
3036
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', { data });
|
|
3037
|
+
SallaApplePay.onCancel({});
|
|
3038
|
+
// Dismiss the sheet + paired device immediately. Rejecting
|
|
3039
|
+
// event.complete() alone leaves them spinning until Apple's own
|
|
3040
|
+
// timeout; abort() forces an instant close. Deferred a tick so it
|
|
3041
|
+
// runs after this validation update settles (abort() throws if
|
|
3042
|
+
// called while an update is still in flight).
|
|
3043
|
+
setTimeout(() => {
|
|
3044
|
+
try { SallaApplePay.paymentRequest?.abort(); } catch (e) { /* already closing */ }
|
|
3045
|
+
}, 0);
|
|
3046
|
+
const validationError = new Error('Apple Pay merchant validation failed');
|
|
3047
|
+
validationError.handled = true;
|
|
3048
|
+
throw validationError;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.success', data);
|
|
3052
|
+
|
|
3053
|
+
if (typeof SallaApplePay.detail.validateMerchant.onSuccess === 'function') {
|
|
3054
|
+
const response = await SallaApplePay.detail.validateMerchant.onSuccess(data);
|
|
3055
|
+
if (response?.redirect) {
|
|
3056
|
+
window.location = response.redirect;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
return data.data;
|
|
3061
|
+
} catch (error) {
|
|
3062
|
+
// Skip when the invalid-session branch above already notified via onCancel.
|
|
3063
|
+
if (!error?.handled) {
|
|
3064
|
+
const response = error?.response;
|
|
3065
|
+
Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', response);
|
|
3066
|
+
if (typeof SallaApplePay.detail.validateMerchant.onFailed === 'function') {
|
|
3067
|
+
SallaApplePay.detail.validateMerchant.onFailed(response);
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
// Rethrow so PaymentRequest aborts the sheet.
|
|
3071
|
+
throw error;
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
|
|
3075
|
+
/**
|
|
3076
|
+
* ISO 3166 alpha-2 code → localized country name. The native path sends the
|
|
3077
|
+
* country *name* in `country` (from ApplePayPaymentContact.country) and the
|
|
3078
|
+
* ISO code in `country_code`; W3C PaymentAddress only exposes the ISO code,
|
|
3079
|
+
* so we derive the name the backend expects. Falls back to the code if
|
|
3080
|
+
* Intl.DisplayNames is unavailable or the code is unknown.
|
|
3081
|
+
*/
|
|
3082
|
+
prCountryName: (isoCode) => {
|
|
3083
|
+
if (!isoCode) {
|
|
3084
|
+
return isoCode;
|
|
3085
|
+
}
|
|
3086
|
+
try {
|
|
3087
|
+
const locale = (salla?.config?.get?.('user.language_code')) || 'en';
|
|
3088
|
+
return new Intl.DisplayNames([locale], { type: 'region' }).of(isoCode) || isoCode;
|
|
3089
|
+
} catch (e) {
|
|
3090
|
+
return isoCode;
|
|
3091
|
+
}
|
|
3092
|
+
},
|
|
3093
|
+
|
|
3094
|
+
/** Shipping address selected in the sheet → returns a PaymentDetailsUpdate. */
|
|
3095
|
+
prShippingAddressChange: async function (request) {
|
|
3096
|
+
const address = request.shippingAddress;
|
|
3097
|
+
const fallback = {
|
|
3098
|
+
total: SallaApplePay.prTotal(),
|
|
3099
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3100
|
+
shippingOptions: [],
|
|
3101
|
+
};
|
|
3102
|
+
|
|
3103
|
+
if (!address) {
|
|
3104
|
+
return fallback;
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
try {
|
|
3108
|
+
const { data } = await http.post(
|
|
3109
|
+
SallaApplePay.detail.shippingContactSelected.url.replace('{id}', SallaApplePay.id),
|
|
3110
|
+
{
|
|
3111
|
+
country: SallaApplePay.prCountryName(address.country),
|
|
3112
|
+
city: address.city,
|
|
3113
|
+
local: address.dependentLocality || address.region || address.city,
|
|
3114
|
+
description: address.region,
|
|
3115
|
+
street: (address.addressLine || []).join(', ') || address.region,
|
|
3116
|
+
country_code: address.country,
|
|
3117
|
+
postal_code: address.postalCode,
|
|
3118
|
+
}
|
|
3119
|
+
);
|
|
3120
|
+
|
|
3121
|
+
SallaApplePay.address_id = data.data.address_id;
|
|
3122
|
+
SallaApplePay.shipping_methods = data.data.shipping_methods;
|
|
3123
|
+
|
|
3124
|
+
if (!SallaApplePay.shipping_methods?.length) {
|
|
3125
|
+
return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
await SallaApplePay.selectApplePayShippingMethod(SallaApplePay.shipping_methods[0]);
|
|
3129
|
+
await SallaApplePay.recalculateTotal();
|
|
3130
|
+
|
|
3131
|
+
return {
|
|
3132
|
+
total: SallaApplePay.prTotal(),
|
|
3133
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3134
|
+
shippingOptions: SallaApplePay.prShippingOptions(),
|
|
3135
|
+
};
|
|
3136
|
+
} catch (error) {
|
|
3137
|
+
salla.logger.warn('🍏 Pay: PR shipping address change failed', error);
|
|
3138
|
+
return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
|
|
3139
|
+
}
|
|
3140
|
+
},
|
|
3141
|
+
|
|
3142
|
+
/** Shipping option selected in the sheet → returns a PaymentDetailsUpdate. */
|
|
3143
|
+
prShippingOptionChange: async function (request) {
|
|
3144
|
+
const identifier = request.shippingOption;
|
|
3145
|
+
if (!identifier) {
|
|
3146
|
+
return {
|
|
3147
|
+
total: SallaApplePay.prTotal(),
|
|
3148
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3149
|
+
shippingOptions: SallaApplePay.prShippingOptions(),
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
const ids = identifier.split(',');
|
|
3154
|
+
const shippingMethod = {
|
|
3155
|
+
ship_id: ids[0],
|
|
3156
|
+
private_ship_id: typeof ids[1] === 'undefined' ? null : ids[1],
|
|
3157
|
+
type: typeof ids[2] === 'undefined' ? null : ids[2],
|
|
3158
|
+
route_id: typeof ids[3] === 'undefined' ? null : ids[3],
|
|
3159
|
+
};
|
|
3160
|
+
|
|
3161
|
+
try {
|
|
3162
|
+
if (SallaApplePay.shouldUpdateShippingCompany(shippingMethod)) {
|
|
3163
|
+
await SallaApplePay.selectApplePayShippingMethod(shippingMethod);
|
|
3164
|
+
await SallaApplePay.recalculateTotal();
|
|
3165
|
+
}
|
|
3166
|
+
return {
|
|
3167
|
+
total: SallaApplePay.prTotal(),
|
|
3168
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3169
|
+
shippingOptions: SallaApplePay.prShippingOptions(identifier),
|
|
3170
|
+
};
|
|
3171
|
+
} catch (error) {
|
|
3172
|
+
salla.logger.warn('🍏 Pay: PR shipping option change failed', error);
|
|
3173
|
+
return {
|
|
3174
|
+
total: SallaApplePay.prTotal(),
|
|
3175
|
+
displayItems: SallaApplePay.prDisplayItems(),
|
|
3176
|
+
shippingOptions: SallaApplePay.prShippingOptions(identifier),
|
|
3177
|
+
error: salla.lang.get('pages.checkout.payment_failed'),
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
},
|
|
3181
|
+
|
|
3182
|
+
/** Map the PaymentResponse payer fields to the contact shape the API expects. */
|
|
3183
|
+
prContactFromResponse: (response) => {
|
|
3184
|
+
const name = (response.payerName || '').trim();
|
|
3185
|
+
const spaceIndex = name.indexOf(' ');
|
|
3186
|
+
return {
|
|
3187
|
+
givenName: spaceIndex > -1 ? name.slice(0, spaceIndex) : name,
|
|
3188
|
+
familyName: spaceIndex > -1 ? name.slice(spaceIndex + 1) : '',
|
|
3189
|
+
emailAddress: response.payerEmail || null,
|
|
3190
|
+
phoneNumber: response.payerPhone || null,
|
|
3191
|
+
countryCode: response.shippingAddress?.country || SallaApplePay.detail.countryCode || null,
|
|
3192
|
+
};
|
|
3193
|
+
},
|
|
3194
|
+
|
|
3195
|
+
/** Authorize + submit the payment, then close the sheet. */
|
|
3196
|
+
prPaymentAuthorized: async function (response) {
|
|
3197
|
+
// Guest checkout → persist the payer contact before submitting.
|
|
3198
|
+
if (SallaApplePay.detail.guestContactSelected) {
|
|
3199
|
+
const contact = SallaApplePay.prContactFromResponse(response);
|
|
3200
|
+
|
|
3201
|
+
// Require familyName too, mirroring the native guest guard
|
|
3202
|
+
// (utils.js mutateShippingContact). Keeps the payload the backend
|
|
3203
|
+
// receives identical to the production native flow — it has only
|
|
3204
|
+
// ever been sent a non-empty last_name from Apple Pay guest checkout.
|
|
3205
|
+
if (!contact.emailAddress || !contact.givenName || !contact.familyName || !contact.phoneNumber) {
|
|
3206
|
+
await response.complete('fail');
|
|
3207
|
+
SallaApplePay.detail.onError(salla.lang.get('common.messages.required_fields'));
|
|
3208
|
+
return;
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
try {
|
|
3212
|
+
await http.post(
|
|
3213
|
+
SallaApplePay.detail.guestContactSelected.url.replace('{id}', SallaApplePay.id),
|
|
3214
|
+
{
|
|
3215
|
+
email: contact.emailAddress,
|
|
3216
|
+
first_name: contact.givenName,
|
|
3217
|
+
last_name: contact.familyName,
|
|
3218
|
+
phone_number: contact.phoneNumber,
|
|
3219
|
+
country_code: contact.countryCode,
|
|
3220
|
+
}
|
|
3221
|
+
);
|
|
3222
|
+
} catch (error) {
|
|
3223
|
+
await response.complete('fail');
|
|
3224
|
+
SallaApplePay.detail.onError(
|
|
3225
|
+
error?.response?.data?.error?.message || salla.lang.get('pages.checkout.payment_failed')
|
|
3226
|
+
);
|
|
3227
|
+
return;
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
Salla.event.dispatch('payments::apple-pay.authorized.init', response);
|
|
3232
|
+
|
|
3233
|
+
let authorizedData;
|
|
3234
|
+
try {
|
|
3235
|
+
const { data } = await http.post(
|
|
3236
|
+
SallaApplePay.detail.authorized.url.replace('{id}', SallaApplePay.id),
|
|
3237
|
+
{ payment_method: 'apple_pay', applepay_token: JSON.stringify(response.details) }
|
|
3238
|
+
);
|
|
3239
|
+
|
|
3240
|
+
authorizedData = data;
|
|
3241
|
+
Salla.event.dispatch('payments::apple-pay.authorized.success', data);
|
|
3242
|
+
await response.complete('success');
|
|
3243
|
+
} catch (error) {
|
|
3244
|
+
const errorResponse = error?.response;
|
|
3245
|
+
Salla.event.dispatch('payments::apple-pay.authorized.failed', errorResponse);
|
|
3246
|
+
await response.complete('fail');
|
|
3247
|
+
if (typeof SallaApplePay.detail.authorized.onFailed === 'function') {
|
|
3248
|
+
SallaApplePay.detail.authorized.onFailed(errorResponse);
|
|
3249
|
+
}
|
|
3250
|
+
return;
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
// response.complete() has already run above, and it can only be called
|
|
3254
|
+
// once. Run the merchant onSuccess callback OUTSIDE the try/catch so a
|
|
3255
|
+
// throw here (e.g. redirect handling) can't fall into the catch and fire
|
|
3256
|
+
// a second complete('fail') → InvalidStateError that masks the real error.
|
|
3257
|
+
if (typeof SallaApplePay.detail.authorized.onSuccess === 'function') {
|
|
3258
|
+
SallaApplePay.detail.authorized.onSuccess(authorizedData);
|
|
3259
|
+
}
|
|
3260
|
+
},
|
|
3261
|
+
|
|
2688
3262
|
shouldUpdateShippingCompany(shippingCompany) {
|
|
2689
3263
|
return SallaApplePay.shippingCompany?.ship_id != shippingCompany?.ship_id || SallaApplePay.shippingCompany?.private_ship_id != shippingCompany?.private_ship_id
|
|
2690
3264
|
},
|
|
@@ -2808,8 +3382,10 @@ if (typeof window !== 'undefined') {
|
|
|
2808
3382
|
}
|
|
2809
3383
|
|
|
2810
3384
|
//applePay doesn't allow iframes
|
|
2811
|
-
// SSR-safe
|
|
2812
|
-
|
|
3385
|
+
// SSR-safe (init only in the browser). Native (Safari) OR any browser with the
|
|
3386
|
+
// Payment Request API (non-Safari / QR-code fallback) can start a transaction;
|
|
3387
|
+
// capability is confirmed per-flow.
|
|
3388
|
+
if (typeof window !== 'undefined' && (SallaApplePay.canUseNative() || window.PaymentRequest)) {
|
|
2813
3389
|
SallaApplePay.init();
|
|
2814
3390
|
} else if (typeof document !== 'undefined') {
|
|
2815
3391
|
// 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>
|
|
@@ -3024,16 +3600,12 @@ const SallaQuickBuy = class {
|
|
|
3024
3600
|
currency: this.currency || salla.config.get('store.settings.buy_now.currency') || 'SAR', // SAR
|
|
3025
3601
|
requiredShippingContactFields: this.getRequiredShippingContactFields(),
|
|
3026
3602
|
shippingMethods: this.isRequireShipping ? [] : undefined,
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks')),
|
|
3032
|
-
supportedCountries: this.isLegacyBuyNowBE()
|
|
3033
|
-
? salla.config.get('store.settings.buy_now.countries')
|
|
3034
|
-
: ((Array.isArray(this.supportedCountries) && this.supportedCountries.length)
|
|
3035
|
-
? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries')),
|
|
3603
|
+
supportedNetworks: (Array.isArray(this.supportedNetworks) && this.supportedNetworks.length)
|
|
3604
|
+
? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks'),
|
|
3605
|
+
supportedCountries: (Array.isArray(this.supportedCountries) && this.supportedCountries.length)
|
|
3606
|
+
? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries'),
|
|
3036
3607
|
countryCode: salla.config.get('store.store_country') || 'SA',
|
|
3608
|
+
merchantIdentifier: applePayMerchantId(),
|
|
3037
3609
|
onStartedSession: this.handleApplePaySessionStarted,
|
|
3038
3610
|
validateMerchant: {
|
|
3039
3611
|
url: this.validateHost ? `${this.validateHost}/checkout/applepay/validate` : salla.url.get('checkout/applepay/validate'),
|
|
@@ -3109,21 +3681,8 @@ const SallaQuickBuy = class {
|
|
|
3109
3681
|
}
|
|
3110
3682
|
return fields;
|
|
3111
3683
|
}
|
|
3112
|
-
/**
|
|
3113
|
-
* TEMPORARY for BE Vip sync
|
|
3114
|
-
*/
|
|
3115
|
-
isLegacyBuyNowBE() {
|
|
3116
|
-
return salla?.config?.get?.('store.settings.buy_now.multi_currency') != null;
|
|
3117
|
-
}
|
|
3118
3684
|
/** Set Apple Pay amount + currency from a price payload, always keeping the pair in one currency. */
|
|
3119
3685
|
applyBaseCurrencyPrice(data) {
|
|
3120
|
-
// Legacy BE: amount only; currency is set once in runInit.
|
|
3121
|
-
if (this.isLegacyBuyNowBE()) {
|
|
3122
|
-
if (data?.price != null) {
|
|
3123
|
-
this.amount = data.price;
|
|
3124
|
-
}
|
|
3125
|
-
return;
|
|
3126
|
-
}
|
|
3127
3686
|
const base = data?.base_currency_price;
|
|
3128
3687
|
// Unified BE base pair (regular products): charge in base currency.
|
|
3129
3688
|
if (base?.amount != null) {
|
|
@@ -3145,11 +3704,6 @@ const SallaQuickBuy = class {
|
|
|
3145
3704
|
const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
|
|
3146
3705
|
this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
|
|
3147
3706
|
const runInit = async () => {
|
|
3148
|
-
if (this.isLegacyBuyNowBE() && !this.currency && salla?.config?.get) {
|
|
3149
|
-
// Legacy BE (pre-PR): currency from the multi_currency flag. The unified BE instead
|
|
3150
|
-
// sources amount + currency from `base_currency_price` (see applyBaseCurrencyPrice).
|
|
3151
|
-
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');
|
|
3152
|
-
}
|
|
3153
3707
|
if (!this.productId && salla?.config?.get && salla.url?.is_page) {
|
|
3154
3708
|
this.productId = salla.config.get('page.id');
|
|
3155
3709
|
}
|
|
@@ -3175,16 +3729,19 @@ const SallaQuickBuy = class {
|
|
|
3175
3729
|
else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
|
|
3176
3730
|
salla.product.event.onPriceUpdated(response => { this.applyBaseCurrencyPrice(response?.data); });
|
|
3177
3731
|
}
|
|
3178
|
-
|
|
3179
|
-
&& (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
|
|
3732
|
+
const storeAllowsApplePay = (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
|
|
3180
3733
|
&& (salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? isSallaGateway);
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3734
|
+
// Preload Apple's JS SDK so the rendered <apple-pay-button> upgrades on
|
|
3735
|
+
// every flow (native Safari + QR). Fire-and-forget: the element upgrades
|
|
3736
|
+
// retroactively once the script defines it.
|
|
3737
|
+
if (storeAllowsApplePay) {
|
|
3738
|
+
ensureApplePaySdk();
|
|
3739
|
+
}
|
|
3740
|
+
// Cross-browser capability: native (Safari) OR the Payment Request API
|
|
3741
|
+
// (non-Safari browsers / non-Apple devices via the QR-code fallback). The
|
|
3742
|
+
// helper loads Apple's JS SDK and awaits it before probing, so this is a
|
|
3743
|
+
// stable answer on first load (no race against the async script fetch).
|
|
3744
|
+
this.isApplePayActive = storeAllowsApplePay && await canCompleteApplePay(this.currency);
|
|
3188
3745
|
};
|
|
3189
3746
|
return new Promise((resolve) => {
|
|
3190
3747
|
if (typeof salla?.onReady === 'function') {
|
|
@@ -3196,7 +3753,7 @@ const SallaQuickBuy = class {
|
|
|
3196
3753
|
});
|
|
3197
3754
|
}
|
|
3198
3755
|
render() {
|
|
3199
|
-
return index.h(index.Host, { key: '
|
|
3756
|
+
return index.h(index.Host, { key: '100f3cd501d568084f3596f5cef7c9b744f7ec82' }, this.quickBuyButton());
|
|
3200
3757
|
}
|
|
3201
3758
|
quickBuyButton() {
|
|
3202
3759
|
return index.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 });
|