arky-sdk 0.3.62 → 0.3.63

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.
@@ -25,7 +25,7 @@ declare const getBlockValue: (entry: any, blockKey: string) => any;
25
25
  declare const getBlockValues: (entry: any, blockKey: string) => any;
26
26
  declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
27
27
  declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
28
- declare const getImageUrl: (imageBlock: any, isBlock?: boolean, storageUrl?: string) => any;
28
+ declare const getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
29
29
  declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
30
30
 
31
31
  declare function convertToMajor(minorAmount: number): number;
@@ -25,7 +25,7 @@ declare const getBlockValue: (entry: any, blockKey: string) => any;
25
25
  declare const getBlockValues: (entry: any, blockKey: string) => any;
26
26
  declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
27
27
  declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
28
- declare const getImageUrl: (imageBlock: any, isBlock?: boolean, storageUrl?: string) => any;
28
+ declare const getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
29
29
  declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
30
30
 
31
31
  declare function convertToMajor(minorAmount: number): number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";;;AAkCO,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":["// Core type definitions\n// All types are exported individually for better tree-shaking\n\nexport * from './api';\n\n// NEW: Payment structure (matches backend)\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: 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}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\n// Quote line item (from quote engine)\nexport interface QuoteLineItem {\n\titemType: string;\n\tid: string;\n\tname: string;\n\tquantity: number;\n\tunitPrice: number;\n\ttotal: number;\n}\n\n// Promo code validation result\nexport interface PromoCodeValidation {\n\tid: string;\n\tcode: string;\n\tdiscountType: any;\n\tdiscountValue: number;\n\tconditions: any[];\n}\n\n// Quote response from backend (full pricing breakdown)\nexport interface Quote {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tlineItems: QuoteLineItem[];\n\tshippingMethod: ShippingMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n}\n\n// Market-based price structure (for product variants)\nexport interface Price {\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n}\n\n// Location structure (for shipping addresses, pickup points, etc.)\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tpostalCode?: string | null;\n\tcountryCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\n// Cart types\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; // Minor units (backend format)\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\tisMultiDay: boolean;\n\treservationMethod: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\n// Payment provider types\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface ZoneDefinition {\n\tid: string;\n\tname: string;\n}\n\nexport interface ZonePaymentMethod {\n\tid: string;\n}\n\nexport interface ZoneShippingMethod {\n\tid: string;\n\tamount: number;\n}\n\nexport interface MarketZone {\n\ttaxBps: number;\n\tzoneId: string;\n\tpaymentMethods: ZonePaymentMethod[];\n\tshippingMethods: ZoneShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n\tzones: MarketZone[];\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n id: string;\n type: 'SHIPPING' | 'PICKUP';\n taxable: boolean;\n etaText: string;\n location?: Location;\n}\n\nexport interface ZoneResolvedShippingMethod extends ShippingMethod {\n\tzoneAmount: number;\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\tzones: ZoneDefinition[];\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n\tmarkets: Market[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\torderBlocks: any[];\n\treservationBlocks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\temails: BusinessEmails;\n}\n\nexport interface Business {\n\tid: string;\n\tname: string;\n\tconfigs?: BusinessConfig;\n}\n\n// Store state types - Simplified (business data moved to business store)\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\tphoneNumber: string;\n\tphoneError: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\n// SEO types\nexport interface Seo {\n\tslug: Record<string, string>;\n\tmetaTitle: Record<string, string>;\n\tmetaDescription: Record<string, string>;\n\tcanonicalUrl: Record<string, string>;\n\togImage: string;\n}\n\n// Media types\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\towner: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tseo: Seo;\n}\n\n// API Response types\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: string;\n cursor?: string;\n total?: 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\n// Legacy types - kept for compatibility\nexport interface MarketConfigClient {\n\tcurrency: string;\n\ttaxMode: string;\n\tdefaultTaxRate: number;\n\tpaymentMethods: string[];\n\tshowTaxIncluded: boolean;\n\tshippingMethods?: ShippingMethod[];\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\n\t// Calendar data\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\n\t// Selection state\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedMethod: string | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\n\t// Status flags\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tisMultiDay: boolean;\n\n\t// Phone verification\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tphoneSuccess: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n\tisPhoneVerified: boolean;\n\tisSendingCode: boolean;\n\tisVerifying: boolean;\n\tcodeSentAt: number | null;\n\tcanResendAt: number | null;\n\n\t// Service & config\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\tstorageUrl: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\n\t// Payment configuration\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";;;AAkCO,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":["// Core type definitions\n// All types are exported individually for better tree-shaking\n\nexport * from './api';\n\n// NEW: Payment structure (matches backend)\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: 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}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\n// Quote line item (from quote engine)\nexport interface QuoteLineItem {\n\titemType: string;\n\tid: string;\n\tname: string;\n\tquantity: number;\n\tunitPrice: number;\n\ttotal: number;\n}\n\n// Promo code validation result\nexport interface PromoCodeValidation {\n\tid: string;\n\tcode: string;\n\tdiscountType: any;\n\tdiscountValue: number;\n\tconditions: any[];\n}\n\n// Quote response from backend (full pricing breakdown)\nexport interface Quote {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tlineItems: QuoteLineItem[];\n\tshippingMethod: ShippingMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n}\n\n// Market-based price structure (for product variants)\nexport interface Price {\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n}\n\n// Location structure (for shipping addresses, pickup points, etc.)\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tpostalCode?: string | null;\n\tcountryCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\n// Cart types\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; // Minor units (backend format)\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\tisMultiDay: boolean;\n\treservationMethod: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\n// Payment provider types\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface ZoneDefinition {\n\tid: string;\n\tname: string;\n}\n\nexport interface ZonePaymentMethod {\n\tid: string;\n}\n\nexport interface ZoneShippingMethod {\n\tid: string;\n\tamount: number;\n}\n\nexport interface MarketZone {\n\ttaxBps: number;\n\tzoneId: string;\n\tpaymentMethods: ZonePaymentMethod[];\n\tshippingMethods: ZoneShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n\tzones: MarketZone[];\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n id: string;\n type: 'SHIPPING' | 'PICKUP';\n taxable: boolean;\n etaText: string;\n location?: Location;\n}\n\nexport interface ZoneResolvedShippingMethod extends ShippingMethod {\n\tzoneAmount: number;\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\tzones: ZoneDefinition[];\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n\tmarkets: Market[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\torderBlocks: any[];\n\treservationBlocks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\temails: BusinessEmails;\n}\n\nexport interface Business {\n\tid: string;\n\tname: string;\n\tconfigs?: BusinessConfig;\n}\n\n// Store state types - Simplified (business data moved to business store)\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\tphoneNumber: string;\n\tphoneError: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\n// SEO types\nexport interface Seo {\n\tslug: Record<string, string>;\n\tmetaTitle: Record<string, string>;\n\tmetaDescription: Record<string, string>;\n\tcanonicalUrl: Record<string, string>;\n\togImage: string;\n}\n\n// Media types\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\towner: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tseo: Seo;\n}\n\n// API Response types\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: string;\n cursor?: string;\n total?: 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\n// Legacy types - kept for compatibility\nexport interface MarketConfigClient {\n\tcurrency: string;\n\ttaxMode: string;\n\tdefaultTaxRate: number;\n\tpaymentMethods: string[];\n\tshowTaxIncluded: boolean;\n\tshippingMethods?: ShippingMethod[];\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\n\t// Calendar data\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\n\t// Selection state\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedMethod: string | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\n\t// Status flags\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tisMultiDay: boolean;\n\n\t// Phone verification\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tphoneSuccess: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n\tisPhoneVerified: boolean;\n\tisSendingCode: boolean;\n\tisVerifying: boolean;\n\tcodeSentAt: number | null;\n\tcanResendAt: number | null;\n\n\t// Service & config\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\n\t// Payment configuration\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n"]}
package/dist/types.d.cts CHANGED
@@ -859,7 +859,6 @@ interface ReservationStoreState {
859
859
  reservationBlocks: Block[];
860
860
  apiUrl: string;
861
861
  businessId: string;
862
- storageUrl: string;
863
862
  timezone: string;
864
863
  tzGroups: any;
865
864
  items: ReservationCartItem[];
package/dist/types.d.ts CHANGED
@@ -859,7 +859,6 @@ interface ReservationStoreState {
859
859
  reservationBlocks: Block[];
860
860
  apiUrl: string;
861
861
  businessId: string;
862
- storageUrl: string;
863
862
  timezone: string;
864
863
  tzGroups: any;
865
864
  items: ReservationCartItem[];
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";AAkCO,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":["// Core type definitions\n// All types are exported individually for better tree-shaking\n\nexport * from './api';\n\n// NEW: Payment structure (matches backend)\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: 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}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\n// Quote line item (from quote engine)\nexport interface QuoteLineItem {\n\titemType: string;\n\tid: string;\n\tname: string;\n\tquantity: number;\n\tunitPrice: number;\n\ttotal: number;\n}\n\n// Promo code validation result\nexport interface PromoCodeValidation {\n\tid: string;\n\tcode: string;\n\tdiscountType: any;\n\tdiscountValue: number;\n\tconditions: any[];\n}\n\n// Quote response from backend (full pricing breakdown)\nexport interface Quote {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tlineItems: QuoteLineItem[];\n\tshippingMethod: ShippingMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n}\n\n// Market-based price structure (for product variants)\nexport interface Price {\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n}\n\n// Location structure (for shipping addresses, pickup points, etc.)\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tpostalCode?: string | null;\n\tcountryCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\n// Cart types\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; // Minor units (backend format)\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\tisMultiDay: boolean;\n\treservationMethod: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\n// Payment provider types\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface ZoneDefinition {\n\tid: string;\n\tname: string;\n}\n\nexport interface ZonePaymentMethod {\n\tid: string;\n}\n\nexport interface ZoneShippingMethod {\n\tid: string;\n\tamount: number;\n}\n\nexport interface MarketZone {\n\ttaxBps: number;\n\tzoneId: string;\n\tpaymentMethods: ZonePaymentMethod[];\n\tshippingMethods: ZoneShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n\tzones: MarketZone[];\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n id: string;\n type: 'SHIPPING' | 'PICKUP';\n taxable: boolean;\n etaText: string;\n location?: Location;\n}\n\nexport interface ZoneResolvedShippingMethod extends ShippingMethod {\n\tzoneAmount: number;\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\tzones: ZoneDefinition[];\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n\tmarkets: Market[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\torderBlocks: any[];\n\treservationBlocks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\temails: BusinessEmails;\n}\n\nexport interface Business {\n\tid: string;\n\tname: string;\n\tconfigs?: BusinessConfig;\n}\n\n// Store state types - Simplified (business data moved to business store)\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\tphoneNumber: string;\n\tphoneError: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\n// SEO types\nexport interface Seo {\n\tslug: Record<string, string>;\n\tmetaTitle: Record<string, string>;\n\tmetaDescription: Record<string, string>;\n\tcanonicalUrl: Record<string, string>;\n\togImage: string;\n}\n\n// Media types\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\towner: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tseo: Seo;\n}\n\n// API Response types\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: string;\n cursor?: string;\n total?: 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\n// Legacy types - kept for compatibility\nexport interface MarketConfigClient {\n\tcurrency: string;\n\ttaxMode: string;\n\tdefaultTaxRate: number;\n\tpaymentMethods: string[];\n\tshowTaxIncluded: boolean;\n\tshippingMethods?: ShippingMethod[];\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\n\t// Calendar data\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\n\t// Selection state\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedMethod: string | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\n\t// Status flags\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tisMultiDay: boolean;\n\n\t// Phone verification\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tphoneSuccess: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n\tisPhoneVerified: boolean;\n\tisSendingCode: boolean;\n\tisVerifying: boolean;\n\tcodeSentAt: number | null;\n\tcanResendAt: number | null;\n\n\t// Service & config\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\tstorageUrl: string;\n\ttimezone: string;\n\ttzGroups: any;\n\titems: ReservationCartItem[];\n\n\t// Payment configuration\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethodType"],"mappings":";AAkCO,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":["// Core type definitions\n// All types are exported individually for better tree-shaking\n\nexport * from './api';\n\n// NEW: Payment structure (matches backend)\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: 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}\n\nexport enum PaymentMethodType {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\n// Quote line item (from quote engine)\nexport interface QuoteLineItem {\n\titemType: string;\n\tid: string;\n\tname: string;\n\tquantity: number;\n\tunitPrice: number;\n\ttotal: number;\n}\n\n// Promo code validation result\nexport interface PromoCodeValidation {\n\tid: string;\n\tcode: string;\n\tdiscountType: any;\n\tdiscountValue: number;\n\tconditions: any[];\n}\n\n// Quote response from backend (full pricing breakdown)\nexport interface Quote {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttotal: number;\n\tlineItems: QuoteLineItem[];\n\tshippingMethod: ShippingMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n}\n\n// Market-based price structure (for product variants)\nexport interface Price {\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n}\n\n// Location structure (for shipping addresses, pickup points, etc.)\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tpostalCode?: string | null;\n\tcountryCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\n// Cart types\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; // Minor units (backend format)\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\tisMultiDay: boolean;\n\treservationMethod: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\n// Payment provider types\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\nexport interface ZoneDefinition {\n\tid: string;\n\tname: string;\n}\n\nexport interface ZonePaymentMethod {\n\tid: string;\n}\n\nexport interface ZoneShippingMethod {\n\tid: string;\n\tamount: number;\n}\n\nexport interface MarketZone {\n\ttaxBps: number;\n\tzoneId: string;\n\tpaymentMethods: ZonePaymentMethod[];\n\tshippingMethods: ZoneShippingMethod[];\n}\n\nexport interface Market {\n\tid: string;\n\tcurrency: string;\n\ttaxMode: \"EXCLUSIVE\" | \"INCLUSIVE\";\n\tzones: MarketZone[];\n}\n\nexport interface PaymentMethod {\n\tid: string;\n\ttype: PaymentMethodType;\n}\n\nexport interface ShippingMethod {\n id: string;\n type: 'SHIPPING' | 'PICKUP';\n taxable: boolean;\n etaText: string;\n location?: Location;\n}\n\nexport interface ZoneResolvedShippingMethod extends ShippingMethod {\n\tzoneAmount: number;\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\tzones: ZoneDefinition[];\n\tpaymentMethods: PaymentMethod[];\n\tshippingMethods: ShippingMethod[];\n\tmarkets: Market[];\n\tbuildHooks: string[];\n\twebhooks: any[];\n\torderBlocks: any[];\n\treservationBlocks: any[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n\temails: BusinessEmails;\n}\n\nexport interface Business {\n\tid: string;\n\tname: string;\n\tconfigs?: BusinessConfig;\n}\n\n// Store state types - Simplified (business data moved to business store)\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\tphoneNumber: string;\n\tphoneError: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\n// SEO types\nexport interface Seo {\n\tslug: Record<string, string>;\n\tmetaTitle: Record<string, string>;\n\tmetaDescription: Record<string, string>;\n\tcanonicalUrl: Record<string, string>;\n\togImage: string;\n}\n\n// Media types\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\towner: string;\n\tmetadata?: string | null;\n\tuploadedAt: string;\n\tseo: Seo;\n}\n\n// API Response types\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: string;\n cursor?: string;\n total?: 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\n// Legacy types - kept for compatibility\nexport interface MarketConfigClient {\n\tcurrency: string;\n\ttaxMode: string;\n\tdefaultTaxRate: number;\n\tpaymentMethods: string[];\n\tshowTaxIncluded: boolean;\n\tshippingMethods?: ShippingMethod[];\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\n\t// Calendar data\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\n\t// Selection state\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedMethod: string | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\n\t// Status flags\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tisMultiDay: boolean;\n\n\t// Phone verification\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tphoneSuccess: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n\tisPhoneVerified: boolean;\n\tisSendingCode: boolean;\n\tisVerifying: boolean;\n\tcodeSentAt: number | null;\n\tcanResendAt: number | null;\n\n\t// Service & config\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\n\t// Payment configuration\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n"]}
package/dist/utils.cjs CHANGED
@@ -130,44 +130,30 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
130
130
  return acc;
131
131
  });
