fontdue-js 2.28.0 → 3.0.0-alpha10
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/README.md +639 -93
- 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__/FontdueAdminToolbarStaffQuery.graphql.d.ts +20 -0
- package/dist/__generated__/{TestModeBannerQuery.graphql.js → FontdueAdminToolbarStaffQuery.graphql.js} +11 -18
- package/dist/__generated__/FontdueAdminToolbarTokenMutation.graphql.d.ts +18 -0
- package/dist/__generated__/FontdueAdminToolbarTokenMutation.graphql.js +56 -0
- package/dist/__generated__/FontdueProviderQuery.graphql.d.ts +19 -0
- package/dist/__generated__/FontdueProviderQuery.graphql.js +140 -0
- 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__/ServerConfigProvider_viewer.graphql.d.ts +23 -0
- package/dist/__generated__/ServerConfigProvider_viewer.graphql.js +57 -0
- 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__/TestModeBanner_viewer.graphql.d.ts +19 -0
- package/dist/__generated__/TestModeBanner_viewer.graphql.js +36 -0
- package/dist/__generated__/ThemeConfig_viewer.graphql.d.ts +19 -0
- package/dist/__generated__/ThemeConfig_viewer.graphql.js +36 -0
- package/dist/__generated__/TypeTesterFamiliesQuery.graphql.js +1 -8
- package/dist/__generated__/TypeTesterFamiliesStylesQuery.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__/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__/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__/VariableTableAmounts_option.graphql.js +1 -8
- package/dist/__generated__/VariableTableAmounts_variable.graphql.js +1 -8
- package/dist/__generated__/orderTrackingUpdateOrderTrackingMutation.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/__tests__/fontLoader.test.js +24 -26
- package/dist/__tests__/licenseExclusions.test.js +27 -30
- package/dist/__tests__/networkFetch.test.js +66 -0
- package/dist/__tests__/nextAdapter.test.js +447 -0
- package/dist/components/AddToCartBanner/index.js +19 -29
- package/dist/components/BuyButton/index.d.ts +29 -6
- package/dist/components/BuyButton/index.js +98 -57
- package/dist/components/BuyButton/index.server.d.ts +9 -2
- package/dist/components/BuyButton/index.server.js +20 -17
- package/dist/components/BuyingOptions/index.d.ts +9 -0
- 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 +102 -113
- 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/orderTracking.js +8 -15
- 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 +5 -8
- package/dist/components/CartButton/index.js +53 -62
- package/dist/components/CharacterViewer/StyleSelect.d.ts +1 -1
- package/dist/components/CharacterViewer/StyleSelect.js +10 -17
- package/dist/components/CharacterViewer/index.d.ts +29 -6
- package/dist/components/CharacterViewer/index.js +150 -102
- package/dist/components/CharacterViewer/index.server.d.ts +9 -2
- package/dist/components/CharacterViewer/index.server.js +21 -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 +13 -12
- package/dist/components/ConfigContext.js +29 -11
- package/dist/components/ConsentBanner/consent.js +6 -17
- package/dist/components/ConsentBanner/index.js +19 -29
- package/dist/components/CookieNotification/index.d.ts +13 -0
- package/dist/components/CookieNotification/index.js +23 -31
- 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 +37 -38
- 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 +2 -2
- package/dist/components/FontStyle/index.js +8 -15
- package/dist/components/FontdueAdminToolbar/index.d.ts +2 -0
- package/dist/components/FontdueAdminToolbar/index.js +146 -0
- package/dist/components/FontdueContextProvider/index.d.ts +18 -0
- package/dist/components/FontdueContextProvider/index.js +148 -0
- package/dist/components/FontdueProvider/index.d.ts +19 -3
- package/dist/components/FontdueProvider/index.js +75 -13
- package/dist/components/FontdueProvider/index.server.d.ts +6 -3
- package/dist/components/FontdueProvider/index.server.js +37 -21
- 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 +11 -6
- package/dist/components/NewsletterSignup/index.js +75 -60
- package/dist/components/NewsletterSignup/index.server.d.ts +7 -2
- package/dist/components/NewsletterSignup/index.server.js +17 -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 +4 -2
- package/dist/components/ServerConfigProvider/index.js +12 -20
- 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 +55 -65
- 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.d.ts +5 -1
- package/dist/components/StoreModal/index.js +24 -20
- 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 +11 -4
- package/dist/components/TestFontsForm/index.js +80 -65
- package/dist/components/TestFontsForm/index.server.d.ts +7 -2
- package/dist/components/TestFontsForm/index.server.js +17 -14
- package/dist/components/TestModeBanner/index.d.ts +4 -1
- package/dist/components/TestModeBanner/index.js +13 -27
- package/dist/components/TextField/index.js +9 -17
- package/dist/components/ThemeConfig/index.d.ts +3 -5
- package/dist/components/ThemeConfig/index.js +12 -36
- 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/TypeTesterFamilies.d.ts +1 -1
- package/dist/components/TypeTester/TypeTesterFamilies.js +26 -37
- 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 +20 -6
- package/dist/components/TypeTester/TypeTesterStandalone.js +49 -39
- package/dist/components/TypeTester/TypeTesterStandalone.server.d.ts +6 -2
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +20 -16
- 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 +3 -3
- package/dist/components/TypeTester/TypeTesterStyleSelectData.js +31 -40
- 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 +2 -2
- 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 +3 -3
- package/dist/components/TypeTester/useTypeTesterStyler.js +6 -13
- package/dist/components/TypeTesters/TypeTestersElement.js +4 -12
- package/dist/components/TypeTesters/index.d.ts +22 -5
- package/dist/components/TypeTesters/index.js +118 -71
- package/dist/components/TypeTesters/index.server.d.ts +7 -2
- package/dist/components/TypeTesters/index.server.js +20 -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 +10 -20
- 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 +20 -29
- 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 +114 -122
- package/dist/components/useConsent.js +4 -9
- package/dist/components/useFont.d.ts +1 -1
- 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 +3 -11
- package/dist/fontdue.css +127 -12
- package/dist/global-shim.d.ts +1 -0
- package/dist/global-shim.js +8 -0
- 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 +9 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/loadFontdueProviderQuery.d.ts +3 -0
- package/dist/loadFontdueProviderQuery.js +10 -0
- package/dist/next/config.d.ts +41 -0
- package/dist/next/config.js +193 -0
- package/dist/next/image-loader.d.ts +7 -0
- package/dist/next/image-loader.js +39 -0
- package/dist/next/index.d.ts +2 -0
- package/dist/next/index.js +10 -0
- package/dist/next/revalidate.d.ts +1 -0
- package/dist/next/revalidate.js +37 -0
- package/dist/next/tenant.d.ts +26 -0
- package/dist/next/tenant.js +169 -0
- 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 +74 -34
- package/dist/relay/loadSerializableQuery.d.ts +3 -1
- package/dist/relay/loadSerializableQuery.js +4 -8
- package/dist/relay/serverConfig.d.ts +16 -0
- package/dist/relay/serverConfig.js +38 -0
- 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 +2 -0
- package/dist/vite.js +141 -0
- package/package.json +13 -9
- package/scripts/addJsExtensionsBabelPlugin.cjs +62 -0
- package/types/globals.d.ts +3 -0
- package/types/next-cache.d.ts +6 -0
- package/types/next-navigation.d.ts +6 -0
- package/vitest.config.ts +4 -0
- package/dist/__generated__/ServerConfigProviderQuery.graphql.d.ts +0 -24
- package/dist/__generated__/ServerConfigProviderQuery.graphql.js +0 -108
- package/dist/__generated__/TestModeBannerQuery.graphql.d.ts +0 -20
- package/dist/__generated__/ThemeConfigQuery.graphql.d.ts +0 -20
- package/dist/__generated__/ThemeConfigQuery.graphql.js +0 -87
- package/dist/components/CartButton/index.server.d.ts +0 -3
- package/dist/components/CartButton/index.server.js +0 -18
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.d.ts +0 -14
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.js +0 -61
- package/dist/components/ThemeConfig/index.server.d.ts +0 -2
- package/dist/components/ThemeConfig/index.server.js +0 -17
- package/fontdue.css +0 -2733
- package/fontdue.css.map +0 -1
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _CollectionAa_Query2 = _interopRequireDefault(require("../../__generated__/CollectionAa_Query.graphql"));
|
|
8
|
-
var _CollectionAa_product2 = _interopRequireDefault(require("../../__generated__/CollectionAa_product.graphql"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _reactRelay = require("react-relay");
|
|
11
|
-
var _FontStyle = _interopRequireDefault(require("../FontStyle"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const CollectionAa = _ref => {
|
|
1
|
+
import _CollectionAa_Query from "../../__generated__/CollectionAa_Query.graphql.js";
|
|
2
|
+
import _CollectionAa_product from "../../__generated__/CollectionAa_product.graphql.js";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { graphql, useFragment, useLazyLoadQuery } from 'react-relay';
|
|
5
|
+
import FontStyle from '../FontStyle/index.js';
|
|
6
|
+
export const CollectionAa = _ref => {
|
|
14
7
|
let {
|
|
15
8
|
product: productKey
|
|
16
9
|
} = _ref;
|
|
17
|
-
const product =
|
|
10
|
+
const product = useFragment((_CollectionAa_product.hash && _CollectionAa_product.hash !== "c6b0113fe8474166dab3649c41880d84" && console.error("The definition of 'CollectionAa_product' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CollectionAa_product), productKey);
|
|
18
11
|
let fontStyle;
|
|
19
12
|
if ((product === null || product === void 0 ? void 0 : product.__typename) === 'Bundle') {
|
|
20
13
|
var _product$fontStyles;
|
|
@@ -23,19 +16,17 @@ const CollectionAa = _ref => {
|
|
|
23
16
|
fontStyle = product.featureStyle;
|
|
24
17
|
}
|
|
25
18
|
if (!fontStyle) return null;
|
|
26
|
-
return /*#__PURE__*/
|
|
19
|
+
return /*#__PURE__*/React.createElement(FontStyle, {
|
|
27
20
|
fontStyle: fontStyle
|
|
28
|
-
}, /*#__PURE__*/
|
|
21
|
+
}, /*#__PURE__*/React.createElement("span", null, "A"), /*#__PURE__*/React.createElement("span", null, "a"));
|
|
29
22
|
};
|
|
30
|
-
exports.CollectionAa = CollectionAa;
|
|
31
23
|
function CollectionAaQueryRenderer(_ref2) {
|
|
32
24
|
let {
|
|
33
25
|
collectionId
|
|
34
26
|
} = _ref2;
|
|
35
|
-
const data =
|
|
27
|
+
const data = useLazyLoadQuery((_CollectionAa_Query.hash && _CollectionAa_Query.hash !== "fbe1f59d074d964464c71ea00d2bd90f" && console.error("The definition of 'CollectionAa_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CollectionAa_Query), {
|
|
36
28
|
collectionId
|
|
37
29
|
});
|
|
38
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/React.createElement(CollectionAa, data);
|
|
39
31
|
}
|
|
40
|
-
|
|
41
|
-
exports.default = _default;
|
|
32
|
+
export default CollectionAaQueryRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type JSX } from 'react';
|
|
2
|
-
import { Download_order$data } from '../__generated__/Download_order.graphql';
|
|
2
|
+
import { Download_order$data } from '../__generated__/Download_order.graphql.js';
|
|
3
3
|
export interface Download_moduleProps {
|
|
4
4
|
open: boolean;
|
|
5
5
|
dismiss: () => void;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const ComponentsContext = /*#__PURE__*/_react.default.createContext({});
|
|
10
|
-
var _default = ComponentsContext;
|
|
11
|
-
exports.default = _default;
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const ComponentsContext = /*#__PURE__*/React.createContext({});
|
|
5
|
+
export default ComponentsContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TypeTesterConfig } from './TypeTester';
|
|
3
|
-
import { StoreModalConfig } from './StoreModal/types';
|
|
2
|
+
import { TypeTesterConfig } from './TypeTester/index.js';
|
|
3
|
+
import { StoreModalConfig } from './StoreModal/types.js';
|
|
4
4
|
import { Appearance } from '@stripe/stripe-js';
|
|
5
5
|
interface FormConfig {
|
|
6
6
|
checkboxStyle?: 'check' | 'cross';
|
|
@@ -31,6 +31,7 @@ export interface Config {
|
|
|
31
31
|
tracking?: TrackingConfig;
|
|
32
32
|
corsErrorModal?: boolean;
|
|
33
33
|
}
|
|
34
|
+
export declare const mergeConfig: (base?: Config, override?: Config) => Config;
|
|
34
35
|
export declare const makeConfig: (config?: Config) => {
|
|
35
36
|
typeTester: {
|
|
36
37
|
autofitOnChange: boolean;
|
|
@@ -44,9 +45,9 @@ export declare const makeConfig: (config?: Config) => {
|
|
|
44
45
|
selectable: boolean;
|
|
45
46
|
priceBar: boolean;
|
|
46
47
|
textInput: boolean;
|
|
47
|
-
initialMode: "
|
|
48
|
+
initialMode: "local" | "group";
|
|
48
49
|
groupEdit: boolean;
|
|
49
|
-
bulletStyle: "
|
|
50
|
+
bulletStyle: "round" | "square";
|
|
50
51
|
openTypeFeatures: {
|
|
51
52
|
buttonLabel: string;
|
|
52
53
|
interactionStyle: "select" | "panel";
|
|
@@ -59,9 +60,9 @@ export declare const makeConfig: (config?: Config) => {
|
|
|
59
60
|
}[] | undefined;
|
|
60
61
|
selectionStyle: "checkbox" | "bullet";
|
|
61
62
|
};
|
|
62
|
-
variableAxesPosition: import("./TypeTester/types").TypeTesterAxesPosition;
|
|
63
|
+
variableAxesPosition: import("./TypeTester/types.js").TypeTesterAxesPosition;
|
|
63
64
|
alignmentButtons: boolean;
|
|
64
|
-
initialAlignment: import("./TypeTester/types").Alignment;
|
|
65
|
+
initialAlignment: import("./TypeTester/types.js").Alignment;
|
|
65
66
|
size: {
|
|
66
67
|
label: string | false;
|
|
67
68
|
min: number;
|
|
@@ -89,7 +90,7 @@ export declare const makeConfig: (config?: Config) => {
|
|
|
89
90
|
storeModal: {
|
|
90
91
|
indexLayout: "styled-aa" | "styled-font-names";
|
|
91
92
|
indexExcludeTags: string[] | undefined;
|
|
92
|
-
productLicensesPosition: "
|
|
93
|
+
productLicensesPosition: "bottom" | "top";
|
|
93
94
|
hideAllCollections: boolean;
|
|
94
95
|
};
|
|
95
96
|
stripe: {
|
|
@@ -116,9 +117,9 @@ declare const _default: React.Context<{
|
|
|
116
117
|
selectable: boolean;
|
|
117
118
|
priceBar: boolean;
|
|
118
119
|
textInput: boolean;
|
|
119
|
-
initialMode: "
|
|
120
|
+
initialMode: "local" | "group";
|
|
120
121
|
groupEdit: boolean;
|
|
121
|
-
bulletStyle: "
|
|
122
|
+
bulletStyle: "round" | "square";
|
|
122
123
|
openTypeFeatures: {
|
|
123
124
|
buttonLabel: string;
|
|
124
125
|
interactionStyle: "select" | "panel";
|
|
@@ -131,9 +132,9 @@ declare const _default: React.Context<{
|
|
|
131
132
|
}[] | undefined;
|
|
132
133
|
selectionStyle: "checkbox" | "bullet";
|
|
133
134
|
};
|
|
134
|
-
variableAxesPosition: import("./TypeTester/types").TypeTesterAxesPosition;
|
|
135
|
+
variableAxesPosition: import("./TypeTester/types.js").TypeTesterAxesPosition;
|
|
135
136
|
alignmentButtons: boolean;
|
|
136
|
-
initialAlignment: import("./TypeTester/types").Alignment;
|
|
137
|
+
initialAlignment: import("./TypeTester/types.js").Alignment;
|
|
137
138
|
size: {
|
|
138
139
|
label: string | false;
|
|
139
140
|
min: number;
|
|
@@ -161,7 +162,7 @@ declare const _default: React.Context<{
|
|
|
161
162
|
storeModal: {
|
|
162
163
|
indexLayout: "styled-aa" | "styled-font-names";
|
|
163
164
|
indexExcludeTags: string[] | undefined;
|
|
164
|
-
productLicensesPosition: "
|
|
165
|
+
productLicensesPosition: "bottom" | "top";
|
|
165
166
|
hideAllCollections: boolean;
|
|
166
167
|
};
|
|
167
168
|
stripe: {
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.makeConfig = exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
3
|
+
import React from 'react';
|
|
9
4
|
const makeTypeTesterConfig = config => {
|
|
10
5
|
var _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$openTypeFeatu4, _config$size, _config$size2, _config$size3, _config$lineHeight, _config$lineHeight2, _config$lineHeight3, _config$letterSpacing, _config$letterSpacing2, _config$letterSpacing3, _config$columns, _config$columns2, _config$columns3;
|
|
11
6
|
let shy = (config === null || config === void 0 ? void 0 : config.shy) ?? false;
|
|
@@ -58,7 +53,32 @@ const makeTypeTesterConfig = config => {
|
|
|
58
53
|
}
|
|
59
54
|
};
|
|
60
55
|
};
|
|
61
|
-
const
|
|
56
|
+
const isPlainObject = value => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
57
|
+
function deepMerge(base, override) {
|
|
58
|
+
const result = {
|
|
59
|
+
...base
|
|
60
|
+
};
|
|
61
|
+
for (const key of Object.keys(override)) {
|
|
62
|
+
const overrideValue = override[key];
|
|
63
|
+
// A partial override should never clobber a set base value with `undefined`.
|
|
64
|
+
if (overrideValue === undefined) continue;
|
|
65
|
+
const baseValue = base[key];
|
|
66
|
+
result[key] = isPlainObject(baseValue) && isPlainObject(overrideValue) ? deepMerge(baseValue, overrideValue) : overrideValue;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Deep-merges `override` onto `base` for the (raw, pre-`makeConfig`) config
|
|
72
|
+
// tree. Nested objects merge recursively; arrays and scalars in `override`
|
|
73
|
+
// replace the corresponding base value. Used to layer a per-component config
|
|
74
|
+
// onto the config it inherits — see EnsureFontdueContext — so the component's
|
|
75
|
+
// keys win while everything else is preserved.
|
|
76
|
+
export const mergeConfig = (base, override) => {
|
|
77
|
+
if (!base) return override ?? {};
|
|
78
|
+
if (!override) return base;
|
|
79
|
+
return deepMerge(base, override);
|
|
80
|
+
};
|
|
81
|
+
export const makeConfig = config => {
|
|
62
82
|
var _config$form, _config$storeModal, _config$storeModal2, _config$storeModal3, _config$storeModal4, _config$stripe, _config$tracking, _config$tracking2, _config$tracking3, _config$tracking4;
|
|
63
83
|
return {
|
|
64
84
|
typeTester: makeTypeTesterConfig(config === null || config === void 0 ? void 0 : config.typeTester),
|
|
@@ -84,6 +104,4 @@ const makeConfig = config => {
|
|
|
84
104
|
corsErrorModal: (config === null || config === void 0 ? void 0 : config.corsErrorModal) ?? true
|
|
85
105
|
};
|
|
86
106
|
};
|
|
87
|
-
|
|
88
|
-
var _default = /*#__PURE__*/_react.default.createContext(makeConfig());
|
|
89
|
-
exports.default = _default;
|
|
107
|
+
export default /*#__PURE__*/React.createContext(makeConfig());
|
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.activateScripts = activateScripts;
|
|
7
|
-
exports.getClientAnonymousId = getClientAnonymousId;
|
|
8
|
-
exports.hasConsent = hasConsent;
|
|
9
|
-
exports.onConsent = onConsent;
|
|
10
|
-
exports.setClientAnonymousId = setClientAnonymousId;
|
|
11
|
-
exports.setConsent = setConsent;
|
|
12
1
|
const CONSENT_COOKIE = '_fontdue_cc';
|
|
13
2
|
const CONSENT_EVENT = 'fontdue:consent';
|
|
14
3
|
const MAX_AGE = 60 * 60 * 24 * 365; // 1 year
|
|
15
4
|
|
|
16
5
|
/** Store the client-generated anonymous_id so it can be sent with consent events. */
|
|
17
6
|
let clientAnonymousId;
|
|
18
|
-
function setClientAnonymousId(id) {
|
|
7
|
+
export function setClientAnonymousId(id) {
|
|
19
8
|
clientAnonymousId = id;
|
|
20
9
|
}
|
|
21
|
-
function getClientAnonymousId() {
|
|
10
|
+
export function getClientAnonymousId() {
|
|
22
11
|
return clientAnonymousId;
|
|
23
12
|
}
|
|
24
13
|
|
|
25
14
|
/** Parse the _fontdue_cc cookie and check if it contains the given category. */
|
|
26
|
-
function hasConsent(category) {
|
|
15
|
+
export function hasConsent(category) {
|
|
27
16
|
const match = document.cookie.match(new RegExp('(?:^|;\\s*)' + CONSENT_COOKIE + '=([^;]*)'));
|
|
28
17
|
if (!match) return false;
|
|
29
18
|
return match[1].split(',').includes(category);
|
|
30
19
|
}
|
|
31
20
|
|
|
32
21
|
/** Set the _fontdue_cc cookie with the given categories. */
|
|
33
|
-
function setConsent(categories) {
|
|
22
|
+
export function setConsent(categories) {
|
|
34
23
|
document.cookie = CONSENT_COOKIE + '=' + categories.join(',') + ';path=/;max-age=' + MAX_AGE + ';SameSite=Lax;Secure';
|
|
35
24
|
window.dispatchEvent(new CustomEvent(CONSENT_EVENT, {
|
|
36
25
|
detail: {
|
|
@@ -44,7 +33,7 @@ function setConsent(categories) {
|
|
|
44
33
|
* If already granted, calls immediately. Otherwise polls (500ms) and
|
|
45
34
|
* listens for the fontdue:consent event. Returns a cleanup function.
|
|
46
35
|
*/
|
|
47
|
-
function onConsent(category, callback) {
|
|
36
|
+
export function onConsent(category, callback) {
|
|
48
37
|
if (hasConsent(category)) {
|
|
49
38
|
callback();
|
|
50
39
|
return () => {};
|
|
@@ -71,7 +60,7 @@ function onConsent(category, callback) {
|
|
|
71
60
|
* Finds all <script type="text/plain" data-consent-category="<category>">
|
|
72
61
|
* elements and replaces them with executable copies.
|
|
73
62
|
*/
|
|
74
|
-
function activateScripts(category) {
|
|
63
|
+
export function activateScripts(category) {
|
|
75
64
|
const scripts = document.querySelectorAll(`script[type="text/plain"][data-consent-category="${category}"]`);
|
|
76
65
|
scripts.forEach(blocked => {
|
|
77
66
|
var _blocked$parentNode;
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
|
|
9
|
-
var _UrlContext = require("../UrlContext");
|
|
10
|
-
var _consent = require("./consent");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
+
import ConfigContext from '../ConfigContext.js';
|
|
3
|
+
import { useFontdueUrl } from '../UrlContext.js';
|
|
4
|
+
import { setConsent, activateScripts, getClientAnonymousId } from './consent.js';
|
|
14
5
|
const DEFAULT_MESSAGE = 'We use cookies to analyze site usage and improve your\u00A0experience.';
|
|
15
6
|
const ConsentBanner = () => {
|
|
16
|
-
const config =
|
|
17
|
-
const url =
|
|
7
|
+
const config = useContext(ConfigContext);
|
|
8
|
+
const url = useFontdueUrl();
|
|
18
9
|
|
|
19
10
|
// Start dismissed to avoid hydration mismatch (server has no document.cookie).
|
|
20
11
|
// Check on the client in useEffect.
|
|
21
|
-
const [dismissed, setDismissed] =
|
|
22
|
-
|
|
12
|
+
const [dismissed, setDismissed] = useState(true);
|
|
13
|
+
useEffect(() => {
|
|
23
14
|
if (!config.tracking.consentRequired) return;
|
|
24
15
|
if (!document.cookie.includes('_fontdue_cc=')) {
|
|
25
16
|
setDismissed(false);
|
|
@@ -37,7 +28,7 @@ const ConsentBanner = () => {
|
|
|
37
28
|
categories: categories.join(',')
|
|
38
29
|
}
|
|
39
30
|
};
|
|
40
|
-
const anonId =
|
|
31
|
+
const anonId = getClientAnonymousId();
|
|
41
32
|
if (anonId) body.anonymous_id = anonId;
|
|
42
33
|
fetch(`${url}/api/track`, {
|
|
43
34
|
method: 'POST',
|
|
@@ -49,36 +40,35 @@ const ConsentBanner = () => {
|
|
|
49
40
|
}).catch(() => {});
|
|
50
41
|
};
|
|
51
42
|
const handleAcceptAll = () => {
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
setConsent(['necessary', 'analytics']);
|
|
44
|
+
activateScripts('analytics');
|
|
54
45
|
if (config.tracking.enabled) {
|
|
55
46
|
sendConsentEvent(['necessary', 'analytics']);
|
|
56
47
|
}
|
|
57
48
|
setDismissed(true);
|
|
58
49
|
};
|
|
59
50
|
const handleReject = () => {
|
|
60
|
-
|
|
51
|
+
setConsent(['necessary']);
|
|
61
52
|
setDismissed(true);
|
|
62
53
|
};
|
|
63
|
-
return /*#__PURE__*/
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
64
55
|
className: "fontdue-consent-banner",
|
|
65
56
|
role: "region",
|
|
66
57
|
"aria-label": "Cookie consent"
|
|
67
|
-
}, /*#__PURE__*/
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
59
|
className: "fontdue-consent-banner__container"
|
|
69
|
-
}, /*#__PURE__*/
|
|
60
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
70
61
|
className: "fontdue-consent-banner__message"
|
|
71
|
-
}, message), /*#__PURE__*/
|
|
62
|
+
}, message), /*#__PURE__*/React.createElement("div", {
|
|
72
63
|
className: "fontdue-consent-banner__actions"
|
|
73
|
-
}, /*#__PURE__*/
|
|
64
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
74
65
|
type: "button",
|
|
75
66
|
className: "fontdue-consent-banner__button fontdue-consent-banner__button--secondary",
|
|
76
67
|
onClick: handleReject
|
|
77
|
-
}, "Necessary only"), /*#__PURE__*/
|
|
68
|
+
}, "Necessary only"), /*#__PURE__*/React.createElement("button", {
|
|
78
69
|
type: "button",
|
|
79
70
|
className: "fontdue-consent-banner__button fontdue-consent-banner__button--primary",
|
|
80
71
|
onClick: handleAcceptAll
|
|
81
72
|
}, "Accept all"))));
|
|
82
73
|
};
|
|
83
|
-
|
|
84
|
-
exports.default = _default;
|
|
74
|
+
export default ConsentBanner;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CookieNotificationProps {
|
|
3
|
+
siteTitle?: string;
|
|
4
|
+
}
|
|
5
|
+
interface CookieNotificationState {
|
|
6
|
+
dismissed: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default class CookieNotification extends React.Component<CookieNotificationProps, CookieNotificationState> {
|
|
9
|
+
constructor(props: CookieNotificationProps);
|
|
10
|
+
dismiss: () => void;
|
|
11
|
+
render(): React.JSX.Element | null;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,77 +1,70 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _store = _interopRequireDefault(require("store"));
|
|
9
|
-
var _ComponentsContext = _interopRequireDefault(require("../ComponentsContext"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore — `store` package has no published types
|
|
4
|
+
import store from 'store';
|
|
5
|
+
import ComponentsContext from '../ComponentsContext.js';
|
|
12
6
|
const DefaultCookieNotification = _ref => {
|
|
13
7
|
let {
|
|
14
8
|
onDismiss,
|
|
15
9
|
open,
|
|
16
10
|
siteTitle
|
|
17
11
|
} = _ref;
|
|
18
|
-
return /*#__PURE__*/
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
13
|
className: "cookie-notification",
|
|
20
14
|
"data-open": open
|
|
21
|
-
}, /*#__PURE__*/
|
|
15
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
16
|
className: "cookie-notification__container"
|
|
23
|
-
}, /*#__PURE__*/
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
18
|
className: "cookie-notification__text-container"
|
|
25
|
-
}, /*#__PURE__*/
|
|
19
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
26
20
|
className: "cookie-notification__label"
|
|
27
|
-
}, siteTitle, " website uses cookies"), /*#__PURE__*/
|
|
21
|
+
}, siteTitle, " website uses cookies"), /*#__PURE__*/React.createElement("p", {
|
|
28
22
|
className: "cookie-notification__text"
|
|
29
|
-
}, "We use cookies to ensure that we give you the best experience. By continuing to visit this site you agree to receive cookies from generaltypestudio.com. You can read more about cookies in our ", /*#__PURE__*/
|
|
23
|
+
}, "We use cookies to ensure that we give you the best experience. By continuing to visit this site you agree to receive cookies from generaltypestudio.com. You can read more about cookies in our ", /*#__PURE__*/React.createElement("a", {
|
|
30
24
|
href: "/privacy-policy"
|
|
31
|
-
}, "privacy policy"), ".")), /*#__PURE__*/
|
|
25
|
+
}, "privacy policy"), ".")), /*#__PURE__*/React.createElement("div", {
|
|
32
26
|
className: "cookie-notification__button-container"
|
|
33
|
-
}, /*#__PURE__*/
|
|
27
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
34
28
|
type: "button",
|
|
35
29
|
className: "cookie-notification__button",
|
|
36
30
|
onClick: onDismiss
|
|
37
31
|
}, "Got it"))));
|
|
38
32
|
};
|
|
39
|
-
|
|
33
|
+
function GetComponent(_ref2) {
|
|
40
34
|
let {
|
|
41
35
|
name,
|
|
42
36
|
fallback,
|
|
43
37
|
children
|
|
44
38
|
} = _ref2;
|
|
45
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/React.createElement(ComponentsContext.Consumer, null, components => {
|
|
46
40
|
const Component = components[name] || fallback;
|
|
47
41
|
return children(Component);
|
|
48
42
|
});
|
|
49
|
-
}
|
|
43
|
+
}
|
|
50
44
|
const CookieNotificationBase = _ref3 => {
|
|
51
45
|
let {
|
|
52
46
|
siteTitle,
|
|
53
47
|
dismiss,
|
|
54
48
|
open
|
|
55
49
|
} = _ref3;
|
|
56
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/React.createElement(GetComponent, {
|
|
57
51
|
name: "CookieNotification",
|
|
58
|
-
fallback: DefaultCookieNotification
|
|
59
|
-
|
|
60
|
-
}, Component => /*#__PURE__*/_react.default.createElement(Component, {
|
|
52
|
+
fallback: DefaultCookieNotification
|
|
53
|
+
}, Component => /*#__PURE__*/React.createElement(Component, {
|
|
61
54
|
onDismiss: dismiss,
|
|
62
55
|
siteTitle: siteTitle,
|
|
63
56
|
open: open
|
|
64
57
|
}));
|
|
65
58
|
};
|
|
66
|
-
class CookieNotification extends
|
|
59
|
+
export default class CookieNotification extends React.Component {
|
|
67
60
|
constructor(props) {
|
|
68
61
|
super(props);
|
|
69
62
|
this.state = {
|
|
70
|
-
dismissed:
|
|
63
|
+
dismissed: store.get('userAgreedCookies') || false
|
|
71
64
|
};
|
|
72
65
|
}
|
|
73
66
|
dismiss = () => {
|
|
74
|
-
|
|
67
|
+
store.set('userAgreedCookies', true);
|
|
75
68
|
this.setState({
|
|
76
69
|
dismissed: true
|
|
77
70
|
});
|
|
@@ -81,10 +74,9 @@ class CookieNotification extends _react.default.Component {
|
|
|
81
74
|
dismissed
|
|
82
75
|
} = this.state;
|
|
83
76
|
if (dismissed) return null;
|
|
84
|
-
return /*#__PURE__*/
|
|
77
|
+
return /*#__PURE__*/React.createElement(CookieNotificationBase, _extends({
|
|
85
78
|
dismiss: this.dismiss,
|
|
86
79
|
open: true
|
|
87
80
|
}, this.props));
|
|
88
81
|
}
|
|
89
|
-
}
|
|
90
|
-
exports.default = CookieNotification;
|
|
82
|
+
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.renderCorsErrorModal = renderCorsErrorModal;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _client = require("react-dom/client");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
10
3
|
const code = {
|
|
11
4
|
background: '#fef2f2',
|
|
12
5
|
padding: '2px 6px',
|
|
@@ -24,7 +17,7 @@ function CorsErrorModal(_ref) {
|
|
|
24
17
|
} catch {
|
|
25
18
|
// keep as-is
|
|
26
19
|
}
|
|
27
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
21
|
style: {
|
|
29
22
|
position: 'fixed',
|
|
30
23
|
inset: 0,
|
|
@@ -37,7 +30,7 @@ function CorsErrorModal(_ref) {
|
|
|
37
30
|
fontSize: 14,
|
|
38
31
|
lineHeight: 1.6
|
|
39
32
|
}
|
|
40
|
-
}, /*#__PURE__*/
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
34
|
style: {
|
|
42
35
|
background: 'white',
|
|
43
36
|
color: '#1f2937',
|
|
@@ -49,22 +42,22 @@ function CorsErrorModal(_ref) {
|
|
|
49
42
|
boxShadow: '0 8px 30px rgba(0,0,0,0.12)',
|
|
50
43
|
textAlign: 'left'
|
|
51
44
|
}
|
|
52
|
-
}, /*#__PURE__*/
|
|
45
|
+
}, /*#__PURE__*/React.createElement("strong", {
|
|
53
46
|
style: {
|
|
54
47
|
fontSize: 16,
|
|
55
48
|
color: '#dc2626'
|
|
56
49
|
}
|
|
57
|
-
}, "Cross-origin request blocked"), /*#__PURE__*/
|
|
50
|
+
}, "Cross-origin request blocked"), /*#__PURE__*/React.createElement("p", {
|
|
58
51
|
style: {
|
|
59
52
|
margin: '12px 0 0'
|
|
60
53
|
}
|
|
61
|
-
}, "Your website (", /*#__PURE__*/
|
|
54
|
+
}, "Your website (", /*#__PURE__*/React.createElement("code", {
|
|
62
55
|
style: code
|
|
63
|
-
}, origin), ") is not allowed to connect to your Fontdue store."), /*#__PURE__*/
|
|
56
|
+
}, origin), ") is not allowed to connect to your Fontdue store."), /*#__PURE__*/React.createElement("p", {
|
|
64
57
|
style: {
|
|
65
58
|
margin: '12px 0 0'
|
|
66
59
|
}
|
|
67
|
-
}, "To fix this, go to", ' ', /*#__PURE__*/
|
|
60
|
+
}, "To fix this, go to", ' ', /*#__PURE__*/React.createElement("a", {
|
|
68
61
|
href: `${settingsOrigin}/admin/settings/security`,
|
|
69
62
|
target: "_blank",
|
|
70
63
|
rel: "noreferrer",
|
|
@@ -72,9 +65,9 @@ function CorsErrorModal(_ref) {
|
|
|
72
65
|
color: '#dc2626',
|
|
73
66
|
fontWeight: 500
|
|
74
67
|
}
|
|
75
|
-
}, "Settings \u2192 Security"), ' ', "in your Fontdue dashboard, and add ", /*#__PURE__*/
|
|
68
|
+
}, "Settings \u2192 Security"), ' ', "in your Fontdue dashboard, and add ", /*#__PURE__*/React.createElement("code", {
|
|
76
69
|
style: code
|
|
77
|
-
}, origin), " to the", ' ', /*#__PURE__*/
|
|
70
|
+
}, origin), " to the", ' ', /*#__PURE__*/React.createElement("strong", null, "Cross-origin API access"), " field."), /*#__PURE__*/React.createElement("p", {
|
|
78
71
|
style: {
|
|
79
72
|
margin: '16px 0 0',
|
|
80
73
|
color: '#6b7280',
|
|
@@ -85,12 +78,12 @@ function CorsErrorModal(_ref) {
|
|
|
85
78
|
function mount(origin, fontdueUrl) {
|
|
86
79
|
const container = document.createElement('div');
|
|
87
80
|
document.body.appendChild(container);
|
|
88
|
-
|
|
81
|
+
createRoot(container).render( /*#__PURE__*/React.createElement(CorsErrorModal, {
|
|
89
82
|
origin: origin,
|
|
90
83
|
fontdueUrl: fontdueUrl
|
|
91
84
|
}));
|
|
92
85
|
}
|
|
93
|
-
function renderCorsErrorModal(origin, fontdueUrl) {
|
|
86
|
+
export function renderCorsErrorModal(origin, fontdueUrl) {
|
|
94
87
|
if (document.body) {
|
|
95
88
|
mount(origin, fontdueUrl);
|
|
96
89
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CouponText_coupon$key } from '__generated__/CouponText_coupon.graphql';
|
|
2
|
+
import { CouponText_coupon$key } from '__generated__/CouponText_coupon.graphql.js';
|
|
3
3
|
interface CouponText_props {
|
|
4
4
|
coupon: CouponText_coupon$key;
|
|
5
5
|
subtract?: number;
|
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = CouponText;
|
|
7
|
-
var _CouponText_coupon2 = _interopRequireDefault(require("../../__generated__/CouponText_coupon.graphql"));
|
|
8
|
-
var _reactRelay = require("react-relay");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _Price = require("../Price");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function CouponText(_ref) {
|
|
1
|
+
import _CouponText_coupon from "../../__generated__/CouponText_coupon.graphql.js";
|
|
2
|
+
import { graphql, useFragment } from 'react-relay';
|
|
3
|
+
import React, { Fragment } from 'react';
|
|
4
|
+
import { Price } from '../Price/index.js';
|
|
5
|
+
export default function CouponText(_ref) {
|
|
15
6
|
let {
|
|
16
7
|
coupon: couponKey,
|
|
17
8
|
subtract = 0
|
|
18
9
|
} = _ref;
|
|
19
|
-
const coupon =
|
|
10
|
+
const coupon = useFragment((_CouponText_coupon.hash && _CouponText_coupon.hash !== "484f6e7b6a444d53ee056ac4a43a58f3" && console.error("The definition of 'CouponText_coupon' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CouponText_coupon), couponKey);
|
|
20
11
|
if (coupon.type === 'credit') {
|
|
21
12
|
const amountRemaining = {
|
|
22
13
|
...coupon.creditAmountRemaining,
|
|
23
14
|
amount: coupon.creditAmountRemaining.amount - subtract,
|
|
24
15
|
currency: coupon.creditAmountRemaining.currency
|
|
25
16
|
};
|
|
26
|
-
return /*#__PURE__*/
|
|
17
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Price, {
|
|
27
18
|
price: amountRemaining
|
|
28
19
|
}), " remaining");
|
|
29
20
|
}
|
|
30
21
|
if (coupon.type === 'percent') {
|
|
31
|
-
return /*#__PURE__*/
|
|
22
|
+
return /*#__PURE__*/React.createElement(Fragment, null, `${coupon.percentAmount}% off`);
|
|
32
23
|
}
|
|
33
24
|
if (coupon.type === 'static_credit') {
|
|
34
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Price, {
|
|
35
26
|
price: coupon.creditAmount
|
|
36
27
|
}), " off");
|
|
37
28
|
}
|