fontdue-js 2.22.4 → 3.0.0-alpha1
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/.babelrc.cjs +72 -0
- package/dist/__generated__/AddToCartBannerQuery.graphql.js +1 -8
- package/dist/__generated__/AddToCartBanner_item.graphql.js +1 -8
- package/dist/__generated__/AddToCartBanner_order.graphql.js +1 -8
- package/dist/__generated__/AddressFieldsRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/AddressFields_viewer.graphql.js +3 -11
- package/dist/__generated__/BuyButtonIDQuery.graphql.js +1 -8
- package/dist/__generated__/BuyButtonSlugQuery.graphql.js +1 -8
- package/dist/__generated__/BuyButton_collection.graphql.js +1 -8
- package/dist/__generated__/CartButtonQuery.graphql.js +1 -8
- package/dist/__generated__/CartButton_order.graphql.js +1 -8
- package/dist/__generated__/CartItemAdditionalLicenses_licenses.graphql.js +1 -8
- package/dist/__generated__/CartItemAdditionalLicenses_orderItem.graphql.js +1 -8
- package/dist/__generated__/CartItemLicense_selection.graphql.js +1 -8
- package/dist/__generated__/CartItemProduct_product.graphql.js +1 -8
- package/dist/__generated__/CartItemVariable_selection.graphql.js +1 -8
- package/dist/__generated__/CartItemVariable_variable.graphql.js +1 -8
- package/dist/__generated__/CartItem_node.graphql.js +1 -8
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +1 -8
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +1 -8
- package/dist/__generated__/CartOrderUpdateMutation.graphql.js +1 -8
- package/dist/__generated__/CartOrder_UpdateErrors.graphql.js +1 -8
- package/dist/__generated__/CartOrder_order.graphql.js +1 -8
- package/dist/__generated__/CartOrder_viewer.graphql.js +1 -8
- package/dist/__generated__/CartQuery.graphql.js +1 -8
- package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.js +1 -8
- package/dist/__generated__/CartStateUpdateMutation.graphql.js +1 -8
- package/dist/__generated__/CartState_order.graphql.js +1 -8
- package/dist/__generated__/CartTotals_order.graphql.js +1 -8
- package/dist/__generated__/CharacterViewerIDQuery.graphql.js +1 -8
- package/dist/__generated__/CharacterViewerSlugQuery.graphql.js +1 -8
- package/dist/__generated__/CharacterViewerStyleRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/CharacterViewer_collection.graphql.js +1 -8
- package/dist/__generated__/CharacterViewer_family.graphql.js +1 -8
- package/dist/__generated__/CharacterViewer_style.graphql.js +3 -11
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +1 -8
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +1 -8
- package/dist/__generated__/Checkout_UpdateOrderErrors.graphql.js +1 -8
- package/dist/__generated__/Checkout_identity.graphql.js +1 -8
- package/dist/__generated__/Checkout_order.graphql.js +1 -8
- package/dist/__generated__/Checkout_viewer.graphql.js +1 -8
- package/dist/__generated__/CollectionAa_Query.graphql.js +1 -8
- package/dist/__generated__/CollectionAa_product.graphql.js +1 -8
- package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.js +1 -8
- package/dist/__generated__/CouponText_coupon.graphql.js +1 -8
- package/dist/__generated__/CustomerLoginFormLoginMutation.graphql.js +1 -8
- package/dist/__generated__/CustomerLoginFormQuery.graphql.js +1 -8
- package/dist/__generated__/DownloadRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/Download_order.graphql.js +1 -8
- package/dist/__generated__/FamilyList_node.graphql.js +1 -8
- package/dist/__generated__/Family_node.graphql.js +1 -8
- package/dist/__generated__/FontFamiliesQuery.graphql.js +1 -8
- package/dist/__generated__/FontStyle_fontStyle.graphql.js +1 -8
- package/dist/__generated__/IdentityBox_identity.graphql.js +1 -8
- package/dist/__generated__/License_node.graphql.js +1 -8
- package/dist/__generated__/NewsletterSignupQuery.graphql.js +1 -8
- package/dist/__generated__/NewsletterSignupUpdateCustomerMutation.graphql.js +1 -8
- package/dist/__generated__/NodePasswordFormAccessNodeMutation.graphql.js +1 -8
- package/dist/__generated__/NodePasswordFormIDQuery.graphql.js +1 -8
- package/dist/__generated__/NodePasswordFormSlugQuery.graphql.js +1 -8
- package/dist/__generated__/OrderVariableSelectionReduxRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/OrderVariableSelectionRedux_viewer.graphql.js +3 -11
- package/dist/__generated__/OrderVariableSelection_variables.graphql.js +1 -8
- package/dist/__generated__/PrecartAddToCartMutation.graphql.js +1 -8
- package/dist/__generated__/PrecartClearCartMutation.graphql.js +1 -8
- package/dist/__generated__/PrecartQuery.graphql.js +1 -8
- package/dist/__generated__/Precart_collection.graphql.js +1 -8
- package/dist/__generated__/Precart_license.graphql.js +1 -8
- package/dist/__generated__/Precart_viewer.graphql.js +1 -8
- package/dist/__generated__/PriceBarSectionRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/PriceBarSection_node.graphql.js +3 -11
- package/dist/__generated__/PriceBar_node.graphql.js +1 -8
- package/dist/__generated__/Price_price.graphql.js +1 -8
- package/dist/__generated__/SKUPrice_sku.graphql.js +1 -8
- package/dist/__generated__/SelectButton_sku.graphql.js +1 -8
- package/dist/__generated__/ServerConfigProviderQuery.graphql.js +1 -8
- package/dist/__generated__/ShareCartCreateSnapshotMutation.graphql.js +1 -8
- package/dist/__generated__/SpecimenLinkQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalBundleButton_bundle.graphql.js +1 -8
- package/dist/__generated__/StoreModalCartQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalContainerQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalDownloadRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalDownload_order.graphql.js +1 -8
- package/dist/__generated__/StoreModalFamilyButton_collection.graphql.js +1 -8
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +1 -8
- package/dist/__generated__/StoreModalIndexItem_fontCollection.graphql.js +1 -8
- package/dist/__generated__/StoreModalIndexQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalOrderVariableSelection_order.graphql.js +1 -8
- package/dist/__generated__/StoreModalOrderVariableSelection_viewer.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductContent_collection.graphql.js +3 -11
- package/dist/__generated__/StoreModalProductLicenseSelection_collection.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductLicense_license.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductSummaryAddToCartMutation.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductSummaryRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/StoreModalProductSummary_viewer.graphql.js +3 -11
- package/dist/__generated__/StoreModalReviewIdentity_identity.graphql.js +1 -8
- package/dist/__generated__/StoreModalStyleButton_fontStyle.graphql.js +1 -8
- package/dist/__generated__/StoreModalUnifiedCheckoutCompleteOrderMutation.graphql.js +1 -8
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateCustomerMutation.graphql.js +1 -8
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.js +1 -8
- package/dist/__generated__/StoreModalUnifiedCheckout_order.graphql.js +1 -8
- package/dist/__generated__/StoreModalUnifiedCheckout_viewer.graphql.js +1 -8
- package/dist/__generated__/StripeProviderCreateCheckoutSessionMutation.graphql.js +1 -8
- package/dist/__generated__/StripeProvider_viewer.graphql.js +1 -8
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +1 -8
- package/dist/__generated__/TestFontsForm_Query.graphql.js +1 -8
- package/dist/__generated__/TestModeBannerQuery.graphql.js +1 -8
- package/dist/__generated__/ThemeConfigQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTesterFeaturesButton_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTesterFeatures_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTesterFloatingToolbar_testers.graphql.js +1 -8
- package/dist/__generated__/TypeTesterStandaloneChangedStylesQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTesterStandaloneQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTesterStyleSelectData_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTesterStyleSelectData_fontStyleData.graphql.js +1 -8
- package/dist/__generated__/TypeTesterStyleSelectData_viewer.graphql.js +1 -8
- package/dist/__generated__/TypeTesterToolbar_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTesterVariableAxes_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTester_fontStyle.graphql.js +1 -8
- package/dist/__generated__/TypeTester_viewer.graphql.js +1 -8
- package/dist/__generated__/TypeTestersChangedStylesQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTestersIDQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTestersSlugQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTesters_collection.graphql.js +3 -11
- package/dist/__generated__/TypeTesters_viewer.graphql.js +1 -8
- package/dist/__generated__/VariableTableAmounts_option.graphql.js +1 -8
- package/dist/__generated__/VariableTableAmounts_variable.graphql.js +1 -8
- package/dist/__generated__/productState_Query.graphql.js +1 -8
- package/dist/__generated__/productState_bundle.graphql.js +1 -8
- package/dist/__generated__/productState_collection.graphql.js +1 -8
- package/dist/__generated__/productState_collectionBundle.graphql.js +1 -8
- package/dist/__generated__/productState_node.graphql.js +1 -8
- package/dist/__generated__/productState_sku.graphql.js +1 -8
- package/dist/__generated__/useFeaturesData_fontStyle.graphql.js +1 -8
- package/dist/__generated__/useFontStyle_fontStyle.graphql.js +1 -8
- package/dist/__generated__/useTotalStyles_fontCollection.graphql.js +1 -8
- package/dist/__tests__/collectionBundleSelection.test.js +221 -222
- package/dist/components/AddToCartBanner/index.js +19 -29
- package/dist/components/BuyButton/index.d.ts +3 -3
- package/dist/components/BuyButton/index.js +36 -46
- package/dist/components/BuyButton/index.server.d.ts +1 -1
- package/dist/components/BuyButton/index.server.js +10 -17
- package/dist/components/BuyingOptions/index.js +4 -12
- package/dist/components/Cart/AddressFields.d.ts +2 -2
- package/dist/components/Cart/AddressFields.js +25 -35
- package/dist/components/Cart/CartItem/CartItemAdditionalLicenses.d.ts +2 -2
- package/dist/components/Cart/CartItem/CartItemAdditionalLicenses.js +9 -16
- package/dist/components/Cart/CartItem/CartItemLicense.d.ts +2 -2
- package/dist/components/Cart/CartItem/CartItemLicense.js +15 -24
- package/dist/components/Cart/CartItem/CartItemProduct.d.ts +1 -1
- package/dist/components/Cart/CartItem/CartItemProduct.js +16 -23
- package/dist/components/Cart/CartItem/CartItemVariable.d.ts +3 -3
- package/dist/components/Cart/CartItem/CartItemVariable.js +16 -23
- package/dist/components/Cart/CartItem/VariableTextInput.js +13 -21
- package/dist/components/Cart/CartItem/index.d.ts +2 -2
- package/dist/components/Cart/CartItem/index.js +18 -27
- package/dist/components/Cart/CartOrder.d.ts +2 -2
- package/dist/components/Cart/CartOrder.js +99 -110
- package/dist/components/Cart/CartState.d.ts +3 -3
- package/dist/components/Cart/CartState.js +18 -25
- package/dist/components/Cart/CartTotals.d.ts +1 -1
- package/dist/components/Cart/CartTotals.js +31 -38
- package/dist/components/Cart/Checkout.d.ts +3 -3
- package/dist/components/Cart/Checkout.js +109 -118
- package/dist/components/Cart/CheckoutSteps.js +1 -8
- package/dist/components/Cart/CouponCodeInput.js +22 -32
- package/dist/components/Cart/CustomerFields.d.ts +1 -1
- package/dist/components/Cart/CustomerFields.js +21 -31
- package/dist/components/Cart/Download.d.ts +1 -1
- package/dist/components/Cart/Download.js +17 -27
- package/dist/components/Cart/EmptyCart.js +15 -23
- package/dist/components/Cart/IdentityBox.d.ts +1 -1
- package/dist/components/Cart/IdentityBox.js +12 -19
- package/dist/components/Cart/ShareCart.js +24 -32
- package/dist/components/Cart/index.js +13 -21
- package/dist/components/Cart/injectRelayEnvironment.js +5 -13
- package/dist/components/Cart/types.d.ts +1 -1
- package/dist/components/Cart/types.js +1 -5
- package/dist/components/Cart/utils.js +2 -9
- package/dist/components/CartButton/index.d.ts +2 -2
- package/dist/components/CartButton/index.js +29 -38
- package/dist/components/CartButton/index.server.d.ts +1 -1
- package/dist/components/CartButton/index.server.js +7 -14
- package/dist/components/CharacterViewer/StyleSelect.d.ts +1 -1
- package/dist/components/CharacterViewer/StyleSelect.js +10 -17
- package/dist/components/CharacterViewer/index.d.ts +3 -3
- package/dist/components/CharacterViewer/index.js +79 -89
- package/dist/components/CharacterViewer/index.server.d.ts +1 -1
- package/dist/components/CharacterViewer/index.server.js +10 -17
- package/dist/components/Checkbox/index.js +9 -19
- package/dist/components/CollectionAa/index.d.ts +1 -1
- package/dist/components/CollectionAa/index.js +12 -21
- package/dist/components/ComponentsContext.d.ts +1 -1
- package/dist/components/ComponentsContext.js +4 -10
- package/dist/components/ConfigContext.d.ts +12 -12
- package/dist/components/ConfigContext.js +4 -11
- package/dist/components/ConsentBanner/consent.js +6 -17
- package/dist/components/ConsentBanner/index.js +19 -29
- package/dist/components/CookieNotification/index.js +19 -27
- package/dist/components/CorsErrorModal.js +13 -20
- package/dist/components/CouponText/index.d.ts +1 -1
- package/dist/components/CouponText/index.js +9 -18
- package/dist/components/CustomerLoginForm/index.js +23 -32
- package/dist/components/Family/FamilyList.d.ts +1 -1
- package/dist/components/Family/FamilyList.js +10 -17
- package/dist/components/Family/index.d.ts +1 -1
- package/dist/components/Family/index.js +37 -46
- package/dist/components/FontFamilies/index.js +18 -28
- package/dist/components/FontStyle/index.d.ts +1 -1
- package/dist/components/FontStyle/index.js +8 -15
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.d.ts +6 -4
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.js +48 -39
- package/dist/components/FontdueProvider/index.d.ts +2 -2
- package/dist/components/FontdueProvider/index.js +32 -15
- package/dist/components/FontdueProvider/index.server.d.ts +2 -2
- package/dist/components/FontdueProvider/index.server.js +24 -22
- package/dist/components/Icons/Align.js +13 -22
- package/dist/components/Icons/ArrowDownRight.js +5 -13
- package/dist/components/Icons/ArrowLeft.js +5 -13
- package/dist/components/Icons/ArrowRight.js +5 -13
- package/dist/components/Icons/CarrotDown.js +5 -13
- package/dist/components/Icons/CarrotUp.js +5 -13
- package/dist/components/Icons/Cart.js +7 -15
- package/dist/components/Icons/CartNew.js +7 -15
- package/dist/components/Icons/Check.js +5 -13
- package/dist/components/Icons/Checkbox.js +5 -13
- package/dist/components/Icons/CheckboxChecked.js +5 -13
- package/dist/components/Icons/CheckboxCrossed.js +6 -14
- package/dist/components/Icons/CircledCheck.js +6 -14
- package/dist/components/Icons/CircledInfo.js +6 -14
- package/dist/components/Icons/CircledMinus.js +6 -14
- package/dist/components/Icons/ColorPicker.js +5 -13
- package/dist/components/Icons/CreditCard.js +6 -14
- package/dist/components/Icons/DownArrow.js +5 -13
- package/dist/components/Icons/DownloadFonts.js +8 -16
- package/dist/components/Icons/FrowningFace.js +8 -16
- package/dist/components/Icons/License.js +5 -13
- package/dist/components/Icons/Receipt.js +8 -16
- package/dist/components/Icons/User.js +5 -13
- package/dist/components/Icons/X.js +5 -13
- package/dist/components/Icons/index.d.ts +23 -23
- package/dist/components/Icons/index.js +23 -167
- package/dist/components/NewsletterSignup/NewsletterSignupElement.d.ts +1 -1
- package/dist/components/NewsletterSignup/NewsletterSignupElement.js +4 -11
- package/dist/components/NewsletterSignup/index.d.ts +2 -2
- package/dist/components/NewsletterSignup/index.js +51 -60
- package/dist/components/NewsletterSignup/index.server.d.ts +1 -1
- package/dist/components/NewsletterSignup/index.server.js +7 -14
- package/dist/components/NodePasswordForm/index.js +25 -33
- package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.d.ts +1 -1
- package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.js +18 -27
- package/dist/components/OrderVariableSelection/index.d.ts +1 -1
- package/dist/components/OrderVariableSelection/index.js +28 -36
- package/dist/components/Precart/License.d.ts +1 -1
- package/dist/components/Precart/License.js +22 -30
- package/dist/components/Precart/index.js +64 -74
- package/dist/components/Price/index.d.ts +1 -1
- package/dist/components/Price/index.js +10 -20
- package/dist/components/PriceBar/PriceBarSection.d.ts +1 -1
- package/dist/components/PriceBar/PriceBarSection.js +23 -33
- package/dist/components/PriceBar/index.d.ts +1 -1
- package/dist/components/PriceBar/index.js +13 -23
- package/dist/components/Root/index.d.ts +1 -1
- package/dist/components/Root/index.js +41 -51
- package/dist/components/Root/productState.d.ts +1 -1
- package/dist/components/Root/productState.js +20 -29
- package/dist/components/SKUPrice/index.d.ts +2 -2
- package/dist/components/SKUPrice/index.js +12 -20
- package/dist/components/Select/index.js +9 -17
- package/dist/components/SelectButton/index.d.ts +2 -2
- package/dist/components/SelectButton/index.js +20 -29
- package/dist/components/ServerConfigProvider/index.d.ts +1 -1
- package/dist/components/ServerConfigProvider/index.js +9 -18
- package/dist/components/SpecimenLink/index.js +12 -20
- package/dist/components/StickyNav/index.js +16 -26
- package/dist/components/StoreModal/StoreModalBundleButton.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalBundleButton.js +16 -23
- package/dist/components/StoreModal/StoreModalCart.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalCart.js +29 -38
- package/dist/components/StoreModal/StoreModalCheckout.js +9 -17
- package/dist/components/StoreModal/StoreModalCheckoutContext.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalCheckoutContext.js +6 -12
- package/dist/components/StoreModal/StoreModalContainer.js +25 -35
- package/dist/components/StoreModal/StoreModalDownload.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalDownload.js +14 -24
- package/dist/components/StoreModal/StoreModalFamily.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalFamily.js +14 -23
- package/dist/components/StoreModal/StoreModalFamilyButton.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalFamilyButton.js +23 -30
- package/dist/components/StoreModal/StoreModalIndex.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalIndex.js +9 -17
- package/dist/components/StoreModal/StoreModalIndexItem.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalIndexItem.js +20 -30
- package/dist/components/StoreModal/StoreModalLicenseeIsBillingSelection.js +8 -17
- package/dist/components/StoreModal/StoreModalLoader.js +6 -15
- package/dist/components/StoreModal/StoreModalOrderVariableSelection.d.ts +3 -3
- package/dist/components/StoreModal/StoreModalOrderVariableSelection.js +12 -21
- package/dist/components/StoreModal/StoreModalProduct.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalProduct.js +51 -61
- package/dist/components/StoreModal/StoreModalReviewIdentity.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalReviewIdentity.js +6 -15
- package/dist/components/StoreModal/StoreModalRouter.js +12 -22
- package/dist/components/StoreModal/StoreModalStyleButton.d.ts +1 -1
- package/dist/components/StoreModal/StoreModalStyleButton.js +20 -27
- package/dist/components/StoreModal/index.js +10 -19
- package/dist/components/StoreModal/routes.d.ts +4 -4
- package/dist/components/StoreModal/routes.js +18 -26
- package/dist/components/StoreModal/types.js +1 -5
- package/dist/components/StoreModalProductLicenseSelection/LicenseElement.js +12 -22
- package/dist/components/StoreModalProductLicenseSelection/LicenseVariableElement.js +7 -15
- package/dist/components/StoreModalProductLicenseSelection/LicenseVariableRadioElement.js +9 -19
- package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.d.ts +1 -1
- package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +19 -28
- package/dist/components/StoreModalProductLicenseSelection/index.d.ts +1 -1
- package/dist/components/StoreModalProductLicenseSelection/index.js +10 -17
- package/dist/components/StoreModalProductSummary/index.d.ts +1 -1
- package/dist/components/StoreModalProductSummary/index.js +45 -55
- package/dist/components/StripeLogo.js +4 -11
- package/dist/components/StripeProvider/index.d.ts +1 -1
- package/dist/components/StripeProvider/index.js +19 -29
- package/dist/components/Switch/index.js +1 -7
- package/dist/components/TestFontsForm/TestFontsFormElement.js +4 -12
- package/dist/components/TestFontsForm/index.d.ts +2 -2
- package/dist/components/TestFontsForm/index.js +56 -65
- package/dist/components/TestFontsForm/index.server.d.ts +1 -1
- package/dist/components/TestFontsForm/index.server.js +7 -14
- package/dist/components/TestModeBanner/index.js +10 -16
- package/dist/components/TextField/index.js +9 -17
- package/dist/components/ThemeConfig/index.d.ts +2 -2
- package/dist/components/ThemeConfig/index.js +14 -20
- package/dist/components/ThemeConfig/index.server.js +7 -14
- package/dist/components/Tracking/index.js +11 -18
- package/dist/components/TypeTester/TypeTesterAlignButtons.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterAlignButtons.js +8 -16
- package/dist/components/TypeTester/TypeTesterBullet.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterBullet.js +4 -12
- package/dist/components/TypeTester/TypeTesterContent.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterContent.js +22 -21
- package/dist/components/TypeTester/TypeTesterContext.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterContext.js +10 -17
- package/dist/components/TypeTester/TypeTesterEditAll.js +10 -20
- package/dist/components/TypeTester/TypeTesterFeatures.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterFeatures.js +28 -37
- package/dist/components/TypeTester/TypeTesterFeaturesButton.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterFeaturesButton.js +20 -30
- package/dist/components/TypeTester/TypeTesterFitter.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterFitter.js +5 -13
- package/dist/components/TypeTester/TypeTesterFloatingToolbar.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +19 -28
- package/dist/components/TypeTester/TypeTesterInput.js +12 -22
- package/dist/components/TypeTester/TypeTesterSlider.js +7 -16
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +3 -3
- package/dist/components/TypeTester/TypeTesterStandalone.js +31 -40
- package/dist/components/TypeTester/TypeTesterStandalone.preload.d.ts +3 -3
- package/dist/components/TypeTester/TypeTesterStandalone.preload.js +4 -4
- package/dist/components/TypeTester/TypeTesterStandalone.server.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +7 -14
- package/dist/components/TypeTester/TypeTesterStandaloneElement.js +7 -16
- package/dist/components/TypeTester/TypeTesterState.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterState.js +6 -14
- package/dist/components/TypeTester/TypeTesterStyleSelect.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterStyleSelect.js +9 -17
- package/dist/components/TypeTester/TypeTesterStyleSelectData.d.ts +4 -4
- package/dist/components/TypeTester/TypeTesterStyleSelectData.js +21 -30
- package/dist/components/TypeTester/TypeTesterToolbar.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterToolbar.js +29 -39
- package/dist/components/TypeTester/TypeTesterVariableAxes.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterVariableAxes.js +16 -24
- package/dist/components/TypeTester/features.js +1 -8
- package/dist/components/TypeTester/index.d.ts +3 -3
- package/dist/components/TypeTester/index.js +45 -55
- package/dist/components/TypeTester/types.js +3 -11
- package/dist/components/TypeTester/useFeaturesData.d.ts +1 -1
- package/dist/components/TypeTester/useFeaturesData.js +7 -15
- package/dist/components/TypeTester/useTypeTesterStyler.d.ts +2 -2
- package/dist/components/TypeTester/useTypeTesterStyler.js +6 -13
- package/dist/components/TypeTesters/TypeTestersElement.js +4 -12
- package/dist/components/TypeTesters/index.d.ts +4 -4
- package/dist/components/TypeTesters/index.js +61 -70
- package/dist/components/TypeTesters/index.server.d.ts +1 -1
- package/dist/components/TypeTesters/index.server.js +10 -17
- package/dist/components/UrlContext.js +6 -12
- package/dist/components/VariableTableAmounts/index.d.ts +2 -2
- package/dist/components/VariableTableAmounts/index.js +9 -16
- package/dist/components/elements/Button/index.js +3 -11
- package/dist/components/elements/EmptyCart/index.js +9 -19
- package/dist/components/elements/StoreModalCartLayout/index.js +10 -18
- package/dist/components/elements/StoreModalContainer/StoreModalContainerContext.js +3 -9
- package/dist/components/elements/StoreModalContainer/index.js +17 -27
- package/dist/components/elements/StoreModalDownloadLayout/index.js +7 -15
- package/dist/components/elements/StoreModalFamily/index.js +8 -16
- package/dist/components/elements/StoreModalFamilyButton/index.d.ts +1 -1
- package/dist/components/elements/StoreModalFamilyButton/index.js +11 -20
- package/dist/components/elements/StoreModalIndexItem/index.js +9 -17
- package/dist/components/elements/StoreModalLicenseeIsBillingIdentityElement.js +16 -25
- package/dist/components/elements/StoreModalLoadingScreen/index.js +4 -12
- package/dist/components/elements/StoreModalPageContainer/index.js +5 -13
- package/dist/components/elements/StoreModalStyleButton/index.d.ts +1 -1
- package/dist/components/elements/StoreModalStyleButton/index.js +10 -18
- package/dist/components/elements/StoreModalUnifiedCheckout.d.ts +2 -2
- package/dist/components/elements/StoreModalUnifiedCheckout.js +107 -115
- package/dist/components/useConsent.js +4 -9
- package/dist/components/useFont.js +8 -15
- package/dist/components/useFontStyle.d.ts +1 -1
- package/dist/components/useFontStyle.js +12 -20
- package/dist/components/useInterval.js +5 -12
- package/dist/components/useTotalStyles.d.ts +1 -1
- package/dist/components/useTotalStyles.js +4 -12
- package/dist/corsError.js +4 -14
- package/dist/data/unicodeData.js +1 -1
- package/dist/fontLoader.js +2 -9
- package/dist/hooks/useAutofit.js +11 -19
- package/dist/hooks/useLicenseAndOrderVariables.d.ts +2 -2
- package/dist/hooks/useLicenseAndOrderVariables.js +7 -12
- package/dist/hooks/useRefetchOnLicenseChanges.d.ts +1 -1
- package/dist/hooks/useRefetchOnLicenseChanges.js +7 -13
- package/dist/hooks/useResizeObserver.d.ts +11 -0
- package/dist/hooks/useResizeObserver.js +23 -0
- package/dist/hooks.js +5 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/react-ranger.d.js +0 -1
- package/dist/react-ranger.js +17 -24
- package/dist/reducer.d.ts +5 -5
- package/dist/reducer.js +15 -36
- package/dist/relay/environment.d.ts +1 -0
- package/dist/relay/environment.js +58 -33
- package/dist/relay/loadSerializableQuery.d.ts +5 -1
- package/dist/relay/loadSerializableQuery.js +4 -8
- package/dist/relay/useSerializablePreloadedQuery.d.ts +3 -3
- package/dist/relay/useSerializablePreloadedQuery.js +26 -22
- package/dist/retryImport.js +1 -7
- package/dist/scripts/updateUnicodeData.js +0 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +14 -36
- package/dist/vanilla/FontStyle.js +3 -11
- package/dist/vanilla/TruncatedMarkdown.js +2 -9
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +74 -0
- package/package.json +7 -4
- package/scripts/addJsExtensionsBabelPlugin.cjs +62 -0
- package/types/globals.d.ts +3 -0
package/dist/fontLoader.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isFontLoaded = isFontLoaded;
|
|
7
|
-
exports.loadFont = loadFont;
|
|
8
1
|
const cache = new Map();
|
|
9
2
|
const loaded = new Set();
|
|
10
|
-
function isFontLoaded(fontFamily) {
|
|
3
|
+
export function isFontLoaded(fontFamily) {
|
|
11
4
|
return loaded.has(fontFamily);
|
|
12
5
|
}
|
|
13
|
-
async function loadFont(fontFamily, sources, verticalMetrics) {
|
|
6
|
+
export async function loadFont(fontFamily, sources, verticalMetrics) {
|
|
14
7
|
// Return cached promise if loading is in progress or complete
|
|
15
8
|
const existing = cache.get(fontFamily);
|
|
16
9
|
if (existing) return existing;
|
package/dist/hooks/useAutofit.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _resizeObserver = _interopRequireDefault(require("@react-hook/resize-observer"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
|
2
|
+
import useResizeObserver from './useResizeObserver.js';
|
|
10
3
|
const REF_SIZE = 100;
|
|
11
4
|
|
|
12
5
|
// Canvas measurement (fast path)
|
|
@@ -63,26 +56,26 @@ const useAutofit = _ref => {
|
|
|
63
56
|
enabled = true,
|
|
64
57
|
padding = 0
|
|
65
58
|
} = _ref;
|
|
66
|
-
const ref =
|
|
67
|
-
const [fontSize, setFontSize] =
|
|
68
|
-
const [containerWidth, setContainerWidth] =
|
|
69
|
-
const [fontVersion, setFontVersion] =
|
|
70
|
-
const [measured, setMeasured] =
|
|
71
|
-
(
|
|
59
|
+
const ref = useRef(null);
|
|
60
|
+
const [fontSize, setFontSize] = useState(externalFontSize);
|
|
61
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
62
|
+
const [fontVersion, setFontVersion] = useState(0);
|
|
63
|
+
const [measured, setMeasured] = useState(false);
|
|
64
|
+
useResizeObserver(ref, entry => {
|
|
72
65
|
setContainerWidth(entry.contentRect.width);
|
|
73
66
|
});
|
|
74
67
|
|
|
75
68
|
// Trigger re-measurement when the font becomes available.
|
|
76
69
|
// If already loaded (e.g. parent waited for font), the promise
|
|
77
70
|
// resolves as a microtask and the re-measurement is near-instant.
|
|
78
|
-
|
|
71
|
+
useLayoutEffect(() => {
|
|
79
72
|
if (!enabled || !fontFamily) return;
|
|
80
73
|
const fontString = `${fontStyle} ${fontWeight} ${REF_SIZE}px ${fontFamily}`;
|
|
81
74
|
document.fonts.load(fontString).then(() => {
|
|
82
75
|
setFontVersion(v => v + 1);
|
|
83
76
|
});
|
|
84
77
|
}, [fontFamily, fontWeight, fontStyle, enabled]);
|
|
85
|
-
|
|
78
|
+
useLayoutEffect(() => {
|
|
86
79
|
if (!enabled) return;
|
|
87
80
|
const availableWidth = containerWidth - padding;
|
|
88
81
|
if (availableWidth <= 0 || !text) return;
|
|
@@ -111,5 +104,4 @@ const useAutofit = _ref => {
|
|
|
111
104
|
ready: measured
|
|
112
105
|
};
|
|
113
106
|
};
|
|
114
|
-
|
|
115
|
-
exports.default = _default;
|
|
107
|
+
export default useAutofit;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LicenseOptionsSpec } from '../__generated__/StoreModalProductRefetchQuery.graphql';
|
|
1
|
+
import { LicenseOptionsSpec } from '../__generated__/StoreModalProductRefetchQuery.graphql.js';
|
|
2
2
|
export declare function useLicenseAndOrderVariables(): {
|
|
3
3
|
licenseOptionsSpecs: readonly (LicenseOptionsSpec | null)[];
|
|
4
|
-
orderVariableSelections: import("../reducer").OrderVariableSelectionState[];
|
|
4
|
+
orderVariableSelections: import("../reducer.js").OrderVariableSelectionState[];
|
|
5
5
|
};
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.useLicenseAndOrderVariables = useLicenseAndOrderVariables;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactRedux = require("react-redux");
|
|
9
|
-
function useLicenseAndOrderVariables() {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { shallowEqual } from 'react-redux';
|
|
4
|
+
export function useLicenseAndOrderVariables() {
|
|
10
5
|
// Select raw data from Redux with shallow equality check
|
|
11
|
-
const licenseOptions =
|
|
6
|
+
const licenseOptions = useSelector(state => state.licenseOptions, shallowEqual);
|
|
12
7
|
|
|
13
8
|
// Select order variables from Redux
|
|
14
|
-
const orderVariableSelections =
|
|
9
|
+
const orderVariableSelections = useSelector(state => state.orderVariableSelections, shallowEqual);
|
|
15
10
|
|
|
16
11
|
// Memoize the transformed license options data
|
|
17
|
-
const licenseOptionsSpecs =
|
|
12
|
+
const licenseOptionsSpecs = useMemo(() => licenseOptions.length > 0 ? licenseOptions.map(spec => ({
|
|
18
13
|
licenseId: spec.licenseId,
|
|
19
14
|
licenseOptionIds: Object.values(spec.licenseOptions).filter(Boolean)
|
|
20
15
|
})) : [], [licenseOptions]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment, GraphQLTaggedNode } from 'relay-runtime';
|
|
2
|
-
import { LicenseOptionsSpec, OrderVariableSelectionInput } from '../__generated__/StoreModalProductRefetchQuery.graphql';
|
|
2
|
+
import { LicenseOptionsSpec, OrderVariableSelectionInput } from '../__generated__/StoreModalProductRefetchQuery.graphql.js';
|
|
3
3
|
type RefetchFn = (variables: {
|
|
4
4
|
licenseOptions: ReadonlyArray<LicenseOptionsSpec | null>;
|
|
5
5
|
orderVariables: ReadonlyArray<OrderVariableSelectionInput>;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useRefetchOnLicenseChanges = useRefetchOnLicenseChanges;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _relayRuntime = require("relay-runtime");
|
|
9
|
-
var _useLicenseAndOrderVariables = require("./useLicenseAndOrderVariables");
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { fetchQuery } from 'relay-runtime';
|
|
3
|
+
import { useLicenseAndOrderVariables } from './useLicenseAndOrderVariables.js';
|
|
10
4
|
/**
|
|
11
5
|
* Custom hook to handle refetching data when license options or order variables change.
|
|
12
6
|
* Uses a two-step process to prevent UI flickering:
|
|
13
7
|
* 1. Fetches new data into the store
|
|
14
8
|
* 2. Updates the component with a store-only policy
|
|
15
9
|
*/
|
|
16
|
-
function useRefetchOnLicenseChanges(_ref) {
|
|
10
|
+
export function useRefetchOnLicenseChanges(_ref) {
|
|
17
11
|
let {
|
|
18
12
|
environment,
|
|
19
13
|
refetch,
|
|
@@ -23,12 +17,12 @@ function useRefetchOnLicenseChanges(_ref) {
|
|
|
23
17
|
const {
|
|
24
18
|
licenseOptionsSpecs,
|
|
25
19
|
orderVariableSelections
|
|
26
|
-
} =
|
|
27
|
-
|
|
20
|
+
} = useLicenseAndOrderVariables();
|
|
21
|
+
useEffect(() => {
|
|
28
22
|
let mounted = true;
|
|
29
23
|
|
|
30
24
|
// First fetch the data into the store
|
|
31
|
-
const subscription =
|
|
25
|
+
const subscription = fetchQuery(environment, query, {
|
|
32
26
|
...variables,
|
|
33
27
|
licenseOptions: licenseOptionsSpecs,
|
|
34
28
|
orderVariables: orderVariableSelections
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ResizeObserverCtor = new (callback: ResizeObserverCallback) => {
|
|
2
|
+
observe: (target: Element) => void;
|
|
3
|
+
unobserve?: (target: Element) => void;
|
|
4
|
+
disconnect?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type UseResizeObserverOptions = {
|
|
7
|
+
polyfill?: ResizeObserverCtor | null;
|
|
8
|
+
};
|
|
9
|
+
export type UseResizeObserverCallback = (entry: ResizeObserverEntry, observer: ResizeObserver) => void;
|
|
10
|
+
export default function useResizeObserver<T extends Element>(target: React.RefObject<T | null> | T | null, callback: UseResizeObserverCallback, options?: UseResizeObserverOptions): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
// Loose constructor type so the SSR no-op polyfills used as fallbacks (which
|
|
4
|
+
// don't implement `disconnect`) still type-check.
|
|
5
|
+
|
|
6
|
+
export default function useResizeObserver(target, callback) {
|
|
7
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8
|
+
const callbackRef = useRef(callback);
|
|
9
|
+
callbackRef.current = callback;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const element = target && 'current' in target ? target.current : target;
|
|
12
|
+
if (!element) return;
|
|
13
|
+
const Ctor = options.polyfill ?? (typeof ResizeObserver !== 'undefined' ? ResizeObserver : null);
|
|
14
|
+
if (!Ctor) return;
|
|
15
|
+
const observer = new Ctor(entries => {
|
|
16
|
+
for (const entry of entries) callbackRef.current(entry, observer);
|
|
17
|
+
});
|
|
18
|
+
observer.observe(element);
|
|
19
|
+
return () => {
|
|
20
|
+
if (observer.disconnect) observer.disconnect();else if (observer.unobserve) observer.unobserve(element);
|
|
21
|
+
};
|
|
22
|
+
}, [target, options.polyfill]);
|
|
23
|
+
}
|
package/dist/hooks.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.useNewPortalElement = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
const useNewPortalElement = () => {
|
|
9
|
-
const elementRef = (0, _react.useRef)(document.createElement('div'));
|
|
10
|
-
(0, _react.useEffect)(() => {
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
export const useNewPortalElement = () => {
|
|
3
|
+
const elementRef = useRef(document.createElement('div'));
|
|
4
|
+
useEffect(() => {
|
|
11
5
|
document.body.appendChild(elementRef.current);
|
|
12
6
|
return () => {
|
|
13
7
|
elementRef.current.remove();
|
|
14
8
|
};
|
|
15
9
|
}, []);
|
|
16
10
|
return elementRef;
|
|
17
|
-
};
|
|
18
|
-
exports.useNewPortalElement = useNewPortalElement;
|
|
11
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { configure, getConfig } from './config';
|
|
2
|
-
export type { FontdueConfig } from './config';
|
|
1
|
+
export { configure, getConfig } from './config.js';
|
|
2
|
+
export type { FontdueConfig } from './config.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { configure, getConfig } from './config';
|
|
1
|
+
export { configure, getConfig } from './config.js';
|
package/dist/react-ranger.d.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/react-ranger.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useRanger = useRanger;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
import React from 'react';
|
|
9
2
|
const getBoundingClientRect = element => {
|
|
10
3
|
const rect = element.getBoundingClientRect();
|
|
11
4
|
return {
|
|
@@ -15,9 +8,9 @@ const getBoundingClientRect = element => {
|
|
|
15
8
|
};
|
|
16
9
|
const sortNumList = arr => [...arr].sort((a, b) => Number(a) - Number(b));
|
|
17
10
|
const useGetLatest = val => {
|
|
18
|
-
const ref =
|
|
11
|
+
const ref = React.useRef(val);
|
|
19
12
|
ref.current = val;
|
|
20
|
-
return
|
|
13
|
+
return React.useCallback(() => ref.current, []);
|
|
21
14
|
};
|
|
22
15
|
const linearInterpolator = {
|
|
23
16
|
getPercentageForValue: (val, min, max) => {
|
|
@@ -33,7 +26,7 @@ const linearInterpolator = {
|
|
|
33
26
|
return value + min;
|
|
34
27
|
}
|
|
35
28
|
};
|
|
36
|
-
function useRanger(_ref) {
|
|
29
|
+
export function useRanger(_ref) {
|
|
37
30
|
let {
|
|
38
31
|
interpolator = linearInterpolator,
|
|
39
32
|
tickSize = 10,
|
|
@@ -46,8 +39,8 @@ function useRanger(_ref) {
|
|
|
46
39
|
onDrag,
|
|
47
40
|
stepSize
|
|
48
41
|
} = _ref;
|
|
49
|
-
const [activeHandleIndex, setActiveHandleIndex] =
|
|
50
|
-
const [tempValues, setTempValues] =
|
|
42
|
+
const [activeHandleIndex, setActiveHandleIndex] = React.useState(null);
|
|
43
|
+
const [tempValues, setTempValues] = React.useState();
|
|
51
44
|
const getLatest = useGetLatest({
|
|
52
45
|
activeHandleIndex,
|
|
53
46
|
onChange,
|
|
@@ -55,12 +48,12 @@ function useRanger(_ref) {
|
|
|
55
48
|
values,
|
|
56
49
|
tempValues
|
|
57
50
|
});
|
|
58
|
-
const trackElRef =
|
|
59
|
-
const getValueForClientX =
|
|
51
|
+
const trackElRef = React.useRef();
|
|
52
|
+
const getValueForClientX = React.useCallback(clientX => {
|
|
60
53
|
const trackDims = getBoundingClientRect(trackElRef.current);
|
|
61
54
|
return interpolator.getValueForClientX(clientX, trackDims, min, max);
|
|
62
55
|
}, [interpolator, max, min]);
|
|
63
|
-
const getNextStep =
|
|
56
|
+
const getNextStep = React.useCallback((val, direction) => {
|
|
64
57
|
if (steps) {
|
|
65
58
|
let currIndex = steps.indexOf(val);
|
|
66
59
|
let nextIndex = currIndex + direction;
|
|
@@ -83,7 +76,7 @@ function useRanger(_ref) {
|
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
78
|
}, [max, min, stepSize, steps]);
|
|
86
|
-
const roundToStep =
|
|
79
|
+
const roundToStep = React.useCallback(val => {
|
|
87
80
|
let left = min;
|
|
88
81
|
let right = max;
|
|
89
82
|
if (steps) {
|
|
@@ -111,7 +104,7 @@ function useRanger(_ref) {
|
|
|
111
104
|
}
|
|
112
105
|
return right;
|
|
113
106
|
}, [max, min, stepSize, steps]);
|
|
114
|
-
const handleDrag =
|
|
107
|
+
const handleDrag = React.useCallback(e => {
|
|
115
108
|
const {
|
|
116
109
|
activeHandleIndex,
|
|
117
110
|
onDrag
|
|
@@ -126,7 +119,7 @@ function useRanger(_ref) {
|
|
|
126
119
|
setTempValues(newValues);
|
|
127
120
|
}
|
|
128
121
|
}, [getLatest, getValueForClientX, roundToStep, values]);
|
|
129
|
-
const handleKeyDown =
|
|
122
|
+
const handleKeyDown = React.useCallback((e, i) => {
|
|
130
123
|
const {
|
|
131
124
|
values,
|
|
132
125
|
onChange = () => {}
|
|
@@ -141,7 +134,7 @@ function useRanger(_ref) {
|
|
|
141
134
|
onChange(sortedValues);
|
|
142
135
|
}
|
|
143
136
|
}, [getLatest, getNextStep]);
|
|
144
|
-
const handlePress =
|
|
137
|
+
const handlePress = React.useCallback((e, i) => {
|
|
145
138
|
setActiveHandleIndex(i);
|
|
146
139
|
const handleRelease = e => {
|
|
147
140
|
const {
|
|
@@ -165,14 +158,14 @@ function useRanger(_ref) {
|
|
|
165
158
|
document.addEventListener('mouseup', handleRelease);
|
|
166
159
|
document.addEventListener('touchend', handleRelease);
|
|
167
160
|
}, [getLatest, handleDrag]);
|
|
168
|
-
const getPercentageForValue =
|
|
161
|
+
const getPercentageForValue = React.useCallback(val => {
|
|
169
162
|
const pct = interpolator.getPercentageForValue(val, min, max);
|
|
170
163
|
// Round to 4 decimal places for consistent SSR/client hydration
|
|
171
164
|
return Math.round(pct * 10000) / 10000;
|
|
172
165
|
}, [interpolator, max, min]);
|
|
173
166
|
|
|
174
167
|
// Build the ticks
|
|
175
|
-
const ticks =
|
|
168
|
+
const ticks = React.useMemo(() => {
|
|
176
169
|
let ticks = controlledTicks || steps;
|
|
177
170
|
if (!ticks) {
|
|
178
171
|
ticks = [min];
|
|
@@ -203,7 +196,7 @@ function useRanger(_ref) {
|
|
|
203
196
|
}
|
|
204
197
|
}));
|
|
205
198
|
}, [controlledTicks, getPercentageForValue, max, min, steps, tickSize]);
|
|
206
|
-
const segments =
|
|
199
|
+
const segments = React.useMemo(() => {
|
|
207
200
|
const sortedValues = sortNumList(tempValues || values);
|
|
208
201
|
return [...sortedValues, max].map((value, i) => ({
|
|
209
202
|
value,
|
|
@@ -228,7 +221,7 @@ function useRanger(_ref) {
|
|
|
228
221
|
}
|
|
229
222
|
}));
|
|
230
223
|
}, [getPercentageForValue, max, min, tempValues, values]);
|
|
231
|
-
const handles =
|
|
224
|
+
const handles = React.useMemo(() => (tempValues || values).map((value, i) => ({
|
|
232
225
|
value,
|
|
233
226
|
active: i === activeHandleIndex,
|
|
234
227
|
getHandleProps: function () {
|
package/dist/reducer.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CollectionStyleSkusMap } from './components/Root/productState';
|
|
1
|
+
import { CollectionStyleSkusMap } from './components/Root/productState.js';
|
|
2
2
|
import { Reducer } from 'redux';
|
|
3
|
-
import { productState_Query$data } from './__generated__/productState_Query.graphql';
|
|
4
|
-
import type { RouteConfig } from './components/StoreModal/routes';
|
|
5
|
-
import { collectionSkuIdsDifferences, isSelected } from './utils';
|
|
6
|
-
import { Config } from './components/ConfigContext';
|
|
3
|
+
import { productState_Query$data } from './__generated__/productState_Query.graphql.js';
|
|
4
|
+
import type { RouteConfig } from './components/StoreModal/routes.js';
|
|
5
|
+
import { collectionSkuIdsDifferences, isSelected } from './utils.js';
|
|
6
|
+
import { Config } from './components/ConfigContext.js';
|
|
7
7
|
export { collectionSkuIdsDifferences, isSelected };
|
|
8
8
|
interface LicenseOptionSpec {
|
|
9
9
|
licenseId: string;
|
package/dist/reducer.js
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "collectionSkuIdsDifferences", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _utils.collectionSkuIdsDifferences;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
exports.createDefaultStore = createDefaultStore;
|
|
14
|
-
exports.default = void 0;
|
|
15
|
-
Object.defineProperty(exports, "isSelected", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () {
|
|
18
|
-
return _utils.isSelected;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
var _productState = require("./components/Root/productState");
|
|
22
|
-
var _redux = require("redux");
|
|
23
|
-
var _reactRedux = require("react-redux");
|
|
24
|
-
var _utils = require("./utils");
|
|
25
|
-
var _ConfigContext = require("./components/ConfigContext");
|
|
1
|
+
import { populateProductStateReducer } from './components/Root/productState.js';
|
|
2
|
+
import { createStore } from 'redux';
|
|
3
|
+
import { shallowEqual } from 'react-redux';
|
|
4
|
+
import { collectionSkuIdsDifferences, collTransitivelyContainsSkuId, isSelected } from './utils.js';
|
|
5
|
+
import { makeConfig } from './components/ConfigContext.js';
|
|
6
|
+
export { collectionSkuIdsDifferences, isSelected };
|
|
26
7
|
const unselectLicense = (state, action) => {
|
|
27
8
|
if (!(action.type === 'PRECART_UNSELECT_LICENSE' || action.type === 'PRECART_TOGGLE_LICENSE')) return state;
|
|
28
9
|
return {
|
|
@@ -78,8 +59,8 @@ const selectLicenseOption = (state, action) => {
|
|
|
78
59
|
})
|
|
79
60
|
};
|
|
80
61
|
};
|
|
81
|
-
const collectionSkuIdWithDiscount = (state, skuId) => {
|
|
82
|
-
const differences =
|
|
62
|
+
export const collectionSkuIdWithDiscount = (state, skuId) => {
|
|
63
|
+
const differences = collectionSkuIdsDifferences(state, skuId);
|
|
83
64
|
const collectionId = Object.keys(differences).filter(collSkuId => differences[collSkuId] <= state.skuPrices[skuId]).reduce((smallest, key) => {
|
|
84
65
|
if (!smallest || differences[key] < differences[smallest]) return key;
|
|
85
66
|
if (differences[key] === differences[smallest]) {
|
|
@@ -101,8 +82,7 @@ const collectionSkuIdWithDiscount = (state, skuId) => {
|
|
|
101
82
|
if (collectionId) return [collectionId, differences[collectionId]];
|
|
102
83
|
return [null, null];
|
|
103
84
|
};
|
|
104
|
-
|
|
105
|
-
const selectedCollectionSkuIdContainingSkuId = (state, skuId) => Object.keys(state.selectedSkuIds).filter(id => state.selectedSkuIds[id] === true).find(selectedSkuId => (0, _utils.collTransitivelyContainsSkuId)(state.collectionStyleSkus, selectedSkuId, skuId));
|
|
85
|
+
const selectedCollectionSkuIdContainingSkuId = (state, skuId) => Object.keys(state.selectedSkuIds).filter(id => state.selectedSkuIds[id] === true).find(selectedSkuId => collTransitivelyContainsSkuId(state.collectionStyleSkus, selectedSkuId, skuId));
|
|
106
86
|
const setKeysFalse = (acc, key) => {
|
|
107
87
|
acc[key] = false;
|
|
108
88
|
return acc;
|
|
@@ -172,7 +152,7 @@ const unselectSkus = state => ({
|
|
|
172
152
|
});
|
|
173
153
|
const storeModalNavigate = (state, action) => {
|
|
174
154
|
if (action.type !== 'STORE_MODAL_NAVIGATE') return state;
|
|
175
|
-
if (state.storeModalRoute.name === action.route &&
|
|
155
|
+
if (state.storeModalRoute.name === action.route && shallowEqual(state.storeModalRoute.variables, action.variables)) {
|
|
176
156
|
return state;
|
|
177
157
|
}
|
|
178
158
|
return {
|
|
@@ -215,7 +195,7 @@ const reducer = (state, action) => {
|
|
|
215
195
|
if (!state) throw 'Reducer called without state';
|
|
216
196
|
switch (action.type) {
|
|
217
197
|
case 'POPULATE_PRODUCT_STATE':
|
|
218
|
-
return
|
|
198
|
+
return populateProductStateReducer(state, action);
|
|
219
199
|
case 'PRECART_TOGGLE_LICENSE':
|
|
220
200
|
return toggleLicense(state, action);
|
|
221
201
|
case 'PRECART_UNSELECT_LICENSE':
|
|
@@ -265,9 +245,9 @@ const reducer = (state, action) => {
|
|
|
265
245
|
return state;
|
|
266
246
|
}
|
|
267
247
|
};
|
|
268
|
-
function createDefaultStore(config) {
|
|
269
|
-
const configValue =
|
|
270
|
-
return
|
|
248
|
+
export function createDefaultStore(config) {
|
|
249
|
+
const configValue = makeConfig(config);
|
|
250
|
+
return createStore(reducer, {
|
|
271
251
|
selectedSkuIds: {},
|
|
272
252
|
// { [skuId]: Boolean }
|
|
273
253
|
licenseOptions: [],
|
|
@@ -288,5 +268,4 @@ function createDefaultStore(config) {
|
|
|
288
268
|
licenseeIsBillingIdentity: null
|
|
289
269
|
});
|
|
290
270
|
}
|
|
291
|
-
|
|
292
|
-
exports.default = _default;
|
|
271
|
+
export default reducer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Environment, RequestParameters, QueryResponseCache, Variables, GraphQLResponse } from 'relay-runtime';
|
|
2
|
+
export declare function createNetworkFetch(options?: CreateRelayEnvironmentOptions): (request: RequestParameters, variables: Variables) => Promise<GraphQLResponse>;
|
|
2
3
|
export declare const networkFetch: (request: RequestParameters, variables: Variables) => Promise<GraphQLResponse>;
|
|
3
4
|
export declare const responseCache: QueryResponseCache | null;
|
|
4
5
|
interface CreateRelayEnvironmentOptions {
|
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createEnvironment = createEnvironment;
|
|
7
|
-
exports.responseCache = exports.networkFetch = void 0;
|
|
8
|
-
exports.useCurrentEnvironment = useCurrentEnvironment;
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _relayRuntime = require("relay-runtime");
|
|
11
|
-
var _corsError = require("../corsError");
|
|
12
|
-
var _package = require("../../package.json");
|
|
13
|
-
// @ts-ignore - JSON import
|
|
1
|
+
import { Environment, Network, RecordSource, Store, QueryResponseCache } from 'relay-runtime';
|
|
2
|
+
import { handlePossibleCorsError } from '../corsError.js';
|
|
3
|
+
import { getConfig } from '../config.js';
|
|
14
4
|
|
|
5
|
+
// `__FONTDUE_JS_VERSION__` is replaced by an inline babel plugin
|
|
6
|
+
// (defineVersionPlugin in .babelrc.cjs) with the literal package.json#version.
|
|
7
|
+
const version = "3.0.0-alpha1";
|
|
15
8
|
const IS_SERVER = typeof window === typeof undefined;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
|
|
10
|
+
// Read env from either process.env (Node/Next.js) or import.meta.env (Vite/Astro).
|
|
11
|
+
// Prefer the framework-agnostic FONTDUE_URL name; fall back to NEXT_PUBLIC_FONTDUE_URL
|
|
12
|
+
// for backwards compatibility with existing Next.js integrations.
|
|
13
|
+
function readEnv(name) {
|
|
14
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
15
|
+
const v = process.env[name];
|
|
16
|
+
if (v != null && v !== '') return v;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
// @ts-ignore - import.meta.env is Vite/Astro-specific
|
|
20
|
+
const metaEnv = typeof import.meta !== 'undefined' ? import.meta.env : undefined;
|
|
21
|
+
if (metaEnv) {
|
|
22
|
+
const v = metaEnv[name] ?? metaEnv[`PUBLIC_${name}`] ?? metaEnv[`VITE_${name}`];
|
|
23
|
+
if (v != null && v !== '') return v;
|
|
24
|
+
}
|
|
25
|
+
} catch {}
|
|
26
|
+
return undefined;
|
|
19
27
|
}
|
|
20
|
-
|
|
28
|
+
|
|
29
|
+
// On Next.js client bundles, only LITERAL `process.env.NAME` accesses get
|
|
30
|
+
// inlined at build time — `process.env[dynamicName]` stays as a runtime
|
|
31
|
+
// lookup that returns undefined in the browser. Check literal references
|
|
32
|
+
// first so existing Next.js consumers keep working without changes.
|
|
33
|
+
const NEXT_PUBLIC_URL = typeof process !== 'undefined' && process.env ? process.env.NEXT_PUBLIC_FONTDUE_URL : undefined;
|
|
34
|
+
const NEXT_PUBLIC_STRIPE = typeof process !== 'undefined' && process.env ? process.env.NEXT_PUBLIC_FONTDUE_STRIPE_INTEGRATION : undefined;
|
|
35
|
+
const FONTDUE_URL = readEnv('FONTDUE_URL') ?? readEnv('NEXT_PUBLIC_FONTDUE_URL') ?? NEXT_PUBLIC_URL;
|
|
36
|
+
const STRIPE_INTEGRATION = readEnv('FONTDUE_STRIPE_INTEGRATION') ?? readEnv('NEXT_PUBLIC_FONTDUE_STRIPE_INTEGRATION') ?? NEXT_PUBLIC_STRIPE;
|
|
21
37
|
const CACHE_TTL = 10 * 1000; // 10 seconds, to resolve preloaded results
|
|
22
38
|
|
|
23
|
-
function createNetworkFetch(options) {
|
|
39
|
+
export function createNetworkFetch(options) {
|
|
24
40
|
return async function networkFetch(request, variables) {
|
|
25
|
-
const
|
|
41
|
+
const base = (options === null || options === void 0 ? void 0 : options.url) ?? getConfig().url ?? FONTDUE_URL;
|
|
42
|
+
if (IS_SERVER && (base == null || base === '')) {
|
|
43
|
+
throw new Error('fontdue-js: no Fontdue URL configured for server-side fetch. ' + 'Call configure({ url }) at app startup, set FONTDUE_URL in your environment, ' + 'or pass `url` explicitly to loadSerializableQuery / createEnvironment.');
|
|
44
|
+
}
|
|
45
|
+
const url = `${base ?? ''}/graphql`;
|
|
26
46
|
for (let attempt = 0; attempt <= 2; attempt++) {
|
|
27
47
|
try {
|
|
28
48
|
const resp = await fetch(url + `?queryName=${request.name}`, {
|
|
@@ -31,8 +51,8 @@ function createNetworkFetch(options) {
|
|
|
31
51
|
headers: {
|
|
32
52
|
Accept: 'application/json',
|
|
33
53
|
'Content-Type': 'application/json',
|
|
34
|
-
'fontdue-stripe-integration':
|
|
35
|
-
'fontdue-client-version':
|
|
54
|
+
'fontdue-stripe-integration': (options === null || options === void 0 ? void 0 : options.stripeIntegration) ?? getConfig().stripeIntegration ?? STRIPE_INTEGRATION ?? 'dynamic',
|
|
55
|
+
'fontdue-client-version': version
|
|
36
56
|
},
|
|
37
57
|
body: JSON.stringify({
|
|
38
58
|
query: request.text,
|
|
@@ -64,7 +84,7 @@ function createNetworkFetch(options) {
|
|
|
64
84
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
65
85
|
continue;
|
|
66
86
|
}
|
|
67
|
-
if (
|
|
87
|
+
if (handlePossibleCorsError(error, url)) {
|
|
68
88
|
return {
|
|
69
89
|
data: undefined,
|
|
70
90
|
errors: [{
|
|
@@ -80,13 +100,11 @@ function createNetworkFetch(options) {
|
|
|
80
100
|
throw new Error('Unexpected: exhausted retries');
|
|
81
101
|
};
|
|
82
102
|
}
|
|
83
|
-
const networkFetch = createNetworkFetch();
|
|
84
|
-
|
|
85
|
-
const responseCache = IS_SERVER ? null : new _relayRuntime.QueryResponseCache({
|
|
103
|
+
export const networkFetch = createNetworkFetch();
|
|
104
|
+
export const responseCache = IS_SERVER ? null : new QueryResponseCache({
|
|
86
105
|
size: 250,
|
|
87
106
|
ttl: CACHE_TTL
|
|
88
107
|
});
|
|
89
|
-
exports.responseCache = responseCache;
|
|
90
108
|
function createNetwork(options) {
|
|
91
109
|
async function fetchResponse(params, variables, cacheConfig) {
|
|
92
110
|
const isQuery = params.operationKind === 'query';
|
|
@@ -101,20 +119,27 @@ function createNetwork(options) {
|
|
|
101
119
|
}
|
|
102
120
|
return createNetworkFetch(options)(params, variables);
|
|
103
121
|
}
|
|
104
|
-
const network =
|
|
122
|
+
const network = Network.create(fetchResponse);
|
|
105
123
|
return network;
|
|
106
124
|
}
|
|
107
|
-
function createEnvironment(options) {
|
|
108
|
-
return new
|
|
125
|
+
export function createEnvironment(options) {
|
|
126
|
+
return new Environment({
|
|
109
127
|
network: createNetwork(options),
|
|
110
|
-
store: new
|
|
128
|
+
store: new Store(RecordSource.create()),
|
|
111
129
|
isServer: IS_SERVER
|
|
112
130
|
});
|
|
113
131
|
}
|
|
114
|
-
|
|
132
|
+
|
|
133
|
+
// Client-side Relay environment is a module-level singleton so multiple
|
|
134
|
+
// FontdueProviders on a page (e.g. one per Astro island) share cache and
|
|
135
|
+
// data. Server-side stays per-render to avoid cross-request pollution.
|
|
136
|
+
let clientEnvironment = null;
|
|
137
|
+
export function useCurrentEnvironment(options) {
|
|
115
138
|
if (IS_SERVER) {
|
|
116
139
|
return createEnvironment(options);
|
|
117
140
|
}
|
|
118
|
-
|
|
119
|
-
|
|
141
|
+
if (clientEnvironment == null) {
|
|
142
|
+
clientEnvironment = createEnvironment(options);
|
|
143
|
+
}
|
|
144
|
+
return clientEnvironment;
|
|
120
145
|
}
|
|
@@ -43,5 +43,9 @@ export interface SerializablePreloadedQuery<TQuery extends OperationType> {
|
|
|
43
43
|
type RequireAllWithNull<T> = {
|
|
44
44
|
[K in keyof T]-?: T[K] | null;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export interface LoadSerializableQueryOptions {
|
|
47
|
+
url?: string;
|
|
48
|
+
stripeIntegration?: 'card-element' | 'dynamic';
|
|
49
|
+
}
|
|
50
|
+
export default function loadSerializableQuery<TQuery extends OperationType>(query: GraphQLTaggedNode, variables: RequireAllWithNull<VariablesOf<TQuery>>, options?: LoadSerializableQueryOptions): Promise<SerializablePreloadedQuery<TQuery>>;
|
|
47
51
|
export {};
|