132
132
  };
133
- var getImageUrl = (imageBlock, isBlock = true, storageUrl = "https://storage.arky.io/dev") => {
133
+ var getImageUrl = (imageBlock, isBlock = true) => {
134
134
  if (!imageBlock) return null;
135
- const isExternalUrl = (url) => {
136
- return url.startsWith("http://") || url.startsWith("https://");
137
- };
138
135
  if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
139
136
  const mediaValue = imageBlock.value[0];
140
137
  if (mediaValue && mediaValue.mimeType) {
141
138
  if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
142
- const url = mediaValue.resolutions.original.url;
143
- return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
139
+ return mediaValue.resolutions.original.url;
144
140
  }
145
141
  if (mediaValue.url) {
146
- return isExternalUrl(mediaValue.url) ? mediaValue.url : `${storageUrl}/${mediaValue.url}`;
142
+ return mediaValue.url;
147
143
  }
148
144
  }
149
145
  return null;
150
146
  }
151
147
  if (isBlock) {
152
148
  if (typeof imageBlock === "string") {
153
- if (isExternalUrl(imageBlock)) {
154
- return imageBlock;
155
- }
156
- return `${storageUrl}/${imageBlock}`;
149
+ return imageBlock;
157
150
  }
158
151
  if (imageBlock.url) {
159
- if (isExternalUrl(imageBlock.url)) {
160
- return imageBlock.url;
161
- }
162
- return `${storageUrl}/${imageBlock.url}`;
152
+ return imageBlock.url;
163
153
  }
164
154
  }
165
155
  if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
166
- const url = imageBlock.resolutions.original.url;
167
- if (isExternalUrl(url)) {
168
- return url;
169
- }
170
- return `${storageUrl}/${url}`;
156
+ return imageBlock.resolutions.original.url;
171
157
  }
172
158
  return null;
