{getShippingLabelWithPrice(shippingItem)}
\n ) : (\n `${getShippingLabelWithPrice(shippingItem)}${\n i < shippingOptions.length ? ', ' : ''\n }`\n );\n });\n }\n }\n\n const itemOffersTakeawayOnly = () =>\n shippingOptions.length === 1 &&\n shippingOptions.find(\n (shippingOption) => shippingOption.shippingType === 'Takeaway'\n ) !== undefined\n ? true\n : false;\n const getCheapestShippingCost = () =>\n shippingOptions.length === 0\n ? { shippingCost: 0 }\n : shippingOptions.reduce((accumulator, currentValue) => {\n if (\n (currentValue.shippingCost <\n accumulator.shippingCost &&\n currentValue.shippingType !== 'Takeaway') ||\n accumulator.shippingType === 'Takeaway'\n ) {\n return currentValue;\n }\n return accumulator;\n });\n\n return itemOffersTakeawayOnly()\n ? STRINGS.SHIPPING_LABELS.TAKEAWAY\n : formatPrice(getCheapestShippingCost().shippingCost);\n };\n};\n\nexport const isNormalListViewType = (listViewType) =>\n listViewType === LIST_VIEW_TYPES.NORMAL;\n","import { PAGE_LIST_TYPES, PAGE_BULK_ACTIONS } from '../constants/list-types';\n\n/**\n * @param {string} listType\n * @param {object} item\n * @returns {object} 'Bulk Actions' available for the specific list\n */\n\nexport const listActions = (\n listType,\n memberId,\n selectedFilterBar,\n count = 0,\n t\n) => {\n const actions = {\n [PAGE_LIST_TYPES.SELLER_ACTIVE]: () => {\n switch (selectedFilterBar) {\n default:\n return {\n isCheckboxActive: (item) =>\n item && item.bidInformation.bidCount === 0,\n bulkCssClass: 'outline-dark',\n label: t('myt_action_cancelListingsLabel'),\n bulkAction: PAGE_BULK_ACTIONS.ACTIVE_CANCEL,\n modal: {\n icon: 'warning',\n heading: t(\n 'myt_action_cancelListingsModalHeading',\n { count: count, itemCount: count }\n ),\n message: t(\n 'myt_action_cancelListingsModalMessage',\n { count: count }\n ),\n confirmButtonText: t(\n 'myt_action_cancelListingsModalConfirmButtonText'\n ),\n cancelButtonText: t(\n 'myt_action_cancelListingsModalCancelButtonText'\n ),\n dismissable: true\n },\n idType: 'itemId'\n };\n }\n },\n\n [PAGE_LIST_TYPES.SELLER_NOT_SOLD]: () => {\n switch (selectedFilterBar) {\n default:\n return {\n isCheckboxActive: (item) => {\n if (!item) {\n return false;\n }\n if (item.listing.restart.hasRestartedChild) {\n return false;\n }\n return !item.isArchived;\n },\n /*\n * @todo: confirm this\n */\n bulkCssClass: 'outline-dark',\n label: t('myt_action_restartListingsLabel'),\n bulkAction: PAGE_BULK_ACTIONS.UNSOLD_RESTART,\n modal: {\n heading: t(\n 'myt_action_restartListingsModalHeading',\n { count: count, itemCount: count }\n ),\n dismissable: true,\n wide: true,\n confirmButtonText: t(\n 'myt_action_restartListingsModalConfirmButtonText'\n ),\n cancelButtonText: t(\n 'myt_action_restartListingsModalCancelButtonText'\n ),\n headingCSS: 'messaging-modal-title-with-line',\n messageAlignment: 'left',\n cssClass: false\n },\n idType: 'itemId'\n };\n }\n },\n\n [PAGE_LIST_TYPES.BUYER_ACTIVE_ITEMS]: () => {\n switch (selectedFilterBar) {\n case 'BuyerHidden':\n return {\n isCheckboxActive: (item) => {\n return (\n (item &&\n item.caller.leadingBidRemoved === true) ||\n (item.bidInformation.leadingBidder &&\n item.bidInformation.leadingBidder.id !==\n memberId)\n );\n },\n bulkCssClass: 'outline-dark',\n label: t(\n 'myt_action_showBuyerHiddenActiveListingsLabel'\n ),\n bulkAction: PAGE_BULK_ACTIONS.BUYER_SHOW_ACTIVE,\n modal: {\n heading: t(\n 'myt_action_showBuyerHiddenActiveListingsModalHeading',\n { count: count, itemCount: count }\n ),\n message: t(\n 'myt_action_showBuyerHiddenActiveListingsModalMessage',\n { count: count }\n ),\n dismissable: true,\n wide: false,\n confirmButtonText: t(\n 'myt_action_showBuyerHiddenActiveListingsModalConfirmButtonText'\n ),\n cancelButtonText: t(\n 'myt_action_showBuyerHiddenActiveListingsModalCancelButtonText'\n ),\n icon: 'warning',\n headingCSS: 'messaging-modal-title',\n messageAlignment: 'center',\n cssClass: false\n }\n };\n case 'BuyerNotHidden':\n return {\n isCheckboxActive: (item) => {\n return (\n (item &&\n item.caller?.leadingBidRemoved === true) ||\n (item.bidInformation.leadingBidder &&\n (item.bidInformation.leadingBidder.id !==\n memberId ||\n item.reservePriceReached === false))\n );\n },\n bulkCssClass: 'outline-dark',\n label: t('myt_action_hideListingsLabel'),\n bulkAction: PAGE_BULK_ACTIONS.BUYER_HIDE_ACTIVE,\n modal: {\n heading: t('myt_action_hideListingsModalHeading', {\n count: count,\n itemCount: count\n }),\n dismissable: true,\n wide: false,\n icon: 'warning',\n confirmButtonText: t(\n 'myt_action_hideListingsModalConfirmButtonText'\n ),\n cancelButtonText: t(\n 'myt_action_hideListingsModalCancelButtonText'\n ),\n message: t('myt_action_hideListingsModalMessage', {\n count: count\n }),\n headingCSS: 'messaging-modal-title',\n messageAlignment: 'center',\n cssClass: false\n }\n };\n default:\n return undefined;\n }\n },\n\n [PAGE_LIST_TYPES.BUYER_ITEMS_LOST]: () => {\n switch (selectedFilterBar) {\n case 'ItemsLostNotHidden':\n return {\n isCheckboxActive: () => true,\n bulkCssClass: 'outline-dark',\n label: t('myt_action_hideListingsLabel'),\n bulkAction: PAGE_BULK_ACTIONS.BUYER_HIDE_ACTIVE,\n modal: {\n heading: t('myt_action_hideListingsModalHeading', {\n count: count,\n itemCount: count\n }),\n dismissable: true,\n wide: false,\n icon: 'warning',\n confirmButtonText: 'Ja',\n cancelButtonText: 'Nej',\n message: t('myt_action_hideListingsModalMessage', {\n count: count\n }),\n headingCSS: 'messaging-modal-title',\n messageAlignment: 'center',\n cssClass: false\n }\n };\n case 'ItemsLostHidden':\n return {\n isCheckboxActive: () => true,\n bulkCssClass: 'outline-dark',\n label: t(\n 'myt_action_showBuyerHiddenActiveListingsLabel'\n ),\n bulkAction: PAGE_BULK_ACTIONS.BUYER_SHOW_ACTIVE,\n modal: {\n heading: t(\n 'myt_action_showBuyerHiddenActiveListingsModalHeading',\n { count: count, itemCount: count }\n ),\n message: t(\n 'myt_action_showBuyerHiddenActiveListingsModalMessage',\n { count: count }\n ),\n dismissable: true,\n wide: false,\n confirmButtonText: t(\n 'myt_action_showBuyerHiddenActiveListingsModalConfirmButtonText'\n ),\n cancelButtonText: t(\n 'myt_action_showBuyerHiddenActiveListingsModalCancelButtonText'\n ),\n icon: 'warning',\n headingCSS: 'messaging-modal-title',\n messageAlignment: 'center',\n cssClass: false\n }\n };\n default:\n return undefined;\n }\n },\n\n default: () => ({})\n };\n\n return actions[listType] ? actions[listType]() : actions['default']();\n};\n","import { selectFiltersState } from 'tradera/apps/my-tradera/app/state/selectors/filters';\n\nconst getDefaultFilters = (filtersState, checkModifiersExist) => {\n return {\n 'filters[paging][page]':\n checkModifiersExist && filtersState.modifiers.paging\n ? filtersState.modifiers.paging.page\n : '',\n 'filters[paging][size]':\n checkModifiersExist && filtersState.modifiers.paging\n ? filtersState.modifiers.paging.size\n : '',\n 'filters[selectedFilterBar]': checkModifiersExist\n ? filtersState.modifiers.selectedFilterBar\n : '',\n 'filters[sellerFilters][feedbackLeft]':\n checkModifiersExist && filtersState.modifiers.sellerFilters\n ? filtersState.modifiers.sellerFilters.feedbackLeft\n : '',\n 'filters[sellerFilters][paid]':\n checkModifiersExist && filtersState.modifiers.sellerFilters\n ? filtersState.modifiers.sellerFilters.paid\n : '',\n 'filters[sellerFilters][shipped]':\n checkModifiersExist && filtersState.modifiers.sellerFilters\n ? filtersState.modifiers.sellerFilters.shipped\n : '',\n 'filters[sellerFilters][hidden]':\n checkModifiersExist && filtersState.modifiers.sellerFilters\n ? filtersState.modifiers.sellerFilters.hidden\n : '',\n 'filters[buyerFilters][feedbackLeft]':\n checkModifiersExist && filtersState.modifiers.buyerFilters\n ? filtersState.modifiers.buyerFilters.feedbackLeft\n : '',\n 'filters[buyerFilters][paid]':\n checkModifiersExist && filtersState.modifiers.buyerFilters\n ? filtersState.modifiers.buyerFilters.paid\n : '',\n 'filters[buyerFilters][hidden]':\n checkModifiersExist && filtersState.modifiers.buyerFilters\n ? filtersState.modifiers.buyerFilters.hidden\n : ''\n };\n};\n\n/** This matches query parameters to state filters.\n * @param {object} state\n * @returns {object}\n */\nexport const getAvailableQueryParams = (state) => {\n const filtersState = selectFiltersState(state);\n\n const checkModifiersExist =\n !!state && filtersState && filtersState.modifiers;\n\n const defaultFilters = getDefaultFilters(filtersState, checkModifiersExist);\n\n return {\n ...defaultFilters,\n 'filters[datatype]': checkModifiersExist\n ? filtersState.modifiers.datatype\n : '',\n 'filters[dateRange][field]':\n checkModifiersExist && filtersState.modifiers.dateRange\n ? filtersState.modifiers.dateRange.field\n : '',\n 'filters[dateRange][from]':\n checkModifiersExist && filtersState.modifiers.dateRange\n ? filtersState.modifiers.dateRange.from\n : '',\n 'filters[dateRange][to]':\n checkModifiersExist && filtersState.modifiers.dateRange\n ? filtersState.modifiers.dateRange.to\n : '',\n 'filters[hasBids]': checkModifiersExist\n ? filtersState.modifiers.hasBids\n : '',\n 'filters[itemCondition]': checkModifiersExist\n ? filtersState.modifiers.itemCondition\n : '',\n 'filters[itemType]': checkModifiersExist\n ? filtersState.modifiers.itemType\n : '',\n 'filters[processState]': checkModifiersExist\n ? filtersState.modifiers.processState\n : '',\n 'filters[purchaseType]': checkModifiersExist\n ? filtersState.modifiers.purchaseType\n : '',\n 'filters[query][properties]':\n checkModifiersExist && filtersState.modifiers.query\n ? filtersState.modifiers.query.properties\n : '',\n 'filters[query][scope]':\n checkModifiersExist && filtersState.modifiers.query\n ? filtersState.modifiers.query.scope\n : '',\n 'filters[query][searchQuery]':\n checkModifiersExist && filtersState.modifiers.query\n ? filtersState.modifiers.query.searchQuery\n : '',\n 'filters[reservePriceReached]': checkModifiersExist\n ? filtersState.modifiers.reservePriceReached\n : '',\n 'filters[searchType]': checkModifiersExist\n ? filtersState.modifiers.searchType\n : '',\n 'filters[sellerFilters][shippingBooked]':\n checkModifiersExist && filtersState.modifiers.sellerFilters\n ? filtersState.modifiers.sellerFilters.shippingBooked\n : '',\n 'filters[sort][order]':\n checkModifiersExist && filtersState.modifiers.sort\n ? filtersState.modifiers.sort.order\n : '',\n 'filters[sort][sorting]':\n checkModifiersExist && filtersState.modifiers.sort\n ? filtersState.modifiers.sort.sorting\n : '',\n 'filters[userIs]': checkModifiersExist\n ? filtersState.modifiers.userIs\n : '',\n 'filters[selectedFilterBar]': checkModifiersExist\n ? filtersState.modifiers.selectedFilterBar\n : ''\n };\n};\n\n/**\n * Checks if a query parameter is in the available parameters.\n * @param {function} getState\n * @param {object} locationQuery\n */\nexport const checkStateOfQueryParams = (getState, locationQuery) => {\n const check = getAvailableQueryParams(getState());\n const checkItem = (item) =>\n !!check[item] &&\n check[item].toString() !== locationQuery[item].toString();\n return Object.keys(check).some((item) => {\n if (!check[item] || !locationQuery[item]) {\n return false;\n }\n return checkItem(item) ? true : false;\n });\n};\n","import mapObject from 'lodash/mapValues';\nimport { REDIRECT_TO_NEWDRAFT_QUERY } from 'tradera/apps/syi/constants';\nimport { OPTIONAL_LANG } from 'tradera/apps/tradera/helpers/optional-lang';\nimport PAGE_TYPES from 'tradera/constants/page-types';\n\nexport const myTraderaUrls = {\n overview: '/my/overview',\n overview2: '/my/overview2',\n buyerOverview: '/my/overview-buyer',\n sellerOverview: '/my/overview-seller',\n accountOverview: '/my/overview-my-account',\n wishlist: '/my/wish-list',\n profile: '/profile/items/:memberId/:cleanedMemberAlias',\n activeItems: '/my/active-items',\n itemsLost: '/my/items-lost',\n active: '/my/active',\n sold: '/my/sold',\n unsold: '/my/unsold',\n listings: '/my/listings',\n listingsUnsold: '/my/listings?tab=unsold',\n bidding: '/my/bidding',\n purchases: '/my/purchases',\n savedSearches: '/my/saved-searches',\n sellerList: '/my/seller-list',\n pickList: '/my/picklist',\n leaveFeedback: '/my/leave-feedback/:role',\n buyerFeedback: '/my/leave-feedback/buyer',\n sellerFeedback: '/my/leave-feedback/seller',\n myFeedback: '/my/feedback',\n invoices: '/my/invoices',\n templates: '/selling/templates',\n payouts: '/my/payouts',\n accounting: '/my/accounting',\n messaging: '/messaging',\n selling: `/selling?${REDIRECT_TO_NEWDRAFT_QUERY}`,\n sellingTemplates: '/selling/templates',\n settings: '/my/settings',\n settingsAccount: '/my/settings/account',\n settingsEmail: '/my/settings/email',\n settingsSelling: '/my/settings/selling',\n settingsNotifications: '/my/settings/notifications',\n settingsSecurity: '/my/settings/security',\n settingsPayouts: '/my/settings/payouts',\n settingsLocalization: '/my/settings/localization',\n buyShippingBags: '/tradera-shop/shipping-bags',\n payeeVerification: '/my/PayeeVerification',\n hyperwalletPayeeVerificationCompleted: '/my/PayeeVerificationCompleted',\n shippingCheckout: '/my/shipping/checkout',\n shippingBook: '/my/shipping',\n shippingConfirmation: '/my/shipping/confirmation/:shipmentCheckoutId',\n invoiceCheckout: '/my/invoices/payment/:invoiceId',\n invoiceConfirmation: '/my/invoices/confirmation/:invoiceId',\n traderaShop: '/tradera-shop',\n notFound: '/my/settings/*'\n} as const;\n\nexport const getMyTraderaUrls = (\n toLocalizedUrl: (url: string) => string\n): Record\n
\n {t('buyerProtectionModal_example')}\n {t('buyerProtectionModal_price')}\n
\n\n \n {t('buyerProtectionModal_example1Text_localized', {\n amount: localizedPriceFormatter(2000)\n })}\n \n \n {localizedPriceFormatter(\n +t(\n 'buyerProtectionModal_example1BuyerProtectionAmount'\n )\n )}\n \n
\n\n \n {t('buyerProtectionModal_example2Text_localized', {\n amount: localizedPriceFormatter(500)\n })}\n \n \n {localizedPriceFormatter(\n +t(\n 'buyerProtectionModal_example2BuyerProtectionAmount'\n )\n )}\n \n
\n >\n \n );\n};\n","import { ModalState } from './modal-state';\nimport type { ErrorMessageCodes } from './error-message-codes';\nimport type { AppDispatch, GetState } from 'tradera/state/configure-store';\nimport { completed, inProgress, setError, reset, startAuth } from './reducer';\nimport { webApiClient } from 'tradera/utils/http';\nimport type {\n BankIdAuthenticationBeginApiRequest,\n BankIdAuthenticationBeginApiResponse,\n BankIdAuthenticationProgressApiResponse,\n BankIdOnFileAuthenticationBeginApiRequest,\n BankIdOnFileAuthenticationBeginApiResponse,\n BeginBankIdSignatoryAuthenticationApiRequest\n} from 'tradera/state/services/types/webapi-auth-generated';\nimport { showSuccessToast } from 'tradera/services/toasts';\nimport { logger } from 'packages/logger';\nimport type { AxiosError } from 'axios';\nimport { type BankIdBeginWithIdApiRequest } from 'tradera/state/services/types/webapi-member-generated';\nimport qs from 'qs';\n\ntype OnError = (message?: ErrorMessageCodes) => void;\ntype OnComplete = (\n bankIdOrderRef?: string | null,\n autoStartToken?: string | null\n) => void;\n\nconst sleep = (delay: number) =>\n new Promise((resolve) => setTimeout(resolve, delay));\n\nexport const startAuthAndOpenModal = (\n onComplete: OnComplete,\n onError: OnError,\n purpose: string,\n contactSsn?: string,\n organizationNumber?: string\n) => {\n return async (dispatch: AppDispatch) => {\n dispatch(reset());\n dispatch(startAuth({ purpose }));\n\n try {\n const { data } = contactSsn\n ? await webApiClient.post<\n BankIdAuthenticationBeginApiResponse,\n BeginBankIdSignatoryAuthenticationApiRequest\n >('/auth/bankid/authenticate-signatory', {\n purpose,\n organizationNumber,\n contactSsn\n })\n : await webApiClient.post<\n BankIdAuthenticationBeginApiResponse,\n BankIdAuthenticationBeginApiRequest\n >('/auth/bankid/authenticate', { purpose });\n\n const errorCode = data.responseStatus\n ?.errorCode as ErrorMessageCodes;\n if (errorCode) {\n dispatch(setError(errorCode));\n onError(errorCode);\n\n logger(`BankId: received error code ${errorCode}`);\n return;\n }\n\n dispatch(\n inProgress({\n autoStartToken: data?.autoStartToken,\n qrData: data?.qrData,\n bankIdOrderRef: data?.bankIdOrderRef,\n contactSsn: contactSsn,\n organizationNumber: organizationNumber\n })\n );\n dispatch(\n bankIdPollProgress(\n onComplete,\n onError,\n contactSsn,\n organizationNumber\n )\n );\n } catch (error) {\n dispatch(setError(undefined));\n onError(undefined);\n\n const maybeAxiosError = error as AxiosError;\n logger(`BankId: received exception ${maybeAxiosError?.message}`);\n }\n };\n};\n\nexport const startAuthWithIdAndOpenModal = (\n onComplete: OnComplete,\n onError: OnError,\n purpose: string,\n memberId: number\n) => {\n return async (dispatch: AppDispatch) => {\n dispatch(reset());\n dispatch(startAuth({ purpose, memberId }));\n\n try {\n const { data } = await webApiClient.post<\n BankIdAuthenticationBeginApiResponse,\n BankIdBeginWithIdApiRequest\n >('/member/profile/bankId-recovery-with-id', {\n memberId\n });\n\n const errorCode = data.responseStatus\n ?.errorCode as ErrorMessageCodes;\n if (errorCode) {\n dispatch(setError(errorCode));\n onError(errorCode);\n\n logger(`BankId: received error code ${errorCode}`);\n return;\n }\n\n dispatch(\n inProgress({\n autoStartToken: data?.autoStartToken,\n qrData: data?.qrData,\n bankIdOrderRef: data?.bankIdOrderRef\n })\n );\n dispatch(\n bankIdPollProgress(\n onComplete,\n onError,\n undefined /* contactSsn */,\n undefined /* organizationNumber */,\n memberId\n )\n );\n } catch (error) {\n dispatch(setError(undefined));\n onError(undefined);\n\n const maybeAxiosError = error as AxiosError;\n logger(`BankId: received exception ${maybeAxiosError?.message}`);\n }\n };\n};\n\nexport const startAuthOnFile = (purpose: string, memberId?: number) => {\n return async (dispatch: AppDispatch) => {\n dispatch(startAuth({ purpose, memberId }));\n\n let autoStartToken: string | null = null;\n try {\n const { data } = await webApiClient.post<\n BankIdOnFileAuthenticationBeginApiResponse,\n BankIdOnFileAuthenticationBeginApiRequest\n >('/auth/bankid/authenticate-on-file', {\n purpose,\n memberId\n });\n\n const errorCode = data.responseStatus\n ?.errorCode as ErrorMessageCodes;\n if (errorCode) {\n dispatch(setError(errorCode));\n logger(`BankId on file: received error code ${errorCode}`);\n return;\n }\n\n autoStartToken = data?.autoStartToken ?? null;\n const bankIdOrderRef = data?.bankIdOrderRef ?? undefined;\n dispatch(\n inProgress({\n autoStartToken,\n bankIdOrderRef\n })\n );\n } catch (error) {\n dispatch(setError(undefined));\n\n const maybeAxiosError = error as AxiosError;\n logger(\n `BankId on file: received exception ${maybeAxiosError?.message}`\n );\n }\n\n return autoStartToken;\n };\n};\n\n/**\n * poll touchweb/webapi to see check if the user has made their bank id auth.\n * this might take some time since the user needs to open up their mobile app with bank id\n */\nconst bankIdPollProgress =\n (\n onComplete: OnComplete,\n onError: OnError,\n contactSsn?: string,\n organizationNumber?: string,\n memberId?: number\n ) =>\n async (dispatch: AppDispatch, getState: GetState) => {\n const state = getState();\n const { modalState, bankIdOrderRef, errorCode } = state.bankId;\n\n if (modalState === ModalState.ERROR) {\n onError(errorCode ?? undefined);\n return;\n }\n\n if (modalState !== ModalState.IN_PROGRESS) {\n return;\n }\n\n if (!bankIdOrderRef) {\n await sleep(3000);\n dispatch(\n bankIdPollProgress(\n onComplete,\n onError,\n contactSsn,\n organizationNumber,\n memberId\n )\n );\n\n return;\n }\n\n try {\n const { data } = contactSsn\n ? await webApiClient.get