addio-admin-sdk 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +17 -0
- package/.env.dev +15 -0
- package/.github/workflows/publish_coverage.yaml +69 -0
- package/addio-sdk-doc.md +1380 -0
- package/changelog.md +353 -0
- package/dist/Interfaces/Address/index.d.ts +21 -0
- package/dist/Interfaces/Address/index.js +17 -0
- package/dist/Interfaces/Address/index.js.map +1 -0
- package/dist/Interfaces/Algolia/index.d.ts +145 -0
- package/dist/Interfaces/Algolia/index.js +3 -0
- package/dist/Interfaces/Algolia/index.js.map +1 -0
- package/dist/Interfaces/Attachement/index.d.ts +5 -0
- package/dist/Interfaces/Attachement/index.js +3 -0
- package/dist/Interfaces/Attachement/index.js.map +1 -0
- package/dist/Interfaces/Attribute/index.d.ts +47 -0
- package/dist/Interfaces/Attribute/index.js +11 -0
- package/dist/Interfaces/Attribute/index.js.map +1 -0
- package/dist/Interfaces/BGJob/index.d.ts +56 -0
- package/dist/Interfaces/BGJob/index.js +37 -0
- package/dist/Interfaces/BGJob/index.js.map +1 -0
- package/dist/Interfaces/BaseClass/index.d.ts +8 -0
- package/dist/Interfaces/BaseClass/index.js +3 -0
- package/dist/Interfaces/BaseClass/index.js.map +1 -0
- package/dist/Interfaces/Blog/IBlogArticle.d.ts +18 -0
- package/dist/Interfaces/Blog/IBlogArticle.js +3 -0
- package/dist/Interfaces/Blog/IBlogArticle.js.map +1 -0
- package/dist/Interfaces/Blog/IBlogAuthor.d.ts +7 -0
- package/dist/Interfaces/Blog/IBlogAuthor.js +3 -0
- package/dist/Interfaces/Blog/IBlogAuthor.js.map +1 -0
- package/dist/Interfaces/Blog/IBlogCategory.d.ts +9 -0
- package/dist/Interfaces/Blog/IBlogCategory.js +3 -0
- package/dist/Interfaces/Blog/IBlogCategory.js.map +1 -0
- package/dist/Interfaces/Blog/IBlogComment.d.ts +13 -0
- package/dist/Interfaces/Blog/IBlogComment.js +3 -0
- package/dist/Interfaces/Blog/IBlogComment.js.map +1 -0
- package/dist/Interfaces/Blog/IBlogKeywords.d.ts +9 -0
- package/dist/Interfaces/Blog/IBlogKeywords.js +3 -0
- package/dist/Interfaces/Blog/IBlogKeywords.js.map +1 -0
- package/dist/Interfaces/Booking/index.d.ts +68 -0
- package/dist/Interfaces/Booking/index.js +18 -0
- package/dist/Interfaces/Booking/index.js.map +1 -0
- package/dist/Interfaces/Brand/index.d.ts +13 -0
- package/dist/Interfaces/Brand/index.js +3 -0
- package/dist/Interfaces/Brand/index.js.map +1 -0
- package/dist/Interfaces/CMS/Creator/index.d.ts +12 -0
- package/dist/Interfaces/CMS/Creator/index.js +3 -0
- package/dist/Interfaces/CMS/Creator/index.js.map +1 -0
- package/dist/Interfaces/CMS/Reader/index.d.ts +47 -0
- package/dist/Interfaces/CMS/Reader/index.js +3 -0
- package/dist/Interfaces/CMS/Reader/index.js.map +1 -0
- package/dist/Interfaces/CMS/index.d.ts +25 -0
- package/dist/Interfaces/CMS/index.js +3 -0
- package/dist/Interfaces/CMS/index.js.map +1 -0
- package/dist/Interfaces/Cart/IPandaPayload.d.ts +64 -0
- package/dist/Interfaces/Cart/IPandaPayload.js +19 -0
- package/dist/Interfaces/Cart/IPandaPayload.js.map +1 -0
- package/dist/Interfaces/Cart/IPaymentCard.d.ts +22 -0
- package/dist/Interfaces/Cart/IPaymentCard.js +45 -0
- package/dist/Interfaces/Cart/IPaymentCard.js.map +1 -0
- package/dist/Interfaces/Cart/IPaypalPayload.d.ts +9 -0
- package/dist/Interfaces/Cart/IPaypalPayload.js +3 -0
- package/dist/Interfaces/Cart/IPaypalPayload.js.map +1 -0
- package/dist/Interfaces/Cart/IPaysafePayload.d.ts +72 -0
- package/dist/Interfaces/Cart/IPaysafePayload.js +3 -0
- package/dist/Interfaces/Cart/IPaysafePayload.js.map +1 -0
- package/dist/Interfaces/Cart/IStripePayload.d.ts +66 -0
- package/dist/Interfaces/Cart/IStripePayload.js +3 -0
- package/dist/Interfaces/Cart/IStripePayload.js.map +1 -0
- package/dist/Interfaces/Cart/index.d.ts +395 -0
- package/dist/Interfaces/Cart/index.js +182 -0
- package/dist/Interfaces/Cart/index.js.map +1 -0
- package/dist/Interfaces/Catalogue/index.d.ts +68 -0
- package/dist/Interfaces/Catalogue/index.js +38 -0
- package/dist/Interfaces/Catalogue/index.js.map +1 -0
- package/dist/Interfaces/Category/index.d.ts +26 -0
- package/dist/Interfaces/Category/index.js +3 -0
- package/dist/Interfaces/Category/index.js.map +1 -0
- package/dist/Interfaces/Chart/index.d.ts +11 -0
- package/dist/Interfaces/Chart/index.js +3 -0
- package/dist/Interfaces/Chart/index.js.map +1 -0
- package/dist/Interfaces/Class/index.d.ts +8 -0
- package/dist/Interfaces/Class/index.js +3 -0
- package/dist/Interfaces/Class/index.js.map +1 -0
- package/dist/Interfaces/Consent/index.d.ts +6 -0
- package/dist/Interfaces/Consent/index.js +3 -0
- package/dist/Interfaces/Consent/index.js.map +1 -0
- package/dist/Interfaces/Context/IContextProps.d.ts +5 -0
- package/dist/Interfaces/Context/IContextProps.js +3 -0
- package/dist/Interfaces/Context/IContextProps.js.map +1 -0
- package/dist/Interfaces/Context/IContextState.d.ts +15 -0
- package/dist/Interfaces/Context/IContextState.js +3 -0
- package/dist/Interfaces/Context/IContextState.js.map +1 -0
- package/dist/Interfaces/Customer/ICustomerBadge.d.ts +2 -0
- package/dist/Interfaces/Customer/ICustomerBadge.js +3 -0
- package/dist/Interfaces/Customer/ICustomerBadge.js.map +1 -0
- package/dist/Interfaces/Customer/ICustomerRating.d.ts +10 -0
- package/dist/Interfaces/Customer/ICustomerRating.js +3 -0
- package/dist/Interfaces/Customer/ICustomerRating.js.map +1 -0
- package/dist/Interfaces/Customer/index.d.ts +92 -0
- package/dist/Interfaces/Customer/index.js +159 -0
- package/dist/Interfaces/Customer/index.js.map +1 -0
- package/dist/Interfaces/Declination/index.d.ts +106 -0
- package/dist/Interfaces/Declination/index.js +65 -0
- package/dist/Interfaces/Declination/index.js.map +1 -0
- package/dist/Interfaces/Delivery/CalendarDay.d.ts +9 -0
- package/dist/Interfaces/Delivery/CalendarDay.js +12 -0
- package/dist/Interfaces/Delivery/CalendarDay.js.map +1 -0
- package/dist/Interfaces/Delivery/Driver.d.ts +7 -0
- package/dist/Interfaces/Delivery/Driver.js +10 -0
- package/dist/Interfaces/Delivery/Driver.js.map +1 -0
- package/dist/Interfaces/Delivery/PlannedOrder.d.ts +26 -0
- package/dist/Interfaces/Delivery/PlannedOrder.js +20 -0
- package/dist/Interfaces/Delivery/PlannedOrder.js.map +1 -0
- package/dist/Interfaces/Delivery/ScheduledRun.d.ts +14 -0
- package/dist/Interfaces/Delivery/ScheduledRun.js +15 -0
- package/dist/Interfaces/Delivery/ScheduledRun.js.map +1 -0
- package/dist/Interfaces/Delivery/Truck.d.ts +21 -0
- package/dist/Interfaces/Delivery/Truck.js +25 -0
- package/dist/Interfaces/Delivery/Truck.js.map +1 -0
- package/dist/Interfaces/Directions/index.d.ts +72 -0
- package/dist/Interfaces/Directions/index.js +3 -0
- package/dist/Interfaces/Directions/index.js.map +1 -0
- package/dist/Interfaces/Document/index.d.ts +8 -0
- package/dist/Interfaces/Document/index.js +3 -0
- package/dist/Interfaces/Document/index.js.map +1 -0
- package/dist/Interfaces/Elastic/index.d.ts +89 -0
- package/dist/Interfaces/Elastic/index.js +3 -0
- package/dist/Interfaces/Elastic/index.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/I3DPrintEmail.d.ts +11 -0
- package/dist/Interfaces/Email/CustomGR/I3DPrintEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/I3DPrintEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/IBorrowToolsEmail.d.ts +15 -0
- package/dist/Interfaces/Email/CustomGR/IBorrowToolsEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/IBorrowToolsEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/IPickupMaterialsEmail.d.ts +12 -0
- package/dist/Interfaces/Email/CustomGR/IPickupMaterialsEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/IPickupMaterialsEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/IPreMeetingFormEmail.d.ts +36 -0
- package/dist/Interfaces/Email/CustomGR/IPreMeetingFormEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/IPreMeetingFormEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/ISponsorRequestEmail.d.ts +12 -0
- package/dist/Interfaces/Email/CustomGR/ISponsorRequestEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/ISponsorRequestEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/ITransportEmail.d.ts +12 -0
- package/dist/Interfaces/Email/CustomGR/ITransportEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/ITransportEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/ITransportQuoteEmail.d.ts +12 -0
- package/dist/Interfaces/Email/CustomGR/ITransportQuoteEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/ITransportQuoteEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/IVegetalsEmail.d.ts +16 -0
- package/dist/Interfaces/Email/CustomGR/IVegetalsEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/IVegetalsEmail.js.map +1 -0
- package/dist/Interfaces/Email/CustomGR/IWishlistEmail.d.ts +15 -0
- package/dist/Interfaces/Email/CustomGR/IWishlistEmail.js +3 -0
- package/dist/Interfaces/Email/CustomGR/IWishlistEmail.js.map +1 -0
- package/dist/Interfaces/Email/IAbandonnedCartEmail.d.ts +29 -0
- package/dist/Interfaces/Email/IAbandonnedCartEmail.js +3 -0
- package/dist/Interfaces/Email/IAbandonnedCartEmail.js.map +1 -0
- package/dist/Interfaces/Email/IAccountConfirmationEmail.d.ts +22 -0
- package/dist/Interfaces/Email/IAccountConfirmationEmail.js +3 -0
- package/dist/Interfaces/Email/IAccountConfirmationEmail.js.map +1 -0
- package/dist/Interfaces/Email/IApplicationEmail.d.ts +19 -0
- package/dist/Interfaces/Email/IApplicationEmail.js +3 -0
- package/dist/Interfaces/Email/IApplicationEmail.js.map +1 -0
- package/dist/Interfaces/Email/IBackInStockEmail.d.ts +21 -0
- package/dist/Interfaces/Email/IBackInStockEmail.js +3 -0
- package/dist/Interfaces/Email/IBackInStockEmail.js.map +1 -0
- package/dist/Interfaces/Email/IContactEmail.d.ts +20 -0
- package/dist/Interfaces/Email/IContactEmail.js +3 -0
- package/dist/Interfaces/Email/IContactEmail.js.map +1 -0
- package/dist/Interfaces/Email/ICustomerBookingAdminEmail.d.ts +15 -0
- package/dist/Interfaces/Email/ICustomerBookingAdminEmail.js +3 -0
- package/dist/Interfaces/Email/ICustomerBookingAdminEmail.js.map +1 -0
- package/dist/Interfaces/Email/ICustomerBookingEmail.d.ts +14 -0
- package/dist/Interfaces/Email/ICustomerBookingEmail.js +3 -0
- package/dist/Interfaces/Email/ICustomerBookingEmail.js.map +1 -0
- package/dist/Interfaces/Email/IEmail.d.ts +20 -0
- package/dist/Interfaces/Email/IEmail.js +70 -0
- package/dist/Interfaces/Email/IEmail.js.map +1 -0
- package/dist/Interfaces/Email/IOrderConfirmationEmail.d.ts +47 -0
- package/dist/Interfaces/Email/IOrderConfirmationEmail.js +3 -0
- package/dist/Interfaces/Email/IOrderConfirmationEmail.js.map +1 -0
- package/dist/Interfaces/Email/IPasswordResetEmail.d.ts +17 -0
- package/dist/Interfaces/Email/IPasswordResetEmail.js +3 -0
- package/dist/Interfaces/Email/IPasswordResetEmail.js.map +1 -0
- package/dist/Interfaces/Email/IPhotoShootEmail.d.ts +14 -0
- package/dist/Interfaces/Email/IPhotoShootEmail.js +3 -0
- package/dist/Interfaces/Email/IPhotoShootEmail.js.map +1 -0
- package/dist/Interfaces/Email/IPickupConfirmation.d.ts +23 -0
- package/dist/Interfaces/Email/IPickupConfirmation.js +3 -0
- package/dist/Interfaces/Email/IPickupConfirmation.js.map +1 -0
- package/dist/Interfaces/Email/IQuoteApprobationEmail.d.ts +29 -0
- package/dist/Interfaces/Email/IQuoteApprobationEmail.js +3 -0
- package/dist/Interfaces/Email/IQuoteApprobationEmail.js.map +1 -0
- package/dist/Interfaces/Email/IShippingConfirmation.d.ts +23 -0
- package/dist/Interfaces/Email/IShippingConfirmation.js +3 -0
- package/dist/Interfaces/Email/IShippingConfirmation.js.map +1 -0
- package/dist/Interfaces/Email/IWelcomeEmail.d.ts +19 -0
- package/dist/Interfaces/Email/IWelcomeEmail.js +3 -0
- package/dist/Interfaces/Email/IWelcomeEmail.js.map +1 -0
- package/dist/Interfaces/ExportSchema/index.d.ts +7 -0
- package/dist/Interfaces/ExportSchema/index.js +3 -0
- package/dist/Interfaces/ExportSchema/index.js.map +1 -0
- package/dist/Interfaces/ExternalService/BaseExternalService.d.ts +12 -0
- package/dist/Interfaces/ExternalService/BaseExternalService.js +3 -0
- package/dist/Interfaces/ExternalService/BaseExternalService.js.map +1 -0
- package/dist/Interfaces/ExternalService/index.d.ts +9 -0
- package/dist/Interfaces/ExternalService/index.js +3 -0
- package/dist/Interfaces/ExternalService/index.js.map +1 -0
- package/dist/Interfaces/G2/index.d.ts +286 -0
- package/dist/Interfaces/G2/index.js +32 -0
- package/dist/Interfaces/G2/index.js.map +1 -0
- package/dist/Interfaces/Indexed/Product/IIndexedLastSavedProduct.d.ts +20 -0
- package/dist/Interfaces/Indexed/Product/IIndexedLastSavedProduct.js +3 -0
- package/dist/Interfaces/Indexed/Product/IIndexedLastSavedProduct.js.map +1 -0
- package/dist/Interfaces/Indexed/Product/index.d.ts +91 -0
- package/dist/Interfaces/Indexed/Product/index.js +316 -0
- package/dist/Interfaces/Indexed/Product/index.js.map +1 -0
- package/dist/Interfaces/Inventory/index.d.ts +19 -0
- package/dist/Interfaces/Inventory/index.js +9 -0
- package/dist/Interfaces/Inventory/index.js.map +1 -0
- package/dist/Interfaces/Invoice/index.d.ts +4 -0
- package/dist/Interfaces/Invoice/index.js +3 -0
- package/dist/Interfaces/Invoice/index.js.map +1 -0
- package/dist/Interfaces/MarketplacePublication/MarketplaceOrderData.d.ts +3 -0
- package/dist/Interfaces/MarketplacePublication/MarketplaceOrderData.js +3 -0
- package/dist/Interfaces/MarketplacePublication/MarketplaceOrderData.js.map +1 -0
- package/dist/Interfaces/MarketplacePublication/index.d.ts +23 -0
- package/dist/Interfaces/MarketplacePublication/index.js +34 -0
- package/dist/Interfaces/MarketplacePublication/index.js.map +1 -0
- package/dist/Interfaces/Operations/ICreatedBy.d.ts +6 -0
- package/dist/Interfaces/Operations/ICreatedBy.js +3 -0
- package/dist/Interfaces/Operations/ICreatedBy.js.map +1 -0
- package/dist/Interfaces/Operations/IUpdate.d.ts +5 -0
- package/dist/Interfaces/Operations/IUpdate.js +3 -0
- package/dist/Interfaces/Operations/IUpdate.js.map +1 -0
- package/dist/Interfaces/Order/index.d.ts +4 -0
- package/dist/Interfaces/Order/index.js +3 -0
- package/dist/Interfaces/Order/index.js.map +1 -0
- package/dist/Interfaces/Org/IRelUser.d.ts +9 -0
- package/dist/Interfaces/Org/IRelUser.js +3 -0
- package/dist/Interfaces/Org/IRelUser.js.map +1 -0
- package/dist/Interfaces/Org/index.d.ts +29 -0
- package/dist/Interfaces/Org/index.js +13 -0
- package/dist/Interfaces/Org/index.js.map +1 -0
- package/dist/Interfaces/Payment/index.d.ts +11 -0
- package/dist/Interfaces/Payment/index.js +3 -0
- package/dist/Interfaces/Payment/index.js.map +1 -0
- package/dist/Interfaces/Product/IAttributeFamily.d.ts +6 -0
- package/dist/Interfaces/Product/IAttributeFamily.js +3 -0
- package/dist/Interfaces/Product/IAttributeFamily.js.map +1 -0
- package/dist/Interfaces/Product/IImportProduct.d.ts +42 -0
- package/dist/Interfaces/Product/IImportProduct.js +967 -0
- package/dist/Interfaces/Product/IImportProduct.js.map +1 -0
- package/dist/Interfaces/Product/IInventoryItem.d.ts +81 -0
- package/dist/Interfaces/Product/IInventoryItem.js +37 -0
- package/dist/Interfaces/Product/IInventoryItem.js.map +1 -0
- package/dist/Interfaces/Product/IPricing.d.ts +177 -0
- package/dist/Interfaces/Product/IPricing.js +175 -0
- package/dist/Interfaces/Product/IPricing.js.map +1 -0
- package/dist/Interfaces/Product/index.d.ts +121 -0
- package/dist/Interfaces/Product/index.js +57 -0
- package/dist/Interfaces/Product/index.js.map +1 -0
- package/dist/Interfaces/ProductAttribute/index.d.ts +11 -0
- package/dist/Interfaces/ProductAttribute/index.js +3 -0
- package/dist/Interfaces/ProductAttribute/index.js.map +1 -0
- package/dist/Interfaces/ProductGroup/index.d.ts +20 -0
- package/dist/Interfaces/ProductGroup/index.js +3 -0
- package/dist/Interfaces/ProductGroup/index.js.map +1 -0
- package/dist/Interfaces/PromiseToPurchase/BankType.d.ts +41 -0
- package/dist/Interfaces/PromiseToPurchase/BankType.js +43 -0
- package/dist/Interfaces/PromiseToPurchase/BankType.js.map +1 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedBankUsed.d.ts +33 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedBankUsed.js +16 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedBankUsed.js.map +1 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedCustomerPromiseToPurchase.d.ts +19 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedCustomerPromiseToPurchase.js +3 -0
- package/dist/Interfaces/PromiseToPurchase/IIndexedCustomerPromiseToPurchase.js.map +1 -0
- package/dist/Interfaces/PromiseToPurchase/index.d.ts +50 -0
- package/dist/Interfaces/PromiseToPurchase/index.js +14 -0
- package/dist/Interfaces/PromiseToPurchase/index.js.map +1 -0
- package/dist/Interfaces/PurchaseOrder/index.d.ts +17 -0
- package/dist/Interfaces/PurchaseOrder/index.js +3 -0
- package/dist/Interfaces/PurchaseOrder/index.js.map +1 -0
- package/dist/Interfaces/Query/IBrandQueryOptions.d.ts +11 -0
- package/dist/Interfaces/Query/IBrandQueryOptions.js +3 -0
- package/dist/Interfaces/Query/IBrandQueryOptions.js.map +1 -0
- package/dist/Interfaces/Query/ICategoryQueryOptions.d.ts +11 -0
- package/dist/Interfaces/Query/ICategoryQueryOptions.js +3 -0
- package/dist/Interfaces/Query/ICategoryQueryOptions.js.map +1 -0
- package/dist/Interfaces/Query/IProductQueryOptions.d.ts +15 -0
- package/dist/Interfaces/Query/IProductQueryOptions.js +3 -0
- package/dist/Interfaces/Query/IProductQueryOptions.js.map +1 -0
- package/dist/Interfaces/Quote/QuoteCMS/actions.d.ts +6 -0
- package/dist/Interfaces/Quote/QuoteCMS/actions.js +50 -0
- package/dist/Interfaces/Quote/QuoteCMS/actions.js.map +1 -0
- package/dist/Interfaces/Quote/QuoteCMS/defaults.d.ts +4 -0
- package/dist/Interfaces/Quote/QuoteCMS/defaults.js +32 -0
- package/dist/Interfaces/Quote/QuoteCMS/defaults.js.map +1 -0
- package/dist/Interfaces/Quote/QuoteCMS/enums.d.ts +50 -0
- package/dist/Interfaces/Quote/QuoteCMS/enums.js +61 -0
- package/dist/Interfaces/Quote/QuoteCMS/enums.js.map +1 -0
- package/dist/Interfaces/Quote/index.d.ts +5 -0
- package/dist/Interfaces/Quote/index.js +3 -0
- package/dist/Interfaces/Quote/index.js.map +1 -0
- package/dist/Interfaces/Rules/IDiscountRule.d.ts +131 -0
- package/dist/Interfaces/Rules/IDiscountRule.js +96 -0
- package/dist/Interfaces/Rules/IDiscountRule.js.map +1 -0
- package/dist/Interfaces/Services/IAddServiceResponse.d.ts +4 -0
- package/dist/Interfaces/Services/IAddServiceResponse.js +3 -0
- package/dist/Interfaces/Services/IAddServiceResponse.js.map +1 -0
- package/dist/Interfaces/Services/IService.d.ts +12 -0
- package/dist/Interfaces/Services/IService.js +3 -0
- package/dist/Interfaces/Services/IService.js.map +1 -0
- package/dist/Interfaces/Services/IServiceSecret.d.ts +8 -0
- package/dist/Interfaces/Services/IServiceSecret.js +3 -0
- package/dist/Interfaces/Services/IServiceSecret.js.map +1 -0
- package/dist/Interfaces/Shipping/Shipstation/carriers.d.ts +10 -0
- package/dist/Interfaces/Shipping/Shipstation/carriers.js +3 -0
- package/dist/Interfaces/Shipping/Shipstation/carriers.js.map +1 -0
- package/dist/Interfaces/Shipping/Shipstation/order.d.ts +227 -0
- package/dist/Interfaces/Shipping/Shipstation/order.js +3 -0
- package/dist/Interfaces/Shipping/Shipstation/order.js.map +1 -0
- package/dist/Interfaces/Shipping/Shipstation/quote.d.ts +31 -0
- package/dist/Interfaces/Shipping/Shipstation/quote.js +3 -0
- package/dist/Interfaces/Shipping/Shipstation/quote.js.map +1 -0
- package/dist/Interfaces/Shipping/Shiptime/order.d.ts +54 -0
- package/dist/Interfaces/Shipping/Shiptime/order.js +49 -0
- package/dist/Interfaces/Shipping/Shiptime/order.js.map +1 -0
- package/dist/Interfaces/Shipping/Shiptime/quote.d.ts +111 -0
- package/dist/Interfaces/Shipping/Shiptime/quote.js +3 -0
- package/dist/Interfaces/Shipping/Shiptime/quote.js.map +1 -0
- package/dist/Interfaces/Slider/GR.d.ts +130 -0
- package/dist/Interfaces/Slider/GR.js +272 -0
- package/dist/Interfaces/Slider/GR.js.map +1 -0
- package/dist/Interfaces/Slider/index.d.ts +14 -0
- package/dist/Interfaces/Slider/index.js +3 -0
- package/dist/Interfaces/Slider/index.js.map +1 -0
- package/dist/Interfaces/Space/IMember.d.ts +16 -0
- package/dist/Interfaces/Space/IMember.js +10 -0
- package/dist/Interfaces/Space/IMember.js.map +1 -0
- package/dist/Interfaces/Space/index.d.ts +311 -0
- package/dist/Interfaces/Space/index.js +78 -0
- package/dist/Interfaces/Space/index.js.map +1 -0
- package/dist/Interfaces/Specials/bb.d.ts +27 -0
- package/dist/Interfaces/Specials/bb.js +23 -0
- package/dist/Interfaces/Specials/bb.js.map +1 -0
- package/dist/Interfaces/Specials/gr.d.ts +61 -0
- package/dist/Interfaces/Specials/gr.js +3 -0
- package/dist/Interfaces/Specials/gr.js.map +1 -0
- package/dist/Interfaces/StockNotification/index.d.ts +7 -0
- package/dist/Interfaces/StockNotification/index.js +3 -0
- package/dist/Interfaces/StockNotification/index.js.map +1 -0
- package/dist/Interfaces/Store/index.d.ts +60 -0
- package/dist/Interfaces/Store/index.js +28 -0
- package/dist/Interfaces/Store/index.js.map +1 -0
- package/dist/Interfaces/Supplier/ICommand.d.ts +11 -0
- package/dist/Interfaces/Supplier/ICommand.js +3 -0
- package/dist/Interfaces/Supplier/ICommand.js.map +1 -0
- package/dist/Interfaces/Supplier/index.d.ts +36 -0
- package/dist/Interfaces/Supplier/index.js +25 -0
- package/dist/Interfaces/Supplier/index.js.map +1 -0
- package/dist/Interfaces/Tag/index.d.ts +18 -0
- package/dist/Interfaces/Tag/index.js +3 -0
- package/dist/Interfaces/Tag/index.js.map +1 -0
- package/dist/Interfaces/Tax/index.d.ts +12 -0
- package/dist/Interfaces/Tax/index.js +3 -0
- package/dist/Interfaces/Tax/index.js.map +1 -0
- package/dist/Interfaces/TransferRequest/index.d.ts +32 -0
- package/dist/Interfaces/TransferRequest/index.js +27 -0
- package/dist/Interfaces/TransferRequest/index.js.map +1 -0
- package/dist/Interfaces/Translation/index.d.ts +4 -0
- package/dist/Interfaces/Translation/index.js +3 -0
- package/dist/Interfaces/Translation/index.js.map +1 -0
- package/dist/Interfaces/Update/index.d.ts +10 -0
- package/dist/Interfaces/Update/index.js +3 -0
- package/dist/Interfaces/Update/index.js.map +1 -0
- package/dist/Interfaces/User/IUser.d.ts +29 -0
- package/dist/Interfaces/User/IUser.js +9 -0
- package/dist/Interfaces/User/IUser.js.map +1 -0
- package/dist/Interfaces/Version/index.d.ts +11 -0
- package/dist/Interfaces/Version/index.js +3 -0
- package/dist/Interfaces/Version/index.js.map +1 -0
- package/dist/Interfaces/Wishlist/index.d.ts +7 -0
- package/dist/Interfaces/Wishlist/index.js +3 -0
- package/dist/Interfaces/Wishlist/index.js.map +1 -0
- package/dist/constants/Interfaces/IBaseApi.d.ts +15 -0
- package/dist/constants/Interfaces/IBaseApi.js +3 -0
- package/dist/constants/Interfaces/IBaseApi.js.map +1 -0
- package/dist/constants/Interfaces/IEndpointResult.d.ts +9 -0
- package/dist/constants/Interfaces/IEndpointResult.js +3 -0
- package/dist/constants/Interfaces/IEndpointResult.js.map +1 -0
- package/dist/constants/enums.d.ts +6 -0
- package/dist/constants/enums.js +11 -0
- package/dist/constants/enums.js.map +1 -0
- package/dist/constants/errors.d.ts +27 -0
- package/dist/constants/errors.js +33 -0
- package/dist/constants/errors.js.map +1 -0
- package/dist/constants/version.d.ts +2 -0
- package/dist/constants/version.js +6 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +417 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Attribute/index.d.ts +14 -0
- package/dist/lib/Attribute/index.js +250 -0
- package/dist/lib/Attribute/index.js.map +1 -0
- package/dist/lib/BGJob/index.d.ts +9 -0
- package/dist/lib/BGJob/index.js +377 -0
- package/dist/lib/BGJob/index.js.map +1 -0
- package/dist/lib/BackgroundWorker/index.d.ts +34 -0
- package/dist/lib/BackgroundWorker/index.js +73 -0
- package/dist/lib/BackgroundWorker/index.js.map +1 -0
- package/dist/lib/Blog/BlogArticle.d.ts +5 -0
- package/dist/lib/Blog/BlogArticle.js +29 -0
- package/dist/lib/Blog/BlogArticle.js.map +1 -0
- package/dist/lib/Blog/BlogAuthor.d.ts +5 -0
- package/dist/lib/Blog/BlogAuthor.js +29 -0
- package/dist/lib/Blog/BlogAuthor.js.map +1 -0
- package/dist/lib/Blog/BlogCategory.d.ts +5 -0
- package/dist/lib/Blog/BlogCategory.js +29 -0
- package/dist/lib/Blog/BlogCategory.js.map +1 -0
- package/dist/lib/Blog/BlogKeyword.d.ts +5 -0
- package/dist/lib/Blog/BlogKeyword.js +29 -0
- package/dist/lib/Blog/BlogKeyword.js.map +1 -0
- package/dist/lib/Booking/index.d.ts +63 -0
- package/dist/lib/Booking/index.js +814 -0
- package/dist/lib/Booking/index.js.map +1 -0
- package/dist/lib/Brand/index.d.ts +17 -0
- package/dist/lib/Brand/index.js +274 -0
- package/dist/lib/Brand/index.js.map +1 -0
- package/dist/lib/CMS/Creator/index.d.ts +38 -0
- package/dist/lib/CMS/Creator/index.js +625 -0
- package/dist/lib/CMS/Creator/index.js.map +1 -0
- package/dist/lib/CMS/Reader/index.d.ts +64 -0
- package/dist/lib/CMS/Reader/index.js +1174 -0
- package/dist/lib/CMS/Reader/index.js.map +1 -0
- package/dist/lib/CMS/Utils.d.ts +1 -0
- package/dist/lib/CMS/Utils.js +30 -0
- package/dist/lib/CMS/Utils.js.map +1 -0
- package/dist/lib/CMS/Writer/index.d.ts +6 -0
- package/dist/lib/CMS/Writer/index.js +91 -0
- package/dist/lib/CMS/Writer/index.js.map +1 -0
- package/dist/lib/Cart/index.d.ts +184 -0
- package/dist/lib/Cart/index.js +3644 -0
- package/dist/lib/Cart/index.js.map +1 -0
- package/dist/lib/Catalogue/index.d.ts +11 -0
- package/dist/lib/Catalogue/index.js +205 -0
- package/dist/lib/Catalogue/index.js.map +1 -0
- package/dist/lib/Category/index.d.ts +26 -0
- package/dist/lib/Category/index.js +358 -0
- package/dist/lib/Category/index.js.map +1 -0
- package/dist/lib/Class/index.d.ts +12 -0
- package/dist/lib/Class/index.js +160 -0
- package/dist/lib/Class/index.js.map +1 -0
- package/dist/lib/Consent/index.d.ts +4 -0
- package/dist/lib/Consent/index.js +80 -0
- package/dist/lib/Consent/index.js.map +1 -0
- package/dist/lib/Customer/index.d.ts +10 -0
- package/dist/lib/Customer/index.js +141 -0
- package/dist/lib/Customer/index.js.map +1 -0
- package/dist/lib/Declination/index.d.ts +10 -0
- package/dist/lib/Declination/index.js +86 -0
- package/dist/lib/Declination/index.js.map +1 -0
- package/dist/lib/Delivery/CalendarDay.d.ts +10 -0
- package/dist/lib/Delivery/CalendarDay.js +149 -0
- package/dist/lib/Delivery/CalendarDay.js.map +1 -0
- package/dist/lib/Delivery/Dispatch.d.ts +56 -0
- package/dist/lib/Delivery/Dispatch.js +1055 -0
- package/dist/lib/Delivery/Dispatch.js.map +1 -0
- package/dist/lib/Delivery/Driver.d.ts +12 -0
- package/dist/lib/Delivery/Driver.js +153 -0
- package/dist/lib/Delivery/Driver.js.map +1 -0
- package/dist/lib/Delivery/PlannedOrder.d.ts +15 -0
- package/dist/lib/Delivery/PlannedOrder.js +237 -0
- package/dist/lib/Delivery/PlannedOrder.js.map +1 -0
- package/dist/lib/Delivery/ScheduledRun.d.ts +12 -0
- package/dist/lib/Delivery/ScheduledRun.js +165 -0
- package/dist/lib/Delivery/ScheduledRun.js.map +1 -0
- package/dist/lib/Delivery/Truck.d.ts +12 -0
- package/dist/lib/Delivery/Truck.js +158 -0
- package/dist/lib/Delivery/Truck.js.map +1 -0
- package/dist/lib/Discount/index.d.ts +18 -0
- package/dist/lib/Discount/index.js +760 -0
- package/dist/lib/Discount/index.js.map +1 -0
- package/dist/lib/ElasticSearch/index.d.ts +8 -0
- package/dist/lib/ElasticSearch/index.js +102 -0
- package/dist/lib/ElasticSearch/index.js.map +1 -0
- package/dist/lib/Email/AbandonedCartEmail.d.ts +8 -0
- package/dist/lib/Email/AbandonedCartEmail.js +79 -0
- package/dist/lib/Email/AbandonedCartEmail.js.map +1 -0
- package/dist/lib/Email/AccountConfirmationEmail.d.ts +11 -0
- package/dist/lib/Email/AccountConfirmationEmail.js +96 -0
- package/dist/lib/Email/AccountConfirmationEmail.js.map +1 -0
- package/dist/lib/Email/AdminOrderConfirmationEmail.d.ts +8 -0
- package/dist/lib/Email/AdminOrderConfirmationEmail.js +79 -0
- package/dist/lib/Email/AdminOrderConfirmationEmail.js.map +1 -0
- package/dist/lib/Email/ApplicationEmail.d.ts +8 -0
- package/dist/lib/Email/ApplicationEmail.js +79 -0
- package/dist/lib/Email/ApplicationEmail.js.map +1 -0
- package/dist/lib/Email/BackInStockEmail.d.ts +8 -0
- package/dist/lib/Email/BackInStockEmail.js +79 -0
- package/dist/lib/Email/BackInStockEmail.js.map +1 -0
- package/dist/lib/Email/ContactEmail.d.ts +8 -0
- package/dist/lib/Email/ContactEmail.js +79 -0
- package/dist/lib/Email/ContactEmail.js.map +1 -0
- package/dist/lib/Email/CustomerBookingAdminEmail.d.ts +8 -0
- package/dist/lib/Email/CustomerBookingAdminEmail.js +79 -0
- package/dist/lib/Email/CustomerBookingAdminEmail.js.map +1 -0
- package/dist/lib/Email/CustomerBookingEmail.d.ts +8 -0
- package/dist/lib/Email/CustomerBookingEmail.js +79 -0
- package/dist/lib/Email/CustomerBookingEmail.js.map +1 -0
- package/dist/lib/Email/OrderConfirmationEmail.d.ts +8 -0
- package/dist/lib/Email/OrderConfirmationEmail.js +79 -0
- package/dist/lib/Email/OrderConfirmationEmail.js.map +1 -0
- package/dist/lib/Email/OrderDenounciationEmail.d.ts +8 -0
- package/dist/lib/Email/OrderDenounciationEmail.js +79 -0
- package/dist/lib/Email/OrderDenounciationEmail.js.map +1 -0
- package/dist/lib/Email/OrderSampleEmail.d.ts +8 -0
- package/dist/lib/Email/OrderSampleEmail.js +79 -0
- package/dist/lib/Email/OrderSampleEmail.js.map +1 -0
- package/dist/lib/Email/OtherTypeEmails.d.ts +8 -0
- package/dist/lib/Email/OtherTypeEmails.js +91 -0
- package/dist/lib/Email/OtherTypeEmails.js.map +1 -0
- package/dist/lib/Email/PasswordResetEmail.d.ts +8 -0
- package/dist/lib/Email/PasswordResetEmail.js +79 -0
- package/dist/lib/Email/PasswordResetEmail.js.map +1 -0
- package/dist/lib/Email/PhotoShootEmail.d.ts +8 -0
- package/dist/lib/Email/PhotoShootEmail.js +79 -0
- package/dist/lib/Email/PhotoShootEmail.js.map +1 -0
- package/dist/lib/Email/PickUpConfirmation.d.ts +8 -0
- package/dist/lib/Email/PickUpConfirmation.js +79 -0
- package/dist/lib/Email/PickUpConfirmation.js.map +1 -0
- package/dist/lib/Email/QuoteApprobationEmail.d.ts +8 -0
- package/dist/lib/Email/QuoteApprobationEmail.js +79 -0
- package/dist/lib/Email/QuoteApprobationEmail.js.map +1 -0
- package/dist/lib/Email/ShippingConfirmation.d.ts +8 -0
- package/dist/lib/Email/ShippingConfirmation.js +79 -0
- package/dist/lib/Email/ShippingConfirmation.js.map +1 -0
- package/dist/lib/Email/WelcomeEmail.d.ts +8 -0
- package/dist/lib/Email/WelcomeEmail.js +79 -0
- package/dist/lib/Email/WelcomeEmail.js.map +1 -0
- package/dist/lib/Email/index.d.ts +8 -0
- package/dist/lib/Email/index.js +83 -0
- package/dist/lib/Email/index.js.map +1 -0
- package/dist/lib/ExternalService/Ebay.d.ts +63 -0
- package/dist/lib/ExternalService/Ebay.js +186 -0
- package/dist/lib/ExternalService/Ebay.js.map +1 -0
- package/dist/lib/ExternalService/index.d.ts +5 -0
- package/dist/lib/ExternalService/index.js +29 -0
- package/dist/lib/ExternalService/index.js.map +1 -0
- package/dist/lib/Indexed/IndexedCart.d.ts +13 -0
- package/dist/lib/Indexed/IndexedCart.js +195 -0
- package/dist/lib/Indexed/IndexedCart.js.map +1 -0
- package/dist/lib/Indexed/Product.d.ts +17 -0
- package/dist/lib/Indexed/Product.js +117 -0
- package/dist/lib/Indexed/Product.js.map +1 -0
- package/dist/lib/Inventory/__tests__.d.ts +1 -0
- package/dist/lib/Inventory/__tests__.js +199 -0
- package/dist/lib/Inventory/__tests__.js.map +1 -0
- package/dist/lib/Inventory/index.d.ts +31 -0
- package/dist/lib/Inventory/index.js +561 -0
- package/dist/lib/Inventory/index.js.map +1 -0
- package/dist/lib/Invoice/index.d.ts +5 -0
- package/dist/lib/Invoice/index.js +29 -0
- package/dist/lib/Invoice/index.js.map +1 -0
- package/dist/lib/MarketplacePublication/index.d.ts +9 -0
- package/dist/lib/MarketplacePublication/index.js +222 -0
- package/dist/lib/MarketplacePublication/index.js.map +1 -0
- package/dist/lib/MongoDB/BaseAPI.d.ts +18 -0
- package/dist/lib/MongoDB/BaseAPI.js +309 -0
- package/dist/lib/MongoDB/BaseAPI.js.map +1 -0
- package/dist/lib/Order/index.d.ts +7 -0
- package/dist/lib/Order/index.js +63 -0
- package/dist/lib/Order/index.js.map +1 -0
- package/dist/lib/Org/index.d.ts +26 -0
- package/dist/lib/Org/index.js +287 -0
- package/dist/lib/Org/index.js.map +1 -0
- package/dist/lib/PandaPay/index.d.ts +16 -0
- package/dist/lib/PandaPay/index.js +220 -0
- package/dist/lib/PandaPay/index.js.map +1 -0
- package/dist/lib/Paysafe/index.d.ts +11 -0
- package/dist/lib/Paysafe/index.js +101 -0
- package/dist/lib/Paysafe/index.js.map +1 -0
- package/dist/lib/Product/index.d.ts +143 -0
- package/dist/lib/Product/index.js +1325 -0
- package/dist/lib/Product/index.js.map +1 -0
- package/dist/lib/ProductAttribute/index.d.ts +15 -0
- package/dist/lib/ProductAttribute/index.js +115 -0
- package/dist/lib/ProductAttribute/index.js.map +1 -0
- package/dist/lib/ProductGroup/index.d.ts +49 -0
- package/dist/lib/ProductGroup/index.js +141 -0
- package/dist/lib/ProductGroup/index.js.map +1 -0
- package/dist/lib/PromiseToPurchase/index.d.ts +35 -0
- package/dist/lib/PromiseToPurchase/index.js +475 -0
- package/dist/lib/PromiseToPurchase/index.js.map +1 -0
- package/dist/lib/PurchaseOrder/index.d.ts +9 -0
- package/dist/lib/PurchaseOrder/index.js +73 -0
- package/dist/lib/PurchaseOrder/index.js.map +1 -0
- package/dist/lib/Queue/index.d.ts +40 -0
- package/dist/lib/Queue/index.js +255 -0
- package/dist/lib/Queue/index.js.map +1 -0
- package/dist/lib/Quote/index.d.ts +204 -0
- package/dist/lib/Quote/index.js +721 -0
- package/dist/lib/Quote/index.js.map +1 -0
- package/dist/lib/Service/Enum/ServiceEnum.d.ts +3 -0
- package/dist/lib/Service/Enum/ServiceEnum.js +8 -0
- package/dist/lib/Service/Enum/ServiceEnum.js.map +1 -0
- package/dist/lib/Service/index.d.ts +5 -0
- package/dist/lib/Service/index.js +58 -0
- package/dist/lib/Service/index.js.map +1 -0
- package/dist/lib/Shipment/index.d.ts +28 -0
- package/dist/lib/Shipment/index.js +560 -0
- package/dist/lib/Shipment/index.js.map +1 -0
- package/dist/lib/Slider/index.d.ts +18 -0
- package/dist/lib/Slider/index.js +233 -0
- package/dist/lib/Slider/index.js.map +1 -0
- package/dist/lib/Space/index.d.ts +758 -0
- package/dist/lib/Space/index.js +6692 -0
- package/dist/lib/Space/index.js.map +1 -0
- package/dist/lib/SpecialOPS/Cases/BB.d.ts +8 -0
- package/dist/lib/SpecialOPS/Cases/BB.js +24 -0
- package/dist/lib/SpecialOPS/Cases/BB.js.map +1 -0
- package/dist/lib/SpecialOPS/index.d.ts +14 -0
- package/dist/lib/SpecialOPS/index.js +21 -0
- package/dist/lib/SpecialOPS/index.js.map +1 -0
- package/dist/lib/StockNotification/index.d.ts +4 -0
- package/dist/lib/StockNotification/index.js +27 -0
- package/dist/lib/StockNotification/index.js.map +1 -0
- package/dist/lib/Store/index.d.ts +5 -0
- package/dist/lib/Store/index.js +31 -0
- package/dist/lib/Store/index.js.map +1 -0
- package/dist/lib/Supplier/Command.d.ts +5 -0
- package/dist/lib/Supplier/Command.js +29 -0
- package/dist/lib/Supplier/Command.js.map +1 -0
- package/dist/lib/Supplier/index.d.ts +25 -0
- package/dist/lib/Supplier/index.js +93 -0
- package/dist/lib/Supplier/index.js.map +1 -0
- package/dist/lib/Tags/index.d.ts +6 -0
- package/dist/lib/Tags/index.js +85 -0
- package/dist/lib/Tags/index.js.map +1 -0
- package/dist/lib/Tax/index.d.ts +8 -0
- package/dist/lib/Tax/index.js +137 -0
- package/dist/lib/Tax/index.js.map +1 -0
- package/dist/lib/TransferRequest/index.d.ts +21 -0
- package/dist/lib/TransferRequest/index.js +303 -0
- package/dist/lib/TransferRequest/index.js.map +1 -0
- package/dist/lib/Update/index.d.ts +10 -0
- package/dist/lib/Update/index.js +72 -0
- package/dist/lib/Update/index.js.map +1 -0
- package/dist/lib/User/index.d.ts +33 -0
- package/dist/lib/User/index.js +361 -0
- package/dist/lib/User/index.js.map +1 -0
- package/dist/lib/Wishlist/index.d.ts +5 -0
- package/dist/lib/Wishlist/index.js +29 -0
- package/dist/lib/Wishlist/index.js.map +1 -0
- package/dist/lib/base copy.d.ts +14 -0
- package/dist/lib/base copy.js +136 -0
- package/dist/lib/base copy.js.map +1 -0
- package/dist/lib/base.d.ts +14 -0
- package/dist/lib/base.js +136 -0
- package/dist/lib/base.js.map +1 -0
- package/dist/lib/baseService.d.ts +17 -0
- package/dist/lib/baseService.js +114 -0
- package/dist/lib/baseService.js.map +1 -0
- package/dist/rules/GR/constants/data.d.ts +28 -0
- package/dist/rules/GR/constants/data.js +58 -0
- package/dist/rules/GR/constants/data.js.map +1 -0
- package/dist/rules/GR/constants/products.d.ts +8 -0
- package/dist/rules/GR/constants/products.js +235 -0
- package/dist/rules/GR/constants/products.js.map +1 -0
- package/dist/rules/GR/interfaces/cart.d.ts +68 -0
- package/dist/rules/GR/interfaces/cart.js +50 -0
- package/dist/rules/GR/interfaces/cart.js.map +1 -0
- package/dist/rules/GR/interfaces/data.d.ts +97 -0
- package/dist/rules/GR/interfaces/data.js +105 -0
- package/dist/rules/GR/interfaces/data.js.map +1 -0
- package/dist/rules/GR/interfaces/products.d.ts +61 -0
- package/dist/rules/GR/interfaces/products.js +11 -0
- package/dist/rules/GR/interfaces/products.js.map +1 -0
- package/dist/rules/GR/utils/anonymisation.d.ts +29 -0
- package/dist/rules/GR/utils/anonymisation.js +269 -0
- package/dist/rules/GR/utils/anonymisation.js.map +1 -0
- package/dist/rules/GR/utils/cart.d.ts +39 -0
- package/dist/rules/GR/utils/cart.js +645 -0
- package/dist/rules/GR/utils/cart.js.map +1 -0
- package/dist/rules/GR/utils/data.d.ts +3 -0
- package/dist/rules/GR/utils/data.js +26 -0
- package/dist/rules/GR/utils/data.js.map +1 -0
- package/dist/rules/GR/utils/expedition.d.ts +70 -0
- package/dist/rules/GR/utils/expedition.js +1584 -0
- package/dist/rules/GR/utils/expedition.js.map +1 -0
- package/dist/rules/GR/utils/g2.d.ts +153 -0
- package/dist/rules/GR/utils/g2.js +915 -0
- package/dist/rules/GR/utils/g2.js.map +1 -0
- package/dist/rules/GR/utils/invoices.d.ts +5 -0
- package/dist/rules/GR/utils/invoices.js +141 -0
- package/dist/rules/GR/utils/invoices.js.map +1 -0
- package/dist/rules/GR/utils/products.d.ts +105 -0
- package/dist/rules/GR/utils/products.js +1014 -0
- package/dist/rules/GR/utils/products.js.map +1 -0
- package/dist/rules/GR/utils/upsells.d.ts +75 -0
- package/dist/rules/GR/utils/upsells.js +279 -0
- package/dist/rules/GR/utils/upsells.js.map +1 -0
- package/dist/services/database/AuthProvider.d.ts +3 -0
- package/dist/services/database/AuthProvider.js +67 -0
- package/dist/services/database/AuthProvider.js.map +1 -0
- package/dist/services/database/BaseProvider.d.ts +28 -0
- package/dist/services/database/BaseProvider.js +78 -0
- package/dist/services/database/BaseProvider.js.map +1 -0
- package/dist/services/database/BatchUtils.d.ts +14 -0
- package/dist/services/database/BatchUtils.js +89 -0
- package/dist/services/database/BatchUtils.js.map +1 -0
- package/dist/services/database/Config.d.ts +2 -0
- package/dist/services/database/Config.js +6 -0
- package/dist/services/database/Config.js.map +1 -0
- package/dist/services/database/DatabaseService.d.ts +41 -0
- package/dist/services/database/DatabaseService.js +312 -0
- package/dist/services/database/DatabaseService.js.map +1 -0
- package/dist/services/database/FirebaseProvider.d.ts +17 -0
- package/dist/services/database/FirebaseProvider.js +301 -0
- package/dist/services/database/FirebaseProvider.js.map +1 -0
- package/dist/services/database/NotFirebaseProvider.d.ts +35 -0
- package/dist/services/database/NotFirebaseProvider.js +368 -0
- package/dist/services/database/NotFirebaseProvider.js.map +1 -0
- package/dist/utils/algolia.d.ts +6 -0
- package/dist/utils/algolia.js +23 -0
- package/dist/utils/algolia.js.map +1 -0
- package/dist/utils/anonymisation.d.ts +30 -0
- package/dist/utils/anonymisation.js +270 -0
- package/dist/utils/anonymisation.js.map +1 -0
- package/dist/utils/array.d.ts +5 -0
- package/dist/utils/array.js +37 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/utils/aws.d.ts +18 -0
- package/dist/utils/aws.js +144 -0
- package/dist/utils/aws.js.map +1 -0
- package/dist/utils/booking.d.ts +22 -0
- package/dist/utils/booking.js +176 -0
- package/dist/utils/booking.js.map +1 -0
- package/dist/utils/cart.d.ts +505 -0
- package/dist/utils/cart.js +504 -0
- package/dist/utils/cart.js.map +1 -0
- package/dist/utils/cmv.d.ts +10 -0
- package/dist/utils/cmv.js +108 -0
- package/dist/utils/cmv.js.map +1 -0
- package/dist/utils/console.d.ts +6 -0
- package/dist/utils/console.js +122 -0
- package/dist/utils/console.js.map +1 -0
- package/dist/utils/context.d.ts +19 -0
- package/dist/utils/context.js +42 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/currency.d.ts +6 -0
- package/dist/utils/currency.js +63 -0
- package/dist/utils/currency.js.map +1 -0
- package/dist/utils/data.d.ts +40 -0
- package/dist/utils/data.js +227 -0
- package/dist/utils/data.js.map +1 -0
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/date.js +17 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/dimensions.d.ts +3 -0
- package/dist/utils/dimensions.js +19 -0
- package/dist/utils/dimensions.js.map +1 -0
- package/dist/utils/discount.d.ts +33 -0
- package/dist/utils/discount.js +907 -0
- package/dist/utils/discount.js.map +1 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/env.js +14 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/errors.d.ts +113 -0
- package/dist/utils/errors.js +114 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/file-admin.d.ts +8 -0
- package/dist/utils/file-admin.js +95 -0
- package/dist/utils/file-admin.js.map +1 -0
- package/dist/utils/file.d.ts +19 -0
- package/dist/utils/file.js +339 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/firebase-admin.d.ts +2 -0
- package/dist/utils/firebase-admin.js +119 -0
- package/dist/utils/firebase-admin.js.map +1 -0
- package/dist/utils/firebase.d.ts +23 -0
- package/dist/utils/firebase.js +59 -0
- package/dist/utils/firebase.js.map +1 -0
- package/dist/utils/import.d.ts +1 -0
- package/dist/utils/import.js +82 -0
- package/dist/utils/import.js.map +1 -0
- package/dist/utils/inventories.d.ts +26 -0
- package/dist/utils/inventories.js +356 -0
- package/dist/utils/inventories.js.map +1 -0
- package/dist/utils/locale.d.ts +13 -0
- package/dist/utils/locale.js +68 -0
- package/dist/utils/locale.js.map +1 -0
- package/dist/utils/mailchimp.d.ts +57 -0
- package/dist/utils/mailchimp.js +736 -0
- package/dist/utils/mailchimp.js.map +1 -0
- package/dist/utils/math.d.ts +1 -0
- package/dist/utils/math.js +16 -0
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/mongodb.d.ts +1 -0
- package/dist/utils/mongodb.js +69 -0
- package/dist/utils/mongodb.js.map +1 -0
- package/dist/utils/object.d.ts +6 -0
- package/dist/utils/object.js +125 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/payment.d.ts +10 -0
- package/dist/utils/payment.js +26 -0
- package/dist/utils/payment.js.map +1 -0
- package/dist/utils/products.d.ts +26 -0
- package/dist/utils/products.js +302 -0
- package/dist/utils/products.js.map +1 -0
- package/dist/utils/promiseToPurchase.d.ts +56 -0
- package/dist/utils/promiseToPurchase.js +229 -0
- package/dist/utils/promiseToPurchase.js.map +1 -0
- package/dist/utils/prosprsearch.d.ts +21 -0
- package/dist/utils/prosprsearch.js +277 -0
- package/dist/utils/prosprsearch.js.map +1 -0
- package/dist/utils/sdc.d.ts +10 -0
- package/dist/utils/sdc.js +1309 -0
- package/dist/utils/sdc.js.map +1 -0
- package/dist/utils/searchIndexes.d.ts +20 -0
- package/dist/utils/searchIndexes.js +274 -0
- package/dist/utils/searchIndexes.js.map +1 -0
- package/dist/utils/services.d.ts +38 -0
- package/dist/utils/services.js +395 -0
- package/dist/utils/services.js.map +1 -0
- package/dist/utils/shipment.d.ts +110 -0
- package/dist/utils/shipment.js +411 -0
- package/dist/utils/shipment.js.map +1 -0
- package/dist/utils/simpletexting.d.ts +2 -0
- package/dist/utils/simpletexting.js +89 -0
- package/dist/utils/simpletexting.js.map +1 -0
- package/dist/utils/slack.d.ts +33 -0
- package/dist/utils/slack.js +178 -0
- package/dist/utils/slack.js.map +1 -0
- package/dist/utils/sliders.d.ts +4 -0
- package/dist/utils/sliders.js +71 -0
- package/dist/utils/sliders.js.map +1 -0
- package/dist/utils/string.d.ts +16 -0
- package/dist/utils/string.js +195 -0
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/update.d.ts +7 -0
- package/dist/utils/update.js +245 -0
- package/dist/utils/update.js.map +1 -0
- package/dist/utils/weight.d.ts +3 -0
- package/dist/utils/weight.js +19 -0
- package/dist/utils/weight.js.map +1 -0
- package/dist/utils/zones.d.ts +10 -0
- package/dist/utils/zones.js +288 -0
- package/dist/utils/zones.js.map +1 -0
- package/package.json +106 -0
- package/publish.sh +144 -0
- package/readme.md +182 -0
|
@@ -0,0 +1,1325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
65
|
+
var t = {};
|
|
66
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
69
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
71
|
+
t[p[i]] = s[p[i]];
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
};
|
|
75
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
76
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
77
|
+
if (ar || !(i in from)) {
|
|
78
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
79
|
+
ar[i] = from[i];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
83
|
+
};
|
|
84
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
85
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
86
|
+
};
|
|
87
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
+
var Product_1 = require("../../Interfaces/Indexed/Product");
|
|
89
|
+
var lodash_1 = require("lodash");
|
|
90
|
+
var file_1 = require("../../utils/file");
|
|
91
|
+
var context_1 = require("../../utils/context");
|
|
92
|
+
var console_1 = require("../../utils/console");
|
|
93
|
+
var currency_1 = require("../../utils/currency");
|
|
94
|
+
var object_1 = require("../../utils/object");
|
|
95
|
+
var services_1 = require("../../utils/services");
|
|
96
|
+
var locale_1 = require("../../utils/locale");
|
|
97
|
+
var algolia_1 = require("../../utils/algolia");
|
|
98
|
+
var __1 = require("../..");
|
|
99
|
+
var MarketplacePublication_1 = __importDefault(require("../MarketplacePublication"));
|
|
100
|
+
var ProductAttribute_1 = __importDefault(require("../ProductAttribute"));
|
|
101
|
+
var Product_2 = __importDefault(require("../Indexed/Product"));
|
|
102
|
+
var Declination_1 = __importDefault(require("../Declination"));
|
|
103
|
+
var Category_1 = __importDefault(require("../Category"));
|
|
104
|
+
var Discount_1 = __importDefault(require("../Discount"));
|
|
105
|
+
var moment_1 = __importDefault(require("moment"));
|
|
106
|
+
var Brand_1 = __importDefault(require("../Brand"));
|
|
107
|
+
var Space_1 = __importDefault(require("../Space"));
|
|
108
|
+
var g2_1 = require("../../rules/GR/utils/g2");
|
|
109
|
+
var baseService_1 = require("../baseService");
|
|
110
|
+
var DatabaseService_1 = __importDefault(require("../../services/database/DatabaseService"));
|
|
111
|
+
var Product = (function (_super) {
|
|
112
|
+
__extends(Product, _super);
|
|
113
|
+
function Product() {
|
|
114
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
115
|
+
_this.data = function () { return _this._data; };
|
|
116
|
+
_this.toCSV = function () {
|
|
117
|
+
return __assign(__assign({}, _this.data()), { product_attributes: !!_this.data().product_attributes
|
|
118
|
+
? _this.data().product_attributes.map(function (pa) { return pa.attribute_id; })
|
|
119
|
+
: undefined, declinations: !!_this.data().declinations
|
|
120
|
+
? _this.data().declinations.map(function (d) { return d.name; })
|
|
121
|
+
: undefined, brand: !!_this.data().brand ? _this.data().brand.key : undefined, classes: !!_this.data().classes ? _this.data().classes.map(function (c) { return c.key; }) : undefined, category: !!_this.data().category ? _this.data().category.key : undefined });
|
|
122
|
+
};
|
|
123
|
+
_this.allRelationships = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_c) {
|
|
125
|
+
switch (_c.label) {
|
|
126
|
+
case 0: return [4, this.relationships(['brands'])];
|
|
127
|
+
case 1: return [2, _c.sent()];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}); };
|
|
131
|
+
_this.getDefaultSupplier = function () {
|
|
132
|
+
var data = _this.data();
|
|
133
|
+
if (!!!data.suppliers)
|
|
134
|
+
return undefined;
|
|
135
|
+
var supplier = data.suppliers.filter(function (supplier) {
|
|
136
|
+
return supplier.supplier_order == 0;
|
|
137
|
+
})[0];
|
|
138
|
+
return supplier.supplier_id;
|
|
139
|
+
};
|
|
140
|
+
_this.relationships = function (relations) { return __awaiter(_this, void 0, void 0, function () {
|
|
141
|
+
var relationships, _getKeyFromRelationType, _i, relations_1, relation, relationReq, relationData;
|
|
142
|
+
return __generator(this, function (_c) {
|
|
143
|
+
switch (_c.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
if (relations.length === 0)
|
|
146
|
+
return [2, {}];
|
|
147
|
+
relationships = {};
|
|
148
|
+
_getKeyFromRelationType = function (_relation) {
|
|
149
|
+
switch (_relation) {
|
|
150
|
+
case 'brands':
|
|
151
|
+
default:
|
|
152
|
+
return 'brand';
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
_i = 0, relations_1 = relations;
|
|
156
|
+
_c.label = 1;
|
|
157
|
+
case 1:
|
|
158
|
+
if (!(_i < relations_1.length)) return [3, 4];
|
|
159
|
+
relation = relations_1[_i];
|
|
160
|
+
if (!!relationships[relation])
|
|
161
|
+
return [3, 3];
|
|
162
|
+
if (!!!this._data[_getKeyFromRelationType(relation)])
|
|
163
|
+
return [3, 3];
|
|
164
|
+
return [4, DatabaseService_1.default.getDocument(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), relation), this._data[_getKeyFromRelationType(relation)].key)];
|
|
165
|
+
case 2:
|
|
166
|
+
relationReq = _c.sent();
|
|
167
|
+
if (!relationReq.exists)
|
|
168
|
+
return [3, 3];
|
|
169
|
+
relationData = relationReq.data;
|
|
170
|
+
if (!!!relationData)
|
|
171
|
+
return [3, 3];
|
|
172
|
+
relationships[_getKeyFromRelationType(relation)] = __assign(__assign({}, relationData), { id: relationReq.id });
|
|
173
|
+
_c.label = 3;
|
|
174
|
+
case 3:
|
|
175
|
+
_i++;
|
|
176
|
+
return [3, 1];
|
|
177
|
+
case 4: return [2, relationships];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}); };
|
|
181
|
+
_this.save = function (partialProduct, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
182
|
+
var beforeData, _c, id;
|
|
183
|
+
return __generator(this, function (_e) {
|
|
184
|
+
switch (_e.label) {
|
|
185
|
+
case 0:
|
|
186
|
+
beforeData = __assign({}, this._data);
|
|
187
|
+
this._data = __assign(__assign({}, this._data), partialProduct);
|
|
188
|
+
_c = this;
|
|
189
|
+
return [4, this._updateDependancies(this._data, beforeData, !!options ? options.space : undefined)];
|
|
190
|
+
case 1:
|
|
191
|
+
_c._data = (_e.sent());
|
|
192
|
+
this._data = __assign(__assign({}, this._data), { last_update_by: this._user });
|
|
193
|
+
return [4, _super.prototype.save.call(this, this._data, undefined, true, true, true, beforeData)];
|
|
194
|
+
case 2:
|
|
195
|
+
id = _e.sent();
|
|
196
|
+
if (!!id && !!!this._data.id && typeof id === 'string') {
|
|
197
|
+
this._data = __assign(__assign({}, this._data), { id: id });
|
|
198
|
+
}
|
|
199
|
+
if (!!!options) {
|
|
200
|
+
return [2, true];
|
|
201
|
+
}
|
|
202
|
+
return [2, id];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}); };
|
|
206
|
+
_this._updateDependancies = function (product, beforeData, space) { return __awaiter(_this, void 0, void 0, function () {
|
|
207
|
+
var productToUpdate, error_1;
|
|
208
|
+
return __generator(this, function (_c) {
|
|
209
|
+
switch (_c.label) {
|
|
210
|
+
case 0:
|
|
211
|
+
(0, console_1.workingMessage)('Updating images and stuff');
|
|
212
|
+
productToUpdate = product;
|
|
213
|
+
_c.label = 1;
|
|
214
|
+
case 1:
|
|
215
|
+
_c.trys.push([1, 10, , 11]);
|
|
216
|
+
if (!!!!space) return [3, 3];
|
|
217
|
+
return [4, Space_1.default.getCurrentSpaceWithRef(this._collection.path, this._user)];
|
|
218
|
+
case 2:
|
|
219
|
+
space = _c.sent();
|
|
220
|
+
_c.label = 3;
|
|
221
|
+
case 3: return [4, this._uploadDeclinationsImages(productToUpdate)];
|
|
222
|
+
case 4:
|
|
223
|
+
productToUpdate = _c.sent();
|
|
224
|
+
return [4, this._updateSEOImage(productToUpdate)];
|
|
225
|
+
case 5:
|
|
226
|
+
productToUpdate = _c.sent();
|
|
227
|
+
return [4, this._updatePanelDescriptionsImage(productToUpdate)];
|
|
228
|
+
case 6:
|
|
229
|
+
productToUpdate = _c.sent();
|
|
230
|
+
return [4, this._updateDeclinationsDiscountRules(productToUpdate, beforeData)];
|
|
231
|
+
case 7:
|
|
232
|
+
productToUpdate = _c.sent();
|
|
233
|
+
return [4, this._updateBarcode(productToUpdate, space)];
|
|
234
|
+
case 8:
|
|
235
|
+
productToUpdate = _c.sent();
|
|
236
|
+
return [4, this._updateInventoryItem(productToUpdate, beforeData, space)];
|
|
237
|
+
case 9:
|
|
238
|
+
_c.sent();
|
|
239
|
+
return [2, productToUpdate];
|
|
240
|
+
case 10:
|
|
241
|
+
error_1 = _c.sent();
|
|
242
|
+
(0, console_1.errorMessage)("Error while updating dependancies: ".concat(error_1, " - ").concat(JSON.stringify(error_1)));
|
|
243
|
+
return [2, product];
|
|
244
|
+
case 11: return [2];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}); };
|
|
248
|
+
_this._updateSEOImage = function (product) { return __awaiter(_this, void 0, void 0, function () {
|
|
249
|
+
var _c, _e, _f, _g;
|
|
250
|
+
var _h, _j, _k;
|
|
251
|
+
return __generator(this, function (_l) {
|
|
252
|
+
switch (_l.label) {
|
|
253
|
+
case 0:
|
|
254
|
+
_c = [__assign({}, product)];
|
|
255
|
+
_h = {};
|
|
256
|
+
_e = [__assign({}, product.seo_info)];
|
|
257
|
+
_j = {};
|
|
258
|
+
if (!(!!product.seo_info &&
|
|
259
|
+
!!product.seo_info.seoImage &&
|
|
260
|
+
!!product.seo_info.seoImage.img_path &&
|
|
261
|
+
typeof product.seo_info.seoImage.img_path === 'string')) return [3, 1];
|
|
262
|
+
_f = product.seo_info.seoImage;
|
|
263
|
+
return [3, 5];
|
|
264
|
+
case 1:
|
|
265
|
+
_k = {};
|
|
266
|
+
if (!(!!product.seo_info && !!product.seo_info.seoImage && !!product.seo_info.seoImage.img_path)) return [3, 3];
|
|
267
|
+
return [4, (0, file_1.uploadFileToPath)(product.seo_info.seoImage.img_path.file, (0, context_1.getPathTo)("products/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))))];
|
|
268
|
+
case 2:
|
|
269
|
+
_g = _l.sent();
|
|
270
|
+
return [3, 4];
|
|
271
|
+
case 3:
|
|
272
|
+
_g = '';
|
|
273
|
+
_l.label = 4;
|
|
274
|
+
case 4:
|
|
275
|
+
_f = (_k.img_path = _g,
|
|
276
|
+
_k);
|
|
277
|
+
_l.label = 5;
|
|
278
|
+
case 5: return [2, __assign.apply(void 0, _c.concat([(_h.seo_info = __assign.apply(void 0, _e.concat([(_j.seoImage = _f, _j)])), _h)]))];
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}); };
|
|
282
|
+
_this._updatePanelDescriptionsImage = function (product) { return __awaiter(_this, void 0, void 0, function () {
|
|
283
|
+
var _c;
|
|
284
|
+
var _e;
|
|
285
|
+
var _this = this;
|
|
286
|
+
return __generator(this, function (_f) {
|
|
287
|
+
switch (_f.label) {
|
|
288
|
+
case 0:
|
|
289
|
+
if (!!!product.panel_descriptions || !!!product.panel_descriptions.length)
|
|
290
|
+
return [2, product];
|
|
291
|
+
_c = [__assign({}, product)];
|
|
292
|
+
_e = {};
|
|
293
|
+
return [4, Promise.all(product.panel_descriptions.map(function (panel) { return __awaiter(_this, void 0, void 0, function () {
|
|
294
|
+
var _c, _e, _f, _g;
|
|
295
|
+
var _h, _j, _k, _l;
|
|
296
|
+
return __generator(this, function (_m) {
|
|
297
|
+
switch (_m.label) {
|
|
298
|
+
case 0:
|
|
299
|
+
if (!!!panel.img)
|
|
300
|
+
return [2, panel];
|
|
301
|
+
if (typeof panel.img.img_path === 'string' && !panel.img.img_path.includes('base64'))
|
|
302
|
+
return [2, panel];
|
|
303
|
+
if (!(typeof panel.img.img_path === 'string')) return [3, 2];
|
|
304
|
+
_c = [__assign({}, panel)];
|
|
305
|
+
_h = {};
|
|
306
|
+
_e = [__assign({}, panel.img)];
|
|
307
|
+
_j = {};
|
|
308
|
+
return [4, (0, file_1.uploadStringToPath)(panel.img.img_path, (0, context_1.getPathTo)("products/".concat(product.slug, "/panels"), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))), (0, locale_1.getPrincipalWord)(panel.label_name), 'jpg')];
|
|
309
|
+
case 1: return [2, __assign.apply(void 0, _c.concat([(_h.img = __assign.apply(void 0, _e.concat([(_j.img_path = _m.sent(), _j)])), _h)]))];
|
|
310
|
+
case 2:
|
|
311
|
+
if (!!!panel.img.img_path.file) return [3, 4];
|
|
312
|
+
_f = [__assign({}, panel)];
|
|
313
|
+
_k = {};
|
|
314
|
+
_g = [__assign({}, panel.img)];
|
|
315
|
+
_l = {};
|
|
316
|
+
return [4, (0, file_1.uploadFileToPath)(panel.img.img_path.file, (0, context_1.getPathTo)("products/".concat(product.slug, "/panels"), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))))];
|
|
317
|
+
case 3: return [2, __assign.apply(void 0, _f.concat([(_k.img = __assign.apply(void 0, _g.concat([(_l.img_path = _m.sent(), _l)])), _k)]))];
|
|
318
|
+
case 4: return [2, __assign(__assign({}, panel), { img: undefined })];
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}); }))];
|
|
322
|
+
case 1: return [2, __assign.apply(void 0, _c.concat([(_e.panel_descriptions = _f.sent(), _e)]))];
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}); };
|
|
326
|
+
_this._updateBarcode = function (product, space) { return __awaiter(_this, void 0, void 0, function () {
|
|
327
|
+
var _c, error_2;
|
|
328
|
+
var _e;
|
|
329
|
+
var _this = this;
|
|
330
|
+
return __generator(this, function (_f) {
|
|
331
|
+
switch (_f.label) {
|
|
332
|
+
case 0:
|
|
333
|
+
_f.trys.push([0, 4, , 5]);
|
|
334
|
+
if (!!!!space) return [3, 2];
|
|
335
|
+
return [4, Space_1.default.getCurrentSpaceWithRef(this._collection.path, this._user)];
|
|
336
|
+
case 1:
|
|
337
|
+
space = _f.sent();
|
|
338
|
+
_f.label = 2;
|
|
339
|
+
case 2:
|
|
340
|
+
if (!!!space.data().product_preferences.generate_barcode)
|
|
341
|
+
return [2, product];
|
|
342
|
+
_c = [__assign({}, product)];
|
|
343
|
+
_e = {};
|
|
344
|
+
return [4, Promise.all((product.declinations || []).map(function (_d) { return __awaiter(_this, void 0, void 0, function () {
|
|
345
|
+
var upc;
|
|
346
|
+
return __generator(this, function (_c) {
|
|
347
|
+
switch (_c.label) {
|
|
348
|
+
case 0:
|
|
349
|
+
if (!!_d.upc)
|
|
350
|
+
return [2, _d];
|
|
351
|
+
if (!!!space)
|
|
352
|
+
return [2, _d];
|
|
353
|
+
upc = space.data().product_preferences.barcode_next;
|
|
354
|
+
return [4, space.save({
|
|
355
|
+
product_preferences: __assign(__assign({}, space.data().product_preferences), { barcode_next: "".concat((0, lodash_1.toNumber)(upc) + 1) })
|
|
356
|
+
})];
|
|
357
|
+
case 1:
|
|
358
|
+
_c.sent();
|
|
359
|
+
return [2, __assign(__assign({}, _d), { upc: upc })];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}); }))];
|
|
363
|
+
case 3: return [2, __assign.apply(void 0, _c.concat([(_e.declinations = _f.sent(), _e)]))];
|
|
364
|
+
case 4:
|
|
365
|
+
error_2 = _f.sent();
|
|
366
|
+
console.log(error_2);
|
|
367
|
+
return [2, product];
|
|
368
|
+
case 5: return [2];
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}); };
|
|
372
|
+
_this._updateInventoryItem = function (product, beforeData, space) { return __awaiter(_this, void 0, void 0, function () {
|
|
373
|
+
var declis, allSameProductInventories, _i, allSameProductInventories_1, inventory, e_1, allSameProductInventoriesSamples, allSameProductInventoriesNotSamples, deletedSkusSamples, deletedSkusNotSamples, skusToDelete, e_2;
|
|
374
|
+
var _this = this;
|
|
375
|
+
return __generator(this, function (_c) {
|
|
376
|
+
switch (_c.label) {
|
|
377
|
+
case 0:
|
|
378
|
+
declis = product.declinations;
|
|
379
|
+
if (!!!declis || !!!declis.length)
|
|
380
|
+
return [2];
|
|
381
|
+
if (!!!!space) return [3, 2];
|
|
382
|
+
return [4, Space_1.default.getCurrentSpaceWithRef(this._collection.path, this._user)];
|
|
383
|
+
case 1:
|
|
384
|
+
space = _c.sent();
|
|
385
|
+
_c.label = 2;
|
|
386
|
+
case 2: return [4, space.inventoryItems.getAllFromSameProduct(!!product.slug ? product.slug : this.data().slug)];
|
|
387
|
+
case 3:
|
|
388
|
+
allSameProductInventories = _c.sent();
|
|
389
|
+
if (!!!allSameProductInventories || !!!allSameProductInventories.length)
|
|
390
|
+
return [2, true];
|
|
391
|
+
if (!(!!beforeData && !!product.is_service && beforeData.is_service !== product.is_service)) return [3, 11];
|
|
392
|
+
_c.label = 4;
|
|
393
|
+
case 4:
|
|
394
|
+
_c.trys.push([4, 9, , 10]);
|
|
395
|
+
_i = 0, allSameProductInventories_1 = allSameProductInventories;
|
|
396
|
+
_c.label = 5;
|
|
397
|
+
case 5:
|
|
398
|
+
if (!(_i < allSameProductInventories_1.length)) return [3, 8];
|
|
399
|
+
inventory = allSameProductInventories_1[_i];
|
|
400
|
+
return [4, inventory.delete()];
|
|
401
|
+
case 6:
|
|
402
|
+
_c.sent();
|
|
403
|
+
_c.label = 7;
|
|
404
|
+
case 7:
|
|
405
|
+
_i++;
|
|
406
|
+
return [3, 5];
|
|
407
|
+
case 8: return [3, 10];
|
|
408
|
+
case 9:
|
|
409
|
+
e_1 = _c.sent();
|
|
410
|
+
console.log('error on deleting inventories of now service product: ', e_1);
|
|
411
|
+
return [3, 10];
|
|
412
|
+
case 10: return [2, true];
|
|
413
|
+
case 11:
|
|
414
|
+
allSameProductInventoriesSamples = allSameProductInventories.filter(function (i) { return !!i.data().is_sample; });
|
|
415
|
+
allSameProductInventoriesNotSamples = allSameProductInventories.filter(function (i) { return !!!i.data().is_sample; });
|
|
416
|
+
deletedSkusSamples = allSameProductInventoriesSamples.filter(function (inventory) {
|
|
417
|
+
var decliSku = inventory.data().decli_sku_associated_to_sample;
|
|
418
|
+
var foundDecli = declis.find(function (d) { return d.sku === decliSku; });
|
|
419
|
+
return !!!foundDecli || !foundDecli.is_sample;
|
|
420
|
+
});
|
|
421
|
+
deletedSkusNotSamples = allSameProductInventoriesNotSamples.filter(function (inventory) { return !!!declis.some(function (d) { return d.sku === inventory.data().sku; }) && !!!inventory.data().is_sample; });
|
|
422
|
+
skusToDelete = __spreadArray(__spreadArray([], deletedSkusSamples, true), deletedSkusNotSamples, true);
|
|
423
|
+
if (!!!skusToDelete.length)
|
|
424
|
+
return [2, true];
|
|
425
|
+
_c.label = 12;
|
|
426
|
+
case 12:
|
|
427
|
+
_c.trys.push([12, 14, , 15]);
|
|
428
|
+
return [4, Promise.all(skusToDelete.map(function (inventory) { return __awaiter(_this, void 0, void 0, function () {
|
|
429
|
+
return __generator(this, function (_c) {
|
|
430
|
+
switch (_c.label) {
|
|
431
|
+
case 0: return [4, inventory.delete()];
|
|
432
|
+
case 1:
|
|
433
|
+
_c.sent();
|
|
434
|
+
return [2];
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}); }))];
|
|
438
|
+
case 13:
|
|
439
|
+
_c.sent();
|
|
440
|
+
return [3, 15];
|
|
441
|
+
case 14:
|
|
442
|
+
e_2 = _c.sent();
|
|
443
|
+
console.log('error on deleting inventories of deleted skus: ', e_2);
|
|
444
|
+
return [3, 15];
|
|
445
|
+
case 15: return [2, true];
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
}); };
|
|
449
|
+
_this._updateDeclinationsDiscountRules = function (product, beforeData) { return __awaiter(_this, void 0, void 0, function () {
|
|
450
|
+
var lastPushedTime, _c, _e;
|
|
451
|
+
var _f;
|
|
452
|
+
var _this = this;
|
|
453
|
+
return __generator(this, function (_g) {
|
|
454
|
+
switch (_g.label) {
|
|
455
|
+
case 0:
|
|
456
|
+
lastPushedTime = '';
|
|
457
|
+
_c = [__assign({}, product)];
|
|
458
|
+
_f = {};
|
|
459
|
+
if (!!!product.declinations) return [3, 2];
|
|
460
|
+
return [4, Promise.all(product.declinations.map(function (declination, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
461
|
+
var timestamp, idString, duplicateTime, currentDataDeclis, sameInCurrentData, discountsToDelete, _i, discountsToDelete_1, discount, discountObj, e_3, _c, _e;
|
|
462
|
+
var _f;
|
|
463
|
+
var _this = this;
|
|
464
|
+
return __generator(this, function (_g) {
|
|
465
|
+
switch (_g.label) {
|
|
466
|
+
case 0:
|
|
467
|
+
timestamp = (0, moment_1.default)().toDate().getTime();
|
|
468
|
+
idString = String(timestamp) + '-' + String(index);
|
|
469
|
+
duplicateTime = idString === lastPushedTime;
|
|
470
|
+
lastPushedTime = String(timestamp) + '-' + String(index);
|
|
471
|
+
currentDataDeclis = !!beforeData.declinations ? beforeData.declinations : [];
|
|
472
|
+
sameInCurrentData = currentDataDeclis.find(function (d) { return !!d && d.sku === declination.sku; });
|
|
473
|
+
discountsToDelete = [];
|
|
474
|
+
if (!!sameInCurrentData) {
|
|
475
|
+
discountsToDelete = (sameInCurrentData.discount_rules || []).filter(function (d) {
|
|
476
|
+
return !!d &&
|
|
477
|
+
d.discountRule_type === 'tier-pricing' &&
|
|
478
|
+
(!!!declination.discount_rules ||
|
|
479
|
+
!!!declination.discount_rules.length ||
|
|
480
|
+
!!!declination.discount_rules.some(function (_d) { return _d.id === d.id; }));
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
if (!!duplicateTime) {
|
|
484
|
+
idString =
|
|
485
|
+
idString.split('-')[0] + '-' + String(index + product.declinations.length);
|
|
486
|
+
}
|
|
487
|
+
if (!(!!discountsToDelete &&
|
|
488
|
+
!!discountsToDelete.length &&
|
|
489
|
+
DatabaseService_1.default.getPathParent(this._collection.path) !== '/')) return [3, 6];
|
|
490
|
+
console.log('** Going to delete tier-pricing discount_rules no longer in declination **');
|
|
491
|
+
_i = 0, discountsToDelete_1 = discountsToDelete;
|
|
492
|
+
_g.label = 1;
|
|
493
|
+
case 1:
|
|
494
|
+
if (!(_i < discountsToDelete_1.length)) return [3, 6];
|
|
495
|
+
discount = discountsToDelete_1[_i];
|
|
496
|
+
_g.label = 2;
|
|
497
|
+
case 2:
|
|
498
|
+
_g.trys.push([2, 4, , 5]);
|
|
499
|
+
discountObj = new Discount_1.default(discount, {
|
|
500
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'discountRules')
|
|
501
|
+
}, this._user);
|
|
502
|
+
return [4, discountObj.delete()];
|
|
503
|
+
case 3:
|
|
504
|
+
_g.sent();
|
|
505
|
+
return [3, 5];
|
|
506
|
+
case 4:
|
|
507
|
+
e_3 = _g.sent();
|
|
508
|
+
console.log('error on deleting discount: ', e_3);
|
|
509
|
+
return [3, 5];
|
|
510
|
+
case 5:
|
|
511
|
+
_i++;
|
|
512
|
+
return [3, 1];
|
|
513
|
+
case 6:
|
|
514
|
+
_c = [__assign({}, declination)];
|
|
515
|
+
_f = { id: !!declination.id ? declination.id : idString };
|
|
516
|
+
if (!(!!declination.discount_rules && !!declination.discount_rules.length)) return [3, 8];
|
|
517
|
+
return [4, Promise.all((0, lodash_1.sortedUniqBy)(declination.discount_rules, function (dr) {
|
|
518
|
+
var rule = !!dr.rules && dr.rules.find(function (r) { return r.field === 'quantity'; });
|
|
519
|
+
if (!!!rule)
|
|
520
|
+
return false;
|
|
521
|
+
return rule.ruleDetails[0].value[0];
|
|
522
|
+
}).map(function (rule) { return __awaiter(_this, void 0, void 0, function () {
|
|
523
|
+
var _rule, id;
|
|
524
|
+
return __generator(this, function (_c) {
|
|
525
|
+
switch (_c.label) {
|
|
526
|
+
case 0:
|
|
527
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) === '/')
|
|
528
|
+
return [2, rule];
|
|
529
|
+
if (rule.discountRule_type !== 'tier-pricing')
|
|
530
|
+
return [2, rule];
|
|
531
|
+
_rule = new Discount_1.default(rule, {
|
|
532
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'discountRules')
|
|
533
|
+
}, this._user);
|
|
534
|
+
return [4, _rule.save()];
|
|
535
|
+
case 1:
|
|
536
|
+
id = _c.sent();
|
|
537
|
+
return [2, __assign(__assign({}, rule), (!!!rule.id && typeof id === 'string' && !!id ? { id: id } : {}))];
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}); }))];
|
|
541
|
+
case 7:
|
|
542
|
+
_e = _g.sent();
|
|
543
|
+
return [3, 9];
|
|
544
|
+
case 8:
|
|
545
|
+
_e = [];
|
|
546
|
+
_g.label = 9;
|
|
547
|
+
case 9: return [2, __assign.apply(void 0, _c.concat([(_f.discount_rules = _e, _f)]))];
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}); }))];
|
|
551
|
+
case 1:
|
|
552
|
+
_e = _g.sent();
|
|
553
|
+
return [3, 3];
|
|
554
|
+
case 2:
|
|
555
|
+
_e = [];
|
|
556
|
+
_g.label = 3;
|
|
557
|
+
case 3: return [2, __assign.apply(void 0, _c.concat([(_f.declinations = _e, _f)]))];
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}); };
|
|
561
|
+
_this._uploadDeclinationsImages = function (product) { return __awaiter(_this, void 0, void 0, function () {
|
|
562
|
+
var _c, _e, _f;
|
|
563
|
+
var _g;
|
|
564
|
+
var _this = this;
|
|
565
|
+
return __generator(this, function (_h) {
|
|
566
|
+
switch (_h.label) {
|
|
567
|
+
case 0:
|
|
568
|
+
_c = [__assign({}, product)];
|
|
569
|
+
_g = {};
|
|
570
|
+
if (!(!!!product.image_files || !!!product.image_files.length)) return [3, 1];
|
|
571
|
+
_e = [];
|
|
572
|
+
return [3, 3];
|
|
573
|
+
case 1: return [4, Promise.all(product.image_files
|
|
574
|
+
.filter(function (i) { return !!i && !!i.img_path; })
|
|
575
|
+
.map(function (imageInfo) { return __awaiter(_this, void 0, void 0, function () {
|
|
576
|
+
var _c, _e, img_path;
|
|
577
|
+
var _f, _g;
|
|
578
|
+
return __generator(this, function (_h) {
|
|
579
|
+
switch (_h.label) {
|
|
580
|
+
case 0:
|
|
581
|
+
if (!(!!imageInfo.img_path.dataURL && !!!imageInfo.img_path.file)) return [3, 3];
|
|
582
|
+
if (!(typeof imageInfo.img_path.dataURL === 'string' &&
|
|
583
|
+
!!imageInfo.img_path.dataURL.includes('base64'))) return [3, 2];
|
|
584
|
+
_c = [__assign({}, imageInfo)];
|
|
585
|
+
_f = {};
|
|
586
|
+
return [4, (0, file_1.uploadStringToPath)(imageInfo.img_path.dataURL, (0, context_1.getPathTo)("products/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))), (0, locale_1.getPrincipalWord)(product.name), imageInfo.img_path.dataURL.split(';')[0].split('/')[1])];
|
|
587
|
+
case 1: return [2, __assign.apply(void 0, _c.concat([(_f.img_path = _h.sent(), _f)]))];
|
|
588
|
+
case 2: return [2, __assign(__assign({}, imageInfo), { img_path: imageInfo.img_path.dataURL })];
|
|
589
|
+
case 3:
|
|
590
|
+
if (!(typeof imageInfo.img_path === 'string')) return [3, 6];
|
|
591
|
+
if (!!!imageInfo.img_path.includes('base64')) return [3, 5];
|
|
592
|
+
_e = [__assign({}, imageInfo)];
|
|
593
|
+
_g = {};
|
|
594
|
+
return [4, (0, file_1.uploadStringToPath)(imageInfo.img_path, (0, context_1.getPathTo)("products/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))), (0, locale_1.getPrincipalWord)(product.name), imageInfo.img_path.split(';')[0].split('/')[1])];
|
|
595
|
+
case 4: return [2, __assign.apply(void 0, _e.concat([(_g.img_path = _h.sent(), _g)]))];
|
|
596
|
+
case 5: return [2, imageInfo];
|
|
597
|
+
case 6: return [4, (0, file_1.uploadFileToPath)(imageInfo.img_path.file, (0, context_1.getPathTo)("products/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))))];
|
|
598
|
+
case 7:
|
|
599
|
+
img_path = _h.sent();
|
|
600
|
+
return [2, __assign(__assign({}, imageInfo), { img_path: img_path })];
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
}); }))];
|
|
604
|
+
case 2:
|
|
605
|
+
_e = _h.sent();
|
|
606
|
+
_h.label = 3;
|
|
607
|
+
case 3:
|
|
608
|
+
_g.image_files = _e;
|
|
609
|
+
if (!(!!!product.declinations || !!!product.declinations.length)) return [3, 4];
|
|
610
|
+
_f = [];
|
|
611
|
+
return [3, 6];
|
|
612
|
+
case 4: return [4, Promise.all(product.declinations.map(function (declination) { return __awaiter(_this, void 0, void 0, function () {
|
|
613
|
+
var _c;
|
|
614
|
+
var _e;
|
|
615
|
+
var _this = this;
|
|
616
|
+
return __generator(this, function (_f) {
|
|
617
|
+
switch (_f.label) {
|
|
618
|
+
case 0:
|
|
619
|
+
if (!!!declination.image_files)
|
|
620
|
+
return [2, declination];
|
|
621
|
+
if (!!!declination.image_files.length)
|
|
622
|
+
return [2, declination];
|
|
623
|
+
if (!!!declination.image_files.find(function (imageInfo) { return !!imageInfo.img_path && !!imageInfo.img_path.file; }))
|
|
624
|
+
return [2, declination];
|
|
625
|
+
_c = [__assign({}, declination)];
|
|
626
|
+
_e = {};
|
|
627
|
+
return [4, Promise.all(declination.image_files
|
|
628
|
+
.filter(function (i) { return !!i && !!i.img_path; })
|
|
629
|
+
.map(function (imageInfo) { return __awaiter(_this, void 0, void 0, function () {
|
|
630
|
+
var _c, img_path;
|
|
631
|
+
var _e;
|
|
632
|
+
return __generator(this, function (_f) {
|
|
633
|
+
switch (_f.label) {
|
|
634
|
+
case 0:
|
|
635
|
+
if (!(typeof imageInfo.img_path === 'string')) return [3, 3];
|
|
636
|
+
if (!!!imageInfo.img_path.includes('base64')) return [3, 2];
|
|
637
|
+
_c = [__assign({}, imageInfo)];
|
|
638
|
+
_e = {};
|
|
639
|
+
return [4, (0, file_1.uploadStringToPath)(imageInfo.img_path, (0, context_1.getPathTo)("brands/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))), (0, locale_1.getPrincipalWord)(declination.name), imageInfo.img_path.split(';')[0].split('/')[1])];
|
|
640
|
+
case 1: return [2, __assign.apply(void 0, _c.concat([(_e.img_path = _f.sent(), _e)]))];
|
|
641
|
+
case 2: return [2, imageInfo];
|
|
642
|
+
case 3: return [4, (0, file_1.uploadFileToPath)(imageInfo.img_path.file, (0, context_1.getPathTo)("products/".concat(product.slug), (0, context_1.getIdsBasedOnSpaceDocRef)(DatabaseService_1.default.getPathParent(this._collection.path))))];
|
|
643
|
+
case 4:
|
|
644
|
+
img_path = _f.sent();
|
|
645
|
+
return [2, __assign(__assign({}, imageInfo), { img_path: img_path })];
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
}); }))];
|
|
649
|
+
case 1: return [2, __assign.apply(void 0, _c.concat([(_e.image_files = _f.sent(), _e)]))];
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
}); }))];
|
|
653
|
+
case 5:
|
|
654
|
+
_f = _h.sent();
|
|
655
|
+
_h.label = 6;
|
|
656
|
+
case 6: return [2, __assign.apply(void 0, _c.concat([(_g.declinations = _f, _g)]))];
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}); };
|
|
660
|
+
_this._getAttributes = function () {
|
|
661
|
+
try {
|
|
662
|
+
if (!!!_this.data().product_attributes || !!!_this._data.id)
|
|
663
|
+
return [];
|
|
664
|
+
return _this.data().product_attributes.map(function (d) {
|
|
665
|
+
return new ProductAttribute_1.default(d, DatabaseService_1.default.addToPath(DatabaseService_1.default.addToPath(_this._collection.path, _this._data.id), 'attributes'), _this._user);
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
catch (err) {
|
|
669
|
+
throw new Error("Error while getting attributes: ".concat(err));
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
_this._addAttribute = function (productAttribute) { return __awaiter(_this, void 0, void 0, function () {
|
|
673
|
+
var pas, existingPA, _attributes;
|
|
674
|
+
return __generator(this, function (_c) {
|
|
675
|
+
switch (_c.label) {
|
|
676
|
+
case 0:
|
|
677
|
+
pas = !!this.data().product_attributes ? this.data().product_attributes : [];
|
|
678
|
+
existingPA = pas.find(function (a) { return a.attribute_id === productAttribute.attribute_id; });
|
|
679
|
+
if (!!!existingPA) return [3, 2];
|
|
680
|
+
_attributes = pas.map(function (pa) {
|
|
681
|
+
if (pa.id !== existingPA.id)
|
|
682
|
+
return pa;
|
|
683
|
+
return __assign(__assign({}, pa), productAttribute);
|
|
684
|
+
});
|
|
685
|
+
return [4, this.save({ product_attributes: _attributes })];
|
|
686
|
+
case 1: return [2, _c.sent()];
|
|
687
|
+
case 2: return [4, this.save({
|
|
688
|
+
product_attributes: __spreadArray(__spreadArray([], pas, true), [productAttribute], false)
|
|
689
|
+
})];
|
|
690
|
+
case 3: return [2, _c.sent()];
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}); };
|
|
694
|
+
_this._getCategory = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
695
|
+
var categorySnap, err_1;
|
|
696
|
+
return __generator(this, function (_c) {
|
|
697
|
+
switch (_c.label) {
|
|
698
|
+
case 0:
|
|
699
|
+
if (!!!this._data.category)
|
|
700
|
+
throw new Error("Product categoy is not yet defined");
|
|
701
|
+
_c.label = 1;
|
|
702
|
+
case 1:
|
|
703
|
+
_c.trys.push([1, 3, , 4]);
|
|
704
|
+
return [4, DatabaseService_1.default.getDocument(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'categories'), this._data.category)];
|
|
705
|
+
case 2:
|
|
706
|
+
categorySnap = _c.sent();
|
|
707
|
+
if (!!!categorySnap)
|
|
708
|
+
throw new Error("Inexisting category");
|
|
709
|
+
if (!categorySnap.exists)
|
|
710
|
+
throw new Error("Impossible to retreive the category");
|
|
711
|
+
if (!!!categorySnap.data)
|
|
712
|
+
throw new Error("Impossible te retreive the category data");
|
|
713
|
+
return [2, new Category_1.default(__assign(__assign({}, categorySnap.data), { id: categorySnap.id }), {
|
|
714
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'categories')
|
|
715
|
+
}, this._user)];
|
|
716
|
+
case 3:
|
|
717
|
+
err_1 = _c.sent();
|
|
718
|
+
throw new Error("Error while getting categories: ".concat(err_1));
|
|
719
|
+
case 4: return [2];
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}); };
|
|
723
|
+
_this._getBrand = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
724
|
+
var brandSnap, err_2;
|
|
725
|
+
return __generator(this, function (_c) {
|
|
726
|
+
switch (_c.label) {
|
|
727
|
+
case 0:
|
|
728
|
+
if (!!!this._data.brand)
|
|
729
|
+
return [2, undefined];
|
|
730
|
+
_c.label = 1;
|
|
731
|
+
case 1:
|
|
732
|
+
_c.trys.push([1, 3, , 4]);
|
|
733
|
+
return [4, DatabaseService_1.default.getDocument(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'brands'), this._data.brand)];
|
|
734
|
+
case 2:
|
|
735
|
+
brandSnap = _c.sent();
|
|
736
|
+
if (!!!brandSnap)
|
|
737
|
+
throw new Error("Inexisting brand");
|
|
738
|
+
if (!brandSnap.exists)
|
|
739
|
+
throw new Error("Impossible to retreive the brand");
|
|
740
|
+
if (!!!brandSnap.data)
|
|
741
|
+
throw new Error("Impossible te retreive the brand data");
|
|
742
|
+
return [2, new Brand_1.default(__assign(__assign({}, brandSnap.data), { id: brandSnap.id }), {
|
|
743
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'brands')
|
|
744
|
+
}, this._user)];
|
|
745
|
+
case 3:
|
|
746
|
+
err_2 = _c.sent();
|
|
747
|
+
throw new Error("Error while getting brands: ".concat(err_2));
|
|
748
|
+
case 4: return [2];
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
}); };
|
|
752
|
+
_this._getDeclinations = function () {
|
|
753
|
+
if (!!!_this._data.id)
|
|
754
|
+
throw new Error("Product must be saved to create declinations.");
|
|
755
|
+
var declinationCollectionRef = DatabaseService_1.default.addToPath(DatabaseService_1.default.addToPath(_this._collection.path, _this._data.id), 'declinations');
|
|
756
|
+
if (!!!_this.data().declinations)
|
|
757
|
+
return [];
|
|
758
|
+
return _this.data().declinations.map(function (d) { return new Declination_1.default(d, declinationCollectionRef, _this._user); });
|
|
759
|
+
};
|
|
760
|
+
_this._addDeclination = function (declination) { return __awaiter(_this, void 0, void 0, function () {
|
|
761
|
+
return __generator(this, function (_c) {
|
|
762
|
+
if (!!!this._data.id)
|
|
763
|
+
throw new Error("Product must be saved to create declinations.");
|
|
764
|
+
if (!!!this.data().declinations)
|
|
765
|
+
return [2];
|
|
766
|
+
return [2, this.save({
|
|
767
|
+
declinations: __spreadArray(__spreadArray([], this.data().declinations, true), [declination], false)
|
|
768
|
+
})];
|
|
769
|
+
});
|
|
770
|
+
}); };
|
|
771
|
+
_this._saveIndex = function (category) { return __awaiter(_this, void 0, void 0, function () {
|
|
772
|
+
var brand, declinations, e_4, tree, _c, space, indexed, error_3;
|
|
773
|
+
return __generator(this, function (_e) {
|
|
774
|
+
switch (_e.label) {
|
|
775
|
+
case 0:
|
|
776
|
+
if (!!!this._data.id)
|
|
777
|
+
throw new Error('Product must be saved first.');
|
|
778
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
779
|
+
throw new Error('BD badly initialised. Products collection must have a parent.');
|
|
780
|
+
brand = undefined;
|
|
781
|
+
declinations = this.data().declinations;
|
|
782
|
+
if (!!!declinations) {
|
|
783
|
+
console.log("No declinations to update");
|
|
784
|
+
return [2, true];
|
|
785
|
+
}
|
|
786
|
+
_e.label = 1;
|
|
787
|
+
case 1:
|
|
788
|
+
_e.trys.push([1, 15, , 16]);
|
|
789
|
+
if (!(!!!category && !!!this.data().is_service)) return [3, 3];
|
|
790
|
+
return [4, this.category.get()];
|
|
791
|
+
case 2:
|
|
792
|
+
category = _e.sent();
|
|
793
|
+
if (!!!category)
|
|
794
|
+
throw new Error("A category must be set");
|
|
795
|
+
_e.label = 3;
|
|
796
|
+
case 3:
|
|
797
|
+
if (!!!this._data.brand) return [3, 7];
|
|
798
|
+
_e.label = 4;
|
|
799
|
+
case 4:
|
|
800
|
+
_e.trys.push([4, 6, , 7]);
|
|
801
|
+
return [4, this.brand.get()];
|
|
802
|
+
case 5:
|
|
803
|
+
brand = _e.sent();
|
|
804
|
+
return [3, 7];
|
|
805
|
+
case 6:
|
|
806
|
+
e_4 = _e.sent();
|
|
807
|
+
console.log('could not fetch brand with id ', this._data.brand, ': ', e_4.toString());
|
|
808
|
+
return [3, 7];
|
|
809
|
+
case 7:
|
|
810
|
+
if (!!!category) return [3, 9];
|
|
811
|
+
return [4, category.getParentTree()];
|
|
812
|
+
case 8:
|
|
813
|
+
_c = _e.sent();
|
|
814
|
+
return [3, 10];
|
|
815
|
+
case 9:
|
|
816
|
+
_c = [];
|
|
817
|
+
_e.label = 10;
|
|
818
|
+
case 10:
|
|
819
|
+
tree = _c;
|
|
820
|
+
return [4, Space_1.default.getCurrentSpaceWithRef(this._collection.path, this._user)];
|
|
821
|
+
case 11:
|
|
822
|
+
space = _e.sent();
|
|
823
|
+
return [4, space.initCurrencies()];
|
|
824
|
+
case 12:
|
|
825
|
+
_e.sent();
|
|
826
|
+
return [4, (0, Product_1.populateIndexedProduct)(this.data(), tree, space, category, brand)];
|
|
827
|
+
case 13:
|
|
828
|
+
indexed = _e.sent();
|
|
829
|
+
console.log('index is created');
|
|
830
|
+
return [4, DatabaseService_1.default.saveDocument(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'indexes/products/public'), this._data.id, (0, moment_1.default)().unix(), (0, object_1.stripObjectForFirebase)(__assign(__assign({}, indexed), { declinations: indexed.declinations.map(function (declination) {
|
|
831
|
+
if (!!declination.promo_price || typeof declination.promo_price !== 'boolean')
|
|
832
|
+
return declination;
|
|
833
|
+
var promo_price = declination.promo_price, rest = __rest(declination, ["promo_price"]);
|
|
834
|
+
return __assign({}, rest);
|
|
835
|
+
}) })), { merge: true })];
|
|
836
|
+
case 14:
|
|
837
|
+
_e.sent();
|
|
838
|
+
return [2, true];
|
|
839
|
+
case 15:
|
|
840
|
+
error_3 = _e.sent();
|
|
841
|
+
console.log("error while indexing", error_3.toString());
|
|
842
|
+
console.trace("indexing error trace");
|
|
843
|
+
throw error_3;
|
|
844
|
+
case 16: return [2];
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
}); };
|
|
848
|
+
_this._getIndex = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
849
|
+
var indexedProductsDocs;
|
|
850
|
+
var _this = this;
|
|
851
|
+
return __generator(this, function (_c) {
|
|
852
|
+
switch (_c.label) {
|
|
853
|
+
case 0:
|
|
854
|
+
if (!!!this._data.id)
|
|
855
|
+
throw new Error("Product has never been saved");
|
|
856
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
857
|
+
throw new Error("Can't access indexes collection");
|
|
858
|
+
return [4, DatabaseService_1.default.getDocuments(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'indexes/products/public'), { query: [{ field: 'product_id', operator: '==', value: this._data.id }] })];
|
|
859
|
+
case 1:
|
|
860
|
+
indexedProductsDocs = _c.sent();
|
|
861
|
+
return [4, Promise.all(indexedProductsDocs
|
|
862
|
+
.filter(function (d) { return !!d.exists && !!d.data; })
|
|
863
|
+
.map(function (doc) {
|
|
864
|
+
return new Product_2.default(__assign(__assign({}, doc.data), { id: doc.id }), {
|
|
865
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(_this._collection.path), 'indexes/products/public')
|
|
866
|
+
}, _this._user);
|
|
867
|
+
}))];
|
|
868
|
+
case 2: return [2, _c.sent()];
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
}); };
|
|
872
|
+
_this._deleteIndex = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
873
|
+
var error_4;
|
|
874
|
+
return __generator(this, function (_c) {
|
|
875
|
+
switch (_c.label) {
|
|
876
|
+
case 0:
|
|
877
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
878
|
+
throw new Error("Can't access parent collection");
|
|
879
|
+
_c.label = 1;
|
|
880
|
+
case 1:
|
|
881
|
+
_c.trys.push([1, 3, , 4]);
|
|
882
|
+
if (!!!this._data.id)
|
|
883
|
+
throw new Error('No id for selected product');
|
|
884
|
+
return [4, DatabaseService_1.default.deleteDocument(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'indexes/products/public'), this._data.id)];
|
|
885
|
+
case 2:
|
|
886
|
+
_c.sent();
|
|
887
|
+
return [3, 4];
|
|
888
|
+
case 3:
|
|
889
|
+
error_4 = _c.sent();
|
|
890
|
+
throw error_4;
|
|
891
|
+
case 4: return [2];
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
}); };
|
|
895
|
+
_this.callPublicService = function (service, fromServer) {
|
|
896
|
+
if (fromServer === void 0) { fromServer = false; }
|
|
897
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
898
|
+
var requestHeader, url, method, quoteReq, details, error_5;
|
|
899
|
+
return __generator(this, function (_c) {
|
|
900
|
+
switch (_c.label) {
|
|
901
|
+
case 0:
|
|
902
|
+
requestHeader = (0, services_1.productServiceUrl)(__assign({}, service.external_service_infos), service.external_service_name);
|
|
903
|
+
if (!!!requestHeader)
|
|
904
|
+
throw new Error("Can't access service provider. Please validate your external services configuration");
|
|
905
|
+
url = requestHeader.url, method = requestHeader.type;
|
|
906
|
+
_c.label = 1;
|
|
907
|
+
case 1:
|
|
908
|
+
_c.trys.push([1, 4, , 5]);
|
|
909
|
+
return [4, fetch(!!fromServer ? "".concat(url, "&q=").concat(this.data().name[0].value) : '/api/services/cors', {
|
|
910
|
+
headers: { 'content-type': 'application/json' },
|
|
911
|
+
method: !!fromServer ? method : 'POST',
|
|
912
|
+
body: JSON.stringify({
|
|
913
|
+
props: { method: method, headers: { 'content-type': 'application/json' } },
|
|
914
|
+
url: "".concat(url, "&q=").concat(this.data().name[0].value)
|
|
915
|
+
})
|
|
916
|
+
})];
|
|
917
|
+
case 2:
|
|
918
|
+
quoteReq = _c.sent();
|
|
919
|
+
if (quoteReq.status.toString() !== '200')
|
|
920
|
+
throw new Error("Error while getting service: ".concat(quoteReq.statusText));
|
|
921
|
+
return [4, quoteReq.json()];
|
|
922
|
+
case 3:
|
|
923
|
+
details = _c.sent();
|
|
924
|
+
return [2, { confirmed: true, details: details }];
|
|
925
|
+
case 4:
|
|
926
|
+
error_5 = _c.sent();
|
|
927
|
+
(0, console_1.errorMessage)("Error while calling order service ".concat(error_5, " - ").concat(JSON.stringify(error_5)));
|
|
928
|
+
return [2, { confirmed: false, error: error_5 }];
|
|
929
|
+
case 5: return [2];
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
};
|
|
934
|
+
_this._updateAllDeclinationsPrice = function (pricingMapFromExternalOrCustom, attributes, saveToDatabase, updateRegular, spaceToUse) {
|
|
935
|
+
if (saveToDatabase === void 0) { saveToDatabase = true; }
|
|
936
|
+
if (updateRegular === void 0) { updateRegular = true; }
|
|
937
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
938
|
+
var space, _c, spacePrice, declinations, declinationsWithAttributeLinkedToService, _loop_1, this_1, _i, declinationsWithAttributeLinkedToService_1, declinationToUpdate, state_1, error_6;
|
|
939
|
+
return __generator(this, function (_e) {
|
|
940
|
+
switch (_e.label) {
|
|
941
|
+
case 0:
|
|
942
|
+
_e.trys.push([0, 9, , 10]);
|
|
943
|
+
if (!!!spaceToUse) return [3, 1];
|
|
944
|
+
_c = spaceToUse;
|
|
945
|
+
return [3, 3];
|
|
946
|
+
case 1: return [4, Space_1.default.getCurrentSpaceWithRef(this._collection.path, this._user)];
|
|
947
|
+
case 2:
|
|
948
|
+
_c = _e.sent();
|
|
949
|
+
_e.label = 3;
|
|
950
|
+
case 3:
|
|
951
|
+
space = _c;
|
|
952
|
+
spacePrice = this.adaptPriceChartingValues(pricingMapFromExternalOrCustom, space);
|
|
953
|
+
declinations = this.data().declinations;
|
|
954
|
+
if (!!!declinations)
|
|
955
|
+
return [2, false];
|
|
956
|
+
declinationsWithAttributeLinkedToService = declinations.filter(function (d) {
|
|
957
|
+
return !!d.attributes.find(function (pa) {
|
|
958
|
+
var attr = attributes.find(function (_a) { return _a.id === pa.attribute_id; });
|
|
959
|
+
if (!!!attr)
|
|
960
|
+
return false;
|
|
961
|
+
if (!!!attr.is_service_related)
|
|
962
|
+
return false;
|
|
963
|
+
if (!!!attr.service_links_to_attribute)
|
|
964
|
+
return false;
|
|
965
|
+
return true;
|
|
966
|
+
});
|
|
967
|
+
});
|
|
968
|
+
if (!!!declinationsWithAttributeLinkedToService.length)
|
|
969
|
+
return [2, false];
|
|
970
|
+
_loop_1 = function (declinationToUpdate) {
|
|
971
|
+
var relationProductAttribute, relationAttribute, propsToLink, price, priceDetails, _declinations;
|
|
972
|
+
return __generator(this, function (_f) {
|
|
973
|
+
switch (_f.label) {
|
|
974
|
+
case 0:
|
|
975
|
+
relationProductAttribute = declinationToUpdate.attributes.find(function (pa) {
|
|
976
|
+
var attr = attributes.find(function (_a) { return _a.id === pa.attribute_id; });
|
|
977
|
+
if (!!!attr)
|
|
978
|
+
return false;
|
|
979
|
+
if (!!!attr.is_service_related)
|
|
980
|
+
return false;
|
|
981
|
+
return true;
|
|
982
|
+
});
|
|
983
|
+
if (!!!relationProductAttribute)
|
|
984
|
+
return [2, "continue"];
|
|
985
|
+
relationAttribute = attributes.find(function (a) { return a.id === relationProductAttribute.attribute_id; });
|
|
986
|
+
if (!!!relationAttribute)
|
|
987
|
+
return [2, "continue"];
|
|
988
|
+
if (!!!relationAttribute.service_links_to_attribute)
|
|
989
|
+
return [2, "continue"];
|
|
990
|
+
propsToLink = relationAttribute.service_links_to_attribute.find(function (slta) {
|
|
991
|
+
return slta.value_slugs.find(function (vs) { return !!relationProductAttribute.values.find(function (value) { return value.slug === vs.slug; }); });
|
|
992
|
+
});
|
|
993
|
+
if (!!!propsToLink)
|
|
994
|
+
return [2, "continue"];
|
|
995
|
+
if (!!!spacePrice[propsToLink.service_field])
|
|
996
|
+
return [2, "continue"];
|
|
997
|
+
price = (0, lodash_1.toNumber)(spacePrice[propsToLink.service_field]) / 100;
|
|
998
|
+
priceDetails = propsToLink.value_slugs.find(function (vs) { return !!relationProductAttribute.values.find(function (value) { return value.slug === vs.slug; }); });
|
|
999
|
+
if (!!priceDetails) {
|
|
1000
|
+
if (!!priceDetails.percent_variation) {
|
|
1001
|
+
price = price * (1 + priceDetails.percent_variation / 100);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
_declinations = declinations.map(function (declination) {
|
|
1005
|
+
if (declination.sku !== declinationToUpdate.sku)
|
|
1006
|
+
return declination;
|
|
1007
|
+
return __assign(__assign({}, declination), { price: __assign(__assign(__assign({}, declination.price), { pdsf: { amount: (0, lodash_1.toNumber)(price) } }), (!!updateRegular
|
|
1008
|
+
? {
|
|
1009
|
+
regular: {
|
|
1010
|
+
amount: (0, lodash_1.ceil)((0, lodash_1.toNumber)(price)) - 0.01 >= (0, lodash_1.toNumber)(declination.price.regular.amount)
|
|
1011
|
+
? (0, lodash_1.ceil)((0, lodash_1.toNumber)(price)) - 0.01
|
|
1012
|
+
: (0, lodash_1.toNumber)(declination.price.regular.amount)
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
: {})) });
|
|
1016
|
+
});
|
|
1017
|
+
if (!!!saveToDatabase)
|
|
1018
|
+
return [2, { value: {
|
|
1019
|
+
declinations: _declinations,
|
|
1020
|
+
services: { price_charting: spacePrice }
|
|
1021
|
+
} }];
|
|
1022
|
+
return [4, this_1.save({
|
|
1023
|
+
declinations: _declinations
|
|
1024
|
+
}, { index: true })];
|
|
1025
|
+
case 1:
|
|
1026
|
+
_f.sent();
|
|
1027
|
+
return [2];
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
};
|
|
1031
|
+
this_1 = this;
|
|
1032
|
+
_i = 0, declinationsWithAttributeLinkedToService_1 = declinationsWithAttributeLinkedToService;
|
|
1033
|
+
_e.label = 4;
|
|
1034
|
+
case 4:
|
|
1035
|
+
if (!(_i < declinationsWithAttributeLinkedToService_1.length)) return [3, 7];
|
|
1036
|
+
declinationToUpdate = declinationsWithAttributeLinkedToService_1[_i];
|
|
1037
|
+
return [5, _loop_1(declinationToUpdate)];
|
|
1038
|
+
case 5:
|
|
1039
|
+
state_1 = _e.sent();
|
|
1040
|
+
if (typeof state_1 === "object")
|
|
1041
|
+
return [2, state_1.value];
|
|
1042
|
+
_e.label = 6;
|
|
1043
|
+
case 6:
|
|
1044
|
+
_i++;
|
|
1045
|
+
return [3, 4];
|
|
1046
|
+
case 7: return [4, this.save({
|
|
1047
|
+
services: __assign(__assign({}, this.data().services), { price_charting: spacePrice })
|
|
1048
|
+
})];
|
|
1049
|
+
case 8:
|
|
1050
|
+
_e.sent();
|
|
1051
|
+
return [2, true];
|
|
1052
|
+
case 9:
|
|
1053
|
+
error_6 = _e.sent();
|
|
1054
|
+
if (process.env.NODE_ENV !== 'production')
|
|
1055
|
+
console.log(error_6);
|
|
1056
|
+
return [2, false];
|
|
1057
|
+
case 10: return [2];
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
_this.adaptPriceChartingValues = function (pricingMap, space) {
|
|
1063
|
+
var returnValue = {};
|
|
1064
|
+
(0, lodash_1.forEach)(pricingMap, function (val, key) {
|
|
1065
|
+
if (['loose-price', 'cib-price', 'loose-price', 'box-only-price', 'manual-only-price', 'new-price'].includes(key)) {
|
|
1066
|
+
returnValue[key] = (0, currency_1.calculateAmountByCurrency)(space, space.preferences.default.currency(), (0, lodash_1.toNumber)(val), 'USD');
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
return __assign(__assign({}, pricingMap), returnValue);
|
|
1071
|
+
};
|
|
1072
|
+
_this._updateAllDeclinationsPriceAsync = function (pricingMapFromExternalOrCustom) { return __awaiter(_this, void 0, void 0, function () {
|
|
1073
|
+
var attributesRes, attributes, error_7;
|
|
1074
|
+
return __generator(this, function (_c) {
|
|
1075
|
+
switch (_c.label) {
|
|
1076
|
+
case 0:
|
|
1077
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
1078
|
+
throw new Error("Can't fetch attributes");
|
|
1079
|
+
_c.label = 1;
|
|
1080
|
+
case 1:
|
|
1081
|
+
_c.trys.push([1, 4, , 5]);
|
|
1082
|
+
return [4, DatabaseService_1.default.getDocuments(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'attributes'))];
|
|
1083
|
+
case 2:
|
|
1084
|
+
attributesRes = _c.sent();
|
|
1085
|
+
attributes = attributesRes
|
|
1086
|
+
.filter(function (d) { return !!d.exists && !!d.data; })
|
|
1087
|
+
.map(function (d) { return (__assign(__assign({}, d.data), { id: d.id })); });
|
|
1088
|
+
return [4, this._updateAllDeclinationsPrice(pricingMapFromExternalOrCustom, attributes)];
|
|
1089
|
+
case 3: return [2, _c.sent()];
|
|
1090
|
+
case 4:
|
|
1091
|
+
error_7 = _c.sent();
|
|
1092
|
+
(0, console_1.errorMessage)("Error while fetching price and attributes");
|
|
1093
|
+
return [2, []];
|
|
1094
|
+
case 5: return [2];
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
}); };
|
|
1098
|
+
_this._getMarketplacePublications = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1099
|
+
var publications, error_8;
|
|
1100
|
+
return __generator(this, function (_c) {
|
|
1101
|
+
switch (_c.label) {
|
|
1102
|
+
case 0:
|
|
1103
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
1104
|
+
throw new Error("Can't fetch marketplace publications");
|
|
1105
|
+
_c.label = 1;
|
|
1106
|
+
case 1:
|
|
1107
|
+
_c.trys.push([1, 3, , 4]);
|
|
1108
|
+
return [4, DatabaseService_1.default.getDocuments(DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'marketplace_publications'), options)];
|
|
1109
|
+
case 2:
|
|
1110
|
+
publications = _c.sent();
|
|
1111
|
+
return [2, publications.map(function (d) { return (__assign(__assign({}, d.data), { id: d.id })); })];
|
|
1112
|
+
case 3:
|
|
1113
|
+
error_8 = _c.sent();
|
|
1114
|
+
(0, console_1.errorMessage)("Error while fetching marketplace publications");
|
|
1115
|
+
return [2, []];
|
|
1116
|
+
case 4: return [2];
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
}); };
|
|
1120
|
+
_this._marketplacePublicationsListner = function (callback, options) {
|
|
1121
|
+
if (DatabaseService_1.default.getPathParent(_this._collection.path) == '/')
|
|
1122
|
+
throw new Error("Can't fetch marketplace publications");
|
|
1123
|
+
try {
|
|
1124
|
+
var call = DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(_this._collection.path), 'marketplace_publications');
|
|
1125
|
+
return DatabaseService_1.default.registerListener(function (dataSnap) {
|
|
1126
|
+
if (!!!dataSnap.length)
|
|
1127
|
+
callback([]);
|
|
1128
|
+
(0, console_1.workingMessage)("Marketplace publications has been udpated. Refreshing...");
|
|
1129
|
+
callback(dataSnap.map(function (d) { return (__assign(__assign({}, d.data), { id: d.id })); }));
|
|
1130
|
+
}, call, !!options ? options : { query: [{ field: 'parent_slug', operator: '==', value: _this._data.slug }] });
|
|
1131
|
+
}
|
|
1132
|
+
catch (error) {
|
|
1133
|
+
(0, console_1.errorMessage)("Error while listening marketplace publications");
|
|
1134
|
+
return '';
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
_this._createNewPublication = function (sku, marketplacePublication, space) { return __awaiter(_this, void 0, void 0, function () {
|
|
1138
|
+
var productInvetory, error_9, newMarketplacePublication, error_10;
|
|
1139
|
+
return __generator(this, function (_c) {
|
|
1140
|
+
switch (_c.label) {
|
|
1141
|
+
case 0:
|
|
1142
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
1143
|
+
throw new Error("Can't fetch marketplace publications");
|
|
1144
|
+
_c.label = 1;
|
|
1145
|
+
case 1:
|
|
1146
|
+
_c.trys.push([1, 3, , 4]);
|
|
1147
|
+
return [4, space.inventoryItems.getOne(sku)];
|
|
1148
|
+
case 2:
|
|
1149
|
+
productInvetory = _c.sent();
|
|
1150
|
+
if (!!!productInvetory || !!!productInvetory.web_inventory)
|
|
1151
|
+
throw new Error("Can't find inventory item with sku: ".concat(sku));
|
|
1152
|
+
if (!!!productInvetory.web_inventory.available)
|
|
1153
|
+
throw new Error("Inventory item with sku: ".concat(sku, " is not available"));
|
|
1154
|
+
if (marketplacePublication.quantity < 1)
|
|
1155
|
+
throw new Error("No quantity available");
|
|
1156
|
+
if ((0, lodash_1.toNumber)(productInvetory.web_inventory.available) < 1)
|
|
1157
|
+
throw new Error("No quantity available");
|
|
1158
|
+
if ((0, lodash_1.toNumber)(productInvetory.web_inventory.available) < marketplacePublication.quantity)
|
|
1159
|
+
throw new Error("Inventory item with sku: ".concat(sku, " is not available"));
|
|
1160
|
+
return [3, 4];
|
|
1161
|
+
case 3:
|
|
1162
|
+
error_9 = _c.sent();
|
|
1163
|
+
(0, console_1.errorMessage)("Error while fetching inventory item with sku: ".concat(sku));
|
|
1164
|
+
return [2, false];
|
|
1165
|
+
case 4:
|
|
1166
|
+
_c.trys.push([4, 6, , 7]);
|
|
1167
|
+
newMarketplacePublication = new MarketplacePublication_1.default(__assign(__assign({}, marketplacePublication), { sku: sku, parent_slug: this.data().slug, created_at: new Date(), created_by: this._user }), {
|
|
1168
|
+
path: DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'marketplace_publications')
|
|
1169
|
+
}, this._user);
|
|
1170
|
+
return [4, newMarketplacePublication.save()];
|
|
1171
|
+
case 5: return [2, _c.sent()];
|
|
1172
|
+
case 6:
|
|
1173
|
+
error_10 = _c.sent();
|
|
1174
|
+
(0, console_1.errorMessage)("Error while creating marketplace publications");
|
|
1175
|
+
return [2, false];
|
|
1176
|
+
case 7: return [2];
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}); };
|
|
1180
|
+
_this._updateMarketplacePublication = function (sku, marketplacePublication) { return __awaiter(_this, void 0, void 0, function () {
|
|
1181
|
+
var marketplacePublicationObj, error_11;
|
|
1182
|
+
return __generator(this, function (_c) {
|
|
1183
|
+
switch (_c.label) {
|
|
1184
|
+
case 0:
|
|
1185
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
1186
|
+
throw new Error("Can't update marketplace publications");
|
|
1187
|
+
_c.label = 1;
|
|
1188
|
+
case 1:
|
|
1189
|
+
_c.trys.push([1, 4, , 5]);
|
|
1190
|
+
return [4, MarketplacePublication_1.default.getMarketplacePublicationObj(sku, DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'marketplace_publications'), this._user)];
|
|
1191
|
+
case 2:
|
|
1192
|
+
marketplacePublicationObj = _c.sent();
|
|
1193
|
+
if (!!!marketplacePublicationObj)
|
|
1194
|
+
throw new Error("No marketplace publication found");
|
|
1195
|
+
return [4, marketplacePublicationObj.save(marketplacePublication)];
|
|
1196
|
+
case 3: return [2, _c.sent()];
|
|
1197
|
+
case 4:
|
|
1198
|
+
error_11 = _c.sent();
|
|
1199
|
+
(0, console_1.errorMessage)("Error while updating marketplace publications");
|
|
1200
|
+
return [2, false];
|
|
1201
|
+
case 5: return [2];
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
}); };
|
|
1205
|
+
_this._removeMarketplacePublication = function (publicationId) { return __awaiter(_this, void 0, void 0, function () {
|
|
1206
|
+
var marketplacePublicationObj, error_12;
|
|
1207
|
+
return __generator(this, function (_c) {
|
|
1208
|
+
switch (_c.label) {
|
|
1209
|
+
case 0:
|
|
1210
|
+
if (DatabaseService_1.default.getPathParent(this._collection.path) == '/')
|
|
1211
|
+
throw new Error("Can't remove marketplace publications");
|
|
1212
|
+
_c.label = 1;
|
|
1213
|
+
case 1:
|
|
1214
|
+
_c.trys.push([1, 4, , 5]);
|
|
1215
|
+
return [4, MarketplacePublication_1.default.getMarketplacePublicationObjById(publicationId, DatabaseService_1.default.addToPath(DatabaseService_1.default.getPathParent(this._collection.path), 'marketplace_publications'), this._user)];
|
|
1216
|
+
case 2:
|
|
1217
|
+
marketplacePublicationObj = _c.sent();
|
|
1218
|
+
if (!!!marketplacePublicationObj)
|
|
1219
|
+
throw new Error("No marketplace publication found");
|
|
1220
|
+
return [4, marketplacePublicationObj.delete()];
|
|
1221
|
+
case 3: return [2, _c.sent()];
|
|
1222
|
+
case 4:
|
|
1223
|
+
error_12 = _c.sent();
|
|
1224
|
+
(0, console_1.errorMessage)("Error while deleting marketplace publications");
|
|
1225
|
+
return [2, false];
|
|
1226
|
+
case 5: return [2];
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
}); };
|
|
1230
|
+
_this.attributes = {
|
|
1231
|
+
get: _this._getAttributes,
|
|
1232
|
+
add: _this._addAttribute
|
|
1233
|
+
};
|
|
1234
|
+
_this.brand = {
|
|
1235
|
+
get: _this._getBrand
|
|
1236
|
+
};
|
|
1237
|
+
_this.category = {
|
|
1238
|
+
get: _this._getCategory
|
|
1239
|
+
};
|
|
1240
|
+
_this.publications = {
|
|
1241
|
+
get: _this._getMarketplacePublications,
|
|
1242
|
+
listen: _this._marketplacePublicationsListner,
|
|
1243
|
+
update: _this._updateMarketplacePublication,
|
|
1244
|
+
create: _this._createNewPublication,
|
|
1245
|
+
remove: _this._removeMarketplacePublication
|
|
1246
|
+
};
|
|
1247
|
+
_this.declinations = {
|
|
1248
|
+
get: _this._getDeclinations,
|
|
1249
|
+
add: _this._addDeclination,
|
|
1250
|
+
update: {
|
|
1251
|
+
priceSync: _this._updateAllDeclinationsPrice,
|
|
1252
|
+
priceAsync: _this._updateAllDeclinationsPriceAsync
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
_this.index = {
|
|
1256
|
+
save: _this._saveIndex,
|
|
1257
|
+
get: _this._getIndex,
|
|
1258
|
+
delete: _this._deleteIndex
|
|
1259
|
+
};
|
|
1260
|
+
return _this;
|
|
1261
|
+
}
|
|
1262
|
+
var _b;
|
|
1263
|
+
_b = Product;
|
|
1264
|
+
Product.fetch = function (_c) {
|
|
1265
|
+
var app = _c.app, api = _c.api, _e = _c.hpp, hpp = _e === void 0 ? 10 : _e, _f = _c.page, page = _f === void 0 ? 0 : _f, _g = _c.query, query = _g === void 0 ? '' : _g, _h = _c.filters, filters = _h === void 0 ? '' : _h, _j = _c.indice, indice = _j === void 0 ? 'products' : _j, _k = _c.f, f = _k === void 0 ? '' : _k, space = _c.space, _l = _c.useProspr, useProspr = _l === void 0 ? false : _l;
|
|
1266
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
1267
|
+
var prosprSearch, prosprService, algolia, results, error_13;
|
|
1268
|
+
return __generator(_b, function (_m) {
|
|
1269
|
+
switch (_m.label) {
|
|
1270
|
+
case 0:
|
|
1271
|
+
_m.trys.push([0, 2, , 3]);
|
|
1272
|
+
prosprSearch = false;
|
|
1273
|
+
if (!!space) {
|
|
1274
|
+
prosprService = space
|
|
1275
|
+
.data()
|
|
1276
|
+
.external_services.find(function (es) { return es.external_service_name.toLowerCase().trim() === 'prosprsearch'; });
|
|
1277
|
+
prosprSearch = !!prosprService && prosprService.is_active;
|
|
1278
|
+
}
|
|
1279
|
+
algolia = (0, algolia_1.createClient)({
|
|
1280
|
+
app: app,
|
|
1281
|
+
indexId: "".concat(__1.isTestEnv ? 'test' : 'prod', "_").concat(indice),
|
|
1282
|
+
key: !!useProspr ? api : prosprSearch && !!space ? space.preferences.prosprsearch.app() : api,
|
|
1283
|
+
prospr: !!prosprSearch || !!useProspr
|
|
1284
|
+
});
|
|
1285
|
+
return [4, algolia.search(query, {
|
|
1286
|
+
hitsPerPage: hpp,
|
|
1287
|
+
facetFilters: filters,
|
|
1288
|
+
filters: f,
|
|
1289
|
+
page: page,
|
|
1290
|
+
facets: ['*']
|
|
1291
|
+
})];
|
|
1292
|
+
case 1:
|
|
1293
|
+
results = _m.sent();
|
|
1294
|
+
return [2, results];
|
|
1295
|
+
case 2:
|
|
1296
|
+
error_13 = _m.sent();
|
|
1297
|
+
(0, console_1.errorMessage)(error_13);
|
|
1298
|
+
throw error_13;
|
|
1299
|
+
case 3: return [2];
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
Product.checkExternalValuesForDecli = function (sku, space, org) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1305
|
+
var externalValues, serviceQuery;
|
|
1306
|
+
return __generator(_b, function (_c) {
|
|
1307
|
+
switch (_c.label) {
|
|
1308
|
+
case 0:
|
|
1309
|
+
if (!!!space)
|
|
1310
|
+
return [2];
|
|
1311
|
+
externalValues = undefined;
|
|
1312
|
+
serviceQuery = space.services({ field: 'external_service_name', value: 'G2' });
|
|
1313
|
+
if (!(!!serviceQuery && serviceQuery.length)) return [3, 2];
|
|
1314
|
+
return [4, (0, g2_1.getG2ProductExternalValues)(sku, serviceQuery[0], space, org)];
|
|
1315
|
+
case 1:
|
|
1316
|
+
externalValues = _c.sent();
|
|
1317
|
+
_c.label = 2;
|
|
1318
|
+
case 2: return [2, externalValues];
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
}); };
|
|
1322
|
+
return Product;
|
|
1323
|
+
}(baseService_1.BaseServiceClass));
|
|
1324
|
+
exports.default = Product;
|
|
1325
|
+
//# sourceMappingURL=index.js.map
|