173
159
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/blocks.ts","../src/utils/errors.ts","../src/utils/currency.ts","../src/utils/price.ts","../src/utils/svg.ts","../src/utils/text.ts","../src/utils/timezone.ts","../src/utils/validation.ts"],"names":[],"mappings":";;;AAsBO,SAAS,aAAA,CAAc,KAAA,EAAY,MAAA,GAAiB,IAAA,EAAc;AACrE,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AAEnB,EAAA,IAAI,KAAA,CAAM,YAAY,KAAA,EAAO;AACzB,IAAA,IAAI,OAAO,KAAA,CAAM,UAAA,CAAW,KAAA,KAAU,QAAA,EAAU;AAC5C,MAAA,OACI,MAAM,UAAA,CAAW,KAAA,CAAM,MAAM,CAAA,IAC7B,MAAM,UAAA,CAAW,KAAA,CAAM,EAAA,IACvB,MAAA,CAAO,OAAO,KAAA,CAAM,UAAA,CAAW,KAAK,CAAA,CAAE,CAAC,CAAA,IACvC,EAAA;AAAA,IAER;AACA,IAAA,IAAI,OAAO,KAAA,CAAM,UAAA,CAAW,KAAA,KAAU,QAAA,EAAU;AAC5C,MAAA,OAAO,MAAM,UAAA,CAAW,KAAA;AAAA,IAC5B;AAAA,EACJ;AAGA,EAAA,OAAO,KAAA,CAAM,GAAA,EAAK,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA,CAAE,OAAA,CAAQ,OAAA,EAAS,CAAC,CAAA,KAAc,CAAA,CAAE,WAAA,EAAa,CAAA,IAAK,EAAA;AAC7F;AAGO,SAAS,iBAAiB,KAAA,EAAoB;AACjD,EAAA,IAAI,CAAC,KAAA,IAAS,KAAA,CAAM,UAAU,IAAA,IAAQ,KAAA,CAAM,UAAU,MAAA,EAAW;AAC7D,IAAA,OAAO,EAAA;AAAA,EACX;AAEA,EAAA,QAAQ,MAAM,IAAA;AAAM,IAChB,KAAK,SAAA;AACD,MAAA,OAAO,KAAA,CAAM,QAAQ,KAAA,GAAQ,IA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A,IAAI,CAAC,IAAA,EAAM;AACP,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,+BAAA,EAAgC;AAAA,EACpE;AAEA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAEtC,EAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AACtB,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,0CAAA,EAA2C;AAAA,EAC/E;AAEA,EAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAC3B;AAGO,SAAS,gBAAA,CAAiB,KAAA,EAAY,SAAA,GAAoB,YAAA,EAAgC;AAC7F,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,IAAa,UAAU,EAAA,EAAI;AACvD,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,CAAA,EAAG,SAAS,CAAA,YAAA,CAAA,EAAe;AAAA,EAC/D;AAEA,EAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAC3B","file":"utils.cjs","sourcesContent":["// Block utilities (extracted from index.ts)\n\nexport interface Block {\n id: string;\n key: string;\n type: string;\n properties: any;\n value: any;\n}\n\nexport interface Collection {\n id: string;\n blocks: Block[];\n}\n\nexport interface CollectionEntry {\n id: string;\n collection_id: string;\n blocks: Block[];\n}\n\n\nexport function getBlockLabel(block: any, locale: string = 'en'): string {\n if (!block) return \"\";\n\n if (block.properties?.label) {\n if (typeof block.properties.label === \"object\") {\n return (\n block.properties.label[locale] ||\n block.properties.label.en ||\n Object.values(block.properties.label)[0] ||\n \"\"\n );\n }\n if (typeof block.properties.label === \"string\") {\n return block.properties.label;\n }\n }\n \n // Convert key to readable format\n return block.key?.replace(/_/g, ' ').replace(/\\b\\w/g, (l: string) => l.toUpperCase()) || \"\";\n}\n\n\nexport function formatBlockValue(block: any): string {\n if (!block || block.value === null || block.value === undefined) {\n return \"\";\n }\n\n switch (block.type) {\n case \"BOOLEAN\":\n return block.value ? \"Yes\" : \"No\";\n case \"NUMBER\":\n // Handle date/datetime variants\n if (block.properties?.variant === \"DATE\" || block.properties?.variant === \"DATE_TIME\") {\n try {\n return new Date(block.value).toLocaleDateString();\n } catch (e) {\n return String(block.value);\n }\n }\n return String(block.value);\n case \"RELATIONSHIP\":\n if (Array.isArray(block.value) && block.value.length > 0) {\n const firstValue = block.value[0];\n if (firstValue && firstValue.mimeType) {\n return firstValue.name || firstValue.id || \"Media\";\n }\n return firstValue.title || firstValue.name || firstValue.id || \"Entry\";\n }\n return String(block.value);\n default:\n return String(block.value);\n }\n}\n\nexport function prepareBlocksForSubmission(formData: any): any[] {\n const preparedBlocks = [];\n\n Object.keys(formData).forEach((key) => {\n if (formData[key] !== null && formData[key] !== undefined) {\n preparedBlocks.push({\n key,\n value: [formData[key]],\n });\n }\n });\n\n return preparedBlocks;\n}\n\nexport function extractBlockValues(blocks: any[]): Record<string, any> {\n const values: Record<string, any> = {};\n\n blocks.forEach((block) => {\n if (block.value && block.value.length > 0) {\n values[block.key] = block.value[0];\n } else {\n values[block.key] = null;\n }\n });\n\n return values;\n}\n\n// Extract localized text value from a block, handling multilingual content\nexport function getBlockTextValue(block: any, locale: string = 'en'): string {\n if (!block || !block.value || block.value.length === 0) return '';\n \n const firstValue = block.value[0];\n \n // Handle multilingual object\n if (typeof firstValue === 'object' && firstValue !== null) {\n // Try specified locale first, then 'en', then first available language\n if (firstValue[locale]) return firstValue[locale];\n if (firstValue.en) return firstValue.en;\n const values = Object.values(firstValue);\n return String(values[0] || '');\n }\n \n // Handle simple string\n return String(firstValue);\n}\n\n// Legacy functions for backward compatibility\nexport const getBlockValue = (entry: any, blockKey: string) => {\n if (!entry || !entry.blocks) return null;\n\n const block = entry.blocks.find((f: any) => f.key === blockKey);\n\n if (!block || !block.value || block.value.length === 0) return null;\n\n return block.value[0];\n};\n\nexport const getBlockValues = (entry: any, blockKey: string) => {\n if (!entry || !entry.blocks) return null;\n\n const block = entry.blocks.find((f: any) => f.key === blockKey);\n\n if (!block || !block.value || block.value.length === 0) return null;\n\n return block.value;\n};\n\nfunction unwrapBlock(block: any, locale: string) {\n if (!block?.type || block.value === undefined) return block;\n\n // Nested objects / lists → recurse for every child\n if (block.type === \"BLOCK\") {\n return block.value.map((obj: Record<string, any>) => {\n const parsed: Record<string, any> = {};\n for (const [k, v] of Object.entries(obj)) {\n parsed[k] = unwrapBlock(v, locale);\n }\n return parsed;\n });\n }\n\n // Primitive leaves (text/number/boolean/media …)\n const isLocalized = block.type === \"TEXT\";\n const isList =\n block.properties?.ui === \"list\" ||\n (block.properties?.maxValues ?? 1) > 1 ||\n block.value.length > 1;\n\n if (isList) {\n return isLocalized\n ? block.value.map((v: Record<string, any>) => v[locale] || v[\"en\"])\n : [...block.value];\n }\n\n return isLocalized ? block.value[0][locale] || block.value[0][\"en\"] : block.value[0];\n}\n\nexport const getBlockObjectValues = (entry: any, blockKey: string, locale = \"en\") => {\n if (!entry) {\n return [];\n }\n\n const values = getBlockValues(entry, blockKey); // top‑level list\n\n const parsed = values.map((obj: Record<string, any>) => {\n const res = obj.value.reduce((acc: any, current: any) => {\n acc[current.key] = unwrapBlock(current, locale);\n\n return acc;\n }, {});\n\n return res;\n });\n\n return parsed;\n};\n\nexport const getBlockFromArray = (entry: any, blockKey: string, locale = \"en\") => {\n if (!entry) {\n return [];\n }\n\n const values = getBlockValues(entry, blockKey); // top‑level list\n\n return values.reduce((acc: any, current: any) => {\n acc[current.key] = unwrapBlock(current, locale);\n return acc;\n });\n};\n\nexport const getImageUrl = (imageBlock: any, isBlock = true, storageUrl: string = \"https://storage.arky.io/dev\") => {\n if (!imageBlock) return null;\n\n // Helper to check if URL is external\n const isExternalUrl = (url: string) => {\n return url.startsWith('http://') || url.startsWith('https://');\n };\n\n // Handle relationship blocks with media\n if (imageBlock.type === 'RELATIONSHIP' && Array.isArray(imageBlock.value)) {\n const mediaValue = imageBlock.value[0];\n if (mediaValue && mediaValue.mimeType) {\n // Handle media with resolutions structure\n if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {\n const url = mediaValue.resolutions.original.url;\n return isExternalUrl(url) ? url : `${storageUrl}/${url}`;\n }\n \n // Handle direct URL on media\n if (mediaValue.url) {\n return isExternalUrl(mediaValue.url) ? mediaValue.url : `${storageUrl}/${mediaValue.url}`;\n }\n }\n return null;\n }\n\n if (isBlock) {\n if (typeof imageBlock === \"string\") {\n // Check if it's already a full URL\n if (isExternalUrl(imageBlock)) {\n return imageBlock;\n }\n return `${storageUrl}/${imageBlock}`;\n }\n\n if (imageBlock.url) {\n // Check if it's already a full URL\n if (isExternalUrl(imageBlock.url)) {\n return imageBlock.url;\n }\n return `${storageUrl}/${imageBlock.url}`;\n }\n }\n\n if (\n imageBlock.resolutions &&\n imageBlock.resolutions.original &&\n imageBlock.resolutions.original.url\n ) {\n const url = imageBlock.resolutions.original.url;\n // Check if it's already a full URL\n if (isExternalUrl(url)) {\n return url;\n }\n return `${storageUrl}/${url}`;\n }\n\n return null;\n};\n\nexport const translateMap = (labels: any, lang: string, fallback = \"unknown\") => {\n let parsedLang = \"en\";\n\n if (lang === \"sr\") {\n parsedLang = \"bih\";\n }\n\n if (!labels) {\n return fallback;\n }\n\n const label = labels[parsedLang];\n if (!label) {\n return fallback;\n }\n\n return label;\n};","// Error handling utilities (combined from errorCodes.ts and errorHelpers.ts)\n\n// Comprehensive error code system with both numeric codes and named constants\nexport const ERROR_CODES = {\n // General errors\n \"GENERAL.001\": \"GENERAL.BAD_REQUEST\",\n \"GENERAL.002\": \"GENERAL.VALIDATION_ERROR\",\n \"GENERAL.003\": \"GENERAL.FORBIDDEN_ERROR\",\n \"GENERAL.004\": \"GENERAL.INTERNAL_SERVER_ERROR\",\n \"GENERAL.005\": \"GENERAL.UNAUTHORIZED\",\n \"GENERAL.006\": \"GENERAL.UNAUTHENTICATED\",\n\n // Google/OAuth errors\n \"GOOGLE.001\": \"GOOGLE.INVALID_ORIGIN_URI\",\n \"GOOGLE.002\": \"GOOGLE.INVALID_REDIRECT_URI\",\n \"GOOGLE.003\": \"GOOGLE.FAILED_TO_CALL_API\",\n \"GOOGLE.004\": \"GOOGLE.FAILED_LOGIN\",\n \"GOOGLE.005\": \"GOOGLE.FAILED_LOGOUT\",\n \"GOOGLE.006\": \"GOOGLE.FAILED_REFRESH_TOKEN\",\n \"GOOGLE.007\": \"GOOGLE.INVALID_PROVIDER_PASSED\",\n\n // User errors\n \"USER.001\": \"USER.NOT_FOUND\",\n \"USER.002\": \"USER.FAILED_TO_CREATE\",\n \"USER.003\": \"USER.FAILED_TO_UPDATE\",\n \"USER.004\": \"USER.FAILED_TO_DELETE\",\n \"USER.005\": \"USER.EMAIL_EXISTS\",\n \"USER.006\": \"USER.FAILED_TO_GET_UPLOAD_URL\",\n\n // Business errors\n \"BUSINESS.001\": \"BUSINESS.NOT_FOUND\",\n \"BUSINESS.002\": \"BUSINESS.FAILED_TO_CREATE\",\n \"BUSINESS.003\": \"BUSINESS.FAILED_TO_UPDATE\",\n \"BUSINESS.004\": \"BUSINESS.FAILED_TO_DELETE\",\n \"BUSINESS.005\": \"BUSINESS.FAILED_TO_GET_UPLOAD_URL\",\n \"BUSINESS.006\": \"BUSINESS.NAME_REQUIRED\",\n \"BUSINESS.007\": \"BUSINESS.BUSINESS_ID_REQUIRED\",\n \"BUSINESS.010\": \"BUSINESS.DESCRIPTION_REQUIRED\",\n \"BUSINESS.011\": \"BUSINESS.SLUG_INVALID\",\n\n // Provider errors\n \"PROVIDER.001\": \"PROVIDER.NOT_FOUND\",\n \"PROVIDER.002\": \"PROVIDER.FAILED_TO_CREATE\",\n \"PROVIDER.003\": \"PROVIDER.FAILED_TO_UPDATE\",\n \"PROVIDER.004\": \"PROVIDER.FAILED_TO_DELETE\",\n \"PROVIDER.005\": \"PROVIDER.FAILED_TO_GET_UPLOAD_URL\",\n \"PROVIDER.006\": \"PROVIDER.NAME_REQUIRED\",\n \"PROVIDER.007\": \"PROVIDER.BUSINESS_ID_REQUIRED\",\n \"PROVIDER.008\": \"PROVIDER.DESCRIPTION_REQUIRED\",\n};\n\n// Named error constants for direct access\nexport const ERROR_CONSTANTS = {\n GENERAL: {\n BAD_REQUEST: \"GENERAL.BAD_REQUEST\",\n VALIDATION_ERROR: \"GENERAL.VALIDATION_ERROR\",\n FORBIDDEN_ERROR: \"GENERAL.FORBIDDEN_ERROR\",\n INTERNAL_SERVER_ERROR: \"GENERAL.INTERNAL_SERVER_ERROR\",\n UNAUTHORIZED: \"GENERAL.UNAUTHORIZED\",\n UNAUTHENTICATED: \"GENERAL.UNAUTHENTICATED\",\n },\n USER: {\n NOT_FOUND: \"USER.NOT_FOUND\",\n FAILED_TO_CREATE: \"USER.FAILED_TO_CREATE\",\n FAILED_TO_UPDATE: \"USER.FAILED_TO_UPDATE\",\n FAILED_TO_DELETE: \"USER.FAILED_TO_DELETE\",\n EMAIL_EXISTS: \"USER.EMAIL_EXISTS\",\n FAILED_TO_GET_UPLOAD_URL: \"USER.FAILED_TO_GET_UPLOAD_URL\",\n },\n BUSINESS: {\n NOT_FOUND: \"BUSINESS.NOT_FOUND\",\n FAILED_TO_CREATE: \"BUSINESS.FAILED_TO_CREATE\",\n FAILED_TO_UPDATE: \"BUSINESS.FAILED_TO_UPDATE\",\n FAILED_TO_DELETE: \"BUSINESS.FAILED_TO_DELETE\",\n FAILED_TO_GET_UPLOAD_URL: \"BUSINESS.FAILED_TO_GET_UPLOAD_URL\",\n NAME_REQUIRED: \"BUSINESS.NAME_REQUIRED\",\n BUSINESS_ID_REQUIRED: \"BUSINESS.BUSINESS_ID_REQUIRED\",\n DESCRIPTION_REQUIRED: \"BUSINESS.DESCRIPTION_REQUIRED\",\n SLUG_INVALID: \"BUSINESS.SLUG_INVALID\",\n },\n};\n\nexport type ServerError = {\n message: string;\n error: string;\n statusCode: number;\n validationErrors: {\n field: string;\n error: string;\n }[];\n};\n\nexport type ValidationError = {\n field: string;\n error: string;\n};\n\nexport type RequestError = {\n validationErrors: ValidationError[];\n};\n\n// Utility functions for error handling\nexport function getErrorMessage(code: string): string {\n return ERROR_CODES[code as keyof typeof ERROR_CODES] || code;\n}\n\nexport function isErrorCode(code: string): boolean {\n return code in ERROR_CODES;\n}\n\nexport const transformErrors = (zodError: any): ValidationError[] => {\n const customErrors: ValidationError[] = [];\n\n if (!zodError.issues) return customErrors;\n\n zodError.issues.forEach((issue: any) => {\n const field = issue.path.join(\".\");\n const error = issue.message;\n\n if (\n !customErrors.some(\n (customError) =>\n customError.field === field && customError.error === error\n )\n ) {\n customErrors.push({ field, error });\n }\n });\n\n return customErrors;\n};\n\nexport const convertServerErrorToRequestError = (\n serverError: ServerError,\n renameRules?: { [key: string]: string }\n): RequestError => {\n return {\n ...serverError,\n validationErrors: serverError.validationErrors.map((validationError) => {\n const field =\n renameRules && renameRules[validationError.field]\n ? renameRules[validationError.field]\n : validationError.field;\n\n return {\n field: field,\n error: validationError.error || \"GENERAL.VALIDATION_ERROR\",\n };\n }),\n };\n};\n\n// Export for backward compatibility\nexport const errors = ERROR_CONSTANTS;\nexport default ERROR_CODES;\n","/**\n * Maps currency codes to their display symbols\n */\nexport function getCurrencySymbol(currency: string): string {\n const currencySymbols: Record<string, string> = {\n USD: '$',\n EUR: '€',\n GBP: '£',\n CAD: 'C$',\n AUD: 'A$',\n JPY: '¥',\n CHF: 'CHF',\n SEK: 'kr',\n NOK: 'kr',\n DKK: 'kr',\n PLN: 'zł',\n CZK: 'Kč',\n HUF: 'Ft',\n RON: 'lei',\n BGN: 'лв',\n HRK: 'kn',\n RSD: 'дин',\n BAM: 'KM',\n MKD: 'ден',\n ALL: 'L',\n TRY: '₺',\n RUB: '₽',\n UAH: '₴',\n BYN: 'Br',\n CNY: '¥',\n INR: '₹',\n KRW: '₩',\n THB: '฿',\n VND: '₫',\n SGD: 'S$',\n MYR: 'RM',\n IDR: 'Rp',\n PHP: '₱',\n BRL: 'R$',\n ARS: '$',\n CLP: '$',\n COP: '$',\n PEN: 'S/',\n MXN: '$',\n ZAR: 'R',\n EGP: 'E£',\n NGN: '₦',\n KES: 'KSh',\n GHS: '₵',\n MAD: 'DH',\n TND: 'د.ت',\n DZD: 'د.ج',\n LYD: 'ل.د',\n AED: 'د.إ',\n SAR: 'ر.س',\n QAR: 'ر.ق',\n KWD: 'د.ك',\n BHD: 'ب.د',\n OMR: 'ر.ع',\n JOD: 'د.أ',\n LBP: 'ل.ل',\n SYP: 'ل.س',\n IQD: 'ع.د',\n IRR: '﷼',\n AFN: '؋',\n PKR: '₨',\n LKR: '₨',\n NPR: '₨',\n BDT: '৳',\n MMK: 'K',\n LAK: '₭',\n KHR: '៛',\n MNT: '₮',\n KZT: '₸',\n UZS: 'лв',\n KGS: 'лв',\n TJS: 'SM',\n TMT: 'T',\n AZN: '₼',\n GEL: '₾',\n AMD: '֏',\n BYR: 'p.',\n MDL: 'L'\n };\n\n return currencySymbols[currency.toUpperCase()] || currency;\n}\n\n/**\n * List of currencies where the symbol appears after the amount\n */\nexport const SYMBOL_AFTER_CURRENCIES = ['SEK', 'NOK', 'DKK', 'PLN', 'CZK', 'HUF', 'RON', 'BGN', 'HRK'];\n\n/**\n * Check if currency symbol should be placed after the amount\n */\nexport function isSymbolAfterCurrency(currency: string): boolean {\n return SYMBOL_AFTER_CURRENCIES.includes(currency.toUpperCase());\n}","// Price formatting utilities - Centralized currency and price operations\nimport type { Payment, PaymentMethodType, Price } from '../types';\nimport { getCurrencySymbol, isSymbolAfterCurrency } from './currency';\n\nconst MARKET_CURRENCIES = {\n 'US': 'USD',\n 'EU': 'EUR',\n 'UK': 'GBP',\n 'CA': 'CAD',\n 'AU': 'AUD'\n} as const;\n\n// Convert minor units (cents) to major units (dollars)\nexport function convertToMajor(minorAmount: number): number {\n return (minorAmount ?? 0) / 100;\n}\n\n// Convert major units to minor units\nexport function convertToMinor(majorAmount: number): number {\n return Math.round((majorAmount ?? 0) * 100);\n}\n\n// Get currency from market ID\nexport function getCurrencyFromMarket(marketId: string): string {\n return MARKET_CURRENCIES[marketId as keyof typeof MARKET_CURRENCIES] || 'USD';\n}\n\n// Format currency amount with symbol (locale-aware positioning)\nexport function formatCurrencyAmount(\n amount: number,\n currency: string,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n customSymbol?: string;\n } = {}\n): string {\n const { showSymbols = true, decimalPlaces = 2, customSymbol } = options;\n const roundedAmount = amount.toFixed(decimalPlaces);\n\n if (!showSymbols) {\n return `${roundedAmount} ${currency}`;\n }\n\n const symbol = customSymbol || getCurrencySymbol(currency);\n\n // Use locale-specific symbol positioning\n if (isSymbolAfterCurrency(currency)) {\n return `${roundedAmount} ${symbol}`;\n }\n\n return `${symbol}${roundedAmount}`;\n}\n\n// Format minor units with currency\nexport function formatMinor(\n amountMinor: number,\n currency: string,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n customSymbol?: string;\n } = {}\n): string {\n const major = convertToMajor(amountMinor);\n return formatCurrencyAmount(major, currency, options);\n}\n\n// Format Payment structure for display\nexport function formatPayment(\n payment: Payment,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n showBreakdown?: boolean;\n } = {}\n): string {\n if (!payment) return '';\n\n const { showSymbols = true, decimalPlaces = 2, showBreakdown = false } = options;\n\n if (showBreakdown) {\n const subtotal = formatMinor(payment.subtotal, payment.currency, { showSymbols, decimalPlaces });\n const discount = (payment.discount ?? 0) > 0 ? formatMinor(payment.discount, payment.currency, { showSymbols, decimalPlaces }) : null;\n const taxAmount = payment.tax?.amount ?? 0;\n const tax = taxAmount > 0 ? formatMinor(taxAmount, payment.currency, { showSymbols, decimalPlaces }) : null;\n const total = formatMinor(payment.total, payment.currency, { showSymbols, decimalPlaces });\n\n let result = `Subtotal: ${subtotal}`;\n if (discount) result += `, Discount: -${discount}`;\n if (tax) result += `, Tax: ${tax}`;\n result += `, Total: ${total}`;\n return result;\n }\n\n return formatMinor(payment.total, payment.currency, { showSymbols, decimalPlaces });\n}\n\n// Format market-based prices (from product variants)\nexport function getMarketPrice(\n prices: Price[],\n marketId: string,\n businessMarkets?: any[],\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n showCompareAt?: boolean;\n fallbackMarket?: string;\n } = {}\n): string {\n if (!prices || prices.length === 0) return '';\n\n const {\n showSymbols = true,\n decimalPlaces = 2,\n showCompareAt = true,\n fallbackMarket,\n } = options;\n\n // Find price for the specific market\n let price = prices.find(p => p.market === marketId);\n\n // Fallback to fallback market (if provided) or first available\n if (!price && fallbackMarket) {\n price = prices.find(p => p.market === fallbackMarket);\n }\n if (!price) {\n price = prices[0];\n }\n\n if (!price) return '';\n\n let currency: string;\n let symbol: string;\n\n // If we have business markets, use the currency directly from market data\n if (businessMarkets) {\n const marketData = businessMarkets.find(m => m.id === price.market || m.code === price.market);\n if (marketData?.currency) {\n currency = marketData.currency;\n symbol = getCurrencySymbol(currency);\n } else {\n currency = getCurrencyFromMarket(price.market);\n symbol = getCurrencySymbol(currency);\n }\n } else {\n currency = getCurrencyFromMarket(price.market);\n symbol = getCurrencySymbol(currency);\n }\n\n // Format price with custom symbol\n const formattedPrice = formatMinor(price.amount ?? 0, currency, {\n showSymbols,\n decimalPlaces,\n customSymbol: symbol\n });\n\n // Add compare-at price if available\n if (showCompareAt && price.compareAt && price.compareAt > (price.amount ?? 0)) {\n const formattedCompareAt = formatMinor(price.compareAt, currency, {\n showSymbols,\n decimalPlaces,\n customSymbol: symbol\n });\n return `${formattedPrice} was ${formattedCompareAt}`;\n }\n\n return formattedPrice;\n}\n\n// Get price amount from market-based prices (for calculations)\nexport function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number {\n if (!prices || prices.length === 0) return 0;\n\n let price = prices.find(p => p.market === marketId);\n if (!price && fallbackMarket) {\n price = prices.find(p => p.market === fallbackMarket);\n }\n if (!price) {\n price = prices[0];\n }\n\n // Amounts are stored in minor units (e.g., cents)\n return price?.amount || 0;\n}\n\n// Create Payment structure for checkout (all amounts in minor units)\nexport function createPaymentForCheckout(\n subtotalMinor: number,\n marketId: string,\n currency: string,\n paymentMethod: any,\n options: {\n discount?: number;\n taxAmount?: number;\n taxRateBps?: number;\n promoCode?: {\n id: string;\n code: string;\n type: string;\n value: number;\n };\n } = {}\n): Payment {\n const { discount = 0, taxAmount = 0, taxRateBps = 0, promoCode } = options;\n const total = subtotalMinor - discount + taxAmount;\n\n return {\n currency,\n market: marketId,\n subtotal: subtotalMinor,\n shipping: 0,\n discount,\n total,\n type: paymentMethod,\n ...(taxAmount > 0 && {\n tax: {\n amount: taxAmount,\n rateBps: taxRateBps,\n lines: [],\n },\n }),\n ...(promoCode && { promoCode }),\n };\n}\n","import { getImageUrl } from \"./blocks\";\n\nexport async function fetchSvgContent(mediaObject: any): Promise<string | null> {\n\tif (!mediaObject) return null;\n\n\tconst svgUrl = getImageUrl(mediaObject, false);\n\n\ttry {\n\t\tconst response = await fetch(svgUrl);\n\n\t\tif (!response.ok) {\n\t\t\tconsole.error(`Failed to fetch SVG: ${response.status} ${response.statusText}`);\n\t\t\treturn null;\n\t\t}\n\n\t\tconst svgContent = await response.text();\n\t\treturn svgContent;\n\t} catch (error) {\n\t\tconsole.error(\"Error fetching SVG:\", error);\n\t\treturn null;\n\t}\n}\n\n/**\n * Server-side helper for Astro components to fetch SVG content during SSR\n *\n * @param mediaObject The media object from the CMS\n * @returns The SVG content as a string, or empty string on failure\n */\nexport async function getSvgContentForAstro(mediaObject: any): Promise<string> {\n\ttry {\n\t\tconst svgContent = await fetchSvgContent(mediaObject);\n\t\treturn svgContent || \"\";\n\t} catch (error) {\n\t\tconsole.error(\"Error getting SVG content for Astro:\", error);\n\t\treturn \"\";\n\t}\n}\n\n/**\n * Client-side helper to fetch and inject SVG content into DOM elements\n *\n * @param mediaObject The media object from the CMS\n * @param targetElement The DOM element to inject the SVG into\n * @param className Optional CSS class to add to the SVG\n */\nexport async function injectSvgIntoElement(\n\tmediaObject: any,\n\ttargetElement: HTMLElement,\n\tclassName?: string,\n): Promise<void> {\n\tif (!targetElement) return;\n\n\ttry {\n\t\tconst svgContent = await fetchSvgContent(mediaObject);\n\n\t\tif (svgContent) {\n\t\t\ttargetElement.innerHTML = svgContent;\n\n\t\t\t// Add class if provided\n\t\t\tif (className) {\n\t\t\t\tconst svgElement = targetElement.querySelector(\"svg\");\n\t\t\t\tif (svgElement) {\n\t\t\t\t\tsvgElement.classList.add(...className.split(\" \"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\"Error injecting SVG:\", error);\n\t}\n}","// Define locales inline since we don't have @lib/i18n in SDK\nconst locales = ['en', 'sr-latn'] as const;\nconst localeMap: Record<typeof locales[number], string> = {\n\t'en': 'en-US',\n\t'sr-latn': 'sr-RS'\n};\n\n/**\n * * returns \"slugified\" text.\n * @param text: string - text to slugify\n */\nexport function slugify(text: string): string {\n\treturn text\n\t\t.toString()\n\t\t.toLowerCase() // convert to lowercase\n\t\t.replace(/\\s+/g, \"-\") // replace spaces with -\n\t\t.replace(/[^\\w-]+/g, \"\") // remove all non-word chars\n\t\t.replace(/--+/g, \"-\") // replace multiple dashes with single dash\n\t\t.replace(/^-+/, \"\") // trim dash from start of text\n\t\t.replace(/-+$/, \"\"); // trim dash from end of text\n}\n\n/**\n * * returns \"humanized\" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest\n * @param text: string - text to humanize\n */\nexport function humanize(text: string): string {\n\tconst slugifiedText = slugify(text);\n\treturn (\n\t\tslugifiedText\n\t\t\t.replace(/-/g, \" \") // replace \"-\" with space\n\t\t\t// .toLowerCase();\n\t\t\t.replace(\n\t\t\t\t// upper case first letter of every word, and lower case the rest\n\t\t\t\t/\\w\\S*/g,\n\t\t\t\t(w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase(),\n\t\t\t)\n\t);\n}\n\n// --------------------------------------------------------\n/**\n * * returns \"categorified\" text. runs slugify() and then replaces - with space and upper cases everything\n * @param text: string - text to categorify\n * @returns string - categorified text\n */\nexport function categorify(text: string): string {\n\tconst slugifiedText = slugify(text);\n\treturn slugifiedText\n\t\t.replace(/-/g, \" \") // replace \"-\" with space\n\t\t.toUpperCase();\n}\n\n// --------------------------------------------------------\n/**\n * * returns a nicely formatted string of the date passed\n * @param date: string | number | Date - date to format\n * @param locale: string - locale to format the date in\n * @returns string - formatted date\n */\nexport function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string {\n\tlet localeString = \"en-US\";\n\n\tif (locales.includes(locale)) {\n\t\tlocaleString = localeMap[locale];\n\t}\n\n\treturn new Date(date).toLocaleDateString(localeString, {\n\t\ttimeZone: \"UTC\",\n\t\tyear: \"numeric\",\n\t\tmonth: \"short\",\n\t\tday: \"numeric\",\n\t});\n}","// Timezone utilities (moved from Reservation folder)\n\nexport const tzGroups = [\n {\n label: \"US\",\n zones: [\n { label: \"Eastern Time\", value: \"America/New_York\" },\n { label: \"Central Time\", value: \"America/Chicago\" },\n { label: \"Mountain Time\", value: \"America/Denver\" },\n { label: \"Pacific Time\", value: \"America/Los_Angeles\" },\n ],\n },\n {\n label: \"Europe\",\n zones: [\n { label: \"London\", value: \"Europe/London\" },\n { label: \"Paris\", value: \"Europe/Paris\" },\n { label: \"Berlin\", value: \"Europe/Berlin\" },\n { label: \"Rome\", value: \"Europe/Rome\" },\n ],\n },\n {\n label: \"Asia\",\n zones: [\n { label: \"Tokyo\", value: \"Asia/Tokyo\" },\n { label: \"Shanghai\", value: \"Asia/Shanghai\" },\n { label: \"Mumbai\", value: \"Asia/Kolkata\" },\n { label: \"Dubai\", value: \"Asia/Dubai\" },\n ],\n },\n];\n\nexport function findTimeZone(groups: typeof tzGroups): string {\n try {\n const detected = Intl.DateTimeFormat().resolvedOptions().timeZone;\n \n // Check if detected timezone is in our list\n for (const group of groups) {\n for (const zone of group.zones) {\n if (zone.value === detected) {\n return detected;\n }\n }\n }\n \n // Fallback to UTC if not found\n return \"UTC\";\n } catch (e) {\n // Fallback to UTC if detection fails\n return \"UTC\";\n }\n}","// Validation utilities\n\nexport interface ValidationResult {\n isValid: boolean;\n error?: string;\n}\n\n// Phone number validation\nexport function validatePhoneNumber(phone: string): ValidationResult {\n if (!phone) {\n return { isValid: false, error: 'Phone number is required' };\n }\n \n const cleaned = phone.replace(/\\D/g, '');\n \n if (cleaned.length < 8) {\n return { isValid: false, error: 'Phone number is too short' };\n }\n \n if (cleaned.length > 15) {\n return { isValid: false, error: 'Phone number is too long' };\n }\n \n return { isValid: true };\n}\n\n// Email validation\nexport function validateEmail(email: string): ValidationResult {\n if (!email) {\n return { isValid: false, error: 'Email is required' };\n }\n \n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n \n if (!emailRegex.test(email)) {\n return { isValid: false, error: 'Please enter a valid email address' };\n }\n \n return { isValid: true };\n}\n\n// Verification code validation (4-digit codes)\nexport function validateVerificationCode(code: string): ValidationResult {\n if (!code) {\n return { isValid: false, error: 'Verification code is required' };\n }\n \n const cleaned = code.replace(/\\D/g, '');\n \n if (cleaned.length !== 4) {\n return { isValid: false, error: 'Please enter a 4-digit verification code' };\n }\n \n return { isValid: true };\n}\n\n// Generic required field validation\nexport function validateRequired(value: any, fieldName: string = 'This field'): ValidationResult {\n if (value === null || value === undefined || value === '') {\n return { isValid: false, error: `${fieldName} is required` };\n }\n \n return { isValid: true };\n}"]}
1
+ {"version":3,"sources":["../src/utils/blocks.ts","../src/utils/errors.ts","../src/utils/currency.ts","../src/utils/price.ts","../src/utils/svg.ts","../src/utils/text.ts","../src/utils/timezone.ts","../src/utils/validation.ts"],"names":[],"mappings":";;;AAsBO,SAAS,aAAA,CAAc,KAAA,EAAY,MAAA,GAAiB,IAAA,EAAc;AACrE,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AAEnB,EAAA,IAAI,KAAA,CAAM,YAAY,KAAA,EAAO;AACzB,IAAA,IAAI,OAAO,KAAA,CAAM,UAAA,CAAW,KAAA,KAAU,QAAA,EAAU;AAC5C,MAAA,OACI,MAAM,UAAA,CA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AAA,EAAgC;AAAA,EACpE;AAEA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAEtC,EAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AACtB,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,0CAAA,EAA2C;AAAA,EAC/E;AAEA,EAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAC3B;AAGO,SAAS,gBAAA,CAAiB,KAAA,EAAY,SAAA,GAAoB,YAAA,EAAgC;AAC7F,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,IAAa,UAAU,EAAA,EAAI;AACvD,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,CAAA,EAAG,SAAS,CAAA,YAAA,CAAA,EAAe;AAAA,EAC/D;AAEA,EAAA,OAAO,EAAE,SAAS,IAAA,EAAK;AAC3B","file":"utils.cjs","sourcesContent":["// Block utilities (extracted from index.ts)\n\nexport interface Block {\n id: string;\n key: string;\n type: string;\n properties: any;\n value: any;\n}\n\nexport interface Collection {\n id: string;\n blocks: Block[];\n}\n\nexport interface CollectionEntry {\n id: string;\n collection_id: string;\n blocks: Block[];\n}\n\n\nexport function getBlockLabel(block: any, locale: string = 'en'): string {\n if (!block) return \"\";\n\n if (block.properties?.label) {\n if (typeof block.properties.label === \"object\") {\n return (\n block.properties.label[locale] ||\n block.properties.label.en ||\n Object.values(block.properties.label)[0] ||\n \"\"\n );\n }\n if (typeof block.properties.label === \"string\") {\n return block.properties.label;\n }\n }\n \n // Convert key to readable format\n return block.key?.replace(/_/g, ' ').replace(/\\b\\w/g, (l: string) => l.toUpperCase()) || \"\";\n}\n\n\nexport function formatBlockValue(block: any): string {\n if (!block || block.value === null || block.value === undefined) {\n return \"\";\n }\n\n switch (block.type) {\n case \"BOOLEAN\":\n return block.value ? \"Yes\" : \"No\";\n case \"NUMBER\":\n // Handle date/datetime variants\n if (block.properties?.variant === \"DATE\" || block.properties?.variant === \"DATE_TIME\") {\n try {\n return new Date(block.value).toLocaleDateString();\n } catch (e) {\n return String(block.value);\n }\n }\n return String(block.value);\n case \"RELATIONSHIP\":\n if (Array.isArray(block.value) && block.value.length > 0) {\n const firstValue = block.value[0];\n if (firstValue && firstValue.mimeType) {\n return firstValue.name || firstValue.id || \"Media\";\n }\n return firstValue.title || firstValue.name || firstValue.id || \"Entry\";\n }\n return String(block.value);\n default:\n return String(block.value);\n }\n}\n\nexport function prepareBlocksForSubmission(formData: any): any[] {\n const preparedBlocks = [];\n\n Object.keys(formData).forEach((key) => {\n if (formData[key] !== null && formData[key] !== undefined) {\n preparedBlocks.push({\n key,\n value: [formData[key]],\n });\n }\n });\n\n return preparedBlocks;\n}\n\nexport function extractBlockValues(blocks: any[]): Record<string, any> {\n const values: Record<string, any> = {};\n\n blocks.forEach((block) => {\n if (block.value && block.value.length > 0) {\n values[block.key] = block.value[0];\n } else {\n values[block.key] = null;\n }\n });\n\n return values;\n}\n\n// Extract localized text value from a block, handling multilingual content\nexport function getBlockTextValue(block: any, locale: string = 'en'): string {\n if (!block || !block.value || block.value.length === 0) return '';\n \n const firstValue = block.value[0];\n \n // Handle multilingual object\n if (typeof firstValue === 'object' && firstValue !== null) {\n // Try specified locale first, then 'en', then first available language\n if (firstValue[locale]) return firstValue[locale];\n if (firstValue.en) return firstValue.en;\n const values = Object.values(firstValue);\n return String(values[0] || '');\n }\n \n // Handle simple string\n return String(firstValue);\n}\n\n// Legacy functions for backward compatibility\nexport const getBlockValue = (entry: any, blockKey: string) => {\n if (!entry || !entry.blocks) return null;\n\n const block = entry.blocks.find((f: any) => f.key === blockKey);\n\n if (!block || !block.value || block.value.length === 0) return null;\n\n return block.value[0];\n};\n\nexport const getBlockValues = (entry: any, blockKey: string) => {\n if (!entry || !entry.blocks) return null;\n\n const block = entry.blocks.find((f: any) => f.key === blockKey);\n\n if (!block || !block.value || block.value.length === 0) return null;\n\n return block.value;\n};\n\nfunction unwrapBlock(block: any, locale: string) {\n if (!block?.type || block.value === undefined) return block;\n\n // Nested objects / lists → recurse for every child\n if (block.type === \"BLOCK\") {\n return block.value.map((obj: Record<string, any>) => {\n const parsed: Record<string, any> = {};\n for (const [k, v] of Object.entries(obj)) {\n parsed[k] = unwrapBlock(v, locale);\n }\n return parsed;\n });\n }\n\n // Primitive leaves (text/number/boolean/media …)\n const isLocalized = block.type === \"TEXT\";\n const isList =\n block.properties?.ui === \"list\" ||\n (block.properties?.maxValues ?? 1) > 1 ||\n block.value.length > 1;\n\n if (isList) {\n return isLocalized\n ? block.value.map((v: Record<string, any>) => v[locale] || v[\"en\"])\n : [...block.value];\n }\n\n return isLocalized ? block.value[0][locale] || block.value[0][\"en\"] : block.value[0];\n}\n\nexport const getBlockObjectValues = (entry: any, blockKey: string, locale = \"en\") => {\n if (!entry) {\n return [];\n }\n\n const values = getBlockValues(entry, blockKey); // top‑level list\n\n const parsed = values.map((obj: Record<string, any>) => {\n const res = obj.value.reduce((acc: any, current: any) => {\n acc[current.key] = unwrapBlock(current, locale);\n\n return acc;\n }, {});\n\n return res;\n });\n\n return parsed;\n};\n\nexport const getBlockFromArray = (entry: any, blockKey: string, locale = \"en\") => {\n if (!entry) {\n return [];\n }\n\n const values = getBlockValues(entry, blockKey); // top‑level list\n\n return values.reduce((acc: any, current: any) => {\n acc[current.key] = unwrapBlock(current, locale);\n return acc;\n });\n};\n\nexport const getImageUrl = (imageBlock: any, isBlock = true) => {\n if (!imageBlock) return null;\n\n // Handle relationship blocks with media\n if (imageBlock.type === 'RELATIONSHIP' && Array.isArray(imageBlock.value)) {\n const mediaValue = imageBlock.value[0];\n if (mediaValue && mediaValue.mimeType) {\n // Handle media with resolutions structure\n if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {\n return mediaValue.resolutions.original.url;\n }\n\n // Handle direct URL on media\n if (mediaValue.url) {\n return mediaValue.url;\n }\n }\n return null;\n }\n\n if (isBlock) {\n if (typeof imageBlock === \"string\") {\n return imageBlock;\n }\n\n if (imageBlock.url) {\n return imageBlock.url;\n }\n }\n\n if (\n imageBlock.resolutions &&\n imageBlock.resolutions.original &&\n imageBlock.resolutions.original.url\n ) {\n return imageBlock.resolutions.original.url;\n }\n\n return null;\n};\n\nexport const translateMap = (labels: any, lang: string, fallback = \"unknown\") => {\n let parsedLang = \"en\";\n\n if (lang === \"sr\") {\n parsedLang = \"bih\";\n }\n\n if (!labels) {\n return fallback;\n }\n\n const label = labels[parsedLang];\n if (!label) {\n return fallback;\n }\n\n return label;\n};","// Error handling utilities (combined from errorCodes.ts and errorHelpers.ts)\n\n// Comprehensive error code system with both numeric codes and named constants\nexport const ERROR_CODES = {\n // General errors\n \"GENERAL.001\": \"GENERAL.BAD_REQUEST\",\n \"GENERAL.002\": \"GENERAL.VALIDATION_ERROR\",\n \"GENERAL.003\": \"GENERAL.FORBIDDEN_ERROR\",\n \"GENERAL.004\": \"GENERAL.INTERNAL_SERVER_ERROR\",\n \"GENERAL.005\": \"GENERAL.UNAUTHORIZED\",\n \"GENERAL.006\": \"GENERAL.UNAUTHENTICATED\",\n\n // Google/OAuth errors\n \"GOOGLE.001\": \"GOOGLE.INVALID_ORIGIN_URI\",\n \"GOOGLE.002\": \"GOOGLE.INVALID_REDIRECT_URI\",\n \"GOOGLE.003\": \"GOOGLE.FAILED_TO_CALL_API\",\n \"GOOGLE.004\": \"GOOGLE.FAILED_LOGIN\",\n \"GOOGLE.005\": \"GOOGLE.FAILED_LOGOUT\",\n \"GOOGLE.006\": \"GOOGLE.FAILED_REFRESH_TOKEN\",\n \"GOOGLE.007\": \"GOOGLE.INVALID_PROVIDER_PASSED\",\n\n // User errors\n \"USER.001\": \"USER.NOT_FOUND\",\n \"USER.002\": \"USER.FAILED_TO_CREATE\",\n \"USER.003\": \"USER.FAILED_TO_UPDATE\",\n \"USER.004\": \"USER.FAILED_TO_DELETE\",\n \"USER.005\": \"USER.EMAIL_EXISTS\",\n \"USER.006\": \"USER.FAILED_TO_GET_UPLOAD_URL\",\n\n // Business errors\n \"BUSINESS.001\": \"BUSINESS.NOT_FOUND\",\n \"BUSINESS.002\": \"BUSINESS.FAILED_TO_CREATE\",\n \"BUSINESS.003\": \"BUSINESS.FAILED_TO_UPDATE\",\n \"BUSINESS.004\": \"BUSINESS.FAILED_TO_DELETE\",\n \"BUSINESS.005\": \"BUSINESS.FAILED_TO_GET_UPLOAD_URL\",\n \"BUSINESS.006\": \"BUSINESS.NAME_REQUIRED\",\n \"BUSINESS.007\": \"BUSINESS.BUSINESS_ID_REQUIRED\",\n \"BUSINESS.010\": \"BUSINESS.DESCRIPTION_REQUIRED\",\n \"BUSINESS.011\": \"BUSINESS.SLUG_INVALID\",\n\n // Provider errors\n \"PROVIDER.001\": \"PROVIDER.NOT_FOUND\",\n \"PROVIDER.002\": \"PROVIDER.FAILED_TO_CREATE\",\n \"PROVIDER.003\": \"PROVIDER.FAILED_TO_UPDATE\",\n \"PROVIDER.004\": \"PROVIDER.FAILED_TO_DELETE\",\n \"PROVIDER.005\": \"PROVIDER.FAILED_TO_GET_UPLOAD_URL\",\n \"PROVIDER.006\": \"PROVIDER.NAME_REQUIRED\",\n \"PROVIDER.007\": \"PROVIDER.BUSINESS_ID_REQUIRED\",\n \"PROVIDER.008\": \"PROVIDER.DESCRIPTION_REQUIRED\",\n};\n\n// Named error constants for direct access\nexport const ERROR_CONSTANTS = {\n GENERAL: {\n BAD_REQUEST: \"GENERAL.BAD_REQUEST\",\n VALIDATION_ERROR: \"GENERAL.VALIDATION_ERROR\",\n FORBIDDEN_ERROR: \"GENERAL.FORBIDDEN_ERROR\",\n INTERNAL_SERVER_ERROR: \"GENERAL.INTERNAL_SERVER_ERROR\",\n UNAUTHORIZED: \"GENERAL.UNAUTHORIZED\",\n UNAUTHENTICATED: \"GENERAL.UNAUTHENTICATED\",\n },\n USER: {\n NOT_FOUND: \"USER.NOT_FOUND\",\n FAILED_TO_CREATE: \"USER.FAILED_TO_CREATE\",\n FAILED_TO_UPDATE: \"USER.FAILED_TO_UPDATE\",\n FAILED_TO_DELETE: \"USER.FAILED_TO_DELETE\",\n EMAIL_EXISTS: \"USER.EMAIL_EXISTS\",\n FAILED_TO_GET_UPLOAD_URL: \"USER.FAILED_TO_GET_UPLOAD_URL\",\n },\n BUSINESS: {\n NOT_FOUND: \"BUSINESS.NOT_FOUND\",\n FAILED_TO_CREATE: \"BUSINESS.FAILED_TO_CREATE\",\n FAILED_TO_UPDATE: \"BUSINESS.FAILED_TO_UPDATE\",\n FAILED_TO_DELETE: \"BUSINESS.FAILED_TO_DELETE\",\n FAILED_TO_GET_UPLOAD_URL: \"BUSINESS.FAILED_TO_GET_UPLOAD_URL\",\n NAME_REQUIRED: \"BUSINESS.NAME_REQUIRED\",\n BUSINESS_ID_REQUIRED: \"BUSINESS.BUSINESS_ID_REQUIRED\",\n DESCRIPTION_REQUIRED: \"BUSINESS.DESCRIPTION_REQUIRED\",\n SLUG_INVALID: \"BUSINESS.SLUG_INVALID\",\n },\n};\n\nexport type ServerError = {\n message: string;\n error: string;\n statusCode: number;\n validationErrors: {\n field: string;\n error: string;\n }[];\n};\n\nexport type ValidationError = {\n field: string;\n error: string;\n};\n\nexport type RequestError = {\n validationErrors: ValidationError[];\n};\n\n// Utility functions for error handling\nexport function getErrorMessage(code: string): string {\n return ERROR_CODES[code as keyof typeof ERROR_CODES] || code;\n}\n\nexport function isErrorCode(code: string): boolean {\n return code in ERROR_CODES;\n}\n\nexport const transformErrors = (zodError: any): ValidationError[] => {\n const customErrors: ValidationError[] = [];\n\n if (!zodError.issues) return customErrors;\n\n zodError.issues.forEach((issue: any) => {\n const field = issue.path.join(\".\");\n const error = issue.message;\n\n if (\n !customErrors.some(\n (customError) =>\n customError.field === field && customError.error === error\n )\n ) {\n customErrors.push({ field, error });\n }\n });\n\n return customErrors;\n};\n\nexport const convertServerErrorToRequestError = (\n serverError: ServerError,\n renameRules?: { [key: string]: string }\n): RequestError => {\n return {\n ...serverError,\n validationErrors: serverError.validationErrors.map((validationError) => {\n const field =\n renameRules && renameRules[validationError.field]\n ? renameRules[validationError.field]\n : validationError.field;\n\n return {\n field: field,\n error: validationError.error || \"GENERAL.VALIDATION_ERROR\",\n };\n }),\n };\n};\n\n// Export for backward compatibility\nexport const errors = ERROR_CONSTANTS;\nexport default ERROR_CODES;\n","/**\n * Maps currency codes to their display symbols\n */\nexport function getCurrencySymbol(currency: string): string {\n const currencySymbols: Record<string, string> = {\n USD: '$',\n EUR: '€',\n GBP: '£',\n CAD: 'C$',\n AUD: 'A$',\n JPY: '¥',\n CHF: 'CHF',\n SEK: 'kr',\n NOK: 'kr',\n DKK: 'kr',\n PLN: 'zł',\n CZK: 'Kč',\n HUF: 'Ft',\n RON: 'lei',\n BGN: 'лв',\n HRK: 'kn',\n RSD: 'дин',\n BAM: 'KM',\n MKD: 'ден',\n ALL: 'L',\n TRY: '₺',\n RUB: '₽',\n UAH: '₴',\n BYN: 'Br',\n CNY: '¥',\n INR: '₹',\n KRW: '₩',\n THB: '฿',\n VND: '₫',\n SGD: 'S$',\n MYR: 'RM',\n IDR: 'Rp',\n PHP: '₱',\n BRL: 'R$',\n ARS: '$',\n CLP: '$',\n COP: '$',\n PEN: 'S/',\n MXN: '$',\n ZAR: 'R',\n EGP: 'E£',\n NGN: '₦',\n KES: 'KSh',\n GHS: '₵',\n MAD: 'DH',\n TND: 'د.ت',\n DZD: 'د.ج',\n LYD: 'ل.د',\n AED: 'د.إ',\n SAR: 'ر.س',\n QAR: 'ر.ق',\n KWD: 'د.ك',\n BHD: 'ب.د',\n OMR: 'ر.ع',\n JOD: 'د.أ',\n LBP: 'ل.ل',\n SYP: 'ل.س',\n IQD: 'ع.د',\n IRR: '﷼',\n AFN: '؋',\n PKR: '₨',\n LKR: '₨',\n NPR: '₨',\n BDT: '৳',\n MMK: 'K',\n LAK: '₭',\n KHR: '៛',\n MNT: '₮',\n KZT: '₸',\n UZS: 'лв',\n KGS: 'лв',\n TJS: 'SM',\n TMT: 'T',\n AZN: '₼',\n GEL: '₾',\n AMD: '֏',\n BYR: 'p.',\n MDL: 'L'\n };\n\n return currencySymbols[currency.toUpperCase()] || currency;\n}\n\n/**\n * List of currencies where the symbol appears after the amount\n */\nexport const SYMBOL_AFTER_CURRENCIES = ['SEK', 'NOK', 'DKK', 'PLN', 'CZK', 'HUF', 'RON', 'BGN', 'HRK'];\n\n/**\n * Check if currency symbol should be placed after the amount\n */\nexport function isSymbolAfterCurrency(currency: string): boolean {\n return SYMBOL_AFTER_CURRENCIES.includes(currency.toUpperCase());\n}","// Price formatting utilities - Centralized currency and price operations\nimport type { Payment, PaymentMethodType, Price } from '../types';\nimport { getCurrencySymbol, isSymbolAfterCurrency } from './currency';\n\nconst MARKET_CURRENCIES = {\n 'US': 'USD',\n 'EU': 'EUR',\n 'UK': 'GBP',\n 'CA': 'CAD',\n 'AU': 'AUD'\n} as const;\n\n// Convert minor units (cents) to major units (dollars)\nexport function convertToMajor(minorAmount: number): number {\n return (minorAmount ?? 0) / 100;\n}\n\n// Convert major units to minor units\nexport function convertToMinor(majorAmount: number): number {\n return Math.round((majorAmount ?? 0) * 100);\n}\n\n// Get currency from market ID\nexport function getCurrencyFromMarket(marketId: string): string {\n return MARKET_CURRENCIES[marketId as keyof typeof MARKET_CURRENCIES] || 'USD';\n}\n\n// Format currency amount with symbol (locale-aware positioning)\nexport function formatCurrencyAmount(\n amount: number,\n currency: string,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n customSymbol?: string;\n } = {}\n): string {\n const { showSymbols = true, decimalPlaces = 2, customSymbol } = options;\n const roundedAmount = amount.toFixed(decimalPlaces);\n\n if (!showSymbols) {\n return `${roundedAmount} ${currency}`;\n }\n\n const symbol = customSymbol || getCurrencySymbol(currency);\n\n // Use locale-specific symbol positioning\n if (isSymbolAfterCurrency(currency)) {\n return `${roundedAmount} ${symbol}`;\n }\n\n return `${symbol}${roundedAmount}`;\n}\n\n// Format minor units with currency\nexport function formatMinor(\n amountMinor: number,\n currency: string,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n customSymbol?: string;\n } = {}\n): string {\n const major = convertToMajor(amountMinor);\n return formatCurrencyAmount(major, currency, options);\n}\n\n// Format Payment structure for display\nexport function formatPayment(\n payment: Payment,\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n showBreakdown?: boolean;\n } = {}\n): string {\n if (!payment) return '';\n\n const { showSymbols = true, decimalPlaces = 2, showBreakdown = false } = options;\n\n if (showBreakdown) {\n const subtotal = formatMinor(payment.subtotal, payment.currency, { showSymbols, decimalPlaces });\n const discount = (payment.discount ?? 0) > 0 ? formatMinor(payment.discount, payment.currency, { showSymbols, decimalPlaces }) : null;\n const taxAmount = payment.tax?.amount ?? 0;\n const tax = taxAmount > 0 ? formatMinor(taxAmount, payment.currency, { showSymbols, decimalPlaces }) : null;\n const total = formatMinor(payment.total, payment.currency, { showSymbols, decimalPlaces });\n\n let result = `Subtotal: ${subtotal}`;\n if (discount) result += `, Discount: -${discount}`;\n if (tax) result += `, Tax: ${tax}`;\n result += `, Total: ${total}`;\n return result;\n }\n\n return formatMinor(payment.total, payment.currency, { showSymbols, decimalPlaces });\n}\n\n// Format market-based prices (from product variants)\nexport function getMarketPrice(\n prices: Price[],\n marketId: string,\n businessMarkets?: any[],\n options: {\n showSymbols?: boolean;\n decimalPlaces?: number;\n showCompareAt?: boolean;\n fallbackMarket?: string;\n } = {}\n): string {\n if (!prices || prices.length === 0) return '';\n\n const {\n showSymbols = true,\n decimalPlaces = 2,\n showCompareAt = true,\n fallbackMarket,\n } = options;\n\n // Find price for the specific market\n let price = prices.find(p => p.market === marketId);\n\n // Fallback to fallback market (if provided) or first available\n if (!price && fallbackMarket) {\n price = prices.find(p => p.market === fallbackMarket);\n }\n if (!price) {\n price = prices[0];\n }\n\n if (!price) return '';\n\n let currency: string;\n let symbol: string;\n\n // If we have business markets, use the currency directly from market data\n if (businessMarkets) {\n const marketData = businessMarkets.find(m => m.id === price.market || m.code === price.market);\n if (marketData?.currency) {\n currency = marketData.currency;\n symbol = getCurrencySymbol(currency);\n } else {\n currency = getCurrencyFromMarket(price.market);\n symbol = getCurrencySymbol(currency);\n }\n } else {\n currency = getCurrencyFromMarket(price.market);\n symbol = getCurrencySymbol(currency);\n }\n\n // Format price with custom symbol\n const formattedPrice = formatMinor(price.amount ?? 0, currency, {\n showSymbols,\n decimalPlaces,\n customSymbol: symbol\n });\n\n // Add compare-at price if available\n if (showCompareAt && price.compareAt && price.compareAt > (price.amount ?? 0)) {\n const formattedCompareAt = formatMinor(price.compareAt, currency, {\n showSymbols,\n decimalPlaces,\n customSymbol: symbol\n });\n return `${formattedPrice} was ${formattedCompareAt}`;\n }\n\n return formattedPrice;\n}\n\n// Get price amount from market-based prices (for calculations)\nexport function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number {\n if (!prices || prices.length === 0) return 0;\n\n let price = prices.find(p => p.market === marketId);\n if (!price && fallbackMarket) {\n price = prices.find(p => p.market === fallbackMarket);\n }\n if (!price) {\n price = prices[0];\n }\n\n // Amounts are stored in minor units (e.g., cents)\n return price?.amount || 0;\n}\n\n// Create Payment structure for checkout (all amounts in minor units)\nexport function createPaymentForCheckout(\n subtotalMinor: number,\n marketId: string,\n currency: string,\n paymentMethod: any,\n options: {\n discount?: number;\n taxAmount?: number;\n taxRateBps?: number;\n promoCode?: {\n id: string;\n code: string;\n type: string;\n value: number;\n };\n } = {}\n): Payment {\n const { discount = 0, taxAmount = 0, taxRateBps = 0, promoCode } = options;\n const total = subtotalMinor - discount + taxAmount;\n\n return {\n currency,\n market: marketId,\n subtotal: subtotalMinor,\n shipping: 0,\n discount,\n total,\n type: paymentMethod,\n ...(taxAmount > 0 && {\n tax: {\n amount: taxAmount,\n rateBps: taxRateBps,\n lines: [],\n },\n }),\n ...(promoCode && { promoCode }),\n };\n}\n","import { getImageUrl } from \"./blocks\";\n\nexport async function fetchSvgContent(mediaObject: any): Promise<string | null> {\n\tif (!mediaObject) return null;\n\n\tconst svgUrl = getImageUrl(mediaObject, false);\n\n\ttry {\n\t\tconst response = await fetch(svgUrl);\n\n\t\tif (!response.ok) {\n\t\t\tconsole.error(`Failed to fetch SVG: ${response.status} ${response.statusText}`);\n\t\t\treturn null;\n\t\t}\n\n\t\tconst svgContent = await response.text();\n\t\treturn svgContent;\n\t} catch (error) {\n\t\tconsole.error(\"Error fetching SVG:\", error);\n\t\treturn null;\n\t}\n}\n\n/**\n * Server-side helper for Astro components to fetch SVG content during SSR\n *\n * @param mediaObject The media object from the CMS\n * @returns The SVG content as a string, or empty string on failure\n */\nexport async function getSvgContentForAstro(mediaObject: any): Promise<string> {\n\ttry {\n\t\tconst svgContent = await fetchSvgContent(mediaObject);\n\t\treturn svgContent || \"\";\n\t} catch (error) {\n\t\tconsole.error(\"Error getting SVG content for Astro:\", error);\n\t\treturn \"\";\n\t}\n}\n\n/**\n * Client-side helper to fetch and inject SVG content into DOM elements\n *\n * @param mediaObject The media object from the CMS\n * @param targetElement The DOM element to inject the SVG into\n * @param className Optional CSS class to add to the SVG\n */\nexport async function injectSvgIntoElement(\n\tmediaObject: any,\n\ttargetElement: HTMLElement,\n\tclassName?: string,\n): Promise<void> {\n\tif (!targetElement) return;\n\n\ttry {\n\t\tconst svgContent = await fetchSvgContent(mediaObject);\n\n\t\tif (svgContent) {\n\t\t\ttargetElement.innerHTML = svgContent;\n\n\t\t\t// Add class if provided\n\t\t\tif (className) {\n\t\t\t\tconst svgElement = targetElement.querySelector(\"svg\");\n\t\t\t\tif (svgElement) {\n\t\t\t\t\tsvgElement.classList.add(...className.split(\" \"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\"Error injecting SVG:\", error);\n\t}\n}","// Define locales inline since we don't have @lib/i18n in SDK\nconst locales = ['en', 'sr-latn'] as const;\nconst localeMap: Record<typeof locales[number], string> = {\n\t'en': 'en-US',\n\t'sr-latn': 'sr-RS'\n};\n\n/**\n * * returns \"slugified\" text.\n * @param text: string - text to slugify\n */\nexport function slugify(text: string): string {\n\treturn text\n\t\t.toString()\n\t\t.toLowerCase() // convert to lowercase\n\t\t.replace(/\\s+/g, \"-\") // replace spaces with -\n\t\t.replace(/[^\\w-]+/g, \"\") // remove all non-word chars\n\t\t.replace(/--+/g, \"-\") // replace multiple dashes with single dash\n\t\t.replace(/^-+/, \"\") // trim dash from start of text\n\t\t.replace(/-+$/, \"\"); // trim dash from end of text\n}\n\n/**\n * * returns \"humanized\" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest\n * @param text: string - text to humanize\n */\nexport function humanize(text: string): string {\n\tconst slugifiedText = slugify(text);\n\treturn (\n\t\tslugifiedText\n\t\t\t.replace(/-/g, \" \") // replace \"-\" with space\n\t\t\t// .toLowerCase();\n\t\t\t.replace(\n\t\t\t\t// upper case first letter of every word, and lower case the rest\n\t\t\t\t/\\w\\S*/g,\n\t\t\t\t(w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase(),\n\t\t\t)\n\t);\n}\n\n// --------------------------------------------------------\n/**\n * * returns \"categorified\" text. runs slugify() and then replaces - with space and upper cases everything\n * @param text: string - text to categorify\n * @returns string - categorified text\n */\nexport function categorify(text: string): string {\n\tconst slugifiedText = slugify(text);\n\treturn slugifiedText\n\t\t.replace(/-/g, \" \") // replace \"-\" with space\n\t\t.toUpperCase();\n}\n\n// --------------------------------------------------------\n/**\n * * returns a nicely formatted string of the date passed\n * @param date: string | number | Date - date to format\n * @param locale: string - locale to format the date in\n * @returns string - formatted date\n */\nexport function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string {\n\tlet localeString = \"en-US\";\n\n\tif (locales.includes(locale)) {\n\t\tlocaleString = localeMap[locale];\n\t}\n\n\treturn new Date(date).toLocaleDateString(localeString, {\n\t\ttimeZone: \"UTC\",\n\t\tyear: \"numeric\",\n\t\tmonth: \"short\",\n\t\tday: \"numeric\",\n\t});\n}","// Timezone utilities (moved from Reservation folder)\n\nexport const tzGroups = [\n {\n label: \"US\",\n zones: [\n { label: \"Eastern Time\", value: \"America/New_York\" },\n { label: \"Central Time\", value: \"America/Chicago\" },\n { label: \"Mountain Time\", value: \"America/Denver\" },\n { label: \"Pacific Time\", value: \"America/Los_Angeles\" },\n ],\n },\n {\n label: \"Europe\",\n zones: [\n { label: \"London\", value: \"Europe/London\" },\n { label: \"Paris\", value: \"Europe/Paris\" },\n { label: \"Berlin\", value: \"Europe/Berlin\" },\n { label: \"Rome\", value: \"Europe/Rome\" },\n ],\n },\n {\n label: \"Asia\",\n zones: [\n { label: \"Tokyo\", value: \"Asia/Tokyo\" },\n { label: \"Shanghai\", value: \"Asia/Shanghai\" },\n { label: \"Mumbai\", value: \"Asia/Kolkata\" },\n { label: \"Dubai\", value: \"Asia/Dubai\" },\n ],\n },\n];\n\nexport function findTimeZone(groups: typeof tzGroups): string {\n try {\n const detected = Intl.DateTimeFormat().resolvedOptions().timeZone;\n \n // Check if detected timezone is in our list\n for (const group of groups) {\n for (const zone of group.zones) {\n if (zone.value === detected) {\n return detected;\n }\n }\n }\n \n // Fallback to UTC if not found\n return \"UTC\";\n } catch (e) {\n // Fallback to UTC if detection fails\n return \"UTC\";\n }\n}","// Validation utilities\n\nexport interface ValidationResult {\n isValid: boolean;\n error?: string;\n}\n\n// Phone number validation\nexport function validatePhoneNumber(phone: string): ValidationResult {\n if (!phone) {\n return { isValid: false, error: 'Phone number is required' };\n }\n \n const cleaned = phone.replace(/\\D/g, '');\n \n if (cleaned.length < 8) {\n return { isValid: false, error: 'Phone number is too short' };\n }\n \n if (cleaned.length > 15) {\n return { isValid: false, error: 'Phone number is too long' };\n }\n \n return { isValid: true };\n}\n\n// Email validation\nexport function validateEmail(email: string): ValidationResult {\n if (!email) {\n return { isValid: false, error: 'Email is required' };\n }\n \n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n \n if (!emailRegex.test(email)) {\n return { isValid: false, error: 'Please enter a valid email address' };\n }\n \n return { isValid: true };\n}\n\n// Verification code validation (4-digit codes)\nexport function validateVerificationCode(code: string): ValidationResult {\n if (!code) {\n return { isValid: false, error: 'Verification code is required' };\n }\n \n const cleaned = code.replace(/\\D/g, '');\n \n if (cleaned.length !== 4) {\n return { isValid: false, error: 'Please enter a 4-digit verification code' };\n }\n \n return { isValid: true };\n}\n\n// Generic required field validation\nexport function validateRequired(value: any, fieldName: string = 'This field'): ValidationResult {\n if (value === null || value === undefined || value === '') {\n return { isValid: false, error: `${fieldName} is required` };\n }\n \n return { isValid: true };\n}"]}
package/dist/utils.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as Block, C as Collection, t as CollectionEntry, V as ValidationResult, m as categorify, D as convertToMajor, E as convertToMinor, i as createPaymentForCheckout, e as extractBlockValues, q as fetchSvgContent, k as findTimeZone, f as formatBlockValue, G as formatCurrencyAmount, n as formatDate, h as formatMinor, d as formatPayment, y as getBlockFromArray, g as getBlockLabel, x as getBlockObjectValues, a as getBlockTextValue, u as getBlockValue, w as getBlockValues, F as getCurrencyFromMarket, j as getCurrencySymbol, z as getImageUrl, b as getMarketPrice, c as getPriceAmount, o as getSvgContentForAstro, l as humanize, r as injectSvgIntoElement, p as prepareBlocksForSubmission, s as slugify, A as translateMap, H as tzGroups, I as validateEmail, v as validatePhoneNumber, K as validateRequired, J as validateVerificationCode } from './svg-D_ajyHnG.cjs';
1
+ export { B as Block, C as Collection, t as CollectionEntry, V as ValidationResult, m as categorify, D as convertToMajor, E as convertToMinor, i as createPaymentForCheckout, e as extractBlockValues, q as fetchSvgContent, k as findTimeZone, f as formatBlockValue, G as formatCurrencyAmount, n as formatDate, h as formatMinor, d as formatPayment, y as getBlockFromArray, g as getBlockLabel, x as getBlockObjectValues, a as getBlockTextValue, u as getBlockValue, w as getBlockValues, F as getCurrencyFromMarket, j as getCurrencySymbol, z as getImageUrl, b as getMarketPrice, c as getPriceAmount, o as getSvgContentForAstro, l as humanize, r as injectSvgIntoElement, p as prepareBlocksForSubmission, s as slugify, A as translateMap, H as tzGroups, I as validateEmail, v as validatePhoneNumber, K as validateRequired, J as validateVerificationCode } from './svg-3F_m7296.cjs';
2
2
  import './types.cjs';
