@posx/core 5.5.673 → 5.5.675
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/build/index.d.ts +3 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -6599,6 +6599,8 @@ declare function importFromCSV(file: File): Promise<{
|
|
|
6599
6599
|
uid: string;
|
|
6600
6600
|
}[];
|
|
6601
6601
|
}>;
|
|
6602
|
+
/** Merge a CSV-imported item onto an existing one: only non-empty CSV-backed fields overwrite, every other existing field (cost, recipe, printers, config...) is kept */
|
|
6603
|
+
declare function mergeImportedItem<T extends Partial<IItem>>(existing: T, imported: Partial<IItem>): T;
|
|
6602
6604
|
//#endregion
|
|
6603
6605
|
//#region src/libs/electron.socket.d.ts
|
|
6604
6606
|
declare class ElectronSocket {
|
|
@@ -6683,5 +6685,5 @@ interface ValidationResult {
|
|
|
6683
6685
|
}
|
|
6684
6686
|
declare function validateSTTemplate(jsonStr: string): ValidationResult;
|
|
6685
6687
|
//#endregion
|
|
6686
|
-
export { Address, AlipayMethod, AppBaseModel, AppConfig, AppCoreModel, AppCoreService, AppExtraModel, AppLocalService, AppMiscService, AppRemoteService, AppReport, AppReportService, Applying, Appointment, AppointmentService, AppointmentServiceLine, AppointmentSource, AppointmentStatus, AssetItem, AssetTags, AssetType, Between, Cache, CalcFlow, CalcType, CancelInvoiceOptions, CardPaymentCode, CashDrawerConfig, Category, CategoryButtonShape, CategorySalesSummary, CategoryService, CategoryType, Charge, ChargeConfig, CheckInvoiceOptions, Codepages, ComboGroup, ComboGroupItem, Condition, Config, ConfigService, CoreCategory, CoreItem, Coupon, CouponItemized, CouponUsage, CreateInvoiceOptions, CrmConfig, CurrencyConfig, CustomResponse, Customer, CustomerDisplaySystemConfig, DatabaseStats, DayOfWeek, DeployChannel, Device, DeviceEtc, DeviceType, DiagnosticsService, DirectPayInvoiceOptions, DiscountType, DrawerSummary, ElectronSocket, Employee, EmployeeRole, EmployeeRoleService, EmployeeService, ErrorMsgs, EscPosCompatibility, EscPosPrinter, EventPrintConfig, FileUploadRequest, GTOConfig, GeneralConfig, GetManyResult, Holiday, IAddress, IAppBase, IAppBaseModel, IAppConfig, IAppCore, IAppCoreModel, IAppCoreService, IAppExtra, IAppExtraModel, IAppLocalService, IAppMiscService, IAppModelSequence, IAppRemoteService, IAppReport, IAppReportService, IApplying, IAppointment, IAppointmentService, IAppointmentServiceLine, ICache, ICashDrawerConfig, ICategory, ICategoryService, IChangePaymentMethodOption, ICharge, IChargeConfig, IComboGroup, IComboGroupItem, IConfig, IConfigService, ICoreCategory, ICoreItem, ICoupon, ICouponItemized, ICouponUsage, ICredit, ICrmConfig, ICurrencyConfig, ICustomer, ICustomerDisplaySystemConfig, IDevice, IDiscount, IDiscountSummaryEntry, IDrawerSummary, IEmployee, IEmployeeRole, IEmployeeRoleService, IEmployeeService, IEscPosPrinter, IEtc, IEventPrintConfig, IExportRow, IFileUploadRequest, IFileUploadResponse, IFontSize, IGeneralConfig, IGtoConfig, IInventoryConfig, IInvoice, IInvoiceActivity, IInvoiceBaseService, IInvoiceCharge, IInvoiceCoreLine, IInvoiceDiscount, IInvoiceLine, IInvoiceOperationService, IInvoiceService, IItem, IItemService, IKdsConfig, IKioskSystemConfig, IKitchenConfig, ILabelConfig, ILineOperationService, ILoyaltyProgram, ILoyaltyProgramSummary, IMarketing, IMenu, IMenuService, IMerchant, IMerchantAsset, INode, INodePrinter, INonCashTillSummary, INote, INoteEntity, INoteGroup, INoteGroupEntity, INoteGroupService, INoteService, IOnlineOrderConfig, IOrderConfig, IOrderDisplay, IOrderDisplayService, IOrderDisplaySystemConfig, IOrderTypeSummary, IPaxConfig, IPayment, IPaymentConfig, IPaymentMethod, IPaymentMethodHistory, IPaymentMethodService, IPaymentService, IPaymentSummary, IPoint, IPrice, IPrintBarcode, IPrintCommand, IPrintCommandLine, IPrintImage, IPrintJob, IPrintJobService, IPrintQrcode, IPrintTable, IPrintTableRowItem, IPrintTemplate, IPrintTemplateCore, IPrintTemplateService, IPrintText, IPrinter, IPrinterService, IProductBase, IProductConfig, IProductService, IPushData, IReceiptConfig, IRenderPrintTemplateOptions, IReport, IReportCategory, IReportConfig, IReportData, IReportRequest, IRoundingConfig, ISalesSummary, ISalesperson, ISection, ISectionItem, ISectionItemService, ISectionService, IServiceOptions, IShift, IShiftService, IStandardPaymentMethod, IStockLog, IStockLogService, IStorage, ISubcategory, ISubcategoryService, ISystemConfig, ITaxConfig, ITemplateData, ITill, ITillConfig, ITillService, IUser, IUserConfig, IVisibility, In, Include, InventoryConfig, Invoice, InvoiceAction, InvoiceActivity, InvoiceBaseService, InvoiceCharge, InvoiceCoreLine, InvoiceDiscount, InvoiceLine, InvoiceOperationService, InvoiceService, InvoiceStatus, InvoiceType, Item, ItemSalesSummary, ItemService, KdsConfig, KioskSystemConfig, KitchenConfig, LabelConfig, LineOperationService, LineOptions, LoyaltyProgram, LoyaltyProgramSummary, MarketingConfig, Menu, MenuService, Merchant, MessageType, ModelPrefix, ModelType, ModifierSalesSummary, Node, NodePrinter, NonCashTillSummary, Not, Note, NoteEntity, NoteGroup, NoteGroupEntity, OnlineOrderConfig, OpenHours, OrderConfig, OrderDisplay, OrderDisplayService, OrderDisplayStatus, OrderDisplaySystemConfig, OrderFlow, PaxConfig, PayInvoiceOptions, Payment, PaymentConfig, PaymentMethod, PaymentMethodHistory, PaymentMethodService, PaymentService, PaymentStatus, PaymentSummary, PaynowMethod, Price, PrintAlign, PrintBarcode, PrintCommand, PrintImage, PrintJob, PrintJobService, PrintJobStatus, PrintQrcode, PrintSize, PrintStyle, PrintTemplate, PrintTemplateCore, PrintTemplateService, PrintType, Printer, PrinterConnections, PrinterProtocols, PrinterService, PrinterStatus, PrinterType, ProductBase, ProductConfig, ProductPartialAssets, ProductPartialConfig, ProductService, ProductType, PushData, Raw, Receipt, RenderPrintTemplateOptions, Report, ReportCategory, ReportConfig, ReportData, ReportType, RoundingConfig, SalesSummary, Schedule, Section, SectionItem, SectionItemService, SectionItemStatus, SectionService, ServiceFactory, ServiceMode, ServiceOptions, Shift, ShiftService, ShiftStatus, SpecialDay, StandardPaymentMethod, StockChange, StockLog, StockLogEntityType, StockLogRefType, StockLogService, StockLogType, Storage, StorageService, Subcategory, SwitchInvoiceOptions, System, SystemConfig, SystemError, TCategorySalesSummary, TDynamicOrderQR, TItemCoreSalesSummary, TItemSalesSummary, TModifierSalesSummary, TStockChange, TStockChangeItem, TStorageService, TableStats, TaxConfig, TaxMethod, TemplateData, Till, TillConfig, TillService, TillType, UomType, UpdateGeneralConfigOptions, UpdateInvoiceOptions, User, UserConfig, type ValidationError, type ValidationResult, Visibility, VoidInvoiceOptions, WechatPayMethod, WeeklyHours, createCSVExport, createCSVExportWithHash, dbSchemas, filterByParams, getCategoryButtonShape, humanizedData, importFromCSV, normalizedDate, transformer, validateSTTemplate };
|
|
6688
|
+
export { Address, AlipayMethod, AppBaseModel, AppConfig, AppCoreModel, AppCoreService, AppExtraModel, AppLocalService, AppMiscService, AppRemoteService, AppReport, AppReportService, Applying, Appointment, AppointmentService, AppointmentServiceLine, AppointmentSource, AppointmentStatus, AssetItem, AssetTags, AssetType, Between, Cache, CalcFlow, CalcType, CancelInvoiceOptions, CardPaymentCode, CashDrawerConfig, Category, CategoryButtonShape, CategorySalesSummary, CategoryService, CategoryType, Charge, ChargeConfig, CheckInvoiceOptions, Codepages, ComboGroup, ComboGroupItem, Condition, Config, ConfigService, CoreCategory, CoreItem, Coupon, CouponItemized, CouponUsage, CreateInvoiceOptions, CrmConfig, CurrencyConfig, CustomResponse, Customer, CustomerDisplaySystemConfig, DatabaseStats, DayOfWeek, DeployChannel, Device, DeviceEtc, DeviceType, DiagnosticsService, DirectPayInvoiceOptions, DiscountType, DrawerSummary, ElectronSocket, Employee, EmployeeRole, EmployeeRoleService, EmployeeService, ErrorMsgs, EscPosCompatibility, EscPosPrinter, EventPrintConfig, FileUploadRequest, GTOConfig, GeneralConfig, GetManyResult, Holiday, IAddress, IAppBase, IAppBaseModel, IAppConfig, IAppCore, IAppCoreModel, IAppCoreService, IAppExtra, IAppExtraModel, IAppLocalService, IAppMiscService, IAppModelSequence, IAppRemoteService, IAppReport, IAppReportService, IApplying, IAppointment, IAppointmentService, IAppointmentServiceLine, ICache, ICashDrawerConfig, ICategory, ICategoryService, IChangePaymentMethodOption, ICharge, IChargeConfig, IComboGroup, IComboGroupItem, IConfig, IConfigService, ICoreCategory, ICoreItem, ICoupon, ICouponItemized, ICouponUsage, ICredit, ICrmConfig, ICurrencyConfig, ICustomer, ICustomerDisplaySystemConfig, IDevice, IDiscount, IDiscountSummaryEntry, IDrawerSummary, IEmployee, IEmployeeRole, IEmployeeRoleService, IEmployeeService, IEscPosPrinter, IEtc, IEventPrintConfig, IExportRow, IFileUploadRequest, IFileUploadResponse, IFontSize, IGeneralConfig, IGtoConfig, IInventoryConfig, IInvoice, IInvoiceActivity, IInvoiceBaseService, IInvoiceCharge, IInvoiceCoreLine, IInvoiceDiscount, IInvoiceLine, IInvoiceOperationService, IInvoiceService, IItem, IItemService, IKdsConfig, IKioskSystemConfig, IKitchenConfig, ILabelConfig, ILineOperationService, ILoyaltyProgram, ILoyaltyProgramSummary, IMarketing, IMenu, IMenuService, IMerchant, IMerchantAsset, INode, INodePrinter, INonCashTillSummary, INote, INoteEntity, INoteGroup, INoteGroupEntity, INoteGroupService, INoteService, IOnlineOrderConfig, IOrderConfig, IOrderDisplay, IOrderDisplayService, IOrderDisplaySystemConfig, IOrderTypeSummary, IPaxConfig, IPayment, IPaymentConfig, IPaymentMethod, IPaymentMethodHistory, IPaymentMethodService, IPaymentService, IPaymentSummary, IPoint, IPrice, IPrintBarcode, IPrintCommand, IPrintCommandLine, IPrintImage, IPrintJob, IPrintJobService, IPrintQrcode, IPrintTable, IPrintTableRowItem, IPrintTemplate, IPrintTemplateCore, IPrintTemplateService, IPrintText, IPrinter, IPrinterService, IProductBase, IProductConfig, IProductService, IPushData, IReceiptConfig, IRenderPrintTemplateOptions, IReport, IReportCategory, IReportConfig, IReportData, IReportRequest, IRoundingConfig, ISalesSummary, ISalesperson, ISection, ISectionItem, ISectionItemService, ISectionService, IServiceOptions, IShift, IShiftService, IStandardPaymentMethod, IStockLog, IStockLogService, IStorage, ISubcategory, ISubcategoryService, ISystemConfig, ITaxConfig, ITemplateData, ITill, ITillConfig, ITillService, IUser, IUserConfig, IVisibility, In, Include, InventoryConfig, Invoice, InvoiceAction, InvoiceActivity, InvoiceBaseService, InvoiceCharge, InvoiceCoreLine, InvoiceDiscount, InvoiceLine, InvoiceOperationService, InvoiceService, InvoiceStatus, InvoiceType, Item, ItemSalesSummary, ItemService, KdsConfig, KioskSystemConfig, KitchenConfig, LabelConfig, LineOperationService, LineOptions, LoyaltyProgram, LoyaltyProgramSummary, MarketingConfig, Menu, MenuService, Merchant, MessageType, ModelPrefix, ModelType, ModifierSalesSummary, Node, NodePrinter, NonCashTillSummary, Not, Note, NoteEntity, NoteGroup, NoteGroupEntity, OnlineOrderConfig, OpenHours, OrderConfig, OrderDisplay, OrderDisplayService, OrderDisplayStatus, OrderDisplaySystemConfig, OrderFlow, PaxConfig, PayInvoiceOptions, Payment, PaymentConfig, PaymentMethod, PaymentMethodHistory, PaymentMethodService, PaymentService, PaymentStatus, PaymentSummary, PaynowMethod, Price, PrintAlign, PrintBarcode, PrintCommand, PrintImage, PrintJob, PrintJobService, PrintJobStatus, PrintQrcode, PrintSize, PrintStyle, PrintTemplate, PrintTemplateCore, PrintTemplateService, PrintType, Printer, PrinterConnections, PrinterProtocols, PrinterService, PrinterStatus, PrinterType, ProductBase, ProductConfig, ProductPartialAssets, ProductPartialConfig, ProductService, ProductType, PushData, Raw, Receipt, RenderPrintTemplateOptions, Report, ReportCategory, ReportConfig, ReportData, ReportType, RoundingConfig, SalesSummary, Schedule, Section, SectionItem, SectionItemService, SectionItemStatus, SectionService, ServiceFactory, ServiceMode, ServiceOptions, Shift, ShiftService, ShiftStatus, SpecialDay, StandardPaymentMethod, StockChange, StockLog, StockLogEntityType, StockLogRefType, StockLogService, StockLogType, Storage, StorageService, Subcategory, SwitchInvoiceOptions, System, SystemConfig, SystemError, TCategorySalesSummary, TDynamicOrderQR, TItemCoreSalesSummary, TItemSalesSummary, TModifierSalesSummary, TStockChange, TStockChangeItem, TStorageService, TableStats, TaxConfig, TaxMethod, TemplateData, Till, TillConfig, TillService, TillType, UomType, UpdateGeneralConfigOptions, UpdateInvoiceOptions, User, UserConfig, type ValidationError, type ValidationResult, Visibility, VoidInvoiceOptions, WechatPayMethod, WeeklyHours, createCSVExport, createCSVExportWithHash, dbSchemas, filterByParams, getCategoryButtonShape, humanizedData, importFromCSV, mergeImportedItem, normalizedDate, transformer, validateSTTemplate };
|
|
6687
6689
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.js
CHANGED
|
@@ -3,5 +3,5 @@ import e from"dayjs";import{nanoid as t}from"nanoid";import n from"wcwidth";impo
|
|
|
3
3
|
`)}async function Ai(e){return Ii(Pi(await e.text()))}function ji(e){let t=Fi(e).map(e=>e.trim());return t.includes(`Codename`)?`v9`:t.includes(`Original Price`)?`v8`:t.includes(`Barcode`)?`v7`:t.includes(`PLU`)||t.includes(`Code`)?`v5`:t.includes(`Prices`)?`v4`:t.includes(`Print On Receipt`)||t.includes(`Name Translations`)?`v3`:t.includes(`Item UID`)?`v2`:`v1`}function Mi(e,t,n){let r=e?.trim().toLowerCase();if(r){if(r===`true`)return!0;if(r===`false`)return!1;throw Error(`Invalid ${t} "${e}" at line ${n}. Must be: true or false`)}}function Ni(e,t){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))throw Error(`not an array`);return t.map(e=>{let t=new Te;return t.lookup_keys=e.lookup_keys||[],t.amount=e.amount||0,t.name=e.name||``,t.name_translations=e.name_translations||{},t.product_uid=e.product_uid||``,t})}catch{throw Error(`Invalid Prices JSON at line ${t}`)}}function Pi(e){let t=e.replace(/^\uFEFF/,``).replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
5
5
|
`).trim().split(`
|
|
6
|
-
`);if(t.length===0)throw Error(`CSV file is empty`);let n=t[0].trim(),r=ji(n),i=yi[r],a=i.headers.length,o=i.headers.join(`,`);if(n!==o)throw Error(`Invalid CSV header. Expected: ${o}\nReceived: ${n}`);let s=[];for(let e=1;e<t.length;e++){let n=t[e].trim();if(!n)continue;let i=Fi(n);if(i.length!==a)throw Error(`Invalid CSV row at line ${e+1}: expected ${a} columns`);let[o,c,l,u,d,f,p,m,h,g,_]=i,v=r===`v1`?``:i[11];if(!o||o!==`combo_item`&&!c.trim())throw Error(`Missing required fields at line ${e+1}`);if(!bi.includes(o))throw Error(`Invalid type "${o}" at line ${e+1}. Must be: ${bi.join(`, `)}`);let y;if(u&&u.trim()&&(y=parseFloat(u),isNaN(y)))throw Error(`Invalid price "${u}" at line ${e+1}`);let b;if(d&&d.trim()&&(b=parseFloat(d),isNaN(b)))throw Error(`Invalid stock "${d}" at line ${e+1}`);let x=Mi(f,`is_internal`,e+1),S;if(p&&p.trim()&&(S=parseInt(p,10),isNaN(S)))throw Error(`Invalid min_order "${p}" at line ${e+1}`);let C;if(m&&m.trim()&&(C=parseInt(m,10),isNaN(C)))throw Error(`Invalid max_order "${m}" at line ${e+1}`);let ee;if(_&&_.trim()&&(ee=parseInt(_,10),isNaN(ee)))throw Error(`Invalid sequence "${_}" at line ${e+1}`);let te,ne,re,ie,w=``,T,ae=``,E=``,oe=``,se,ce=``;if((r===`v3`||r===`v4`||r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&(te=Mi(i[12],`print_on_receipt`,e+1),ne=Mi(i[13],`discountable`,e+1),re=Mi(i[14],`open_editor_panel`,e+1),ie=Mi(i[15],`is_delisted`,e+1),w=i[16]?.trim()||``),(r===`v4`||r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&i[17]?.trim()&&(T=Ni(i[17],e+1)),(r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&(ae=i[18]?.trim()||``,E=i[19]?.trim()||``),(r===`v7`||r===`v8`||r===`v9`)&&(oe=i[20]?.trim()||``),(r===`v8`||r===`v9`)&&i[21]?.trim()&&(se=parseFloat(i[21]),isNaN(se)))throw Error(`Invalid original_price "${i[21]}" at line ${e+1}`);r===`v9`&&(ce=i[22]?.trim()||``),s.push({type:o,name:c.trim(),sku:l?.trim()||``,price:y,stock:b,is_internal:x,min_order:S,max_order:C,image_url:h?.trim()||``,image_thumbnail_url:g?.trim()||``,sequence:ee,item_uid:v?.trim()||``,print_on_receipt:te,discountable:ne,open_editor_panel:re,is_delisted:ie,name_translations:w,prices:T,plu:ae,code:E,barcode:oe,original_price:se,codename:ce})}return s}function Fi(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`"`?r&&e[i+1]===`"`?(n+=`"`,i++):r=!r:a===`,`&&!r?(t.push(n),n=``):n+=a}return t.push(n),t}function Ii(e){let n=[],r=[],i=[],a=null,o=null,s=null,c=null,l=null,u=0,d=new Map;for(let n of e)(n.type===`product`||n.type===`combo`)&&n.item_uid&&d.set(n.item_uid,E.Item+t());for(let t of e)if(t.type===`category`)a=new xe,a.name=t.name,a.is_internal=t.is_internal===void 0?!1:t.is_internal,a.sequence=t.sequence===void 0?u++:t.sequence,a.image_url=t.image_url||``,a.image_thumbnail_url=t.image_thumbnail_url||``,a.visibility=[],a.is_delisted=t.is_delisted===void 0?!1:t.is_delisted,t.name_translations&&(a.name_translations=Ei(t.name_translations)),t.code&&(a.code=t.code),n.push(a),s=null,c=null,l=null,o=null;else if(t.type===`subcategory`){if(!a)throw Error(`Subcategory "${t.name}" found without a category`);o=new Se,o.name=t.name,o.sequence=t.sequence||0,o.category_uid=a.uid,t.name_translations&&(o.name_translations=Ei(t.name_translations)),a.has_subcategory=!0,a.subcategories.push(o),s=null,c=null,l=null}else if(t.type===`product`||t.type===`combo`){if(!a)throw Error(`${t.type===`combo`?`Combo`:`Product`} "${t.name}" found without a category`);if(s=new we,s.uid=t.item_uid&&d.get(t.item_uid)||s.uid,s.name=t.name,s.sku=t.sku||``,s.price=t.price||0,s.stock=t.stock===void 0?1e3:t.stock,s.is_internal=t.is_internal===void 0?!1:t.is_internal,s.sequence=t.sequence||0,s.image_url=t.image_url||``,s.image_thumbnail_url=t.image_thumbnail_url||``,s.category_uid=a.uid,s.type=t.type===`combo`?N.Combo:N.ByQuantity,s.modifier_categories=[],s.modifiers=[],s.combo_groups=[],t.print_on_receipt!==void 0&&(s.print_on_receipt=t.print_on_receipt),t.discountable!==void 0&&(s.discountable=t.discountable),t.open_editor_panel!==void 0&&(s.open_editor_panel=t.open_editor_panel),t.is_delisted!==void 0&&(s.is_delisted=t.is_delisted),t.name_translations&&(s.name_translations=Ei(t.name_translations)),t.prices?.length){for(let e of t.prices)e.product_uid=s.uid;s.prices=t.prices}t.plu&&(s.plu=t.plu),t.barcode&&(s.barcode=t.barcode),t.codename&&(s.codename=t.codename),t.original_price!==void 0&&(s.original_price=t.original_price),o&&(s.subcategory_uid=o.uid),r.push(s),c=null,l=null}else if(t.type===`combo_group`){if(!s||s.type!==N.Combo)throw Error(`Combo group "${t.name}" found without a combo product`);l=new De,l.name=t.name,l.min_order=t.min_order===void 0?1:t.min_order,l.max_order=t.max_order===void 0?1:t.max_order,l.sequence=t.sequence===void 0?s.combo_groups.length:t.sequence,s.combo_groups.push(l)}else if(t.type===`combo_item`){if(!l)throw Error(`Combo item "${t.name}" found without a combo group`);let e=d.get(t.item_uid||``);if(t.item_uid&&!e)i.push({combo:s?.name||``,group:l.name,item:t.name,uid:t.item_uid});else{let n=new Ee;n.item_uid=e||t.item_uid||``,n.price=t.price||0,n.sequence=t.sequence||0,n.combo_item=new we,n.combo_item.name=t.name,l.combo_items.push(n)}}else if(t.type===`modifier_category`){if(!s)throw Error(`Modifier category "${t.name}" found without a product`);c=new be,c.name=t.name,c.min_order=t.min_order===void 0?0:t.min_order,c.max_order=t.max_order===void 0?0:t.max_order,c.sequence=t.sequence===void 0?s.modifier_categories.length:t.sequence,c.visibility=[],s.modifier_categories.push(c)}else if(t.type===`modifier`){if(!s)throw Error(`Modifier "${t.name}" found without a product`);let e=new Ce;if(e.name=t.name,e.sku=t.sku||``,e.price=t.price||0,e.stock=t.stock===void 0?0:t.stock,e.is_internal=t.is_internal===void 0?!1:t.is_internal,e.sequence=t.sequence||0,e.image_url=t.image_url||``,e.image_thumbnail_url=t.image_thumbnail_url||``,e.type=N.Modifier,e.category_uid=c?c.uid:s.category_uid,t.print_on_receipt!==void 0&&(e.print_on_receipt=t.print_on_receipt),t.original_price!==void 0&&(e.original_price=t.original_price),t.name_translations&&(e.name_translations=Ei(t.name_translations)),t.prices?.length){for(let n of t.prices)n.product_uid=e.uid;e.prices=t.prices}s.modifiers.push(e)}return{categories:n,products:r,discardedComboItems:i}}let Li=function(e){return e.None=``,e.Always=`always`,e}({}),Ri=function(e){return e.Image=`image`,e.Video=`video`,e.Unsupported=`unsupported`,e}({}),zi=function(e){return e.CdsFullScreenImage=`cds_full_screen_image`,e.CdsHalfScreenImage=`cds_half_screen_image`,e}({});var Bi=class{constructor(){v(this,`name`,void 0),v(this,`address`,void 0),v(this,`postcode`,void 0),v(this,`tel`,void 0),v(this,`tax_number`,void 0),v(this,`user_id`,void 0),v(this,`uid`,void 0),v(this,`api_key`,void 0),v(this,`ip_address`,void 0),v(this,`meta`,void 0)}},Vi=class extends T{constructor(...e){super(...e),v(this,`uid`,E.Storage+t()),v(this,`model`,void 0),v(this,`data`,void 0)}},Hi=class extends T{constructor(...e){super(...e),v(this,`uid`,E.Menu+t()),v(this,`icon`,``),v(this,`meta`,{}),v(this,`category_uids`,[]),v(this,`online_order_expiry_in_minutes`,0),v(this,`online_order_session_expiry_in_minutes`,0)}};let Ui=function(e){return e.In=`IN`,e.Out=`OUT`,e.Adjust=`ADJUST`,e.Production=`PRODUCTION`,e}({}),Wi=function(e){return e.Invoice=`invoice`,e.Purchase=`purchase`,e.Production=`production`,e.Stocktake=`stocktake`,e}({}),Gi=function(e){return e.Item=`item`,e.Material=`material`,e}({});var Ki=class extends w{constructor(){super(),v(this,`entity_type`,Gi.Item),v(this,`entity_uid`,``),v(this,`type`,Ui.Adjust),v(this,`qty`,0),v(this,`qty_before`,0),v(this,`qty_after`,0),v(this,`ref_type`,void 0),v(this,`ref_uid`,void 0),v(this,`reason`,void 0),v(this,`created_by`,void 0),v(this,`uid`,E.StockLog+t())}};let qi=function(e){return e.Pending=`pending`,e.Confirmed=`confirmed`,e.CheckedIn=`checked_in`,e.InService=`in_service`,e.Completed=`completed`,e.Cancelled=`cancelled`,e.NoShow=`no_show`,e}({}),Ji=function(e){return e.Pos=`pos`,e.Online=`online`,e.Phone=`phone`,e}({});var Yi=class{constructor(){v(this,`uid`,E.AppointmentServiceLine+t()),v(this,`name`,``),v(this,`duration_in_minutes`,0),v(this,`price`,0),v(this,`quantity`,1),v(this,`is_custom`,!1)}},Xi=class extends w{constructor(){super(),v(this,`uid`,E.Appointment+t()),v(this,`appointment_no`,``),v(this,`status`,qi.Confirmed),v(this,`source`,Ji.Pos),v(this,`customer_id`,0),v(this,`scheduled_at`,new Date),v(this,`duration_in_minutes`,60),v(this,`services`,[]),v(this,`meta`,{})}};const Zi=[`#each`,`#if`,`#elseif`,`#else`,`#let`,`#merge`,`#concat`,`#include`,`#?`,`#flatten`];function Qi(e){let t=[],n=(e,n,r,i)=>t.push({type:e,path:n,message:r,context:i}),r;try{r=JSON.parse(e)}catch(t){let n=t.message.match(/position (\d+)/)?.[1];return{valid:!1,errors:[{type:`JSON_PARSE`,path:null,message:t.message,context:n?e.slice(Math.max(0,n-20),+n+20):void 0}]}}let i=JSON.stringify(r),a=i.match(/"[^"]*"/g)||[],o=0,s=0;return a.forEach(e=>{o+=(e.match(/\{\{/g)||[]).length,s+=(e.match(/\}\}/g)||[]).length}),o!==s&&n(`BRACKET_MISMATCH`,null,`{{ : ${o}, }} : ${s}`),(i.match(/\{\{([^}]+)\}\}/g)||[]).forEach(e=>{let t=e.slice(2,-2).trim();if(t.startsWith(`#`)){let r=t.split(/\s/)[0];Zi.includes(r)||n(`UNKNOWN_DIRECTIVE`,null,r,e);return}try{Function(`with(this){return(${t})}`)}catch(t){n(`INVALID_EXPRESSION`,null,t.message,e)}}),(function e(t,r){if(!(!t||typeof t!=`object`)){if(Array.isArray(t)){let i=t[0]&&Object.keys(t[0])[0];i?.includes(`#if`)&&!i.includes(`#elseif`)&&$i(t,r,n),t.forEach((t,n)=>e(t,`${r}[${n}]`));return}for(let i in t){let a=t[i];i.includes(`#each`)&&typeof a!=`object`&&n(`INVALID_EACH`,r,`value must be object`,i),i.includes(`#let`)&&(!Array.isArray(a)||a.length!==2)&&n(`INVALID_LET`,r,`must be [definitions, template]`,i),(i.includes(`#merge`)||i.includes(`#concat`))&&!Array.isArray(a)&&n(`INVALID_STRUCTURE`,r,`value must be array`,i),e(a,r?`${r}.${i}`:i)}}})(r,``),{valid:!t.length,errors:t}}function $i(e,t,n){let r=e=>Object.keys(e)[0]||``;r(e[0]).match(/#if\s/)||n(`INVALID_CONDITIONAL`,t,`must start with #if`,r(e[0]));for(let i=1;i<e.length-1;i++)r(e[i]).includes(`#elseif`)||n(`INVALID_CONDITIONAL`,`${t}[${i}]`,`middle must be #elseif`,r(e[i]));e.length>1&&!r(e.at(-1)).includes(`#else`)&&n(`INVALID_CONDITIONAL`,`${t}[${e.length-1}]`,`last must be #else/#elseif`,r(e.at(-1)))}export{y as Address,At as AlipayMethod,T as AppBaseModel,xt as AppConfig,w as AppCoreModel,pn as AppCoreService,ae as AppExtraModel,mn as AppLocalService,Xr as AppMiscService,K as AppRemoteService,vn as AppReport,Zr as AppReportService,ee as Applying,Xi as Appointment,ri as AppointmentService,Yi as AppointmentServiceLine,Ji as AppointmentSource,qi as AppointmentStatus,zi as AssetTags,Ri as AssetType,ln as Between,St as Cache,G as CalcFlow,W as CalcType,Ot as CardPaymentCode,rn as CashDrawerConfig,xe as Category,Dn as CategorySalesSummary,Vr as CategoryService,ye as CategoryType,ht as Charge,Zt as ChargeConfig,P as Codepages,De as ComboGroup,Ee as ComboGroupItem,Li as Condition,Nt as Config,Hr as ConfigService,be as CoreCategory,Ce as CoreItem,te as Coupon,re as CouponItemized,ne as CouponUsage,Ct as CrmConfig,Qt as CurrencyConfig,x as Customer,Dt as CustomerDisplaySystemConfig,It as DeployChannel,He as Device,We as DeviceType,ai as DiagnosticsService,ft as DiscountType,xn as DrawerSummary,Oe as ElectronSocket,bt as Employee,me as EmployeeRole,Rr as EmployeeRoleService,zr as EmployeeService,O as ErrorMsgs,Be as EscPosCompatibility,Ne as EscPosPrinter,Tt as EventPrintConfig,an as FileUploadRequest,nn as GTOConfig,zt as GeneralConfig,cn as In,sn as Include,en as InventoryConfig,yt as Invoice,ut as InvoiceAction,mt as InvoiceActivity,Pr as InvoiceBaseService,pt as InvoiceCharge,_t as InvoiceCoreLine,gt as InvoiceDiscount,vt as InvoiceLine,Ir as InvoiceOperationService,Lr as InvoiceService,U as InvoiceStatus,H as InvoiceType,we as Item,Tn as ItemSalesSummary,Br as ItemService,Wt as KdsConfig,jt as KioskSystemConfig,Ut as KitchenConfig,Gt as LabelConfig,Fr as LineOperationService,Et as LoyaltyProgram,wn as LoyaltyProgramSummary,Mt as MarketingConfig,Hi as Menu,$r as MenuService,Bi as Merchant,le as MessageType,E as ModelPrefix,oe as ModelType,En as ModifierSalesSummary,Ue as Node,Ge as NodePrinter,Sn as NonCashTillSummary,un as Not,st as Note,ot as NoteEntity,at as NoteGroup,it as NoteGroupEntity,Ft as OnlineOrderConfig,Kt as OrderConfig,jr as OrderDisplay,Mr as OrderDisplayService,X as OrderDisplayStatus,qt as OrderDisplaySystemConfig,ct as OrderFlow,tn as PaxConfig,$e as Payment,Jt as PaymentConfig,et as PaymentMethod,tt as PaymentMethodHistory,Jr as PaymentMethodService,Yr as PaymentService,rt as PaymentStatus,Cn as PaymentSummary,Pt as PaynowMethod,Te as Price,Pe as PrintAlign,Le as PrintBarcode,I as PrintCommand,ze as PrintImage,B as PrintJob,Qr as PrintJobService,Ye as PrintJobStatus,Re as PrintQrcode,Ie as PrintSize,Fe as PrintStyle,z as PrintTemplate,Je as PrintTemplateCore,ei as PrintTemplateService,F as PrintType,Ze as Printer,qe as PrinterConnections,Ke as PrinterProtocols,On as PrinterService,Xe as PrinterStatus,R as PrinterType,ge as ProductBase,Rt as ProductConfig,Gr as ProductService,N as ProductType,ue as PushData,dn as Raw,Ht as Receipt,V as RenderPrintTemplateOptions,_n as Report,gn as ReportCategory,Vt as ReportConfig,yn as ReportData,hn as ReportType,$t as RoundingConfig,bn as SalesSummary,pe as Section,fe as SectionItem,Wr as SectionItemService,M as SectionItemStatus,Ur as SectionService,_i as ServiceFactory,se as ServiceMode,ce as ServiceOptions,de as Shift,Kr as ShiftService,k as ShiftStatus,nt as StandardPaymentMethod,he as StockChange,Ki as StockLog,Gi as StockLogEntityType,Wi as StockLogRefType,ni as StockLogService,Ui as StockLogType,Vi as Storage,ti as StorageService,Se as Subcategory,ve as System,wt as SystemConfig,D as SystemError,Xt as TaxConfig,lt as TaxMethod,Qe as TemplateData,j as Till,Bt as TillConfig,qr as TillService,A as TillType,dt as UomType,b as User,Yt as UserConfig,_e as Visibility,kt as WechatPayMethod,xi as createCSVExport,Si as createCSVExportWithHash,gi as dbSchemas,fn as filterByParams,Lt as getCategoryButtonShape,L as humanizedData,Ai as importFromCSV,Ve as normalizedDate,ie as transformer,Qi as validateSTTemplate};
|
|
6
|
+
`);if(t.length===0)throw Error(`CSV file is empty`);let n=t[0].trim(),r=ji(n),i=yi[r],a=i.headers.length,o=i.headers.join(`,`);if(n!==o)throw Error(`Invalid CSV header. Expected: ${o}\nReceived: ${n}`);let s=[];for(let e=1;e<t.length;e++){let n=t[e].trim();if(!n)continue;let i=Fi(n);if(i.length!==a)throw Error(`Invalid CSV row at line ${e+1}: expected ${a} columns`);let[o,c,l,u,d,f,p,m,h,g,_]=i,v=r===`v1`?``:i[11];if(!o||o!==`combo_item`&&!c.trim())throw Error(`Missing required fields at line ${e+1}`);if(!bi.includes(o))throw Error(`Invalid type "${o}" at line ${e+1}. Must be: ${bi.join(`, `)}`);let y;if(u&&u.trim()&&(y=parseFloat(u),isNaN(y)))throw Error(`Invalid price "${u}" at line ${e+1}`);let b;if(d&&d.trim()&&(b=parseFloat(d),isNaN(b)))throw Error(`Invalid stock "${d}" at line ${e+1}`);let x=Mi(f,`is_internal`,e+1),S;if(p&&p.trim()&&(S=parseInt(p,10),isNaN(S)))throw Error(`Invalid min_order "${p}" at line ${e+1}`);let C;if(m&&m.trim()&&(C=parseInt(m,10),isNaN(C)))throw Error(`Invalid max_order "${m}" at line ${e+1}`);let ee;if(_&&_.trim()&&(ee=parseInt(_,10),isNaN(ee)))throw Error(`Invalid sequence "${_}" at line ${e+1}`);let te,ne,re,ie,w=``,T,ae=``,E=``,oe=``,se,ce=``;if((r===`v3`||r===`v4`||r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&(te=Mi(i[12],`print_on_receipt`,e+1),ne=Mi(i[13],`discountable`,e+1),re=Mi(i[14],`open_editor_panel`,e+1),ie=Mi(i[15],`is_delisted`,e+1),w=i[16]?.trim()||``),(r===`v4`||r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&i[17]?.trim()&&(T=Ni(i[17],e+1)),(r===`v5`||r===`v7`||r===`v8`||r===`v9`)&&(ae=i[18]?.trim()||``,E=i[19]?.trim()||``),(r===`v7`||r===`v8`||r===`v9`)&&(oe=i[20]?.trim()||``),(r===`v8`||r===`v9`)&&i[21]?.trim()&&(se=parseFloat(i[21]),isNaN(se)))throw Error(`Invalid original_price "${i[21]}" at line ${e+1}`);r===`v9`&&(ce=i[22]?.trim()||``),s.push({type:o,name:c.trim(),sku:l?.trim()||``,price:y,stock:b,is_internal:x,min_order:S,max_order:C,image_url:h?.trim()||``,image_thumbnail_url:g?.trim()||``,sequence:ee,item_uid:v?.trim()||``,print_on_receipt:te,discountable:ne,open_editor_panel:re,is_delisted:ie,name_translations:w,prices:T,plu:ae,code:E,barcode:oe,original_price:se,codename:ce})}return s}function Fi(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`"`?r&&e[i+1]===`"`?(n+=`"`,i++):r=!r:a===`,`&&!r?(t.push(n),n=``):n+=a}return t.push(n),t}function Ii(e){let n=[],r=[],i=[],a=null,o=null,s=null,c=null,l=null,u=0,d=new Map;for(let n of e)(n.type===`product`||n.type===`combo`)&&n.item_uid&&d.set(n.item_uid,E.Item+t());for(let t of e)if(t.type===`category`)a=new xe,a.name=t.name,a.is_internal=t.is_internal===void 0?!1:t.is_internal,a.sequence=t.sequence===void 0?u++:t.sequence,a.image_url=t.image_url||``,a.image_thumbnail_url=t.image_thumbnail_url||``,a.visibility=[],a.is_delisted=t.is_delisted===void 0?!1:t.is_delisted,t.name_translations&&(a.name_translations=Ei(t.name_translations)),t.code&&(a.code=t.code),n.push(a),s=null,c=null,l=null,o=null;else if(t.type===`subcategory`){if(!a)throw Error(`Subcategory "${t.name}" found without a category`);o=new Se,o.name=t.name,o.sequence=t.sequence||0,o.category_uid=a.uid,t.name_translations&&(o.name_translations=Ei(t.name_translations)),a.has_subcategory=!0,a.subcategories.push(o),s=null,c=null,l=null}else if(t.type===`product`||t.type===`combo`){if(!a)throw Error(`${t.type===`combo`?`Combo`:`Product`} "${t.name}" found without a category`);if(s=new we,s.uid=t.item_uid&&d.get(t.item_uid)||s.uid,s.name=t.name,s.sku=t.sku||``,s.price=t.price||0,s.stock=t.stock===void 0?1e3:t.stock,s.is_internal=t.is_internal===void 0?!1:t.is_internal,s.sequence=t.sequence||0,s.image_url=t.image_url||``,s.image_thumbnail_url=t.image_thumbnail_url||``,s.category_uid=a.uid,s.type=t.type===`combo`?N.Combo:N.ByQuantity,s.modifier_categories=[],s.modifiers=[],s.combo_groups=[],t.print_on_receipt!==void 0&&(s.print_on_receipt=t.print_on_receipt),t.discountable!==void 0&&(s.discountable=t.discountable),t.open_editor_panel!==void 0&&(s.open_editor_panel=t.open_editor_panel),t.is_delisted!==void 0&&(s.is_delisted=t.is_delisted),t.name_translations&&(s.name_translations=Ei(t.name_translations)),t.prices?.length){for(let e of t.prices)e.product_uid=s.uid;s.prices=t.prices}t.plu&&(s.plu=t.plu),t.barcode&&(s.barcode=t.barcode),t.codename&&(s.codename=t.codename),t.original_price!==void 0&&(s.original_price=t.original_price),o&&(s.subcategory_uid=o.uid),r.push(s),c=null,l=null}else if(t.type===`combo_group`){if(!s||s.type!==N.Combo)throw Error(`Combo group "${t.name}" found without a combo product`);l=new De,l.name=t.name,l.min_order=t.min_order===void 0?1:t.min_order,l.max_order=t.max_order===void 0?1:t.max_order,l.sequence=t.sequence===void 0?s.combo_groups.length:t.sequence,s.combo_groups.push(l)}else if(t.type===`combo_item`){if(!l)throw Error(`Combo item "${t.name}" found without a combo group`);let e=d.get(t.item_uid||``);if(t.item_uid&&!e)i.push({combo:s?.name||``,group:l.name,item:t.name,uid:t.item_uid});else{let n=new Ee;n.item_uid=e||t.item_uid||``,n.price=t.price||0,n.sequence=t.sequence||0,n.combo_item=new we,n.combo_item.name=t.name,l.combo_items.push(n)}}else if(t.type===`modifier_category`){if(!s)throw Error(`Modifier category "${t.name}" found without a product`);c=new be,c.name=t.name,c.min_order=t.min_order===void 0?0:t.min_order,c.max_order=t.max_order===void 0?0:t.max_order,c.sequence=t.sequence===void 0?s.modifier_categories.length:t.sequence,c.visibility=[],s.modifier_categories.push(c)}else if(t.type===`modifier`){if(!s)throw Error(`Modifier "${t.name}" found without a product`);let e=new Ce;if(e.name=t.name,e.sku=t.sku||``,e.price=t.price||0,e.stock=t.stock===void 0?0:t.stock,e.is_internal=t.is_internal===void 0?!1:t.is_internal,e.sequence=t.sequence||0,e.image_url=t.image_url||``,e.image_thumbnail_url=t.image_thumbnail_url||``,e.type=N.Modifier,e.category_uid=c?c.uid:s.category_uid,t.print_on_receipt!==void 0&&(e.print_on_receipt=t.print_on_receipt),t.original_price!==void 0&&(e.original_price=t.original_price),t.name_translations&&(e.name_translations=Ei(t.name_translations)),t.prices?.length){for(let n of t.prices)n.product_uid=e.uid;e.prices=t.prices}s.modifiers.push(e)}return{categories:n,products:r,discardedComboItems:i}}const Li=[`uid`,`name`,`sku`,`price`,`original_price`,`stock`,`is_internal`,`sequence`,`image_url`,`image_thumbnail_url`,`category_uid`,`subcategory_uid`,`type`,`plu`,`barcode`,`codename`,`print_on_receipt`,`discountable`,`open_editor_panel`,`is_delisted`,`name_translations`,`prices`,`modifiers`,`modifier_categories`,`combo_groups`],Ri=e=>e==null||e===``||Array.isArray(e)&&!e.length||e?.constructor===Object&&!Object.keys(e).length;function zi(e,t){let n={...e};for(let e of Li)Ri(t[e])||(n[e]=t[e]);return n}let Bi=function(e){return e.None=``,e.Always=`always`,e}({}),Vi=function(e){return e.Image=`image`,e.Video=`video`,e.Unsupported=`unsupported`,e}({}),Hi=function(e){return e.CdsFullScreenImage=`cds_full_screen_image`,e.CdsHalfScreenImage=`cds_half_screen_image`,e}({});var Ui=class{constructor(){v(this,`name`,void 0),v(this,`address`,void 0),v(this,`postcode`,void 0),v(this,`tel`,void 0),v(this,`tax_number`,void 0),v(this,`user_id`,void 0),v(this,`uid`,void 0),v(this,`api_key`,void 0),v(this,`ip_address`,void 0),v(this,`meta`,void 0)}},Wi=class extends T{constructor(...e){super(...e),v(this,`uid`,E.Storage+t()),v(this,`model`,void 0),v(this,`data`,void 0)}},Gi=class extends T{constructor(...e){super(...e),v(this,`uid`,E.Menu+t()),v(this,`icon`,``),v(this,`meta`,{}),v(this,`category_uids`,[]),v(this,`online_order_expiry_in_minutes`,0),v(this,`online_order_session_expiry_in_minutes`,0)}};let Ki=function(e){return e.In=`IN`,e.Out=`OUT`,e.Adjust=`ADJUST`,e.Production=`PRODUCTION`,e}({}),qi=function(e){return e.Invoice=`invoice`,e.Purchase=`purchase`,e.Production=`production`,e.Stocktake=`stocktake`,e}({}),Ji=function(e){return e.Item=`item`,e.Material=`material`,e}({});var Yi=class extends w{constructor(){super(),v(this,`entity_type`,Ji.Item),v(this,`entity_uid`,``),v(this,`type`,Ki.Adjust),v(this,`qty`,0),v(this,`qty_before`,0),v(this,`qty_after`,0),v(this,`ref_type`,void 0),v(this,`ref_uid`,void 0),v(this,`reason`,void 0),v(this,`created_by`,void 0),v(this,`uid`,E.StockLog+t())}};let Xi=function(e){return e.Pending=`pending`,e.Confirmed=`confirmed`,e.CheckedIn=`checked_in`,e.InService=`in_service`,e.Completed=`completed`,e.Cancelled=`cancelled`,e.NoShow=`no_show`,e}({}),Zi=function(e){return e.Pos=`pos`,e.Online=`online`,e.Phone=`phone`,e}({});var Qi=class{constructor(){v(this,`uid`,E.AppointmentServiceLine+t()),v(this,`name`,``),v(this,`duration_in_minutes`,0),v(this,`price`,0),v(this,`quantity`,1),v(this,`is_custom`,!1)}},$i=class extends w{constructor(){super(),v(this,`uid`,E.Appointment+t()),v(this,`appointment_no`,``),v(this,`status`,Xi.Confirmed),v(this,`source`,Zi.Pos),v(this,`customer_id`,0),v(this,`scheduled_at`,new Date),v(this,`duration_in_minutes`,60),v(this,`services`,[]),v(this,`meta`,{})}};const ea=[`#each`,`#if`,`#elseif`,`#else`,`#let`,`#merge`,`#concat`,`#include`,`#?`,`#flatten`];function ta(e){let t=[],n=(e,n,r,i)=>t.push({type:e,path:n,message:r,context:i}),r;try{r=JSON.parse(e)}catch(t){let n=t.message.match(/position (\d+)/)?.[1];return{valid:!1,errors:[{type:`JSON_PARSE`,path:null,message:t.message,context:n?e.slice(Math.max(0,n-20),+n+20):void 0}]}}let i=JSON.stringify(r),a=i.match(/"[^"]*"/g)||[],o=0,s=0;return a.forEach(e=>{o+=(e.match(/\{\{/g)||[]).length,s+=(e.match(/\}\}/g)||[]).length}),o!==s&&n(`BRACKET_MISMATCH`,null,`{{ : ${o}, }} : ${s}`),(i.match(/\{\{([^}]+)\}\}/g)||[]).forEach(e=>{let t=e.slice(2,-2).trim();if(t.startsWith(`#`)){let r=t.split(/\s/)[0];ea.includes(r)||n(`UNKNOWN_DIRECTIVE`,null,r,e);return}try{Function(`with(this){return(${t})}`)}catch(t){n(`INVALID_EXPRESSION`,null,t.message,e)}}),(function e(t,r){if(!(!t||typeof t!=`object`)){if(Array.isArray(t)){let i=t[0]&&Object.keys(t[0])[0];i?.includes(`#if`)&&!i.includes(`#elseif`)&&na(t,r,n),t.forEach((t,n)=>e(t,`${r}[${n}]`));return}for(let i in t){let a=t[i];i.includes(`#each`)&&typeof a!=`object`&&n(`INVALID_EACH`,r,`value must be object`,i),i.includes(`#let`)&&(!Array.isArray(a)||a.length!==2)&&n(`INVALID_LET`,r,`must be [definitions, template]`,i),(i.includes(`#merge`)||i.includes(`#concat`))&&!Array.isArray(a)&&n(`INVALID_STRUCTURE`,r,`value must be array`,i),e(a,r?`${r}.${i}`:i)}}})(r,``),{valid:!t.length,errors:t}}function na(e,t,n){let r=e=>Object.keys(e)[0]||``;r(e[0]).match(/#if\s/)||n(`INVALID_CONDITIONAL`,t,`must start with #if`,r(e[0]));for(let i=1;i<e.length-1;i++)r(e[i]).includes(`#elseif`)||n(`INVALID_CONDITIONAL`,`${t}[${i}]`,`middle must be #elseif`,r(e[i]));e.length>1&&!r(e.at(-1)).includes(`#else`)&&n(`INVALID_CONDITIONAL`,`${t}[${e.length-1}]`,`last must be #else/#elseif`,r(e.at(-1)))}export{y as Address,At as AlipayMethod,T as AppBaseModel,xt as AppConfig,w as AppCoreModel,pn as AppCoreService,ae as AppExtraModel,mn as AppLocalService,Xr as AppMiscService,K as AppRemoteService,vn as AppReport,Zr as AppReportService,ee as Applying,$i as Appointment,ri as AppointmentService,Qi as AppointmentServiceLine,Zi as AppointmentSource,Xi as AppointmentStatus,Hi as AssetTags,Vi as AssetType,ln as Between,St as Cache,G as CalcFlow,W as CalcType,Ot as CardPaymentCode,rn as CashDrawerConfig,xe as Category,Dn as CategorySalesSummary,Vr as CategoryService,ye as CategoryType,ht as Charge,Zt as ChargeConfig,P as Codepages,De as ComboGroup,Ee as ComboGroupItem,Bi as Condition,Nt as Config,Hr as ConfigService,be as CoreCategory,Ce as CoreItem,te as Coupon,re as CouponItemized,ne as CouponUsage,Ct as CrmConfig,Qt as CurrencyConfig,x as Customer,Dt as CustomerDisplaySystemConfig,It as DeployChannel,He as Device,We as DeviceType,ai as DiagnosticsService,ft as DiscountType,xn as DrawerSummary,Oe as ElectronSocket,bt as Employee,me as EmployeeRole,Rr as EmployeeRoleService,zr as EmployeeService,O as ErrorMsgs,Be as EscPosCompatibility,Ne as EscPosPrinter,Tt as EventPrintConfig,an as FileUploadRequest,nn as GTOConfig,zt as GeneralConfig,cn as In,sn as Include,en as InventoryConfig,yt as Invoice,ut as InvoiceAction,mt as InvoiceActivity,Pr as InvoiceBaseService,pt as InvoiceCharge,_t as InvoiceCoreLine,gt as InvoiceDiscount,vt as InvoiceLine,Ir as InvoiceOperationService,Lr as InvoiceService,U as InvoiceStatus,H as InvoiceType,we as Item,Tn as ItemSalesSummary,Br as ItemService,Wt as KdsConfig,jt as KioskSystemConfig,Ut as KitchenConfig,Gt as LabelConfig,Fr as LineOperationService,Et as LoyaltyProgram,wn as LoyaltyProgramSummary,Mt as MarketingConfig,Gi as Menu,$r as MenuService,Ui as Merchant,le as MessageType,E as ModelPrefix,oe as ModelType,En as ModifierSalesSummary,Ue as Node,Ge as NodePrinter,Sn as NonCashTillSummary,un as Not,st as Note,ot as NoteEntity,at as NoteGroup,it as NoteGroupEntity,Ft as OnlineOrderConfig,Kt as OrderConfig,jr as OrderDisplay,Mr as OrderDisplayService,X as OrderDisplayStatus,qt as OrderDisplaySystemConfig,ct as OrderFlow,tn as PaxConfig,$e as Payment,Jt as PaymentConfig,et as PaymentMethod,tt as PaymentMethodHistory,Jr as PaymentMethodService,Yr as PaymentService,rt as PaymentStatus,Cn as PaymentSummary,Pt as PaynowMethod,Te as Price,Pe as PrintAlign,Le as PrintBarcode,I as PrintCommand,ze as PrintImage,B as PrintJob,Qr as PrintJobService,Ye as PrintJobStatus,Re as PrintQrcode,Ie as PrintSize,Fe as PrintStyle,z as PrintTemplate,Je as PrintTemplateCore,ei as PrintTemplateService,F as PrintType,Ze as Printer,qe as PrinterConnections,Ke as PrinterProtocols,On as PrinterService,Xe as PrinterStatus,R as PrinterType,ge as ProductBase,Rt as ProductConfig,Gr as ProductService,N as ProductType,ue as PushData,dn as Raw,Ht as Receipt,V as RenderPrintTemplateOptions,_n as Report,gn as ReportCategory,Vt as ReportConfig,yn as ReportData,hn as ReportType,$t as RoundingConfig,bn as SalesSummary,pe as Section,fe as SectionItem,Wr as SectionItemService,M as SectionItemStatus,Ur as SectionService,_i as ServiceFactory,se as ServiceMode,ce as ServiceOptions,de as Shift,Kr as ShiftService,k as ShiftStatus,nt as StandardPaymentMethod,he as StockChange,Yi as StockLog,Ji as StockLogEntityType,qi as StockLogRefType,ni as StockLogService,Ki as StockLogType,Wi as Storage,ti as StorageService,Se as Subcategory,ve as System,wt as SystemConfig,D as SystemError,Xt as TaxConfig,lt as TaxMethod,Qe as TemplateData,j as Till,Bt as TillConfig,qr as TillService,A as TillType,dt as UomType,b as User,Yt as UserConfig,_e as Visibility,kt as WechatPayMethod,xi as createCSVExport,Si as createCSVExportWithHash,gi as dbSchemas,fn as filterByParams,Lt as getCategoryButtonShape,L as humanizedData,Ai as importFromCSV,zi as mergeImportedItem,Ve as normalizedDate,ie as transformer,ta as validateSTTemplate};
|
|
7
7
|
//# sourceMappingURL=index.js.map
|