arky-sdk 0.4.32 → 0.4.34

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";;;AA4CO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACN,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,YAAA,CAAA,GAAa,aAAA;AACb,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AAHI,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA","file":"types.cjs","sourcesContent":["export * from './api';\n\nexport interface PaymentRefund {\n\tid: string;\n\tentity: string;\n\ttotal: number;\n\tproviderRefundId?: string;\n\tstatus: string;\n\tcreatedAt: number;\n}\n\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tpaid: number;\n\ttax?: {\n\t\tamount: number;\n\t\tmodeSnapshot?: string;\n\t\trateBps: number;\n\t\tlines: Array<{ rateBps: number; amount: number; label?: string; scope?: string }>;\n\t};\n\tpromoCode?: {\n\t\tid: string;\n\t\tcode: string;\n\t\ttype: string;\n\t\tvalue: number;\n\t};\n\ttype: PaymentMethodType;\n\tprovider?: {\n\t\tcustomerId: string;\n\t\tpaymentIntentId?: string;\n\t\tsubscriptionId?: string;\n\t\tpriceId?: string;\n\t};\n\trefunds: PaymentRefund[];\n\tzoneId?: string;\n\tpaymentMethodId?: string;\n\tshippingMethodId?: string;\n}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\nexport interface PromoCodeValidation {\n\tpromoCodeId: string;\n\tcode: string;\n\tdiscounts: any[];\n\tconditions: any[];\n}\n\nexport interface Quote {\n\tmarket: string;\n\tzone: Zone;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tshippingMethod: ShippingMethod | null;\n\tpaymentMethod: PaymentMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n\tid?: string;\n\texpiresAt?: number;\n}\n\nexport type PriceType = 'recurring' | 'one_time';\n\nexport interface Price {\n\tcurrency: string;\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n\ttype: PriceType;\n}\n\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EshopCartItem {\n\tid: string;\n\tproductId: string;\n\tvariantId: string;\n\tproductName: string;\n\tproductSlug: string;\n\tvariantAttributes: Record<string, any>;\n\tprice: Price;\n\tquantity: number;\n\taddedAt: number;\n}\n\nexport interface ReservationCartItem {\n\tid: string;\n\tserviceId: string;\n\tserviceName: string;\n\tdate: string;\n\tfrom: number;\n\tto: number;\n\ttimeText: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface AnalyticsConfig {\n\ttype: \"GA4\";\n\tmeasurementId: string;\n}\n\nexport interface ShippingWeightTier {\n\tupToGrams: number;\n\tamount: number;\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttaxable: boolean;\n\tetaText: string;\n\tpickupLocation?: Location;\n\tamount: number;\n\tfreeAbove?: number;\n\tweightTiers?: ShippingWeightTier[];\n}\n\nexport type ZoneScope = \"ALL\" | \"ORDER\" | \"RESERVATION\";\n\nexport interface Zone {\n\tid: string;\n\tname: string;\n\tmarketId: string;\n\tscope: ZoneScope;\n\tcountries: string[];\n\tstates: string[];\n\tpostalCodes: string[];\n\ttaxBps: number;\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n}\n\nexport interface Language {\n\tid: string;\n}\n\nexport interface BusinessEmails {\n\tbilling: string;\n\tsupport: string;\n}\n\nexport interface BusinessConfig {\n\tlanguages: Language[];\n\tmarkets: Market[];\n\tzones: Zone[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\tanalytics?: AnalyticsConfig;\n\temails: BusinessEmails;\n}\n\nexport interface Subscription {\n\tid: string;\n\ttarget: string;\n\tplanId: string;\n\tpendingPlanId: string | null;\n\tpayment: any;\n\tstatus: SubscriptionStatus;\n\tendDate: number;\n\tusage: Record<string, any>;\n\ttoken: string;\n}\n\nexport interface Business {\n\tid: string;\n\tkey: string;\n\tnetworkKey: string | null;\n\ttimezone: string;\n\tconfigs?: BusinessConfig;\n\tsubscriptions?: Subscription[];\n\tstatus: Status;\n}\n\nexport interface EshopStoreState {\n\tbusinessId: string;\n\tselectedShippingMethodId: string | null;\n\tuserToken: string | null;\n\tprocessingCheckout: boolean;\n\tloading: boolean;\n\terror: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\nexport type BlockType =\n\t| \"TEXT\"\n\t| \"LOCALIZED_TEXT\"\n\t| \"NUMBER\"\n\t| \"BOOLEAN\"\n\t| \"BLOCK\"\n\t| \"RELATIONSHIP_ENTRY\"\n\t| \"RELATIONSHIP_MEDIA\"\n\t| \"MARKDOWN\"\n\t| \"EMAIL\"\n\t| \"PHONE\"\n\t| \"ADDRESS\";\n\nexport type AddressType = \"SHIPPING\" | \"BILLING\";\n\nexport interface EmailBlockProperties {}\n\nexport interface PhoneBlockProperties {}\n\nexport interface AddressBlockProperties {\n\taddressType: AddressType;\n}\n\nexport interface GeoLocationValue {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EmailBlock extends Block {\n\ttype: \"EMAIL\";\n\tproperties: EmailBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface PhoneBlock extends Block {\n\ttype: \"PHONE\";\n\tproperties: PhoneBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface AddressBlock extends Block {\n\ttype: \"ADDRESS\";\n\tproperties: AddressBlockProperties;\n\tvalue: GeoLocationValue | null;\n}\n\nexport type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';\n\nexport interface MediaResolution {\n\tid: string;\n\tsize: string;\n\turl: string;\n}\n\nexport interface Media {\n\tid: string;\n\tresolutions: { [key: string]: MediaResolution };\n\tmimeType: string;\n\ttitle?: string | null;\n\tdescription?: string | null;\n\talt?: string | null;\n\tentity: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tslug: Record<string, string>;\n}\n\nexport interface ApiResponse<T> {\n\tsuccess: boolean;\n\tdata?: T;\n\terror?: string;\n\tcursor?: string;\n\ttotal?: number;\n}\n\nexport interface PaginatedResponse<T> {\n\tdata: T[];\n\tmeta?: {\n\t\ttotal: number;\n\t\tpage: number;\n\t\tper_page: number;\n\t};\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tguestToken: string | null;\n\tservice: any | null;\n\tbusiness: Business | null;\n\tcurrency: string;\n\treservationBlocks: Block[];\n\tapiUrl: string;\n\tbusinessId: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n\nexport type Status = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';\n\nexport type OrderStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'SHIPPED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type ReservationStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type SubscriptionStatus = 'PENDING' | 'ACTIVE' | 'CANCELLATION_SCHEDULED' | 'CANCELLED' | 'EXPIRED';\n\nexport interface ReservationItem {\n\tid: string;\n\tserviceId: string;\n\tproviderId: string;\n\tbusinessId: string;\n\treservationId: string;\n\tuserId: string;\n\tfrom: number;\n\tto: number;\n\tblocks: Block[];\n\tprice: Price;\n}\n\nexport interface Reservation {\n\tid: string;\n\tnumber: string;\n\tuserId: string;\n\tblocks: Block[];\n\tbusinessId: string;\n\tstatus: ReservationStatus;\n\tserviceIds: string[];\n\tproviderIds: string[];\n\tpayment: Payment;\n\tbusiness?: Business;\n\tuser?: any;\n\titems: ReservationItem[];\n\tcreatedAt: number;\n\tlastModified: number;\n}\n\nexport interface Node {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tparentId?: string | null;\n\tblocks: Block[];\n\tstatus: Status;\n\tslug: Record<string, string>;\n\taccess: Access;\n\twriteAccess: Access;\n\temailSubject?: Record<string, string>;\n\tchildren: Node[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface ServiceDuration {\n\tduration: number;\n\tisPause?: boolean;\n}\n\nexport interface ServiceProvider {\n\tid: string;\n\tproviderId: string;\n\tworkingTime: {\n\t\tworkingDays: Array<{ day: string; workingHours: Array<{ from: number; to: number }> }>;\n\t\toutcastDates: Array<{ month: number; day: number; workingHours: Array<{ from: number; to: number }> }>;\n\t\tspecificDates: Array<{ date: number; workingHours: Array<{ from: number; to: number }> }>;\n\t};\n\tprovider?: Provider;\n}\n\nexport interface Service {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tprices: Price[];\n\tdurations: ServiceDuration[];\n\tblocks: Block[];\n\tnodeIds: string[];\n\tisApprovalRequired: boolean;\n\tproviders: ServiceProvider[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tstatus: Status;\n}\n\nexport interface ProviderTimelinePoint {\n\ttimestamp: number;\n\tconcurrent: number;\n}\n\nexport interface Provider {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tstatus: Status;\n\tconcurrentLimit: number;\n\tnodeIds: string[];\n\tblocks: Block[];\n\ttimeline: ProviderTimelinePoint[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Workflow {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tsecret: string;\n\tstatus: Status;\n\tnodes: Record<string, WorkflowNode>;\n\tedges: WorkflowEdge[];\n\t\n\tschedule?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface WorkflowEdge {\n\tid: string;\n\tsource: string;\n\tsourceOutput: string;\n\ttarget: string;\n}\n\nexport type WorkflowNode =\n\t| WorkflowTriggerNode\n\t| WorkflowHttpNode\n\t| WorkflowIfNode\n\t| WorkflowLoopNode\n\t| WorkflowWaitNode;\n\nexport interface WorkflowTriggerNode {\n\ttype: 'trigger';\n\tevent?: string;\n}\n\nexport interface WorkflowHttpNode {\n\ttype: 'http';\n\tmethod: WorkflowHttpMethod;\n\turl: string;\n\theaders?: Record<string, string>;\n\tbody?: any;\n\ttimeoutMs?: number;\n}\n\nexport interface WorkflowIfNode {\n\ttype: 'if';\n\tcondition: string;\n}\n\nexport interface WorkflowLoopNode {\n\ttype: 'loop';\n\tarray: string;\n}\n\nexport interface WorkflowWaitNode {\n\ttype: 'wait';\n\tduration: string;\n}\n\nexport type WorkflowHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type ExecutionStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'WAITING';\n\nexport interface WorkflowExecution {\n\tid: string;\n\tworkflowId: string;\n\tbusinessId: string;\n\tstatus: ExecutionStatus;\n\tinput: Record<string, any>;\n\tnodeOutputs: Record<string, any>;\n\tcurrentNode?: string;\n\terror?: string;\n\tscheduledAt: number;\n\tstartedAt: number;\n\tcompletedAt?: number;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Audience {\n\tid: string;\n\tbusinessId: string;\n\tkey: string;\n\taccess: Access;\n\tnodeIds: string[];\n\tprices: Price[];\n\tstatus: Status;\n}\n\nexport interface AudienceAccessResponse {\n\thasAccess: boolean;\n\tsubscription?: Subscription;\n}\n\nexport interface AudienceSubscribeResponse {\n\tcheckoutUrl?: string;\n\tsubscription?: Subscription;\n}\n\nexport type BusinessEventAction =\n\t\n\t| { action: 'order_created' }\n\t| { action: 'order_status_changed'; data: { from: string; to: string } }\n\t| { action: 'order_payment_received'; data: { amount: number } }\n\t| { action: 'order_payment_failed'; data: { reason?: string } }\n\t| { action: 'order_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'order_shipped'; data: { tracking_url?: string } }\n\t| { action: 'order_completed' }\n\t| { action: 'order_cancelled'; data: { reason?: string } }\n\t\n\t| { action: 'reservation_created' }\n\t| { action: 'reservation_status_changed'; data: { from: string; to: string } }\n\t| { action: 'reservation_payment_received'; data: { amount: number } }\n\t| { action: 'reservation_payment_failed'; data: { reason?: string } }\n\t| { action: 'reservation_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'reservation_completed' }\n\t| { action: 'reservation_cancelled'; data: { reason?: string } };\n\nexport interface BusinessEvent {\n\tid: string;\n\tbusinessId: string;\n\tentity: string;\n\tpayload: BusinessEventAction;\n\tactor: string;\n\tcreatedAt: number;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";;;AA4CO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACN,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,YAAA,CAAA,GAAa,aAAA;AACb,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AAHI,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA","file":"types.cjs","sourcesContent":["export * from './api';\n\nexport interface PaymentRefund {\n\tid: string;\n\tentity: string;\n\ttotal: number;\n\tproviderRefundId?: string;\n\tstatus: string;\n\tcreatedAt: number;\n}\n\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tpaid: number;\n\ttax?: {\n\t\tamount: number;\n\t\tmodeSnapshot?: string;\n\t\trateBps: number;\n\t\tlines: Array<{ rateBps: number; amount: number; label?: string; scope?: string }>;\n\t};\n\tpromoCode?: {\n\t\tid: string;\n\t\tcode: string;\n\t\ttype: string;\n\t\tvalue: number;\n\t};\n\ttype: PaymentMethodType;\n\tprovider?: {\n\t\tcustomerId: string;\n\t\tpaymentIntentId?: string;\n\t\tsubscriptionId?: string;\n\t\tpriceId?: string;\n\t};\n\trefunds: PaymentRefund[];\n\tzoneId?: string;\n\tpaymentMethodId?: string;\n\tshippingMethodId?: string;\n}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\nexport interface PromoCodeValidation {\n\tpromoCodeId: string;\n\tcode: string;\n\tdiscounts: any[];\n\tconditions: any[];\n}\n\nexport interface Quote {\n\tmarket: string;\n\tzone: Zone;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tshippingMethod: ShippingMethod | null;\n\tpaymentMethod: PaymentMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n\tid?: string;\n\texpiresAt?: number;\n}\n\nexport type PriceType = 'recurring' | 'one_time';\n\nexport interface Price {\n\tcurrency: string;\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n\ttype: PriceType;\n}\n\n/**\n * Unified Location type used for addresses, shipping, and geo locations.\n * All fields are optional to support various use cases.\n */\nexport interface Location {\n\t// Identity/Contact\n\tname?: string | null;\n\tcompany?: string | null;\n\temail?: string | null;\n\tphone?: string | null;\n\n\t// Address\n\tstreet1?: string | null;\n\tstreet2?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcountry?: string | null;\n\n\t// Geo\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EshopCartItem {\n\tid: string;\n\tproductId: string;\n\tvariantId: string;\n\tproductName: string;\n\tproductSlug: string;\n\tvariantAttributes: Record<string, any>;\n\tprice: Price;\n\tquantity: number;\n\taddedAt: number;\n}\n\nexport interface ReservationCartItem {\n\tid: string;\n\tserviceId: string;\n\tserviceName: string;\n\tdate: string;\n\tfrom: number;\n\tto: number;\n\ttimeText: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface AnalyticsConfig {\n\ttype: \"GA4\";\n\tmeasurementId: string;\n}\n\nexport interface ShippingWeightTier {\n\tupToGrams: number;\n\tamount: number;\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttaxable: boolean;\n\tetaText: string;\n\tfulfillmentCenterId?: string;\n\tamount: number;\n\tfreeAbove?: number;\n\tweightTiers?: ShippingWeightTier[];\n}\n\nexport interface FulfillmentCenter {\n\tid: string;\n\tkey: string;\n\tname: Record<string, string>;\n\tlocation: Location;\n\tisPickupLocation: boolean;\n}\n\nexport interface InventoryLevel {\n\tfulfillmentCenterId: string;\n\tavailable: number;\n\treserved: number;\n}\n\nexport type ZoneScope = \"ALL\" | \"ORDER\" | \"RESERVATION\";\n\nexport interface Zone {\n\tid: string;\n\tname: string;\n\tmarketId: string;\n\tscope: ZoneScope;\n\tcountries: string[];\n\tstates: string[];\n\tpostalCodes: string[];\n\ttaxBps: number;\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n}\n\nexport interface Language {\n\tid: string;\n}\n\nexport interface BusinessEmails {\n\tbilling: string;\n\tsupport: string;\n}\n\nexport interface BusinessConfig {\n\tlanguages: Language[];\n\tmarkets: Market[];\n\tzones: Zone[];\n\tfulfillmentCenters: FulfillmentCenter[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\tanalytics?: AnalyticsConfig;\n\temails: BusinessEmails;\n}\n\nexport interface Subscription {\n\tid: string;\n\ttarget: string;\n\tplanId: string;\n\tpendingPlanId: string | null;\n\tpayment: any;\n\tstatus: SubscriptionStatus;\n\tendDate: number;\n\tusage: Record<string, any>;\n\ttoken: string;\n}\n\nexport interface Business {\n\tid: string;\n\tkey: string;\n\tnetworkKey: string | null;\n\ttimezone: string;\n\tconfigs?: BusinessConfig;\n\tsubscriptions?: Subscription[];\n\tstatus: Status;\n}\n\nexport interface EshopStoreState {\n\tbusinessId: string;\n\tselectedShippingMethodId: string | null;\n\tuserToken: string | null;\n\tprocessingCheckout: boolean;\n\tloading: boolean;\n\terror: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\nexport type BlockType =\n\t| \"TEXT\"\n\t| \"LOCALIZED_TEXT\"\n\t| \"NUMBER\"\n\t| \"BOOLEAN\"\n\t| \"BLOCK\"\n\t| \"RELATIONSHIP_ENTRY\"\n\t| \"RELATIONSHIP_MEDIA\"\n\t| \"MARKDOWN\"\n\t| \"EMAIL\"\n\t| \"PHONE\"\n\t| \"ADDRESS\";\n\nexport type AddressType = \"SHIPPING\" | \"BILLING\";\n\nexport interface EmailBlockProperties {}\n\nexport interface PhoneBlockProperties {}\n\nexport interface AddressBlockProperties {\n\taddressType: AddressType;\n}\n\n/** @deprecated Use Location instead */\nexport type GeoLocationValue = Location;\n\nexport interface EmailBlock extends Block {\n\ttype: \"EMAIL\";\n\tproperties: EmailBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface PhoneBlock extends Block {\n\ttype: \"PHONE\";\n\tproperties: PhoneBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface AddressBlock extends Block {\n\ttype: \"ADDRESS\";\n\tproperties: AddressBlockProperties;\n\tvalue: Location | null;\n}\n\nexport type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';\n\nexport interface MediaResolution {\n\tid: string;\n\tsize: string;\n\turl: string;\n}\n\nexport interface Media {\n\tid: string;\n\tresolutions: { [key: string]: MediaResolution };\n\tmimeType: string;\n\ttitle?: string | null;\n\tdescription?: string | null;\n\talt?: string | null;\n\tentity: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tslug: Record<string, string>;\n}\n\nexport interface ApiResponse<T> {\n\tsuccess: boolean;\n\tdata?: T;\n\terror?: string;\n\tcursor?: string;\n\ttotal?: number;\n}\n\nexport interface PaginatedResponse<T> {\n\tdata: T[];\n\tmeta?: {\n\t\ttotal: number;\n\t\tpage: number;\n\t\tper_page: number;\n\t};\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tguestToken: string | null;\n\tservice: any | null;\n\tbusiness: Business | null;\n\tcurrency: string;\n\treservationBlocks: Block[];\n\tapiUrl: string;\n\tbusinessId: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n\nexport type Status = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';\n\nexport type OrderStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'SHIPPED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type ReservationStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type SubscriptionStatus = 'PENDING' | 'ACTIVE' | 'CANCELLATION_SCHEDULED' | 'CANCELLED' | 'EXPIRED';\n\nexport interface ReservationItem {\n\tid: string;\n\tserviceId: string;\n\tproviderId: string;\n\tbusinessId: string;\n\treservationId: string;\n\tuserId: string;\n\tfrom: number;\n\tto: number;\n\tblocks: Block[];\n\tprice: Price;\n}\n\nexport interface Reservation {\n\tid: string;\n\tnumber: string;\n\tuserId: string;\n\tblocks: Block[];\n\tbusinessId: string;\n\tstatus: ReservationStatus;\n\tserviceIds: string[];\n\tproviderIds: string[];\n\tpayment: Payment;\n\tbusiness?: Business;\n\tuser?: any;\n\titems: ReservationItem[];\n\tcreatedAt: number;\n\tlastModified: number;\n}\n\nexport interface Node {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tparentId?: string | null;\n\tblocks: Block[];\n\tstatus: Status;\n\tslug: Record<string, string>;\n\taccess: Access;\n\twriteAccess: Access;\n\temailSubject?: Record<string, string>;\n\tchildren: Node[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface ServiceDuration {\n\tduration: number;\n\tisPause?: boolean;\n}\n\nexport interface ServiceProvider {\n\tid: string;\n\tproviderId: string;\n\tworkingTime: {\n\t\tworkingDays: Array<{ day: string; workingHours: Array<{ from: number; to: number }> }>;\n\t\toutcastDates: Array<{ month: number; day: number; workingHours: Array<{ from: number; to: number }> }>;\n\t\tspecificDates: Array<{ date: number; workingHours: Array<{ from: number; to: number }> }>;\n\t};\n\tprovider?: Provider;\n}\n\nexport interface Service {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tprices: Price[];\n\tdurations: ServiceDuration[];\n\tblocks: Block[];\n\tnodeIds: string[];\n\tisApprovalRequired: boolean;\n\tproviders: ServiceProvider[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tstatus: Status;\n}\n\nexport interface ProviderTimelinePoint {\n\ttimestamp: number;\n\tconcurrent: number;\n}\n\nexport interface Provider {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tstatus: Status;\n\tconcurrentLimit: number;\n\tnodeIds: string[];\n\tblocks: Block[];\n\ttimeline: ProviderTimelinePoint[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Workflow {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tsecret: string;\n\tstatus: Status;\n\tnodes: Record<string, WorkflowNode>;\n\tedges: WorkflowEdge[];\n\t\n\tschedule?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface WorkflowEdge {\n\tid: string;\n\tsource: string;\n\tsourceOutput: string;\n\ttarget: string;\n}\n\nexport type WorkflowNode =\n\t| WorkflowTriggerNode\n\t| WorkflowHttpNode\n\t| WorkflowIfNode\n\t| WorkflowLoopNode\n\t| WorkflowWaitNode;\n\nexport interface WorkflowTriggerNode {\n\ttype: 'trigger';\n\tevent?: string;\n}\n\nexport interface WorkflowHttpNode {\n\ttype: 'http';\n\tmethod: WorkflowHttpMethod;\n\turl: string;\n\theaders?: Record<string, string>;\n\tbody?: any;\n\ttimeoutMs?: number;\n}\n\nexport interface WorkflowIfNode {\n\ttype: 'if';\n\tcondition: string;\n}\n\nexport interface WorkflowLoopNode {\n\ttype: 'loop';\n\tarray: string;\n}\n\nexport interface WorkflowWaitNode {\n\ttype: 'wait';\n\tduration: string;\n}\n\nexport type WorkflowHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type ExecutionStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'WAITING';\n\nexport interface WorkflowExecution {\n\tid: string;\n\tworkflowId: string;\n\tbusinessId: string;\n\tstatus: ExecutionStatus;\n\tinput: Record<string, any>;\n\tnodeOutputs: Record<string, any>;\n\tcurrentNode?: string;\n\terror?: string;\n\tscheduledAt: number;\n\tstartedAt: number;\n\tcompletedAt?: number;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Audience {\n\tid: string;\n\tbusinessId: string;\n\tkey: string;\n\taccess: Access;\n\tnodeIds: string[];\n\tprices: Price[];\n\tstatus: Status;\n}\n\nexport interface AudienceAccessResponse {\n\thasAccess: boolean;\n\tsubscription?: Subscription;\n}\n\nexport interface AudienceSubscribeResponse {\n\tcheckoutUrl?: string;\n\tsubscription?: Subscription;\n}\n\nexport type BusinessEventAction =\n\t\n\t| { action: 'order_created' }\n\t| { action: 'order_status_changed'; data: { from: string; to: string } }\n\t| { action: 'order_payment_received'; data: { amount: number } }\n\t| { action: 'order_payment_failed'; data: { reason?: string } }\n\t| { action: 'order_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'order_shipped'; data: { tracking_url?: string } }\n\t| { action: 'order_completed' }\n\t| { action: 'order_cancelled'; data: { reason?: string } }\n\t\n\t| { action: 'reservation_created' }\n\t| { action: 'reservation_status_changed'; data: { from: string; to: string } }\n\t| { action: 'reservation_payment_received'; data: { amount: number } }\n\t| { action: 'reservation_payment_failed'; data: { reason?: string } }\n\t| { action: 'reservation_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'reservation_completed' }\n\t| { action: 'reservation_cancelled'; data: { reason?: string } };\n\nexport interface BusinessEvent {\n\tid: string;\n\tbusinessId: string;\n\tentity: string;\n\tpayload: BusinessEventAction;\n\tactor: string;\n\tcreatedAt: number;\n}\n"]}
package/dist/types.d.cts CHANGED
@@ -78,12 +78,21 @@ interface Price {
78
78
  compareAt?: number;
79
79
  type: PriceType$1;
80
80
  }
81
+ /**
82
+ * Unified Location type used for addresses, shipping, and geo locations.
83
+ * All fields are optional to support various use cases.
84
+ */
81
85
  interface Location {
82
- country?: string | null;
83
- address?: string | null;
86
+ name?: string | null;
87
+ company?: string | null;
88
+ email?: string | null;
89
+ phone?: string | null;
90
+ street1?: string | null;
91
+ street2?: string | null;
84
92
  city?: string | null;
85
93
  state?: string | null;
86
94
  postalCode?: string | null;
95
+ country?: string | null;
87
96
  coordinates?: {
88
97
  lat: number;
89
98
  lon: number;
@@ -135,11 +144,23 @@ interface ShippingMethod {
135
144
  name: Record<string, string>;
136
145
  taxable: boolean;
137
146
  etaText: string;
138
- pickupLocation?: Location;
147
+ fulfillmentCenterId?: string;
139
148
  amount: number;
140
149
  freeAbove?: number;
141
150
  weightTiers?: ShippingWeightTier[];
142
151
  }
152
+ interface FulfillmentCenter {
153
+ id: string;
154
+ key: string;
155
+ name: Record<string, string>;
156
+ location: Location;
157
+ isPickupLocation: boolean;
158
+ }
159
+ interface InventoryLevel {
160
+ fulfillmentCenterId: string;
161
+ available: number;
162
+ reserved: number;
163
+ }
143
164
  type ZoneScope = "ALL" | "ORDER" | "RESERVATION";
144
165
  interface Zone {
145
166
  id: string;
@@ -169,6 +190,7 @@ interface BusinessConfig {
169
190
  languages: Language[];
170
191
  markets: Market[];
171
192
  zones: Zone[];
193
+ fulfillmentCenters: FulfillmentCenter[];
172
194
  buildHooks: string[];
173
195
  webhooks: any[];
174
196
  paymentProvider?: PaymentProviderConfig;
@@ -220,17 +242,8 @@ interface PhoneBlockProperties {
220
242
  interface AddressBlockProperties {
221
243
  addressType: AddressType;
222
244
  }
223
- interface GeoLocationValue {
224
- country?: string | null;
225
- address?: string | null;
226
- city?: string | null;
227
- state?: string | null;
228
- postalCode?: string | null;
229
- coordinates?: {
230
- lat: number;
231
- lon: number;
232
- } | null;
233
- }
245
+ /** @deprecated Use Location instead */
246
+ type GeoLocationValue = Location;
234
247
  interface EmailBlock extends Block {
235
248
  type: "EMAIL";
236
249
  properties: EmailBlockProperties;
@@ -244,7 +257,7 @@ interface PhoneBlock extends Block {
244
257
  interface AddressBlock extends Block {
245
258
  type: "ADDRESS";
246
259
  properties: AddressBlockProperties;
247
- value: GeoLocationValue | null;
260
+ value: Location | null;
248
261
  }
249
262
  type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';
250
263
  interface MediaResolution {
@@ -1311,4 +1324,4 @@ interface DisconnectStripeParams {
1311
1324
  businessId: string;
1312
1325
  }
1313
1326
 
1314
- export { type Access, type AccountSubscribeParams, type AddPhoneNumberParams, type AddressBlock, type AddressBlockProperties, type AddressType, type AnalyticsConfig, type ApiResponse, type Audience, type AudienceAccessResponse, type AudiencePrice, type AudienceSubscribeResponse, type AudienceSubscriber, type Block, type BlockType, type BulkScheduleParams, type Business, type BusinessConfig, type BusinessEmails, type BusinessEvent, type BusinessEventAction, type BusinessRole, type Condition, type ConnectStripeParams, type CreateAudienceParams, type CreateBusinessParams, type CreateNodeParams, type CreateOrderParams, type CreatePortalSessionParams, type CreateProductParams, type CreatePromoCodeParams, type CreateProviderParams, type CreateReservationParams, type CreateServiceParams, type CreateWorkflowParams, type DayAvailability, type DeleteAccountParams, type DeleteAudienceParams, type DeleteBusinessMediaParams, type DeleteBusinessParams, type DeleteNodeParams, type DeleteProductParams, type DeletePromoCodeParams, type DeleteProviderParams, type DeleteServiceParams, type DeleteWorkflowParams, type DisconnectStripeParams, type Discount, type EmailBlock, type EmailBlockProperties, type EshopCartItem, type EshopItem, type EshopStoreState, type ExecutionStatus, type GenerateBlocksParams, type GeoLocationValue, type GetAnalyticsHealthParams, type GetAnalyticsParams, type GetAudienceParams, type GetAudienceSubscribersParams, type GetAudiencesParams, type GetAvailabilityParams, type GetBusinessEventsParams, type GetBusinessMediaParams, type GetBusinessMediaParams2, type GetBusinessParams, type GetBusinessParentsParams, type GetBusinessServiceWorkingTimeParams, type GetBusinessesParams, type GetDeliveryStatsParams, type GetMeParams, type GetNodeChildrenParams, type GetNodeParams, type GetNodesParams, type GetOrderParams, type GetOrdersParams, type GetProductParams, type GetProductsParams, type GetPromoCodeParams, type GetPromoCodesParams, type GetProviderParams, type GetProvidersParams, type GetQuoteParams, type GetReservationParams, type GetReservationQuoteParams, type GetServiceParams, type GetServicesParams, type GetSlotsForDateParams, type GetSubscriptionParams, type GetSubscriptionPlansParams, type GetVariableMetadataParams, type GetWorkflowParams, type GetWorkflowsParams, type HandleInvitationParams, type InviteUserParams, type Language, type Location, type LoginAccountParams, type LogoutParams, type MagicLinkRequestParams, type MagicLinkVerifyParams, type Market, type Media, type MediaResolution, type Node, type OrderCheckoutParams, type OrderStatus, type OutcastDate, type PaginatedResponse, type Payment, type PaymentMethod, PaymentMethodType, type PaymentProviderConfig, type PaymentRefund, type PhoneBlock, type PhoneBlockProperties, type PhoneNumberConfirmParams, type Price, type PriceType$1 as PriceType, type ProcessRefundParams, type PromoCodeValidation, type Provider, type ProviderTimelinePoint, type ProviderWithTimeline, type Quote, type RequestOptions, type Reservation, type ReservationCartItem, type ReservationCheckoutParams, type ReservationItem, type ReservationQuoteItem, type ReservationStatus, type ReservationStoreState, type RevokeAudienceSubscriptionParams, type SearchAccountsParams, type SearchReservationsParams, type Service, type ServiceDuration, type ServiceProvider, type ServiceProviderInput, type SetupAnalyticsParams, type ShippingMethod, type ShippingWeightTier, type Slot, type SpecificDate, type Status, type SubscribeAudienceParams, type SubscribeParams, type Subscription, type SubscriptionStatus, type SystemTemplateKey, type TestWebhookParams, type TimelinePoint, type TrackEmailOpenParams, type TriggerBuildsParams, type TriggerWorkflowParams, type UpdateAccountProfileParams, type UpdateAudienceParams, type UpdateBusinessEventParams, type UpdateBusinessParams, type UpdateMediaParams, type UpdateNodeParams, type UpdateNotificationsParams, type UpdateOrderParams, type UpdateProductParams, type UpdatePromoCodeParams, type UpdateProviderParams, type UpdateReservationParams, type UpdateServiceParams, type UpdateWorkflowParams, type UploadBusinessMediaParams, type Workflow, type WorkflowEdge, type WorkflowExecution, type WorkflowHttpMethod, type WorkflowHttpNode, type WorkflowIfNode, type WorkflowLoopNode, type WorkflowNode, type WorkflowTriggerNode, type WorkflowWaitNode, type WorkingDay, type WorkingHour, type WorkingTime, type Zone, type ZoneScope };
1327
+ export { type Access, type AccountSubscribeParams, type AddPhoneNumberParams, type AddressBlock, type AddressBlockProperties, type AddressType, type AnalyticsConfig, type ApiResponse, type Audience, type AudienceAccessResponse, type AudiencePrice, type AudienceSubscribeResponse, type AudienceSubscriber, type Block, type BlockType, type BulkScheduleParams, type Business, type BusinessConfig, type BusinessEmails, type BusinessEvent, type BusinessEventAction, type BusinessRole, type Condition, type ConnectStripeParams, type CreateAudienceParams, type CreateBusinessParams, type CreateNodeParams, type CreateOrderParams, type CreatePortalSessionParams, type CreateProductParams, type CreatePromoCodeParams, type CreateProviderParams, type CreateReservationParams, type CreateServiceParams, type CreateWorkflowParams, type DayAvailability, type DeleteAccountParams, type DeleteAudienceParams, type DeleteBusinessMediaParams, type DeleteBusinessParams, type DeleteNodeParams, type DeleteProductParams, type DeletePromoCodeParams, type DeleteProviderParams, type DeleteServiceParams, type DeleteWorkflowParams, type DisconnectStripeParams, type Discount, type EmailBlock, type EmailBlockProperties, type EshopCartItem, type EshopItem, type EshopStoreState, type ExecutionStatus, type FulfillmentCenter, type GenerateBlocksParams, type GeoLocationValue, type GetAnalyticsHealthParams, type GetAnalyticsParams, type GetAudienceParams, type GetAudienceSubscribersParams, type GetAudiencesParams, type GetAvailabilityParams, type GetBusinessEventsParams, type GetBusinessMediaParams, type GetBusinessMediaParams2, type GetBusinessParams, type GetBusinessParentsParams, type GetBusinessServiceWorkingTimeParams, type GetBusinessesParams, type GetDeliveryStatsParams, type GetMeParams, type GetNodeChildrenParams, type GetNodeParams, type GetNodesParams, type GetOrderParams, type GetOrdersParams, type GetProductParams, type GetProductsParams, type GetPromoCodeParams, type GetPromoCodesParams, type GetProviderParams, type GetProvidersParams, type GetQuoteParams, type GetReservationParams, type GetReservationQuoteParams, type GetServiceParams, type GetServicesParams, type GetSlotsForDateParams, type GetSubscriptionParams, type GetSubscriptionPlansParams, type GetVariableMetadataParams, type GetWorkflowParams, type GetWorkflowsParams, type HandleInvitationParams, type InventoryLevel, type InviteUserParams, type Language, type Location, type LoginAccountParams, type LogoutParams, type MagicLinkRequestParams, type MagicLinkVerifyParams, type Market, type Media, type MediaResolution, type Node, type OrderCheckoutParams, type OrderStatus, type OutcastDate, type PaginatedResponse, type Payment, type PaymentMethod, PaymentMethodType, type PaymentProviderConfig, type PaymentRefund, type PhoneBlock, type PhoneBlockProperties, type PhoneNumberConfirmParams, type Price, type PriceType$1 as PriceType, type ProcessRefundParams, type PromoCodeValidation, type Provider, type ProviderTimelinePoint, type ProviderWithTimeline, type Quote, type RequestOptions, type Reservation, type ReservationCartItem, type ReservationCheckoutParams, type ReservationItem, type ReservationQuoteItem, type ReservationStatus, type ReservationStoreState, type RevokeAudienceSubscriptionParams, type SearchAccountsParams, type SearchReservationsParams, type Service, type ServiceDuration, type ServiceProvider, type ServiceProviderInput, type SetupAnalyticsParams, type ShippingMethod, type ShippingWeightTier, type Slot, type SpecificDate, type Status, type SubscribeAudienceParams, type SubscribeParams, type Subscription, type SubscriptionStatus, type SystemTemplateKey, type TestWebhookParams, type TimelinePoint, type TrackEmailOpenParams, type TriggerBuildsParams, type TriggerWorkflowParams, type UpdateAccountProfileParams, type UpdateAudienceParams, type UpdateBusinessEventParams, type UpdateBusinessParams, type UpdateMediaParams, type UpdateNodeParams, type UpdateNotificationsParams, type UpdateOrderParams, type UpdateProductParams, type UpdatePromoCodeParams, type UpdateProviderParams, type UpdateReservationParams, type UpdateServiceParams, type UpdateWorkflowParams, type UploadBusinessMediaParams, type Workflow, type WorkflowEdge, type WorkflowExecution, type WorkflowHttpMethod, type WorkflowHttpNode, type WorkflowIfNode, type WorkflowLoopNode, type WorkflowNode, type WorkflowTriggerNode, type WorkflowWaitNode, type WorkingDay, type WorkingHour, type WorkingTime, type Zone, type ZoneScope };
package/dist/types.d.ts CHANGED
@@ -78,12 +78,21 @@ interface Price {
78
78
  compareAt?: number;
79
79
  type: PriceType$1;
80
80
  }
81
+ /**
82
+ * Unified Location type used for addresses, shipping, and geo locations.
83
+ * All fields are optional to support various use cases.
84
+ */
81
85
  interface Location {
82
- country?: string | null;
83
- address?: string | null;
86
+ name?: string | null;
87
+ company?: string | null;
88
+ email?: string | null;
89
+ phone?: string | null;
90
+ street1?: string | null;
91
+ street2?: string | null;
84
92
  city?: string | null;
85
93
  state?: string | null;
86
94
  postalCode?: string | null;
95
+ country?: string | null;
87
96
  coordinates?: {
88
97
  lat: number;
89
98
  lon: number;
@@ -135,11 +144,23 @@ interface ShippingMethod {
135
144
  name: Record<string, string>;
136
145
  taxable: boolean;
137
146
  etaText: string;
138
- pickupLocation?: Location;
147
+ fulfillmentCenterId?: string;
139
148
  amount: number;
140
149
  freeAbove?: number;
141
150
  weightTiers?: ShippingWeightTier[];
142
151
  }
152
+ interface FulfillmentCenter {
153
+ id: string;
154
+ key: string;
155
+ name: Record<string, string>;
156
+ location: Location;
157
+ isPickupLocation: boolean;
158
+ }
159
+ interface InventoryLevel {
160
+ fulfillmentCenterId: string;
161
+ available: number;
162
+ reserved: number;
163
+ }
143
164
  type ZoneScope = "ALL" | "ORDER" | "RESERVATION";
144
165
  interface Zone {
145
166
  id: string;
@@ -169,6 +190,7 @@ interface BusinessConfig {
169
190
  languages: Language[];
170
191
  markets: Market[];
171
192
  zones: Zone[];
193
+ fulfillmentCenters: FulfillmentCenter[];
172
194
  buildHooks: string[];
173
195
  webhooks: any[];
174
196
  paymentProvider?: PaymentProviderConfig;
@@ -220,17 +242,8 @@ interface PhoneBlockProperties {
220
242
  interface AddressBlockProperties {
221
243
  addressType: AddressType;
222
244
  }
223
- interface GeoLocationValue {
224
- country?: string | null;
225
- address?: string | null;
226
- city?: string | null;
227
- state?: string | null;
228
- postalCode?: string | null;
229
- coordinates?: {
230
- lat: number;
231
- lon: number;
232
- } | null;
233
- }
245
+ /** @deprecated Use Location instead */
246
+ type GeoLocationValue = Location;
234
247
  interface EmailBlock extends Block {
235
248
  type: "EMAIL";
236
249
  properties: EmailBlockProperties;
@@ -244,7 +257,7 @@ interface PhoneBlock extends Block {
244
257
  interface AddressBlock extends Block {
245
258
  type: "ADDRESS";
246
259
  properties: AddressBlockProperties;
247
- value: GeoLocationValue | null;
260
+ value: Location | null;
248
261
  }
249
262
  type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';
250
263
  interface MediaResolution {
@@ -1311,4 +1324,4 @@ interface DisconnectStripeParams {
1311
1324
  businessId: string;
1312
1325
  }
1313
1326
 
1314
- export { type Access, type AccountSubscribeParams, type AddPhoneNumberParams, type AddressBlock, type AddressBlockProperties, type AddressType, type AnalyticsConfig, type ApiResponse, type Audience, type AudienceAccessResponse, type AudiencePrice, type AudienceSubscribeResponse, type AudienceSubscriber, type Block, type BlockType, type BulkScheduleParams, type Business, type BusinessConfig, type BusinessEmails, type BusinessEvent, type BusinessEventAction, type BusinessRole, type Condition, type ConnectStripeParams, type CreateAudienceParams, type CreateBusinessParams, type CreateNodeParams, type CreateOrderParams, type CreatePortalSessionParams, type CreateProductParams, type CreatePromoCodeParams, type CreateProviderParams, type CreateReservationParams, type CreateServiceParams, type CreateWorkflowParams, type DayAvailability, type DeleteAccountParams, type DeleteAudienceParams, type DeleteBusinessMediaParams, type DeleteBusinessParams, type DeleteNodeParams, type DeleteProductParams, type DeletePromoCodeParams, type DeleteProviderParams, type DeleteServiceParams, type DeleteWorkflowParams, type DisconnectStripeParams, type Discount, type EmailBlock, type EmailBlockProperties, type EshopCartItem, type EshopItem, type EshopStoreState, type ExecutionStatus, type GenerateBlocksParams, type GeoLocationValue, type GetAnalyticsHealthParams, type GetAnalyticsParams, type GetAudienceParams, type GetAudienceSubscribersParams, type GetAudiencesParams, type GetAvailabilityParams, type GetBusinessEventsParams, type GetBusinessMediaParams, type GetBusinessMediaParams2, type GetBusinessParams, type GetBusinessParentsParams, type GetBusinessServiceWorkingTimeParams, type GetBusinessesParams, type GetDeliveryStatsParams, type GetMeParams, type GetNodeChildrenParams, type GetNodeParams, type GetNodesParams, type GetOrderParams, type GetOrdersParams, type GetProductParams, type GetProductsParams, type GetPromoCodeParams, type GetPromoCodesParams, type GetProviderParams, type GetProvidersParams, type GetQuoteParams, type GetReservationParams, type GetReservationQuoteParams, type GetServiceParams, type GetServicesParams, type GetSlotsForDateParams, type GetSubscriptionParams, type GetSubscriptionPlansParams, type GetVariableMetadataParams, type GetWorkflowParams, type GetWorkflowsParams, type HandleInvitationParams, type InviteUserParams, type Language, type Location, type LoginAccountParams, type LogoutParams, type MagicLinkRequestParams, type MagicLinkVerifyParams, type Market, type Media, type MediaResolution, type Node, type OrderCheckoutParams, type OrderStatus, type OutcastDate, type PaginatedResponse, type Payment, type PaymentMethod, PaymentMethodType, type PaymentProviderConfig, type PaymentRefund, type PhoneBlock, type PhoneBlockProperties, type PhoneNumberConfirmParams, type Price, type PriceType$1 as PriceType, type ProcessRefundParams, type PromoCodeValidation, type Provider, type ProviderTimelinePoint, type ProviderWithTimeline, type Quote, type RequestOptions, type Reservation, type ReservationCartItem, type ReservationCheckoutParams, type ReservationItem, type ReservationQuoteItem, type ReservationStatus, type ReservationStoreState, type RevokeAudienceSubscriptionParams, type SearchAccountsParams, type SearchReservationsParams, type Service, type ServiceDuration, type ServiceProvider, type ServiceProviderInput, type SetupAnalyticsParams, type ShippingMethod, type ShippingWeightTier, type Slot, type SpecificDate, type Status, type SubscribeAudienceParams, type SubscribeParams, type Subscription, type SubscriptionStatus, type SystemTemplateKey, type TestWebhookParams, type TimelinePoint, type TrackEmailOpenParams, type TriggerBuildsParams, type TriggerWorkflowParams, type UpdateAccountProfileParams, type UpdateAudienceParams, type UpdateBusinessEventParams, type UpdateBusinessParams, type UpdateMediaParams, type UpdateNodeParams, type UpdateNotificationsParams, type UpdateOrderParams, type UpdateProductParams, type UpdatePromoCodeParams, type UpdateProviderParams, type UpdateReservationParams, type UpdateServiceParams, type UpdateWorkflowParams, type UploadBusinessMediaParams, type Workflow, type WorkflowEdge, type WorkflowExecution, type WorkflowHttpMethod, type WorkflowHttpNode, type WorkflowIfNode, type WorkflowLoopNode, type WorkflowNode, type WorkflowTriggerNode, type WorkflowWaitNode, type WorkingDay, type WorkingHour, type WorkingTime, type Zone, type ZoneScope };
1327
+ export { type Access, type AccountSubscribeParams, type AddPhoneNumberParams, type AddressBlock, type AddressBlockProperties, type AddressType, type AnalyticsConfig, type ApiResponse, type Audience, type AudienceAccessResponse, type AudiencePrice, type AudienceSubscribeResponse, type AudienceSubscriber, type Block, type BlockType, type BulkScheduleParams, type Business, type BusinessConfig, type BusinessEmails, type BusinessEvent, type BusinessEventAction, type BusinessRole, type Condition, type ConnectStripeParams, type CreateAudienceParams, type CreateBusinessParams, type CreateNodeParams, type CreateOrderParams, type CreatePortalSessionParams, type CreateProductParams, type CreatePromoCodeParams, type CreateProviderParams, type CreateReservationParams, type CreateServiceParams, type CreateWorkflowParams, type DayAvailability, type DeleteAccountParams, type DeleteAudienceParams, type DeleteBusinessMediaParams, type DeleteBusinessParams, type DeleteNodeParams, type DeleteProductParams, type DeletePromoCodeParams, type DeleteProviderParams, type DeleteServiceParams, type DeleteWorkflowParams, type DisconnectStripeParams, type Discount, type EmailBlock, type EmailBlockProperties, type EshopCartItem, type EshopItem, type EshopStoreState, type ExecutionStatus, type FulfillmentCenter, type GenerateBlocksParams, type GeoLocationValue, type GetAnalyticsHealthParams, type GetAnalyticsParams, type GetAudienceParams, type GetAudienceSubscribersParams, type GetAudiencesParams, type GetAvailabilityParams, type GetBusinessEventsParams, type GetBusinessMediaParams, type GetBusinessMediaParams2, type GetBusinessParams, type GetBusinessParentsParams, type GetBusinessServiceWorkingTimeParams, type GetBusinessesParams, type GetDeliveryStatsParams, type GetMeParams, type GetNodeChildrenParams, type GetNodeParams, type GetNodesParams, type GetOrderParams, type GetOrdersParams, type GetProductParams, type GetProductsParams, type GetPromoCodeParams, type GetPromoCodesParams, type GetProviderParams, type GetProvidersParams, type GetQuoteParams, type GetReservationParams, type GetReservationQuoteParams, type GetServiceParams, type GetServicesParams, type GetSlotsForDateParams, type GetSubscriptionParams, type GetSubscriptionPlansParams, type GetVariableMetadataParams, type GetWorkflowParams, type GetWorkflowsParams, type HandleInvitationParams, type InventoryLevel, type InviteUserParams, type Language, type Location, type LoginAccountParams, type LogoutParams, type MagicLinkRequestParams, type MagicLinkVerifyParams, type Market, type Media, type MediaResolution, type Node, type OrderCheckoutParams, type OrderStatus, type OutcastDate, type PaginatedResponse, type Payment, type PaymentMethod, PaymentMethodType, type PaymentProviderConfig, type PaymentRefund, type PhoneBlock, type PhoneBlockProperties, type PhoneNumberConfirmParams, type Price, type PriceType$1 as PriceType, type ProcessRefundParams, type PromoCodeValidation, type Provider, type ProviderTimelinePoint, type ProviderWithTimeline, type Quote, type RequestOptions, type Reservation, type ReservationCartItem, type ReservationCheckoutParams, type ReservationItem, type ReservationQuoteItem, type ReservationStatus, type ReservationStoreState, type RevokeAudienceSubscriptionParams, type SearchAccountsParams, type SearchReservationsParams, type Service, type ServiceDuration, type ServiceProvider, type ServiceProviderInput, type SetupAnalyticsParams, type ShippingMethod, type ShippingWeightTier, type Slot, type SpecificDate, type Status, type SubscribeAudienceParams, type SubscribeParams, type Subscription, type SubscriptionStatus, type SystemTemplateKey, type TestWebhookParams, type TimelinePoint, type TrackEmailOpenParams, type TriggerBuildsParams, type TriggerWorkflowParams, type UpdateAccountProfileParams, type UpdateAudienceParams, type UpdateBusinessEventParams, type UpdateBusinessParams, type UpdateMediaParams, type UpdateNodeParams, type UpdateNotificationsParams, type UpdateOrderParams, type UpdateProductParams, type UpdatePromoCodeParams, type UpdateProviderParams, type UpdateReservationParams, type UpdateServiceParams, type UpdateWorkflowParams, type UploadBusinessMediaParams, type Workflow, type WorkflowEdge, type WorkflowExecution, type WorkflowHttpMethod, type WorkflowHttpNode, type WorkflowIfNode, type WorkflowLoopNode, type WorkflowNode, type WorkflowTriggerNode, type WorkflowWaitNode, type WorkingDay, type WorkingHour, type WorkingTime, type Zone, type ZoneScope };
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";AA4CO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACN,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,YAAA,CAAA,GAAa,aAAA;AACb,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AAHI,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA","file":"types.js","sourcesContent":["export * from './api';\n\nexport interface PaymentRefund {\n\tid: string;\n\tentity: string;\n\ttotal: number;\n\tproviderRefundId?: string;\n\tstatus: string;\n\tcreatedAt: number;\n}\n\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tpaid: number;\n\ttax?: {\n\t\tamount: number;\n\t\tmodeSnapshot?: string;\n\t\trateBps: number;\n\t\tlines: Array<{ rateBps: number; amount: number; label?: string; scope?: string }>;\n\t};\n\tpromoCode?: {\n\t\tid: string;\n\t\tcode: string;\n\t\ttype: string;\n\t\tvalue: number;\n\t};\n\ttype: PaymentMethodType;\n\tprovider?: {\n\t\tcustomerId: string;\n\t\tpaymentIntentId?: string;\n\t\tsubscriptionId?: string;\n\t\tpriceId?: string;\n\t};\n\trefunds: PaymentRefund[];\n\tzoneId?: string;\n\tpaymentMethodId?: string;\n\tshippingMethodId?: string;\n}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\nexport interface PromoCodeValidation {\n\tpromoCodeId: string;\n\tcode: string;\n\tdiscounts: any[];\n\tconditions: any[];\n}\n\nexport interface Quote {\n\tmarket: string;\n\tzone: Zone;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tshippingMethod: ShippingMethod | null;\n\tpaymentMethod: PaymentMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n\tid?: string;\n\texpiresAt?: number;\n}\n\nexport type PriceType = 'recurring' | 'one_time';\n\nexport interface Price {\n\tcurrency: string;\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n\ttype: PriceType;\n}\n\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EshopCartItem {\n\tid: string;\n\tproductId: string;\n\tvariantId: string;\n\tproductName: string;\n\tproductSlug: string;\n\tvariantAttributes: Record<string, any>;\n\tprice: Price;\n\tquantity: number;\n\taddedAt: number;\n}\n\nexport interface ReservationCartItem {\n\tid: string;\n\tserviceId: string;\n\tserviceName: string;\n\tdate: string;\n\tfrom: number;\n\tto: number;\n\ttimeText: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface AnalyticsConfig {\n\ttype: \"GA4\";\n\tmeasurementId: string;\n}\n\nexport interface ShippingWeightTier {\n\tupToGrams: number;\n\tamount: number;\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttaxable: boolean;\n\tetaText: string;\n\tpickupLocation?: Location;\n\tamount: number;\n\tfreeAbove?: number;\n\tweightTiers?: ShippingWeightTier[];\n}\n\nexport type ZoneScope = \"ALL\" | \"ORDER\" | \"RESERVATION\";\n\nexport interface Zone {\n\tid: string;\n\tname: string;\n\tmarketId: string;\n\tscope: ZoneScope;\n\tcountries: string[];\n\tstates: string[];\n\tpostalCodes: string[];\n\ttaxBps: number;\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n}\n\nexport interface Language {\n\tid: string;\n}\n\nexport interface BusinessEmails {\n\tbilling: string;\n\tsupport: string;\n}\n\nexport interface BusinessConfig {\n\tlanguages: Language[];\n\tmarkets: Market[];\n\tzones: Zone[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\tanalytics?: AnalyticsConfig;\n\temails: BusinessEmails;\n}\n\nexport interface Subscription {\n\tid: string;\n\ttarget: string;\n\tplanId: string;\n\tpendingPlanId: string | null;\n\tpayment: any;\n\tstatus: SubscriptionStatus;\n\tendDate: number;\n\tusage: Record<string, any>;\n\ttoken: string;\n}\n\nexport interface Business {\n\tid: string;\n\tkey: string;\n\tnetworkKey: string | null;\n\ttimezone: string;\n\tconfigs?: BusinessConfig;\n\tsubscriptions?: Subscription[];\n\tstatus: Status;\n}\n\nexport interface EshopStoreState {\n\tbusinessId: string;\n\tselectedShippingMethodId: string | null;\n\tuserToken: string | null;\n\tprocessingCheckout: boolean;\n\tloading: boolean;\n\terror: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\nexport type BlockType =\n\t| \"TEXT\"\n\t| \"LOCALIZED_TEXT\"\n\t| \"NUMBER\"\n\t| \"BOOLEAN\"\n\t| \"BLOCK\"\n\t| \"RELATIONSHIP_ENTRY\"\n\t| \"RELATIONSHIP_MEDIA\"\n\t| \"MARKDOWN\"\n\t| \"EMAIL\"\n\t| \"PHONE\"\n\t| \"ADDRESS\";\n\nexport type AddressType = \"SHIPPING\" | \"BILLING\";\n\nexport interface EmailBlockProperties {}\n\nexport interface PhoneBlockProperties {}\n\nexport interface AddressBlockProperties {\n\taddressType: AddressType;\n}\n\nexport interface GeoLocationValue {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EmailBlock extends Block {\n\ttype: \"EMAIL\";\n\tproperties: EmailBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface PhoneBlock extends Block {\n\ttype: \"PHONE\";\n\tproperties: PhoneBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface AddressBlock extends Block {\n\ttype: \"ADDRESS\";\n\tproperties: AddressBlockProperties;\n\tvalue: GeoLocationValue | null;\n}\n\nexport type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';\n\nexport interface MediaResolution {\n\tid: string;\n\tsize: string;\n\turl: string;\n}\n\nexport interface Media {\n\tid: string;\n\tresolutions: { [key: string]: MediaResolution };\n\tmimeType: string;\n\ttitle?: string | null;\n\tdescription?: string | null;\n\talt?: string | null;\n\tentity: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tslug: Record<string, string>;\n}\n\nexport interface ApiResponse<T> {\n\tsuccess: boolean;\n\tdata?: T;\n\terror?: string;\n\tcursor?: string;\n\ttotal?: number;\n}\n\nexport interface PaginatedResponse<T> {\n\tdata: T[];\n\tmeta?: {\n\t\ttotal: number;\n\t\tpage: number;\n\t\tper_page: number;\n\t};\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tguestToken: string | null;\n\tservice: any | null;\n\tbusiness: Business | null;\n\tcurrency: string;\n\treservationBlocks: Block[];\n\tapiUrl: string;\n\tbusinessId: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n\nexport type Status = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';\n\nexport type OrderStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'SHIPPED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type ReservationStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type SubscriptionStatus = 'PENDING' | 'ACTIVE' | 'CANCELLATION_SCHEDULED' | 'CANCELLED' | 'EXPIRED';\n\nexport interface ReservationItem {\n\tid: string;\n\tserviceId: string;\n\tproviderId: string;\n\tbusinessId: string;\n\treservationId: string;\n\tuserId: string;\n\tfrom: number;\n\tto: number;\n\tblocks: Block[];\n\tprice: Price;\n}\n\nexport interface Reservation {\n\tid: string;\n\tnumber: string;\n\tuserId: string;\n\tblocks: Block[];\n\tbusinessId: string;\n\tstatus: ReservationStatus;\n\tserviceIds: string[];\n\tproviderIds: string[];\n\tpayment: Payment;\n\tbusiness?: Business;\n\tuser?: any;\n\titems: ReservationItem[];\n\tcreatedAt: number;\n\tlastModified: number;\n}\n\nexport interface Node {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tparentId?: string | null;\n\tblocks: Block[];\n\tstatus: Status;\n\tslug: Record<string, string>;\n\taccess: Access;\n\twriteAccess: Access;\n\temailSubject?: Record<string, string>;\n\tchildren: Node[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface ServiceDuration {\n\tduration: number;\n\tisPause?: boolean;\n}\n\nexport interface ServiceProvider {\n\tid: string;\n\tproviderId: string;\n\tworkingTime: {\n\t\tworkingDays: Array<{ day: string; workingHours: Array<{ from: number; to: number }> }>;\n\t\toutcastDates: Array<{ month: number; day: number; workingHours: Array<{ from: number; to: number }> }>;\n\t\tspecificDates: Array<{ date: number; workingHours: Array<{ from: number; to: number }> }>;\n\t};\n\tprovider?: Provider;\n}\n\nexport interface Service {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tprices: Price[];\n\tdurations: ServiceDuration[];\n\tblocks: Block[];\n\tnodeIds: string[];\n\tisApprovalRequired: boolean;\n\tproviders: ServiceProvider[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tstatus: Status;\n}\n\nexport interface ProviderTimelinePoint {\n\ttimestamp: number;\n\tconcurrent: number;\n}\n\nexport interface Provider {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tstatus: Status;\n\tconcurrentLimit: number;\n\tnodeIds: string[];\n\tblocks: Block[];\n\ttimeline: ProviderTimelinePoint[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Workflow {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tsecret: string;\n\tstatus: Status;\n\tnodes: Record<string, WorkflowNode>;\n\tedges: WorkflowEdge[];\n\t\n\tschedule?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface WorkflowEdge {\n\tid: string;\n\tsource: string;\n\tsourceOutput: string;\n\ttarget: string;\n}\n\nexport type WorkflowNode =\n\t| WorkflowTriggerNode\n\t| WorkflowHttpNode\n\t| WorkflowIfNode\n\t| WorkflowLoopNode\n\t| WorkflowWaitNode;\n\nexport interface WorkflowTriggerNode {\n\ttype: 'trigger';\n\tevent?: string;\n}\n\nexport interface WorkflowHttpNode {\n\ttype: 'http';\n\tmethod: WorkflowHttpMethod;\n\turl: string;\n\theaders?: Record<string, string>;\n\tbody?: any;\n\ttimeoutMs?: number;\n}\n\nexport interface WorkflowIfNode {\n\ttype: 'if';\n\tcondition: string;\n}\n\nexport interface WorkflowLoopNode {\n\ttype: 'loop';\n\tarray: string;\n}\n\nexport interface WorkflowWaitNode {\n\ttype: 'wait';\n\tduration: string;\n}\n\nexport type WorkflowHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type ExecutionStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'WAITING';\n\nexport interface WorkflowExecution {\n\tid: string;\n\tworkflowId: string;\n\tbusinessId: string;\n\tstatus: ExecutionStatus;\n\tinput: Record<string, any>;\n\tnodeOutputs: Record<string, any>;\n\tcurrentNode?: string;\n\terror?: string;\n\tscheduledAt: number;\n\tstartedAt: number;\n\tcompletedAt?: number;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Audience {\n\tid: string;\n\tbusinessId: string;\n\tkey: string;\n\taccess: Access;\n\tnodeIds: string[];\n\tprices: Price[];\n\tstatus: Status;\n}\n\nexport interface AudienceAccessResponse {\n\thasAccess: boolean;\n\tsubscription?: Subscription;\n}\n\nexport interface AudienceSubscribeResponse {\n\tcheckoutUrl?: string;\n\tsubscription?: Subscription;\n}\n\nexport type BusinessEventAction =\n\t\n\t| { action: 'order_created' }\n\t| { action: 'order_status_changed'; data: { from: string; to: string } }\n\t| { action: 'order_payment_received'; data: { amount: number } }\n\t| { action: 'order_payment_failed'; data: { reason?: string } }\n\t| { action: 'order_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'order_shipped'; data: { tracking_url?: string } }\n\t| { action: 'order_completed' }\n\t| { action: 'order_cancelled'; data: { reason?: string } }\n\t\n\t| { action: 'reservation_created' }\n\t| { action: 'reservation_status_changed'; data: { from: string; to: string } }\n\t| { action: 'reservation_payment_received'; data: { amount: number } }\n\t| { action: 'reservation_payment_failed'; data: { reason?: string } }\n\t| { action: 'reservation_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'reservation_completed' }\n\t| { action: 'reservation_cancelled'; data: { reason?: string } };\n\nexport interface BusinessEvent {\n\tid: string;\n\tbusinessId: string;\n\tentity: string;\n\tpayload: BusinessEventAction;\n\tactor: string;\n\tcreatedAt: number;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";AA4CO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACN,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,YAAA,CAAA,GAAa,aAAA;AACb,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AAHI,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA","file":"types.js","sourcesContent":["export * from './api';\n\nexport interface PaymentRefund {\n\tid: string;\n\tentity: string;\n\ttotal: number;\n\tproviderRefundId?: string;\n\tstatus: string;\n\tcreatedAt: number;\n}\n\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tpaid: number;\n\ttax?: {\n\t\tamount: number;\n\t\tmodeSnapshot?: string;\n\t\trateBps: number;\n\t\tlines: Array<{ rateBps: number; amount: number; label?: string; scope?: string }>;\n\t};\n\tpromoCode?: {\n\t\tid: string;\n\t\tcode: string;\n\t\ttype: string;\n\t\tvalue: number;\n\t};\n\ttype: PaymentMethodType;\n\tprovider?: {\n\t\tcustomerId: string;\n\t\tpaymentIntentId?: string;\n\t\tsubscriptionId?: string;\n\t\tpriceId?: string;\n\t};\n\trefunds: PaymentRefund[];\n\tzoneId?: string;\n\tpaymentMethodId?: string;\n\tshippingMethodId?: string;\n}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\nexport interface PromoCodeValidation {\n\tpromoCodeId: string;\n\tcode: string;\n\tdiscounts: any[];\n\tconditions: any[];\n}\n\nexport interface Quote {\n\tmarket: string;\n\tzone: Zone;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tshippingMethod: ShippingMethod | null;\n\tpaymentMethod: PaymentMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n\tid?: string;\n\texpiresAt?: number;\n}\n\nexport type PriceType = 'recurring' | 'one_time';\n\nexport interface Price {\n\tcurrency: string;\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n\ttype: PriceType;\n}\n\n/**\n * Unified Location type used for addresses, shipping, and geo locations.\n * All fields are optional to support various use cases.\n */\nexport interface Location {\n\t// Identity/Contact\n\tname?: string | null;\n\tcompany?: string | null;\n\temail?: string | null;\n\tphone?: string | null;\n\n\t// Address\n\tstreet1?: string | null;\n\tstreet2?: string | null;\n\tcity?: string | null;\n\tstate?: string | null;\n\tpostalCode?: string | null;\n\tcountry?: string | null;\n\n\t// Geo\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\nexport interface EshopCartItem {\n\tid: string;\n\tproductId: string;\n\tvariantId: string;\n\tproductName: string;\n\tproductSlug: string;\n\tvariantAttributes: Record<string, any>;\n\tprice: Price;\n\tquantity: number;\n\taddedAt: number;\n}\n\nexport interface ReservationCartItem {\n\tid: string;\n\tserviceId: string;\n\tserviceName: string;\n\tdate: string;\n\tfrom: number;\n\tto: number;\n\ttimeText: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface AnalyticsConfig {\n\ttype: \"GA4\";\n\tmeasurementId: string;\n}\n\nexport interface ShippingWeightTier {\n\tupToGrams: number;\n\tamount: number;\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n\tid: string;\n\tname: Record<string, string>;\n\ttaxable: boolean;\n\tetaText: string;\n\tfulfillmentCenterId?: string;\n\tamount: number;\n\tfreeAbove?: number;\n\tweightTiers?: ShippingWeightTier[];\n}\n\nexport interface FulfillmentCenter {\n\tid: string;\n\tkey: string;\n\tname: Record<string, string>;\n\tlocation: Location;\n\tisPickupLocation: boolean;\n}\n\nexport interface InventoryLevel {\n\tfulfillmentCenterId: string;\n\tavailable: number;\n\treserved: number;\n}\n\nexport type ZoneScope = \"ALL\" | \"ORDER\" | \"RESERVATION\";\n\nexport interface Zone {\n\tid: string;\n\tname: string;\n\tmarketId: string;\n\tscope: ZoneScope;\n\tcountries: string[];\n\tstates: string[];\n\tpostalCodes: string[];\n\ttaxBps: number;\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n}\n\nexport interface Language {\n\tid: string;\n}\n\nexport interface BusinessEmails {\n\tbilling: string;\n\tsupport: string;\n}\n\nexport interface BusinessConfig {\n\tlanguages: Language[];\n\tmarkets: Market[];\n\tzones: Zone[];\n\tfulfillmentCenters: FulfillmentCenter[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\tanalytics?: AnalyticsConfig;\n\temails: BusinessEmails;\n}\n\nexport interface Subscription {\n\tid: string;\n\ttarget: string;\n\tplanId: string;\n\tpendingPlanId: string | null;\n\tpayment: any;\n\tstatus: SubscriptionStatus;\n\tendDate: number;\n\tusage: Record<string, any>;\n\ttoken: string;\n}\n\nexport interface Business {\n\tid: string;\n\tkey: string;\n\tnetworkKey: string | null;\n\ttimezone: string;\n\tconfigs?: BusinessConfig;\n\tsubscriptions?: Subscription[];\n\tstatus: Status;\n}\n\nexport interface EshopStoreState {\n\tbusinessId: string;\n\tselectedShippingMethodId: string | null;\n\tuserToken: string | null;\n\tprocessingCheckout: boolean;\n\tloading: boolean;\n\terror: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\nexport type BlockType =\n\t| \"TEXT\"\n\t| \"LOCALIZED_TEXT\"\n\t| \"NUMBER\"\n\t| \"BOOLEAN\"\n\t| \"BLOCK\"\n\t| \"RELATIONSHIP_ENTRY\"\n\t| \"RELATIONSHIP_MEDIA\"\n\t| \"MARKDOWN\"\n\t| \"EMAIL\"\n\t| \"PHONE\"\n\t| \"ADDRESS\";\n\nexport type AddressType = \"SHIPPING\" | \"BILLING\";\n\nexport interface EmailBlockProperties {}\n\nexport interface PhoneBlockProperties {}\n\nexport interface AddressBlockProperties {\n\taddressType: AddressType;\n}\n\n/** @deprecated Use Location instead */\nexport type GeoLocationValue = Location;\n\nexport interface EmailBlock extends Block {\n\ttype: \"EMAIL\";\n\tproperties: EmailBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface PhoneBlock extends Block {\n\ttype: \"PHONE\";\n\tproperties: PhoneBlockProperties;\n\tvalue: string | null;\n}\n\nexport interface AddressBlock extends Block {\n\ttype: \"ADDRESS\";\n\tproperties: AddressBlockProperties;\n\tvalue: Location | null;\n}\n\nexport type Access = 'PUBLIC' | 'AUTHENTICATED' | 'PRIVATE';\n\nexport interface MediaResolution {\n\tid: string;\n\tsize: string;\n\turl: string;\n}\n\nexport interface Media {\n\tid: string;\n\tresolutions: { [key: string]: MediaResolution };\n\tmimeType: string;\n\ttitle?: string | null;\n\tdescription?: string | null;\n\talt?: string | null;\n\tentity: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tslug: Record<string, string>;\n}\n\nexport interface ApiResponse<T> {\n\tsuccess: boolean;\n\tdata?: T;\n\terror?: string;\n\tcursor?: string;\n\ttotal?: number;\n}\n\nexport interface PaginatedResponse<T> {\n\tdata: T[];\n\tmeta?: {\n\t\ttotal: number;\n\t\tpage: number;\n\t\tper_page: number;\n\t};\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tguestToken: string | null;\n\tservice: any | null;\n\tbusiness: Business | null;\n\tcurrency: string;\n\treservationBlocks: Block[];\n\tapiUrl: string;\n\tbusinessId: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n\nexport type Status = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';\n\nexport type OrderStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'SHIPPED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type ReservationStatus = 'CREATED' | 'PENDING' | 'AUTHORIZED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'FAILED';\n\nexport type SubscriptionStatus = 'PENDING' | 'ACTIVE' | 'CANCELLATION_SCHEDULED' | 'CANCELLED' | 'EXPIRED';\n\nexport interface ReservationItem {\n\tid: string;\n\tserviceId: string;\n\tproviderId: string;\n\tbusinessId: string;\n\treservationId: string;\n\tuserId: string;\n\tfrom: number;\n\tto: number;\n\tblocks: Block[];\n\tprice: Price;\n}\n\nexport interface Reservation {\n\tid: string;\n\tnumber: string;\n\tuserId: string;\n\tblocks: Block[];\n\tbusinessId: string;\n\tstatus: ReservationStatus;\n\tserviceIds: string[];\n\tproviderIds: string[];\n\tpayment: Payment;\n\tbusiness?: Business;\n\tuser?: any;\n\titems: ReservationItem[];\n\tcreatedAt: number;\n\tlastModified: number;\n}\n\nexport interface Node {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tparentId?: string | null;\n\tblocks: Block[];\n\tstatus: Status;\n\tslug: Record<string, string>;\n\taccess: Access;\n\twriteAccess: Access;\n\temailSubject?: Record<string, string>;\n\tchildren: Node[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface ServiceDuration {\n\tduration: number;\n\tisPause?: boolean;\n}\n\nexport interface ServiceProvider {\n\tid: string;\n\tproviderId: string;\n\tworkingTime: {\n\t\tworkingDays: Array<{ day: string; workingHours: Array<{ from: number; to: number }> }>;\n\t\toutcastDates: Array<{ month: number; day: number; workingHours: Array<{ from: number; to: number }> }>;\n\t\tspecificDates: Array<{ date: number; workingHours: Array<{ from: number; to: number }> }>;\n\t};\n\tprovider?: Provider;\n}\n\nexport interface Service {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tprices: Price[];\n\tdurations: ServiceDuration[];\n\tblocks: Block[];\n\tnodeIds: string[];\n\tisApprovalRequired: boolean;\n\tproviders: ServiceProvider[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tstatus: Status;\n}\n\nexport interface ProviderTimelinePoint {\n\ttimestamp: number;\n\tconcurrent: number;\n}\n\nexport interface Provider {\n\tid: string;\n\tkey: string;\n\tslug: Record<string, string>;\n\taccess: Access;\n\tbusinessId: string;\n\tstatus: Status;\n\tconcurrentLimit: number;\n\tnodeIds: string[];\n\tblocks: Block[];\n\ttimeline: ProviderTimelinePoint[];\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Workflow {\n\tid: string;\n\tkey: string;\n\tbusinessId: string;\n\tsecret: string;\n\tstatus: Status;\n\tnodes: Record<string, WorkflowNode>;\n\tedges: WorkflowEdge[];\n\t\n\tschedule?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface WorkflowEdge {\n\tid: string;\n\tsource: string;\n\tsourceOutput: string;\n\ttarget: string;\n}\n\nexport type WorkflowNode =\n\t| WorkflowTriggerNode\n\t| WorkflowHttpNode\n\t| WorkflowIfNode\n\t| WorkflowLoopNode\n\t| WorkflowWaitNode;\n\nexport interface WorkflowTriggerNode {\n\ttype: 'trigger';\n\tevent?: string;\n}\n\nexport interface WorkflowHttpNode {\n\ttype: 'http';\n\tmethod: WorkflowHttpMethod;\n\turl: string;\n\theaders?: Record<string, string>;\n\tbody?: any;\n\ttimeoutMs?: number;\n}\n\nexport interface WorkflowIfNode {\n\ttype: 'if';\n\tcondition: string;\n}\n\nexport interface WorkflowLoopNode {\n\ttype: 'loop';\n\tarray: string;\n}\n\nexport interface WorkflowWaitNode {\n\ttype: 'wait';\n\tduration: string;\n}\n\nexport type WorkflowHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type ExecutionStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'WAITING';\n\nexport interface WorkflowExecution {\n\tid: string;\n\tworkflowId: string;\n\tbusinessId: string;\n\tstatus: ExecutionStatus;\n\tinput: Record<string, any>;\n\tnodeOutputs: Record<string, any>;\n\tcurrentNode?: string;\n\terror?: string;\n\tscheduledAt: number;\n\tstartedAt: number;\n\tcompletedAt?: number;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\nexport interface Audience {\n\tid: string;\n\tbusinessId: string;\n\tkey: string;\n\taccess: Access;\n\tnodeIds: string[];\n\tprices: Price[];\n\tstatus: Status;\n}\n\nexport interface AudienceAccessResponse {\n\thasAccess: boolean;\n\tsubscription?: Subscription;\n}\n\nexport interface AudienceSubscribeResponse {\n\tcheckoutUrl?: string;\n\tsubscription?: Subscription;\n}\n\nexport type BusinessEventAction =\n\t\n\t| { action: 'order_created' }\n\t| { action: 'order_status_changed'; data: { from: string; to: string } }\n\t| { action: 'order_payment_received'; data: { amount: number } }\n\t| { action: 'order_payment_failed'; data: { reason?: string } }\n\t| { action: 'order_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'order_shipped'; data: { tracking_url?: string } }\n\t| { action: 'order_completed' }\n\t| { action: 'order_cancelled'; data: { reason?: string } }\n\t\n\t| { action: 'reservation_created' }\n\t| { action: 'reservation_status_changed'; data: { from: string; to: string } }\n\t| { action: 'reservation_payment_received'; data: { amount: number } }\n\t| { action: 'reservation_payment_failed'; data: { reason?: string } }\n\t| { action: 'reservation_refunded'; data: { amount: number; reason?: string } }\n\t| { action: 'reservation_completed' }\n\t| { action: 'reservation_cancelled'; data: { reason?: string } };\n\nexport interface BusinessEvent {\n\tid: string;\n\tbusinessId: string;\n\tentity: string;\n\tpayload: BusinessEventAction;\n\tactor: string;\n\tcreatedAt: number;\n}\n"]}
package/dist/utils.cjs CHANGED
@@ -79,11 +79,36 @@ function formatMinor(amountMinor, currency) {
79
79
  return formatCurrency(convertToMajor(amountMinor, currency), currency);
80
80
  }
81
81
 
82
+ // src/utils/inventory.ts
83
+ function getAvailableStock(variant) {
84
+ if (!variant?.inventory) return 0;
85
+ return variant.inventory.reduce((sum, inv) => sum + inv.available, 0);
86
+ }
87
+ function getReservedStock(variant) {
88
+ if (!variant?.inventory) return 0;
89
+ return variant.inventory.reduce((sum, inv) => sum + inv.reserved, 0);
90
+ }
91
+ function hasStock(variant, quantity = 1) {
92
+ return getAvailableStock(variant) >= quantity;
93
+ }
94
+ function getInventoryAt(variant, fulfillmentCenterId) {
95
+ return variant?.inventory?.find((inv) => inv.fulfillmentCenterId === fulfillmentCenterId);
96
+ }
97
+ function getFirstAvailableFCId(variant, quantity = 1) {
98
+ const inv = variant?.inventory?.find((i) => i.available >= quantity);
99
+ return inv?.fulfillmentCenterId;
100
+ }
101
+
82
102
  exports.convertToMajor = convertToMajor;
83
103
  exports.convertToMinor = convertToMinor;
84
104
  exports.formatMinor = formatMinor;
105
+ exports.getAvailableStock = getAvailableStock;
85
106
  exports.getCurrencyName = getCurrencyName;
86
107
  exports.getCurrencySymbol = getCurrencySymbol;
108
+ exports.getFirstAvailableFCId = getFirstAvailableFCId;
109
+ exports.getInventoryAt = getInventoryAt;
110
+ exports.getReservedStock = getReservedStock;
111
+ exports.hasStock = hasStock;
87
112
  exports.isValidKey = isValidKey;
88
113
  exports.nameToKey = nameToKey;
89
114
  exports.toKey = toKey;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/keyValidation.ts","../src/utils/price.ts"],"names":[],"mappings":";;;AACA,IAAM,WAAA,GAAc,kBAAA;AAEb,SAAS,WAAW,GAAA,EAAsB;AAC/C,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,GAAG,OAAO,KAAA;AACrC,EAAA,OAAO,WAAA,CAAY,KAAK,GAAG,CAAA;AAC7B;AAEO,SAAS,YAAY,GAAA,EAAiD;AAC3E,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AAC5B,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,iBAAA,EAAkB;AAAA,EAClD;AAEA,EAAA,IAAI,GAAA,CAAI,SAAS,GAAA,EAAK;AACpB,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,oCAAA,EAAqC;AAAA,EACrE;AAEA,EAAA,IAAI,CAAC,WAAA,CAAY,IAAA,CAAK,GAAG,CAAA,EAAG;AAC1B,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,KAAA;AAAA,MACP,KAAA,EACE;AAAA,KACJ;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,OAAO,IAA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isValidKey(key: string): boolean {\n if (!key || key.length === 0) return false;\n return KEY_PATTERN.test(key);\n}\n\nexport function validateKey(key: string): { valid: boolean; error?: string } {\n if (!key || key.length === 0) {\n return { valid: false, error: \"Key is required\" };\n }\n\n if (key.length > 255) {\n return { valid: false, error: \"Key must be 255 characters or less\" };\n }\n\n if (!KEY_PATTERN.test(key)) {\n return {\n valid: false,\n error:\n \"Key can only contain letters, numbers, underscores (_) and hyphens (-)\",\n };\n }\n\n return { valid: true };\n}\n\nexport function toKey(input: string): string {\n if (!input) return \"\";\n\n return input\n .toLowerCase()\n .trim()\n .replace(/\\s+/g, \"_\") \n .replace(/[^a-z0-9_-]/g, \"\") \n .replace(/^[-_]+|[-_]+$/g, \"\") \n .replace(/[-_]{2,}/g, \"_\"); \n}\n\nexport function nameToKey(name: string): string {\n return toKey(name);\n}\n","import type { Payment, Price } from '../types';\n\nfunction formatCurrency(amount: number, currencyCode: string, locale: string = 'en'): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode.toUpperCase(),\n }).format(amount);\n}\n\nfunction getMinorUnits(currency: string): number {\n try {\n const formatter = new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n });\n const parts = formatter.formatToParts(1.11);\n const fractionPart = parts.find(p => p.type === 'fraction');\n return fractionPart?.value.length ?? 2;\n } catch {\n return 2; // Default fallback\n }\n}\n\nexport function convertToMajor(minorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return minorAmount / Math.pow(10, units);\n}\n\nexport function convertToMinor(majorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return Math.round(majorAmount * Math.pow(10, units));\n}\n\nexport function getCurrencySymbol(currency: string): string {\n try {\n return new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n currencyDisplay: 'narrowSymbol'\n }).formatToParts(0).find(p => p.type === 'currency')?.value || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function getCurrencyName(currency: string): string {\n try {\n return new Intl.DisplayNames(['en'], { type: 'currency' }).of(currency.toUpperCase()) || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function formatMinor(amountMinor: number, currency: string): string {\n return formatCurrency(convertToMajor(amountMinor, currency), currency);\n}\n\nexport function formatPayment(payment: Payment): string {\n return formatMinor(payment.total, payment.currency);\n}\n\nexport function formatPrice(prices: Price[], marketId?: string): string {\n if (!prices || prices.length === 0) return '';\n\n const price = marketId\n ? prices.find(p => p.market === marketId) || prices[0]\n : prices[0];\n\n if (!price) return '';\n\n return formatMinor(price.amount, price.currency);\n}\n\nexport function getPriceAmount(prices: Price[], marketId: string): number {\n if (!prices || prices.length === 0) return 0;\n const price = prices.find(p => p.market === marketId) || prices[0];\n return price?.amount || 0;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/keyValidation.ts","../src/utils/price.ts","../src/utils/inventory.ts"],"names":[],"mappings":";;;AACA,IAAM,WAAA,GAAc,kBAAA;AAEb,SAAS,WAAW,GAAA,EAAsB;AAC/C,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,GAAG,OAAO,KAAA;AACrC,EAAA,OAAO,WAAA,CAAY,KAAK,GAAG,CAAA;AAC7B;AAEO,SAAS,YAAY,GAAA,EAAiD;AAC3E,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AAC5B,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,iBAAA,EAAkB;AAAA,EAClD;AAEA,EAAA,IAAI,GAAA,CAAI,SAAS,GAAA,EAAK;AACpB,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,oCAAA,EAAqC;AAAA,EACrE;AAEA,EAAA,IAAI,CAAC,WAAA,CAAY,IAAA,CAAK,GAAG,CAAA,EAAG;AAC1B,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,KAAA;AAAA,MACP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AC9CO,SAAS,kBAAkB,OAAA,EAAuC;AACvE,EAAA,IAAI,CAAC,OAAA,EAAS,SAAA,EAAW,OAAO,CAAA;AAChC,EAAA,OAAO,OAAA,CAAQ,UAAU,MAAA,CAAO,CAAC,KAAK,GAAA,KAAQ,GAAA,GAAM,GAAA,CAAI,SAAA,EAAW,CAAC,CAAA;AACtE;AAKO,SAAS,iBAAiB,OAAA,EAAuC;AACtE,EAAA,IAAI,CAAC,OAAA,EAAS,SAAA,EAAW,OAAO,CAAA;AAChC,EAAA,OAAO,OAAA,CAAQ,UAAU,MAAA,CAAO,CAAC,KAAK,GAAA,KAAQ,GAAA,GAAM,GAAA,CAAI,QAAA,EAAU,CAAC,CAAA;AACrE;AAKO,SAAS,QAAA,CAAS,OAAA,EAA+B,QAAA,GAAmB,CAAA,EAAY;AACrF,EAAA,OAAO,iBAAA,CAAkB,OAAO,CAAA,IAAK,QAAA;AACvC;AAKO,SAAS,cAAA,CACd,SACA,mBAAA,EAC4B;AAC5B,EAAA,OAAO,SAAS,SAAA,EAAW,IAAA,CAAK,CAAA,GAAA,KAAO,GAAA,CAAI,wBAAwB,mBAAmB,CAAA;AACxF;AAMO,SAAS,qBAAA,CACd,OAAA,EACA,QAAA,GAAmB,CAAA,EACC;AACpB,EAAA,MAAM,MAAM,OAAA,EAAS,SAAA,EAAW,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,aAAa,QAAQ,CAAA;AACjE,EAAA,OAAO,GAAA,EAAK,mBAAA;AACd","file":"utils.cjs","sourcesContent":["\nconst KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;\n\nexport function isValidKey(key: string): boolean {\n if (!key || key.length === 0) return false;\n return KEY_PATTERN.test(key);\n}\n\nexport function validateKey(key: string): { valid: boolean; error?: string } {\n if (!key || key.length === 0) {\n return { valid: false, error: \"Key is required\" };\n }\n\n if (key.length > 255) {\n return { valid: false, error: \"Key must be 255 characters or less\" };\n }\n\n if (!KEY_PATTERN.test(key)) {\n return {\n valid: false,\n error:\n \"Key can only contain letters, numbers, underscores (_) and hyphens (-)\",\n };\n }\n\n return { valid: true };\n}\n\nexport function toKey(input: string): string {\n if (!input) return \"\";\n\n return input\n .toLowerCase()\n .trim()\n .replace(/\\s+/g, \"_\") \n .replace(/[^a-z0-9_-]/g, \"\") \n .replace(/^[-_]+|[-_]+$/g, \"\") \n .replace(/[-_]{2,}/g, \"_\"); \n}\n\nexport function nameToKey(name: string): string {\n return toKey(name);\n}\n","import type { Payment, Price } from '../types';\n\nfunction formatCurrency(amount: number, currencyCode: string, locale: string = 'en'): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode.toUpperCase(),\n }).format(amount);\n}\n\nfunction getMinorUnits(currency: string): number {\n try {\n const formatter = new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n });\n const parts = formatter.formatToParts(1.11);\n const fractionPart = parts.find(p => p.type === 'fraction');\n return fractionPart?.value.length ?? 2;\n } catch {\n return 2; // Default fallback\n }\n}\n\nexport function convertToMajor(minorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return minorAmount / Math.pow(10, units);\n}\n\nexport function convertToMinor(majorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return Math.round(majorAmount * Math.pow(10, units));\n}\n\nexport function getCurrencySymbol(currency: string): string {\n try {\n return new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n currencyDisplay: 'narrowSymbol'\n }).formatToParts(0).find(p => p.type === 'currency')?.value || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function getCurrencyName(currency: string): string {\n try {\n return new Intl.DisplayNames(['en'], { type: 'currency' }).of(currency.toUpperCase()) || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function formatMinor(amountMinor: number, currency: string): string {\n return formatCurrency(convertToMajor(amountMinor, currency), currency);\n}\n\nexport function formatPayment(payment: Payment): string {\n return formatMinor(payment.total, payment.currency);\n}\n\nexport function formatPrice(prices: Price[], marketId?: string): string {\n if (!prices || prices.length === 0) return '';\n\n const price = marketId\n ? prices.find(p => p.market === marketId) || prices[0]\n : prices[0];\n\n if (!price) return '';\n\n return formatMinor(price.amount, price.currency);\n}\n\nexport function getPriceAmount(prices: Price[], marketId: string): number {\n if (!prices || prices.length === 0) return 0;\n const price = prices.find(p => p.market === marketId) || prices[0];\n return price?.amount || 0;\n}\n","import type { InventoryLevel, FulfillmentCenter } from '../types';\n\nexport interface VariantWithInventory {\n inventory: InventoryLevel[];\n}\n\n/**\n * Get total available stock across all fulfillment centers for a variant\n */\nexport function getAvailableStock(variant: VariantWithInventory): number {\n if (!variant?.inventory) return 0;\n return variant.inventory.reduce((sum, inv) => sum + inv.available, 0);\n}\n\n/**\n * Get total reserved stock across all fulfillment centers for a variant\n */\nexport function getReservedStock(variant: VariantWithInventory): number {\n if (!variant?.inventory) return 0;\n return variant.inventory.reduce((sum, inv) => sum + inv.reserved, 0);\n}\n\n/**\n * Check if variant has any available stock\n */\nexport function hasStock(variant: VariantWithInventory, quantity: number = 1): boolean {\n return getAvailableStock(variant) >= quantity;\n}\n\n/**\n * Get inventory level at a specific fulfillment center\n */\nexport function getInventoryAt(\n variant: VariantWithInventory,\n fulfillmentCenterId: string\n): InventoryLevel | undefined {\n return variant?.inventory?.find(inv => inv.fulfillmentCenterId === fulfillmentCenterId);\n}\n\n/**\n * Get the first fulfillment center with available stock\n * Returns the fulfillmentCenterId of the first center that has stock\n */\nexport function getFirstAvailableFCId(\n variant: VariantWithInventory,\n quantity: number = 1\n): string | undefined {\n const inv = variant?.inventory?.find(i => i.available >= quantity);\n return inv?.fulfillmentCenterId;\n}\n"]}
package/dist/utils.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as convertToMajor, d as convertToMinor, a as formatMinor, b as getCurrencyName, g as getCurrencySymbol, i as isValidKey, n as nameToKey, t as toKey, v as validateKey } from './index-BYfD8CyL.cjs';
1
+ export { k as convertToMajor, l as convertToMinor, a as formatMinor, c as getAvailableStock, b as getCurrencyName, g as getCurrencySymbol, j as getFirstAvailableFCId, e as getInventoryAt, d as getReservedStock, h as hasStock, i as isValidKey, n as nameToKey, t as toKey, v as validateKey } from './index-C28uWlRE.cjs';
2
2
  import './types.cjs';
package/dist/utils.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as convertToMajor, d as convertToMinor, a as formatMinor, b as getCurrencyName, g as getCurrencySymbol, i as isValidKey, n as nameToKey, t as toKey, v as validateKey } from './index-BmbG-NrS.js';
1
+ export { k as convertToMajor, l as convertToMinor, a as formatMinor, c as getAvailableStock, b as getCurrencyName, g as getCurrencySymbol, j as getFirstAvailableFCId, e as getInventoryAt, d as getReservedStock, h as hasStock, i as isValidKey, n as nameToKey, t as toKey, v as validateKey } from './index-GZfY5CmP.js';
2
2
  import './types.js';
package/dist/utils.js CHANGED
@@ -77,6 +77,26 @@ function formatMinor(amountMinor, currency) {
77
77
  return formatCurrency(convertToMajor(amountMinor, currency), currency);
78
78
  }
79
79
 
80
- export { convertToMajor, convertToMinor, formatMinor, getCurrencyName, getCurrencySymbol, isValidKey, nameToKey, toKey, validateKey };
80
+ // src/utils/inventory.ts
81
+ function getAvailableStock(variant) {
82
+ if (!variant?.inventory) return 0;
83
+ return variant.inventory.reduce((sum, inv) => sum + inv.available, 0);
84
+ }
85
+ function getReservedStock(variant) {
86
+ if (!variant?.inventory) return 0;
87
+ return variant.inventory.reduce((sum, inv) => sum + inv.reserved, 0);
88
+ }
89
+ function hasStock(variant, quantity = 1) {
90
+ return getAvailableStock(variant) >= quantity;
91
+ }
92
+ function getInventoryAt(variant, fulfillmentCenterId) {
93
+ return variant?.inventory?.find((inv) => inv.fulfillmentCenterId === fulfillmentCenterId);
94
+ }
95
+ function getFirstAvailableFCId(variant, quantity = 1) {
96
+ const inv = variant?.inventory?.find((i) => i.available >= quantity);
97
+ return inv?.fulfillmentCenterId;
98
+ }
99
+
100
+ export { convertToMajor, convertToMinor, formatMinor, getAvailableStock, getCurrencyName, getCurrencySymbol, getFirstAvailableFCId, getInventoryAt, getReservedStock, hasStock, isValidKey, nameToKey, toKey, validateKey };
81
101
  //# sourceMappingURL=utils.js.map
82
102
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/keyValidation.ts","../src/utils/price.ts"],"names":[],"mappings":";AACA,IAAM,WAAA,GAAc,kBAAA;AAEb,SAAS,WAAW,GAAA,EAAsB;AAC/C,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,GAAG,OAAO,KAAA;AACrC,EAAA,OAAO,WAAA,CAAY,KAAK,GAAG,CAAA;AAC7B;AAEO,SAAS,YAAY,GAAA,EAAiD;AAC3E,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AAC5B,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,iBAAA,EAAkB;AAAA,EAClD;AAEA,EAAA,IAAI,GAAA,CAAI,SAAS,GAAA,EAAK;AACpB,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,oCAAA,EAAqC;AAAA,EACrE;AAEA,EAAA,IAAI,CAAC,WAAA,CAAY,IAAA,CAAK,GAAG,CAAA,EAAG;AAC1B,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,KAAA;AAAA,MACP,KAAA,EACE;AAAA,KACJ;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,OAAO,IAAA,EAAK;AACvB;AAEO,SAAS,MAAM,KAAA,EAAuB;AAC3C,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AAEnB,EAAA,OAAO,MACJ,WAAA,EAAY,CACZ,MAAK,CACL,OAAA,CAAQ,QAAQ,GAAG,CAAA,CACnB,QAAQ,cAAA,EAAgB,EAAE,EAC1B,OAAA,CAAQ,gBAAA,EAAkB,EAAE,CAAA,CAC5B,OAAA,C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AAA;AACvD;AAEO,SAAS,kBAAkB,QAAA,EAA0B;AACxD,EAAA,IAAI;AACA,IAAA,OAAO,IAAI,IAAA,CAAK,YAAA,CAAa,IAAA,EAAM;AAAA,MAC/B,KAAA,EAAO,UAAA;AAAA,MACP,QAAA,EAAU,SAAS,WAAA,EAAY;AAAA,MAC/B,eAAA,EAAiB;AAAA,KACpB,CAAA,CAAE,aAAA,CAAc,CAAC,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,KAAS,UAAU,CAAA,EAAG,KAAA,IAAS,SAAS,WAAA,EAAY;AAAA,EACxF,CAAA,CAAA,MAAQ;AACJ,IAAA,OAAO,SAAS,WAAA,EAAY;AAAA,EAChC;AACJ;AAEO,SAAS,gBAAgB,QAAA,EAA0B;AACtD,EAAA,IAAI;AACA,IAAA,OAAO,IAAI,IAAA,CAAK,YAAA,CAAa,CAAC,IAAI,GAAG,EAAE,IAAA,EAAM,UAAA,EAAY,EAAE,EAAA,CAAG,QAAA,CAAS,aAAa,CAAA,IAAK,SAAS,WAAA,EAAY;AAAA,EAClH,CAAA,CAAA,MAAQ;AACJ,IAAA,OAAO,SAAS,WAAA,EAAY;AAAA,EAChC;AACJ;AAEO,SAAS,WAAA,CAAY,aAAqB,QAAA,EAA0B;AACvE,EAAA,OAAO,cAAA,CAAe,cAAA,CAAe,WAAA,EAAa,QAAQ,GAAG,QAAQ,CAAA;AACzE","file":"utils.js","sourcesContent":["\nconst KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;\n\nexport function isValidKey(key: string): boolean {\n if (!key || key.length === 0) return false;\n return KEY_PATTERN.test(key);\n}\n\nexport function validateKey(key: string): { valid: boolean; error?: string } {\n if (!key || key.length === 0) {\n return { valid: false, error: \"Key is required\" };\n }\n\n if (key.length > 255) {\n return { valid: false, error: \"Key must be 255 characters or less\" };\n }\n\n if (!KEY_PATTERN.test(key)) {\n return {\n valid: false,\n error:\n \"Key can only contain letters, numbers, underscores (_) and hyphens (-)\",\n };\n }\n\n return { valid: true };\n}\n\nexport function toKey(input: string): string {\n if (!input) return \"\";\n\n return input\n .toLowerCase()\n .trim()\n .replace(/\\s+/g, \"_\") \n .replace(/[^a-z0-9_-]/g, \"\") \n .replace(/^[-_]+|[-_]+$/g, \"\") \n .replace(/[-_]{2,}/g, \"_\"); \n}\n\nexport function nameToKey(name: string): string {\n return toKey(name);\n}\n","import type { Payment, Price } from '../types';\n\nfunction formatCurrency(amount: number, currencyCode: string, locale: string = 'en'): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode.toUpperCase(),\n }).format(amount);\n}\n\nfunction getMinorUnits(currency: string): number {\n try {\n const formatter = new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n });\n const parts = formatter.formatToParts(1.11);\n const fractionPart = parts.find(p => p.type === 'fraction');\n return fractionPart?.value.length ?? 2;\n } catch {\n return 2; // Default fallback\n }\n}\n\nexport function convertToMajor(minorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return minorAmount / Math.pow(10, units);\n}\n\nexport function convertToMinor(majorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return Math.round(majorAmount * Math.pow(10, units));\n}\n\nexport function getCurrencySymbol(currency: string): string {\n try {\n return new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n currencyDisplay: 'narrowSymbol'\n }).formatToParts(0).find(p => p.type === 'currency')?.value || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function getCurrencyName(currency: string): string {\n try {\n return new Intl.DisplayNames(['en'], { type: 'currency' }).of(currency.toUpperCase()) || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function formatMinor(amountMinor: number, currency: string): string {\n return formatCurrency(convertToMajor(amountMinor, currency), currency);\n}\n\nexport function formatPayment(payment: Payment): string {\n return formatMinor(payment.total, payment.currency);\n}\n\nexport function formatPrice(prices: Price[], marketId?: string): string {\n if (!prices || prices.length === 0) return '';\n\n const price = marketId\n ? prices.find(p => p.market === marketId) || prices[0]\n : prices[0];\n\n if (!price) return '';\n\n return formatMinor(price.amount, price.currency);\n}\n\nexport function getPriceAmount(prices: Price[], marketId: string): number {\n if (!prices || prices.length === 0) return 0;\n const price = prices.find(p => p.market === marketId) || prices[0];\n return price?.amount || 0;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/keyValidation.ts","../src/utils/price.ts","../src/utils/inventory.ts"],"names":[],"mappings":";AACA,IAAM,WAAA,GAAc,kBAAA;AAEb,SAAS,WAAW,GAAA,EAAsB;AAC/C,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,GAAG,OAAO,KAAA;AACrC,EAAA,OAAO,WAAA,CAAY,KAAK,GAAG,CAAA;AAC7B;AAEO,SAAS,YAAY,GAAA,EAAiD;AAC3E,EAAA,IAAI,CAAC,GAAA,IAAO,GAAA,CAAI,MAAA,KAAW,CAAA,EAAG;AAC5B,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,iBAAA,EAAkB;AAAA,EAClD;AAEA,EAAA,IAAI,GAAA,CAAI,SAAS,GAAA,EAAK;AACpB,IAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,oCAAA,EAAqC;AAAA,EACrE;AAEA,EAAA,IAAI,CAAC,WAAA,CAAY,IAAA,CAAK,GAAG,CAAA,EAAG;AAC1B,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,KAAA;AAAA,MACP,KAAA,EACE;AAAA,KACJ;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,OAAO,IAAA,EAAK;AACvB;AAEO,SAAS,MAAM,KAAA,EAAuB;AAC3C,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AAEnB,EAAA,OAAO,MACJ,WAAA,EAAY,CACZ,MAAK,CACL,OAAA,CAAQ,QAAQ,GAAG,CAAA,CACnB,QAAQ,cAAA,EAAgB,EAA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,CAAC,OAAA,EAAS,SAAA,EAAW,OAAO,CAAA;AAChC,EAAA,OAAO,OAAA,CAAQ,UAAU,MAAA,CAAO,CAAC,KAAK,GAAA,KAAQ,GAAA,GAAM,GAAA,CAAI,QAAA,EAAU,CAAC,CAAA;AACrE;AAKO,SAAS,QAAA,CAAS,OAAA,EAA+B,QAAA,GAAmB,CAAA,EAAY;AACrF,EAAA,OAAO,iBAAA,CAAkB,OAAO,CAAA,IAAK,QAAA;AACvC;AAKO,SAAS,cAAA,CACd,SACA,mBAAA,EAC4B;AAC5B,EAAA,OAAO,SAAS,SAAA,EAAW,IAAA,CAAK,CAAA,GAAA,KAAO,GAAA,CAAI,wBAAwB,mBAAmB,CAAA;AACxF;AAMO,SAAS,qBAAA,CACd,OAAA,EACA,QAAA,GAAmB,CAAA,EACC;AACpB,EAAA,MAAM,MAAM,OAAA,EAAS,SAAA,EAAW,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,aAAa,QAAQ,CAAA;AACjE,EAAA,OAAO,GAAA,EAAK,mBAAA;AACd","file":"utils.js","sourcesContent":["\nconst KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;\n\nexport function isValidKey(key: string): boolean {\n if (!key || key.length === 0) return false;\n return KEY_PATTERN.test(key);\n}\n\nexport function validateKey(key: string): { valid: boolean; error?: string } {\n if (!key || key.length === 0) {\n return { valid: false, error: \"Key is required\" };\n }\n\n if (key.length > 255) {\n return { valid: false, error: \"Key must be 255 characters or less\" };\n }\n\n if (!KEY_PATTERN.test(key)) {\n return {\n valid: false,\n error:\n \"Key can only contain letters, numbers, underscores (_) and hyphens (-)\",\n };\n }\n\n return { valid: true };\n}\n\nexport function toKey(input: string): string {\n if (!input) return \"\";\n\n return input\n .toLowerCase()\n .trim()\n .replace(/\\s+/g, \"_\") \n .replace(/[^a-z0-9_-]/g, \"\") \n .replace(/^[-_]+|[-_]+$/g, \"\") \n .replace(/[-_]{2,}/g, \"_\"); \n}\n\nexport function nameToKey(name: string): string {\n return toKey(name);\n}\n","import type { Payment, Price } from '../types';\n\nfunction formatCurrency(amount: number, currencyCode: string, locale: string = 'en'): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode.toUpperCase(),\n }).format(amount);\n}\n\nfunction getMinorUnits(currency: string): number {\n try {\n const formatter = new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n });\n const parts = formatter.formatToParts(1.11);\n const fractionPart = parts.find(p => p.type === 'fraction');\n return fractionPart?.value.length ?? 2;\n } catch {\n return 2; // Default fallback\n }\n}\n\nexport function convertToMajor(minorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return minorAmount / Math.pow(10, units);\n}\n\nexport function convertToMinor(majorAmount: number, currency: string): number {\n const units = getMinorUnits(currency);\n return Math.round(majorAmount * Math.pow(10, units));\n}\n\nexport function getCurrencySymbol(currency: string): string {\n try {\n return new Intl.NumberFormat('en', {\n style: 'currency',\n currency: currency.toUpperCase(),\n currencyDisplay: 'narrowSymbol'\n }).formatToParts(0).find(p => p.type === 'currency')?.value || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function getCurrencyName(currency: string): string {\n try {\n return new Intl.DisplayNames(['en'], { type: 'currency' }).of(currency.toUpperCase()) || currency.toUpperCase();\n } catch {\n return currency.toUpperCase();\n }\n}\n\nexport function formatMinor(amountMinor: number, currency: string): string {\n return formatCurrency(convertToMajor(amountMinor, currency), currency);\n}\n\nexport function formatPayment(payment: Payment): string {\n return formatMinor(payment.total, payment.currency);\n}\n\nexport function formatPrice(prices: Price[], marketId?: string): string {\n if (!prices || prices.length === 0) return '';\n\n const price = marketId\n ? prices.find(p => p.market === marketId) || prices[0]\n : prices[0];\n\n if (!price) return '';\n\n return formatMinor(price.amount, price.currency);\n}\n\nexport function getPriceAmount(prices: Price[], marketId: string): number {\n if (!prices || prices.length === 0) return 0;\n const price = prices.find(p => p.market === marketId) || prices[0];\n return price?.amount || 0;\n}\n","import type { InventoryLevel, FulfillmentCenter } from '../types';\n\nexport interface VariantWithInventory {\n inventory: InventoryLevel[];\n}\n\n/**\n * Get total available stock across all fulfillment centers for a variant\n */\nexport function getAvailableStock(variant: VariantWithInventory): number {\n if (!variant?.inventory) return 0;\n return variant.inventory.reduce((sum, inv) => sum + inv.available, 0);\n}\n\n/**\n * Get total reserved stock across all fulfillment centers for a variant\n */\nexport function getReservedStock(variant: VariantWithInventory): number {\n if (!variant?.inventory) return 0;\n return variant.inventory.reduce((sum, inv) => sum + inv.reserved, 0);\n}\n\n/**\n * Check if variant has any available stock\n */\nexport function hasStock(variant: VariantWithInventory, quantity: number = 1): boolean {\n return getAvailableStock(variant) >= quantity;\n}\n\n/**\n * Get inventory level at a specific fulfillment center\n */\nexport function getInventoryAt(\n variant: VariantWithInventory,\n fulfillmentCenterId: string\n): InventoryLevel | undefined {\n return variant?.inventory?.find(inv => inv.fulfillmentCenterId === fulfillmentCenterId);\n}\n\n/**\n * Get the first fulfillment center with available stock\n * Returns the fulfillmentCenterId of the first center that has stock\n */\nexport function getFirstAvailableFCId(\n variant: VariantWithInventory,\n quantity: number = 1\n): string | undefined {\n const inv = variant?.inventory?.find(i => i.available >= quantity);\n return inv?.fulfillmentCenterId;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arky-sdk",
3
- "version": "0.4.32",
3
+ "version": "0.4.34",
4
4
  "description": "Official TypeScript SDK for Arky - All-in-one business platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,18 +0,0 @@
1
- import { Payment } from './types.cjs';
2
-
3
- declare function convertToMajor(minorAmount: number, currency: string): number;
4
- declare function convertToMinor(majorAmount: number, currency: string): number;
5
- declare function getCurrencySymbol(currency: string): string;
6
- declare function getCurrencyName(currency: string): string;
7
- declare function formatMinor(amountMinor: number, currency: string): string;
8
- declare function formatPayment(payment: Payment): string;
9
-
10
- declare function isValidKey(key: string): boolean;
11
- declare function validateKey(key: string): {
12
- valid: boolean;
13
- error?: string;
14
- };
15
- declare function toKey(input: string): string;
16
- declare function nameToKey(name: string): string;
17
-
18
- export { formatMinor as a, getCurrencyName as b, convertToMajor as c, convertToMinor as d, formatPayment as f, getCurrencySymbol as g, isValidKey as i, nameToKey as n, toKey as t, validateKey as v };
@@ -1,18 +0,0 @@
1
- import { Payment } from './types.js';
2
-
3
- declare function convertToMajor(minorAmount: number, currency: string): number;
4
- declare function convertToMinor(majorAmount: number, currency: string): number;
5
- declare function getCurrencySymbol(currency: string): string;
6
- declare function getCurrencyName(currency: string): string;
7
- declare function formatMinor(amountMinor: number, currency: string): string;
8
- declare function formatPayment(payment: Payment): string;
9
-
10
- declare function isValidKey(key: string): boolean;
11
- declare function validateKey(key: string): {
12
- valid: boolean;
13
- error?: string;
14
- };
15
- declare function toKey(input: string): string;
16
- declare function nameToKey(name: string): string;
17
-
18
- export { formatMinor as a, getCurrencyName as b, convertToMajor as c, convertToMinor as d, formatPayment as f, getCurrencySymbol as g, isValidKey as i, nameToKey as n, toKey as t, validateKey as v };