3
3
 
4
4
  declare const ERROR_CODES: {
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as Block, C as Collection, t as CollectionEntry, V as ValidationResult, m as categorify, D as convertToMajor, E as convertToMinor, i as createPaymentForCheckout, e as extractBlockValues, q as fetchSvgContent, k as findTimeZone, f as formatBlockValue, G as formatCurrencyAmount, n as formatDate, h as formatMinor, d as formatPayment, y as getBlockFromArray, g as getBlockLabel, x as getBlockObjectValues, a as getBlockTextValue, u as getBlockValue, w as getBlockValues, F as getCurrencyFromMarket, j as getCurrencySymbol, z as getImageUrl, b as getMarketPrice, c as getPriceAmount, o as getSvgContentForAstro, l as humanize, r as injectSvgIntoElement, p as prepareBlocksForSubmission, s as slugify, A as translateMap, H as tzGroups, I as validateEmail, v as validatePhoneNumber, K as validateRequired, J as validateVerificationCode } from './svg-WKQadzp2.js';
1
+ export { B as Block, C as Collection, t as CollectionEntry, V as ValidationResult, m as categorify, D as convertToMajor, E as convertToMinor, i as createPaymentForCheckout, e as extractBlockValues, q as fetchSvgContent, k as findTimeZone, f as formatBlockValue, G as formatCurrencyAmount, n as formatDate, h as formatMinor, d as formatPayment, y as getBlockFromArray, g as getBlockLabel, x as getBlockObjectValues, a as getBlockTextValue, u as getBlockValue, w as getBlockValues, F as getCurrencyFromMarket, j as getCurrencySymbol, z as getImageUrl, b as getMarketPrice, c as getPriceAmount, o as getSvgContentForAstro, l as humanize, r as injectSvgIntoElement, p as prepareBlocksForSubmission, s as slugify, A as translateMap, H as tzGroups, I as validateEmail, v as validatePhoneNumber, K as validateRequired, J as validateVerificationCode } from './svg-4hIdMU6f.js';
2
2
  import './types.js';
