@retaila/shared-types 2.0.11 → 2.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3403,11 +3403,19 @@ interface UpdateNotificationSettingsDTO {
3403
3403
  delayHours?: number;
3404
3404
  }
3405
3405
 
3406
+ /** Catalog price row and contract term: amount is the total for this period (e.g. full year for ANNUAL). */
3406
3407
  declare enum BillingInterval {
3407
3408
  MONTHLY = "MONTHLY",
3408
3409
  SEMIANNUAL = "SEMIANNUAL",
3409
3410
  ANNUAL = "ANNUAL"
3410
3411
  }
3412
+ /** How often a subscription charge is generated (may split the contract total into installments). */
3413
+ declare enum PaymentFrequency {
3414
+ MONTHLY = "MONTHLY",
3415
+ QUARTERLY = "QUARTERLY",
3416
+ SEMIANNUAL = "SEMIANNUAL",
3417
+ ANNUAL = "ANNUAL"
3418
+ }
3411
3419
  /** Single item in a spec category (display-like structure). */
3412
3420
  interface ServiceBillingPlanSpecItem {
3413
3421
  key: string;
@@ -3475,6 +3483,7 @@ interface ServiceBillingPlan {
3475
3483
  interface ServiceBillingPlanPrice {
3476
3484
  id: string;
3477
3485
  serviceBillingPlanId: string;
3486
+ /** Contract / pricing period this row applies to (matches account assignment contract term). */
3478
3487
  billingInterval: BillingInterval;
3479
3488
  amount: number;
3480
3489
  aiImageCreditsIncluded: number;
@@ -3493,10 +3502,13 @@ interface AccountServicePlan {
3493
3502
  serviceBillingPlanId: string;
3494
3503
  status: AccountServicePlanStatus;
3495
3504
  customAmount?: number | null;
3505
+ /** Contract term; selects `service_billing_plan_price` row (catalog total for this term). */
3496
3506
  billingInterval?: BillingInterval | null;
3497
- freePeriodsRemaining: number;
3507
+ /** Charge cadence; installments divide the contract catalog/custom total. Null = same as billingInterval (legacy). */
3508
+ paymentFrequency?: PaymentFrequency | null;
3509
+ /** Optional one-time fee; generates an INSTALLATION charge when the job runs. */
3498
3510
  installationFee?: number | null;
3499
- installationFeePaidAt?: Date | null;
3511
+ /** First day of the first billable subscription period; installation fee is also anchored to this date. */
3500
3512
  startedAt: Date;
3501
3513
  endedAt?: Date | null;
3502
3514
  notes?: string | null;
@@ -3523,7 +3535,8 @@ interface AccountServiceBillingCharge {
3523
3535
  amount: number;
3524
3536
  currency: string;
3525
3537
  type: ChargeType;
3526
- billingInterval?: BillingInterval | null;
3538
+ /** For SUBSCRIPTION: length of the billed period (payment frequency), e.g. MONTHLY or QUARTERLY. */
3539
+ billingInterval?: BillingInterval | PaymentFrequency | null;
3527
3540
  periodStart?: Date | null;
3528
3541
  periodEnd?: Date | null;
3529
3542
  dueDate?: Date | null;
@@ -3531,11 +3544,26 @@ interface AccountServiceBillingCharge {
3531
3544
  status: ChargeStatus;
3532
3545
  externalReference?: string | null;
3533
3546
  description?: string | null;
3547
+ /** Public URL of invoice/receipt PDF or image (e.g. Gestión upload to GCS). */
3548
+ invoiceUrl?: string | null;
3534
3549
  createdAt: Date;
3535
3550
  updatedAt: Date;
3536
3551
  deletedAt?: Date | null;
3537
3552
  }
3538
3553
 
3554
+ declare function contractTermMonths(contract: BillingInterval): number;
3555
+ declare function paymentFrequencyMonths(freq: PaymentFrequency): number;
3556
+ /**
3557
+ * Number of subscription charges in one full contract term, or null if incompatible
3558
+ * (e.g. quarterly billing on a 1-month contract).
3559
+ */
3560
+ declare function subscriptionInstallmentCount(contract: BillingInterval, payment: PaymentFrequency): number | null;
3561
+ declare function resolveEffectivePaymentFrequency(contract: BillingInterval, paymentFrequency: PaymentFrequency | null | undefined): PaymentFrequency;
3562
+ /** Per-charge amount from the contract-period total (catalog or custom). */
3563
+ declare function subscriptionAmountPerInstallment(contractTotalAmount: number, contract: BillingInterval, payment: PaymentFrequency): number | null;
3564
+ /** IA credits to grant per subscription charge (proportional to installments). */
3565
+ declare function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract: number, contract: BillingInterval, payment: PaymentFrequency): number;
3566
+
3539
3567
  declare enum HolidayType {
3540
3568
  /** Business is expected to be closed. Default: excluded from delivery calculation. */
3541
3569
  NON_WORKING = "NON_WORKING",
@@ -3631,4 +3659,4 @@ interface GestionLoginAttempt {
3631
3659
  createdAt: Date;
3632
3660
  }
3633
3661
 
3634
- export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern };
3662
+ export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentFrequency, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, aiCreditsPerSubscriptionInstallment, contractTermMonths, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern, paymentFrequencyMonths, resolveEffectivePaymentFrequency, subscriptionAmountPerInstallment, subscriptionInstallmentCount };
package/dist/index.d.ts CHANGED
@@ -3403,11 +3403,19 @@ interface UpdateNotificationSettingsDTO {
3403
3403
  delayHours?: number;
3404
3404
  }
3405
3405
 
3406
+ /** Catalog price row and contract term: amount is the total for this period (e.g. full year for ANNUAL). */
3406
3407
  declare enum BillingInterval {
3407
3408
  MONTHLY = "MONTHLY",
3408
3409
  SEMIANNUAL = "SEMIANNUAL",
3409
3410
  ANNUAL = "ANNUAL"
3410
3411
  }
3412
+ /** How often a subscription charge is generated (may split the contract total into installments). */
3413
+ declare enum PaymentFrequency {
3414
+ MONTHLY = "MONTHLY",
3415
+ QUARTERLY = "QUARTERLY",
3416
+ SEMIANNUAL = "SEMIANNUAL",
3417
+ ANNUAL = "ANNUAL"
3418
+ }
3411
3419
  /** Single item in a spec category (display-like structure). */
3412
3420
  interface ServiceBillingPlanSpecItem {
3413
3421
  key: string;
@@ -3475,6 +3483,7 @@ interface ServiceBillingPlan {
3475
3483
  interface ServiceBillingPlanPrice {
3476
3484
  id: string;
3477
3485
  serviceBillingPlanId: string;
3486
+ /** Contract / pricing period this row applies to (matches account assignment contract term). */
3478
3487
  billingInterval: BillingInterval;
3479
3488
  amount: number;
3480
3489
  aiImageCreditsIncluded: number;
@@ -3493,10 +3502,13 @@ interface AccountServicePlan {
3493
3502
  serviceBillingPlanId: string;
3494
3503
  status: AccountServicePlanStatus;
3495
3504
  customAmount?: number | null;
3505
+ /** Contract term; selects `service_billing_plan_price` row (catalog total for this term). */
3496
3506
  billingInterval?: BillingInterval | null;
3497
- freePeriodsRemaining: number;
3507
+ /** Charge cadence; installments divide the contract catalog/custom total. Null = same as billingInterval (legacy). */
3508
+ paymentFrequency?: PaymentFrequency | null;
3509
+ /** Optional one-time fee; generates an INSTALLATION charge when the job runs. */
3498
3510
  installationFee?: number | null;
3499
- installationFeePaidAt?: Date | null;
3511
+ /** First day of the first billable subscription period; installation fee is also anchored to this date. */
3500
3512
  startedAt: Date;
3501
3513
  endedAt?: Date | null;
3502
3514
  notes?: string | null;
@@ -3523,7 +3535,8 @@ interface AccountServiceBillingCharge {
3523
3535
  amount: number;
3524
3536
  currency: string;
3525
3537
  type: ChargeType;
3526
- billingInterval?: BillingInterval | null;
3538
+ /** For SUBSCRIPTION: length of the billed period (payment frequency), e.g. MONTHLY or QUARTERLY. */
3539
+ billingInterval?: BillingInterval | PaymentFrequency | null;
3527
3540
  periodStart?: Date | null;
3528
3541
  periodEnd?: Date | null;
3529
3542
  dueDate?: Date | null;
@@ -3531,11 +3544,26 @@ interface AccountServiceBillingCharge {
3531
3544
  status: ChargeStatus;
3532
3545
  externalReference?: string | null;
3533
3546
  description?: string | null;
3547
+ /** Public URL of invoice/receipt PDF or image (e.g. Gestión upload to GCS). */
3548
+ invoiceUrl?: string | null;
3534
3549
  createdAt: Date;
3535
3550
  updatedAt: Date;
3536
3551
  deletedAt?: Date | null;
3537
3552
  }
3538
3553
 
3554
+ declare function contractTermMonths(contract: BillingInterval): number;
3555
+ declare function paymentFrequencyMonths(freq: PaymentFrequency): number;
3556
+ /**
3557
+ * Number of subscription charges in one full contract term, or null if incompatible
3558
+ * (e.g. quarterly billing on a 1-month contract).
3559
+ */
3560
+ declare function subscriptionInstallmentCount(contract: BillingInterval, payment: PaymentFrequency): number | null;
3561
+ declare function resolveEffectivePaymentFrequency(contract: BillingInterval, paymentFrequency: PaymentFrequency | null | undefined): PaymentFrequency;
3562
+ /** Per-charge amount from the contract-period total (catalog or custom). */
3563
+ declare function subscriptionAmountPerInstallment(contractTotalAmount: number, contract: BillingInterval, payment: PaymentFrequency): number | null;
3564
+ /** IA credits to grant per subscription charge (proportional to installments). */
3565
+ declare function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract: number, contract: BillingInterval, payment: PaymentFrequency): number;
3566
+
3539
3567
  declare enum HolidayType {
3540
3568
  /** Business is expected to be closed. Default: excluded from delivery calculation. */
3541
3569
  NON_WORKING = "NON_WORKING",
@@ -3631,4 +3659,4 @@ interface GestionLoginAttempt {
3631
3659
  createdAt: Date;
3632
3660
  }
3633
3661
 
3634
- export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern };
3662
+ export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentFrequency, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, aiCreditsPerSubscriptionInstallment, contractTermMonths, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern, paymentFrequencyMonths, resolveEffectivePaymentFrequency, subscriptionAmountPerInstallment, subscriptionInstallmentCount };
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ __export(index_exports, {
84
84
  OrderStatus: () => OrderStatus,
85
85
  PageType: () => PageType,
86
86
  PaymentCardBrandKey: () => PaymentCardBrandKey,
87
+ PaymentFrequency: () => PaymentFrequency,
87
88
  PaymentMethodType: () => PaymentMethodType,
88
89
  PaymentStatus: () => PaymentStatus,
89
90
  ProductAttributeStatus: () => ProductAttributeStatus,
@@ -114,6 +115,8 @@ __export(index_exports, {
114
115
  SupportConversationStatus: () => SupportConversationStatus,
115
116
  SupportConversationVisibility: () => SupportConversationVisibility,
116
117
  TrafficSource: () => TrafficSource,
118
+ aiCreditsPerSubscriptionInstallment: () => aiCreditsPerSubscriptionInstallment,
119
+ contractTermMonths: () => contractTermMonths,
117
120
  getAccountPaymentMethodStatusInfo: () => getAccountPaymentMethodStatusInfo,
118
121
  getCountryDefaults: () => getCountryDefaults,
119
122
  getCurrencySymbol: () => getCurrencySymbol,
@@ -129,7 +132,11 @@ __export(index_exports, {
129
132
  isLegacyLayout: () => isLegacyLayout,
130
133
  isSupportedCountry: () => isSupportedCountry,
131
134
  isZonedLayout: () => isZonedLayout,
132
- parsePriceFormatPattern: () => parsePriceFormatPattern
135
+ parsePriceFormatPattern: () => parsePriceFormatPattern,
136
+ paymentFrequencyMonths: () => paymentFrequencyMonths,
137
+ resolveEffectivePaymentFrequency: () => resolveEffectivePaymentFrequency,
138
+ subscriptionAmountPerInstallment: () => subscriptionAmountPerInstallment,
139
+ subscriptionInstallmentCount: () => subscriptionInstallmentCount
133
140
  });
134
141
  module.exports = __toCommonJS(index_exports);
135
142
 
@@ -1198,6 +1205,13 @@ var BillingInterval = /* @__PURE__ */ ((BillingInterval2) => {
1198
1205
  BillingInterval2["ANNUAL"] = "ANNUAL";
1199
1206
  return BillingInterval2;
1200
1207
  })(BillingInterval || {});
1208
+ var PaymentFrequency = /* @__PURE__ */ ((PaymentFrequency2) => {
1209
+ PaymentFrequency2["MONTHLY"] = "MONTHLY";
1210
+ PaymentFrequency2["QUARTERLY"] = "QUARTERLY";
1211
+ PaymentFrequency2["SEMIANNUAL"] = "SEMIANNUAL";
1212
+ PaymentFrequency2["ANNUAL"] = "ANNUAL";
1213
+ return PaymentFrequency2;
1214
+ })(PaymentFrequency || {});
1201
1215
  var AccountServicePlanStatus = /* @__PURE__ */ ((AccountServicePlanStatus2) => {
1202
1216
  AccountServicePlanStatus2["ACTIVE"] = "ACTIVE";
1203
1217
  AccountServicePlanStatus2["ENDED"] = "ENDED";
@@ -1218,6 +1232,55 @@ var ChargeStatus = /* @__PURE__ */ ((ChargeStatus2) => {
1218
1232
  return ChargeStatus2;
1219
1233
  })(ChargeStatus || {});
1220
1234
 
1235
+ // src/serviceBilling/billingSchedule.ts
1236
+ function contractTermMonths(contract) {
1237
+ switch (contract) {
1238
+ case "MONTHLY" /* MONTHLY */:
1239
+ return 1;
1240
+ case "SEMIANNUAL" /* SEMIANNUAL */:
1241
+ return 6;
1242
+ case "ANNUAL" /* ANNUAL */:
1243
+ return 12;
1244
+ default:
1245
+ return 1;
1246
+ }
1247
+ }
1248
+ function paymentFrequencyMonths(freq) {
1249
+ switch (freq) {
1250
+ case "MONTHLY" /* MONTHLY */:
1251
+ return 1;
1252
+ case "QUARTERLY" /* QUARTERLY */:
1253
+ return 3;
1254
+ case "SEMIANNUAL" /* SEMIANNUAL */:
1255
+ return 6;
1256
+ case "ANNUAL" /* ANNUAL */:
1257
+ return 12;
1258
+ default:
1259
+ return 1;
1260
+ }
1261
+ }
1262
+ function subscriptionInstallmentCount(contract, payment) {
1263
+ const cm = contractTermMonths(contract);
1264
+ const pm = paymentFrequencyMonths(payment);
1265
+ if (pm > cm) return null;
1266
+ if (cm % pm !== 0) return null;
1267
+ return cm / pm;
1268
+ }
1269
+ function resolveEffectivePaymentFrequency(contract, paymentFrequency) {
1270
+ if (paymentFrequency != null) return paymentFrequency;
1271
+ return contract;
1272
+ }
1273
+ function subscriptionAmountPerInstallment(contractTotalAmount, contract, payment) {
1274
+ const n = subscriptionInstallmentCount(contract, payment);
1275
+ if (n == null || n <= 0) return null;
1276
+ return Math.round(contractTotalAmount / n * 100) / 100;
1277
+ }
1278
+ function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract, contract, payment) {
1279
+ const n = subscriptionInstallmentCount(contract, payment);
1280
+ if (n == null || n <= 0) return creditsIncludedPerContract;
1281
+ return Math.round(creditsIncludedPerContract / n);
1282
+ }
1283
+
1221
1284
  // src/holiday/types.ts
1222
1285
  var HolidayType = /* @__PURE__ */ ((HolidayType2) => {
1223
1286
  HolidayType2["NON_WORKING"] = "NON_WORKING";
@@ -1303,6 +1366,7 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1303
1366
  OrderStatus,
1304
1367
  PageType,
1305
1368
  PaymentCardBrandKey,
1369
+ PaymentFrequency,
1306
1370
  PaymentMethodType,
1307
1371
  PaymentStatus,
1308
1372
  ProductAttributeStatus,
@@ -1333,6 +1397,8 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1333
1397
  SupportConversationStatus,
1334
1398
  SupportConversationVisibility,
1335
1399
  TrafficSource,
1400
+ aiCreditsPerSubscriptionInstallment,
1401
+ contractTermMonths,
1336
1402
  getAccountPaymentMethodStatusInfo,
1337
1403
  getCountryDefaults,
1338
1404
  getCurrencySymbol,
@@ -1348,6 +1414,10 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1348
1414
  isLegacyLayout,
1349
1415
  isSupportedCountry,
1350
1416
  isZonedLayout,
1351
- parsePriceFormatPattern
1417
+ parsePriceFormatPattern,
1418
+ paymentFrequencyMonths,
1419
+ resolveEffectivePaymentFrequency,
1420
+ subscriptionAmountPerInstallment,
1421
+ subscriptionInstallmentCount
1352
1422
  });
1353
1423
  //# sourceMappingURL=index.js.map