{"version":3,"file":"modern.checkout.v5Wru3vZ.js","names":["styled","css","plume","SelectionCard","theme","colors","undefined","background","primary","TipSummaryInformations","TipSummary","styles","copy","M","semiBold","TipSummaryConversion","XS","regular","TipLink","Link","StyledTable","SelectionWrapper","SelectionItem","$hasAdditionalCost","SelectionItemInformations","SelectionTitle","S","SelectionCurrencyWrapper","SelectionCurrency","SmallSelectionCurrency","MoneyConverterWrapper","props","bottomPosition","absolutePosition","biggerFont","SelectionAction","marginTop","baseRewardThumbnail","isSmall","RewardSelectionPlaceholder","DefaultRewardImage","RewardSelectionImage","SelectionVariantTitle","QuantityResume","SelectionSection","SelectionSectionTitle","isBold","forceUpperCase","noMargin","ColumnSelectionSection","Price","ShippingSelection","SelectedCountry","SelectionShipping","SelectionShippingCurrencyWrapper","SelectedTotal","marginBottom","SelectedConvertedCurrency","CalloutText","CalloutTextStrong","SelectionSectionTitleWrapper","FeeIconWrapper","styled","plume","styles","Container","Headline","heading","XS","PullingContainer","SkipLink","Link","attrs","kind","underlined","Title","rem","TextContainer","Banner"],"sources":["../../../../../../owl-nest/common/utils/src/money.ts","../../../../../../owl-nest/common/utils/src/shipping.ts","../../../../../../owl-nest/external/owl-kit/src/legacy/sponsorship/styles.js","../../../../../../owl-nest/external/owl-kit/src/legacy/sponsorship/Sponsor.jsx","../../../../../../owl-nest/common/services/src/user/address/base.ts","../../../../../../owl-nest/common/services/src/user/address/useAddress.ts","../../../../../../owl-nest/ulule/features/checkout/src/models/reward.ts","../../../../../../owl-nest/ulule/features/checkout/src/models/variant.ts","../../../../../../owl-nest/ulule/features/checkout/src/models/product.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/product.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/error.tsx","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useCart/getOrderCreatePayload.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useCart/format.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useCart/atom.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/localStorage.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/searchParams.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useRevealedRewards.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/hydrate.ts","../../../../../../owl-nest/ulule/features/checkout/src/utils/UFE.ts","../../../../../../owl-nest/ulule/features/checkout/src/components/Modals/PaymentDisturbanceModal.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Header.tsx","../../../../../../owl-nest/ulule/features/checkout/src/utils/scrollTo.js","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useScrollToAnonymous.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useProject.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useCart/useCart.ts","../../../../../../owl-nest/ulule/features/checkout/src/hooks/useNavigation.ts","../../../../../../owl-nest/ulule/features/checkout/src/style.js","../../../../../../owl-nest/ulule/features/checkout/src/components/Item.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/FutureItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/AnonymousOrderToggle.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/IdentityItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/selection/style.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/style.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/money/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/selection/SelectedShipping.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/ServiceFee.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/ItemsTotal.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/SelectionTotal.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/selection/CartSummary.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/ShippingItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/components/NewAddressSubForm.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/components/AddressManager/DetailAddress.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/components/ExistingAddressSubForm.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/components/AddressManager/ListAddress.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/components/AddressManager/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/PickupAddressItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/DropoffAddressItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/ContactAddressItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/HomeDeliveryAddress.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/address/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/MembershipHero.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/ProgressBar.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Title.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Layout.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/donation/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/login/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/payment/hooks/useOrderError.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/payment/hooks/usePayment.ts","../../../../../../owl-nest/ulule/features/checkout/src/models/project.ts","../../../../../../owl-nest/ulule/features/checkout/src/models/user.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/payment/components/ModalIncompleteProfile.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Payment/PaymentDisclaimers.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Payment/PaymentMethod.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/payment/PaymentSection.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/payment/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/pickup/PickupItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/pickup/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/renew/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Modals/RemoveModal.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Form/SelectionQuantity.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/SelectionItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/CountrySelect.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/SingleCountryAndShippingModeLabel.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/SelectionShipping.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/cart/SelectionTip.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/Cart.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/components/rewards/Reward.tsx","../../../../../../owl-nest/ulule/features/checkout/src/utils/filter.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/RewardList.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/ItemTip.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/selection/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/mondialRelay/StepTitle.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/mondialRelay/MondialRelayStep1.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/mondialRelay/MondialRelayStep2.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/mondialRelay/MondialRelayItem.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/mondialRelay/index.tsx","../../../../../../owl-nest/ulule/features/checkout/src/components/Modals/RewardTaxDeductionModal.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/PAGES.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/style.ts","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/Processing.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/Buttons.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/Aborted.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/Canceled.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/Sponsorships.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/MembershipTitle.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/MembershipThanks.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/Title.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/TeamMessage.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/Comment.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/components/Share.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/RewardOrDonationThanks.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/Done.tsx","../../../../../../owl-nest/ulule/features/checkout/src/views/endfunnel/EndfunnelRouter.tsx","../../../../../../owl-nest/ulule/features/checkout/src/Router.tsx","../../../../../../owl-nest/ulule/features/checkout/src/index.tsx"],"sourcesContent":["import * as logger from '@owl-nest/logger'\n\nexport function convert(\n amount: number,\n sourceCurrency: string,\n targetCurrency: string,\n rates: { [s: string]: number },\n precision = 0,\n): number {\n if (sourceCurrency === targetCurrency) {\n return amount\n }\n\n if (rates === undefined || rates[sourceCurrency] === undefined || rates[targetCurrency] === undefined) {\n logger.warn(\"[money] Couldn't find currency in provided rates\", { rates, sourceCurrency, targetCurrency })\n return amount\n }\n\n const convertedAmount = (amount / rates[sourceCurrency]) * rates[targetCurrency]\n return parseFloat(convertedAmount.toFixed(precision))\n}\n","import { type Shipping } from '@owl-nest/api-client/latest'\nimport { t } from '@owl-nest/localize'\n\n/**\n * Maps country codes to their shipping amount for a given list of shippings\n *\n * @param shippings - List of shipping to map data from\n * @returns A map of country codes and shipping amounts\n */\nexport function mapCountryToShipping(shippings: Array | undefined): Record {\n // TODO: Probably clearer to throw\n if (!shippings) {\n return {}\n }\n\n return shippings.reduce((accumulator: Record, shipping: Shipping): Record => {\n const countries = shipping.countries?.reduce(\n (countryAccumulator: Record, country: string) => ({\n ...countryAccumulator,\n [country]: shipping.amount,\n }),\n {},\n )\n return { ...accumulator, ...countries }\n }, {})\n}\n\n// Formats the given label to be displayed in the countries Select component\nexport function getShippingOptionLabel(label: string, shipping: number | undefined, currencySymbol: string): string {\n const freeShipping = shipping === 0 || shipping === undefined\n return freeShipping\n ? t('%(label)s (included)', { label })\n : `${label} (+\\xa0${t('%(currency)s%(amount)s', { amount: shipping, currency: currencySymbol })})`\n}\n","import { styled } from 'next-yak'\n\nimport * as colors from '../../constants/colors.ts'\nimport * as fonts from '../../constants/fonts.js'\n\nimport { StyledAvatar } from '../Avatar.jsx'\n\nexport const Sponsor = styled.span`\n font-family: ${fonts.PRIMARY_FONT};\n font-weight: 500;\n font-size: 13px;\n display: flex;\n flex-flow: row nowrap;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n\n ${StyledAvatar /* sc-sel */} {\n margin-right: 5px;\n }\n`\n\nexport const Description = styled.span`\n position: relative;\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n color: ${colors.PRIMARY_GREY_000};\n padding: 10px;\n z-index: 10;\n\n &::before {\n content: '';\n transform: skewX(-5deg);\n width: 101%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n z-index: -1;\n }\n`\n","import * as React from 'react'\nimport * as PropTypes from 'prop-types'\nimport { styled } from 'next-yak'\n\nimport * as utils from '../../utils/index.ts'\nimport * as S from './styles.js'\n\nimport Avatar from '../Avatar.jsx'\n\nconst Sponsor = ({ name, avatarUrl, link, mainColor }) => {\n const content = (\n \n \n {name}\n \n )\n\n if (link) {\n return (\n \n {content}\n \n )\n }\n\n return {content}\n}\n\nconst DynamicSponsor = styled(S.Sponsor)`\n color: ${(props) => props.mainColor || 'inherit'};\n`\n\nconst SponsorLink = styled(DynamicSponsor).attrs((props) => ({\n color: props.mainColor || utils.colors.primary(props),\n}))`\n color: ${(props) => props.color};\n display: inline-flex;\n text-decoration: none;\n\n &:hover {\n color: ${(props) => utils.colors.hexToRgb(props.color, 0.85)};\n }\n`\n\nSponsor.propTypes = {\n avatarUrl: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n /** url will open in new tab */\n link: PropTypes.string,\n /** color of component */\n mainColor: PropTypes.string,\n}\n\nexport default Sponsor\nSponsor.displayName = 'legacy.Sponsor'\n","import * as api from '@owl-nest/api-client/next'\n\nexport async function load(\n userId: number,\n extraFields: EXTRA_FIELDS[] = [],\n): Promise>> {\n const response = await api.client('GET /users/:id/addresses', {\n urlParams: { id: String(userId) },\n getParams: { extra_fields: extraFields.join(',') },\n })\n\n return response.next((success) => success.body)\n}\n\nexport async function create(\n userId: number,\n address: api.CreateAddress,\n extraFields: EXTRA_FIELDS[] = [],\n): Promise>> {\n const response = await api.client('POST /users/:id/addresses', {\n urlParams: { id: String(userId) },\n getParams: { extra_fields: extraFields.join(',') },\n body: address,\n })\n\n return response.next((response) => response.body)\n}\n\nexport async function remove(addressId: number): Promise> {\n const response = await api.client('DELETE /addresses/:id', {\n urlParams: { id: String(addressId) },\n })\n\n return response.next((success) => success.body)\n}\n\nexport async function update(\n addressId: number,\n address: api.UpdateAddress,\n extraFields: EXTRA_FIELDS[] = [],\n): Promise>> {\n const response = await api.client('PATCH /addresses/:id', {\n urlParams: { id: String(addressId) },\n getParams: { extra_fields: extraFields.join(',') },\n body: address,\n })\n\n return response.next((success) => success.body)\n}\n\nexport function filter(\n addresses: api.Address[],\n countries: string[],\n): api.Address[] {\n return addresses.filter((address: api.Address) => {\n if (countries.length === 0) {\n return true\n }\n return countries.includes(address.country)\n })\n}\n","import * as jotai from 'jotai'\n\nimport * as hooks from '@owl-nest/hooks'\nimport * as api from '@owl-nest/api-client/next'\n\nimport * as base from './base'\n\nexport const SHARED_ADDRESSES_CACHE = jotai.atom>({})\n\ntype UseAddressOptions = {\n fetchOnMount?: boolean | 'force'\n extraFields?: EXTRA_FIELDS[]\n}\n\nexport function useAddress(\n userId: number | undefined,\n { fetchOnMount = true, extraFields = [] }: UseAddressOptions = {},\n) {\n const sharedQuery = hooks.useSharedQuery(\n (userId: number, extraFields: EXTRA_FIELDS[]) => {\n return base.load(userId, extraFields)\n },\n {\n atom: SHARED_ADDRESSES_CACHE,\n id,\n },\n )\n\n hooks.useFetchOnMount({ fetchOnMount, query, getResponse }, id(userId, extraFields))\n\n return { response: getResponse(), create, update, remove }\n\n function query(): Promise | undefined {\n if (userId) {\n return sharedQuery.query(userId, extraFields)\n }\n }\n\n function getResponse(): hooks.Response> {\n if (userId === undefined) {\n return { status: hooks.QueryStatus.PRISTINE }\n }\n\n return sharedQuery.getCurrentResponse([userId, extraFields])\n }\n\n async function create(address: api.CreateAddress) {\n if (userId === undefined) {\n return\n }\n\n const promiseResult = base.create(userId, address, extraFields)\n await sharedQuery.patch([userId, extraFields], async (response) => {\n const result = await promiseResult\n\n return result.next((address) => {\n const addresses = [...(response.data?.addresses ?? [])]\n\n addresses.push(address)\n\n return { addresses }\n })\n })\n\n return await promiseResult\n }\n\n function update(\n id: number,\n address: api.UpdateAddress,\n ): Promise> | undefined> | undefined {\n if (userId === undefined) {\n return\n }\n\n return sharedQuery.patch([userId, extraFields], async (response) => {\n const result = await base.update(id, address, extraFields)\n\n return result.next((address) => {\n const addresses = [...(response.data?.addresses ?? [])]\n\n const addressIndex = addresses.findIndex((address) => address.id === id)\n\n addresses[addressIndex] = address\n\n return { addresses }\n })\n })\n }\n\n function remove(id: number) {\n if (userId === undefined) {\n return\n }\n\n return sharedQuery.patch([userId, extraFields], async (response) => {\n const result = await base.remove(id)\n\n return result.next(() => {\n const addresses = [...(response.data?.addresses ?? [])]\n\n const addressIndex = addresses.findIndex((address) => address.id === id)\n\n addresses.splice(addressIndex, 1)\n\n return { addresses }\n })\n })\n }\n}\n\nfunction id(userId: number | undefined, extraFields: EXTRA_FIELDS[]): string {\n return JSON.stringify([userId, extraFields.sort()])\n}\n","import * as models from '@owl-nest/models'\nimport { text } from '@owl-nest/utils'\n\nexport type RewardStock = {\n available: number | null\n taken: number\n total: number | null\n}\n\nexport function getTruncatedDescription(reward: models.reward.Reward): string {\n const description = models.reward.description(reward)\n return text.truncate(text.stripTags(description), 150)\n}\n\nexport function getTruncatedTitle(reward: models.reward.Reward): string | undefined {\n const title = models.reward.title(reward)\n return text.truncate(text.stripTags(title), 150)\n}\n","import { text } from '@owl-nest/utils'\nimport * as models from '@owl-nest/models'\n\nexport const getTruncatedDescription = (variant: models.variant.Variant): string => {\n const description = models.variant.description(variant)\n return text.truncate(text.stripTags(description), 150)\n}\n","import * as api from '@owl-nest/api-client/next'\nimport * as model from '@owl-nest/models'\n\nimport * as rewardModel from './reward'\nimport * as variantModel from './variant'\n\nexport type Product = {\n id: number\n optionValuesIds?: number[]\n project: api.Project\n quantity: number\n reward: model.reward.Reward\n variant?: model.variant.Variant\n}\n\ntype MakeProduct = {\n optionValuesIds?: number[]\n project: api.Project\n quantity?: number\n reward: api.Reward\n variant?: api.Variant\n}\n\nexport function Product({ reward, optionValuesIds, project, variant, quantity = 1 }: MakeProduct): Product {\n const rewardModel = model.reward.Reward(reward, project)\n const variantModel = variant && model.variant.Variant(variant, rewardModel)\n return {\n id: variant?.id ?? reward.id,\n optionValuesIds,\n project,\n quantity,\n reward: rewardModel,\n variant: variantModel,\n }\n}\n\nexport function getDeliveryDate(product: Product): string | undefined {\n return product.reward.shippings?.date_delivery\n}\n\nexport function getImage(product: Product): string | undefined {\n if (product.reward.image === undefined) return\n\n const image = model.i18n.get(product.reward.image, model.project.language(product.project) as api.Lang)\n return image === undefined ? undefined : model.image.getUrl(image.versions, 'full')\n}\n\nexport function getTitle(product: Product): string | undefined {\n if (product.reward.title === undefined) return undefined\n\n return model.i18n.get(product.reward.title, model.project.language(product.project) as api.Lang, '')\n}\n\nexport function getTruncatedDescription(product: Product): string {\n if (product.variant) {\n return variantModel.getTruncatedDescription(product.variant)\n }\n\n return rewardModel.getTruncatedDescription(product.reward)\n}\n\nexport function getTruncatedTitle(product: Product): string | undefined {\n return rewardModel.getTruncatedTitle(product.reward)\n}\n\nexport function stock(product: Product): model.reward.RewardStock {\n return product.variant ? model.variant.stock(product.variant) : model.reward.stock(product.reward)\n}\n\nexport function hasAvailableStock(product: Product): boolean {\n const productStock = stock(product)\n return productStock.available !== undefined && productStock.available !== null && productStock.available > 0\n}\n\nexport function hasLimitedStock(product: Product): boolean {\n const productStock = stock(product)\n return productStock.total !== null && productStock.total !== undefined\n}\n\nexport function hasVariants(product: Product): boolean {\n return !product.variant && product.reward.variants !== undefined && product.reward.variants.length > 0\n}\n\nexport function isLegacy(product: Product): boolean {\n return model.reward.isLegacy(product.reward)\n}\n\n/**\n * Returns the ids of the option values the product's variant was resolved from,\n * or `undefined` when the product has none (a plain reward, or a legacy variant\n * that is not tied to any option).\n */\nexport function optionValuesIds(product: Product): number[] | undefined {\n if (product.optionValuesIds !== undefined && product.optionValuesIds.length > 0) {\n return product.optionValuesIds\n }\n\n const valuesIds = product.variant?.value_ids\n ?.map((value) => value.id)\n .filter((valueId): valueId is number => valueId !== undefined)\n\n if (valuesIds === undefined || valuesIds.length === 0) {\n return undefined\n }\n\n return valuesIds\n}\n\nexport function isSelectable(product: Product): boolean {\n const productStock = stock(product)\n\n if (productStock.available === undefined) {\n return true\n }\n return Number(productStock.available) > 0 || !hasLimitedStock(product)\n}\n\nexport function quantityDoesNotExceedStock(product: Product): boolean {\n const productStock = stock(product)\n if (productStock.available === undefined) {\n return true\n }\n return Number(productStock.available) >= 0 || !hasLimitedStock(product)\n}\n\nexport function requiresPhone(product: Product): boolean {\n return product.reward.phone_number_required || false\n}\n","import * as api from '@owl-nest/api-client/latest'\nimport * as logger from '@owl-nest/logger'\nimport * as model from '@owl-nest/models'\n\nimport * as productModel from '../models/product'\n\ntype PreSerializedProduct = {\n quantity: number\n reward_id: number\n}\n\nexport function findProductIndexById(products: Array = [], productId: number): number {\n return products.findIndex((selectedProduct) => {\n return productId === selectedProduct.id\n })\n}\n\n// TODO: Improvement suggestion: we should use a `savedProducts` counter\n// to avoid scanning all project rewards and their variants\n// once all of `savedProducts` were resolved (doing so, probably drop `forEach` altogether).\n/**\n * Retrieves products from saved IDs based on the given project's rewards.\n *\n * @param savedProducts - An array of pre-serialized products.\n * @param project - The project object containing rewards information.\n * @returns A tuple containing three arrays:\n * 1. Array of available products.\n * 2. Array of limited products.\n * 3. Array of sold-out products.\n */\nexport function getProductsFromSavedIds(\n savedProducts: PreSerializedProduct[] = [],\n project: api.Project,\n): productModel.Product[][] {\n const availableProducts: productModel.Product[] = []\n const limitedProducts: productModel.Product[] = []\n const soldOutProducts: productModel.Product[] = []\n\n if (savedProducts.length === 0 || project.rewards === null || project.rewards === undefined) {\n return [[], [], []]\n }\n\n project.rewards.forEach((reward: api.Reward) => {\n if (reward.variants && reward.variants_count > 0) {\n reward.variants\n .filter((variant) => Boolean(variant))\n .forEach((variant: api.Variant) => {\n if (variant) {\n const product = findAndFormatProduct(variant, reward)\n dispatchProduct(product)\n } else {\n logger.warn('[checkout] Trying to resolve non-existent variant', {\n projectID: project.id,\n rewardID: reward.id,\n variants: reward.variants,\n })\n }\n })\n }\n // We also have to consider rewards with variations, in case one is set in params.\n const product = findAndFormatProduct(reward)\n dispatchProduct(product)\n })\n\n return [availableProducts, limitedProducts, soldOutProducts]\n\n function dispatchProduct(product: productModel.Product | undefined): void {\n if (product) {\n const availableStock = productModel.stock(product).available\n if (\n availableStock === null ||\n availableStock === undefined ||\n (Number.isInteger(availableStock) && availableStock >= product.quantity)\n ) {\n availableProducts.push(product)\n } else if (productModel.hasAvailableStock(product)) {\n limitedProducts.push(product)\n } else {\n soldOutProducts.push(product)\n }\n }\n }\n\n function findAndFormatProduct(\n product?: api.Variant | api.Reward,\n parent?: api.Reward,\n ): productModel.Product | undefined {\n if (!product) {\n return\n }\n const selectedProduct = savedProducts.find((savedProduct) => {\n return savedProduct.reward_id === product.id\n })\n if (selectedProduct) {\n if (parent !== undefined) {\n const reward = model.reward.Reward(parent, project)\n const variant = model.variant.Variant(product as api.Variant, reward)\n return productModel.Product({ project, reward, variant, quantity: selectedProduct.quantity })\n } else {\n const reward = model.reward.Reward(product as api.Reward, project)\n return productModel.Product({ project, reward, quantity: selectedProduct.quantity })\n }\n }\n }\n}\n\nexport function orderRewardsAvailableFirst(rewardList: model.reward.Reward[]): model.reward.Reward[] {\n return rewardList.sort((firstReward, secondReward) => {\n // Hidden rewards should be on the top of the list, whereas sold-out ones should be at the end\n if (firstReward.is_hidden === secondReward.is_hidden) {\n if (firstReward.available === secondReward.available) {\n return 0\n } else if (firstReward.available) {\n return -1\n } else return 1\n } else if (firstReward.is_hidden) {\n return -1\n } else return 1\n })\n}\n\nexport function preSerialize(products: productModel.Product[]): PreSerializedProduct[] {\n return products.map((product) => ({\n quantity: product.quantity,\n reward_id: product.id,\n }))\n}\n","import * as React from 'react'\n\nimport { tn, tnc, t } from '@owl-nest/localize'\nimport { Link } from '@ulule/owl-kit-components/next'\n\nimport * as productModel from '../models/product'\n\nexport type ErrorPayload = {\n context: string\n focus: boolean\n message: React.ReactNode\n}\n\nexport function allSelectedProductsAreExpiredError(context: string, productCount: number): ErrorPayload {\n return {\n context,\n focus: true,\n message: tn(\n 'The reward you chose is out of stock and has been removed from your selection. Please choose another reward.',\n 'The rewards you chose are out of stock and have been removed from your selection. Please choose another reward.',\n productCount,\n ),\n }\n}\n\nexport function someSelectedProductsAreExpiredError(\n context: string,\n products: productModel.Product[],\n action?: () => void,\n): ErrorPayload {\n return {\n context,\n focus: true,\n message: tnc(\n 'The reward [strong: %(productName)s] you chose is out of stock and has been removed from your selection.[br][br] Please [link: choose another reward] or continue.',\n 'Rewards [strong: %(productName)s] are out of stock and have been removed from your selection.[br][br] Please [link: choose other rewards] or continue.',\n products.length,\n {\n br:
,\n // eslint-disable-next-line jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid\n link: action !== undefined ? : ,\n productName: products.map((product) => productModel.getTitle(product)).join(', '),\n strong: ,\n },\n ),\n }\n}\n\nexport function unavailableQuantityError(context: string, products: productModel.Product[]): ErrorPayload {\n const firstProduct = products[0]\n\n return {\n context,\n focus: true,\n message: tnc(\n `The reward [strong: %(productName)s] is no longer available [strong: at a quantity of %(chosenQuantity)d]. There are only [strong: %(left)d] left: we've updated your selection to reflect this. Click Continue to proceed to payment.`,\n `The rewards you chose are no longer available at selected quantities. We've updated your selection to reflect this. Click Continue to proceed to payment.`,\n products.length,\n {\n chosenQuantity: firstProduct.quantity ?? 0,\n left: productModel.stock(firstProduct).available ?? 0,\n productName: productModel.getTitle(firstProduct) ?? '',\n strong: ,\n },\n ),\n }\n}\n","import * as api from '@owl-nest/api-client/next'\nimport * as cartService from '@owl-nest/services/src/cart'\n\nexport function getOrderCreatePayload(state: cartService.CartState) {\n return {\n tip: state.tip.amount,\n pickup_point_id: state.shipping.mode === 'pickup_point' ? state.shipping.pickupPoint : undefined,\n rewards: state.products.map((product) => ({ reward_id: product.id, quantity: product.quantity })),\n billing_address_id: state.shipping.billingAddress,\n delivery_type: state.shipping.mode === 'pickup_point' ? undefined : state.shipping.mode,\n shipping_address_id:\n state.shipping.mode === 'home_delivery' || state.dryRunResult?.initial_shipping_address_required\n ? state.shipping.shippingAddress\n : undefined,\n shipping_address:\n state.shipping.mode === 'mondial_relay' && state.shipping.mondialRelay !== undefined\n ? {\n dropoff_id: state.shipping.mondialRelay.dropoff?.id,\n dropoff_name: state.shipping.mondialRelay.dropoff?.name,\n address1: state.shipping.mondialRelay.dropoff?.address,\n city: state.shipping.mondialRelay.dropoff?.city,\n country: state.shipping.country?.code,\n postal_code: state.shipping.mondialRelay.dropoff?.postal_code,\n phone_number: state.shipping.mondialRelay.phoneNumber,\n first_name: state.shipping.mondialRelay.firstName,\n last_name: state.shipping.mondialRelay.lastName,\n latitude: state.shipping.mondialRelay.dropoff?.coordinates.lat,\n longitude: state.shipping.mondialRelay.dropoff?.coordinates.lon,\n }\n : undefined,\n country: state.shipping.country?.code,\n hidden: state.hidden,\n // fake data that is required by the endpoint, but useless for\n // a dry_run\n payment_method: 'credit',\n return_url: location.href,\n } as api.CreateOrder\n}\n","import { type Location } from '@ulule/duvet/LocationPicker.tsx'\n\nimport * as cartService from '@owl-nest/services/src/cart'\nimport * as api from '@owl-nest/api-client/next'\nimport * as models from '@owl-nest/models'\nimport * as productModel from '../../models/product'\n\nimport { getOrderCreatePayload } from './getOrderCreatePayload'\n\ntype BaseCart = {\n isEmpty: boolean\n isLoading: boolean\n hidden?: boolean\n products: productModel.Product[]\n serviceFee?: number\n shippingSubTotal: number\n subTotal: number\n taxDeductible: boolean\n // Rate applicable to this order: 60% for business billing addresses, otherwise the project rate.\n taxDeductibleRate?: number\n taxDeductibleTotal: number\n tip: { amount: number; frequency?: models.project.DonationFrequency }\n total: number\n total_with_fees?: number\n getPayload: () => api.CreateOrder\n}\n\nexport type SelectedMondialRelay = {\n address: api.BaseAddress & { longitude: number; latitude: number }\n firstName: string\n lastName: string\n phoneNumber: string\n dropoff: Location\n}\n\nexport type InitialCart = BaseCart & { addressType?: undefined }\n\nexport type NoneCart = BaseCart & { addressType: 'none' }\n\nexport type ContactCart = BaseCart & {\n addressType: 'contact'\n isTax: boolean\n contactAddress?: number\n needPhone: boolean\n}\n\nexport type ShippingCart = BaseCart & {\n addressType: 'shipping'\n shippingModes: api.ShippingMode[]\n isTax: boolean\n availableCountries: string[]\n pickupPoints: api.PickupPoint[]\n rates: { homeDelivery: Record; mondialRelay: Record }\n selectedCountry?: { code: string; forced: boolean }\n selectedMondialRelay?: Partial\n getRate: (countryCode: string, mode?: api.ShippingMode) => number | undefined\n getPickupPoint: (id: number) => api.PickupPoint | undefined\n selectedPickupPoint?: api.PickupPoint\n selectedShippingMode?: api.ShippingMode\n shippingError: boolean\n shippingAddress?: number\n billingAddress?: number\n billingAddressRequired: boolean\n needAddress: boolean\n needPhone: boolean\n deliveryDates: string[]\n}\n\nexport type Cart = InitialCart | NoneCart | ContactCart | ShippingCart\n\nexport function formatCart(state: cartService.CartState): Cart {\n const tipAmount = state.tip.amount ?? 0\n\n if (state.dryRunResult === undefined || state.project === undefined) {\n return {\n isLoading: state.isLoading,\n hidden: state.hidden,\n tip: { amount: tipAmount },\n subTotal: 0,\n shippingSubTotal: 0,\n products: [],\n isEmpty: tipAmount === 0 && state.products.length === 0,\n total: 0,\n taxDeductibleTotal: 0,\n taxDeductible: false,\n getPayload: () => getOrderCreatePayload(state),\n }\n }\n\n const baseCart: BaseCart = {\n isLoading: state.isLoading,\n hidden: state.hidden,\n tip: { amount: tipAmount, frequency: state.tip.frequency },\n subTotal: state.dryRunResult.order_subtotal,\n serviceFee: state.dryRunResult.service_fee,\n products: formatCartProducts(state),\n total: state.dryRunResult.order_total,\n total_with_fees: state.dryRunResult.order_total_with_fees,\n shippingSubTotal: state.dryRunResult.order_shipping_total,\n taxDeductibleTotal: state.dryRunResult.tax_deductible_total ?? 0,\n taxDeductible: state.dryRunResult.tax_deductible,\n taxDeductibleRate: state.dryRunResult.tax_deductible_rate,\n isEmpty: tipAmount === 0 && state.products.length === 0,\n getPayload: () => getOrderCreatePayload(state),\n }\n\n const needAddress =\n state.dryRunResult.initial_billing_address_required || state.dryRunResult.initial_shipping_address_required\n\n //TODO: use shipping_address_type === home_delivery instead of this condition\n if (state.dryRunResult.initial_shipping_address_required && state.dryRunResult?.shippings_available) {\n const homeDeliveryRates = state.dryRunResult.shippings_available.standard ?? {}\n const mondialRelayRates = state.dryRunResult.shippings_available.mondial_relay ?? {}\n const pickupPoints = state.dryRunResult.shippings_available.pickup_points ?? []\n const selectedPickupPoint = pickupPoints.find((pickupPoint) => pickupPoint.id === state.shipping.pickupPoint)\n\n const shippingModes: ShippingCart['shippingModes'] = []\n\n const canHandlePickup =\n state.dryRunResult.shipping_modes !== null\n ? state.dryRunResult.shipping_modes.includes('pickup_point') &&\n (state.dryRunResult.shippings_available?.pickup_points?.length ?? 0) !== 0\n : state.dryRunResult.initial_pickup_point_required\n\n const canHandleHomeDelivery =\n state.dryRunResult.shipping_modes !== null\n ? state.dryRunResult.shipping_modes.includes('home_delivery') &&\n Object.keys(state.dryRunResult.shippings_available?.standard ?? {}).length !== 0\n : state.dryRunResult.initial_shipping_address_required\n\n const canHandleMondialRelay =\n state.dryRunResult.shipping_modes !== null\n ? state.dryRunResult.shipping_modes.includes('mondial_relay') &&\n Object.keys(state.dryRunResult.shippings_available?.mondial_relay ?? {}).length !== 0\n : false\n\n if (canHandlePickup) {\n shippingModes.push('pickup_point')\n }\n if (canHandleHomeDelivery) {\n shippingModes.push('home_delivery')\n }\n if (canHandleMondialRelay) {\n shippingModes.push('mondial_relay')\n }\n\n //TODO: use shipping_address_type === membership instead of this condition\n const needPhone =\n (state.shipping.mode !== 'mondial_relay' && state.dryRunResult.initial_phone_number_required) ||\n baseCart.products.some((product) => productModel.requiresPhone(product))\n\n return {\n ...baseCart,\n addressType: 'shipping',\n shippingModes: shippingModes,\n isTax: state.dryRunResult.billing_address_type === 'tax',\n pickupPoints,\n rates: { homeDelivery: homeDeliveryRates, mondialRelay: mondialRelayRates },\n availableCountries: state.dryRunResult.countries_available,\n selectedMondialRelay: state.shipping.mondialRelay,\n getRate: (countryCode, mode = state.shipping.mode) =>\n (mode === 'home_delivery' ? homeDeliveryRates : mode === 'mondial_relay' ? mondialRelayRates : {})[countryCode],\n getPickupPoint: (id: number) => pickupPoints.find((pickupPoint) => pickupPoint.id === id),\n selectedCountry: state.shipping.country,\n selectedPickupPoint,\n selectedShippingMode: state.shipping.mode,\n shippingError: state.shipping.error,\n billingAddress: state.shipping.billingAddress,\n shippingAddress: state.shipping.shippingAddress,\n billingAddressRequired: state.dryRunResult.initial_billing_address_required ?? false,\n needAddress,\n needPhone,\n deliveryDates: baseCart.products.reduce((dates: string[], product) => {\n const deliveryDate = productModel.getDeliveryDate(product)\n if (deliveryDate && !dates.includes(deliveryDate)) {\n dates.push(deliveryDate)\n }\n return dates\n }, []),\n }\n }\n //TODO: use initial_billing_address_required instead in this condition\n else if (needAddress) {\n return {\n ...baseCart,\n addressType: 'contact',\n isTax: state.dryRunResult.billing_address_type === 'tax',\n contactAddress: state.shipping.billingAddress,\n needPhone: state.dryRunResult.initial_phone_number_required ?? false,\n }\n } else {\n return {\n ...baseCart,\n addressType: 'none',\n }\n }\n}\n\nexport function formatCartProducts(state: cartService.CartState): productModel.Product[] {\n const products = state.products ?? []\n const dryRunResult = state.dryRunResult\n const project = state.project\n\n if (dryRunResult === undefined || project === undefined) {\n return []\n }\n\n return products.flatMap(({ id, quantity }) => {\n let productReward = undefined\n let productVariant = undefined\n const items = dryRunResult.items ?? []\n for (const item of items) {\n if (item.reward.id === id) {\n if (item.reward.parent === undefined) {\n productReward = item.reward\n } else {\n productVariant = item.reward\n productReward = item.reward.parent\n }\n }\n }\n\n // Between adding a product and the response of the resulting dryrun, no\n // reward will be found in the dryRunResult (because it is the result of a\n // request before the product was added). We ignore this product (because\n // there is no way for us to match it right now), but this is transitory and\n // the product will be matched when the dryRun is done (since it will\n // trigger a rerender and another call to `formatCartProducts`).\n //\n // In summary, when adding a product to the cart, it is added immediatly to\n // the state, but visually it will be added to the cart only when the\n // resulting dryRun is done.\n if (productReward === undefined) {\n return []\n }\n\n return [\n productModel.Product({\n project,\n reward: productReward,\n variant: productVariant,\n quantity,\n }),\n ]\n })\n}\n","import { atomWithReducer } from 'jotai/utils'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as cartService from '@owl-nest/services/src/cart'\nimport * as models from '@owl-nest/models'\nimport * as env from '@owl-nest/config'\n\nimport { formatCart, type SelectedMondialRelay } from './format'\n\nexport type UpdateCartProductOptions = { createIfNotFound?: boolean }\nexport type SetProductOptions = { withDelay?: boolean } & UpdateCartProductOptions\nexport type SetTipOptions = { withDelay?: boolean }\n\nexport const INITIAL_STATE: cartService.CartState = {\n isLoading: false,\n shipping: {\n error: false,\n },\n tip: {},\n products: [],\n}\n\nexport const CART_STATE = atomWithReducer(INITIAL_STATE, reducer)\n\ntype ResetIsLoadingAction = { type: 'reset.isLoading' }\ntype SetIsLoadingAction = { type: 'set.isLoading'; isLoading: boolean }\ntype ResetCart = { type: 'reset.cart' }\ntype SetTipAction = {\n type: 'set.tip'\n tip: number\n frequency?: models.project.DonationFrequency\n options?: SetTipOptions\n}\ntype UpdateProductsAction = {\n type: 'update.products'\n products: { id: number; parentId?: number; quantity: number | ((quantity: number) => number); valuesIds?: number[] }[]\n options: SetProductOptions\n}\ntype ResetProducts = { type: 'reset.products' }\ntype SetAddress = { type: 'set.address'; billing?: number; delivery?: number }\ntype ResetAddresses = { type: 'reset.addresses' }\ntype SetSelectedCountry = { type: 'set.selectedCountry'; countryCode: string; forced: boolean }\ntype SetPickupPoint = { type: 'set.pickupPoint'; id: number }\ntype SetMondialRelay = { type: 'set.mondialRelay'; mondialRelay: Partial }\ntype SetShippingMode = { type: 'set.shippingMode'; mode: api.ShippingMode | undefined }\ntype SetShippingError = { type: 'set.shippingError'; error: boolean }\ntype ResetShippingError = { type: 'reset.shippingError' }\ntype SetHidden = { type: 'set.hidden'; hidden: boolean }\ntype Override = { type: 'override'; state: cartService.CartState }\ntype UpdateDryRun = { type: 'update.dryRun'; dryRunResult: api.Order; project: api.Project }\ntype Action =\n | ResetIsLoadingAction\n | SetIsLoadingAction\n | SetTipAction\n | UpdateProductsAction\n | ResetProducts\n | SetAddress\n | ResetAddresses\n | SetShippingError\n | ResetShippingError\n | SetSelectedCountry\n | SetPickupPoint\n | SetShippingMode\n | SetHidden\n | Override\n | UpdateDryRun\n | SetMondialRelay\n | ResetCart\n\nexport function reducer(state: cartService.CartState, action: Action): cartService.CartState {\n switch (action.type) {\n case 'reset.cart': {\n return INITIAL_STATE\n }\n case 'reset.isLoading': {\n return {\n ...state,\n isLoading: false,\n }\n }\n case 'set.isLoading': {\n return {\n ...state,\n isLoading: action.isLoading,\n }\n }\n case 'set.tip': {\n return {\n ...state,\n tip: {\n frequency: action.frequency,\n amount: action.tip,\n },\n isLoading: action.options?.withDelay ?? false,\n }\n }\n case 'update.products': {\n const nextProducts: (\n | {\n id: number\n parentId?: number\n quantity: number\n valuesIds?: number[]\n }\n | undefined\n )[] = [...state.products]\n\n for (const product of action.products) {\n const currentProductIndex = state.products.findIndex((currentProduct) => currentProduct.id === product.id)\n\n if (currentProductIndex === -1) {\n const nextQuantity = typeof product.quantity === 'number' ? product.quantity : product.quantity(0)\n if (action.options.createIfNotFound && nextQuantity > 0) {\n nextProducts.push({\n id: product.id,\n parentId: product.parentId,\n quantity: nextQuantity,\n valuesIds: product.valuesIds,\n })\n }\n } else {\n const currentProduct = nextProducts[currentProductIndex]\n const nextQuantity =\n typeof product.quantity === 'number' ? product.quantity : product.quantity(currentProduct?.quantity ?? 0)\n\n if (nextQuantity > 0) {\n nextProducts[currentProductIndex] = {\n id: product.id,\n parentId: product.parentId ?? state.products[currentProductIndex].parentId,\n quantity: nextQuantity,\n valuesIds: product.valuesIds ?? state.products[currentProductIndex].valuesIds,\n }\n } else {\n nextProducts[currentProductIndex] = undefined\n }\n }\n }\n\n const products = nextProducts.filter((product): product is { id: number; quantity: number } => Boolean(product))\n\n const isSameProduct =\n products.find((product) => {\n return (\n state.products.find(\n (stateProduct) => stateProduct.id === product.id || stateProduct.parentId === product.id,\n ) !== undefined\n )\n }) !== undefined\n\n if (isSameProduct) {\n return {\n ...state,\n products: products,\n shipping: {\n ...state.shipping,\n country: products.length === 0 ? undefined : state.shipping.country,\n },\n isLoading: false,\n }\n }\n\n return {\n ...state,\n products: products,\n shipping: {\n ...state.shipping,\n country: products.length === 0 ? undefined : state.shipping.country,\n },\n isLoading: action.options?.withDelay ?? false,\n }\n }\n case 'reset.products': {\n return {\n ...state,\n products: [],\n }\n }\n case 'set.address': {\n const billingAddress = action.billing\n const shippingAddress = action.delivery\n\n return {\n ...state,\n shipping: {\n ...state.shipping,\n billingAddress: billingAddress,\n shippingAddress: shippingAddress,\n },\n }\n }\n case 'reset.addresses': {\n return {\n ...state,\n shipping: {\n ...INITIAL_STATE.shipping,\n },\n }\n }\n case 'set.shippingError': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n error: action.error,\n },\n }\n }\n case 'reset.shippingError': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n error: false,\n },\n }\n }\n case 'set.selectedCountry': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n country: { code: action.countryCode, forced: action.forced },\n },\n }\n }\n case 'set.pickupPoint': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n pickupPoint: action.id,\n },\n }\n }\n case 'set.mondialRelay': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n mondialRelay: {\n ...state.shipping.mondialRelay,\n ...action.mondialRelay,\n },\n },\n }\n }\n case 'set.shippingMode': {\n return {\n ...state,\n shipping: {\n ...state.shipping,\n mode: action.mode,\n },\n }\n }\n case 'update.dryRun': {\n const nextState: cartService.CartState = {\n ...state,\n dryRunResult: action.dryRunResult,\n project: action.project,\n }\n\n const cart = formatCart(nextState)\n\n if (cart.addressType === 'shipping') {\n // reset shipping data if the cart is emptied\n if (cart.products.length === 0) {\n return {\n ...nextState,\n shipping: {\n mode: 'home_delivery',\n error: false,\n },\n }\n }\n\n // for shipping carts, we preselect a country and/or a pickup point if\n // only one is available, or with a geolocalised one if applicable\n const supportedCountries = cart.availableCountries\n const hasOnlyOneStandardRate = supportedCountries.length === 1\n\n const userCountryCode = env.USER_COUNTRY\n\n // Project country is the default preselected country since it is always available\n const preselectedCountry = hasOnlyOneStandardRate\n ? supportedCountries[0]\n : cart.getRate(userCountryCode, 'home_delivery') !== undefined ||\n cart.getRate(userCountryCode, 'mondial_relay') !== undefined\n ? userCountryCode\n : action.project.country\n\n const stateWithPreselectedCountry =\n (cart.selectedCountry === undefined || !cart.availableCountries.includes(cart.selectedCountry.code)) &&\n cart.selectedShippingMode !== 'pickup_point'\n ? reducer(nextState, {\n type: 'set.selectedCountry',\n countryCode: preselectedCountry,\n forced: cart.selectedCountry !== undefined,\n })\n : nextState\n\n const hasOnlyOnePickupPoint = cart.pickupPoints.length === 1\n\n const geolocalizedPickupPoint = cart.pickupPoints.find((pickupPoint) => {\n pickupPoint.address && pickupPoint.address.country === userCountryCode\n })\n\n const preselectedPickupPoint = hasOnlyOnePickupPoint ? cart.pickupPoints[0].id : geolocalizedPickupPoint?.id\n\n const stateWithPreselectedPickup =\n preselectedPickupPoint && cart.selectedShippingMode !== 'home_delivery'\n ? reducer(stateWithPreselectedCountry, { type: 'set.pickupPoint', id: preselectedPickupPoint })\n : stateWithPreselectedCountry\n\n return state.shipping.mode === undefined\n ? reducer(stateWithPreselectedPickup, { type: 'set.shippingMode', mode: 'home_delivery' })\n : cart.shippingModes.length === 1\n ? reducer(stateWithPreselectedPickup, { type: 'set.shippingMode', mode: cart.shippingModes[0] })\n : !cart.shippingModes.includes(state.shipping.mode)\n ? reducer(stateWithPreselectedPickup, { type: 'set.shippingMode', mode: cart.shippingModes[0] })\n : stateWithPreselectedPickup\n } else {\n // if cart address type is not shipping (contact or none), reset shippings and delivery address (contact will be in billing)\n return {\n ...nextState,\n shipping: {\n ...nextState.shipping,\n mode: 'home_delivery',\n error: false,\n shippingAddress: undefined,\n },\n }\n }\n }\n case 'set.hidden': {\n return {\n ...state,\n hidden: action.hidden,\n }\n }\n case 'override': {\n return action.state\n }\n default: {\n return state\n }\n }\n}\n","import * as date from '@owl-nest/date'\nimport { t, tn } from '@owl-nest/localize'\nimport * as api from '@owl-nest/api-client/next'\nimport * as cartService from '@owl-nest/services/src/cart'\n\nimport * as productModel from '../models/product'\nimport * as productUtils from './product'\n\nimport * as errorUtils from '../utils/error'\nimport { INITIAL_STATE } from '../hooks/useCart/atom.ts'\n\nexport const LOCALSTORAGE_NAME_TRACKING = 'ul_checkout_tracking_v3_'\n\nexport function isExpired(expirable: { expirationDate: string }): boolean {\n const currentDate = new Date()\n const expirationDate = new Date(expirable.expirationDate)\n\n return currentDate > expirationDate\n}\n\nfunction cleanAllExpired() {\n const carts = cartService.getAllCarts()\n\n for (const cart of carts) {\n const projectId = cart.cartState.project?.id\n if (projectId !== undefined) {\n if (isExpired(cart)) {\n cartService.removeCartFromLocalStorage(projectId)\n }\n }\n }\n\n const storage = window.localStorage\n for (let i = 0; i < storage.length; i++) {\n const key = storage.key(i)!\n if (key.startsWith(LOCALSTORAGE_NAME_TRACKING)) {\n const stored = storage.getItem(key)\n if (stored) {\n const tracking = JSON.parse(stored)\n if (isExpired(tracking)) {\n storage.removeItem(key)\n }\n }\n }\n }\n}\n\nexport function getTrackingOrderFromLocalStorage(orderId: number) {\n const storage = window.localStorage\n const stored = storage.getItem(`${LOCALSTORAGE_NAME_TRACKING}${orderId}`)\n\n if (stored) {\n const data = JSON.parse(stored)\n\n // Clean expired entries\n cleanAllExpired()\n\n return data\n }\n\n return\n}\n\nexport function setTrackingOrderInLocalStorage(orderId: number) {\n const storage = window.localStorage\n const expirationDate = date.minutesFromNow(30)\n\n storage.setItem(\n `${LOCALSTORAGE_NAME_TRACKING}${orderId}`,\n JSON.stringify({\n expirationDate,\n }),\n )\n}\n\nexport function saveCartToLocalStorage(cartState: cartService.CartState, projectId: number) {\n const expirationDate = date.daysFromNow(7)\n\n const serializableCartState = { ...cartState }\n delete serializableCartState.dryRunResult\n delete serializableCartState.project\n\n cartService.setCartInLocalStorage(projectId, serializableCartState, expirationDate)\n}\n\nexport function loadCartFromLocalStorage(project: api.Project): {\n cartState: cartService.CartState\n error?: LoadError\n} {\n cleanAllExpired()\n\n const cartState = cartService.getCartFromLocalStorage(project.id)\n\n // Since the local storage format has changed, there can be an entry present in\n // local storage with a deprecated format. Those won't have the\n // `cartState` entry. They are considered empty\n if (cartState === undefined) {\n return { cartState: INITIAL_STATE }\n }\n\n const [products, limitedProducts, soldOutProducts] = productUtils.getProductsFromSavedIds(\n cartState.products.map((product) => ({ reward_id: product.id, quantity: product.quantity })),\n project,\n )\n\n return {\n cartState: {\n project,\n ...cartState,\n products: cartState.products.filter(\n (product) => soldOutProducts.findIndex((soldOutProduct) => soldOutProduct.id === product.id) === -1,\n ),\n },\n error: loadCartError(products, limitedProducts, soldOutProducts),\n }\n}\n\ntype LoadError = errorUtils.ErrorPayload & {\n level: 'alert' | 'error' | 'info' | 'success'\n}\n\nfunction loadCartError(\n products: productModel.Product[],\n limitedProducts: productModel.Product[],\n soldOutProducts: productModel.Product[],\n): LoadError | undefined {\n if (limitedProducts.length === 0 && soldOutProducts.length === 0) {\n return\n }\n\n if (limitedProducts.length > 0) {\n const errorPayload = errorUtils.unavailableQuantityError('selection', limitedProducts)\n\n return {\n level: 'error',\n ...errorPayload,\n }\n } else {\n if (products.length === 0) {\n const errorPayload = errorUtils.allSelectedProductsAreExpiredError('selection', soldOutProducts.length)\n\n return {\n level: 'error',\n ...errorPayload,\n }\n } else {\n const errorPayload = errorUtils.someSelectedProductsAreExpiredError('selection', soldOutProducts, undefined)\n\n return {\n level: 'error',\n ...errorPayload,\n }\n }\n }\n}\n","import type * as api from '@owl-nest/api-client/latest'\nimport * as models from '@owl-nest/models'\n\nimport * as cartService from '@owl-nest/services/src/cart'\nimport * as projectService from '@owl-nest/services/src/project'\n\nimport * as productModel from '../models/product'\nimport * as productUtils from './product'\nimport { formatCartProducts } from '../hooks/useCart/format.ts'\n\ntype ProductFromSearchParams = {\n quantity: number\n reward_id: number\n}\n\nexport function cleanSearchParams(): void {\n const location = document.location\n const params = new URLSearchParams(document.location.search)\n params.delete('frequency')\n params.delete('quantity')\n params.delete('reward')\n params.delete('tip')\n params.delete('valuesIds')\n const remainingParameters = params.toString() ? `?${params.toString()}` : ''\n window.history.replaceState('', '', `${location.origin}${location.pathname}${remainingParameters}`)\n}\n\n// TODO: remove `isMembership` parameter and condition once `donations_monthly_allowed`is set to true by default on MB projects\nexport function extractDonationFromSearchParams(configuration: {\n monthliesAllowed: boolean\n singleAllowed: boolean\n isMembershipProject: boolean\n}): { amount?: number; frequency?: models.project.DonationFrequency; isMembershipProject?: boolean } | undefined {\n const params = new URLSearchParams(document.location.search)\n\n const amount = params.get('tip') || ''\n const frequency = params.get('frequency') || ''\n\n if (!amount && !frequency) {\n return undefined\n }\n\n return {\n ...(amount && { amount: parseFloat(amount) }),\n ...(frequency && isValidFrequency(frequency) && { frequency }),\n }\n\n function isValidFrequency(value: string): value is models.project.DonationFrequency {\n if (!['monthly', 'one-time'].includes(value as models.project.DonationFrequency)) {\n return false\n }\n\n return (\n (value === 'one-time' && configuration.singleAllowed) ||\n (value === 'monthly' && (configuration.monthliesAllowed || configuration.isMembershipProject))\n )\n }\n}\n\nexport function updateCartBasedOnProduct(\n product: productModel.Product | undefined,\n cart: cartService.CartState,\n project: api.Project,\n preFilledDonation?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n },\n): cartService.CartState {\n const donationAmount = preFilledDonation?.amount ?? cart.tip.amount\n\n if (!product) {\n return {\n ...cart,\n tip: {\n amount: donationAmount,\n frequency: preFilledDonation?.frequency,\n },\n }\n }\n\n const productsInCart = formatCartProducts(cart)\n\n const hasSelectedProducts = productsInCart.length > 0\n const payloadProducts = [...(cart.products ?? [])]\n\n if (hasSelectedProducts) {\n // Try to find the product extracted from search params among existing selection (loaded from local storage).\n // If found, overwrite quantity with value from search params.\n const productIndex = productUtils.findProductIndexById(productsInCart, product.id)\n const productInCart = productsInCart[productIndex]\n\n if (productIndex >= 0) {\n // TODO: FIXME: Falling back to 0 for quantity incrementation is clumsy\n if (product.quantity === 0 && productModel.isSelectable(productInCart)) {\n payloadProducts[productIndex] = { ...payloadProducts[productIndex], quantity: productInCart.quantity + 1 }\n } else if (product.quantity > 0) {\n payloadProducts[productIndex] = { ...payloadProducts[productIndex], quantity: product.quantity }\n }\n return {\n ...cart,\n products: payloadProducts,\n tip: {\n amount: donationAmount,\n frequency: preFilledDonation?.frequency,\n },\n }\n }\n }\n\n // If there was no existing selection, simply add the product extracted from search params.\n // TODO: FIXME: Falling back to 0 for quantity incrementation is clumsy\n if (!productModel.hasVariants(product)) {\n payloadProducts.push({\n id: product.id,\n // NOTE: a variant can only be resolved back from its parent and its option\n // values, so both have to be kept alongside its id. Without them, the\n // product could never be matched against the project again, and would\n // notably escape the sold out purge on the next cart load.\n parentId: product.variant !== undefined ? product.reward.id : undefined,\n quantity: product.quantity > 0 ? product.quantity : 1,\n valuesIds: productModel.optionValuesIds(product),\n })\n }\n return {\n ...cart,\n products: payloadProducts,\n tip: {\n amount: donationAmount,\n frequency: preFilledDonation?.frequency,\n },\n }\n}\n\nexport async function extractVariantFromSearchParams(): Promise<{\n quantity: number\n rewardId: number\n variant?: api.Variant\n}> {\n const params = new URLSearchParams(document.location.search)\n const quantity = parseInt(params.get('quantity') || '1', 10)\n const rewardId = parseInt(params.get('reward') || '', 10)\n const valuesIds = params.get('valuesIds')\n\n if (rewardId && valuesIds) {\n const optionValuesIds = valuesIds.split(',')\n const response = await projectService.rewardVariants(rewardId, optionValuesIds)\n return {\n quantity,\n rewardId,\n variant: response.next((success) => success.variants[0]).unwrap(),\n }\n }\n\n return { quantity, rewardId }\n}\n\nfunction extractProductFromSearchParams(): ProductFromSearchParams | undefined {\n const params = new URLSearchParams(document.location.search)\n const quantity = parseInt(params.get('quantity') || '1', 10)\n const rewardId = parseInt(params.get('reward') || '', 10)\n\n if (Number.isNaN(rewardId)) return\n\n return {\n quantity,\n reward_id: rewardId,\n }\n}\n\nexport function getProductFromSearchParams(project: api.Project): productModel.Product | undefined {\n const productFromParams = extractProductFromSearchParams()\n if (!productFromParams) return\n\n const [[product]] = productUtils.getProductsFromSavedIds([productFromParams], project)\n return product\n}\n","import * as jotai from 'jotai'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as services from '@owl-nest/services'\n\nimport * as productModel from '../models/product'\nimport * as productUtils from '../utils/product'\n\nconst REVEALED_REWARDS_ATOM = jotai.atom([])\n\nexport function revealRewards(\n store: ReturnType,\n cart: services.cart.CartState,\n productFromSearchParams: productModel.Product | undefined,\n project: api.Project<'delivery' | 'rewards' | 'partnerships'>,\n): void {\n let revealedRewards: number[] = []\n\n if (cart.products) {\n // get IDs of hidden rewards which need to be revealed\n revealedRewards = cart.products.reduce((revealedRewardsIds: number[], cartProduct) => {\n if (productFromSearchParams?.id === cartProduct.id) {\n return [...revealedRewardsIds, cartProduct.id]\n }\n\n const [[product]] = productUtils.getProductsFromSavedIds(\n [{ reward_id: cartProduct.id, quantity: cartProduct.quantity }],\n project,\n )\n\n if (product?.reward.is_hidden) {\n return [...revealedRewardsIds, cartProduct.id]\n }\n return revealedRewardsIds\n }, [])\n\n // Also reveal rewards with variants so that they can be selected from the list of rewards.\n if (productFromSearchParams && productModel.hasVariants(productFromSearchParams)) {\n const productFromSearchParamsId = productFromSearchParams?.id\n revealedRewards = [...revealedRewards, productFromSearchParamsId]\n }\n }\n\n store.set(REVEALED_REWARDS_ATOM, revealedRewards)\n}\n\nexport function useRevealedRewards() {\n return jotai.useAtomValue(REVEALED_REWARDS_ATOM)\n}\n","import * as jotai from 'jotai'\n\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as api from '@owl-nest/api-client/next'\nimport * as cartService from '@owl-nest/services/src/cart'\nimport * as services from '@owl-nest/services'\n\nimport { loadCartFromLocalStorage } from './localStorage'\nimport {\n cleanSearchParams,\n extractDonationFromSearchParams,\n extractVariantFromSearchParams,\n getProductFromSearchParams,\n updateCartBasedOnProduct,\n} from './searchParams'\nimport { getProductsFromSavedIds } from './product'\nimport { type CheckoutExtraFields } from '../hooks/useProject'\nimport { revealRewards } from '../hooks/useRevealedRewards'\nimport { INITIAL_STATE } from '../hooks/useCart/atom.ts'\n\ntype HydrationResult = {\n messages: services.message.Message[]\n cart: services.cart.CartState\n initialConfiguration: InitialConfiguration\n}\n\ntype InitialConfiguration = {\n donationBasedProject: boolean\n membershipProject: boolean\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n}\n\nfunction isSelectionRoute(): boolean {\n const urlWithoutQueryParams = `${document.location.origin}${document.location.pathname}`\n return /checkout\\/$/.test(urlWithoutQueryParams)\n}\n\nexport async function hydrate(\n project: api.Project,\n store: ReturnType,\n): Promise {\n const isDonationBasedProject = models.project.isDonationBased(project)\n const isMembershipProject = models.project.isMembership(project)\n\n document.title = `${\n project.type === api.ProjectType.Membership ? t('Subscribe') : t('Contribute')\n } - ${models.project.name(project)} - Ulule`\n\n // First, let's see if we can extract a variant from search params. Variants need to be preloaded from\n // the API, so we start by checking the need for said preload and apply it.\n const { quantity, rewardId, variant: variantFromSearch } = await extractVariantFromSearchParams()\n\n // Now, let's try and get a potentially existing cart from local storage. Same reason as above,\n // if there are variants within, we will need to preload them before proceeding.\n const savedCartState = cartService.getCartFromLocalStorage(project.id)\n let projectWithVariants: api.Project = project\n\n // If there was indeed a preloaded variant for search params, we inject it within the project to allow\n // seamlessly resolving products further down the execution flow.\n variantFromSearch && injectSearchParamsVariant()\n\n // Just as we did for the search param variant, we preload and inject possible local storage variants\n // to allow resolving products later.\n await preloadAndInjectLocalStorageVariants()\n\n const { cartState, error } = loadCartFromLocalStorage(projectWithVariants)\n\n // TODO: remove `isMembershipProject` param once `donations_monthly_allowed`is set to true by default on MB projects\n const prefilledDonation = isSelectionRoute()\n ? extractDonationFromSearchParams({\n monthliesAllowed: project.donations_monthly_allowed ?? false,\n singleAllowed: project.donations_single_allowed ?? false,\n isMembershipProject: isMembershipProject,\n }) || {}\n : undefined\n\n const membershipCart =\n prefilledDonation && prefilledDonation.amount\n ? {\n ...INITIAL_STATE,\n tip: prefilledDonation,\n }\n : INITIAL_STATE\n\n let initialCartState = models.project.isMembership(project) ? membershipCart : cartState\n\n if (isSelectionRoute()) {\n const productFromSearchParams = variantFromSearch\n ? getProductsFromSavedIds([{ reward_id: variantFromSearch.id, quantity: quantity }], projectWithVariants)[0][0]\n : getProductFromSearchParams(projectWithVariants)\n\n const productIsAlreadyInCart =\n initialCartState.products.findIndex((cartProduct) => cartProduct.id === productFromSearchParams?.id) !== -1\n\n if (productIsAlreadyInCart) {\n cleanSearchParams()\n } else {\n initialCartState = updateCartBasedOnProduct(\n productFromSearchParams,\n initialCartState,\n projectWithVariants,\n prefilledDonation,\n )\n\n cleanSearchParams()\n }\n\n if (!isDonationBasedProject && !isMembershipProject && initialCartState.shipping.mode === undefined) {\n initialCartState.shipping.mode = 'home_delivery'\n }\n\n revealRewards(store, initialCartState, productFromSearchParams, project)\n }\n\n return {\n messages: error ? [error] : [],\n cart: initialCartState,\n initialConfiguration: {\n donationBasedProject: isDonationBasedProject,\n membershipProject: isMembershipProject,\n preFilledTip: prefilledDonation,\n },\n }\n\n async function preloadAndInjectLocalStorageVariants() {\n for await (const product of savedCartState?.products || []) {\n if (Boolean(product.parentId) && Boolean(product.valuesIds?.length)) {\n const response = await services.project.rewardVariants(\n product.parentId!,\n product.valuesIds!.map((valueId) => valueId.toString()),\n )\n const resolvedVariant = response.next((success) => success.variants[0]).unwrap()\n\n if ('rewards' in project) {\n const rewards = project.rewards as api.Reward[]\n const rewardIndex = rewards.findIndex((reward) => reward.id === product.parentId)\n if (rewardIndex > -1) {\n const mutatedRewards = [...rewards]\n if (\n mutatedRewards[rewardIndex].variants &&\n mutatedRewards[rewardIndex].variants.findIndex((variant) => variant.id === resolvedVariant.id) === -1\n ) {\n mutatedRewards[rewardIndex].variants!.push(resolvedVariant)\n } else {\n mutatedRewards[rewardIndex].variants = [resolvedVariant]\n }\n projectWithVariants = { ...project, rewards: mutatedRewards }\n }\n }\n }\n }\n }\n\n function injectSearchParamsVariant() {\n if (rewardId && variantFromSearch) {\n if ('rewards' in project) {\n const rewards = project.rewards as api.Reward[]\n const rewardIndex = rewards.findIndex((reward) => reward.id === rewardId)\n if (rewardIndex > -1) {\n const mutatedRewards = [...rewards]\n if (mutatedRewards[rewardIndex].variants) {\n mutatedRewards[rewardIndex].variants!.push(variantFromSearch)\n } else {\n mutatedRewards[rewardIndex].variants = [variantFromSearch]\n }\n projectWithVariants = { ...project, rewards: mutatedRewards }\n }\n }\n }\n }\n}\n","import { lens } from '@owl-nest/config'\n\ntype Window = {\n UFE: {\n data: {\n project: {\n id: number\n }\n }\n gtmKey: string\n support_email: string\n tracking: string\n flags: {\n paypal_enabled: boolean\n apple_pay_enabled: boolean\n }\n }\n CHECKOUT_ASSETS: {\n concours: string\n concours_mobile: string\n endfunnel: {\n confetti: string\n }\n contest: string\n contest_mobile: string\n }\n}\n\nconst windowLens = lens()\n\nexport const CHECKOUT_ASSETS = windowLens.get('CHECKOUT_ASSETS').value(globalThis, { trust: true })\n\nexport const FLAGS = windowLens.get('UFE').get('flags').value(globalThis)\n\nexport const GTM_KEY = windowLens.get('UFE').get('gtmKey').value(globalThis)\n\nexport const PROJECT_ID = windowLens.get('UFE').get('data').get('project').get('id').value(globalThis)\n\nexport const SUPPORT_EMAIL = windowLens.get('UFE').get('support_email').value(globalThis, { silent: true })\n\nexport const TRACKING = windowLens.get('UFE').get('tracking').value(globalThis)\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\n\ntype PaymentDisturbanceModalProps = {\n className?: string\n projectUrl: string\n}\n\nfunction PaymentDisturbanceModalComponent({\n className,\n projectUrl,\n}: PaymentDisturbanceModalProps): React.ReactElement {\n return (\n }\n svgScale={0.88}\n buttons={{\n type: 'link',\n props: {\n kind: 'secondary',\n href: projectUrl,\n children: t('Back to project'),\n },\n }}\n >\n {t('Payment temporarily unavailable')}\n \n {t(\n 'Due to a technical maintenance of our payment provider, we are obliged to suspend all payments tonight on our platform.',\n )}\n \n \n {t('You will be able to contribute to this project again from 7am (Paris time).')}\n \n \n {t('We invite you to subscribe to the project to receive posts and back it later.')}\n \n \n )\n}\n\nexport const PaymentDisturbanceModal = styled(PaymentDisturbanceModalComponent)`\n ${plume.styles.modal.Body} {\n display: flex;\n flex-direction: column;\n }\n\n ${plume.styles.heading.S} {\n text-align: left;\n margin: 15px 0;\n }\n\n ${plume.styles.copy.M.light} {\n text-align: left;\n margin-bottom: 25px;\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n ${plume.styles.modal.Wrapper} {\n max-width: 390px;\n }\n }\n`\n","import React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { t } from '@owl-nest/localize'\n\nexport function Header() {\n return (\n \n \n \n\n \n {t('Secure payment')}\n \n \n \n \n )\n}\n\nconst HeaderWrapper = styled.div`\n padding-top: 57px;\n`\n\nconst HeaderNav = styled.div`\n align-items: center;\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n display: flex;\n height: 57px;\n justify-content: center;\n width: 100%;\n position: fixed;\n left: 0px;\n top: 0px;\n z-index: 5;\n`\n\nconst HeaderInfoRight = styled.div`\n align-items: center;\n color: ${plume.COLORS.TEXT_TERTIARY};\n display: flex;\n justify-content: center;\n margin-right: 10px;\n position: absolute;\n right: 0px;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n margin-right: 20px;\n }\n`\n\nconst HeaderInfoRightText = styled(plume.styles.heading.XXXXXXS)`\n display: none;\n color: inherit;\n margin-right: 8px;\n text-transform: uppercase;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n display: block;\n }\n`\n","import { scroll } from '@owl-nest/utils'\n\n/**\n * @param {HTMLElement|null} element\n * @returns\n */\nexport const getOffsetTop = (element) => {\n let offsetTop = 0\n while (element) {\n offsetTop += element.offsetTop\n element = /** @type {HTMLElement|null} */ (element.offsetParent)\n }\n offsetTop -= 70\n return offsetTop\n}\n\n/**\n * @param {HTMLElement|null} step\n */\nexport const scrollToCurrentItem = (step) => {\n const top = getOffsetTop(step)\n scroll.animatedScrollTo(top, 150)\n}\n\nexport function scrollToTop() {\n scroll.animatedScrollTo(0, 150)\n}\n","import * as React from 'react'\n\nimport { scrollToCurrentItem } from '../utils/scrollTo'\n\n// Module-level flag: the anonymous toggle is shown on every checkout step, so without\n// this guard the scroll would fire again each time the user navigates between steps\n// (payment → address → payment, etc.), even though they've already seen it.\n// A module-level variable (rather than a ref) persists across component unmount/remount.\nlet hasAnonymousBoxBeenDisplayed = false\n\n/**\n * Scrolls once to the right block when a checkout step loads:\n * - to the shipping summary block if the user has already filled their shipping info\n * - to the anonymous toggle block otherwise\n *\n * Uses callback refs (instead of useRef) so that React notifies us via state\n * when the DOM elements actually mount — avoiding the race condition where the\n * effect fires before the conditional shipping component is in the DOM.\n */\nexport function useScrollToAnonymous(hasFilledShipping: boolean, isLoading: boolean) {\n // State-backed refs: updating these triggers a re-render and re-runs the effect.\n const [shippingsEl, setShippingsEl] = React.useState(null)\n const [anonymousEl, setAnonymousEl] = React.useState(null)\n\n // Prevents scrolling more than once even if dependencies change after the first scroll.\n const hasScrolled = React.useRef(false)\n\n // Callback refs: React calls these with the DOM node on mount, and null on unmount.\n const shippingsBoxRef = React.useCallback((node: HTMLElement | null) => setShippingsEl(node), [])\n const anonymousBoxRef = React.useCallback((node: HTMLElement | null) => setAnonymousEl(node), [])\n\n React.useEffect(() => {\n // Wait for the cart to finish loading so hasFilledShipping reflects the real state.\n if (hasScrolled.current || isLoading) return\n if (hasFilledShipping && shippingsEl) {\n scrollToCurrentItem(shippingsEl)\n hasScrolled.current = true\n } else if (!hasFilledShipping && anonymousEl && !hasAnonymousBoxBeenDisplayed) {\n scrollToCurrentItem(anonymousEl)\n hasAnonymousBoxBeenDisplayed = true\n hasScrolled.current = true\n }\n }, [hasFilledShipping, isLoading, shippingsEl, anonymousEl])\n\n return { shippingsBoxRef, anonymousBoxRef }\n}\n","import * as jotai from 'jotai'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as cookies from '@owl-nest/cookie-helper'\nimport * as env from '@owl-nest/config'\nimport * as projectService from '@owl-nest/services/src/project'\n\nimport * as UFE from '../utils/UFE'\n\nconst CHECKOUT_EXTRA_FIELDS = [\n 'account',\n 'delivery',\n 'partnerships',\n 'rewards',\n 'analytics',\n 'sponsorships',\n 'shippings',\n 'socials',\n 'user_subscriptions',\n] as const\n\nexport type CheckoutExtraFields = (typeof CHECKOUT_EXTRA_FIELDS)[number]\n\nexport async function initializeProject(\n store: ReturnType,\n): Promise> {\n const id = UFE.PROJECT_ID\n\n // HACK: `user_subscriptions` is required to determine whether monthly donations should be allowed\n // and that's why access_token is required here.\n const accessToken = cookies.getCookie(env.ACCESS_TOKEN_COOKIE_NAME)\n\n const projectResponse = await projectService.load(id, {\n extraFields: CHECKOUT_EXTRA_FIELDS,\n withToken: Boolean(accessToken),\n })\n const project = projectResponse.doThrow()\n\n projectService.setInitialProject(store, id, project)\n\n return project\n}\n\nexport async function getProject(\n store: ReturnType,\n): Promise> {\n const id = UFE.PROJECT_ID\n\n const cache = store.get(projectService.SHARED_PROJECT_CACHE)\n\n return cache[id]?.data as api.Project\n}\n\nexport function useProject(): projectService.UseProject & {\n project: api.Project\n} {\n const useProject = projectService.useProject(UFE.PROJECT_ID, {\n extraFields: CHECKOUT_EXTRA_FIELDS,\n })\n\n // \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const project = useProject.response.data!\n\n return { ...useProject, project }\n}\n","import * as jotai from 'jotai'\nimport * as React from 'react'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as logger from '@owl-nest/logger'\nimport * as models from '@owl-nest/models'\nimport * as services from '@owl-nest/services'\n\nimport { useProject } from '../useProject'\nimport { type Cart, formatCart, type SelectedMondialRelay } from './format'\nimport {\n type SetTipOptions,\n type SetProductOptions,\n type UpdateCartProductOptions,\n CART_STATE,\n INITIAL_STATE,\n} from './atom'\nimport { getOrderCreatePayload } from './getOrderCreatePayload'\nimport * as errorUtils from '../../utils/error'\n\nconst REGEXP_REWARD_STOCK = /reward\\s(\\d+)\\s\\(stock is (\\d+)/\n\nexport type CartMethods = {\n setTip: (tip: number, options?: SetTipOptions) => void\n setProduct: (\n id: number,\n quantity: number | ((quantity: number) => number),\n options?: SetProductOptions,\n parentId?: number,\n valuesIds?: number[],\n ) => void\n resetAddresses: () => void\n resetShippingError: () => void\n resetProducts: () => void\n setAddress: (addresses: { billing?: number; delivery?: number }) => void\n setProducts: (\n products: {\n id: number\n quantity: number\n parentId?: number\n valuesIds?: number[]\n }[],\n options?: UpdateCartProductOptions,\n ) => void\n setShippingError: (error: boolean) => void\n setSelectedCountry: (country: string, options?: { forced?: boolean }) => void\n setPickupPoint: (id: number) => void\n setMondialRelay: (mondialRelay: Partial) => void\n setShippingMode: (mode: api.ShippingMode | undefined) => void\n setDonation: (tip: number, frequency?: models.project.DonationFrequency) => void\n setHidden: (hidden: boolean) => void\n}\n\nlet IS_UPDATING_LOCK = false\n\nexport function useCart(): Cart & CartMethods {\n const { project, refreshRewards } = useProject()\n const dispatchMessage = services.message.useDispatch()\n\n const [state, dispatch] = jotai.useAtom(CART_STATE)\n\n React.useEffect(() => {\n if (state.project !== undefined && state.project?.id !== project.id) {\n dispatch({ type: 'override', state: INITIAL_STATE })\n }\n if (!IS_UPDATING_LOCK) {\n IS_UPDATING_LOCK = true\n dispatch({ type: 'set.isLoading', isLoading: true })\n\n // NOTE: the lock must be released whatever happens, otherwise no further\n // dry run would ever run and the cart would stay stuck as loading.\n updateDryRunResult(state)\n .catch((error) => {\n logger.err(error)\n })\n .then(() => {\n IS_UPDATING_LOCK = false\n dispatch({ type: 'set.isLoading', isLoading: false })\n })\n }\n }, [stateHash(state)])\n\n return {\n ...formatCart(state),\n setTip,\n setProduct,\n resetAddresses,\n resetShippingError,\n resetProducts,\n setAddress,\n setProducts,\n setShippingError,\n setSelectedCountry,\n setPickupPoint,\n setShippingMode,\n setDonation,\n setMondialRelay,\n setHidden,\n }\n\n function resetShippingError() {\n dispatch({ type: 'reset.shippingError' })\n }\n\n function setShippingError(error = false) {\n dispatch({ type: 'set.shippingError', error })\n }\n\n function setAddress(addresses: { billing?: number; delivery?: number }) {\n dispatch({ type: 'set.address', ...addresses })\n }\n\n function resetAddresses() {\n dispatch({ type: 'reset.addresses' })\n }\n\n function resetProducts() {\n dispatch({ type: 'reset.products' })\n }\n\n function setShippingMode(mode: api.ShippingMode | undefined) {\n dispatch({ type: 'set.shippingMode', mode })\n }\n\n function setPickupPoint(id: number) {\n dispatch({ type: 'set.pickupPoint', id })\n }\n\n function setSelectedCountry(countryCode: string, { forced = false } = {}) {\n dispatch({ type: 'set.selectedCountry', countryCode, forced })\n }\n\n function setMondialRelay(mondialRelay: Partial) {\n dispatch({ type: 'set.mondialRelay', mondialRelay })\n }\n\n function setTip(tip: number, options: SetTipOptions = {}) {\n dispatch({ type: 'set.tip', tip, options })\n }\n\n function setDonation(tip: number, frequency?: models.project.DonationFrequency) {\n dispatch({ type: 'set.tip', tip, frequency })\n }\n\n function setHidden(hidden: boolean) {\n dispatch({ type: 'set.hidden', hidden })\n }\n\n function setProduct(\n id: number,\n quantity: number | ((quantity: number) => number),\n options: SetProductOptions = {},\n parentId?: number,\n valuesIds?: number[],\n ) {\n // NOTE: selection messages (a product removed because it went out of stock, a\n // quantity downgraded…) describe the very selection the user is changing, and\n // the callout has no way to be dismissed otherwise. `setProducts` purposely\n // does not clear them: it is the recovery action of those same messages.\n dispatchMessage(services.message.clear('selection'))\n dispatch({ type: 'update.products', products: [{ id, parentId, quantity, valuesIds }], options })\n }\n\n function setProducts(\n products: {\n id: number\n quantity: number\n parentId?: number\n valuesIds?: number[]\n }[],\n options: UpdateCartProductOptions = {},\n ) {\n dispatch({ type: 'update.products', products, options })\n }\n\n async function updateDryRunResult(state: services.cart.CartState): Promise {\n const payload = getOrderCreatePayload(state)\n\n const response = await services.order.create(project.id, { dry_run: true, ...payload })\n\n response.caseOf({\n left: (failure) => {\n handleDryRunError(failure.body)\n },\n right: (order) => {\n dispatch({ type: 'update.dryRun', dryRunResult: order, project })\n },\n })\n }\n\n function handleDryRunError(body: unknown) {\n if (!Array.isArray(body) || body.length === 0) {\n return\n }\n\n for (const error of body) {\n if (!('classification' in error)) {\n continue\n }\n\n if (error.classification !== 'StockError') {\n dispatch({ type: 'reset.cart' })\n continue\n }\n\n if (!('fieldNames' in error) || !error.fieldNames.includes('rewards')) {\n continue\n }\n\n const outOfStockProduct = getOutOfStockProduct(error)\n\n // NOTE: alongside the actual stock error, the API also emits a legacy one\n // for the option value, which carries no product to update. We skip it, as\n // the actual error already downgraded the product quantity.\n if (outOfStockProduct === undefined) {\n continue\n }\n\n dispatch({\n type: 'update.products',\n products: [outOfStockProduct],\n options: { createIfNotFound: false, withDelay: true },\n })\n\n const errorMessage = errorUtils.allSelectedProductsAreExpiredError('selection', 1)\n dispatchMessage(services.message.error(errorMessage.message, { ...errorMessage }))\n\n refreshRewards()\n }\n }\n}\n\ntype StockErrorBody = {\n message: string\n data?: { parent_id?: number; stock_available?: number; variant_id?: number }\n}\n\nfunction getOutOfStockProduct(error: StockErrorBody): { id: number; parentId?: number; quantity: number } | undefined {\n if (error.data?.variant_id !== undefined) {\n return {\n id: Number(error.data.variant_id),\n parentId: error.data.parent_id !== undefined ? Number(error.data.parent_id) : undefined,\n quantity: Number(error.data.stock_available),\n }\n }\n\n // NOTE: fallback for stock errors that predate the `data` payload, where the\n // product and its remaining stock can only be read from the message itself.\n const match = error.message.match(REGEXP_REWARD_STOCK)\n\n if (match === null) {\n return undefined\n }\n\n return { id: Number(match[1]), quantity: Number(match[2]) }\n}\n\nfunction stateHash(state: services.cart.CartState) {\n return JSON.stringify([\n state.project?.id,\n state.products.map((product) => [product.id, product.quantity]),\n state.tip.amount,\n state.tip.frequency,\n state.shipping.mode,\n state.shipping.country,\n state.shipping.billingAddress,\n state.shipping.mondialRelay,\n state.shipping.pickupPoint,\n state.shipping.shippingAddress,\n ])\n}\n","import * as React from 'react'\nimport * as routerDOM from 'react-router'\n\nimport * as models from '@owl-nest/models'\nimport * as services from '@owl-nest/services'\n\nimport { useCart } from './useCart/useCart'\n\nexport const PAGES = {\n SELECTION: '/',\n LOGIN: '/login/',\n ADDRESS: '/address/',\n MONDIAL_RELAY: '/mondialrelay/',\n PICKUP: '/pickup/',\n PAYMENT: '/payment/',\n} as const\n\ntype NavigationContext = {\n configuration: {\n donationBasedProject: boolean\n membershipProject: boolean\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n }\n}\n\nconst navigationContext = React.createContext(undefined)\n\nexport const NavigationContext = navigationContext.Provider\n\ntype UseNavigationProps = {\n redirectToLegalPage?: boolean\n}\n\nexport function useNavigation({ redirectToLegalPage = false }: UseNavigationProps = {}) {\n const navContext = React.useContext(navigationContext)\n if (navContext === undefined) {\n throw Error('useNavigation outside a NavigationContext')\n }\n const { donationBasedProject, membershipProject, preFilledTip } = navContext.configuration\n\n const routerNavigate = routerDOM.useNavigate()\n const location = routerDOM.useLocation()\n const state = location.state as { forceStep?: boolean }\n const cart = useCart()\n const auth = services.user.useAuth()\n\n React.useEffect(() => {\n const currentLegal = getCurrentLegalPage()\n if (getCurrentPage() !== currentLegal && currentLegal !== undefined && redirectToLegalPage) {\n navigate(currentLegal, { replace: true })\n }\n }, [cart, auth, location])\n\n return { isCurrentLegal: getCurrentPage() === getCurrentLegalPage(), nextLegalPage: getNextLegalPage(), navigate }\n\n function navigate(pathname?: string, options: { replace?: boolean; forceStep?: boolean } = {}): void {\n if (pathname === undefined) {\n return\n }\n routerNavigate(\n { pathname, search: document.location.search },\n { replace: options.replace, state: { forceStep: options.forceStep } },\n )\n }\n\n function getCurrentPage() {\n return Object.values(PAGES).find((path) => path === location.pathname)\n }\n\n function getCurrentLegalPage() {\n const currentPage = getCurrentPage()\n\n switch (currentPage) {\n case PAGES.SELECTION: {\n if ((membershipProject || donationBasedProject) && preFilledTip?.amount && !state?.forceStep) {\n return PAGES.LOGIN\n }\n break\n }\n\n case PAGES.LOGIN: {\n if (cart.isEmpty) {\n return PAGES.SELECTION\n }\n\n if (auth.type === 'loggedin') {\n return getNextLegalPage()\n }\n break\n }\n\n case PAGES.PICKUP: {\n if (cart.isEmpty) {\n return PAGES.SELECTION\n }\n if (auth.type !== 'loggedin' && auth.type !== 'initial') {\n return PAGES.LOGIN\n }\n if (auth.type === 'loggedin' && cart.addressType === 'shipping') {\n if (cart.selectedShippingMode === 'home_delivery') {\n return PAGES.ADDRESS\n } else if (cart.selectedShippingMode === 'mondial_relay') {\n return PAGES.MONDIAL_RELAY\n }\n }\n break\n }\n\n case PAGES.MONDIAL_RELAY: {\n if (cart.isEmpty) {\n return PAGES.SELECTION\n }\n if (auth.type !== 'loggedin' && auth.type !== 'initial') {\n return PAGES.LOGIN\n }\n if (auth.type === 'loggedin' && cart.addressType === 'shipping') {\n if (cart.selectedShippingMode === 'home_delivery') {\n return PAGES.ADDRESS\n } else if (cart.selectedShippingMode === 'pickup_point') {\n return PAGES.PICKUP\n }\n }\n break\n }\n\n case PAGES.ADDRESS: {\n if (cart.isEmpty) {\n return PAGES.SELECTION\n }\n if (auth.type !== 'loggedin' && auth.type !== 'initial') {\n return PAGES.LOGIN\n }\n\n if (auth.type === 'loggedin' && cart.addressType !== undefined) {\n if (cart.addressType === 'none') {\n return getNextLegalPage()\n }\n if (cart.addressType === 'shipping') {\n if (cart.selectedShippingMode === 'pickup_point') {\n if (cart.selectedPickupPoint == undefined) {\n return PAGES.PICKUP\n }\n } else if (cart.selectedShippingMode === 'mondial_relay') {\n if (cart.selectedMondialRelay === undefined) {\n return PAGES.MONDIAL_RELAY\n }\n }\n }\n }\n break\n }\n\n case PAGES.PAYMENT: {\n if (cart.isEmpty) {\n return PAGES.SELECTION\n }\n if (auth.type !== 'loggedin' && auth.type !== 'initial') {\n return PAGES.LOGIN\n }\n if (auth.type === 'loggedin') {\n if (cart.addressType === 'shipping' && cart.needAddress) {\n if (cart.selectedShippingMode === 'home_delivery' && cart.shippingAddress === undefined) {\n return PAGES.ADDRESS\n }\n if (cart.selectedShippingMode === 'pickup_point' && cart.selectedPickupPoint === undefined) {\n return PAGES.PICKUP\n }\n if (cart.selectedShippingMode === 'mondial_relay' && cart.selectedMondialRelay === undefined) {\n return PAGES.MONDIAL_RELAY\n }\n }\n\n if (cart.addressType === 'contact' && cart.contactAddress === undefined) {\n return PAGES.ADDRESS\n }\n }\n\n break\n }\n }\n\n return currentPage\n }\n\n function getNextLegalPage() {\n const currentPage = getCurrentPage()\n\n switch (currentPage) {\n case PAGES.SELECTION: {\n return PAGES.LOGIN\n }\n\n case PAGES.LOGIN: {\n if (cart.addressType === 'shipping' && cart.selectedShippingMode === 'pickup_point') {\n return PAGES.PICKUP\n } else if (cart.addressType === 'shipping' && cart.selectedShippingMode === 'mondial_relay') {\n return PAGES.MONDIAL_RELAY\n } else {\n return PAGES.ADDRESS\n }\n }\n\n case PAGES.PICKUP: {\n return PAGES.ADDRESS\n }\n\n case PAGES.MONDIAL_RELAY: {\n return PAGES.ADDRESS\n }\n\n case PAGES.ADDRESS: {\n return PAGES.PAYMENT\n }\n\n case PAGES.PAYMENT: {\n return undefined\n }\n }\n }\n}\n","import { styled } from 'next-yak'\nimport { BREAKPOINTS, COLORS } from '@ulule/owl-kit-components/next'\n\nexport const CenterWrapper = styled.div`\n width: 100%;\n\n @media screen and ${BREAKPOINTS.TABLET} {\n width: 590px;\n margin: 0 auto;\n }\n`\n\nexport const LoadingCard = styled.div`\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n background-color: rgba(255, 255, 255, 0.8);\n z-index: 1;\n display: flex;\n justify-content: center;\n`\n\nexport const Highlighted = styled.span`\n background-color: ${COLORS.PRIMARY_BLUE_200};\n color: ${COLORS.PRIMARY_BLUE_900};\n padding: 0 3px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { CenterWrapper } from '../style'\n\nconst ItemWrapper = styled(CenterWrapper)`\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n padding: 10px;\n margin-bottom: 20px;\n box-shadow: ${plume.EFFECTS.SHADOW_1};\n box-sizing: border-box;\n\n @media screen and ${plume.BREAKPOINTS.MOBILE_M} {\n padding: 20px;\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n border-radius: 6px;\n padding: 25px 33px;\n margin-bottom: 20px;\n }\n`\n\nconst ItemHeader = styled.div`\n display: flex;\n justify-content: space-between;\n`\n\nexport const Title = styled(plume.styles.heading.XXS)`\n display: block;\n margin-bottom: 20px;\n width: 100%;\n`\n\nexport type ItemProps = {\n action?: {\n handler: (event: React.MouseEvent) => void\n text: string\n }\n children?: React.ReactNode\n className?: string\n testid?: string\n title?: React.ReactNode\n}\n\nexport const Item = React.forwardRef(\n ({ action, children, className, testid, title }, ref) => {\n return (\n \n \n {title && {title}}\n {action && (\n \n \n {action.text}\n \n \n )}\n \n {children}\n \n )\n },\n)\n\nItem.displayName = 'Item'\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { Item, Title, type ItemProps } from './Item'\n\nconst StyledItem = styled(Item)`\n align-items: center;\n display: flex;\n min-height: 112px;\n\n ${Title} {\n color: ${plume.COLORS.PRIMARY_SAND_500};\n margin-bottom: 0;\n }\n`\n\nexport function FutureItem({ title, action }: ItemProps): React.ReactElement {\n return \n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport { useCart } from '../hooks/useCart/useCart'\n\nexport const AnonymousOrderToggle = React.forwardRef(\n function AnonymousOrderToggle(_, ref): React.ReactElement {\n const cart = useCart()\n\n return (\n <>\n \n \n cart.setHidden(event.target.checked)}\n label={{t('Make the contribution anonymous')}}\n />\n \n {t(\n 'Select this option if you want to make your contribution anonymous. However, it will still be visible to the project team.',\n )}{' '}\n \n {t('Learn more')}\n \n \n \n \n )\n },\n)\n\nconst Divider = styled.hr`\n border: none;\n border-top: 1px solid ${plume.COLORS.PRIMARY_SAND_200};\n margin: 19px 0;\n width: 100%;\n`\n\nconst Row = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n`\n\nconst Description = styled(plume.styles.copy.S.regular)`\n color: ${plume.COLORS.TEXT_TERTIARY};\n`\n","import * as React from 'react'\n\nimport { Spinner } from '@ulule/owl-kit-components/next'\n\nimport { Item } from './Item'\nimport { AnonymousOrderToggle } from './AnonymousOrderToggle'\n\nimport { Connect } from '@owl-nest/connect'\n\nexport const IdentityItem = React.forwardRef(function IdentityItem(\n _,\n ref,\n): React.ReactElement<{}> | null {\n return (\n \n }>\n \n \n \n \n )\n})\n","import { styled, css } from 'next-yak'\n\nimport { styles } from '@owl-nest/utils'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nexport const SelectionCard = styled.div`\n position: relative;\n\n ${({ theme }) => {\n if ((theme as any)?.colors !== undefined) {\n return css`\n ${plume.Callout} {\n background-color: ${(theme as any)?.colors?.background};\n\n ${plume.glyphs.Icon} {\n color: ${(theme as any)?.colors?.primary};\n }\n }\n `\n }\n }}\n`\n\nexport const TipSummaryInformations = styled.div`\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n\n ${plume.Callout} {\n ${({ theme }) => {\n if ((theme as any)?.colors !== undefined) {\n return css`\n background-color: ${(theme as any)?.colors?.background};\n\n ${plume.glyphs.Icon} {\n color: ${(theme as any)?.colors?.primary};\n }\n `\n }\n }}\n }\n`\n\nexport const TipSummary = styled(plume.styles.copy.M.semiBold)``\n\nexport const TipSummaryConversion = styled(plume.styles.copy.XS.regular)`\n color: ${plume.COLORS.TEXT_TERTIARY};\n margin-left: 7px;\n`\n\nexport const TipLink = styled(plume.Link)`\n font-size: 13px; // HACK: Irregular font manipulation\n line-height: 23px;\n`\n\nexport const StyledTable = styled.table`\n width: 100%;\n`\n\nexport const SelectionWrapper = styled.div`\n display: flex;\n flex-direction: column;\n`\n\nexport const SelectionItem = styled.tr<{ $hasAdditionalCost?: boolean }>`\n position: relative;\n\n td {\n padding-bottom: 12px;\n padding-top: 12px;\n vertical-align: middle;\n /* width: 205px; */\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n td {\n padding-bottom: 15px;\n padding-top: 15px;\n }\n\n ${({ $hasAdditionalCost = false }) => {\n if ($hasAdditionalCost) {\n return css`\n td:last-of-type {\n padding-top: 18px;\n }\n `\n }\n }};\n }\n`\n\nexport const SelectionItemInformations = styled.td`\n display: flex;\n align-items: center;\n width: 180px;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n width: 325px;\n }\n`\n/*\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n width: 340px;\n max-width: 340px;\n }*/\n\nexport const SelectionTitle = styled(plume.styles.copy.S.regular)`\n font-size: 14px; // HACK: Irregular font manipulation\n display: block;\n`\n/*\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n max-width: 100%;\n }*/\n\nexport const SelectionCurrencyWrapper = styled.td`\n text-align: right;\n min-width: 42px;\n position: relative;\n`\n\nexport const SelectionCurrency = styled(plume.styles.copy.M.semiBold)``\n\nexport const SmallSelectionCurrency = styled(plume.styles.copy.S.semiBold)``\n\ntype MoneyConverterWrapperProps = {\n absolutePosition?: boolean\n biggerFont?: boolean\n bottomPosition?: number\n}\n\nexport const MoneyConverterWrapper = styled(plume.styles.copy.S.regular)`\n display: ${(props) => (props.absolutePosition ? 'block' : 'inline-block')};\n color: ${plume.COLORS.TEXT_TERTIARY};\n font-size: ${(props) => (props.biggerFont ? '14px' : '10px')};\n position: ${(props) => (props.absolutePosition ? 'absolute' : 'relative')};\n right: 0;\n ${(props) => {\n return (\n props.bottomPosition &&\n css`\n bottom: ${() => props.bottomPosition}px;\n `\n )\n }}\n`\n\nexport const SelectionAction = styled.div<{ marginTop?: boolean }>`\n margin-top: ${(props) => (props.marginTop ? '50px' : '24px')};\n`\n\nconst baseRewardThumbnail = css<{ isSmall?: boolean }>`\n width: 70px;\n margin-right: 14px;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n width: ${({ isSmall }) => (isSmall ? 70 : 132)}px;\n }\n`\n\nexport const RewardSelectionPlaceholder = styled(plume.DefaultRewardImage)<{ isSmall?: boolean }>`\n ${baseRewardThumbnail};\n\n max-height: 54px;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n max-height: 82px;\n }\n`\n\nexport const RewardSelectionImage = styled.img<{ isSmall?: boolean }>`\n ${baseRewardThumbnail};\n`\n\nexport const SelectionVariantTitle = styled(plume.styles.copy.S.regular)`\n color: ${plume.COLORS.TEXT_TERTIARY};\n`\n\nexport const QuantityResume = styled.span`\n font-size: 13px; // HACK: Irregular font manipulation\n font-style: italic;\n line-height: 20px;\n text-align: right;\n color: ${plume.COLORS.TEXT_TERTIARY};\n margin-right: 10px;\n`\n\nexport const SelectionSection = styled.div<{ isSmall?: boolean }>`\n display: flex;\n align-items: center;\n justify-content: ${(props) => (props.isSmall ? 'flex-end' : 'space-between')};\n margin-bottom: 8px;\n`\n\ntype SelectionSectionTitleProps = {\n isSmall?: boolean\n forceUpperCase?: boolean\n isBold?: boolean\n noMargin?: boolean\n}\n\nexport const SelectionSectionTitle = styled(plume.styles.copy.S.regular)`\n font-size: ${(props) => (props.isSmall ? '14px' : '16px')}; // HACK: Irregular font manipulation\n font-weight: ${(props) => (props.isBold ? 600 : 400)}; // HACK: Irregular font manipulation\n line-height: 16px;\n text-transform: ${(props) => (props.forceUpperCase ? 'uppercase' : 'none')};\n color: ${plume.COLORS.TEXT_TERTIARY};\n margin-right: ${(props) => (props.noMargin ? 0 : '16px')};\n white-space: pre;\n`\n\nexport const ColumnSelectionSection = styled.div<{ isSmall?: boolean }>`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: ${(props) => (props.isSmall ? 'flex-end' : 'space-between')};\n margin: 20px 0px;\n\n ${SelectionSectionTitle} {\n margin-bottom: 11px;\n }\n`\n\nexport const Price = styled(plume.styles.copy.S.regular)<{ isSmall?: boolean; isBold?: boolean }>`\n font-size: ${(props) => (props.isSmall ? '16px' : '18px')};\n font-weight: ${(props) => (props.isBold ? '600' : '400')};\n line-height: 24px;\n text-align: right;\n color: ${plume.COLORS.TEXT_PRIMARY};\n`\n\nexport const ShippingSelection = styled.div`\n text-align: right;\n margin-right: 10px;\n`\n\nexport const SelectedCountry = styled(QuantityResume)`\n font-size: 14px;\n margin-right: 0px;\n`\n\nexport const SelectionShipping = styled.div`\n display: flex;\n align-items: baseline;\n justify-content: flex-end;\n margin-bottom: 8px;\n`\n\nexport const SelectionShippingCurrencyWrapper = styled.div``\n\nexport const SelectedTotal = styled.div<{ marginBottom?: boolean }>`\n display: flex;\n justify-content: flex-end;\n align-items: baseline;\n margin-bottom: ${(props) => (props.marginBottom ? '20px' : '0px')};\n`\n\nexport const SelectedConvertedCurrency = styled.div`\n text-align: right;\n`\n\nexport const CalloutText = styled(plume.styles.copy.S.regular)`\n font-size: 15px; // HACK: Irregular font manipulation\n line-height: 22px; // HACK: Irregular font manipulation\n display: block;\n color: ${plume.COLORS.TEXT_PRIMARY};\n`\n\nexport const CalloutTextStrong = styled(CalloutText)`\n font-weight: 500; // HACK: Irregular font manipulation\n`\n\nexport const SelectionSectionTitleWrapper = styled.div`\n display: flex;\n position: relative;\n align-items: baseline;\n\n ${plume.glyphs.stroke.Info} {\n margin-left: 5px;\n margin-right: 16px;\n color: ${plume.COLORS.TEXT_TERTIARY};\n position: relative;\n }\n`\n\nexport const FeeIconWrapper = styled.div`\n position: relative;\n\n ${plume.Tooltip} {\n display: none;\n }\n\n &:hover {\n ${plume.Tooltip} {\n display: block;\n }\n }\n`\n","import { styled, css } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport {\n BREAKPOINTS,\n COLORS,\n Dropdown,\n LinkAsButton,\n Option,\n RadioField,\n glyphs,\n styles as S,\n} from '@ulule/owl-kit-components/next'\n\n// TODO: FIXME: We shouldn't have to do this... This is misleading.\nexport * from '../../components/selection/style'\n\nimport { Item } from '../../components/Item'\n\nexport const OrderedItem = styled(Item)``\n\ntype DropdownExtraProps = {\n $active?: boolean\n $visible?: boolean\n}\n\n//TODO: FIX Dropdown in DS (error status, drawer margin-top and horizontal alignment) instead of hacks done here\nexport const StyledDropdown = styled(Dropdown)`\n z-index: ${({ $active }) => ($active ? 2 : 1)};\n\n ${S.select.ScrollList} {\n min-width: 200px;\n max-width: 300px;\n z-index: ${({ $active }) => ($active ? 2 : 1)};\n }\n\n ${S.select.Button} {\n align-self: flex-start;\n border: ${({ status }) => (status === 'error' ? `1px dashed ${COLORS.PRIMARY_RED_500}` : 'none')};\n padding: ${({ status }) => (status === 'error' ? '3px' : '0px')};\n max-width: 100%;\n }\n\n ${S.select.Label} {\n display: block;\n }\n\n ${S.select.CaretDown} {\n flex: 0 0 10px;\n }\n\n ${S.select.Drawer} {\n margin-top: 0px;\n min-width: 200px;\n }\n`\n\nexport const OneLineOption = styled(Option)``\n\nexport const Rate = styled(S.copy.S.semiBold)``\n\nexport const StyledRadioField = styled(RadioField)<{ $hideDescriptionContent?: boolean }>`\n position: relative;\n\n ${S.field.Description} {\n visibility: ${({ $hideDescriptionContent }) => ($hideDescriptionContent ? `hidden` : 'visible')};\n width: 70%;\n\n @media screen and ${plume.BREAKPOINTS.MOBILE_L} {\n width: 80%;\n }\n }\n\n ${plume.StyledRadioField} {\n min-height: 70px !important;\n }\n\n ${Rate} {\n position: absolute;\n right: 20px;\n top: 50%;\n transform: translateY(-50%);\n }\n\n ${Dropdown} {\n position: absolute;\n left: 40px;\n bottom: 20%;\n }\n`\n\nexport const TipInformations = styled.td`\n @media screen and ${BREAKPOINTS.TABLET} {\n width: 325px;\n }\n`\n\nexport const TipActions = styled.td`\n text-align: right;\n`\n\nexport const SelectionError = styled(S.copy.S.regular)<{ $error: boolean }>`\n color: ${COLORS.PRIMARY_RED_500};\n position: absolute;\n right: 0;\n bottom: -2px;\n display: ${({ $error }) => ($error ? 'block' : 'none')};\n`\n\nexport const Error = styled(S.copy.S.regular)<{ $error: boolean }>`\n color: ${COLORS.PRIMARY_RED_500};\n display: ${({ $error }) => ($error ? 'block' : 'none')};\n margin-bottom: 10px;\n text-align: right;\n`\n\nexport const AddMoreRewards = styled(LinkAsButton)`\n cursor: pointer;\n margin-top: 11px;\n margin-bottom: 16px;\n width: 100%;\n\n ${glyphs.stroke.Plus} {\n color: ${COLORS.PRIMARY_GREY_500};\n margin-right: 8px;\n }\n`\n\nexport const SelectionShippingLabel = styled(S.copy.S.semiBold)`\n line-height: 22px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { LocaleMoneyDisplayer } from '@ulule/owl-kit-components'\nimport { glyphs, Link, styles as S } from '@ulule/owl-kit-components/next'\nimport { type Project } from '@owl-nest/api-client/latest'\nimport { t, tc } from '@owl-nest/localize'\nimport * as env from '@owl-nest/config'\n\n// TODO: FIXME: Prefix\nimport { MoneyConverterWrapper } from '../../views/selection/style'\nimport { useProject } from '../../hooks/useProject'\n\nconst ConversionDisclaimerWrapper = styled.div`\n display: flex;\n margin-top: 19px;\n`\n\nconst GlyphWrapper = styled.div`\n margin-right: 6px;\n`\n\ntype ConversionDisclaimerProps = {\n readonly project: Project\n}\n\ntype CurrencyGlyphProps = {\n currency: string\n size?: number\n}\n\ntype GlyphName = {\n [key: string]: string\n}\n\nconst glyphNameBySymbol: GlyphName = {\n AUD: 'Dolls',\n CAD: 'Dolls',\n CHF: 'Chf',\n DKK: 'Kr',\n EUR: 'Eur',\n GBP: 'Pound',\n NOK: 'Kr',\n NZD: 'Dolls',\n SEK: 'Kr',\n USD: 'Dolls',\n}\n\nexport const CurrencyGlyph = ({ currency, size }: CurrencyGlyphProps): React.ReactElement => {\n return (glyphs as any)['currencies'][`${glyphNameBySymbol[currency]}`]({ size })\n}\n\nexport const ConversionDisclaimer = ({\n project,\n}: ConversionDisclaimerProps): React.ReactElement => {\n const projectCurrency = project.currency\n const userConfig = env.useUserEnv()\n const userCurrency = userConfig.currency\n\n return (\n \n \n \n \n <>\n \n {tc(\n '[strong: This project is set in %(projectCurrency)s.] If you choose to pay in %(userCurrency)s, a conversion rate and possible additional fees will be applied by your card issuer.',\n {\n projectCurrency,\n strong: ,\n userCurrency,\n },\n )}\n
\n \n {t('Learn more')}\n \n
\n \n
\n )\n}\n\ntype MoneyConverterProps = {\n readonly absolutePosition?: boolean\n readonly amount: number\n readonly biggerFont?: boolean\n readonly bottomPosition?: number\n readonly precision?: number\n}\n\n// TODO: Use as this basically adds a wrapper and a different `targetCurrency`\nexport const MoneyConverter = ({\n absolutePosition = true,\n amount,\n biggerFont = false,\n bottomPosition,\n precision,\n}: MoneyConverterProps): React.ReactElement => {\n const { project } = useProject()\n\n const userConfig = env.useUserEnv()\n\n const currency = project.currency\n const currentCurrency = userConfig.currency\n\n const userLanguage = userConfig.lang\n\n return (\n \n \n \n )\n}\n\ntype MoneyDisplayerProps = {\n readonly amount: number\n readonly precision?: number\n}\n\nexport const MoneyDisplayer = ({ amount, precision }: MoneyDisplayerProps): React.ReactElement => {\n const { project } = useProject()\n const userConfig = env.useUserEnv()\n\n const currency = project.currency\n const userLanguage = userConfig.lang\n\n return (\n \n )\n}\n","import * as React from 'react'\n\nimport { t, tp } from '@owl-nest/localize'\nimport * as env from '@owl-nest/config'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { type ShippingCart } from '../../hooks/useCart/format'\nimport { MoneyDisplayer } from '../money'\n\nimport * as S from './style'\n\ntype SelectedShippingProps = {\n cart: ShippingCart\n}\n\nexport function SelectedShipping({ cart }: SelectedShippingProps) {\n const cartHasFreeShipping =\n cart.selectedShippingMode === 'pickup_point' ||\n (cart.selectedCountry?.code && cart.getRate(cart.selectedCountry.code) === 0)\n const shippingRate = cart.selectedCountry?.code && cart.getRate(cart.selectedCountry.code)\n\n return (\n <>\n \n \n \n {cart.selectedShippingMode === 'pickup_point' ? (\n t('Pick-up')\n ) : cart.selectedShippingMode === 'mondial_relay' ? (\n <>\n {t('Mondial Relay')}\n \n \n ) : (\n t('%(country)s Delivery', {\n country: env.COUNTRIES.find((country) => country.code === cart.selectedCountry?.code)?.label() ?? '',\n })\n )}\n \n \n \n \n {cartHasFreeShipping ? (\n <>{cart.selectedShippingMode === 'pickup_point' ? tp('Free', 'pickup') : tp('Free', 'address')}\n ) : (\n shippingRate && (\n <>\n +{'\\u00A0'}\n \n \n )\n )}\n \n \n \n \n )\n}\n","import * as React from 'react'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport { MoneyDisplayer } from '../../../../components/money'\nimport * as S from '../../style'\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype ServiceFeeProps = {\n isSmall?: boolean\n frequency?: 'one-time' | 'monthly'\n}\n\nexport function ServiceFee({ isSmall, frequency }: ServiceFeeProps): React.ReactElement {\n const cart = useCart()\n const userConfig = env.useUserEnv()\n\n return (\n \n \n \n {t('Service fees')}\n \n \n \n \n \n {t(\n 'This service fee of 10 cts + %(serviceFeesRate)s incl. VAT enables us to continue improving our service, guaranteeing contributors the best possible experience and responsive customer service. This fee is refunded if the contribution is reimbursed, and includes VAT.',\n {\n serviceFeesRate: `${new Intl.NumberFormat(userConfig.lang).format(2.2)}\\u00A0%`,\n },\n )}\n \n \n \n \n\n \n +{'\\u00A0'}\n {frequency === 'monthly' ? (\n <>\n {tc('[amount] / month', {\n amount: ,\n })}\n \n ) : (\n \n )}\n \n \n )\n}\n","import * as React from 'react'\n\nimport { t } from '@owl-nest/localize'\n\nimport { MoneyDisplayer } from '../../../../components/money'\nimport * as S from '../../style'\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype ItemsTotalProps = {\n isSmall?: boolean\n}\n\nexport function ItemsTotal({ isSmall }: ItemsTotalProps): React.ReactElement {\n const cart = useCart()\n\n return (\n \n \n {t('Total contribution')}\n \n\n \n \n \n \n )\n}\n","import * as React from 'react'\n\nimport { t, tc } from '@owl-nest/localize'\n\nimport { MoneyConverter, MoneyDisplayer } from '../../../../components/money'\nimport * as S from '../../style'\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype SelectionTotalProps = {\n isDifferentCurrency: boolean\n isSmall?: boolean\n frequency?: 'one-time' | 'monthly'\n}\n\nexport function SelectionTotal({\n isDifferentCurrency,\n isSmall,\n frequency,\n}: SelectionTotalProps): React.ReactElement {\n const cart = useCart()\n const total = cart.total_with_fees ?? cart.total\n return (\n \n \n {t('Total')}\n \n \n {frequency === 'monthly' ? (\n tc('[amount] / month', {\n amount: ,\n })\n ) : (\n \n )}\n {isDifferentCurrency && (\n \n \n \n )}\n \n \n )\n}\n","import * as React from 'react'\nimport { styled, css, YakThemeProvider } from 'next-yak'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as hooks from '@owl-nest/hooks'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport * as productModel from '../../models/product'\n\nimport { MoneyDisplayer } from '../money'\nimport { SelectedShipping } from './SelectedShipping'\n\nimport * as S from './style'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { useProject } from '../../hooks/useProject'\nimport { ServiceFee } from '../../views/selection/components/cart/ServiceFee'\nimport { ItemsTotal } from '../../views/selection/components/cart/ItemsTotal'\nimport { SelectionTotal } from '../../views/selection/components/cart/SelectionTotal'\n\ntype Theme = {\n colors: {\n accent: string\n background: string\n hover: string\n primary: string\n }\n}\n\nexport function CartSummary(): React.ReactElement {\n const { project } = useProject()\n const cart = useCart()\n const userConfig = env.useUserEnv()\n\n const projectCurrency = project.currency\n const userCurrency = userConfig.currency\n const isDifferentCurrency = projectCurrency !== userCurrency\n const setIsRewardTaxDeductionModalOpen = hooks.useSetModal('RewardTaxDeductionInfo')\n\n const tip = cart.tip\n const selectedProducts = cart.products\n\n const isMembership = models.project.isMembership(project)\n const isDonationBased = models.project.isDonationBased(project)\n\n const projectColor = models.project.backgroundColor(project) ?? plume.COLORS.COMPLEMENTARY_INDIGO\n const theme: Theme = {\n colors: {\n accent: `color-mix(in srgb, ${projectColor} 20%, white)`,\n background: `color-mix(in srgb, ${projectColor} 10%, white)`,\n hover: `color-mix(in srgb, ${projectColor} 70%, black)`,\n primary: projectColor,\n },\n }\n\n function getTipLabel(): any {\n if (isDonationBased || isMembership) {\n return tip.frequency === 'monthly' ? t('Monthly donation') : t('One-time donation')\n }\n\n return tc('[tip] Donation (without reward)', {\n tip: ,\n })\n }\n\n return (\n \n \n \n \n {tip.amount > 0 && (\n \n \n {getTipLabel()}\n \n \n \n {tip.frequency === 'monthly' ? (\n <>\n {tc('[amount] / month', {\n amount: ,\n })}\n \n ) : (\n \n )}\n \n \n \n )}\n\n {selectedProducts.length > 0 &&\n selectedProducts.map((selectedProduct) => {\n const additionalCost = selectedProduct.variant && selectedProduct.variant.additional_cost\n const description = productModel.getTruncatedDescription(selectedProduct)\n const image = selectedProduct.variant\n ? models.variant.image(selectedProduct.variant)\n : productModel.getImage(selectedProduct)\n\n const productIsLegacy = productModel.isLegacy(selectedProduct)\n const title = productIsLegacy ? description : productModel.getTruncatedTitle(selectedProduct)\n\n return (\n \n \n {image ? (\n \n ) : (\n isMembership && \n )}\n
\n {title && }\n {description && selectedProduct.variant && !productIsLegacy && (\n \n )}\n
\n
\n\n \n \n {selectedProduct.quantity > 1 && (\n {selectedProduct.quantity} x\n )}\n {isMembership ? (\n tc('[amount] / month', {\n amount: ,\n })\n ) : (\n \n )}\n \n {additionalCost && (\n <>\n \n +{'\\u00A0'}\n {selectedProduct.quantity > 1 && (\n {selectedProduct.quantity} x\n )}\n \n \n \n )}\n \n
\n )\n })}\n \n
\n\n {cart.taxDeductible && (\n \n setIsRewardTaxDeductionModalOpen(true)}>\n \n {t('%(price)s after tax reduction', {\n price: plume.accounting.localeMoney(cart.taxDeductibleTotal, {\n currency: project.currency,\n lang: userConfig.lang,\n }),\n })}\n \n \n )}\n\n {cart.addressType === 'shipping' && }\n\n {Boolean(cart.serviceFee) &&\n (cart.products.length > 1 || (cart.tip.amount > 0 && cart.products.length > 0)) && (\n \n )}\n\n {Boolean(cart.serviceFee) && (\n = 1 ? 'monthly' : cart.tip.frequency\n }\n />\n )}\n\n \n = 1 ? 'monthly' : cart.tip.frequency\n }\n />\n \n\n {models.project.isMembership(project) && selectedProducts.length === 0 && (\n \n {t(\n 'This donation does not give you access to paid posts. If you wish to have access to paid posts, you must subscribe.',\n )}\n \n )}\n
\n
\n )\n}\n\nconst TaxInfo = styled(plume.LinkAsButton)<{ alignRight?: boolean }>`\n display: block;\n margin-bottom: 8px;\n margin-top: 8px;\n padding: 0;\n\n ${({ alignRight = true }) => {\n if (alignRight) {\n return css`\n width: 100%;\n text-align: right;\n `\n }\n }};\n\n ${plume.glyphs.stroke.Percent} {\n color: ${plume.COLORS.PRIMARY_SAND_500};\n margin-right: 6px;\n margin-top: -5px;\n }\n`\n\nconst Callout = styled(plume.Callout)`\n margin-top: 16px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t, tp } from '@owl-nest/localize'\nimport { pickup as pickupModel } from '@owl-nest/models'\nimport * as services from '@owl-nest/services'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as env from '@owl-nest/config'\n\nimport { Item } from './Item'\nimport { useCart } from '../hooks/useCart/useCart'\n\ntype ShippingItemProps = {\n goToDelivery: () => void\n goToAddress: () => void\n}\n\nexport const ContactItem = React.forwardRef(function ShippingItem(\n { goToAddress },\n ref,\n) {\n const cart = useCart()\n const countries = env.COUNTRIES\n\n const user = services.user.useAuthenticatedUser()\n const { response } = services.user.address.useAddress(user?.id, { fetchOnMount: 'force' })\n const addresses = response.data?.addresses\n\n if (cart.addressType !== 'contact' || addresses === undefined) {\n return <>\n }\n\n const contactAddress = addresses.find((address) => address.id === cart.contactAddress)\n if (contactAddress !== undefined) {\n return (\n \n {addressModel.format(contactAddress, countries)}\n \n )\n }\n return null\n})\n\nexport const BillingAddress = React.forwardRef(function ShippingItem(\n { goToAddress },\n ref,\n) {\n const cart = useCart()\n const countries = env.COUNTRIES\n\n const user = services.user.useAuthenticatedUser()\n const { response } = services.user.address.useAddress(user?.id, { fetchOnMount: 'force' })\n const addresses = response.data?.addresses\n\n if (\n !(\n cart.addressType === 'shipping' &&\n (cart.selectedShippingMode === 'pickup_point' || cart.selectedShippingMode === 'mondial_relay')\n ) ||\n addresses === undefined\n ) {\n return <>\n }\n\n const billingAddress = addresses.find((address) => address.id === cart.billingAddress)\n if (billingAddress !== undefined) {\n return (\n \n {addressModel.format(billingAddress, countries)}\n \n )\n }\n return null\n})\n\nexport const AddressItem = React.forwardRef(function ShippingItem(\n { goToAddress },\n ref,\n) {\n const cart = useCart()\n const countries = env.COUNTRIES\n\n const user = services.user.useAuthenticatedUser()\n const { response } = services.user.address.useAddress(user?.id, { fetchOnMount: 'force' })\n const addresses = response.data?.addresses\n\n if (cart.addressType !== 'shipping' || addresses === undefined) {\n return <>\n }\n\n const deliveryAddress = addresses.find((address) => address.id === cart.shippingAddress)\n if (deliveryAddress !== undefined) {\n return (\n \n {addressModel.format(deliveryAddress, countries)}\n \n )\n }\n return null\n})\n\nexport const MondialRelayItem = React.forwardRef(function ShippingItem(\n { goToDelivery },\n ref,\n) {\n const cart = useCart()\n\n if (cart.addressType !== 'shipping') {\n return <>\n }\n\n if (cart.selectedMondialRelay !== undefined) {\n return (\n \n \n \n {t('Recipient')}\n \n {cart.selectedMondialRelay.firstName} {cart.selectedMondialRelay.lastName}\n \n {cart.selectedMondialRelay.phoneNumber}\n \n \n {t('Drop-off point')}\n {cart.selectedMondialRelay.dropoff?.name}\n {cart.selectedMondialRelay.dropoff?.address}\n \n {cart.selectedMondialRelay.dropoff?.postal_code} {cart.selectedMondialRelay.dropoff?.city}\n \n \n {env.COUNTRIES.find((country) => country.code === cart.selectedCountry?.code)?.label()}\n \n \n \n \n )\n }\n\n return null\n})\n\nconst MondialRelayDetail = styled.div`\n display: flex;\n`\n\nconst MondialRelayColumn = styled.div`\n margin: 0 24px 0 0;\n\n ${plume.styles.heading.XXXXXXS} {\n color: ${plume.COLORS.PRIMARY_SAND_700};\n margin-bottom: 4px;\n text-transform: uppercase;\n }\n`\n\nexport const PickupItem = React.forwardRef(function ShippingItem({ goToDelivery }, ref) {\n const cart = useCart()\n\n if (cart.addressType !== 'shipping') {\n return <>\n }\n\n if (cart.selectedPickupPoint !== undefined) {\n return (\n \n \n \n \n \n {pickupModel.city(cart.selectedPickupPoint)}\n \n {pickupModel.address(cart.selectedPickupPoint)}\n \n \n {pickupModel.description(cart.selectedPickupPoint)}\n \n \n \n )\n }\n\n return null\n})\n\nconst AddressDisplay = styled.div`\n white-space: pre;\n font-weight: 200;\n font-size: 15px;\n line-height: 22px;\n`\n\nconst PickupDisplay = styled.div`\n display: flex;\n flex-direction: column;\n\n ${plume.glyphs.stroke.MapCursor} {\n color: ${plume.COLORS.PRIMARY_GREY_500};\n margin-right: 4px;\n }\n\n ${plume.styles.field.Title} {\n margin-right: 8px;\n color: ${plume.COLORS.TEXT_PRIMARY} !important;\n\n ${plume.styles.heading.XXXS} {\n display: inline;\n }\n }\n`\n","import * as React from 'react'\nimport * as formik from 'formik'\nimport { styled } from 'next-yak'\n\nimport { AutocompleteSubForm } from '@owl-nest/address/src/AutocompleteSubForm'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as api from '@owl-nest/api-client/next'\nimport * as hooks from '@owl-nest/hooks'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\nimport * as utils from '@owl-nest/utils'\n\nimport { useProject } from '../../../hooks/useProject'\nimport { useCart } from '../../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../../hooks/useCart/format'\n\ntype NewAddressSubFormProps = {\n allowCountrySelection?: boolean\n hideCountrySelection?: boolean\n initialCountryFilter: string[]\n defaultPhoneCountry: env.Country\n disableCountry?: boolean\n errors: formik.FormikErrors\n hideState?: boolean\n initialEmpty: boolean\n onChange: (model: addressModel.Model) => void\n onFound: () => void\n phoneRequired: boolean\n touched: formik.FormikTouched\n value: addressModel.Model\n}\n\nexport function NewAddressSubForm({\n allowCountrySelection = false,\n hideCountrySelection = false,\n initialCountryFilter,\n defaultPhoneCountry,\n disableCountry = false,\n errors,\n hideState = false,\n initialEmpty,\n onChange,\n onFound,\n phoneRequired,\n touched,\n value,\n}: NewAddressSubFormProps): React.ReactElement {\n const countries = env.COUNTRIES\n const baseAddress: api.BaseAddress = {\n address1: value.address1,\n address2: value.address2,\n city: value.city,\n country: value.country,\n postal_code: value.postal_code,\n state: value.state,\n }\n\n const [lockCountrySelect, setLockCountrySelect] = React.useState(false)\n const [countryFilter, setCountryFilter] = React.useState(initialCountryFilter)\n const [phoneCountryCode, setPhoneCountryCode] = React.useState(undefined)\n\n const cart = useCart()\n const { project } = useProject()\n const isDonationBasedProject = models.project.isDonationBased(project)\n const isRewardBasedProject = models.project.isRewardBased(project)\n\n const countryOptions =\n cart.addressType === 'shipping'\n ? Object.keys(cart.rates.homeDelivery)\n .map((countryCode) => {\n return { label: getCountryLabel(cart, countryCode, project), code: countryCode }\n })\n // unknown country will have an undefined label. We filter them out.\n .filter((option) => option.label !== undefined)\n : countries.map((country) => ({ label: country.label(), code: country.code }))\n\n const previousCountryLockState = hooks.usePrevious(lockCountrySelect)\n React.useEffect(() => {\n if (!lockCountrySelect && previousCountryLockState) {\n // HACK: To hell with the ref drilling, we try and keep it simple here.\n const $shippingCountrySelector = document.getElementById('shipping-country-selector')\n if ($shippingCountrySelector) {\n $shippingCountrySelector.click()\n }\n }\n }, [lockCountrySelect])\n\n return (\n <>\n \n ) => onChange({ ...value, first_name: evt.target.value })}\n error={touched.first_name && errors.first_name}\n />\n ) => onChange({ ...value, last_name: evt.target.value })}\n error={touched.last_name && errors.last_name}\n />\n \n\n \n onChange({ ...value, type: 'personal' } as any)}\n />\n onChange({ ...value, type: 'association' } as any)}\n />\n onChange({ ...value, type: 'business' } as any)}\n />\n \n\n {value.type !== 'personal' && (\n ) => onChange({ ...value, entity_name: evt.target.value })}\n error={touched.entity_name && errors.entity_name}\n />\n )}\n\n {phoneRequired && (\n {\n setPhoneCountryCode(phone.country)\n onChange({\n ...value,\n phone_number: phone.number,\n phone_number_country: phone.country as utils.phone.CountryCode,\n })\n }}\n label={t('Phone number')}\n context={isRewardBasedProject ? t('to facilitate delivery') : undefined}\n error={touched.phone_number && errors.phone_number}\n />\n )}\n\n {allowCountrySelection && !hideCountrySelection && (\n \n {\n const selectedCountry = selected[0].code\n setCountryFilter(selected.map((country) => country.code))\n cart.setSelectedCountry(selectedCountry)\n if (!value.phone_number) {\n setPhoneCountryCode(selectedCountry)\n }\n onChange({ ...value, country: selectedCountry })\n }}\n >\n {countryOptions.map((option) => {\n return (\n \n {option.label}\n \n )\n })}\n \n {lockCountrySelect && (\n {\n setLockCountrySelect(false)\n }}\n >\n {t('Edit')}\n \n )}\n \n )}\n\n
\n {\n delete baseAddress.latitude\n delete baseAddress.longitude\n\n if (!lockCountrySelect) {\n setLockCountrySelect(true)\n }\n onFound()\n onChange({ ...value, ...baseAddress })\n }}\n touched={touched}\n />\n
\n \n )\n}\n\nfunction getCountryLabel(cart: ShippingCart, countryCode: string, project: api.Project): string | undefined {\n const rate = cart.getRate(countryCode, 'home_delivery')\n const country = env.COUNTRIES.find((country) => country.code === countryCode)\n\n // the list of countries API side might be out of sync with the liste of\n // country in the front.\n if (country === undefined) {\n return undefined\n }\n\n return rate === 0 || rate === undefined\n ? t('%(label)s (included)', { label: country.label() })\n : `${country.label()} (+\\xa0${t('%(currency)s%(amount)s', {\n amount: rate,\n currency: models.project.currencySymbol(project),\n })})`\n}\n\nconst ShippingCountryModifier = styled.button`\n ${plume.styles.copy._baseStyle};\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 13px; // HACK: Irregular font manipulation\n font-weight: 500; // HACK: Irregular font manipulation\n position: absolute;\n right: 23px;\n top: 55%;\n z-index: 2;\n`\n\nexport const IdentityGroup = styled(plume.styles.controls.Group)`\n margin: 20px 0 20px;\n\n ${plume.TextField} {\n flex: 1;\n\n &:first-child {\n margin-right: 10px;\n }\n }\n`\n\nconst SelectWrapper = styled.div`\n position: relative;\n`\n\nconst StyledAutocompleteSubForm = styled(AutocompleteSubForm)`\n margin: 20px 0 20px;\n`\n\nconst StyledPhoneField = styled(plume.PhoneField)`\n margin: 30px 0 20px;\n`\n\nconst StyledSelectField = styled(plume.SelectField)`\n margin: 20px 0 20px;\n position: relative;\n z-index: 2;\n\n ${plume.styles.select.Button}:disabled {\n ${plume.glyphs.fill.CaretDown} {\n display: none;\n }\n }\n`\n\nexport const Type = styled(plume.RadioGroupField)`\n display: flex;\n margin: 20px 0 30px;\n`\n","import * as React from 'react'\nimport * as formik from 'formik'\nimport { styled } from 'next-yak'\n\nimport * as addressModel from '@owl-nest/address/src/model'\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport { NewAddressSubForm } from '../NewAddressSubForm'\nimport { Title } from '../../../../components/Item'\n\ntype DetailAddressProps = {\n initialAddress: addressModel.Model\n reason?: string\n schema: any\n errors: formik.FormikErrors\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n countryFilter: string[]\n onCancel: () => void\n onSubmit: (address: addressModel.Model) => Promise\n hideState?: boolean\n}\n\nexport function DetailAddress({\n initialAddress,\n reason,\n schema,\n errors,\n allowCountrySelection,\n disableCountry,\n phoneRequired,\n countryFilter,\n onCancel,\n onSubmit,\n hideState,\n}: DetailAddressProps) {\n const mode = initialAddress.id === undefined ? 'create' : 'edit'\n\n const defaultPhoneCountry =\n env.COUNTRIES.find((country) => country.code === countryFilter[0]) ||\n env.COUNTRIES.find((country) => country.code === env.USER_COUNTRY) ||\n env.COUNTRIES[0]\n\n const isInitialEmpty =\n initialAddress === undefined ||\n initialAddress.address1 === '' ||\n initialAddress.city === '' ||\n initialAddress.postal_code === '' ||\n initialAddress.city === ''\n\n const [found, setFound] = React.useState(!isInitialEmpty)\n\n const wrapperRef = React.useRef(null)\n\n return (\n \n {mode === 'create' ? t('Add a new address') : t('Edit an address')}\n\n {reason && {reason}}\n\n \n {(formikBag) => {\n React.useEffect(() => {\n if (wrapperRef.current !== null && !formikBag.isValid) {\n wrapperRef.current.scrollIntoView()\n }\n }, [formikBag.submitCount, formikBag.isValid])\n\n return (\n
\n formikBag.setValues(address)}\n onFound={() => setFound(true)}\n phoneRequired={phoneRequired}\n touched={formikBag.touched}\n value={formikBag.values}\n />\n\n \n {!found ? t('Awaiting address') : t('Save')}\n \n\n \n \n {t('Back')}\n \n \n \n )\n }}\n \n
\n )\n}\n\nconst Wrapper = styled.div`\n ${plume.styles.button.Button} {\n width: 100%;\n margin: 30px 0 18px;\n }\n\n ${plume.styles.copy.S.regular} {\n display: block;\n text-align: center;\n margin: 18px 0 20px;\n }\n\n ${plume.Callout} {\n p {\n margin: 0;\n padding: 0;\n text-align: left;\n }\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { type Address } from '@owl-nest/api-client/latest'\nimport { t } from '@owl-nest/localize'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport {\n COLORS,\n Field,\n glyphs,\n Link,\n RadioField,\n RadioGroupField,\n styles as S,\n //@ts-ignore\n} from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nconst Wrapper = styled.div`\n ${Link} {\n margin: 10px 0 25px;\n }\n\n ${RadioField} {\n ${S.field.Title} {\n white-space: pre;\n }\n\n ${S.input.HiddenFocusableInput}:checked + ${Field} {\n ${S.field.Title} {\n color: ${COLORS.TEXT_PRIMARY};\n }\n }\n }\n\n ${RadioGroupField} {\n margin: 20px 0 10px;\n }\n`\n\nconst Actions = styled(S.copy.S.regular)`\n display: flex;\n flex-direction: row;\n\n ${Link} {\n margin: 0 6px;\n }\n`\n\nconst RadioWrapper = styled.div`\n position: relative;\n\n ${Actions} {\n position: absolute;\n z-index: 1;\n bottom: 10px;\n right: 8px;\n }\n`\n\ntype ExistingAddressSubFormProps = {\n addresses: Address<'has_shippings'>[]\n selectedAddress: addressModel.Model\n onChange: (model: addressModel.Model) => void\n onCreate: () => void\n onEdit: (address: Address<'has_shippings'>) => void\n onRemove: (address: Address<'has_shippings'>) => void\n}\n\nexport function ExistingAddressSubForm({\n addresses,\n selectedAddress,\n onChange,\n onCreate,\n onEdit,\n onRemove,\n}: ExistingAddressSubFormProps): React.ReactElement {\n const countries = env.COUNTRIES\n return (\n \n \n {addresses.map((address, index) => {\n const model = address\n return (\n \n {\n onChange(model)\n }}\n />\n \n onEdit(address)}>\n {t('Edit')}\n \n onRemove(address)}>\n {t('Delete')}\n \n \n \n )\n })}\n \n \n \n {t('Add a new address')}\n \n \n \n )\n}\n","import * as React from 'react'\nimport * as formik from 'formik'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as yup from '@owl-nest/validators'\nimport * as services from '@owl-nest/services'\nimport * as env from '@owl-nest/config'\n\nimport { ExistingAddressSubForm } from '../ExistingAddressSubForm'\nimport { NewAddressSubForm } from '../NewAddressSubForm'\nimport { Title } from '../../../../components/Item'\n\ntype ListAddressProps = {\n addresses: api.Address<'has_shippings'>[]\n toDetail(options: {\n target: 'primary' | 'secondary'\n primary?: addressModel.Model\n secondary?: addressModel.Model\n errors?: formik.FormikErrors\n reason?: string\n }): void\n callout?: React.ReactNode\n onRemove: (address: api.Address<'has_shippings'>) => void\n emptyAddress: () => addressModel.Model\n onSubmit: (value: {\n primary: addressModel.Model\n secondary?: addressModel.Model\n ignoreSecondary: boolean\n }) => Promise\n} & (\n | {\n primary: {\n title: string\n initialAddress: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n countryFilter: string[]\n schema: any\n }\n secondary?: undefined\n }\n | {\n primary: {\n title: string\n initialAddress: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n countryFilter: string[]\n schema: any\n }\n secondary: {\n checkbox: { label: React.ReactNode; description?: React.ReactNode }\n title: string\n initialAddress: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n schema: any\n }\n }\n)\n\nexport function ListAddress({\n toDetail,\n emptyAddress,\n addresses,\n callout,\n onRemove,\n onSubmit,\n primary,\n secondary,\n}: ListAddressProps) {\n const wrapperRef = React.useRef(null)\n\n const defaultPhoneCountry =\n env.COUNTRIES.find((country) => country.code === primary.countryFilter[0]) ||\n env.COUNTRIES.find((country) => country.code === env.USER_COUNTRY) ||\n env.COUNTRIES[0]\n\n const primaryFilteredAddresses = services.user.address.filter(addresses, primary.countryFilter)\n\n const isPrimaryEmpty = primaryFilteredAddresses.length === 0\n const isSecondaryEmpty = addresses.length === 0\n\n const [found, setFound] = React.useState(primary.initialAddress?.id !== undefined)\n\n return (\n // The key on the is used to force unmount/remount if\n // initialAddress changes.\n //\n // There is a `enableReinitialize` that provide this functionality\n // (reinitialize the form if `initialValues` changes), but with a caveat :\n // the first render will have the old `initialValues` and then a rerender\n // will be triggered with the new `initalValues` and the form cleard. The\n // issue comes from the `PhoneInput` that uses an uncontrolled input with\n // `defaultValue`. So the first value passed when mounting the component\n // will be displayed until the user interact with the input.\n //\n // In our case, the first value passed comes from the old `initialValues`\n // that contain stale informations. This stale information is displayed on\n // the phone input and is not updated when formik rerenders with the fresh\n // information.\n //\n // We use our own ghetto reinitialisation with the `key` that will change if\n // the address changes, forcing a remount of the `` with updated\n // `initialValues`. The first render will be done with the fresh\n // `initialValues` and the phone number will display fresh information.\n \n {\n onSubmit({ primary: values.primary, secondary: values.secondary, ignoreSecondary: values.ignoreSecondary })\n }}\n validationSchema={yup.lazy((value) =>\n yup.object({\n primary: primary.schema,\n secondary: value.ignoreSecondary ? yup.mixed() : secondary?.schema,\n ignoreSecondary: yup.mixed(),\n }),\n )}\n >\n {(formikBag) => {\n // if there were some validation errors after selecting an address in\n // list mode, switch to detail view to fix the errors\n React.useEffect(() => {\n if (!isPrimaryEmpty && Object.keys(formikBag.errors.primary ?? {}).length !== 0) {\n toDetail({\n target: 'primary',\n primary: formikBag.values.primary,\n secondary: formikBag.values.secondary,\n errors: formikBag.errors.primary,\n reason:\n formikBag.errors?.primary?.phone_number !== undefined\n ? t('Your phone number is missing and necessary for the delivery of the rewards of this project')\n : t('Some fields are missing from this address'),\n })\n\n return\n }\n }, [formikBag.submitCount, formikBag.isSubmitting])\n\n React.useEffect(() => {\n if (wrapperRef.current !== null && !formikBag.isValid) {\n wrapperRef.current.scrollIntoView()\n }\n }, [formikBag.submitCount, formikBag.isValid])\n\n return (\n
\n {primary.title}\n\n {callout && {callout}}\n\n {isPrimaryEmpty ? (\n setFound(true)}\n onChange={(address) => formikBag.setFieldValue('primary', address)}\n />\n ) : (\n {\n formikBag.setFieldValue('primary', address)\n setFound(true)\n }}\n onCreate={() =>\n toDetail({\n target: 'primary',\n secondary: formikBag.values.secondary,\n })\n }\n onEdit={(address) =>\n toDetail({\n target: 'primary',\n primary: address,\n secondary: formikBag.values.secondary,\n })\n }\n onRemove={onRemove}\n />\n )}\n\n {secondary && (\n <>\n ) => {\n formikBag.setFieldValue('ignoreSecondary', evt.target.checked)\n }}\n disabled={!found}\n />\n\n {!formikBag.values.ignoreSecondary && (\n <>\n {secondary.title}\n {isSecondaryEmpty ? (\n {}}\n onChange={(address) => formikBag.setFieldValue('secondary', address)}\n />\n ) : (\n {\n formikBag.setFieldValue('secondary', address)\n }}\n onCreate={() =>\n toDetail({\n target: 'secondary',\n primary: formikBag.values.primary,\n })\n }\n onEdit={(address) =>\n toDetail({\n target: 'secondary',\n secondary: address,\n primary: formikBag.values.primary,\n })\n }\n onRemove={onRemove}\n />\n )}\n \n )}\n \n )}\n\n \n {!found ? t('Awaiting address') : t('Continue')}\n \n \n )\n }}\n \n
\n )\n}\n\nconst Center = styled.div`\n text-align: center;\n`\n\nconst Wrapper = styled.div`\n ${plume.Callout} {\n margin: 20px 0 25px;\n }\n\n ${plume.CheckboxField} {\n margin: 28px 0 22px;\n }\n\n ${plume.styles.button.Button} {\n width: 100%;\n }\n\n ${Title}:not(:first-child) {\n margin: 30px 0 16px;\n }\n\n ${Center} {\n margin: 20px 0 0;\n }\n`\n","import * as React from 'react'\nimport * as formik from 'formik'\n\nimport * as services from '@owl-nest/services'\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\n\nimport { DetailAddress } from './DetailAddress'\nimport { ListAddress } from './ListAddress'\nimport { Either } from '@owl-nest/monad'\n\ntype AddressManagerProps = {\n userId: number\n addresses: api.Address<'has_shippings'>[]\n onRemove: (address: Omit & { id: number }) => void\n callout?: React.ReactNode\n emptyAddress: () => addressModel.Model\n} & (\n | {\n onChange: (value: { primary: Omit & { id: number }; secondary?: undefined }) => void\n primary: {\n title: string\n address?: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n countryFilter: string[]\n schema: any\n }\n secondary?: undefined\n }\n | {\n onChange: (value: {\n primary: Omit & { id: number }\n secondary?: Omit & { id: number }\n }) => void\n primary: {\n title: string\n address?: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n countryFilter: string[]\n schema: any\n }\n secondary: {\n title: string\n checkbox: { label: React.ReactNode; description?: React.ReactNode }\n address?: addressModel.Model\n allowCountrySelection?: boolean\n disableCountry?: boolean\n phoneRequired: boolean\n schema: any\n countryFilter?: undefined\n }\n }\n)\n\nexport function AddressManager({ userId, addresses, onRemove, callout, emptyAddress, ...rest }: AddressManagerProps) {\n const userAddressService = services.user.address.useAddress(userId, {\n extraFields: ['has_shippings'],\n fetchOnMount: false,\n })\n\n const primaryFilteredAddresses = services.user.address.filter(addresses, rest.primary.countryFilter)\n\n const [state, setState] = React.useState<\n {\n primary: addressModel.Model\n secondary: addressModel.Model\n errors?: formik.FormikErrors\n reason?: string\n } & ({ mode: 'list'; target?: undefined } | { mode: 'detail'; target: 'primary' | 'secondary' })\n >({\n mode: 'list',\n primary:\n rest.primary.address === undefined && primaryFilteredAddresses.length === 1\n ? primaryFilteredAddresses[0]\n : (rest.primary.address ?? emptyAddress()),\n secondary:\n rest.secondary?.address === undefined && addresses.length === 1\n ? addresses[0]\n : (rest.secondary?.address ?? emptyAddress()),\n errors: {},\n reason: undefined,\n })\n\n if (state.mode === 'detail') {\n const countryFilter = rest[state.target]?.countryFilter ?? []\n const address = state[state.target]\n const target = state.target\n return (\n {\n setState((state) => ({\n ...state,\n errors: {},\n reason: undefined,\n mode: 'list',\n target: undefined,\n }))\n }}\n onSubmit={async (address) => {\n if (address.id === undefined) {\n const result = await userAddressService.create(addressModel.address(address))\n result?.next((address) => {\n if (target === 'primary') {\n rest.onChange({ primary: address })\n } else {\n setState((state) => {\n return {\n ...state,\n errors: {},\n reason: undefined,\n mode: 'list',\n target: undefined,\n secondary: address,\n }\n })\n }\n })\n } else {\n const result = await userAddressService.update(address.id, addressModel.address(address))\n result?.next(({ addresses }) => {\n const updatedAddress = addresses.find((updatedAddress) => updatedAddress.id === address.id)\n\n if (!updatedAddress) {\n return\n }\n\n if (target === 'primary') {\n rest.onChange({ primary: updatedAddress })\n } else {\n setState((state) => {\n return {\n ...state,\n errors: {},\n reason: undefined,\n mode: 'list',\n target: undefined,\n secondary: updatedAddress,\n }\n })\n }\n })\n }\n }}\n />\n )\n }\n\n return (\n \n setState((state) => {\n return {\n ...state,\n mode: 'detail',\n target,\n primary: primary ?? state.primary,\n secondary: secondary ?? state.secondary,\n [target]: (target === 'primary' ? primary : secondary) ?? emptyAddress(),\n errors,\n reason,\n }\n })\n }\n onRemove={async (address) => {\n onRemove(address)\n const result = await userAddressService.remove(address.id)\n result?.next(({ addresses }) => {\n const primaryFilteredAddresses = services.user.address.filter(addresses, rest.primary.countryFilter)\n\n setState((state) => {\n return {\n ...state,\n primary:\n primaryFilteredAddresses.length === 0 || state.primary.id === address.id\n ? emptyAddress()\n : state.primary,\n secondary: addresses.length === 0 || state.secondary.id === address.id ? emptyAddress() : state.secondary,\n }\n })\n })\n }}\n emptyAddress={emptyAddress}\n callout={callout}\n primary={{\n title: rest.primary.title,\n initialAddress: state.primary,\n allowCountrySelection: rest.primary.allowCountrySelection,\n disableCountry: rest.primary.disableCountry,\n phoneRequired: rest.primary.phoneRequired,\n countryFilter: rest.primary.countryFilter,\n schema: rest.primary.schema,\n }}\n secondary={\n rest.secondary\n ? {\n title: rest.secondary.title,\n initialAddress: state.secondary,\n allowCountrySelection: rest.secondary.allowCountrySelection,\n disableCountry: rest.secondary.disableCountry,\n phoneRequired: rest.secondary.phoneRequired,\n schema: rest.secondary.schema,\n checkbox: rest.secondary.checkbox,\n }\n : undefined\n }\n onSubmit={async (value) => {\n if (rest.secondary === undefined || value.ignoreSecondary) {\n if (value.primary.id === undefined) {\n const result = await userAddressService.create(addressModel.address(value.primary))\n result?.next((address) => rest.onChange({ primary: address }))\n } else {\n rest.onChange({ primary: value.primary as Omit & { id: number } })\n }\n } else {\n const result = await (\n await Either.right(undefined).nextAsync(async () => {\n if (value.primary.id === undefined) {\n return await userAddressService.create(addressModel.address(value.primary))\n }\n return value.primary as Omit & { id: number }\n })\n ).nextAsync(async (primary) => {\n if (value.secondary === undefined) {\n return { primary }\n }\n if (value.secondary.id === undefined) {\n return (await userAddressService.create(addressModel.address(value.secondary)))?.next((secondary) => ({\n primary,\n secondary,\n }))\n }\n return {\n primary,\n secondary: value.secondary as Omit & { id: number },\n }\n })\n\n result?.next((content) => {\n rest.onChange({\n primary: content?.primary as Omit & { id: number },\n secondary: content?.secondary as Omit & { id: number },\n })\n })\n }\n }}\n />\n )\n}\n","import * as React from 'react'\n\nimport * as services from '@owl-nest/services'\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\n\nimport { AddressManager } from './components/AddressManager'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { Item } from '../../components/Item'\n\ntype PickupAddressItemProps = {\n user: api.AuthenticatedUser\n countryFilter: string[]\n onContinue: () => void\n}\n\nexport const PickupAddressItem = React.forwardRef(function PickupAddressItem(\n { user, countryFilter, onContinue },\n ref,\n) {\n const userAddressService = services.user.address.useAddress(user.id, {\n extraFields: ['has_shippings'],\n fetchOnMount: true,\n })\n\n const userAddresses = userAddressService.response.data?.addresses ?? []\n const addresses = services.user.address.filter(userAddresses, countryFilter)\n\n const cart = useCart()\n\n const selectedAddressInCart = addresses.find(\n (address) => address.id === (cart.addressType === 'shipping' && cart.billingAddress),\n )\n const selectedAddress: addressModel.Model =\n selectedAddressInCart === undefined ? emptyAddress() : selectedAddressInCart\n\n return (\n \n {userAddressService.response.data === undefined ? (\n \n ) : (\n {\n cart.setAddress({ billing: primary.id })\n onContinue()\n }}\n onRemove={(address) => {\n if (\n (cart.addressType === 'shipping' && cart.billingAddress === address.id) ||\n (cart.addressType === 'contact' && cart.contactAddress === address.id)\n ) {\n cart.setAddress({ billing: undefined })\n }\n }}\n primary={{\n title: t('Billing'),\n countryFilter: countryFilter,\n address: selectedAddress,\n allowCountrySelection: false,\n disableCountry: false,\n phoneRequired: true,\n schema: addressModel.schema(true),\n }}\n />\n )}\n \n )\n\n function emptyAddress() {\n return {\n ...addressModel.empty(),\n first_name: user.first_name ?? '',\n last_name: user.last_name ?? '',\n }\n }\n})\n","import * as React from 'react'\n\nimport * as services from '@owl-nest/services'\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\n\nimport { AddressManager } from './components/AddressManager'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { Item } from '../../components/Item'\n\ntype DropoffAddressItemProps = {\n user: api.AuthenticatedUser\n countryFilter: string[]\n onContinue: () => void\n}\n\nexport const DropoffAddressItem = React.forwardRef(function DropoffAddressItem(\n { user, countryFilter, onContinue },\n ref,\n) {\n const userAddressService = services.user.address.useAddress(user.id, {\n extraFields: ['has_shippings'],\n fetchOnMount: true,\n })\n\n const userAddresses = userAddressService.response.data?.addresses ?? []\n const addresses = services.user.address.filter(userAddresses, countryFilter)\n\n const cart = useCart()\n\n const selectedAddressInCart = addresses.find(\n (address) => address.id === (cart.addressType === 'shipping' && cart.billingAddress),\n )\n const selectedAddress: addressModel.Model =\n selectedAddressInCart === undefined ? emptyAddress() : selectedAddressInCart\n\n return (\n \n {userAddressService.response.data === undefined ? (\n \n ) : (\n {\n if (\n (cart.addressType === 'shipping' && cart.billingAddress === address.id) ||\n (cart.addressType === 'contact' && cart.contactAddress === address.id)\n ) {\n cart.setAddress({ billing: undefined })\n }\n }}\n onChange={({ primary }) => {\n cart.setAddress({ billing: primary.id })\n onContinue()\n }}\n primary={{\n title: t('Billing'),\n countryFilter: countryFilter,\n address: selectedAddress,\n allowCountrySelection: false,\n disableCountry: false,\n phoneRequired: false,\n schema: addressModel.schema(false),\n }}\n />\n )}\n \n )\n\n function emptyAddress() {\n return {\n ...addressModel.empty(),\n first_name:\n cart.addressType === 'shipping' && cart.selectedMondialRelay?.firstName\n ? cart.selectedMondialRelay?.firstName\n : (user.first_name ?? ''),\n last_name:\n cart.addressType === 'shipping' && cart.selectedMondialRelay?.lastName\n ? cart.selectedMondialRelay?.lastName\n : (user.last_name ?? ''),\n }\n }\n})\n","import * as React from 'react'\n\nimport * as services from '@owl-nest/services'\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\n\nimport { AddressManager } from './components/AddressManager'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { Item } from '../../components/Item'\nimport { useProject } from '../../hooks/useProject'\n\ntype ContactAddressItemProps = {\n user: api.AuthenticatedUser\n countryFilter: string[]\n onContinue: () => void\n phoneRequired: boolean\n}\n\nexport const ContactAddressItem = React.forwardRef(function ContactAddressItem(\n { user, countryFilter, onContinue, phoneRequired },\n ref,\n) {\n const userAddressService = services.user.address.useAddress(user.id, {\n extraFields: ['has_shippings'],\n fetchOnMount: true,\n })\n\n const userAddresses = userAddressService.response.data?.addresses ?? []\n const addresses = services.user.address.filter(userAddresses, countryFilter)\n\n const cart = useCart()\n const { project } = useProject()\n\n const selectedAddressInCart = addresses.find(\n (address) => address.id === (cart.addressType === 'shipping' && cart.billingAddress),\n )\n const selectedAddress: addressModel.Model =\n selectedAddressInCart === undefined ? emptyAddress() : selectedAddressInCart\n\n return (\n \n {userAddressService.response.data === undefined ? (\n \n ) : (\n {\n if (\n (cart.addressType === 'shipping' && cart.billingAddress === address.id) ||\n (cart.addressType === 'contact' && cart.contactAddress === address.id)\n ) {\n cart.setAddress({ billing: undefined })\n }\n }}\n onChange={({ primary }) => {\n cart.setAddress({ billing: primary.id })\n onContinue()\n }}\n primary={{\n title: t('Contact details'),\n countryFilter: countryFilter,\n address: selectedAddress,\n allowCountrySelection: false,\n disableCountry: false,\n phoneRequired: phoneRequired,\n schema: addressModel.schema(phoneRequired),\n }}\n />\n )}\n \n )\n\n function emptyAddress() {\n return {\n ...addressModel.empty(),\n first_name: user.first_name ?? '',\n last_name: user.last_name ?? '',\n }\n }\n})\n","import * as React from 'react'\n\nimport * as services from '@owl-nest/services'\nimport * as api from '@owl-nest/api-client/next'\nimport * as addressModel from '@owl-nest/address/src/model'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport { parse, format } from '@owl-nest/date'\n\nimport { AddressManager } from './components/AddressManager'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { Item } from '../../components/Item'\n\ntype HomeDeliveryAddressItemProps = {\n user: api.AuthenticatedUser\n countryFilter: string[]\n phoneRequired: boolean\n onContinue: () => void\n}\n\nexport const HomeDeliveryAddressItem = React.forwardRef(\n function HomeDeliveryAddressItem({ user, countryFilter, onContinue, phoneRequired }, ref) {\n const userAddressService = services.user.address.useAddress(user.id, {\n extraFields: ['has_shippings'],\n fetchOnMount: true,\n })\n\n const addresses = userAddressService.response.data?.addresses ?? []\n\n const cart = useCart()\n\n const selectedShippingAddress = addresses.find(\n (address) => address.id === (cart.addressType === 'shipping' && cart.shippingAddress),\n )\n const selectedBilingAddress = addresses.find(\n (address) => address.id === (cart.addressType === 'shipping' && cart.billingAddress),\n )\n\n return (\n \n {userAddressService.response.data === undefined ? (\n \n ) : (\n {\n if (\n (cart.addressType === 'shipping' && cart.billingAddress === address.id) ||\n (cart.addressType === 'contact' && cart.contactAddress === address.id)\n ) {\n cart.setAddress({ billing: undefined })\n }\n }}\n onChange={(value: any) => {\n const delivery = value.primary.id\n const billing =\n value.secondary === undefined\n ? cart.addressType === 'shipping' && cart.billingAddressRequired\n ? delivery\n : undefined\n : value.secondary.id\n cart.setAddress({ delivery, billing })\n onContinue()\n }}\n callout={\n cart.addressType === 'shipping' &&\n t('Estimated delivery date for rewards: %(delivery_dates)s. You can edit your home address later.', {\n delivery_dates: cart.deliveryDates.map(formatDeliveryDate).join(', '),\n })\n }\n primary={{\n title: t('Home delivery'),\n countryFilter: countryFilter,\n address: selectedShippingAddress,\n allowCountrySelection: true,\n disableCountry: true,\n phoneRequired: phoneRequired,\n schema: addressModel.schema(phoneRequired),\n }}\n secondary={{\n title: t('Billing'),\n checkbox: {\n label: t('My billing address is the same as my delivery address'),\n description:\n cart.addressType === 'shipping' &&\n cart.isTax &&\n t('The billing address is used for the tax receipt.'),\n },\n address: selectedBilingAddress,\n allowCountrySelection: false,\n disableCountry: false,\n phoneRequired: false,\n schema: addressModel.schema(false),\n }}\n />\n )}\n \n )\n\n function emptyAddress() {\n return {\n ...addressModel.empty(),\n first_name: user.first_name ?? '',\n last_name: user.last_name ?? '',\n }\n }\n },\n)\n\nfunction formatDeliveryDate(deliveryDate: string): string {\n return format(parse(deliveryDate, 'yyyy-MM', new Date()), 'MMMM yyyy')\n}\n","import * as React from 'react'\n\nimport { t } from '@owl-nest/localize'\nimport { Spinner } from '@ulule/owl-kit-components/next'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as models from '@owl-nest/models'\n\nimport { useScrollToAnonymous } from '../../hooks/useScrollToAnonymous'\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\nimport { FutureItem } from '../../components/FutureItem'\nimport { IdentityItem } from '../../components/IdentityItem'\nimport { Item } from '../../components/Item'\nimport { CartSummary } from '../../components/selection'\nimport { MondialRelayItem, PickupItem } from '../../components/ShippingItem'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { PickupAddressItem } from './PickupAddressItem'\nimport { DropoffAddressItem } from './DropoffAddressItem'\nimport { ContactAddressItem } from './ContactAddressItem'\nimport { HomeDeliveryAddressItem } from './HomeDeliveryAddress'\nimport { useProject } from '../../hooks/useProject'\n\nexport function AddressView(): React.ReactElement | null {\n const navigation = useNavigation()\n const cart = useCart()\n const { project } = useProject()\n\n const countryFilter: string[] =\n cart.addressType === 'shipping' && cart.selectedShippingMode === 'home_delivery' && cart.selectedCountry\n ? [cart.selectedCountry?.code]\n : []\n const phoneRequired =\n ((cart.addressType === 'shipping' && cart.selectedShippingMode !== 'mondial_relay') ||\n cart.addressType === 'contact') &&\n cart.needPhone\n\n const auth = services.user.useAuth()\n\n // True when the user has already provided shipping info on a previous visit to this step.\n // Determines whether to scroll to the shipping summary or to the anonymous toggle on load.\n const hasFilledShipping = Boolean(\n cart.addressType === 'shipping' &&\n (cart.selectedShippingMode === 'pickup_point' ||\n cart.billingAddress ||\n cart.shippingAddress ||\n cart.selectedMondialRelay),\n )\n const { shippingsBoxRef, anonymousBoxRef } = useScrollToAnonymous(hasFilledShipping, cart.isLoading)\n\n const tracking = shadow.useTracking()\n\n return (\n <>\n navigation.navigate(PAGES.SELECTION, { forceStep: true }),\n text: t('Edit'),\n }}\n >\n \n \n\n \n\n {cart.addressType === 'shipping' && cart.selectedShippingMode === 'pickup_point' && (\n navigation.navigate(PAGES.ADDRESS)}\n goToDelivery={() => navigation.navigate(PAGES.PICKUP)}\n />\n )}\n\n {cart.addressType === 'shipping' && cart.selectedShippingMode === 'mondial_relay' && (\n navigation.navigate(PAGES.ADDRESS)}\n goToDelivery={() => navigation.navigate(PAGES.MONDIAL_RELAY)}\n />\n )}\n\n {auth.type !== 'loggedin' || cart.addressType === undefined ? (\n \n \n \n ) : cart.addressType === 'shipping' && cart.selectedShippingMode === 'pickup_point' ? (\n \n ) : cart.addressType === 'shipping' && cart.selectedShippingMode === 'mondial_relay' ? (\n \n ) : cart.addressType === 'shipping' && cart.selectedShippingMode === 'home_delivery' ? (\n \n ) : cart.addressType === 'contact' ? (\n \n ) : (\n <>\n )}\n\n \n \n )\n\n function handleContinue() {\n // track only home_delivery. Mondial relay and pickyp are\n // tracked in there respective steps.\n if (cart.addressType === 'shipping' && cart.selectedShippingMode === 'home_delivery') {\n tracking.ecommerce.track('add_shipping_info', {\n value: cart.subTotal,\n currency: project.currency,\n shipping_tier: 'home_delivery',\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n }\n\n navigation.navigate(navigation.nextLegalPage)\n }\n}\n","import * as React from 'react'\nimport { styled, css, YakThemeProvider } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { MembershipDefaultBanner } from '@ulule/duvet/MembershipDefaultBanner.tsx'\nimport * as env from '@owl-nest/config'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as models from '@owl-nest/models'\n\ntype MembershipHeroProps = {\n project: api.Project\n}\n\ntype Theme = {\n colors: {\n accent: string\n background: string\n hover: string\n primary: string\n }\n}\n\nexport function MembershipHero({ project }: MembershipHeroProps): React.ReactElement {\n const mainImage = models.project.mainImage(project, 'full')\n\n const projectColor = models.project.backgroundColor(project) ?? plume.COLORS.COMPLEMENTARY_INDIGO\n const theme: Theme = {\n colors: {\n accent: `color-mix(in srgb, ${projectColor} 20%, white)`,\n background: `color-mix(in srgb, ${projectColor} 10%, white)`,\n hover: `color-mix(in srgb, ${projectColor} 70%, black)`,\n primary: projectColor,\n },\n }\n const userConfig = env.useUserEnv()\n\n return (\n \n \n \n \n \n {models.project.name(project)}\n \n \n \n \n \n )\n}\n\nconst Banner = styled.div<{ $backgroundImage?: string }>`\n height: 166px;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ${plume.ZINDEX.NEUTRAL};\n\n ${({ $backgroundImage, theme }) => {\n if ($backgroundImage) {\n return css`\n background-image: ${() => `url('${$backgroundImage}')`};\n background-position: center;\n background-size: cover;\n\n ${plume.styles.heading.Base} {\n color: ${plume.COLORS.PRIMARY_GREY_000};\n }\n\n &::before {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 120%);\n content: '';\n display: block;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n }\n `\n } else {\n return css`\n background-image: ${() => `url('${plume.utils.svg.toDataUrl(MembershipDefaultBanner, { theme })}')`};\n `\n }\n }};\n`\n\nconst Wrapper = styled.div`\n background-position: center;\n background-size: cover;\n overflow: hidden;\n position: relative;\n width: 100%;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n height: 166px;\n }\n`\n\nconst User = styled.div`\n position: relative;\n z-index: ${plume.ZINDEX.ABOVE};\n display: flex;\n align-items: center;\n width: fit-content;\n margin: auto;\n padding: 24px 0;\n\n ${plume.Link} {\n display: flex;\n align-items: center;\n height: fit-content;\n }\n\n ${plume.styles.image.Avatar} {\n margin-right: 15px;\n }\n\n ${plume.styles.heading.XXXS} {\n color: ${plume.COLORS.PRIMARY_GREY_000};\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n height: 100%;\n padding: 0;\n }\n`\n","import React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nexport function ProgressBar({ percent }: { percent: number }) {\n return \n}\n\nexport const ProgressBarStyled = styled.div<{ $percent: number }>`\n height: 3px;\n width: 100%;\n background-color: ${plume.COLORS.PRIMARY_SAND_200};\n position: fixed;\n top: 57px;\n left: 0px;\n z-index: 5;\n\n &::after {\n content: '';\n display: block;\n width: ${(props) => props.$percent}%;\n height: 3px;\n background-color: ${plume.COLORS.PRIMARY_BLUE_500};\n transition: 0.3s ease;\n }\n`\n","import * as React from 'react'\nimport { css, styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as model from '@owl-nest/models'\nimport { usePartnershipTracker } from '@owl-nest/shadow'\nimport { BREAKPOINTS, COLORS, Link, styles as S } from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport { CenterWrapper } from '../style'\nimport { type CheckoutExtraFields } from '../hooks/useProject'\n\ntype TitleProps = {\n project: api.Project\n}\n\nexport function Title({ project }: TitleProps): React.ReactElement {\n const ribbonRef = React.useRef(null)\n const userConfig = env.useUserEnv()\n const userLocale = userConfig.lang\n const owner = project.owner\n const projectHasBackgroundImage = Boolean(project.background_image?.[userLocale]?.url)\n const ribbon = project.partnerships && model.project.getRibbonData(project)\n\n usePartnershipTracker(ribbon?.partnerOwnerId, ribbonRef, {\n click: {\n enabled: false,\n },\n impression: {\n enabled: true,\n once: true,\n },\n })\n\n return (\n <>\n {owner && project && (\n \n {ribbon && }\n \n \n \n {model.project.name(project)}\n \n \n \n \n {model.user.username(project.owner)}\n \n \n \n )}\n \n )\n}\n\nconst TitleWrapper = styled.div<{ $backgroundColor?: string; $backgroundImage?: string }>`\n padding-top: 25px;\n padding-bottom: 25px;\n ${(props) => {\n return (\n props.$backgroundImage &&\n css`\n background-image: ${() => `url(\"${props.$backgroundImage}\")`};\n `\n )\n }}\n ${(props) => {\n return (\n props.$backgroundColor &&\n css`\n background-color: ${() => props.$backgroundColor};\n `\n )\n }}\n background-size: cover;\n background-position: center;\n position: relative;\n\n ${S.heading.XXXS} {\n color: ${(props) => (props.$backgroundImage ? COLORS.PRIMARY_GREY_000 : COLORS.TEXT_PRIMARY)};\n }\n\n ${S.heading.S} {\n text-align: center;\n }\n\n &::before {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 120%);\n content: '';\n display: ${(props) => (props.$backgroundImage ? 'block' : 'none')};\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n }\n\n @media screen and ${BREAKPOINTS.TABLET} {\n height: 215px;\n margin-bottom: -126px;\n padding-top: 30px;\n position: relative;\n padding-bottom: 0px;\n\n &::before {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);\n }\n }\n`\n\nconst Content = styled(CenterWrapper)`\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n`\n\nconst Owner = styled.div`\n display: flex;\n align-items: center;\n margin-top: 7px;\n`\n\nconst OwnerLogo = styled(S.image.Avatar)`\n margin-right: 10px;\n`\n\nconst PartnershipBanner = styled.img`\n position: absolute;\n right: 0;\n top: 0;\n width: 120px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { BREAKPOINTS, COLORS, styles as S } from '@ulule/owl-kit-components/next'\nimport * as models from '@owl-nest/models'\nimport { message } from '@owl-nest/services'\n\nimport { useProject } from '../hooks/useProject'\nimport { MembershipHero } from './MembershipHero'\nimport { ProgressBar } from './ProgressBar'\nimport { Title } from './Title'\n\ntype LayoutProps = {\n children: React.ReactNode\n progress: number\n}\n\nexport function Layout({ children, progress }: LayoutProps): React.ReactElement {\n const { project } = useProject()\n\n const isMembershipProject = models.project.isMembership(project)\n\n const projectColor = models.project.backgroundColor(project) ?? COLORS.COMPLEMENTARY_INDIGO\n\n const theme = models.project.isMembership(project)\n ? {\n colors: {\n primary: projectColor,\n background: `color-mix(in srgb, ${projectColor} 5%, white);`,\n },\n }\n : undefined\n\n return (\n
\n \n \n {isMembershipProject ? : }\n\n <CheckoutStepWrapper $negativeMarginTop={isMembershipProject}>\n <CalloutWrapper>\n <message.Callout contexts={['selection', 'address', 'payment']}>\n <CalloutExtra />\n </message.Callout>\n </CalloutWrapper>\n {children}\n </CheckoutStepWrapper>\n </Main>\n )\n}\n\ntype CalloutExtraProps = { action?: any; message?: any }\n\nfunction CalloutExtra({ action, message }: CalloutExtraProps): React.ReactElement<any> | null {\n if (!message) return null\n\n return (\n <CalloutExtraWrapper>\n <S.copy.M.light>{message}</S.copy.M.light>\n {action && <S.button.CallToAction>{action.label}</S.button.CallToAction>}\n </CalloutExtraWrapper>\n )\n}\n\nconst Main = styled.div<{ theme: any }>`\n padding-bottom: 25px;\n background-color: ${({ theme }) => theme?.colors?.background ?? COLORS.PRIMARY_SAND_100};\n min-height: calc(100vh - 85px);\n`\n\nconst CheckoutStepWrapper = styled.section<{ $negativeMarginTop: boolean }>`\n position: relative;\n\n @media screen and ${BREAKPOINTS.TABLET} {\n margin-top: ${({ $negativeMarginTop }) => {\n return $negativeMarginTop ? '-25px' : '90px'\n }};\n }\n`\n\nconst FixedBanner = styled(message.Banner)``\n\nconst CalloutWrapper = styled.section`\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-bottom: 10px;\n width: 100%;\n\n &:empty {\n display: none;\n }\n\n @media screen and ${BREAKPOINTS.TABLET} {\n width: 590px;\n margin: 0 auto 24px;\n }\n`\n\nconst CalloutExtraWrapper = styled.div`\n background-color: ${COLORS.PRIMARY_GREY_000};\n padding: 10px;\n\n @media screen and ${BREAKPOINTS.MOBILE_M} {\n padding: 20px;\n }\n\n @media screen and ${BREAKPOINTS.TABLET} {\n padding: 25px 33px;\n }\n`\n","import * as React from 'react'\nimport { styled, YakThemeProvider, css } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { t } from '@owl-nest/localize'\nimport * as tip from '@owl-nest/tip'\nimport * as models from '@owl-nest/models'\n\nimport { useNavigation } from '../../hooks/useNavigation'\n\nimport { Item } from '../../components/Item'\nimport { FutureItem } from '../../components/FutureItem'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { useProject } from '../../hooks/useProject'\nimport * as UFE from '../../utils/UFE'\n\ntype DonationViewProps = {\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n}\n\ntype Theme = {\n colors: {\n accent: string\n background: string\n hover: string\n primary: string\n }\n}\n\nexport function DonationView({ preFilledTip }: DonationViewProps): React.ReactElement<DonationViewProps> {\n const navigation = useNavigation()\n const cart = useCart()\n\n const { project } = useProject()\n\n const isDonationBasedProject = models.project.isDonationBased(project)\n const allowedFrequency = models.project.allowedDonationFrequency(project)\n\n const hasContactStep = cart.addressType === 'contact'\n\n const projectColor = models.project.backgroundColor(project) ?? plume.COLORS.COMPLEMENTARY_INDIGO\n const theme: Theme = {\n colors: {\n accent: `color-mix(in srgb, ${projectColor} 20%, white)`,\n background: `color-mix(in srgb, ${projectColor} 10%, white)`,\n hover: `color-mix(in srgb, ${projectColor} 70%, black)`,\n primary: projectColor,\n },\n }\n\n return (\n <>\n <YakThemeProvider theme={models.project.isMembership(project) ? theme : {}}>\n <div className=\"tip-view-tip-component\" data-testid=\"view:donation\">\n {/* // FIXME: when we pass styled component to v6\n we have to refacto tip to include directly the title in it */}\n <Item\n title={\n isDonationBasedProject ? (\n <>\n {allowedFrequency === 'all' ? (\n <span className=\"tip-title-tip-component\">{t('Donate')}</span>\n ) : (\n t('Donate')\n )}\n </>\n ) : (\n t('Support with a donation')\n )\n }\n >\n <tip.Tip\n frequency={cart.tip.frequency}\n handleFormSubmit={(tipForm: { frequency?: string; donation: number; inputValue?: string }) => {\n const newTip =\n tipForm.inputValue !== '' && tipForm.inputValue !== undefined\n ? Number(tipForm.inputValue)\n : tipForm.donation\n cart.setDonation(newTip, tipForm.frequency as any)\n navigation.navigate(navigation.nextLegalPage)\n }}\n isApplePayEnabled={UFE.FLAGS.apple_pay_enabled}\n preFilledTip={preFilledTip}\n project={project}\n withDisclaimer\n withPresets\n callout={\n <>\n {models.project.isMembership(project) ? (\n <Callout type=\"info\">\n {t(\n 'This donation does not give you access to paid posts. If you wish to have access to paid posts, you must subscribe.',\n )}\n </Callout>\n ) : undefined}\n </>\n }\n />\n </Item>\n </div>\n </YakThemeProvider>\n <FutureItem title={t('Log in or sign up')} />\n {hasContactStep && <FutureItem title={t('Contact details')} />}\n <FutureItem title={t('Payment')} />\n {project && <tip.TaxDeductionModal project={project} />}\n </>\n )\n}\n\nconst Callout = styled(plume.Callout)`\n margin-top: 16px;\n\n ${plume.Callout} {\n ${({ theme }) => {\n if ((theme as any)?.colors !== undefined) {\n return css`\n background-color: ${(theme as any)?.colors?.background};\n\n ${plume.glyphs.Icon} {\n color: ${(theme as any)?.colors?.primary};\n }\n `\n }\n }}\n }\n`\n","import * as React from 'react'\n\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport { Spinner } from '@ulule/owl-kit-components/next'\nimport { Connect } from '@owl-nest/connect'\n\nimport { useNavigation, PAGES } from '../../hooks/useNavigation'\nimport { scrollToCurrentItem } from '../../utils/scrollTo'\n\nimport { FutureItem } from '../../components/FutureItem'\nimport { Item } from '../../components/Item'\nimport { CartSummary } from '../../components/selection'\nimport { useCart } from '../../hooks/useCart/useCart'\n\nexport function LoginView(): React.ReactElement<any> {\n const navigation = useNavigation()\n const refLogin = React.useRef(null)\n React.useEffect(() => {\n scrollToCurrentItem(refLogin.current)\n }, [])\n\n const auth = services.user.useAuth()\n\n const cart = useCart()\n const hasPickupStep = cart.addressType === 'shipping' && cart.selectedShippingMode === 'pickup_point'\n\n return (\n <>\n <Item\n title={t('Your selection')}\n action={{\n handler: () => {\n navigation.navigate(PAGES.SELECTION, { forceStep: true })\n },\n text: t('Edit'),\n }}\n >\n <CartSummary />\n </Item>\n <Item ref={refLogin} title={auth.type === 'known' ? t('Welcome back') : t('Log in or sign up')}>\n <React.Suspense fallback={<Spinner />}>\n <Connect />\n </React.Suspense>\n </Item>\n {hasPickupStep && <FutureItem title={t('Pick-up locations')} />}\n {cart.addressType === 'contact' && <FutureItem title={t('Contact details')} />}\n {cart.addressType === 'shipping' && cart.selectedShippingMode === 'home_delivery' && (\n <FutureItem title={t('Home delivery')} />\n )}\n <FutureItem title={t('Payment')} />\n </>\n )\n}\n","import * as React from 'react'\n\nimport { type RequestFailure } from '@owl-nest/api-client'\nimport { type ApiError, type CreateOrder } from '@owl-nest/api-client/latest'\nimport { t, tn } from '@owl-nest/localize'\nimport * as logger from '@owl-nest/logger'\nimport * as hooks from '@owl-nest/hooks'\nimport * as services from '@owl-nest/services'\n\nimport { PAGES, useNavigation } from '../../../hooks/useNavigation'\nimport * as productModel from '../../../models/product'\nimport * as errorUtils from '../../../utils/error'\nimport * as productUtils from '../../../utils/product'\nimport { useProject } from '../../../hooks/useProject'\nimport { useCart } from '../../../hooks/useCart/useCart'\n\ntype OrderUiEffect = {\n messageType?: 'genericError'\n dispatchableMessage?: services.message.CreateAction\n action?: () => void\n}\n\nexport function useOrderError(\n status: hooks.QueryStatus,\n failure?: RequestFailure,\n orderPayload?: Omit<CreateOrder, 'payment_method'>,\n): void {\n const dispatch = services.message.useDispatch()\n const cart = useCart()\n const { project, refreshRewards } = useProject()\n const navigation = useNavigation()\n\n const productsInCart = cart.products\n const preSerializedProducts = React.useMemo(() => productUtils.preSerialize(productsInCart), [productsInCart])\n\n const BASE_ERROR = { context: 'payment', focus: true } as const\n\n React.useEffect(() => {\n if (status !== hooks.QueryStatus.FAILURE) {\n return\n }\n\n // First synchronize the rewards, then calculate and apply the UI effects.\n refreshRewards().then(() => {\n const effects = buildOrderEffects()\n\n for (const effect of effects) {\n if (effect.messageType === 'genericError') {\n dispatch(\n services.message.error(\n t(\n 'Oops... An error has occurred while processing your order. Please check your selection before trying again',\n ),\n { ...BASE_ERROR },\n ),\n )\n } else {\n if (effect.dispatchableMessage) {\n dispatch(effect.dispatchableMessage)\n }\n if (effect.action) {\n effect.action()\n }\n }\n }\n })\n }, [status])\n\n function buildOrderEffects(): OrderUiEffect[] {\n const apiErrorBody = failure?.body as ApiError | { message: string } | undefined\n const effects: OrderUiEffect[] = []\n\n const [_, limitedProducts, expiredProducts] = productUtils.getProductsFromSavedIds(preSerializedProducts, project)\n\n // Quantity unavailable\n if (limitedProducts.length > 0) {\n effects.push({\n dispatchableMessage: services.message.error(\n t('Unavailable quantity'),\n errorUtils.unavailableQuantityError('selection', limitedProducts),\n ),\n action: () => {\n cart.setProducts(\n limitedProducts.map((p) => ({\n id: p.id,\n quantity: productModel.stock(p).available ?? 0,\n })),\n { createIfNotFound: true },\n )\n navigation.navigate(PAGES.SELECTION, { replace: true })\n },\n })\n }\n\n // All expired (and no tip)\n if (expiredProducts.length === preSerializedProducts.length && cart.tip.amount === 0) {\n const errorMessage = errorUtils.allSelectedProductsAreExpiredError('selection', productsInCart.length)\n effects.push({\n dispatchableMessage: services.message.error(errorMessage.message, { ...errorMessage }),\n action: () => {\n cart.resetProducts()\n navigation.navigate(PAGES.SELECTION, { replace: true })\n },\n })\n }\n\n // \"ValueError\" errors from the API\n try {\n const apiErrors = Array.isArray(apiErrorBody) ? apiErrorBody : []\n const valueErrors = apiErrors.filter(\n (error: { classification: string }) => error?.classification === 'ValueError',\n )\n\n if (valueErrors.length > 0) {\n const hasShipping =\n valueErrors.some((error: { fieldNames: string[] }) =>\n error?.fieldNames?.some((field) => field.includes('shipping_address')),\n ) ||\n valueErrors.some((error: { fieldNames: string[] }) =>\n error?.fieldNames?.some((field) => field.includes('shipping_address_id')),\n )\n\n const rewardMissing = valueErrors.some((error: { fieldNames: string[] }) =>\n error?.fieldNames?.some((field) => field.includes('rewards')),\n )\n\n if (rewardMissing) {\n effects.push({\n dispatchableMessage: services.message.error(t('Reward does not exist'), { context: 'selection' }),\n action: () => navigation.navigate(PAGES.SELECTION, { replace: true }),\n })\n } else if (hasShipping) {\n effects.push({\n dispatchableMessage: services.message.error(\n t(\n 'Oops... An error has occurred while processing your order. Please check your shipping address before trying again',\n ),\n { context: 'address' },\n ),\n action: () => navigation.navigate(PAGES.ADDRESS, { replace: true }),\n })\n } else {\n // Other ValueError -> generic\n effects.push({ messageType: 'genericError' })\n }\n } else if (apiErrorBody && !Array.isArray(apiErrorBody) && 'message' in apiErrorBody) {\n effects.push({\n dispatchableMessage: services.message.error(String((apiErrorBody as { message: string }).message), {\n ...BASE_ERROR,\n }),\n })\n }\n } catch {\n // we don't block the UX for a dubious parsing\n }\n\n // Logging + generic if nothing specific and no limited/expired\n if (expiredProducts.length === 0 && limitedProducts.length === 0) {\n logger.err(`Failed to create order - Code ${(failure as { status: number })?.status}`, {\n errors: apiErrorBody,\n payload: orderPayload,\n })\n effects.push({ messageType: 'genericError' })\n }\n\n // Partially expired products\n if (expiredProducts.length > 0) {\n effects.push({\n dispatchableMessage: services.message.error(\n tn('Reward out of stock!', 'Rewards out of stock!', expiredProducts.length),\n { ...BASE_ERROR },\n ),\n action: () => {\n cart.setProducts(expiredProducts.map((p) => ({ id: p.id, quantity: 0 })))\n errorUtils.someSelectedProductsAreExpiredError('payment', expiredProducts, () => {\n navigation.navigate(PAGES.SELECTION, { replace: true })\n })\n },\n })\n }\n\n const hasGeneric = effects.some((effect) => effect.messageType === 'genericError')\n const hasParticular = effects.some((effect) => effect.messageType !== 'genericError')\n\n if (hasParticular && hasGeneric) {\n const particularEffects = effects.filter((effect) => effect.messageType !== 'genericError')\n return particularEffects\n }\n\n return effects\n }\n}\n","import * as React from 'react'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport * as services from '@owl-nest/services'\nimport { QueryStatus } from '@owl-nest/hooks'\n\ntype PaymentState = {\n failure?: api.RequestFailure\n paymentUrl?: string\n paymentMethod?: api.PaymentMethod\n status: QueryStatus\n} & (\n | {\n status: typeof QueryStatus.FAILURE | typeof QueryStatus.PENDING | typeof QueryStatus.PRISTINE\n }\n | {\n status: typeof QueryStatus.SUCCESS\n id: number\n }\n)\n\ntype UsePayment = {\n createPayment: (payload: api.CreateOrder) => Promise<void>\n createMonthlyPayment: (payload: api.CreateSubscription) => Promise<void>\n paymentState: PaymentState\n}\n\nexport function usePayment(projectId: number): UsePayment {\n const [paymentState, setState] = React.useState<PaymentState>({\n status: QueryStatus.PRISTINE,\n })\n\n async function createPayment(payload: api.CreateOrder): Promise<void> {\n const response = await services.order.create(projectId, payload)\n\n response.caseOf({\n right: (order) => {\n setState({\n paymentUrl: order.payment_url,\n status: QueryStatus.SUCCESS,\n id: order.id,\n paymentMethod: order.payment_method,\n })\n },\n left: (failure) => {\n setState({\n failure: failure,\n status: QueryStatus.FAILURE,\n })\n },\n })\n }\n\n async function createMonthlyPayment(payload: api.CreateSubscription): Promise<void> {\n const response = await services.subscription.create(projectId, payload)\n\n response.caseOf({\n right: (subscription) => {\n setState({\n paymentUrl: subscription.payment_url,\n status: QueryStatus.SUCCESS,\n id: subscription.id,\n paymentMethod: subscription.payment_method,\n })\n },\n left: (failure) => {\n setState({\n failure: failure,\n status: QueryStatus.FAILURE,\n })\n },\n })\n }\n\n return { createPayment, createMonthlyPayment, paymentState }\n}\n","import { type Project } from '@owl-nest/api-client/latest'\n\nexport function isPersonalIdNumberRequired(project: Project): boolean {\n return project.required_personal_id_number === true\n}\n","import * as yup from 'yup'\nimport { t } from '@owl-nest/localize'\nimport { type AuthenticatedUser } from '@owl-nest/api-client/latest'\n\nexport const userSchema = (user: AuthenticatedUser, isPersonalIdRequired: boolean): object => {\n return yup.object({\n email: user.email ? yup.mixed() : yup.string().email().required(t('This field is required')),\n personal_id_number: !isPersonalIdRequired\n ? yup.mixed()\n : yup\n .string()\n .matches(\n /^([a-z0-9]{16}|[0-9]{11})$/i,\n t(\n 'Italian fiscal code is either 16 caracters for natural persons or 11 caracters for legal persons. Please enter a valid fiscal code.',\n ),\n )\n .required(t('This field is required')),\n })\n}\n\n/**\n * @param user\n * @return boolean\n */\nexport function hasCompletedProfile(user: AuthenticatedUser, isPersonalIdRequired: boolean): boolean {\n const { email } = user\n\n if (!email) {\n return false\n }\n\n if (isPersonalIdRequired) {\n return false\n }\n\n return true\n}\n\nexport function isPersonalIdRequired(\n user: AuthenticatedUser,\n requirePersonalIdNumber: boolean,\n shippingCountry: string | undefined,\n userCountry: string,\n): boolean {\n const { personal_id_number: personalIdNumber } = user\n\n return requirePersonalIdNumber && !personalIdNumber && (userCountry === 'IT' || shippingCountry === 'IT')\n}\n","import * as React from 'react'\nimport { Formik, Form } from 'formik'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport { type AuthenticatedUser } from '@owl-nest/api-client/latest'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { isAlreadyExistsError } from '@owl-nest/auth'\nimport { userSchema } from '../../../models/user'\n\ntype ModalProps = {\n isPersonalIdNumberRequired: boolean\n userIsCompleted: boolean\n user: AuthenticatedUser\n}\n\nconst StyledRegularText = styled(plume.styles.copy.S.regular)`\n display: block;\n margin: 15px 0;\n`\n\nconst LinkContainer = styled(plume.styles.copy.S.regular)`\n display: block;\n margin-top: 10px;\n text-align: center;\n`\n\nconst FormFieldContainer = styled.div`\n margin: 15px 0;\n`\n\nexport const ModalIncompleteProfile = ({\n isPersonalIdNumberRequired,\n userIsCompleted,\n user,\n}: ModalProps): React.ReactElement<ModalProps> => {\n const auth = services.user.useSafeAuth()\n const apiError = auth.failure && auth.failure.body.length > 0 ? isAlreadyExistsError(auth.failure) : null\n\n const [open, setOpen] = React.useState(!userIsCompleted)\n\n return (\n // Modal is closable only if the user.email exists\n // Buttons are in the form so we can't pass them to the buttons props\n <plume.Modal open={open} closable={!!user.email} onClose={() => setOpen(false)}>\n <plume.styles.heading.S>{t('Update your information to pay')}</plume.styles.heading.S>\n\n <StyledRegularText>\n {t(\n 'You must update first your information to choose a payment method and click on the green button. Those additionnal information are required by our payment provider, you will be able to select your payment method after.',\n )}\n </StyledRegularText>\n\n <Formik\n initialValues={{\n email: user?.email || '',\n personal_id_number: user?.personal_id_number || '',\n }}\n validationSchema={userSchema(user, isPersonalIdNumberRequired)}\n validateOnBlur={false}\n validateOnChange={false}\n onSubmit={(values) => {\n const userPayload = {\n ...(!user?.email && { email: values.email }),\n ...(isPersonalIdNumberRequired && { personal_id_number: values.personal_id_number }),\n }\n const userId = user.id\n auth.update(userId, userPayload)\n }}\n >\n {({ values, errors, setFieldValue, submitForm }) => {\n const emailError = apiError ? t('This email is already taken.') : undefined\n return (\n <Form>\n {/* EMAIL FIELD */}\n {!user?.email && (\n <FormFieldContainer>\n <plume.TextField\n label={t('Email')}\n type=\"email\"\n value={values.email}\n error={errors.email || emailError}\n required={true}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n setFieldValue('email', event.target.value)\n }}\n />\n </FormFieldContainer>\n )}\n\n {/* FIELD personalIdNumberValidator */}\n {!user?.personal_id_number && isPersonalIdNumberRequired && (\n <FormFieldContainer>\n <plume.TextField\n label={t('Italian fiscal code')}\n value={values.personal_id_number}\n error={errors.personal_id_number}\n required={false}\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n setFieldValue('personal_id_number', event.target.value)\n }}\n />\n </FormFieldContainer>\n )}\n\n {/* SUBMIT */}\n <plume.styles.button.CallToAction onClick={submitForm}>\n {t('Update my information')}\n </plume.styles.button.CallToAction>\n\n {!user?.personal_id_number && isPersonalIdNumberRequired && (\n <LinkContainer>\n <plume.Link\n href=\"#\"\n kind=\"secondary\"\n as=\"a\"\n onClick={(event) => {\n event.preventDefault()\n setOpen(false)\n }}\n >\n {t(\"I don't have an Italian tax code\")}\n </plume.Link>\n </LinkContainer>\n )}\n </Form>\n )\n }}\n </Formik>\n </plume.Modal>\n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as env from '@owl-nest/config'\nimport { t, tc } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as UFE from '../../utils/UFE'\n\nexport function PaymentDisclaimers(): React.ReactElement<any> {\n return (\n <PaymentDisclaimersSection>\n <PaymentDisclaimersTitle>{t('Secure payment')}</PaymentDisclaimersTitle>{' '}\n <PaymentPartnersLogoSection>\n <plume.glyphs.paymentMethods.SSL size={39} />\n <plume.glyphs.paymentMethods.VerifiedByVisa size={47} />\n <plume.glyphs.paymentMethods.MastercardSecurecode size={56} />\n {UFE.FLAGS.apple_pay_enabled && <plume.glyphs.paymentMethods.ApplePay size={56} />}\n </PaymentPartnersLogoSection>\n <plume.styles.copy.XS.regular>\n {tc(\n 'By placing your order you agree to our [termsLink:Terms & Conditions] and [privacyLink: privacy policies]. You also consent to some of your data being stored by Ulule, which may be used to make future shopping experiences better for you.',\n {\n termsLink: <plume.Link href={env.TERMS_OF_USE_URL} />,\n privacyLink: <plume.Link href={env.PRIVACY_URL} />,\n },\n )}\n </plume.styles.copy.XS.regular>\n </PaymentDisclaimersSection>\n )\n}\n\nconst PaymentDisclaimersSection = styled.section`\n margin-top: 20px;\n\n ${plume.styles.copy.XS.regular} {\n font-size: 10px;\n line-height: 17px;\n color: ${plume.COLORS.TEXT_TERTIARY};\n }\n\n ${plume.Link} {\n text-decoration: underline;\n }\n`\n\nconst PaymentDisclaimersTitle = styled(plume.styles.copy.S.regular)`\n color: ${plume.COLORS.TEXT_TERTIARY};\n display: block;\n text-align: center;\n`\n\nconst PaymentPartnersLogoSection = styled.div`\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n justify-content: center;\n margin-bottom: 13px;\n margin: 0 auto;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n flex-wrap: nowrap;\n gap: 16px;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport { money, payment } from '@owl-nest/utils'\nimport * as env from '@owl-nest/config'\nimport { BREAKPOINTS, COLORS, styles as S, glyphs } from '@ulule/owl-kit-components/next'\nimport { type YakComponentOf, Polymorphic, type PolymorphicComponent } from '@owl-nest/yak/extra-runtime'\n\nimport { CurrencyGlyph } from '../../components/money'\n\n// PRIMARY PAYMENT METHOD\n\nexport const PaymentCallToAction = styled(S.button.CallToAction)``\n\nconst PaymentButton = styled(S.button.Button)`\n /* TODO: FIXME: Respect ODS transform? Check with product team */\n text-transform: initial;\n`\n\nconst PaymentMethod = styled(Polymorphic.div)`\n box-sizing: border-box;\n border: 1px solid ${COLORS.PRIMARY_SAND_200};\n border-radius: 3px;\n padding: 20px;\n width: 100%;\n` as YakComponentOf<PolymorphicComponent<'div'>>\n\nconst PaymentMethodDescription = styled(S.copy.S.regular)`\n color: ${COLORS.TEXT_PRIMARY};\n display: block;\n line-height: 20px;\n margin-bottom: 15px;\n margin-top: 11px;\n text-align: center;\n`\n\nconst PaymentMethodName = styled(S.copy.S.semiBold)`\n align-items: center;\n display: flex;\n justify-content: center;\n line-height: 21px;\n\n svg {\n margin-right: 2px;\n width: 42px;\n\n @media screen and ${BREAKPOINTS.MOBILE_M} {\n margin-right: 10px;\n width: initial;\n }\n }\n`\n\n// SECONDARY PAYMENT METHODS\n\nconst SecondaryPaymentMethod = styled(PaymentMethod)`\n align-items: center;\n cursor: pointer;\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-bottom: 10px;\n overflow: hidden;\n padding: 13px 20px;\n\n &:last-child {\n margin: 0px;\n }\n` as YakComponentOf<PolymorphicComponent<'div'>>\n\ntype CollapsibleSectionProps = {\n readonly collapsed: boolean\n}\n\nconst PaymentMethodCollapsibleSection = styled.section<CollapsibleSectionProps>`\n max-height: ${({ collapsed }) => (collapsed ? 0 : '100vh')};\n text-align: center;\n transition: max-height 0.3s ease-in-out;\n`\n\n// CONVERSION HINT\n\nconst ConversionHint = styled(S.copy.S.regular)`\n margin-left: 9px;\n`\n\nconst ConversionHintWrapper = styled.span`\n align-items: center;\n display: flex;\n justify-content: center;\n padding-top: 10px;\n`\n\n//\n\ntype PaymentMethodViewProps = {\n conversion?: {\n sourceAmount: number\n sourceCurrency: string\n targetCurrency: string\n }\n ctaText: React.ReactNode\n onCtaClick: () => void\n paymentMethod: payment.PaymentMethod\n}\n\ntype SecondaryPaymentMethodViewProps = {\n activeMethod: string | null\n ctaText: React.ReactNode\n onCtaClick: () => void\n onMethodClick: () => void\n paymentMethod: payment.PaymentMethod\n}\n\nexport const PaymentMethodView = ({\n conversion,\n ctaText,\n onCtaClick,\n paymentMethod,\n}: PaymentMethodViewProps): React.ReactElement<unknown> => {\n const PaymentMethodIcon = glyphs.paymentMethods[paymentMethod.icon]\n\n return (\n <PaymentMethod>\n <PaymentMethodName>\n <PaymentMethodIcon />\n <S.copy.S.regular>{paymentMethod.name}</S.copy.S.regular>\n </PaymentMethodName>\n <PaymentMethodDescription>{paymentMethod.description}</PaymentMethodDescription>\n <PaymentCallToAction\n color=\"blue\"\n onClick={(event: React.MouseEvent<HTMLElement>): void => {\n event.preventDefault()\n onCtaClick()\n }}\n size=\"medium\"\n >\n {ctaText}\n </PaymentCallToAction>\n\n {conversion !== undefined && conversion.sourceCurrency !== conversion.targetCurrency && env.CURRENCIES_RATES && (\n <ConversionHintWrapper>\n <CurrencyGlyph currency={conversion.sourceCurrency} size={17} />\n <ConversionHint>\n {t('Approximately %(amount)s at current exchange rates', {\n amount: t('%(currency)s%(amount)s', {\n amount: money.convert(\n conversion.sourceAmount,\n conversion.sourceCurrency,\n conversion.targetCurrency,\n env.CURRENCIES_RATES,\n ),\n currency: conversion.targetCurrency,\n }),\n })}\n </ConversionHint>\n </ConversionHintWrapper>\n )}\n </PaymentMethod>\n )\n}\n\nexport const SecondaryPaymentMethodView = ({\n activeMethod,\n ctaText,\n onMethodClick,\n onCtaClick,\n paymentMethod,\n}: SecondaryPaymentMethodViewProps): React.ReactElement<unknown> => {\n const PaymentMethodIcon = glyphs.paymentMethods[paymentMethod.icon]\n return (\n <SecondaryPaymentMethod\n as=\"li\"\n key={paymentMethod.id}\n onClick={(event: React.MouseEvent<HTMLElement>): void => {\n event.preventDefault()\n onMethodClick()\n }}\n >\n <PaymentMethodName>\n <PaymentMethodIcon />\n {paymentMethod.name}\n </PaymentMethodName>\n <PaymentMethodCollapsibleSection collapsed={activeMethod !== paymentMethod.id}>\n <PaymentMethodDescription>{paymentMethod.description}</PaymentMethodDescription>\n <PaymentButton\n onClick={(event: React.MouseEvent<HTMLElement>): void => {\n event.preventDefault()\n onCtaClick()\n }}\n >\n {ctaText}\n </PaymentButton>\n </PaymentMethodCollapsibleSection>\n </SecondaryPaymentMethod>\n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport { tc, t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as logger from '@owl-nest/logger'\nimport * as services from '@owl-nest/services'\nimport * as hooks from '@owl-nest/hooks'\nimport * as shadow from '@owl-nest/shadow'\nimport { COLORS, Spinner, styles as S } from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport { useOrderError } from './hooks/useOrderError'\nimport { usePayment } from './hooks/usePayment'\nimport * as projectModel from '../../models/project'\nimport { hasCompletedProfile, isPersonalIdRequired } from '../../models/user'\nimport * as UFE from '../../utils/UFE'\n\nimport * as AppStyle from '../../style'\nimport { ModalIncompleteProfile } from './components/ModalIncompleteProfile'\nimport { MoneyDisplayer } from '../../components/money'\nimport { PaymentDisclaimers } from '../../components/Payment/PaymentDisclaimers'\nimport { PaymentMethodView, SecondaryPaymentMethodView } from '../../components/Payment/PaymentMethod'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { type Cart } from '../../hooks/useCart/format'\nimport { useProject } from '../../hooks/useProject'\n\n// TODO: Always show 'Check' payment for staff (as per existing behavior)\nexport function PaymentSection(): React.ReactElement<unknown> {\n const [activeMethod, setActiveMethod] = React.useState(null)\n\n const cart = useCart()\n const { project } = useProject()\n\n const totalCost = cart.total_with_fees ?? cart.total\n const orderPayload = getOrderPayload(cart, project)\n\n const tracking = shadow.useTracking()\n\n const primaryPaymentMethod = models.project.getPrimaryPaymentMethod(\n project,\n UFE.FLAGS.paypal_enabled,\n UFE.FLAGS.apple_pay_enabled,\n )\n const secondaryPaymentMethods = models.project\n .getSecondaryPaymentMethods(project, UFE.FLAGS.paypal_enabled, UFE.FLAGS.apple_pay_enabled)\n .reduce((accumulator: any, method: any, index: number) => {\n if (method.id === 'bankwire' && totalCost < 400) {\n return accumulator\n }\n if (method.id === 'paypal' && !UFE.FLAGS.paypal_enabled) {\n return accumulator\n }\n if (method.id === 'check') {\n return accumulator\n }\n accumulator.push(method)\n return accumulator\n }, [])\n\n const { createPayment, createMonthlyPayment, paymentState } = usePayment(project.id)\n useOrderError(paymentState.status, paymentState.failure, orderPayload)\n\n React.useEffect(() => {\n if (paymentState.status === hooks.QueryStatus.SUCCESS && paymentState.paymentUrl) {\n tracking.ecommerce.track('add_payment_info', {\n value: cart.subTotal,\n currency: project.currency,\n payment_type: paymentState.paymentMethod ?? '',\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n // Usually kolkt redirects the user to the endfunnel with a query param\n // ?order_id=XXX. But in some odd cases the device of the user strips the\n // query param before arriving to the endfunnel. The endfunnel has no\n // order_id to verify the status of the order, and the user is stuck on a\n // never ending loop in the processing step of the endfunnel. For those\n // rare cases, we save the id of the newly created order in local storage.\n // That way, when arriving on the endfunnel, if the query param is absent\n // we can rely on the localstorage to rebuild the correct url.\n if (paymentState.id) {\n localStorage.setItem(`endfunnel_${project.id}_order`, String(paymentState.id))\n }\n window.location.href = paymentState.paymentUrl\n } else if (!paymentState.paymentUrl) {\n // logger.err('Received payment data w/o payment URL', {\n // paymentState,\n // project,\n // })\n }\n }, [paymentState.status])\n\n const user = services.user.useAuthenticatedUser()\n const config = env.useUserEnv()\n\n const projectCurrencyCode = project.currency\n const userCountry = env.USER_COUNTRY\n const userCurrencyCode = config.currency\n\n if (user === undefined) {\n return <></>\n }\n\n const isPersonalIdNumberRequired = isPersonalIdRequired(\n user,\n projectModel.isPersonalIdNumberRequired(project),\n cart.addressType === 'shipping' ? cart.selectedCountry?.code : undefined,\n userCountry,\n )\n const userIsCompleted = hasCompletedProfile(user, isPersonalIdNumberRequired)\n\n const isMembership = models.project.isMembership(project)\n\n return (\n <>\n {!userIsCompleted && (\n <ModalIncompleteProfile\n userIsCompleted={userIsCompleted}\n user={user}\n isPersonalIdNumberRequired={isPersonalIdNumberRequired}\n />\n )}\n <PaymentSectionWrapper data-testid=\"component:payment\">\n {/* Note: Success state means redirection to Kolkt is ongoing,\n ** we want to express that through the loading state. */}\n {paymentState.status === hooks.QueryStatus.PENDING ||\n (paymentState.status === hooks.QueryStatus.SUCCESS && (\n <AppStyle.LoadingCard>\n <Spinner />\n </AppStyle.LoadingCard>\n ))}\n\n <PaymentMethodView\n conversion={{\n sourceAmount: totalCost,\n sourceCurrency: projectCurrencyCode,\n targetCurrency: userCurrencyCode || projectCurrencyCode,\n }}\n ctaText={\n cart.tip.frequency === 'monthly'\n ? tc('Pay [amount] / month', {\n amount: <MoneyDisplayer amount={totalCost} />,\n })\n : isMembership && !cart.tip\n ? tc('Pay [amount] / month', {\n amount: <MoneyDisplayer amount={totalCost} />,\n })\n : tc('Pay [amount]', {\n amount: <MoneyDisplayer amount={totalCost} />,\n })\n }\n onCtaClick={() => pay(cart, primaryPaymentMethod.id as api.PaymentMethod)}\n paymentMethod={primaryPaymentMethod}\n />\n\n {!!secondaryPaymentMethods.length && (\n <>\n <OrSeparation>\n <S.copy.S.regular>{t('or')}</S.copy.S.regular>\n </OrSeparation>\n <SecondaryPaymentMethodList>\n {/* TODO: define `method` */}\n {secondaryPaymentMethods.map((method: any, index: number) => {\n return (\n <SecondaryPaymentMethodView\n key={index}\n activeMethod={activeMethod}\n paymentMethod={method}\n onCtaClick={() => pay(cart, method.id)}\n ctaText={t('Pay with %(method)s', { method: method.name })}\n onMethodClick={() => setActiveMethod(activeMethod === method.id ? null : method.id)}\n />\n )\n })}\n </SecondaryPaymentMethodList>\n </>\n )}\n\n <PaymentDisclaimers />\n </PaymentSectionWrapper>\n </>\n )\n\n async function pay(cart: Cart, paymentMethod: api.PaymentMethod): Promise<void> {\n if (cart.tip.frequency === 'monthly') {\n const payload = getSubscriptionPayload(cart, project)\n return await createMonthlyPayment({\n ...payload,\n payment_method: paymentMethod,\n })\n } else if (project.type === api.ProjectType.Membership && cart.products.length !== 0) {\n const payload = getMembershipSubscriptionPayload(cart, project)\n return await createMonthlyPayment({\n ...payload,\n payment_method: paymentMethod,\n })\n }\n\n try {\n await createPayment({\n ...orderPayload,\n country: undefined,\n return_url: endFunnelUrl(project),\n payment_method: paymentMethod,\n } as any)\n } catch (exception) {\n logger.err(\"[checkout] Couldn't proceed to payment\", {\n exception,\n orderPayload,\n })\n }\n }\n}\n\nfunction getOrderPayload(cart: Cart, project: api.Project): Omit<api.CreateOrder, 'payment_method'> {\n const trackingCookie = UFE.TRACKING\n let trackingJSON\n if (trackingCookie) {\n try {\n trackingJSON = JSON.parse(trackingCookie)\n } catch (exception) {\n logger.err('Failed to parse order tracking cookie', {\n exception,\n trackingCookie,\n })\n }\n }\n\n return {\n ...cart.getPayload(),\n return_url: endFunnelUrl(project),\n ...(trackingJSON && { tracking: trackingJSON }),\n }\n}\n\nfunction getSubscriptionPayload(cart: Cart, project: api.Project): Omit<api.CreateSubscription, 'payment_method'> {\n const payload = cart.getPayload()\n // FIXME: Payload is missing `tracking` property on API side\n return {\n billing_address_id: payload.billing_address_id,\n return_url: endFunnelUrl(project),\n total: payload.tip ?? 0,\n hidden: payload.hidden,\n }\n}\n\nfunction getMembershipSubscriptionPayload(\n cart: Cart,\n project: api.Project,\n): Omit<api.CreateSubscription, 'payment_method'> {\n const payload = cart.getPayload()\n\n const endfunnelURL = new URL(endFunnelUrl(project), window.location.href)\n const returnURL = new URLSearchParams(location.search).get('return_url')\n if (returnURL) {\n endfunnelURL.searchParams.set('return_url', returnURL)\n }\n const trackingCookie = UFE.TRACKING\n let trackingJSON\n if (trackingCookie) {\n try {\n trackingJSON = JSON.parse(trackingCookie)\n } catch (exception) {\n logger.err('Failed to parse membership subscription tracking cookie', {\n exception,\n trackingCookie,\n })\n }\n }\n\n return {\n reward_id: cart.products[0].id,\n shipping_address_id: payload.shipping_address_id,\n billing_address_id: payload.billing_address_id,\n return_url: endfunnelURL.toString(),\n hidden: payload.hidden,\n ...(trackingJSON && { tracking: trackingJSON }),\n }\n}\n\nfunction endFunnelUrl(project: api.Project) {\n return new URL(`/projects/${project.id}/checkout/endfunnel/processing/`, window.location.href).href\n}\n\n// GLOBAL LAYOUT\nexport const PaymentSectionWrapper = styled.section`\n position: relative;\n`\n\n// SECONDARY PAYMENT METHODS\nconst OrSeparation = styled.span`\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 20px;\n\n ${S.copy.S.regular} {\n color: ${COLORS.TEXT_TERTIARY};\n }\n`\n\nconst SecondaryPaymentMethodList = styled.ul`\n margin: 0 0 20px;\n padding: 0;\n`\n","import * as React from 'react'\n\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport { Spinner } from '@ulule/owl-kit-components/next'\n\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\nimport { useScrollToAnonymous } from '../../hooks/useScrollToAnonymous'\nimport { Item } from '../../components/Item'\nimport { CartSummary } from '../../components/selection'\nimport { IdentityItem } from '../../components/IdentityItem'\nimport { PickupItem, ContactItem, AddressItem, BillingAddress, MondialRelayItem } from '../../components/ShippingItem'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { PaymentSection } from './PaymentSection'\n\nexport function PaymentView(): React.ReactElement<unknown> | null {\n const cart = useCart()\n const navigation = useNavigation()\n\n // True when the user has already provided shipping info on a previous visit to this step.\n // Determines whether to scroll to the shipping summary or to the anonymous toggle on load.\n const hasFilledShipping = Boolean(\n cart.addressType === 'shipping' &&\n (cart.selectedShippingMode === 'pickup_point' || cart.billingAddress || cart.shippingAddress),\n )\n const { shippingsBoxRef, anonymousBoxRef } = useScrollToAnonymous(hasFilledShipping, cart.isLoading)\n\n const auth = services.user.useAuth()\n\n const hasAddressStep = cart.addressType === 'shipping' && cart.selectedShippingMode === 'home_delivery'\n const hasPickupStep = cart.addressType === 'shipping' && cart.selectedShippingMode === 'pickup_point'\n const hasMondialRelayStep = cart.addressType === 'shipping' && cart.selectedShippingMode === 'mondial_relay'\n const hasContactStep = cart.addressType === 'contact'\n\n return (\n <>\n <Item\n title={t('Your selection')}\n action={{\n handler: () => {\n navigation.navigate(PAGES.SELECTION, { forceStep: true })\n },\n text: t('Edit'),\n }}\n >\n <CartSummary />\n </Item>\n\n <IdentityItem ref={anonymousBoxRef} />\n\n {hasPickupStep && (\n <PickupItem\n ref={shippingsBoxRef}\n goToAddress={() => {\n navigation.navigate(PAGES.ADDRESS)\n }}\n goToDelivery={() => {\n navigation.navigate(PAGES.PICKUP)\n }}\n />\n )}\n\n {hasMondialRelayStep && (\n <MondialRelayItem\n ref={shippingsBoxRef}\n goToAddress={() => {\n navigation.navigate(PAGES.ADDRESS)\n }}\n goToDelivery={() => {\n navigation.navigate(PAGES.MONDIAL_RELAY)\n }}\n />\n )}\n\n {hasContactStep && (\n <ContactItem\n ref={shippingsBoxRef}\n goToAddress={() => {\n navigation.navigate(PAGES.ADDRESS)\n }}\n goToDelivery={() => {\n navigation.navigate(PAGES.PICKUP)\n }}\n />\n )}\n\n {(hasPickupStep || hasMondialRelayStep) && (\n <BillingAddress\n ref={shippingsBoxRef}\n goToAddress={() => {\n navigation.navigate(PAGES.ADDRESS)\n }}\n goToDelivery={() => {\n if (hasPickupStep) {\n navigation.navigate(PAGES.PICKUP)\n }\n if (hasMondialRelayStep) {\n navigation.navigate(PAGES.MONDIAL_RELAY)\n }\n }}\n />\n )}\n\n {hasAddressStep && (\n <AddressItem\n ref={shippingsBoxRef}\n goToAddress={() => {\n navigation.navigate(PAGES.ADDRESS)\n }}\n goToDelivery={() => {\n navigation.navigate(PAGES.PICKUP)\n }}\n />\n )}\n\n <Item title={t('Payment')}>\n <React.Suspense fallback={<Spinner />}>\n {auth.type !== 'loggedin' ? <Spinner /> : <PaymentSection />}\n </React.Suspense>\n </Item>\n </>\n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport { t } from '@owl-nest/localize'\nimport * as model from '@owl-nest/models'\nimport {\n Callout,\n BREAKPOINTS,\n COLORS,\n glyphs,\n Link,\n RadioField,\n RadioGroupField,\n styles as S,\n} from '@ulule/owl-kit-components/next'\n\nimport { Item } from '../../components/Item'\nimport { type CartMethods } from '../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../hooks/useCart/format'\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\n\ntype PickupItemProps = {\n cart: ShippingCart & CartMethods\n className?: string\n onContinue: () => void\n}\n\nconst Center = styled.div`\n text-align: center;\n`\n\nconst PickupItemComponent = React.forwardRef<HTMLDivElement, PickupItemProps>(function PickupItemComponent(\n { cart, className, onContinue },\n ref,\n) {\n const navigation = useNavigation()\n\n return (\n <Item title={t('Pick-up locations')} ref={ref} className={className} testid=\"view:address:pickup\">\n <Callout type=\"info\">\n {t(\n 'Creator is offering pick-up locations instead of postal delivery, a cheaper option and an opportunity to meet them!',\n )}\n </Callout>\n <RadioGroupField>\n {cart.pickupPoints.map((pickupPoint, i) => {\n return (\n <RadioField\n dataTestId={`component:cart.shipping.pickup_point`}\n key={i}\n onChange={() => cart.setPickupPoint(pickupPoint.id)}\n checked={cart.selectedPickupPoint?.id === pickupPoint.id}\n label={<S.heading.XXXS>{model.pickup.city(pickupPoint)}</S.heading.XXXS>}\n context={model.pickup.address(pickupPoint)}\n description={model.pickup.description(pickupPoint)}\n />\n )\n })}\n </RadioGroupField>\n\n <S.button.Button onClick={onContinue} data-testid=\"component:address.continue\">\n {t('Continue')}\n </S.button.Button>\n\n <Center>\n <S.copy.S.regular>{t(\"Can't find a pick-up location?\")}</S.copy.S.regular>\n <S.copy.S.regular>\n <Link\n kind=\"secondary\"\n onClick={() => {\n navigation.navigate(PAGES.SELECTION)\n }}\n >\n {t('Change delivery method')}\n </Link>\n </S.copy.S.regular>\n </Center>\n </Item>\n )\n})\n\nexport const PickupItem = styled(PickupItemComponent)`\n ${RadioGroupField} {\n margin: 20px 0;\n }\n\n ${RadioField} {\n ${glyphs.stroke.MapCursor} {\n color: ${COLORS.PRIMARY_GREY_500};\n margin-right: 4px;\n }\n\n ${S.field.Title} {\n margin-right: 8px;\n color: ${COLORS.TEXT_PRIMARY} !important;\n\n ${S.heading.XXXS} {\n display: inline;\n }\n }\n\n ${S.field.Context} {\n white-space: pre-wrap;\n }\n\n @media screen and ${BREAKPOINTS.TABLET} {\n ${S.field.Context} {\n margin-left: 15px;\n }\n }\n }\n\n ${S.button.Button} {\n width: 100%;\n }\n\n ${Center} {\n margin: 20px 0 0;\n }\n`\n","import * as React from 'react'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as models from '@owl-nest/models'\n\nimport { Item } from '../../components/Item'\nimport { FutureItem } from '../../components/FutureItem'\nimport { CartSummary } from '../../components/selection'\nimport { IdentityItem } from '../../components/IdentityItem'\nimport { useScrollToAnonymous } from '../../hooks/useScrollToAnonymous'\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\nimport { PickupItem } from './PickupItem'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { useProject } from '../../hooks/useProject'\n\nexport function PickupView(): React.ReactElement<unknown> | null {\n const navigation = useNavigation()\n const cart = useCart()\n const { project } = useProject()\n\n const auth = services.user.useAuth()\n\n // True when the user has already provided shipping info on a previous visit to this step.\n // Determines whether to scroll to the shipping summary or to the anonymous toggle on load.\n const hasFilledShipping = Boolean(cart.addressType === 'shipping' && (cart.billingAddress || cart.shippingAddress))\n const { shippingsBoxRef, anonymousBoxRef } = useScrollToAnonymous(hasFilledShipping, cart.isLoading)\n\n const tracking = shadow.useTracking()\n\n if (cart.addressType !== 'shipping') {\n return <></>\n }\n\n return (\n <>\n <Item\n title={t('Your selection')}\n action={{\n handler: () => {\n navigation.navigate(PAGES.SELECTION, { forceStep: true })\n },\n text: t('Edit'),\n }}\n >\n <CartSummary />\n </Item>\n\n <IdentityItem ref={anonymousBoxRef} />\n\n {auth.type !== 'loggedin' ? (\n <Item title={t('Delivery at-home')}>\n <plume.Spinner />\n </Item>\n ) : (\n <PickupItem ref={shippingsBoxRef} cart={cart} onContinue={handleContinue} />\n )}\n\n {cart.needAddress && <FutureItem title={t('Contact details')} />}\n <FutureItem title={t('Payment')} />\n </>\n )\n\n function handleContinue() {\n tracking.ecommerce.track('add_shipping_info', {\n value: cart.subTotal,\n currency: project.currency,\n shipping_tier: 'pickup_point',\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n\n navigation.navigate(navigation.nextLegalPage)\n }\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { Callout, Spinner, styles as S } from '@ulule/owl-kit-components/next'\nimport { t, tc } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\n\nimport * as model from '@owl-nest/models'\n\nimport { Item } from '../../components/Item'\nimport { PaymentMethodView } from '../../components/Payment/PaymentMethod'\nimport * as UFE from '../../utils/UFE'\n\nimport { PaymentSectionWrapper } from '../payment/PaymentSection'\nimport { PaymentDisclaimers } from '../../components/Payment/PaymentDisclaimers'\nimport { MoneyDisplayer } from '../../components/money'\nimport { useProject } from '../../hooks/useProject'\n\nconst PaymentSection = styled(PaymentSectionWrapper)`\n margin-top: 30px;\n`\n\ntype RenewViewProps = {\n orderId: number\n}\n\nexport function RenewView({ orderId }: RenewViewProps): React.ReactElement<RenewViewProps> | null {\n const { project } = useProject()\n const { renew, response } = services.order.useOrder(orderId)\n\n const primaryPaymentMethod = model.project.getPrimaryPaymentMethod(project, UFE.FLAGS.paypal_enabled)\n const renewBoxRef = React.useRef(null)\n\n return (\n <>\n {response.data === undefined ? (\n <Spinner />\n ) : (\n <Item ref={renewBoxRef} title={t('Payment')}>\n <Callout type=\"info\">\n {t(\n \"We can't validate your previous payment, you can renew your contribution by providing a new payment method\",\n )}\n </Callout>\n <PaymentSection>\n <PaymentMethodView\n paymentMethod={primaryPaymentMethod}\n onCtaClick={() => {\n // TODO : investigate inconsistencies between `primaryPaymentMethod.id` type and `payment_method` type\n renew({ payment_method: primaryPaymentMethod.id as any }).then((result) => {\n result?.next((response) => {\n if (response.payment_url) {\n window.location.href = response.payment_url\n }\n })\n })\n }}\n ctaText={tc('Pay [amount]', {\n amount: <MoneyDisplayer amount={response.data?.order_total} />,\n })}\n />\n </PaymentSection>\n\n <PaymentDisclaimers />\n </Item>\n )}\n </>\n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { t } from '@owl-nest/localize'\n\ntype RemoveModalProps = {\n removalModalIsOpen: boolean\n removeSelection: () => void\n closeModal: () => void\n}\nexport const RemoveModal = ({ removalModalIsOpen, removeSelection, closeModal }: RemoveModalProps) => {\n return (\n <plume.Modal\n data-testid=\"modal:cart.remove\"\n open={removalModalIsOpen}\n onClose={closeModal}\n buttons={[\n {\n type: 'button',\n props: {\n onClick: removeSelection,\n children: t('Yes, remove'),\n 'data-testid': 'modal:cart.remove.cta.confirm',\n },\n },\n {\n type: 'linkAsButton',\n props: {\n kind: 'secondary',\n onClick: closeModal,\n children: t('No, keep it'),\n 'data-testid': 'modal:cart.remove.cta.cancel',\n },\n },\n ]}\n >\n <RemoveModalTitle>{t('Please confirm you wish to remove this reward.')}</RemoveModalTitle>\n </plume.Modal>\n )\n}\n\nconst RemoveModalTitle = styled(plume.styles.heading.S)`\n text-align: center;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { BREAKPOINTS, COLORS, FONTS, Tooltip, glyphs, styles as S } from '@ulule/owl-kit-components/next'\nimport { styles } from '@owl-nest/utils'\nimport { t } from '@owl-nest/localize'\n\nimport * as productModel from '../../models/product'\nimport { useCart } from '../../hooks/useCart/useCart'\n\ntype SelectionQuantityProps = {\n product: productModel.Product\n setRemovalModalIsOpen: (isOpen: boolean) => void\n}\n\nexport function SelectionQuantity({ product, setRemovalModalIsOpen }: SelectionQuantityProps) {\n const cart = useCart()\n const productHasUnlimitedStock = !productModel.hasLimitedStock(product)\n const productIsSelectable = productModel.isSelectable(product)\n const productIsAvailable = productHasUnlimitedStock || productIsSelectable\n\n const [isOpenTooltip, setIsOpenTooltip] = React.useState(false)\n\n return (\n <SelectionItemQuantity>\n <Flex>\n <ButtonQuantity\n data-testid=\"component:cart.item.decrement\"\n onClick={() => {\n if (product.quantity === 1) {\n setRemovalModalIsOpen(true)\n } else {\n cart.setProduct(product.id, (quantity) => quantity - 1)\n }\n }}\n $active={true}\n >\n <glyphs.stroke.Minus size={11} />\n </ButtonQuantity>\n <Quantity data-testid=\"component:cart.item.quantity\">{product.quantity}</Quantity>\n <ButtonQuantity\n data-testid=\"component:cart.item.increment\"\n onClick={() => {\n if (productIsAvailable) {\n cart.setProduct(product.id, (quantity) => quantity + 1)\n }\n }}\n onMouseEnter={() => {\n if (!productIsAvailable) {\n setIsOpenTooltip(true)\n }\n }}\n onMouseLeave={() => {\n if (!productIsAvailable) {\n setIsOpenTooltip(false)\n }\n }}\n $active={productIsAvailable}\n >\n <glyphs.stroke.Plus size={11} />\n <StyledTooltip open={isOpenTooltip} position=\"bottom\">\n <S.copy.S.regular>{t('No more quantity available for this reward')}</S.copy.S.regular>\n </StyledTooltip>\n </ButtonQuantity>\n </Flex>\n </SelectionItemQuantity>\n )\n}\n\nexport const SelectionItemQuantity = styled.td`\n text-align: right;\n`\n\nexport const ButtonQuantity = styled.button<{ $active?: boolean }>`\n background-color: transparent;\n border-radius: 100%;\n border: 1px solid ${(props) => (props.$active ? `${COLORS.PRIMARY_SAND_500}` : `${COLORS.PRIMARY_SAND_200}`)};\n color: ${(props) => (props.$active ? `${COLORS.PRIMARY_SAND_500}` : `${COLORS.PRIMARY_SAND_200}`)};\n cursor: pointer;\n font-size: ${() => styles.rem(17)};\n height: 19px;\n line-height: 0px;\n margin: 0px 4px;\n padding: 0px;\n position: relative;\n text-align: center;\n transition: 0.3s ease;\n width: 19px;\n\n &:hover {\n /* HACK: Wrong token family, check with Product */\n border: 1px solid ${(props) => (props.$active ? `${COLORS.TEXT_TERTIARY}` : `${COLORS.PRIMARY_SAND_200}`)};\n color: ${(props) => (props.$active ? `${COLORS.TEXT_TERTIARY}` : `${COLORS.PRIMARY_SAND_200}`)};\n outline: none;\n }\n\n &:focus,\n &:active {\n border: 1px solid ${(props) => (props.$active ? `${COLORS.PRIMARY_SAND_500}` : `${COLORS.PRIMARY_SAND_200}`)};\n color: ${(props) => (props.$active ? `${COLORS.PRIMARY_SAND_500}` : `${COLORS.PRIMARY_SAND_200}`)};\n outline: none;\n }\n\n @media screen and ${BREAKPOINTS.MOBILE_L} {\n margin: 0px 12px;\n }\n`\n\nconst Flex = styled.div`\n display: flex;\n justify-content: flex-end;\n`\n\nexport const Quantity = styled.span`\n color: ${COLORS.TEXT_PRIMARY};\n cursor: default;\n font-size: ${() => styles.rem(15)};\n line-height: 18px;\n text-align: center;\n`\n\nconst StyledTooltip = styled(Tooltip)`\n top: 30px;\n width: 133px;\n\n @media screen and ${BREAKPOINTS.TABLET} {\n width: 183px;\n }\n`\n","import * as React from 'react'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\n\nimport * as productModel from '../../../../models/product'\nimport { MoneyDisplayer } from '../../../../components/money'\nimport { RemoveModal } from '../../../../components/Modals/RemoveModal'\nimport { SelectionQuantity } from '../../../../components/Form/SelectionQuantity'\n\nimport * as S from '../../style'\nimport { useProject } from '../../../../hooks/useProject'\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype SelectionItemProps = {\n product: productModel.Product\n}\n\nexport function SelectionItem({ product }: SelectionItemProps): React.ReactElement<any> {\n const [removalModalIsOpen, setRemovalModalIsOpen] = React.useState(false)\n const { project } = useProject()\n const cart = useCart()\n const isMembership = models.project.isMembership(project)\n\n const additionalCost =\n product.variant && product.variant.total_additional_cost\n ? product.variant.total_additional_cost * product.quantity\n : null\n const amount = product.reward.price * product.quantity\n const description = productModel.getTruncatedDescription(product)\n const image = product.variant ? models.variant.image(product.variant) : productModel.getImage(product)\n const productIsAvailable = productModel.quantityDoesNotExceedStock(product)\n const productIsLegacy = productModel.isLegacy(product)\n const title = productIsLegacy ? description : productModel.getTruncatedTitle(product)\n\n return (\n <S.SelectionItem $hasAdditionalCost={Boolean(additionalCost)} data-testid=\"component:cart.item\">\n {/* INFORMATION */}\n <S.SelectionItemInformations data-testid=\"component:cart.item.info\">\n {image ? <S.RewardSelectionImage src={image} alt={''} /> : isMembership && <S.RewardSelectionPlaceholder />}\n <div>\n {title && <S.SelectionTitle dangerouslySetInnerHTML={{ __html: title }}></S.SelectionTitle>}\n {description && product.variant && !productIsLegacy && (\n <S.SelectionVariantTitle dangerouslySetInnerHTML={{ __html: description }}></S.SelectionVariantTitle>\n )}\n </div>\n </S.SelectionItemInformations>\n\n {/* QUANTITY */}\n {!isMembership && <SelectionQuantity product={product} setRemovalModalIsOpen={setRemovalModalIsOpen} />}\n\n {/* CURRENCY */}\n <S.SelectionCurrencyWrapper data-testid=\"component:cart.item.price\">\n <S.SelectionCurrency>\n {isMembership ? (\n tc('[amount] / month', {\n amount: <MoneyDisplayer amount={amount} />,\n })\n ) : (\n <MoneyDisplayer amount={amount} />\n )}\n </S.SelectionCurrency>\n {additionalCost && (\n <>\n <S.SmallSelectionCurrency>\n +{'\\u00A0'}\n <MoneyDisplayer amount={additionalCost} />\n </S.SmallSelectionCurrency>\n </>\n )}\n </S.SelectionCurrencyWrapper>\n\n {/* ERRORS */}\n <S.SelectionError $error={!productIsAvailable}>\n {/* error already hide content if not available */}\n {t('This reward stock is limited to %(limit)s', { limit: productModel.stock(product).available! })}\n </S.SelectionError>\n\n {/* MODAL */}\n <RemoveModal\n removeSelection={() => {\n setRemovalModalIsOpen(false)\n cart.setProduct(product.id, 0)\n }}\n removalModalIsOpen={removalModalIsOpen}\n closeModal={() => {\n setRemovalModalIsOpen(false)\n }}\n />\n </S.SelectionItem>\n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype CountrySelectProps = {\n countries: { code: string; label: string }[]\n className?: string\n}\n\nfunction CountrySelectComponent({ className, countries }: CountrySelectProps) {\n const cart = useCart()\n\n if (cart.addressType !== 'shipping' || countries.length === 0) {\n return <></>\n }\n\n if (countries.length === 1) {\n if (cart.shippingModes.length === 1) return <></>\n\n return (\n <plume.styles.heading.XXXS className={className}>\n {t('Delivery')} {countries[0].label}{' '}\n </plume.styles.heading.XXXS>\n )\n }\n\n return (\n <plume.SelectField\n className={className}\n height={250}\n label={<plume.styles.heading.XXXS>{t('Delivery')}</plume.styles.heading.XXXS>}\n selected={[cart.selectedCountry?.code]}\n placeholder={t('Select a country')}\n error={cart.selectedShippingMode === 'home_delivery' && cart.shippingError && t('Please select a country')}\n filterable={countries.length > 12}\n filterPlaceholder={t('Search')}\n onChange={(selected) => {\n cart.setSelectedCountry(selected[0].value)\n }}\n selectLabel={(selectedOptions) => {\n // @ts-expect-error selectedOptions[0]?.value is not typed\n return <>{countries.find((country) => country.code === selectedOptions[0]?.value)?.label}</>\n }}\n >\n {countries.map(({ label, code }) => {\n return <plume.Option key={code} value={code} label={label} />\n })}\n </plume.SelectField>\n )\n}\n\nexport const CountrySelect = styled(CountrySelectComponent)`\n flex-direction: row;\n justify-content: space-between;\n\n ${plume.Select} {\n z-index: 3;\n position: relative;\n width: 200px;\n }\n`\n","import * as React from 'react'\nimport { styled, css } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype SingleCountryAndShippingModeLabelProps = {\n countries: { code: string; label: string }[]\n rate: string | undefined\n className?: string\n}\n\nexport function SingleCountryAndShippingModeLabel({\n className,\n countries,\n rate,\n}: SingleCountryAndShippingModeLabelProps): React.ReactElement<any> {\n const cart = useCart()\n\n if (cart.addressType !== 'shipping') {\n return <></>\n }\n\n return (\n <plume.styles.heading.XXXS className={className}>\n <SingleMethodContainer>\n <div>\n {t('Delivery')} {countries[0].label}{' '}\n <SingleMethodSubLabel $forceLowerCase={cart.shippingModes[0] === 'home_delivery'}>\n {cart.shippingModes[0] === 'home_delivery' ? (\n t('At home')\n ) : cart.shippingModes[0] === 'pickup_point' ? (\n `- ${t('Pickup point')}`\n ) : cart.shippingModes[0] === 'mondial_relay' ? (\n <>\n {`- ${t('Mondial Relay')}`}\n <plume.glyphs.thirdParty.MondialRelay size={20} />\n </>\n ) : (\n ''\n )}\n </SingleMethodSubLabel>\n </div>\n <span>{rate}</span>\n </SingleMethodContainer>\n </plume.styles.heading.XXXS>\n )\n}\n\nconst SingleMethodSubLabel = styled.span<{ $forceLowerCase: boolean }>`\n ${({ $forceLowerCase }) =>\n $forceLowerCase &&\n css`\n text-transform: lowercase;\n `}\n\n svg {\n vertical-align: bottom;\n }\n`\n\nconst SingleMethodContainer = styled.div`\n display: flex;\n justify-content: space-between;\n\n span {\n text-align: right;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as money from '@owl-nest/money'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\n\nimport * as S from '../../style'\nimport { useCart } from '../../../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../../../hooks/useCart/format'\nimport { useProject } from '../../../../hooks/useProject'\nimport { CountrySelect } from './CountrySelect'\nimport { SingleCountryAndShippingModeLabel } from './SingleCountryAndShippingModeLabel'\n\nexport function SelectionShipping() {\n const cart = useCart()\n const { project } = useProject()\n const userConfig = env.useUserEnv()\n\n if (cart.addressType !== 'shipping') {\n return <></>\n }\n const userCountryIsSupported =\n cart.availableCountries.length === 0 || cart.availableCountries.includes(env.USER_COUNTRY)\n\n const supportedCountries = cart.availableCountries\n .map((code) => ({\n label: getCountryLabel(code),\n code,\n })) // unknown country will have an undefined label. We filter them out.\n .filter((option): option is { label: string; code: string } => option.label !== undefined)\n .sort((a, b) => a.label.localeCompare(b.label))\n\n return (\n <Wrapper data-testid=\"component:cart.shipping\">\n {cart.selectedCountry?.forced && (\n <plume.Callout type=\"info\" wrapWithCopy={false}>\n <S.CalloutTextStrong>\n {t(\n \"Shipping to one or more selected countries has been cancelled since a reward you chose can't be shipped to those countries.\",\n )}\n </S.CalloutTextStrong>\n </plume.Callout>\n )}\n\n {cart.shippingModes.length === 1 && supportedCountries.length === 1 ? (\n <SingleCountryAndShippingModeLabel\n countries={supportedCountries}\n rate={getRate(cart.shippingModes[0], cart, project, userConfig.lang)}\n />\n ) : (\n <CountrySelect countries={supportedCountries} />\n )}\n\n <>\n {cart.shippingModes.length === 1 &&\n supportedCountries.length >= 1 &&\n cart.selectedShippingMode === 'pickup_point' && (\n <SingleMethod\n data-testid=\"component:cart.shipping.singlemethod\"\n label={\n <plume.styles.heading.XXXS>\n {`${t('Pick-up')}${\n cart.pickupPoints.length === 1 ? ' - ' + models.pickup.city(cart.pickupPoints[0]) : ''\n }`}\n </plume.styles.heading.XXXS>\n }\n >\n <>\n {cart.pickupPoints.length > 1 && (\n <PickupPointDropdown\n selected={cart.selectedPickupPoint}\n error={cart.selectedShippingMode === 'pickup_point' && cart.shippingError}\n options={cart.pickupPoints.map((pickupPoint) => ({\n value: pickupPoint.id,\n label: models.pickup.city(pickupPoint),\n }))}\n onChange={cart.setPickupPoint}\n active={cart.selectedShippingMode === 'pickup_point'}\n />\n )}\n <S.Rate>{t('included')}</S.Rate>\n </>\n </SingleMethod>\n )}\n {cart.shippingModes.length === 1 &&\n supportedCountries.length > 1 &&\n cart.selectedShippingMode !== 'pickup_point' && (\n <SingleMethod\n data-testid=\"component:cart.shipping.singlemethod\"\n label={\n <plume.styles.heading.XXXS>\n {cart.shippingModes[0] === 'home_delivery'\n ? t('Home delivery')\n : cart.shippingModes[0] === 'pickup_point'\n ? t('Pick-up')\n : cart.shippingModes[0] === 'mondial_relay'\n ? t('Mondial relay')\n : ''}\n </plume.styles.heading.XXXS>\n }\n >\n <S.Rate>{getRate(cart.shippingModes[0], cart, project, userConfig.lang)}</S.Rate>\n </SingleMethod>\n )}\n {cart.shippingModes.length > 1 && (\n <S.ColumnSelectionSection>\n <plume.RadioGroupField>\n {cart.shippingModes.includes('home_delivery') && (\n <S.StyledRadioField\n dataTestId=\"component:cart.shipping.radio.home_delivery\"\n label={t('Home delivery')}\n checked={cart.selectedShippingMode === 'home_delivery'}\n onChange={() => {\n cart.setShippingMode('home_delivery')\n }}\n >\n <S.Rate>{getRate('home_delivery', cart, project, userConfig.lang)}</S.Rate>\n </S.StyledRadioField>\n )}\n {cart.shippingModes.includes('mondial_relay') && (\n <S.StyledRadioField\n dataTestId=\"component:cart.shipping.radio.mondial_relay\"\n label={\n <>\n {t('Mondial relay')}\n <plume.glyphs.thirdParty.MondialRelay size={20} />\n </>\n }\n checked={cart.selectedShippingMode === 'mondial_relay'}\n onChange={() => {\n cart.setShippingMode('mondial_relay')\n }}\n >\n <S.Rate>{getRate('mondial_relay', cart, project, userConfig.lang)}</S.Rate>\n </S.StyledRadioField>\n )}\n {/* We have to set a fake description that will be hidden to have 2 lines so that the dropdown */}\n {/* is displayed instead of the second 'empty' line */}\n {cart.shippingModes.includes('pickup_point') && (\n <S.StyledRadioField\n dataTestId=\"component:cart.shipping.radio.pickup_point\"\n label={t('Pick-up')}\n description={cart.pickupPoints.length > 1 ? 'fake text' : models.pickup.city(cart.pickupPoints[0])}\n checked={cart.selectedShippingMode === 'pickup_point'}\n onChange={() => {\n cart.setShippingMode('pickup_point')\n }}\n $hideDescriptionContent={cart.pickupPoints.length > 1}\n >\n {cart.pickupPoints.length > 1 && (\n <PickupPointDropdown\n selected={cart.selectedPickupPoint}\n error={cart.selectedShippingMode === 'pickup_point' && cart.shippingError}\n options={cart.pickupPoints.map((pickupPoint) => ({\n value: pickupPoint.id,\n label: models.pickup.city(pickupPoint),\n }))}\n onChange={cart.setPickupPoint}\n active={cart.selectedShippingMode === 'pickup_point'}\n />\n )}\n <S.Rate>{t('included')}</S.Rate>\n </S.StyledRadioField>\n )}\n </plume.RadioGroupField>\n </S.ColumnSelectionSection>\n )}\n </>\n\n {!userCountryIsSupported && (\n <plume.Callout type=\"alert\" wrapWithCopy={false}>\n <S.CalloutText>\n {t('In %(country)s? Project creator doesn’t ship to this country.', {\n country: env.COUNTRIES.find((country) => country.code === env.USER_COUNTRY)!.label(),\n })}\n </S.CalloutText>\n </plume.Callout>\n )}\n </Wrapper>\n )\n}\n\ntype PickupPointDropdownProps = {\n selected: api.PickupPoint | undefined\n error?: boolean\n options: { label: string; value: any }[]\n onChange: (value: any) => void\n active: boolean\n}\n\nfunction PickupPointDropdown({ selected, error, options, onChange, active }: PickupPointDropdownProps) {\n return (\n <S.StyledDropdown\n dataTestId=\"component:cart.shipping.pickup_point_dropdown\"\n $active={active}\n selected={selected ? [selected.id] : []}\n placeholder={t('Choose a pickup point')}\n height={200}\n status={error ? 'error' : 'default'}\n onChange={(selected) => {\n onChange(selected[0].value)\n }}\n filterable={options.length > 12}\n filterPlaceholder={t('Search')}\n >\n {options.map((option) => {\n return (\n <S.OneLineOption key={option.value} label={option.label} value={option.value}>\n {option.label}\n </S.OneLineOption>\n )\n })}\n </S.StyledDropdown>\n )\n}\n\nfunction getRate(mode: api.ShippingMode, cart: ShippingCart, project: api.Project, lang: api.Lang) {\n if (cart.selectedCountry === undefined) {\n return undefined\n }\n\n const rate = cart.getRate(cart.selectedCountry.code, mode)\n\n return rate === 0 || rate === undefined\n ? t('included')\n : `+\\u00A0${money.format(rate, {\n currency: project.currency,\n locale: lang ?? env.DEFAULT_LOCALE,\n })}`\n}\n\nfunction getCountryLabel(countryCode: string) {\n const country = env.COUNTRIES.find((country) => country.code === countryCode)\n\n // the list of countries API side might be out of sync with the liste of\n // country in the front.\n if (country === undefined) {\n return undefined\n }\n\n return country.label()\n}\n\nconst SingleMethod = styled(plume.StyledRadioField)`\n padding-left: 20px;\n min-height: 50px;\n\n ${S.Rate} {\n position: absolute;\n right: 20px;\n top: 50%;\n transform: translateY(-50%);\n }\n`\n\nconst Wrapper = styled.div`\n margin-bottom: 20px;\n ${CountrySelect} {\n margin: 20px 0 16px;\n }\n`\n","import * as React from 'react'\n\nimport { t } from '@owl-nest/localize'\n\nimport { MoneyConverter, MoneyDisplayer } from '../../../../components/money'\nimport * as S from '../../style'\n\ntype SelectionTipProps = {\n isDifferentCurrency: boolean\n scrollTo: () => void\n tip: number\n}\n\nexport function SelectionTip({ isDifferentCurrency, scrollTo, tip }: SelectionTipProps) {\n return (\n <S.SelectionItem data-testid=\"component:cart.tip\">\n <S.TipInformations data-testid=\"component:cart.tip.info\">\n <S.SelectionTitle>{t('Donation')}</S.SelectionTitle>\n </S.TipInformations>\n <S.TipActions>\n <S.TipLink kind=\"secondary\" onClick={scrollTo}>\n {t('Edit')}\n </S.TipLink>\n </S.TipActions>\n <S.SelectionCurrencyWrapper data-testid=\"component:cart.tip.price\">\n <S.SelectionCurrency>\n <MoneyDisplayer amount={tip} />\n </S.SelectionCurrency>\n {isDifferentCurrency && <MoneyConverter bottomPosition={1} amount={tip} />}\n </S.SelectionCurrencyWrapper>\n </S.SelectionItem>\n )\n}\n","import * as React from 'react'\nimport { styled, YakThemeProvider } from 'next-yak'\n\nimport * as env from '@owl-nest/config'\nimport { t, tc } from '@owl-nest/localize'\nimport * as logger from '@owl-nest/logger'\nimport * as hooks from '@owl-nest/hooks'\nimport * as models from '@owl-nest/models'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { ConversionDisclaimer } from '../../components/money'\nimport { SelectionItem } from './components/cart/SelectionItem'\nimport { SelectionShipping } from './components/cart/SelectionShipping'\nimport { SelectionTip } from './components/cart/SelectionTip'\nimport { SelectionTotal } from './components/cart/SelectionTotal'\nimport { ServiceFee } from './components/cart/ServiceFee'\nimport { ItemsTotal } from './components/cart/ItemsTotal'\n\nimport * as ComponentStyle from './style'\nimport * as AppStyle from '../../style'\nimport { useProject } from '../../hooks/useProject'\nimport { useCart } from '../../hooks/useCart/useCart'\n\ntype Theme = {\n colors: {\n accent: string\n background: string\n hover: string\n primary: string\n }\n}\n\ntype CartProps = {\n onValidate: () => void\n scrollToRewards: () => void\n}\n\nexport function Cart({ onValidate, scrollToRewards }: CartProps) {\n const cart = useCart()\n logger.addBreadcrumb({\n category: 'checkout.selection',\n data: { cart },\n level: 'info',\n message: 'Displaying cart',\n type: 'debug',\n })\n\n const { project } = useProject()\n\n const cartHasSelectedProducts = cart.products.length > 0\n const cartHasTip = cart.tip.amount > 0\n const cartHasTipOnly = cartHasTip && cart.products.length === 0\n\n const setIsRewardTaxDeductionModalOpen = hooks.useSetModal('RewardTaxDeductionInfo')\n\n const userConfig = env.useUserEnv()\n\n const projectCurrency = project.currency\n const userCurrency = userConfig.currency\n const isDifferentCurrency = projectCurrency != userCurrency\n\n const projectColor = models.project.backgroundColor(project) ?? plume.COLORS.COMPLEMENTARY_INDIGO\n const theme: Theme = {\n colors: {\n accent: `color-mix(in srgb, ${projectColor} 20%, white)`,\n background: `color-mix(in srgb, ${projectColor} 10%, white)`,\n hover: `color-mix(in srgb, ${projectColor} 70%, black)`,\n primary: projectColor,\n },\n }\n\n return (\n <YakThemeProvider theme={models.project.isMembership(project) ? theme : {}}>\n <ComponentStyle.SelectionCard>\n {cart.isLoading && (\n <AppStyle.LoadingCard>\n <plume.Spinner />\n </AppStyle.LoadingCard>\n )}\n\n <ComponentStyle.StyledTable>\n <tbody>\n {cart.tip.amount > 0 && (\n <SelectionTip\n isDifferentCurrency={models.project.isDonationBased(project) && isDifferentCurrency}\n tip={cart.tip.amount}\n scrollTo={scrollToRewards}\n />\n )}\n\n {cart.products.length > 0 &&\n cart.products.map((product) => {\n return <SelectionItem product={product} key={product.id} />\n })}\n </tbody>\n </ComponentStyle.StyledTable>\n\n {cart.taxDeductibleTotal > 0 && (\n <plume.styles.copy.S.semiBold as=\"span\">\n <TaxInfo\n data-testid=\"component:cart.taxdeductible\"\n kind=\"primary\"\n tinted\n type=\"button\"\n onClick={() => setIsRewardTaxDeductionModalOpen(true)}\n >\n <plume.glyphs.stroke.Percent size={16} />\n {t('%(price)s after tax reduction', {\n price: plume.accounting.localeMoney(cart.taxDeductibleTotal, {\n currency: project.currency,\n lang: userConfig.lang,\n }),\n })}\n </TaxInfo>\n </plume.styles.copy.S.semiBold>\n )}\n\n {cart.addressType === 'shipping' && <SelectionShipping />}\n\n {Boolean(cart.serviceFee) && (\n <>\n {(cart.products.length > 1 || (cartHasTip && cart.products.length > 0)) && <ItemsTotal />}\n <ServiceFee\n frequency={\n models.project.isMembership(project) && cart.products.length >= 1 ? 'monthly' : cart.tip.frequency\n }\n />\n </>\n )}\n\n <SelectionTotal\n isDifferentCurrency={isDifferentCurrency}\n frequency={models.project.isMembership(project) && cart.products.length >= 1 ? 'monthly' : cart.tip.frequency}\n />\n\n {models.project.isMembership(project) && (\n <>\n {cart.products.length !== 0 && (\n <plume.Callout type=\"info\" customIcon={plume.glyphs.stroke.Reroll}>\n {tc(\n '[bold: Monthly membership]: first payment today, then every month on this date. No commitment, you can stop whenever you want.',\n { bold: <strong /> },\n )}\n </plume.Callout>\n )}\n </>\n )}\n\n <ComponentStyle.SelectionAction marginTop={isDifferentCurrency}>\n <plume.styles.button.CallToAction onClick={goToNextStep} data-testid=\"component:cart.continue\">\n {t('Continue')}\n </plume.styles.button.CallToAction>\n </ComponentStyle.SelectionAction>\n\n {!models.project.isMembership(project) && (\n <>\n <ComponentStyle.AddMoreRewards onClick={scrollToRewards} kind=\"secondary\">\n <plume.glyphs.stroke.Plus size={13} />\n {'\\xa0'}\n {t('Add a reward')}\n </ComponentStyle.AddMoreRewards>\n\n <plume.styles.copy.S.regular>\n {tc(\n \"[strong: Ulule is not an e-commerce website.] You are backing a project to contribute to its success. Ulule doesn't guarantee that the creator will succeed and isn't responsible for the creator's engagements towards its backers.\",\n { strong: <strong /> },\n )}\n </plume.styles.copy.S.regular>\n </>\n )}\n {isDifferentCurrency && <ConversionDisclaimer project={project} />}\n </ComponentStyle.SelectionCard>\n </YakThemeProvider>\n )\n\n function goToNextStep() {\n if (cartHasSelectedProducts) {\n const error =\n cart.addressType === 'shipping' &&\n ((cart.selectedShippingMode === 'home_delivery' && cart.selectedCountry === undefined) ||\n (cart.selectedShippingMode === 'pickup_point' && cart.selectedPickupPoint === undefined))\n\n cart.setShippingError(error)\n\n if (!error) {\n onValidate()\n }\n } else if (cartHasTipOnly) {\n onValidate()\n }\n }\n}\n\nconst TaxInfo = styled(plume.LinkAsButton)`\n display: block;\n margin-bottom: 8px;\n margin-top: 8px;\n margin-left: auto;\n padding: 0;\n width: fit-content;\n\n ${plume.glyphs.stroke.Percent} {\n color: ${plume.COLORS.PRIMARY_SAND_500};\n margin-right: 6px;\n margin-top: -5px;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\nimport { useInView } from 'react-intersection-observer'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as env from '@owl-nest/config'\nimport { RewardCard } from '@ulule/duvet/RewardCard.tsx'\nimport { MembershipRewardCard } from '@ulule/duvet/MembershipRewardCard.tsx'\nimport { DiscordRoleList } from '@ulule/duvet/DiscordRoleList.tsx'\nimport { t, tn, tc } from '@owl-nest/localize'\nimport * as logger from '@owl-nest/logger'\nimport * as models from '@owl-nest/models'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { useTracking } from '@owl-nest/shadow'\n\nimport { useProject } from '../../../../hooks/useProject'\nimport { useCart } from '../../../../hooks/useCart/useCart'\n\ntype RewardProps = {\n handleRemoveSelectReward: (reward: models.reward.Reward, variant?: models.variant.Variant) => void\n handleSelectReward: (\n reward: models.reward.Reward,\n variant?: models.variant.Variant,\n optionValuesIds?: number[],\n ) => void\n mode?: 'checkout' | 'popup' | 'preview' | 'project'\n reward: models.reward.Reward\n trackView?: boolean\n}\n\nexport function Reward({\n handleRemoveSelectReward,\n handleSelectReward,\n reward,\n trackView = false,\n}: RewardProps): React.ReactElement<any> {\n const { fetchVariants, project } = useProject()\n const cart = useCart()\n\n const rewardIsInCart = cart.products.some((product) => product.id === reward.id)\n const pictureSrc = models.reward.image(reward, 'full')\n\n const tracking = useTracking()\n const { ref, inView } = useInView({\n triggerOnce: true,\n })\n\n React.useEffect(() => {\n if (inView && trackView) {\n tracking.ecommerce.track('view_item', {\n items: [\n {\n item_id: String(reward.id),\n item_name: models.reward.title(reward) ?? '',\n item_brand: models.project.name(reward.project),\n price: reward.price,\n },\n ],\n })\n }\n }, [inView])\n\n if (reward.project.type === api.ProjectType.Membership) {\n const isSelected = cart.products.some((product) => product.reward.id === reward.id)\n\n return (\n <InViewDetector ref={ref}>\n <MembershipStyled\n membership={{\n description: { __html: models.reward.description(reward) },\n img: pictureSrc,\n title: models.reward.title(reward)!,\n isFree: reward.is_free ?? false,\n isFeatured: reward.is_featured,\n isHidden: reward.is_hidden,\n stock: { available: reward.stock_available ?? undefined, taken: reward.stock_taken },\n }}\n fullWidth\n maxHeight={100}\n selected={isSelected}\n showPlaceholderImage\n showSubscriptionsCount={project.show_subscriptions_count}\n cta={{\n type: 'button',\n props: {\n disabled: cart.isLoading,\n prefixIcon: isSelected ? <plume.glyphs.fill.CheckCircle size={16} /> : undefined,\n onClick: () => {\n if (rewardIsInCart) {\n handleRemoveSelectReward(reward)\n } else {\n handleSelectReward(reward)\n }\n },\n },\n }}\n translations={{\n members: ({ taken }) => tn('%(count)d member', '%(count)d members', taken, { count: taken }),\n showMore: t('Show more'),\n showLess: t('Show less'),\n soldOut: t('Sold out'),\n soonSoldOut: t('Soon sold out'),\n stockAvailable: ({ available }) => {\n return t('%(amount)d remaining', { amount: available })\n },\n cta: isSelected\n ? t('Selected')\n : tc('Subscribe for [price] / month', {\n price: (\n <plume.LocaleMoneyDisplayer\n rates={env.CURRENCIES_RATES}\n amount={reward.price}\n currency={project.currency}\n targetCurrency={project.currency}\n localeFormat={project.lang}\n />\n ),\n }),\n featuredTag: t('Featured'),\n discord: reward.socials ? DiscordRoleList(reward.socials) : undefined,\n hiddenTag: t('Secret membership'),\n }}\n />\n </InViewDetector>\n )\n }\n\n const stockOffsets = cart.products.reduce((previousValue, currentValue) => {\n return {\n ...previousValue,\n [currentValue.id]: currentValue.quantity,\n }\n }, {})\n\n return (\n <InViewDetector ref={ref}>\n <RewardStyled\n reward={reward}\n selected={rewardIsInCart}\n stockOffsets={stockOffsets}\n fullWidth\n disabled={cart.isLoading}\n onSelect={{\n reward: () => {\n if (rewardIsInCart) {\n handleRemoveSelectReward(reward)\n } else {\n handleSelectReward(reward)\n }\n },\n variant: async (rewardId, optionValuesIds, resolvedVariantId) => {\n logger.addBreadcrumb({\n category: 'checkout.onSelect',\n data: { rewardId, resolvedVariantId, optionValuesIds },\n level: 'info',\n message: 'Reward has resolved variant…',\n type: 'debug',\n })\n if (optionValuesIds && optionValuesIds.length >= 1) {\n if (project.rewards) {\n await fetchVariants(rewardId, optionValuesIds)\n const freshReward = project.rewards.find((freshReward) => freshReward.id === reward.id)\n if (freshReward) {\n const modeledReward = models.reward.Reward(freshReward, project)\n const resolvedVariant = modeledReward.variants.find(\n (variant) => variant.id === Number(resolvedVariantId),\n )\n\n logger.addBreadcrumb({\n category: 'checkout.onSelect',\n data: { rewardId, resolvedVariantId, optionValuesIds },\n level: 'info',\n message: 'Reward has resolved variant…',\n type: 'debug',\n })\n\n handleSelectReward(\n modeledReward,\n resolvedVariant,\n optionValuesIds.map((valueId) => Number(valueId)),\n )\n return\n }\n }\n } else {\n handleSelectReward(\n reward,\n reward.variants.find((variant) => variant.id === Number(rewardId)),\n )\n }\n },\n }}\n />\n </InViewDetector>\n )\n}\n\nexport const RewardStyled = styled(RewardCard)``\n\n// HACK: This wrapper is only here to avoid using forwardRef. When moving to\n// React 19, please remove it and pass `className` and `ref` as props.\n// Come on, don't pretend you didn't see this comment, telling yourself\n// someone else will do it later. Be that person, now is the time to shine.\n// Thank you!\nconst InViewDetector = styled.div`\n max-width: 374px;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n max-width: 524px;\n }\n`\n\nexport const MembershipStyled = styled(MembershipRewardCard)`\n max-width: none;\n`\n","export function getFilterFromUrlParams(): { type: 'reward'; rewards: number[] } | { type: 'donation' } {\n const filter = new URLSearchParams(location.search).get('filter')\n\n if (filter === null) {\n return { type: 'reward', rewards: [] }\n }\n\n if (filter === 'donation') {\n return { type: 'donation' }\n }\n\n return {\n type: 'reward',\n rewards: filter\n .split(',')\n .map((id) => Number(id.trim()))\n .filter((id) => !Number.isNaN(id)),\n }\n}\n\nexport function matchFilter(id: number) {\n const filter = getFilterFromUrlParams()\n\n if (filter.type === 'donation') {\n return false\n }\n\n if (filter.rewards.length === 0) {\n return true\n }\n\n return filter.rewards.some((whitelistId) => whitelistId === id)\n}\n","import * as React from 'react'\nimport { styled, YakThemeProvider } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as logger from '@owl-nest/logger'\nimport * as models from '@owl-nest/models'\nimport { useTracking } from '@owl-nest/shadow'\n\nimport { Reward } from './components/rewards/Reward'\nimport { useCart } from '../../hooks/useCart/useCart'\nimport { useProject } from '../../hooks/useProject'\nimport { matchFilter } from '../../utils/filter'\n\ntype Theme = {\n colors: {\n accent: string\n background: string\n hover: string\n primary: string\n }\n}\n\ntype RewardListProps = {\n rewards: models.reward.Reward[]\n scrollToCart: () => void\n}\n\nexport function RewardList({ rewards, scrollToCart }: RewardListProps) {\n const { project } = useProject()\n\n const cart = useCart()\n\n const tracking = useTracking()\n\n const featuredReward = rewards.find((reward) => reward.is_featured && matchFilter(reward.id))\n\n const projectColor = models.project.backgroundColor(project) ?? plume.COLORS.COMPLEMENTARY_INDIGO\n const theme: Theme = {\n colors: {\n accent: `color-mix(in srgb, ${projectColor} 20%, white)`,\n background: `color-mix(in srgb, ${projectColor} 10%, white)`,\n hover: `color-mix(in srgb, ${projectColor} 70%, black)`,\n primary: projectColor,\n },\n }\n\n return (\n <List>\n <YakThemeProvider theme={models.project.isMembership(project) ? theme : {}}>\n {featuredReward && (\n <Reward\n handleRemoveSelectReward={handleRemoveSelectReward}\n handleSelectReward={handleSelectReward}\n reward={featuredReward}\n trackView\n />\n )}\n {getListRewards()}\n </YakThemeProvider>\n </List>\n )\n\n function handleSelectReward(\n reward: models.reward.Reward,\n variant?: models.variant.Variant,\n optionValuesIds?: number[],\n ) {\n logger.addBreadcrumb({\n category: 'ui.click',\n data: { reward, variant, optionValuesIds },\n level: 'info',\n message: 'Adding selected reward to cart…',\n type: 'debug',\n })\n\n if (models.project.isMembership(reward.project)) {\n cart.resetProducts()\n }\n const cartProduct = cart.products.find((product) => product.id === variant?.id || product.id === reward.id)\n const quantity = cartProduct?.quantity\n\n logger.addBreadcrumb({\n category: 'checkout.selection',\n data: { cartProduct, quantity, reward, variant },\n level: 'info',\n message: 'Adding selected reward to cart…',\n type: 'debug',\n })\n\n cart.setProduct(\n variant?.id ?? reward.id,\n quantity ?? 1,\n { createIfNotFound: true, withDelay: true },\n // NOTE: the parent is what makes a variant resolvable again on the next cart\n // load, so it has to be kept for every variant, options or not.\n variant !== undefined ? reward.id : undefined,\n optionValuesIds,\n )\n tracking.ecommerce.track('add_to_cart', {\n currency: project.currency,\n value: reward.price,\n items: [\n {\n item_id: String(reward.id),\n item_name: models.reward.title(reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: variant && String(variant.id),\n price: reward.price,\n quantity: quantity ?? 1,\n },\n ],\n })\n\n scrollToCart()\n }\n\n function handleRemoveSelectReward(reward: models.reward.Reward, variant?: models.variant.Variant) {\n cart.setProduct(variant?.id ?? reward.id, 0)\n }\n\n function getListRewards() {\n return rewards\n .filter(\n (reward) =>\n !reward.is_featured &&\n !(reward.project.type === api.ProjectType.Membership && reward.is_free) &&\n matchFilter(reward.id),\n )\n .map((reward, index) => {\n return (\n <div key={index}>\n <Reward\n handleRemoveSelectReward={handleRemoveSelectReward}\n handleSelectReward={handleSelectReward}\n reward={reward}\n trackView\n />\n </div>\n )\n })\n }\n}\n\nconst List = styled.div`\n display: grid;\n grid-row-gap: 24px;\n grid-template-columns: 1fr;\n margin-top: 6px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport { Tip, TipContainerWrapper, InputRadioWrapper, RemoveButton } from '@owl-nest/tip'\nimport { BREAKPOINTS, styles as S } from '@ulule/owl-kit-components/next'\nimport * as shadow from '@owl-nest/shadow'\n\nimport { useProject } from '../../hooks/useProject'\nimport { useCart } from '../../hooks/useCart/useCart'\n\ntype ItemTipProps = {\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n scrollToCart: () => void\n}\n\nexport function ItemTip({ preFilledTip, scrollToCart }: ItemTipProps): React.ReactElement<ItemTipProps> {\n const { project } = useProject()\n const cart = useCart()\n\n const tip = cart.tip ?? preFilledTip?.amount ?? 0\n const tracking = shadow.useTracking()\n\n return (\n <Wrapper className=\"tip-view-tip-component\">\n <S.copy.M.light>{t('Just a donation to contribute to the success of the project!')}</S.copy.M.light>\n <StyledTip\n handleFormSubmit={(values) => {\n cart.setTip(values.donation ? Number(values.donation) : 0, { withDelay: tip.amount !== values.donation })\n scrollToCart()\n }}\n project={project}\n preFilledTip={{\n amount: tip.amount,\n }}\n translations={{\n submit: tip.amount > 0 ? t('Edit') : t('Add'),\n placeholder: t('5, 10, 25, 50, whatever you want!'),\n }}\n removable={tip.amount > 0}\n />\n </Wrapper>\n )\n}\n\nconst StyledTip = styled(Tip)`\n padding-left: 0px;\n padding-right: 0px;\n\n ${TipContainerWrapper} {\n flex-wrap: wrap;\n justify-content: center;\n }\n\n @media screen and ${BREAKPOINTS.TABLET} {\n ${TipContainerWrapper} {\n justify-content: space-between;\n }\n\n ${InputRadioWrapper} {\n width: calc(20% - 10px);\n }\n\n ${RemoveButton} {\n margin-top: 0;\n padding: 0px;\n width: auto;\n position: absolute;\n right: 0px;\n top: -41px;\n }\n }\n`\n\nconst Wrapper = styled.div`\n position: relative;\n\n ${S.copy.M.light} {\n margin-bottom: 10px;\n }\n`\n","import * as React from 'react'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as shadow from '@owl-nest/shadow'\n\nimport { useNavigation } from '../../hooks/useNavigation'\nimport * as productUtils from '../../utils/product'\nimport { scrollToCurrentItem } from '../../utils/scrollTo'\n\nimport { Cart } from './Cart'\nimport { Item } from '../../components/Item'\nimport { RewardList } from './RewardList'\nimport { ItemTip } from './ItemTip'\nimport * as ComponentStyle from './style'\nimport { useProject } from '../../hooks/useProject'\nimport { useRevealedRewards } from '../../hooks/useRevealedRewards'\nimport { useCart } from '../../hooks/useCart/useCart'\n\ntype SelectionViewProps = {\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n}\n\nexport function SelectionView({ preFilledTip }: SelectionViewProps): React.ReactElement<SelectionViewProps> {\n const cart = useCart()\n const { project } = useProject()\n\n const isMembershipProject = models.project.isMembership(project)\n\n const navigation = useNavigation()\n const rewards = useRewards()\n\n const cartRef = React.useRef<HTMLDivElement>(null)\n const rewardsRef = React.useRef(null)\n const tracking = shadow.useTracking()\n\n React.useEffect(() => {\n cart.resetAddresses()\n scrollToCurrentItem(cartRef.current)\n }, [])\n\n return (\n <ComponentStyle.SelectionWrapper data-testid=\"view:selection\">\n {!cart.isEmpty && (\n <Item ref={cartRef} title={t('Your selection')} testid=\"component:cart\">\n <Cart\n scrollToRewards={() => scrollToCurrentItem(rewardsRef.current)}\n onValidate={() => {\n tracking.ecommerce.track('begin_checkout', {\n currency: project.currency,\n value: cart.subTotal,\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n navigation.navigate(navigation.nextLegalPage)\n }}\n />\n </Item>\n )}\n <ComponentStyle.OrderedItem\n ref={rewardsRef}\n title={\n cart.isEmpty\n ? isMembershipProject\n ? t('Choose your membership')\n : t('Choose your rewards')\n : isMembershipProject\n ? t('Choose another membership')\n : t('You can add another reward')\n }\n >\n <RewardList rewards={rewards} scrollToCart={() => scrollToCurrentItem(cartRef.current)} />\n </ComponentStyle.OrderedItem>\n {project.type !== api.ProjectType.Membership && (\n <ComponentStyle.OrderedItem title={t('Support with a donation')}>\n <ItemTip preFilledTip={preFilledTip} scrollToCart={() => scrollToCurrentItem(cartRef.current)} />\n </ComponentStyle.OrderedItem>\n )}\n </ComponentStyle.SelectionWrapper>\n )\n}\n\nfunction useRewards(): models.reward.Reward[] {\n const { project } = useProject()\n const revealedRewards = useRevealedRewards()\n\n function isRevealedReward(reward: api.Reward): boolean {\n return revealedRewards.some((revealedRewardId: number) => {\n if (reward.variants?.length) {\n return reward.variants?.some((variant) => variant.id === revealedRewardId) || revealedRewardId === reward.id\n }\n return revealedRewardId === reward.id\n })\n }\n\n function getModeledRewards(): models.reward.Reward[] {\n const rewards =\n project === undefined || project.rewards === null || project.rewards === undefined\n ? []\n : project.rewards.reduce<models.reward.Reward<any>[]>((rewards, reward) => {\n if (reward.is_hidden) {\n if (!isRevealedReward(reward)) return rewards\n }\n if (reward.is_archived) {\n return rewards\n }\n\n rewards.push(models.reward.Reward(reward, project))\n return rewards\n }, [])\n\n return rewards\n }\n\n const rewards = getModeledRewards()\n return productUtils.orderRewardsAvailableFirst(rewards)\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\n\ntype StepTitleProps = {\n index: number\n className?: string\n children: React.ReactNode\n}\n\nfunction StepTitleComponent({ index, children, className }: StepTitleProps) {\n return (\n <div className={className}>\n <BackgroundCircle>\n <plume.styles.copy.S.regular>{index}</plume.styles.copy.S.regular>\n </BackgroundCircle>\n <plume.styles.copy.M.semiBold>{children}</plume.styles.copy.M.semiBold>\n </div>\n )\n}\n\nexport const StepTitle = styled(StepTitleComponent)`\n display: flex;\n margin: 24px 0;\n`\n\nconst BackgroundCircle = styled.div`\n width: 27px;\n height: 27px;\n background-color: ${plume.COLORS.PRIMARY_SAND_100};\n border-radius: 28px;\n color: ${plume.COLORS.PRIMARY_SAND_700};\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 8px;\n\n ${plume.styles.copy.S.regular} {\n margin-bottom: 2px;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\nimport * as formik from 'formik'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as utils from '@owl-nest/utils'\nimport * as models from '@owl-nest/models'\nimport * as env from '@owl-nest/config'\n\nimport { StepTitle } from './StepTitle'\nimport { type CartMethods } from '../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../hooks/useCart/format'\nimport { useProject } from '../../hooks/useProject'\n\ntype MondialRelayStep1Props = {\n cart: ShippingCart & CartMethods\n}\n\nexport function MondialRelayStep1({ cart }: MondialRelayStep1Props) {\n const [phoneCountryCode, setPhoneCountryCode] = React.useState<string | undefined>(undefined)\n const defaultPhoneCountry = env.COUNTRIES.find((country) => country.code === env.USER_COUNTRY) || env.COUNTRIES[0]\n const { project } = useProject()\n\n const deliveryCountries = Object.entries(cart.rates.mondialRelay)\n .reduce(\n (countries, [code, rate]) => {\n const country = env.COUNTRIES.find((country) => country.code === code)\n if (country === undefined) {\n return countries\n }\n\n countries.push({\n label: utils.shipping.getShippingOptionLabel(country.label(), rate, models.project.currencySymbol(project)),\n code: code,\n })\n\n return countries\n },\n [] as { label: string; code: string }[],\n )\n .sort((a, b) => a.label.localeCompare(b.label))\n\n return (\n <Wrapper>\n <StepTitle index={1}>{t('Enter your contact details')}</StepTitle>\n\n <IdentityGroup>\n <formik.Field name=\"firstName\">\n {({ field, meta }: formik.FieldProps<string>) => {\n return (\n <plume.TextField\n data-testid=\"component:address.first_name\"\n label={t('First name')}\n value={field.value}\n name={field.name}\n onChange={field.onChange}\n onBlur={field.onBlur}\n error={meta.touched && meta.error}\n />\n )\n }}\n </formik.Field>\n\n <formik.Field name=\"lastName\">\n {({ field, meta }: formik.FieldProps<string>) => {\n return (\n <plume.TextField\n data-testid=\"component:address.last_name\"\n label={t('Last name')}\n value={field.value}\n name={field.name}\n onChange={field.onChange}\n onBlur={field.onBlur}\n error={meta.touched && meta.error}\n />\n )\n }}\n </formik.Field>\n </IdentityGroup>\n\n <formik.Field name=\"phoneNumber\">\n {({ field, meta, form }: formik.FieldProps<string>) => {\n return (\n <plume.PhoneField\n countries={env.COUNTRIES}\n defaultCountry={defaultPhoneCountry.code}\n data-testid=\"component:address.phone_number\"\n label={t('Phone number')}\n context={t('to facilitate delivery')}\n value={{ number: field.value, country: phoneCountryCode }}\n name={field.name}\n onChange={(phone: { number: string; country?: string }) => {\n setPhoneCountryCode(phone.country)\n form.setValues({\n ...form.values,\n phone_number_country: phone.country as utils.phone.CountryCode,\n phoneNumber: phone.number,\n })\n }}\n onBlur={field.onBlur}\n error={meta.touched && meta.error}\n />\n )\n }}\n </formik.Field>\n\n <plume.SelectField\n data-testid=\"component:address.country\"\n label={t('Shipping country')}\n selected={cart.selectedCountry ? [cart.selectedCountry?.code] : undefined}\n onChange={(selected) => {\n cart.setSelectedCountry(selected[0])\n }}\n disabled={deliveryCountries.length === 1}\n >\n {deliveryCountries.map((option) => {\n return <plume.Option key={option.code} value={option.code} label={option.label} />\n })}\n </plume.SelectField>\n </Wrapper>\n )\n}\n\nconst Wrapper = styled.div`\n ${plume.Select} {\n z-index: 3;\n }\n\n ${plume.PhoneField} {\n margin-bottom: 24px;\n }\n`\n\nexport const IdentityGroup = styled(plume.styles.controls.Group)`\n margin: 20px 0 20px;\n\n ${plume.TextField} {\n flex: 1;\n\n &:first-child {\n margin-right: 10px;\n }\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\nimport * as formik from 'formik'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as env from '@owl-nest/config'\n\nimport { StepTitle } from './StepTitle'\nimport { type CartMethods } from '../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../hooks/useCart/format'\nimport { useProject } from '../../hooks/useProject'\nimport { DropoffPicker } from '@ulule/duvet/DropoffPicker.tsx'\nimport { type Location } from '@ulule/duvet/LocationPicker.tsx'\n\ntype MondialRelayStep1Props = {\n cart: ShippingCart & CartMethods\n}\n\nexport function MondialRelayStep2({ cart }: MondialRelayStep1Props) {\n const { project } = useProject()\n\n return (\n <Wrapper data-testid=\"view:address:mondial.relay.step2\">\n <StepTitle index={2}>{t('Find a drop-off point')}</StepTitle>\n\n <formik.Field name=\"dropoff\">\n {({ field, meta, form }: formik.FieldProps<Location>) => {\n return (\n <>\n <DropoffPicker\n selected={field.value?.id}\n onSelect={(location) => {\n form.setFieldValue(field.name, location)\n }}\n addressQuery={cart.selectedMondialRelay?.address}\n onAddressChange={(address) =>\n cart.setMondialRelay({\n address,\n })\n }\n projectId={project.id}\n countries={env.COUNTRIES}\n mapboxApiKey={env.MAPBOX_API_KEY}\n countryFilter={\n cart.selectedCountry?.code\n ? [cart.selectedCountry?.code]\n : ['DE', 'AT', 'BE', 'ES', 'IT', 'LU', 'NL', 'PT', 'FR']\n }\n />\n <plume.styles.field.Message type=\"error\">{meta.touched && meta.error}</plume.styles.field.Message>\n </>\n )\n }}\n </formik.Field>\n </Wrapper>\n )\n}\n\nconst Wrapper = styled.div`\n ${plume.AutocompleteField} {\n z-index: 3;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\nimport * as formik from 'formik'\nimport * as phone from 'libphonenumber-js'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport { t } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as yup from '@owl-nest/validators'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as utils from '@owl-nest/utils'\n\nimport { Item } from '../../components/Item'\nimport { type CartMethods } from '../../hooks/useCart/useCart'\nimport { type ShippingCart } from '../../hooks/useCart/format'\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\nimport { MondialRelayStep1 } from './MondialRelayStep1'\nimport { MondialRelayStep2 } from './MondialRelayStep2'\n\ntype MondialRelayItemProps = {\n cart: ShippingCart & CartMethods\n project: api.Project\n className?: string\n onContinue: () => void\n}\n\nconst Center = styled.div`\n text-align: center;\n`\n\nconst MondialRelayItemComponent = React.forwardRef<HTMLDivElement, MondialRelayItemProps>(function PickupItemComponent(\n { cart, project, className, onContinue },\n ref,\n) {\n const navigation = useNavigation()\n\n return (\n <Item title={t('Mondial Relay delivery')} ref={ref} className={className} testid=\"view:address:mondial.relay\">\n {project.date_delivery && (\n <plume.Callout type=\"info\">\n {t(\n 'The project owner estimates delivering rewards around %(date)s. You can always change your drop-off point later if you need to.',\n {\n date: models.project.getShippingFormattedDate(project),\n },\n )}\n </plume.Callout>\n )}\n\n <formik.Formik\n initialValues={{\n firstName: cart.selectedMondialRelay?.firstName ?? '',\n lastName: cart.selectedMondialRelay?.firstName ?? '',\n phoneNumber: cart.selectedMondialRelay?.phoneNumber ?? '',\n phone_number_country: '',\n country: cart.selectedCountry?.code,\n dropoff: cart.selectedMondialRelay?.dropoff ?? undefined,\n }}\n onSubmit={(values) => {\n const phoneNumber = utils.phone.normalizePhoneNumber(\n values.phoneNumber,\n values.phone_number_country as phone.CountryCode,\n )\n\n cart.setMondialRelay({\n firstName: values.firstName,\n lastName: values.lastName,\n phoneNumber: phoneNumber,\n dropoff: values.dropoff,\n })\n onContinue()\n }}\n validationSchema={yup.lazy((values) =>\n yup.object({\n firstName: yup.string().required(),\n lastName: yup.string().required(),\n phoneNumber: yup.phone({ country: values?.phone_number_country as phone.CountryCode }).required(),\n country: yup.string().required(),\n dropoff: yup.mixed().required(),\n }),\n )}\n >\n {(formikBag) => {\n return (\n <form noValidate onSubmit={formikBag.handleSubmit}>\n <MondialRelayStep1 cart={cart} />\n <MondialRelayStep2 cart={cart} />\n\n <plume.styles.button.Button data-testid=\"component:address.continue\">\n {t('Continue')}\n </plume.styles.button.Button>\n </form>\n )\n }}\n </formik.Formik>\n <Center>\n <plume.styles.copy.S.regular>\n <plume.Link\n kind=\"secondary\"\n onClick={() => {\n navigation.navigate(PAGES.SELECTION)\n }}\n >\n {t('Change delivery method')}\n </plume.Link>\n </plume.styles.copy.S.regular>\n </Center>\n </Item>\n )\n})\n\nexport const MondialRelayItem = styled(MondialRelayItemComponent)`\n ${plume.RadioGroupField} {\n margin: 20px 0;\n }\n\n ${plume.RadioField} {\n ${plume.glyphs.stroke.MapCursor} {\n color: ${plume.COLORS.PRIMARY_GREY_500};\n margin-right: 4px;\n }\n\n ${plume.styles.field.Title} {\n margin-right: 8px;\n color: ${plume.COLORS.TEXT_PRIMARY} !important;\n\n ${plume.styles.heading.XXXS} {\n display: inline;\n }\n }\n\n ${plume.styles.field.Context} {\n white-space: pre-wrap;\n }\n }\n\n ${plume.styles.button.Button} {\n width: 100%;\n margin-top: 24px;\n }\n\n ${Center} {\n margin: 20px 0 0;\n }\n`\n","import * as React from 'react'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as models from '@owl-nest/models'\n\nimport { Item } from '../../components/Item'\nimport { FutureItem } from '../../components/FutureItem'\nimport { CartSummary } from '../../components/selection'\nimport { IdentityItem } from '../../components/IdentityItem'\nimport { useScrollToAnonymous } from '../../hooks/useScrollToAnonymous'\nimport { PAGES, useNavigation } from '../../hooks/useNavigation'\nimport { MondialRelayItem } from './MondialRelayItem'\nimport { useProject } from '../../hooks/useProject'\nimport { useCart } from '../../hooks/useCart/useCart'\n\nexport function MondialRelayView(): React.ReactElement<unknown> | null {\n const navigation = useNavigation()\n const cart = useCart()\n const { project } = useProject()\n\n const auth = services.user.useAuth()\n\n // True when the user has already provided shipping info on a previous visit to this step.\n // Determines whether to scroll to the shipping summary or to the anonymous toggle on load.\n const hasFilledShipping = Boolean(cart.addressType === 'shipping' && (cart.billingAddress || cart.shippingAddress))\n const { shippingsBoxRef, anonymousBoxRef } = useScrollToAnonymous(hasFilledShipping, cart.isLoading)\n\n const tracking = shadow.useTracking()\n\n if (cart.addressType !== 'shipping') {\n return <></>\n }\n\n return (\n <>\n <Item\n title={t('Your selection')}\n action={{\n handler: () => {\n navigation.navigate(PAGES.SELECTION, { forceStep: true })\n },\n text: t('Edit'),\n }}\n >\n <CartSummary />\n </Item>\n\n <IdentityItem ref={anonymousBoxRef} />\n\n {auth.type !== 'loggedin' ? (\n <Item title={t('Mondial Relay delivery')}>\n <plume.Spinner />\n </Item>\n ) : (\n <MondialRelayItem ref={shippingsBoxRef} cart={cart} project={project} onContinue={handleContinue} />\n )}\n\n {<FutureItem title={t('Billing address')} />}\n <FutureItem title={t('Payment')} />\n </>\n )\n\n function handleContinue() {\n tracking.ecommerce.track('add_shipping_info', {\n value: cart.subTotal,\n currency: project.currency,\n shipping_tier: 'mondial_relay',\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n\n navigation.navigate(navigation.nextLegalPage)\n }\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport * as hooks from '@owl-nest/hooks'\nimport { t, tc } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport { useCart } from '../../hooks/useCart/useCart'\n\ntype TipTaxReceiptInfoProps = {\n project: api.Project\n}\n\nexport function RewardTaxDeductionModal({ project }: TipTaxReceiptInfoProps): React.ReactElement<any> {\n const cart = useCart()\n const [isTaxReceiptModalOpen, setIsTaxReceiptModalOpen] = hooks.useModal('RewardTaxDeductionInfo')\n\n const cartRewards = cart.products.map((product) => (product.variant ? product.reward.id : product.id))\n const taxDeductibleRate = Number(cart.taxDeductibleRate ?? project?.tax_deductible_rate ?? 66)\n\n const filteredRewards = project.rewards\n ? project.rewards.filter((reward) => cartRewards.includes(reward.id) && reward.tax_deductible)\n : undefined\n\n return (\n <ModalWithIcon\n open={isTaxReceiptModalOpen}\n closable\n onClose={() => setIsTaxReceiptModalOpen(false)}\n buttons={[\n {\n type: 'button',\n props: {\n kind: 'primary',\n type: 'button',\n onClick: () => setIsTaxReceiptModalOpen(false),\n children: t('Close'),\n },\n },\n ]}\n icon={<plume.illustrations.twoToned.SecurePaymentMedium size={127} />}\n svgScale={0.9}\n >\n <plume.styles.heading.S>\n {t('The following items are %(rate)s tax-deductible:', {\n rate: `${taxDeductibleRate}%`,\n })}\n </plume.styles.heading.S>\n <ul>\n {cart.tip.amount !== 0 && (\n <li>\n <plume.styles.copy.M.light>{t('Donation (without reward)')}</plume.styles.copy.M.light>\n </li>\n )}\n {filteredRewards &&\n filteredRewards.map((reward) => {\n return (\n <li key={reward.id}>\n <plume.styles.copy.M.light>\n {models.reward.title(models.reward.Reward(reward, project))}\n </plume.styles.copy.M.light>\n </li>\n )\n })}\n </ul>\n\n {project.tax_receipt_enabled ? (\n <plume.styles.copy.M.light>\n {tc(\n 'The owner of this fundraiser declares itself to be an organization of general interest or recognized public utility. [br][br] Following payment, you will receive by email a tax receipt that can give rise to an income tax reduction of up to %(rate)s, within the limit of %(maximumRate)s of your taxable income (only if you are taxed on income in France).',\n {\n br: <br />,\n rate: `${taxDeductibleRate}%`,\n maximumRate: '20%',\n },\n )}\n </plume.styles.copy.M.light>\n ) : (\n <plume.styles.copy.M.light>\n {tc(\n 'The owner of this fundraiser declares themself as an organization of general interest or recognized public utility.[br][br]They will provide you with a tax receipt that can allow you up to a %(rate)s income tax reduction for a maximum of %(maximumRate)s of your taxable income (only if you are taxed on income in France).',\n {\n br: <br />,\n rate: `${taxDeductibleRate}%`,\n maximumRate: '20%',\n },\n )}\n </plume.styles.copy.M.light>\n )}\n </ModalWithIcon>\n )\n}\n\nconst ModalWithIcon = styled(plume.ModalWithIcon)`\n ${plume.ModalIconWrapper} {\n margin-bottom: 10px;\n }\n\n ${plume.styles.heading.S} {\n margin-bottom: 10px;\n }\n`\n","export const PAGES = {\n PROCESSING: '/endfunnel/processing',\n CANCELED: '/endfunnel/cancelled',\n ABORTED: '/endfunnel/aborted',\n DONE: '/endfunnel/done',\n} as const\n","import { styled } from 'next-yak'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { styles } from '@owl-nest/utils'\n\nexport const Container = styled.div`\n margin: 20px auto;\n padding: 0 15px;\n max-width: 520px;\n text-align: center;\n box-sizing: content-box;\n\n @media (min-width: 550px) {\n padding: 0 0;\n }\n`\n\nexport const Headline = styled(plume.styles.heading.XS)`\n text-align: left;\n margin-bottom: 1.75em;\n`\n\nexport const PullingContainer = styled.div`\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n box-shadow: ${plume.EFFECTS.SHADOW_1};\n padding: 30px;\n text-align: center;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n border-radius: 6px;\n margin: -32px auto 0;\n max-width: 600px;\n }\n`\n\nexport const SkipLink = styled(plume.Link).attrs({ kind: 'secondary', underlined: true })`\n display: block;\n margin-top: 20px;\n\n ${plume.styles.copy.S.regular} {\n color: ${plume.COLORS.TEXT_TERTIARY};\n }\n`\n\n// FIXME= Replace with a proper Plume title\nexport const Title = styled.div`\n color: ${plume.COLORS.TEXT_PRIMARY};\n font-size: ${() => styles.rem(24)}; // HACK: Irregular font manipulation\n font-weight: 700;\n`\n\nexport const TextContainer = styled.div`\n text-align: center;\n margin-bottom: 20px;\n`\n\nexport const Banner = styled(plume.Banner)`\n position: relative;\n top: 0;\n`\n","import * as React from 'react'\nimport { useNavigate } from 'react-router'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as consent from '@owl-nest/consent'\nimport * as date from '@owl-nest/date'\nimport { t, tc } from '@owl-nest/localize'\nimport * as models from '@owl-nest/models'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport * as UFE from '../../utils/UFE'\nimport { setTrackingOrderInLocalStorage, getTrackingOrderFromLocalStorage } from '../../utils/localStorage'\nimport { useProject } from '../../hooks/useProject'\nimport { PAGES } from './PAGES'\nimport { Banner, Container, TextContainer, Title } from './style'\n\nconst LOCALSTORAGE_LIFETIME = 1000 * 60 * 30 // 30 min\n\ntype ProcessingProps = {\n orderId: number\n returnUrl?: string\n}\n\nexport function Processing({ orderId, returnUrl }: ProcessingProps) {\n const orderService = services.order.useOrder(orderId, { fetchOnMount: false })\n const currentOrder = React.useRef(orderService.response.data)\n currentOrder.current = orderService.response.data\n\n const { project } = useProject()\n const tracking = shadow.useTracking()\n\n services.cart.removeCartFromLocalStorage(project.id)\n\n const navigate = useNavigate()\n\n React.useEffect(() => {\n document.title = `${t('Confirmed payment')} - ${models.project.name(project)}`\n }, [])\n\n React.useEffect(() => {\n const handle = setInterval(() => {\n if (currentOrder.current !== undefined && models.order.isCancelled(currentOrder.current)) {\n navigate({\n pathname: PAGES.CANCELED,\n search: new URLSearchParams({ order_id: String(orderId) }).toString(),\n })\n } else if (currentOrder.current !== undefined && models.order.isFailed(currentOrder.current)) {\n navigate({\n pathname: PAGES.ABORTED,\n search: new URLSearchParams({ order_id: String(orderId) }).toString(),\n })\n } else if (currentOrder.current !== undefined && models.order.isSucceeded(currentOrder.current)) {\n trackOrder(currentOrder.current, project, tracking)\n if (returnUrl) {\n const parsedReturnUrl = new URL(returnUrl, document.baseURI)\n const isExternal = !parsedReturnUrl.pathname.startsWith(`/projects/${project.id}/checkout`)\n if (isExternal) {\n window.location.href = returnUrl\n } else {\n navigate({\n pathname: returnUrl,\n search: new URLSearchParams({ order_id: String(orderId) }).toString(),\n })\n }\n } else {\n navigate({\n pathname: PAGES.DONE,\n search: new URLSearchParams({ order_id: String(orderId) }).toString(),\n })\n }\n } else {\n orderService.query()\n }\n }, 1000)\n\n return () => clearInterval(handle)\n }, [])\n\n return (\n <>\n <Banner type=\"info\">\n <Title>{t('Your payment is processing')}\n \n\n \n \n \n {tc(\n 'Your payment is processing, if nothing happens, please contact the support. Do not hesitate to send an email to [link: %(support_email)s]',\n {\n link: ,\n support_email: UFE.SUPPORT_EMAIL,\n },\n )}\n \n \n \n \n \n )\n}\n\nfunction trackOrder(order: api.Order, project: api.Project, tracking: shadow.TrackingContext): void {\n consent.whenGivenFor(consent.Vendor.GOOGLE_ANALYTICS, {\n do: () => {\n const trackingOrder = getTrackingOrderFromLocalStorage(order.id)\n const orderTimestamp = date.parseISO(order.created_at).getTime()\n\n if (trackingOrder === undefined && +new Date() - orderTimestamp < LOCALSTORAGE_LIFETIME) {\n tracking.ecommerce.track('purchase', {\n value: order.order_subtotal,\n currency: project.currency,\n transaction_id: order.id.toString(),\n shipping: order.order_shipping_total,\n items: [\n ...(order.items?.map((product) => {\n const reward = models.orderItem.getReward(product, project)\n const variant = models.orderItem.getVariant(product, project)\n return {\n item_id: String(product.reward.id),\n item_name: (reward && models.reward.title(reward)) ?? '',\n item_brand: models.project.name(project),\n item_variant: String(variant?.id),\n price: product.unit_price,\n quantity: product.quantity,\n }\n }) || []),\n ...(order.tip !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: order.tip,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n\n setTrackingOrderInLocalStorage(order.id)\n }\n },\n })\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as api from '@owl-nest/api-client/next'\nimport type { YakComponentOf, PolymorphicComponent } from '@owl-nest/yak/extra-runtime'\n\ntype RetryButtonProps = { project: api.Project }\n\nexport function RetryButton({ project }: RetryButtonProps) {\n return (\n \n )\n}\n\ntype BackButtonProps = { project: api.Project }\n\nexport function BackButton({ project }: BackButtonProps) {\n return (\n \n )\n}\n\nconst Button = styled(plume.styles.button.CallToAction)`\n margin: 10px 0;\n` as YakComponentOf>\n\nconst ButtonText = styled.span`\n padding: 10px;\n`\n\nconst ButtonIcon = styled.svg`\n display: inline-block;\n width: 1em;\n height: 1em;\n fill: currentColor;\n fill-rule: evenodd;\n`\n","import * as React from 'react'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as api from '@owl-nest/api-client/next'\n\nimport * as UFE from '../../utils/UFE'\nimport { useProject } from '../../hooks/useProject'\nimport { Container, Title, TextContainer, Banner } from './style'\nimport { BackButton, RetryButton } from './components/Buttons'\n\ntype AbortedProps = {\n order: api.Order\n}\n\nexport function Aborted({ order }: AbortedProps) {\n const { project } = useProject()\n\n React.useEffect(() => {\n document.title = t('Payment Aborted')\n }, [])\n\n return (\n <>\n \n {t('Oops... An error occurred while processing your payment.')}\n \n\n
\n \n \n {order?.error_code == 'no-stock-available' ? (\n \n {t('This transaction was cancelled due to a stock issue. No charges were made.')}\n \n ) : (\n \n {t('This transaction has been aborted. No charges were made.')}\n \n )}\n \n \n \n {tc(\n 'If you have questions about this project, you can contact the project owner [link: %(username)s] who will answer you.',\n {\n link: ,\n username: project.owner.username,\n },\n )}\n \n \n\n \n \n {tc('If you have questions about Ulule, do not hesitate to send an email to [link: %(support_email)s]', {\n link: ,\n support_email: UFE.SUPPORT_EMAIL,\n })}\n \n \n\n \n \n \n
\n \n )\n}\n","import * as React from 'react'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nimport * as UFE from '../../utils/UFE'\nimport { useProject } from '../../hooks/useProject'\nimport { Banner, Container, TextContainer, Title } from './style'\nimport { BackButton, RetryButton } from './components/Buttons'\n\nexport function Canceled() {\n const { project } = useProject()\n const projectOwner = project.owner\n\n return (\n <>\n \n {t('Your contribution has been cancelled')}\n \n\n \n \n {t('That is a shame!')}\n \n \n \n {t('Is there a particular reason why you finally decided not to support this project?')}\n \n \n \n \n {tc(\n 'If you have questions about this project, you can contact the project owner [link: %(username)s] who will answer you.',\n {\n link: ,\n username: projectOwner.username,\n },\n )}\n \n \n \n \n {tc('If you have questions about Ulule, do not hesitate to send an email to [link: %(support_email)s]', {\n link: ,\n support_email: UFE.SUPPORT_EMAIL,\n })}\n \n \n\n \n \n \n \n )\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t, tc } from '@owl-nest/localize'\nimport { MoneyDisplayer } from '@owl-nest/money'\nimport { Sponsor } from '@ulule/owl-kit-components'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as shadow from '@owl-nest/shadow'\nimport * as model from '@owl-nest/models'\nimport * as api from '@owl-nest/api-client/next'\n\ntype SponsorshipsProps = {\n sponsorships: api.Sponsorship[]\n order: api.Order\n}\n\nexport function Sponsorships({ sponsorships, order }: SponsorshipsProps) {\n let component\n const orderAmount = order.order_total\n const project = order.project\n\n if (sponsorships.length === 0) {\n return null\n } else if (sponsorships.length === 1 && !sponsorships[0].is_full && sponsorships[0].amount > 0) {\n component = \n } else if (sponsorships.length === 1 && sponsorships[0].is_full && sponsorships[0].amount > 0) {\n component = \n } else if (sponsorships.length === 1) {\n component = \n } else {\n component = \n }\n\n return (\n
\n {component}\n
\n )\n}\n\ntype MultiSponsorshipsProps = {\n sponsorships: api.Sponsorship[]\n}\n\nfunction MultiSponsorships({ sponsorships }: MultiSponsorshipsProps) {\n return (\n <>\n {t('This project is supported by')}\n \n {sponsorships.map((sponsorship, key) => {\n return (\n \n \n \n )\n })}\n \n \n )\n}\n\ntype SponsorshipWithAmountProps = {\n sponsorship: api.Sponsorship\n project: api.Project\n amount: number\n}\n\nfunction SponsorshipWithAmount({ sponsorship, amount, project }: SponsorshipWithAmountProps) {\n const finalAmount = amount * sponsorship.coefficient\n\n return (\n \n \n {tc('also match funded this project for an amount of [amount]', {\n amount: ,\n })}\n \n )\n}\n\ntype SponsorshipProps = {\n sponsorship: api.Sponsorship\n project: api.Project\n}\n\nfunction Sponsorship({ sponsorship, project }: SponsorshipProps) {\n return (\n \n \n {tc('match funded your support for an amount of [amount]', {\n amount: ,\n })}\n \n )\n}\n\ntype SponsorshipWithoutAmountProps = {\n sponsorship: api.Sponsorship\n}\n\nfunction SponsorshipWithoutAmount({ sponsorship }: SponsorshipWithoutAmountProps) {\n return (\n \n \n {t('supports this project.')}\n \n )\n}\n\ntype SponsorshipContainerProps = {\n sponsorship: api.Sponsorship\n position: string\n}\n\nfunction SponsorshipContainer({ sponsorship, position }: SponsorshipContainerProps) {\n const sponsorRef = React.useRef(null)\n\n shadow.usePartnershipTracker(sponsorship.sponsor.user.id, sponsorRef, {\n click: {\n enabled: true,\n },\n eventPosition: position,\n impression: {\n enabled: true,\n },\n })\n\n return (\n \n \n \n )\n}\n\nconst Main = styled.div`\n border-top: 1px solid ${plume.COLORS.PRIMARY_SAND_100};\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n padding: 10px 10px;\n text-align: center;\n width: 100%;\n`\n\nconst Heading = styled(plume.styles.copy.S.regular)`\n align-items: center;\n color: ${plume.COLORS.TEXT_TERTIARY};\n display: flex;\n flex-direction: row;\n line-height: 13px;\n\n @media not screen and ${plume.BREAKPOINTS.TABLET} {\n flex-direction: column;\n }\n`\n\nconst Wrapper = styled.div`\n width: 100%;\n margin: 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n\n ${Heading} > span {\n display: flex;\n align-items: center;\n\n & > a:first-child {\n margin-right: 5px;\n @media not screen and ${plume.BREAKPOINTS.TABLET} {\n width: 100%;\n }\n }\n\n & > span:first-child {\n margin-right: 5px;\n }\n }\n`\n\nconst SponsorList = styled.ul`\n margin: 0;\n padding: 5px 0 0;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n list-style-type: none;\n\n @media not screen and ${plume.BREAKPOINTS.TABLET} {\n flex-flow: row wrap;\n }\n`\n\nconst SponsorItem = styled.li`\n flex: 1 0 auto;\n margin: auto;\n padding: 0 5px;\n\n @media not screen and ${plume.BREAKPOINTS.TABLET} {\n padding: 5px 5px 0;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport * as plume from '@ulule/owl-kit-components/next'\n\nexport function MembershipTitle() {\n const auth = services.user.useAuth()\n if (auth.type !== 'loggedin') {\n return null\n }\n\n return (\n <>\n \n \n \n {t('Payment confirmed, thank you %(username)s!', {\n username: auth.user.name || '',\n })}\n \n \n \n )\n}\n\nconst TitleBanner = styled.div`\n align-items: center;\n background-color: ${plume.COLORS.SECONDARY_GREEN_800};\n display: flex;\n flex-direction: column;\n height: 210px;\n justify-content: center;\n padding: 10px 0 20px;\n text-align: center;\n\n ${plume.styles.heading.L} {\n color: ${plume.COLORS.PRIMARY_GREY_000};\n margin-top: 18px;\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n padding: 18px 0 60px;\n }\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as models from '@owl-nest/models'\nimport * as date from '@owl-nest/date'\nimport { t, tc, tp } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as env from '@owl-nest/config'\nimport { renderConfetti } from '@owl-nest/confetti'\n\nimport { useProject } from '../../hooks/useProject'\nimport { Sponsorships } from './components/Sponsorships'\nimport { MembershipTitle } from './components/MembershipTitle'\nimport { PullingContainer } from './style'\n\ntype MembershipThanksProps = {\n order: api.Order\n}\n\nexport function MembershipThanks({ order }: MembershipThanksProps): React.ReactElement {\n const { project } = useProject()\n\n React.useEffect(() => {\n renderConfetti('realisticLook')\n }, [])\n\n const userTransactionsURL = `/users/${order?.user?.id}/settings/transactions/` || `/settings/transactions/`\n const isSingleDonation = order.tip !== undefined && order.tip !== null && order.tip > 0\n const isMonthlyDonation = order.subscription?.is_donation\n const userConfig = env.useUserEnv()\n const projectName = models.project.name(project)\n const reward = order?.items?.[0]?.reward\n\n return (\n <>\n {project?.sponsorships_count > 0 && order && (\n \n )}\n\n \n\n \n {order.thanks_note && (\n \n \n\n \n \n )}\n\n \n {reward !== undefined &&\n !(isSingleDonation || isMonthlyDonation) &&\n tc(\n 'Your membership [strong: %(membership)s at %(amount)s / month] has been taken into account. You will receive an email shortly.',\n {\n amount: plume.accounting.localeMoney(order?.order_total, {\n currency: order.project.currency,\n lang: userConfig.lang,\n }),\n membership: models.reward.title(reward as models.reward.Reward<''>) ?? '',\n strong: ,\n },\n )}\n \n\n {(order?.type === api.OrderType.SINGLE || isSingleDonation || isMonthlyDonation) && (\n \n {isMonthlyDonation && projectName\n ? tc(\n `Your [strong: monthly donation of %(amount)s to %(name)s] has been taken into account. You will receive an email shortly.`,\n {\n strong: ,\n amount: plume.accounting.localeMoney(order?.order_total, {\n currency: order.project.currency,\n lang: userConfig.lang,\n }),\n name: projectName,\n },\n )\n : projectName &&\n tc(\n `Your [strong: donation of %(amount)s to %(name)s] has been taken into account. You will receive an email shortly.`,\n {\n strong: ,\n amount: plume.accounting.localeMoney(order?.order_total, {\n currency: order.project.currency,\n lang: userConfig.lang,\n }),\n name: projectName,\n },\n )}\n \n )}\n\n {t('See page')}\n\n {!isSingleDonation && order?.type === api.OrderType.MONTHLY && (\n \n {order?.subscription?.next_payment_expected_at ? (\n <>\n {isMonthlyDonation\n ? tc(\n `[strong: Monthly donation:] your first payment was made today. The next payment is due on %(date)s. If you change your mind, you can change or stop your donation from [link: your Ulule account].`,\n {\n date: date.format(new Date(`${order.subscription.next_payment_expected_at} 00:00:00`), 'PPP'),\n link: ,\n strong: ,\n },\n )\n : tc(\n `[strong: Monthly membership:] your first payment was made today. The next payment is due on %(date)s. If you change your mind, you can change or stop your membership from [link: your Ulule account].`,\n {\n date: date.format(new Date(`${order.subscription.next_payment_expected_at} 00:00:00`), 'PPP'),\n link: ,\n strong: ,\n },\n )}\n \n ) : (\n <>\n {isMonthlyDonation\n ? tc(\n `[strong: donation:] your first payment was made today. The next payment will automatically take place in one month. If you change your mind, you can change or stop your donation from [link: your Ulule account].`,\n {\n link: ,\n strong: ,\n },\n )\n : tc(\n `[strong: membership:] your first payment was made today. The next payment will automatically take place in one month. If you change your mind, you can change or stop your membership from [link: your Ulule account].`,\n {\n link: ,\n strong: ,\n },\n )}\n \n )}\n \n )}\n \n \n )\n}\n\nconst WysiwygContent = styled(plume.WysiwygContentProseMirror)`\n p:first-child {\n margin-top: 0;\n }\n p:last-child {\n margin-bottom: 0;\n }\n`\n\nconst Information = styled(plume.styles.copy.M.light)`\n text-align: center;\n margin-bottom: 20px;\n`\n\nconst Thanks = styled(plume.WysiwygContentProseMirror)`\n align-items: start;\n background: ${plume.COLORS.PRIMARY_GREY_000};\n border-radius: 4px;\n box-shadow: ${plume.EFFECTS.SHADOW_5};\n display: flex;\n flex-direction: row;\n gap: 16px;\n margin-bottom: 20px;\n max-width: 534px;\n padding: 16px 16px 24px 16px;\n text-align: left;\n width: 100%;\n\n & > * {\n ${plume.styles.copy.styles.S.regular};\n }\n`\n\nconst MonthlyDonationCallout = styled(plume.Callout)`\n margin-top: 20px;\n margin-bottom: 26px;\n text-align: left;\n\n ${plume.glyphs.stroke.Reroll} {\n color: ${plume.COLORS.PRIMARY_BLUE_700};\n }\n`\n\nconst Strong = styled.strong`\n font-weight: 700;\n`\n\nconst Headline = styled(plume.styles.copy.M.light)`\n text-align: center;\n margin-bottom: 20px;\n`\n","import * as React from 'react'\nimport { styled } from 'next-yak'\n\nimport { t, tc } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as api from '@owl-nest/api-client/next'\nimport * as models from '@owl-nest/models'\nimport * as env from '@owl-nest/config'\nimport * as date from '@owl-nest/date'\n\nimport { useProject } from '../../../hooks/useProject'\n\ntype TitleProps = {\n order: api.Order\n}\n\nexport function Title({ order }: TitleProps) {\n const auth = services.user.useAuth()\n if (auth.type !== 'loggedin') {\n return null\n }\n\n const userConfig = env.useUserEnv()\n\n const { project } = useProject()\n\n const isDonationBasedProject = models.project.isDonationBased(project)\n const projectName = models.project.name(project)\n const userTransactionsURL = `/users/${order?.user?.id}/settings/transactions/` || `/settings/transactions/`\n\n const headlineGettextArguments = {\n amount: plume.accounting.localeMoney(order?.order_total, {\n currency: order.project.currency,\n lang: userConfig.lang,\n }),\n projectName: projectName!,\n strong: ,\n }\n\n return (\n <>\n \n \n \n {t('Payment confirmed, thank you %(username)s!', {\n username: auth.user.name || '',\n })}\n \n \n {order !== undefined ? (\n order?.type === 'monthly' ? (\n tc(\n 'Your [strong: monthly donation of %(amount)s to %(projectName)s] has been processed. You will receive an email in a few moments.',\n headlineGettextArguments,\n )\n ) : (\n <>\n {isDonationBasedProject\n ? tc(\n 'Your [strong: %(amount)s donation to %(projectName)s] has been processed. You will receive an email in a few moments.',\n headlineGettextArguments,\n )\n : tc(\n 'Your [strong: %(amount)s contribution to %(projectName)s] has been processed. You will receive an email in a few moments.',\n headlineGettextArguments,\n )}\n \n )\n ) : (\n \n )}\n \n {order?.type === 'monthly' && (\n \n {order?.subscription?.next_payment_expected_at ? (\n <>\n {tc(\n `[strong: Monthly donation:] your first payment was made today. The next payment is due on %(date)s. If you change your mind, you can edit or stop your monthly donation from [link: your Ulule account].`,\n {\n date: date.format(new Date(`${order.subscription.next_payment_expected_at} 00:00:00`), 'PPP'),\n link: ,\n strong: ,\n },\n )}\n \n ) : (\n <>\n {tc(\n `[strong: Monthly donation:] your first payment was made today. The next payment will automatically take place in one month. If you change your mind, you can edit or stop your monthly donation from [link: your Ulule account].`,\n {\n link: ,\n strong: ,\n },\n )}\n \n )}\n \n )}\n \n \n {t('Back to project')}\n \n \n \n )\n}\n\nconst TitleBanner = styled.div`\n align-items: center;\n background-color: ${plume.COLORS.SECONDARY_GREEN_800};\n display: flex;\n flex-direction: column;\n min-height: 210px;\n justify-content: center;\n padding: 10px 0 20px;\n text-align: center;\n\n ${plume.styles.heading.L} {\n color: ${plume.COLORS.PRIMARY_GREY_000};\n margin-top: 18px;\n }\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n padding: 18px 0 60px;\n }\n`\n\nconst MonthlyDonationCallout = styled(plume.Callout)`\n margin-bottom: 14px;\n text-align: left;\n max-width: 600px;\n\n ${plume.glyphs.stroke.Reroll} {\n color: ${plume.COLORS.PRIMARY_BLUE_700};\n }\n`\n\nconst StyledHeadline = styled(plume.styles.copy.M.light)`\n color: ${plume.COLORS.PRIMARY_GREY_000};\n margin: 14px 0;\n\n @media screen and ${plume.BREAKPOINTS.TABLET} {\n max-width: 600px;\n text-align: center;\n }\n`\n\nconst StyledLink = styled(plume.Link)`\n color: ${plume.COLORS.PRIMARY_GREY_000};\n\n svg {\n margin-top: 7px;\n fill: ${plume.COLORS.PRIMARY_GREY_000};\n }\n`\n","import React from 'react'\n\nimport { styled } from 'next-yak'\n\nimport { t } from '@owl-nest/localize'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as models from '@owl-nest/models'\n\nimport { useProject } from '../../../hooks/useProject'\n\nimport { Headline, PullingContainer } from '../style'\n\nexport function TeamMessage() {\n const { project } = useProject()\n\n return (\n \n {t('Message from the project team')}\n {project.thanks_note !== undefined && (models.i18n.get(project.thanks_note) ?? '')?.length > 0 && (\n <>\n \n \n {project?.owner?.name}\n \n \n \n \n \n )}\n \n )\n}\n\nconst StyledContainer = styled(PullingContainer)`\n margin-bottom: 16px;\n display: flex;\n flex-direction: column;\n`\n\nconst Thanks = styled(plume.WysiwygContentProseMirror)`\n text-align: left;\n\n & > * {\n ${plume.styles.copy.styles.M.light};\n }\n`\nconst WysiwygContent = styled(plume.WysiwygContentProseMirror)`\n p:first-child {\n margin-top: 0;\n }\n p:last-child {\n margin-bottom: 0;\n }\n`\n\nconst AvatarContainer = styled.div`\n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: center;\n margin-bottom: 16px;\n`\n","import * as React from 'react'\nimport { Formik, Form, Field, ErrorMessage, type FieldProps, type FormikProps } from 'formik'\nimport { styled, css } from 'next-yak'\nimport * as yup from 'yup'\n\nimport * as api from '@owl-nest/api-client/next'\nimport { t, tc } from '@owl-nest/localize'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as hooks from '@owl-nest/hooks'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { useProject } from '../../../hooks/useProject'\n\nimport { Headline, PullingContainer } from '../style'\n\ntype CommentProps = {\n order: api.Order\n}\n\nexport function Comment({ order }: CommentProps) {\n const tracking = shadow.useTracking()\n const [commentStatus, comment] = useComment(order.id)\n\n const { project } = useProject()\n\n const DEFAULT_MESSAGES = [\n t('Congratulations for this great project 👏'),\n t(\"We're behind you!\"),\n t('Congrats, with all my support!'),\n t(\"Let's do this!\"),\n t('Sky is the limit 👍'),\n ]\n\n const isProcessingComment = commentStatus === hooks.QueryStatus.SUCCESS\n\n React.useEffect(() => {\n if (commentStatus === hooks.QueryStatus.SUCCESS) {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.SOCIAL,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'comment on project page from checkout endfunnel',\n })\n }\n }, [commentStatus])\n\n return (\n \n \n {t('Congratulate the project team')}\n {isProcessingComment && (\n \n {tc(\n 'Your comment has been published. You can find it in the [link: comments section] of the project page.',\n {\n link: ,\n },\n )}\n \n )}\n {!isProcessingComment && (\n {\n comment(values.comment)\n }}\n validateOnChange={false}\n validationSchema={commentSchema()}\n >\n {({ errors, touched, handleSubmit, setFieldValue }: FormikProps<{ comment: string }>) => (\n
\n \n {({ field }: FieldProps) => (\n {\n setFieldValue(field.name, event.target.value)\n }}\n resizable={false}\n rows={4}\n value={field.value}\n />\n )}\n \n \n \n \n )}\n \n )}\n {t('Comments are public, please be mindful and respectful.')}\n
\n
\n )\n}\n\nfunction commentSchema() {\n return yup.object().shape({\n comment: yup\n .string()\n .required(t('This field is required'))\n .max(500, t('This field must contain a maximum of %(max)d characters').replace('%(max)d', '${max}')),\n })\n}\n\nfunction useComment(orderId: number): [hooks.QueryStatus, (comment: string) => Promise] {\n const [state, setState] = React.useState(hooks.QueryStatus.PRISTINE)\n const dispatch = services.message.useDispatch()\n\n return [state, comment]\n\n async function comment(comment: string) {\n setState(hooks.QueryStatus.PENDING)\n\n const response = await services.order.comment(orderId, comment)\n\n response.caseOf({\n left: () => {\n setState(hooks.QueryStatus.FAILURE)\n dispatch(\n services.message.error(t('Oops... An error has occurred. Please retry in a few minutes.'), {\n focus: true,\n context: 'error_create_comment',\n }),\n )\n },\n right: () => {\n setState(hooks.QueryStatus.SUCCESS)\n },\n })\n }\n}\n\n/** Returns a number between min and max (included) */\nfunction getRandomInt(min: number, max: number) {\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n\n/** Returns an element of array randomly */\nfunction pickRandomly(array: any[]) {\n return array[getRandomInt(0, array.length - 1)]\n}\n\nconst Button = styled(plume.styles.button.Button)`\n margin: 20px auto 0;\n\n ${(props) =>\n props.loading &&\n css`\n background-color: ${plume.COLORS.PRIMARY_BLUE_700};\n `};\n`\n\nconst ErrorComment = styled(plume.styles.copy.S.regular)`\n color: ${plume.COLORS.PRIMARY_RED_500};\n`\n\nconst PrivacyDisclaimer = styled(plume.styles.copy.XS.regular)`\n color: ${plume.COLORS.PRIMARY_GREY_500};\n margin-top: 20px;\n`\n\nconst Container = styled.div`\n margin: 0 auto 16px;\n`\n\nconst StyledPullingContainer = styled(PullingContainer)`\n margin: 0 auto 0px;\n`\n\nconst StyledCallout = styled(plume.Callout)`\n text-align: left;\n`\n","import * as React from 'react'\n\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as shadow from '@owl-nest/shadow'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\nimport { SharingLinks } from '@owl-nest/sharing'\n\nimport { useProject } from '../../../hooks/useProject'\nimport { Headline, PullingContainer } from '../style'\n\ntype ShareProps = {\n user: api.AuthenticatedUser\n}\n\nexport function Share({ user }: ShareProps) {\n const { project } = useProject()\n\n return (\n <>\n \n {t('Share the fundraising to make the project a reality')}\n \n {t(\n \"Every share counts! By spreading the word about the fundraising, you're helping to reach more people and give the project every chance of success.\",\n )}\n \n \n \n \n )\n}\n\nconst StyledPullingContainer = styled(PullingContainer)`\n margin: 0 auto 0;\n`\n\nconst StyledHeadline = styled(Headline)`\n margin-bottom: 8px;\n`\n\nconst StyledText = styled(plume.styles.copy.S.regular)`\n text-align: left;\n color: ${plume.COLORS.TEXT_SECONDARY};\n margin-bottom: 24px;\n`\n","import React from 'react'\n\nimport { styled } from 'next-yak'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport * as shadow from '@owl-nest/shadow'\nimport { message } from '@owl-nest/services'\nimport { renderConfetti } from '@owl-nest/confetti'\nimport { useProject } from '../../hooks/useProject'\n\nimport { Sponsorships } from './components/Sponsorships'\nimport { Title } from './components/Title'\nimport { TeamMessage } from './components/TeamMessage'\nimport { Comment } from './components/Comment'\nimport { Share } from './components/Share'\n\nimport { useSearchParams } from 'react-router'\n\ntype RewardOrDonationProps = {\n order: api.Order\n user: api.AuthenticatedUser\n}\n\nexport function RewardOrDonationThanks({ order, user }: RewardOrDonationProps) {\n const { project } = useProject()\n\n const canComment = project.comments_enabled !== api.ProjectCommentsPermission.NOONE\n\n const tracking = shadow.useTracking()\n\n React.useEffect(() => {\n if (window.FB) {\n window.FB.Event.subscribe('edge.create', trackLike)\n window.FB.Event.subscribe('edge.remove', trackUnLike)\n }\n if (window.FB && window.FB.XFBML) {\n window.FB.XFBML.parse()\n }\n\n return () => {\n if (window.FB) {\n window.FB.Event.unsubscribe('edge.create', trackLike)\n window.FB.Event.unsubscribe('edge.remove', trackUnLike)\n }\n }\n\n function trackLike() {\n tracking.social.track({\n socialNetwork: shadow.SOCIAL_NETWORK.FACEBOOK,\n socialAction: 'Like',\n socialTarget: 'https://www.facebook.com/ulule',\n })\n }\n\n function trackUnLike() {\n tracking.social.track({\n socialNetwork: shadow.SOCIAL_NETWORK.FACEBOOK,\n socialAction: 'Unlike',\n socialTarget: 'https://www.facebook.com/ulule',\n })\n }\n }, [])\n\n React.useEffect(() => {\n renderConfetti('realisticLook')\n }, [])\n\n return (\n <>\n \n {project?.sponsorships_count > 0 && order && (\n \n )}\n \n <TeamMessage />\n {canComment && <Comment order={order} />}\n <Share user={user} />\n </>\n )\n}\n\nconst BannerComment = styled(message.Banner)`\n position: relative;\n color: ${plume.COLORS.PRIMARY_GREY_000};\n`\n","import React from 'react'\n\nimport * as api from '@owl-nest/api-client/next'\nimport * as models from '@owl-nest/models'\nimport { useProject } from '../../hooks/useProject'\n\nimport { MembershipThanks } from './MembershipThanks'\nimport { RewardOrDonationThanks } from './RewardOrDonationThanks'\n\ntype DoneProps = {\n order: api.Order<true, ''>\n user: api.AuthenticatedUser\n}\n\nexport function Done({ order, user }: DoneProps) {\n const { project } = useProject()\n const isMembership = models.project.isMembership(project)\n return isMembership ? <MembershipThanks order={order} /> : <RewardOrDonationThanks order={order} user={user} />\n}\n","import * as React from 'react'\nimport { styled } from 'next-yak'\nimport { Route, Routes, useLocation, useNavigate } from 'react-router'\n\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as logger from '@owl-nest/logger'\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { useDramaticallyInefficientGlobalCss, css } from '@owl-nest/yak/extra-runtime'\n\nimport { Processing } from './Processing'\nimport { Aborted } from './Aborted'\nimport { Canceled } from './Canceled'\nimport { Done } from './Done'\nimport { useProject } from '../../hooks/useProject'\nimport { PAGES } from './PAGES'\n\nexport function EndfunnelRouter(): React.ReactElement<any> {\n const searchQuery = new URLSearchParams(document.location.search)\n const { project } = useProject()\n const navigate = useNavigate()\n\n // Usually kolkt redirects the user to the endfunnel with a query param\n // ?order_id=XXX. But in some odd cases the device of the user strips the\n // query param before arriving to the endfunnel. The endfunnel has no\n // order_id to verify the status of the order, and the user is stuck on a\n // never ending loop in the processing step of the endfunnel. For those\n // rare cases, we save the id of the newly created order in local storage.\n // That way, when arriving on the endfunnel, if the query param is absent\n // we can rely on the localstorage to rebuild the correct url.\n React.useEffect(() => {\n const orderId = localStorage.getItem(`endfunnel_${project.id}_order`)\n if (orderId !== null) {\n localStorage.removeItem(`endfunnel_${project.id}_order`)\n }\n\n if (orderId !== null && searchQuery.get('order_id') === null) {\n navigate(\n {\n pathname: PAGES.PROCESSING,\n search: new URLSearchParams({ order_id: String(orderId) }).toString(),\n },\n { replace: true },\n )\n }\n }, [])\n\n if (searchQuery.get('order_id') === null) {\n logger.log('[endfunnel] undefined orderId - post fix')\n return <></>\n }\n\n return <Router />\n}\n\nfunction Router(): React.ReactElement<any> {\n const searchQuery = new URLSearchParams(document.location.search)\n\n const orderId = Number(searchQuery.get('order_id'))\n const returnUrlParam = searchQuery.get('return_url')\n const returnUrl = returnUrlParam ? decodeURIComponent(returnUrlParam) : undefined\n\n const tracking = shadow.useTracking()\n\n const auth = services.user.useAuth()\n const orderService = services.order.useOrder(orderId, { fetchOnMount: false })\n const order = orderService.response.data\n\n const location = useLocation()\n\n React.useEffect(() => {\n if (auth.type === 'loggedin') {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachEndfunnel',\n })\n }\n }, [auth.type])\n\n return (\n <>\n <GlobalStyle />\n <Routes>\n <Route\n path=\"/done\"\n element={\n auth.type === 'loggedin' && order ? (\n <Main>\n <Done order={order} user={auth.user} />\n </Main>\n ) : (\n <Processing orderId={orderId} returnUrl={returnUrl} />\n )\n }\n />\n <Route path={'/processing'} element={<Processing orderId={orderId} returnUrl={returnUrl} />} />\n {order ? (\n <>\n <Route path={'/aborted'} element={<Aborted order={order} />} />\n <Route path={'/cancelled'} element={<Canceled />} />\n </>\n ) : (\n <Route path={'/*'} element={<Processing orderId={orderId} returnUrl={location.pathname} />} />\n )}\n </Routes>\n </>\n )\n}\n\nfunction GlobalStyle() {\n useDramaticallyInefficientGlobalCss(css`\n *,\n :after,\n :before {\n box-sizing: border-box;\n }\n `)\n\n useDramaticallyInefficientGlobalCss(css`\n body {\n background-color: ${plume.COLORS.PRIMARY_SAND_100};\n }\n `)\n\n return <></>\n}\n\nconst Main = styled.div`\n padding-bottom: 60px;\n`\n","import * as React from 'react'\nimport { Navigate, Route, Routes } from 'react-router'\n\nimport * as env from '@owl-nest/config'\nimport { EulaModal } from '@owl-nest/eula-modal'\nimport { t } from '@owl-nest/localize'\nimport * as logger from '@owl-nest/logger'\nimport * as models from '@owl-nest/models'\nimport * as service from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport { Spinner } from '@ulule/owl-kit-components/next'\n\nimport { AddressView } from './views/address'\nimport { Item } from './components/Item'\nimport { Layout } from './components/Layout'\n\nimport { DonationView } from './views/donation'\nimport { LoginView } from './views/login'\nimport { PaymentView } from './views/payment'\nimport { PickupView } from './views/pickup'\nimport { RenewView } from './views/renew'\nimport { SelectionView } from './views/selection'\nimport { MondialRelayView } from './views/mondialRelay'\nimport { NavigationContext, useNavigation } from './hooks/useNavigation'\nimport { RewardTaxDeductionModal } from './components/Modals/RewardTaxDeductionModal'\nimport { useCart } from './hooks/useCart/useCart'\nimport { useProject } from './hooks/useProject'\nimport { Connect } from '@owl-nest/connect'\nimport { EndfunnelRouter } from './views/endfunnel/EndfunnelRouter'\nimport { getFilterFromUrlParams } from './utils/filter'\n\ntype RouterProps = {\n configuration: {\n donationBasedProject: boolean\n membershipProject: boolean\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n }\n}\n\nexport function Router({ configuration }: RouterProps): React.ReactElement<RouterProps> {\n logger.addBreadcrumb({\n category: 'started',\n data: { configuration },\n level: 'info',\n message: 'Initializing checkout router…',\n type: 'debug',\n })\n\n const { project } = useProject()\n\n return (\n <NavigationContext value={{ configuration }}>\n <React.Suspense fallback={<Spinner />}>\n {project?.tax_deductible && <RewardTaxDeductionModal project={project} />}\n <Routes>\n <Route\n path=\"/\"\n element={\n <>\n <Selection\n donationBasedProject={configuration.donationBasedProject}\n membershipProject={configuration.membershipProject}\n preFilledTip={configuration.preFilledTip}\n />\n {project?.tax_deductible && <RewardTaxDeductionModal project={project} />}\n </>\n }\n />\n <Route path=\"/login\" element={<Login />} />\n <Route path=\"/address\" element={<Address />} />\n <Route path=\"/pickup\" element={<Pickup />} />\n <Route path=\"/mondialrelay\" element={<MondialRelay />} />\n <Route path=\"/payment\" element={<Payment />} />\n <Route path=\"/renew\" element={<Renew />} />\n\n <Route path=\"/endfunnel\">\n <Route path=\"*\" element={<Endfunnel />} />\n </Route>\n\n <Route path=\"*\" element={<Navigate to=\"/\" />} />\n </Routes>\n </React.Suspense>\n </NavigationContext>\n )\n}\n\nfunction Selection({\n donationBasedProject = false,\n membershipProject = false,\n preFilledTip,\n}: {\n donationBasedProject: boolean\n membershipProject: boolean\n preFilledTip?: {\n amount?: number\n frequency?: models.project.DonationFrequency\n }\n}): React.ReactElement<{ preFilledTip?: number }> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Selection step…', type: 'debug' })\n\n const tracking = shadow.useTracking()\n const cart = useCart()\n const { project } = useProject()\n\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction:\n donationBasedProject || membershipProject ? 'ReachingPickDonationAmount' : 'ReachingPickAmountAndReward',\n })\n\n const { clearMessages } = service.message.useMessage()\n const navigation = useNavigation({ redirectToLegalPage: true })\n\n const auth = service.user.useAuth()\n\n React.useEffect(() => {\n if (!navigation.isCurrentLegal) {\n tracking.ecommerce.track('begin_checkout', {\n currency: project.currency,\n value: cart.subTotal,\n items: [\n ...cart.products.map((product) => ({\n item_id: String(product.reward.id),\n item_name: models.reward.title(product.reward) ?? '',\n item_brand: models.project.name(project),\n item_variant: product.variant && String(product.variant.id),\n price: product.reward.price,\n quantity: product.quantity,\n })),\n ...(cart.tip.amount !== 0\n ? [\n {\n item_id: 'tip',\n item_name: 'tip',\n item_brand: models.project.name(project),\n price: cart.tip.amount,\n quantity: 1,\n },\n ]\n : []),\n ],\n })\n }\n }, [navigation.isCurrentLegal])\n\n const filter = getFilterFromUrlParams()\n\n React.useEffect(() => {\n clearMessages('payment')\n return () => clearMessages('selection')\n }, [])\n\n return (\n <Layout progress={0}>\n {auth.type === 'loggedin' && <EulaModal user={auth.user} refresh={auth.refresh} />}\n {donationBasedProject || (membershipProject && filter.type === 'donation') ? (\n <DonationView preFilledTip={preFilledTip} />\n ) : (\n <SelectionView preFilledTip={preFilledTip} />\n )}\n </Layout>\n )\n}\n\nfunction Login(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Login step…', type: 'debug' })\n\n const navigation = useNavigation({ redirectToLegalPage: true })\n const tracking = shadow.useTracking()\n\n React.useEffect(() => {\n if (navigation.isCurrentLegal) {\n return\n }\n\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachingLogin',\n })\n }, [navigation.isCurrentLegal])\n\n return (\n <Layout progress={25}>\n <LoginView />\n </Layout>\n )\n}\n\nfunction Pickup(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Pickup step…', type: 'debug' })\n\n const navigation = useNavigation({ redirectToLegalPage: true })\n const tracking = shadow.useTracking()\n const auth = service.user.useAuth()\n\n React.useEffect(() => {\n if (!navigation.isCurrentLegal) {\n return\n }\n\n if (auth.type === 'loggedin') {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachingSetAddress',\n })\n }\n }, [auth.type, navigation.isCurrentLegal])\n\n return (\n <Layout progress={50}>\n <PickupView />\n </Layout>\n )\n}\n\nfunction MondialRelay(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Relay step…', type: 'debug' })\n\n const navigation = useNavigation({ redirectToLegalPage: true })\n const tracking = shadow.useTracking()\n const auth = service.user.useAuth()\n\n React.useEffect(() => {\n if (!navigation.isCurrentLegal) {\n return\n }\n\n if (auth.type === 'loggedin') {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachingSetAddress',\n })\n }\n }, [auth.type, navigation.isCurrentLegal])\n\n return (\n <Layout progress={50}>\n <MondialRelayView />\n </Layout>\n )\n}\n\nfunction Address(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Address step…', type: 'debug' })\n\n const navigation = useNavigation({ redirectToLegalPage: true })\n const tracking = shadow.useTracking()\n const auth = service.user.useAuth()\n\n React.useEffect(() => {\n if (!navigation.isCurrentLegal) {\n return\n }\n\n if (auth.type === 'loggedin') {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachingSetAddress',\n })\n }\n }, [auth.type, navigation.isCurrentLegal])\n\n return (\n <Layout progress={50}>\n <AddressView />\n </Layout>\n )\n}\n\nfunction Payment(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Payment step…', type: 'debug' })\n\n const tracking = shadow.useTracking()\n const auth = service.user.useAuth()\n const { clearMessages } = service.message.useMessage()\n const navigation = useNavigation({ redirectToLegalPage: true })\n\n React.useEffect(() => {\n return () => clearMessages('payment')\n }, [])\n\n React.useEffect(() => {\n if (!navigation.isCurrentLegal) {\n return\n }\n\n if (auth.type === 'loggedin') {\n tracking.project.trackOnce({\n eventCategory: shadow.CATEGORY.CHECKOUT,\n pageCategory: 'project',\n siteCategory: shadow.SITE.CHECKOUT,\n eventAction: 'ReachingPickPaymentMethod',\n })\n }\n }, [auth.type, navigation.isCurrentLegal])\n\n return (\n <Layout progress={75}>\n <PaymentView />\n </Layout>\n )\n}\n\nfunction Renew(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Renew step…', type: 'debug' })\n\n const auth = service.user.useAuth()\n const [orderId, setOrderId] = React.useState<number | undefined>()\n\n React.useEffect(() => {\n if (auth.type === 'loggedin') {\n const params = new URLSearchParams(document.location.search)\n const orderId = params.get('order')\n if (orderId) {\n const id = parseInt(orderId, 10)\n\n if (id) {\n setOrderId(id)\n }\n }\n }\n }, [auth.type])\n\n return (\n <Layout progress={75}>\n <>\n {auth.type !== 'loggedin' && auth.type !== 'initial' && (\n <Item title={auth.type === 'known' ? t('Welcome back') : t('Log in or sign up')}>\n <React.Suspense fallback={<Spinner />}>\n <Connect />\n </React.Suspense>\n </Item>\n )}\n {auth.type === 'loggedin' && orderId !== undefined && <RenewView orderId={orderId} />}\n </>\n </Layout>\n )\n}\n\nfunction Endfunnel(): React.ReactElement<unknown> {\n logger.addBreadcrumb({ category: 'started', level: 'info', message: 'Entering Endfunnel…', type: 'debug' })\n\n const auth = service.user.useAuth()\n\n React.useEffect(() => {\n if (auth.type !== 'loggedin' && auth.type !== 'initial') {\n window.location.replace(env.SIGNIN_URL + '?next=' + window.location.href)\n }\n }, [auth.type])\n\n return <EndfunnelRouter />\n}\n","import * as React from 'react'\nimport * as ReactDOM from 'react-dom/client'\nimport * as jotai from 'jotai'\nimport { BrowserRouter } from 'react-router'\n\nimport * as api from '@owl-nest/api-client/latest'\nimport * as fb from '@owl-nest/facebook-sdk-init'\nimport * as error from '@owl-nest/error'\nimport { initializeLocalization } from '@owl-nest/localize'\nimport * as logger from '@owl-nest/logger'\nimport * as models from '@owl-nest/models'\nimport * as services from '@owl-nest/services'\nimport * as shadow from '@owl-nest/shadow'\nimport * as env from '@owl-nest/config'\n\nimport { saveCartToLocalStorage } from './utils/localStorage'\nimport { hydrate } from './utils/hydrate'\nimport * as UFE from './utils/UFE'\n\nimport { PaymentDisturbanceModal } from './components/Modals/PaymentDisturbanceModal'\nimport { Header } from './components/Header'\nimport { Router } from './Router'\nimport { getProject, initializeProject } from './hooks/useProject'\nimport { CART_STATE } from './hooks/useCart/atom.ts'\n\nconst jotaiStore = jotai.getDefaultStore()\n\nasync function init(): Promise<void> {\n await env.initUserConfig()\n const userConfig = env.getUserConfig()\n\n logger.init({\n dsn: env.SENTRY_PUBLIC_DSN,\n environment: env.ENVIRONMENT,\n user: {\n country: env.USER_COUNTRY,\n currency: userConfig.currency,\n locale: userConfig.lang,\n },\n })\n logger.setTag('feature', 'checkout')\n\n fb.init({ appId: env.FACEBOOK_APP_ID ?? '', locale: api.EXTENDED_LOCALES[userConfig.lang] })\n\n // TODO: UI placeholder, let's be sexy\n await initializeLocalization(userConfig.lang, env.LOCALE_FILES[userConfig.lang])\n\n try {\n await initializeProject(jotaiStore)\n } catch (error: any) {\n if (error.status === 401) {\n document.location.href = `${env.SIGNIN_URL}?next=${document.location.href}`\n return\n }\n throw error\n }\n\n renderHeader()\n renderApp()\n}\n\ninit()\n\nfunction renderHeader(): void {\n const headerContainer = document.querySelector('#checkout-app-header')\n if (headerContainer) {\n const headerRoot = ReactDOM.createRoot(headerContainer)\n headerRoot.render(<Header />)\n } else {\n logger.err('Header container is missing')\n }\n}\n\nasync function renderApp(): Promise<void> {\n let initialError\n const appContainer = document.querySelector('#checkout-app-container')\n\n if (appContainer) {\n // TODO: FIXME: hydrate might throw, we need to display error\n const project = await getProject(jotaiStore)\n const applicationStatePromise = hydrate(project, jotaiStore)\n const response = await applicationStatePromise.catch((error) => {\n initialError = error\n })\n\n if (!response || initialError) {\n return error.renderCrashToast('checkout', initialError)\n }\n\n const { cart, initialConfiguration, messages } = response\n\n jotaiStore.set(CART_STATE, { type: 'override', state: cart })\n jotaiStore.set(services.message.MESSAGES_ATOM, { type: 'MESSAGE.SYNC', state: messages })\n saveCartToLocalStorageOnChange(project)\n\n // NOTE: We want to embed current cart state within all checkout related logs\n logger.getCurrentScope().addEventProcessor(function (event) {\n event.extra = {\n ...event.extra,\n cart,\n }\n return event\n })\n logger.setTag('project', project.id)\n\n // NOTE: We do NOT support displaying Checkout for non-online projects. Thus, we exit back to project page.\n if (!models.project.isOnline(project)) {\n window.location.href = project.absolute_url\n }\n\n if (models.project.isFinished(project) || project?.is_cancelled) {\n if (!window.location.pathname.match(/checkout\\/renew/)) {\n window.location.href = `${project.absolute_url}?reward=${project.rewards?.[0].id ?? 1}`\n return\n }\n }\n\n observeStoreForUser((user: api.AuthenticatedUser) => {\n const userConfig = env.getUserConfig()\n\n logger.setUser({\n country: user.country,\n currency: userConfig.currency,\n email: user.email,\n id: String(user.id),\n isCompleted: user.is_completed,\n locale: user.lang,\n timezone: user.timezone,\n username: user.username,\n })\n })\n\n const getUserId = (): number | undefined => {\n const authState = jotaiStore.get(services.user.AUTH_ATOM)\n return authState.type === 'loggedin' ? authState.authenticatedUser.id : undefined\n }\n\n const root = ReactDOM.createRoot(appContainer)\n root.render(\n <shadow.TrackingProvider\n getUserId={getUserId}\n gtmContainerId={UFE.GTM_KEY}\n pageCategory=\"project\"\n project={project}\n siteCategory={shadow.SITE.CHECKOUT}\n >\n <shadow.plausible.TrackingProvider context={'Checkout'}>\n <BrowserRouter\n basename={`/projects/${project.id}/checkout`}\n >\n {!models.project.isOrdersEnabled(project) && <PaymentDisturbanceModal projectUrl={project.absolute_url} />}\n <Router configuration={initialConfiguration} />\n </BrowserRouter>\n </shadow.plausible.TrackingProvider>\n </shadow.TrackingProvider>,\n )\n } else {\n logger.err('App container is missing')\n }\n}\n\nfunction observeStoreForUser(onChange: (user: api.AuthenticatedUser) => void): () => void {\n let currentState: services.user.AuthState\n\n function handleChange(): void {\n const nextState = jotaiStore.get(services.user.AUTH_ATOM)\n if (nextState !== currentState && nextState.type === 'loggedin') {\n currentState = nextState\n onChange(currentState.authenticatedUser)\n }\n }\n\n const unsubscribe = jotaiStore.sub(services.user.AUTH_ATOM, handleChange)\n handleChange()\n return unsubscribe\n}\n\nfunction saveCartToLocalStorageOnChange(project: api.Project): () => void {\n return jotaiStore.sub(CART_STATE, () => {\n const state = jotaiStore.get(CART_STATE)\n if (state.dryRunResult) {\n saveCartToLocalStorage(state, project.id)\n }\n })\n}\n"],"mappings":"28JAEA,SAAgB,GACd,EACA,EACA,EACA,EACA,EAAY,EACJ,CACR,GAAI,IAAmB,EACrB,OAAO,EAGT,GAAI,IAAU,IAAA,IAAa,EAAM,KAAoB,IAAA,IAAa,EAAM,KAAoB,IAAA,GAE1F,OADA,GAAY,mDAAoD,CAAE,QAAO,iBAAgB,gBAAe,CAAC,EAClG,EAGT,IAAM,EAAmB,EAAS,EAAM,GAAmB,EAAM,GACjE,OAA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