3
3
 
4
4
  declare const ERROR_CODES: {
package/dist/utils.js CHANGED
@@ -128,44 +128,30 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
128
128
  return acc;
129
129
  });
130
130
  };
131
- var getImageUrl = (imageBlock, isBlock = true, storageUrl = "https://storage.arky.io/dev") => {
131
+ var getImageUrl = (imageBlock, isBlock = true) => {
132
132
  if (!imageBlock) return null;
133
- const isExternalUrl = (url) => {
134
- return url.startsWith("http://") || url.startsWith("https://");
135
- };
136
133
  if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
137
134
  const mediaValue = imageBlock.value[0];
138
135
  if (mediaValue && mediaValue.mimeType) {
139
136
  if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
140
- const url = mediaValue.resolutions.original.url;
141
- return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
137
+ return mediaValue.resolutions.original.url;
142
138
  }
143
139
  if (mediaValue.url) {
144
- return isExternalUrl(mediaValue.url) ? mediaValue.url : `${storageUrl}/${mediaValue.url}`;
140
+ return mediaValue.url;
145
141
  }
146
142
  }
147
143
  return null;
148
144
  }
149
145
  if (isBlock) {
150
146
  if (typeof imageBlock === "string") {
151
- if (isExternalUrl(imageBlock)) {
152
- return imageBlock;
153
- }
154
- return `${storageUrl}/${imageBlock}`;
147
+ return imageBlock;
155
148
  }
156
149
  if (imageBlock.url) {
157
- if (isExternalUrl(imageBlock.url)) {
158
- return imageBlock.url;
159
- }
160
- return `${storageUrl}/${imageBlock.url}`;
150
+ return imageBlock.url;
161
151
  }
162
152
  }
163
153
  if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
164
- const url = imageBlock.resolutions.original.url;
165
- if (isExternalUrl(url)) {
166
- return url;
167
- }
168
- return `${storageUrl}/${url}`;
154
+ return imageBlock.resolutions.original.url;
169
155
  }
170
156
  return null;
171
157
  };