import ICustomer, { BasicCustomerTypeEnum, CustomerTypeEnum, IExpeditionInfo } from '../../../Interfaces/Customer'; import { ICustomPriceItem, IG2Customer, IG2Product, IG2ProductExternalValues } from '../../../Interfaces/G2'; import { ICartItem, IIndexedDeclination } from '../../../Interfaces/Cart'; import Org from '../../../lib/Org'; import Space from '../../../lib/Space'; import IndexedProduct from '../../../lib/Indexed/Product'; import { ICustomerGroup } from '../../../Interfaces/Space'; import IDiscountRule from '../../../Interfaces/Rules/IDiscountRule'; import { IExternalServices } from '../../../Interfaces/Space/IExternalService'; export interface IG2PostResponse { type: string; title: string; status: number; traceId: string; errors?: { [key: string]: string[]; }; } export declare const getG2ProductExternalValues: (sku: string, g2Service: IExternalServices, space: Space, org: Org) => Promise; export declare const fetchProductFromG2WithSku: (sku: string, space: Space | string, org: Org | string, logError?: boolean) => Promise; export declare const getG2Customer: (spaceToken: string, customerId: string) => Promise; export declare const getAllNewOrUpdatedCustomersFromG2: (space: Space, allG2Customers: IG2Customer[]) => Promise<{ new: ICustomer[]; updated: ICustomer[]; } | undefined>; export declare const transformG2CustomerToCustomer: (g2Customer: IG2Customer, prevCustomer?: ICustomer, allGroups?: ICustomerGroup[]) => { expedition_info: IExpeditionInfo[]; company_info: import("../../../Interfaces/Customer").ICompanyInfoCustomer; basic_info: { customer_professionnal_info: { external_customer_class?: string | undefined; external_price_class?: string | undefined; external_customer_code?: string | undefined; external_customer_group?: string | undefined; terms_code?: string | undefined; professionnal_title: string; proof_doc_value: string; blocked?: boolean | undefined; }; customer_prefered_lang?: string | undefined; customer_firstname: string; customer_lastname: string; customer_phone?: string | undefined; customer_photocopier?: string | undefined; customer_email?: string | undefined; customer_image?: string | undefined; customer_type?: BasicCustomerTypeEnum | undefined; customer_accountStatus: "active" | "inactive" | "pending"; customer_communicationPreference: "email" | "phone"; customer_position?: string | undefined; } | { customer_professionnal_info: { external_customer_class?: string | undefined; external_price_class?: string | undefined; external_customer_code?: string | undefined; external_customer_group?: string | undefined; terms_code?: string | undefined; professionnal_title: string; proof_doc_value: string; blocked?: boolean | undefined; }; customer_prefered_lang?: string | undefined; customer_firstname: string; customer_lastname: string; customer_phone?: string | undefined; customer_photocopier?: string | undefined; customer_email?: string | undefined; customer_type: BasicCustomerTypeEnum; customer_image?: string | undefined; customer_accountStatus: "active" | "inactive" | "pending"; customer_communicationPreference: "email" | "phone"; customer_position?: string | undefined; }; represented_by?: string | undefined; has_credit_line?: boolean | undefined; credit_line_max?: number | undefined; hash?: string | undefined; type: CustomerTypeEnum; id: string; rating: import("../../../Interfaces/Customer/ICustomerRating").default; customer_level: number; fb_id?: string | undefined; temp_hash?: string | undefined; validationCode?: string | undefined; stripe_customer_id?: string | undefined; client_group_slug?: string | undefined; other_info?: string | undefined; credit_line_used?: number | undefined; prefered_store?: string | undefined; mailchimp_id?: string | undefined; date_accepted_terms?: string | undefined; last_login?: Date | null | undefined; last_activity?: Date | null | undefined; store_credits?: import("../../../Interfaces/Customer/IStoreCredit").ICustomerStoreCredit[] | undefined; } | { expedition_info: IExpeditionInfo[]; company_info: import("../../../Interfaces/Customer").ICompanyInfoCustomer; basic_info: { customer_professionnal_info: { external_customer_class?: string | undefined; external_price_class?: string | undefined; external_customer_code?: string | undefined; external_customer_group?: string | undefined; terms_code?: string | undefined; professionnal_title: string; proof_doc_value: string; blocked?: boolean | undefined; }; customer_prefered_lang?: string | undefined; customer_firstname: string; customer_lastname: string; customer_phone?: string | undefined; customer_photocopier?: string | undefined; customer_email?: string | undefined; customer_image?: string | undefined; customer_type?: BasicCustomerTypeEnum | undefined; customer_accountStatus: "active" | "inactive" | "pending"; customer_communicationPreference: "email" | "phone"; customer_position?: string | undefined; } | { customer_professionnal_info: { external_customer_class?: string | undefined; external_price_class?: string | undefined; external_customer_code?: string | undefined; external_customer_group?: string | undefined; terms_code?: string | undefined; professionnal_title: string; proof_doc_value: string; blocked?: boolean | undefined; }; customer_prefered_lang?: string | undefined; customer_firstname: string; customer_lastname: string; customer_phone?: string | undefined; customer_photocopier?: string | undefined; customer_email?: string | undefined; customer_type: BasicCustomerTypeEnum; customer_image?: string | undefined; customer_accountStatus: "active" | "inactive" | "pending"; customer_communicationPreference: "email" | "phone"; customer_position?: string | undefined; }; represented_by?: string | undefined; has_credit_line?: boolean | undefined; credit_line_max?: number | undefined; hash?: string | undefined; type: CustomerTypeEnum; id: string; rating: { from: number; to: number; levels: never[]; }; customer_level: number; }; /** * Verifies if customer exists in G2. * @param customerID - Customer ID for G2 fetch * @param space - Space Object * @param org - Org Object */ export declare const checkIfCustomerExistsInG2: (customerID: string, space: Space, org: Org) => Promise; /** * Updates customer in database with new info found in G2. * @param customerID - Customer ID for G2 fetch * @param space - Space Object * @param org - Org Object * @param addToDB - if updated customer should be saved to database (defaults to true) * @param skipEmailCheck - if check for unique email should be skiped or not (defaults to false) */ export declare const updateCustomerWithG2Info: (customerID: string, space: Space, org: Org, addToDB?: boolean, skipEmailCheck?: boolean) => Promise; export declare const getG2DiscountFromCode: (code: string) => number | undefined; export declare const getG2CustomerTypeFromCode: (code: string) => string; export declare const fetchCustomPriceList: (spaceToken: string, customerId: string, ignoreDashPriceList?: boolean, onlyForProductSlugs?: string[]) => Promise; /** * Constructs a custom price list for a PRO Groupe Richer customer, based on data from G2 and AddioCommerce. * @param space - The space Object for appointed customer * @param idClient - The customer's G2 ID * @param ignoreDashPriceList - Optionnal. If customer group prices found in Addio should be ignored, and only G2 prices be considered. * @param onlyForProductSlugs - Optionnal. Array of skus for which the list should be generated (used to not go through all products in database if only certain products are needed) */ export declare const getCustomPriceList: (space: Space, idClient: string, ignoreDashPriceList?: boolean, onlyForProductSlugs?: string[]) => Promise; /** * Get promise to purchase additionnal escompte equivalent from customPriceList for specific cart item * @param customPriceList - The pro customers custom price list * @param item - The cart item to check */ export declare const getItemEscompteSupp: (customPriceList: ICustomPriceItem[], item: ICartItem | IIndexedDeclination) => ICustomPriceItem | undefined; export declare const groupArrayOfItemsByItemAndCorrespondingEscompteItem: (items: ICartItem[]) => ICartItem[]; export declare const buildEscompteSuppCartItem: (escompteItems: IndexedProduct[], customPriceList: ICustomPriceItem[], escompteSuppItem: ICustomPriceItem, item: ICartItem) => ICartItem | undefined; export declare const isEscompteSuppItem: (itemSku: string) => boolean; /** * Adjusts prices in item provided with corresponding custom price list item, if it exists. * @param item - The cart item or indexed declination * @param customPriceList - The customers custom price list * @param options.removeTierPricing - Optionnal. If tier-pricing should be removed from item returned * @param options.setNetPriceAsRegular - Optionnal. If true and custom price found is NET (entente), sets the NET price as regular price (normaly set to discount_price) */ export declare const checkForCustomPriceEquivalent: (item: IIndexedDeclination | ICartItem, customPriceList: ICustomPriceItem[], options?: { removeTierPricing?: boolean; setNetPriceAsRegular?: boolean; }) => IIndexedDeclination | ICartItem; export declare const getCustomIncentiveAmount: (customPriceList: ICustomPriceItem[] | undefined) => number | undefined; export declare const getDiscountRulesWithCustomIncentive: (incentiveAmount: number, discountRules: IDiscountRule[]) => IDiscountRule[] | undefined; export declare const getCustomIncentiveInfo: (customPriceList: ICustomPriceItem[] | undefined, discountRules: IDiscountRule[], defaultIncentiveAmount?: number) => { amount: number; updatedDiscountRules: IDiscountRule[]; reset?: boolean; } | undefined;