@putiikkipalvelu/storefront-sdk 0.2.5 → 0.3.0

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.cts CHANGED
@@ -507,21 +507,6 @@ interface CalculatedCartItem {
507
507
  /** Total quantity in cart */
508
508
  totalQuantity: number;
509
509
  }
510
- /**
511
- * Free shipping eligibility status
512
- */
513
- interface FreeShippingStatus {
514
- /** Whether the cart qualifies for free shipping */
515
- isEligible: boolean;
516
- /** Minimum spend required for free shipping (in cents) */
517
- minimumSpend: number;
518
- /** Amount remaining to qualify for free shipping (in cents) */
519
- remainingAmount: number;
520
- /** Name of the free shipping campaign */
521
- campaignName?: string;
522
- /** IDs of shipment methods eligible for free shipping (when isEligible is true) */
523
- eligibleShipmentMethodIds?: string[];
524
- }
525
510
  /**
526
511
  * Result of cart calculation with campaigns applied
527
512
  */
@@ -534,21 +519,18 @@ interface CartCalculationResult {
534
519
  originalTotal: number;
535
520
  /** Total savings from campaigns (in cents) */
536
521
  totalSavings: number;
537
- /** Free shipping eligibility status */
538
- freeShipping: FreeShippingStatus;
539
522
  }
540
523
 
541
524
  /**
542
525
  * Shipping Types
543
526
  *
544
527
  * Types for shipment methods and pickup locations.
545
- * ShipmentMethod and ShipitShippingMethod are re-exported from storeconfig.
528
+ * Uses unified response format that works with any provider (Shipit, custom, future integrations).
546
529
  */
547
-
548
530
  /**
549
531
  * Opening hours for a pickup location
550
532
  */
551
- interface PickupLocationOpeningHours {
533
+ interface OpeningHours {
552
534
  monday: string[];
553
535
  tuesday: string[];
554
536
  wednesday: string[];
@@ -559,57 +541,82 @@ interface PickupLocationOpeningHours {
559
541
  exceptions: string[];
560
542
  }
561
543
  /**
562
- * A pickup location (parcel locker, pickup point, etc.)
563
- * Returned from Shipit API with shipmentMethodId and price attached
544
+ * A home delivery option (works for any provider)
545
+ */
546
+ interface HomeDeliveryOption {
547
+ /** ShipmentMethods.id - unique identifier for this method */
548
+ id: string;
549
+ /** Display name (e.g., "Posti Kotipaketti") */
550
+ name: string;
551
+ /** Optional description */
552
+ description: string | null;
553
+ /** Price in cents (0 if free shipping applies) */
554
+ price: number;
555
+ /** Original price in cents (always the base price before free shipping) */
556
+ originalPrice: number;
557
+ /** Free shipping threshold in cents, null = no free shipping available for this method */
558
+ freeShippingThreshold: number | null;
559
+ /** Carrier logo URL */
560
+ logo: string | null;
561
+ /** Provider type */
562
+ provider: "shipit" | "custom";
563
+ /** Carrier name (e.g., "Posti", "Matkahuolto") - null for custom methods */
564
+ carrier: string | null;
565
+ /** Estimated delivery time (e.g., "1-3") - null if not available */
566
+ estimatedDelivery: string | null;
567
+ }
568
+ /**
569
+ * A pickup point option (parcel locker, service point, etc.)
570
+ * Works for any provider that supports pickup locations.
564
571
  */
565
- interface PickupLocation {
566
- /** Unique location ID from Shipit */
572
+ interface PickupPointOption {
573
+ /** Unique pickup point ID from carrier */
567
574
  id: string;
568
- /** Shipit service ID */
575
+ /** ShipmentMethods.id - needed for checkout */
576
+ shipmentMethodId: string;
577
+ /** Shipit service ID - needed for checkout and shipment creation */
569
578
  serviceId: string;
570
- /** Location name */
579
+ /** Location name (e.g., "Lidl Graniittitalo") */
571
580
  name: string;
572
581
  /** Street address */
573
- address1: string;
582
+ address: string;
574
583
  /** City */
575
584
  city: string;
576
585
  /** Postal code */
577
- zipcode: string;
578
- /** Country code (e.g., "FI") */
579
- countryCode: string;
580
- /** Carrier name (e.g., "Posti", "Matkahuolto") */
581
- carrier: string;
586
+ postalCode: string;
587
+ /** Price in cents (0 if free shipping applies) */
588
+ price: number;
589
+ /** Original price in cents (always the base price before free shipping) */
590
+ originalPrice: number;
591
+ /** Free shipping threshold in cents, null = no free shipping available for this method */
592
+ freeShippingThreshold: number | null;
582
593
  /** Carrier logo URL */
583
- carrierLogo: string;
584
- /** GPS latitude */
585
- latitude?: number;
586
- /** GPS longitude */
587
- longitude?: number;
588
- /** Distance from postal code in meters */
589
- distanceInMeters: number;
590
- /** Distance from postal code in kilometers */
591
- distanceInKilometers: number;
592
- /** Location type (e.g., "parcel_locker", "service_point", "outdoor_parcel_locker") */
593
- type?: string;
594
+ logo: string | null;
595
+ /** Provider type */
596
+ provider: "shipit" | "custom";
597
+ /** Carrier name (e.g., "Posti", "Matkahuolto") */
598
+ carrier: string | null;
599
+ /** Distance from customer's postal code in meters */
600
+ distance: number | null;
594
601
  /** Structured opening hours */
595
- openingHours?: PickupLocationOpeningHours | null;
596
- /** Raw opening hours string from Shipit */
597
- openingHoursRaw?: string | null;
598
- /** Additional metadata */
599
- metadata?: unknown | null;
600
- /** The shipment method ID this location belongs to */
601
- shipmentMethodId: string;
602
- /** Price in cents (from store settings) */
603
- price: number;
602
+ openingHours: OpeningHours | null;
603
+ /** GPS coordinates */
604
+ coordinates: {
605
+ lat: number;
606
+ lng: number;
607
+ } | null;
604
608
  }
605
609
  /**
606
610
  * Response from GET /shipment-methods/[postalCode]
611
+ *
612
+ * Returns unified shipping options regardless of provider.
613
+ * Pickup points are sorted by distance, home delivery by price.
607
614
  */
608
- interface ShipmentMethodsWithLocationsResponse {
609
- /** Home delivery methods (custom methods + Shipit home delivery) */
610
- homeDeliveryMethods: ShipmentMethod[];
611
- /** Pickup locations with shipmentMethodId and price attached */
612
- pickupLocations: PickupLocation[];
615
+ interface ShipmentMethodsResponse {
616
+ /** Home delivery options (sorted by price) */
617
+ homeDelivery: HomeDeliveryOption[];
618
+ /** Pickup point options (sorted by distance) */
619
+ pickupPoints: PickupPointOption[];
613
620
  }
614
621
 
615
622
  /**
@@ -1126,6 +1133,8 @@ interface CheckoutShipmentMethod {
1126
1133
  shipmentMethodId: string;
1127
1134
  /** ID of pickup point (for pickup delivery methods) */
1128
1135
  pickupId: string | null;
1136
+ /** Shipit service ID (for Shipit pickup points) */
1137
+ serviceId: string | null;
1129
1138
  }
1130
1139
  /**
1131
1140
  * Parameters for creating a checkout session
@@ -1686,9 +1695,13 @@ type CartResource = ReturnType<typeof createCartResource>;
1686
1695
  /**
1687
1696
  * Options for fetching shipment methods with weight-based filtering
1688
1697
  */
1689
- interface GetMethodsOptions extends FetchOptions {
1690
- /** Cart items - weight will be calculated automatically */
1698
+ interface GetShippingOptionsParams extends FetchOptions {
1699
+ /** Cart items - weight and total will be calculated automatically */
1691
1700
  cartItems?: CartItem[];
1701
+ /** Active campaigns - used to calculate cart total with discounts for free shipping */
1702
+ campaigns?: Campaign[];
1703
+ /** Country code (default: "FI") */
1704
+ country?: string;
1692
1705
  }
1693
1706
  /**
1694
1707
  * Shipping resource for fetching shipment methods and pickup locations
@@ -1696,40 +1709,55 @@ interface GetMethodsOptions extends FetchOptions {
1696
1709
  declare function createShippingResource(fetcher: Fetcher): {
1697
1710
  /**
1698
1711
  * Get shipping options for a specific postal code.
1699
- * Returns home delivery methods and pickup locations.
1712
+ * Returns pickup points and home delivery options in a unified format.
1713
+ *
1714
+ * **Pickup points are returned first** as they are more popular in Finland.
1700
1715
  *
1701
1716
  * @param postalCode - Customer's postal code (e.g., "00100")
1702
1717
  * @param options - Fetch options including optional cartItems for weight-based filtering
1703
- * @returns Home delivery methods and pickup locations
1718
+ * @returns Unified shipping options (pickupPoints sorted by distance, homeDelivery sorted by price)
1704
1719
  *
1705
1720
  * @example
1706
1721
  * ```typescript
1707
- * const { homeDeliveryMethods, pickupLocations } = await client.shipping.getWithLocations("00100");
1708
- *
1709
- * // Show home delivery options
1710
- * homeDeliveryMethods.forEach(method => {
1711
- * console.log(`${method.name}: ${method.price / 100}€`);
1722
+ * const { pickupPoints, homeDelivery } = await client.shipping.getOptions("00100");
1723
+ *
1724
+ * // Show pickup points (more popular in Finland)
1725
+ * pickupPoints.forEach(point => {
1726
+ * console.log(`${point.name} - ${point.carrier}`);
1727
+ * console.log(` ${point.address}, ${point.city}`);
1728
+ * console.log(` ${(point.distance! / 1000).toFixed(1)} km away`);
1729
+ * console.log(` Price: ${point.price / 100}€`);
1712
1730
  * });
1713
1731
  *
1714
- * // Show pickup locations
1715
- * pickupLocations.forEach(location => {
1716
- * console.log(`${location.name} - ${location.carrier}`);
1717
- * console.log(` ${location.address1}, ${location.city}`);
1718
- * console.log(` ${location.distanceInKilometers.toFixed(1)} km away`);
1719
- * console.log(` Price: ${location.price / 100}€`);
1732
+ * // Show home delivery options
1733
+ * homeDelivery.forEach(option => {
1734
+ * console.log(`${option.name}: ${option.price / 100}€`);
1735
+ * if (option.estimatedDelivery) {
1736
+ * console.log(` Delivery: ${option.estimatedDelivery} days`);
1737
+ * }
1720
1738
  * });
1721
1739
  * ```
1722
1740
  *
1723
1741
  * @example Weight-based filtering
1724
1742
  * ```typescript
1725
- * const { homeDeliveryMethods, pickupLocations } = await client.shipping.getWithLocations(
1726
- * "00100",
1727
- * { cartItems: cartItems }
1728
- * );
1743
+ * const options = await client.shipping.getOptions("00100", {
1744
+ * cartItems: cartItems
1745
+ * });
1729
1746
  * // Only shows methods that support the cart's total weight
1730
1747
  * ```
1748
+ *
1749
+ * @example International shipping
1750
+ * ```typescript
1751
+ * const options = await client.shipping.getOptions("112 22", {
1752
+ * country: "SE"
1753
+ * });
1754
+ * ```
1755
+ */
1756
+ getOptions(postalCode: string, options?: GetShippingOptionsParams): Promise<ShipmentMethodsResponse>;
1757
+ /**
1758
+ * @deprecated Use getOptions() instead. This method is kept for backwards compatibility.
1731
1759
  */
1732
- getWithLocations(postalCode: string, options?: GetMethodsOptions): Promise<ShipmentMethodsWithLocationsResponse>;
1760
+ getWithLocations(postalCode: string, options?: GetShippingOptionsParams): Promise<ShipmentMethodsResponse>;
1733
1761
  };
1734
1762
  /**
1735
1763
  * Type for the shipping resource
@@ -2378,13 +2406,11 @@ declare function getPriceInfo(product: ProductDetail, variation?: ProductVariati
2378
2406
  /**
2379
2407
  * Calculate cart totals with campaign discounts applied.
2380
2408
  *
2381
- * Supports two campaign types:
2382
- * - **FREE_SHIPPING**: Free shipping when cart total exceeds minimum spend
2383
- * - **BUY_X_PAY_Y**: Buy X items, pay for Y (e.g., Buy 3 Pay 2 = 1 free item)
2409
+ * Supports BUY_X_PAY_Y campaigns: Buy X items, pay for Y (e.g., Buy 3 Pay 2 = 1 free item)
2384
2410
  *
2385
2411
  * @param items - Cart items to calculate
2386
2412
  * @param campaigns - Active campaigns to apply
2387
- * @returns Calculation result with totals, savings, and free shipping status
2413
+ * @returns Calculation result with totals and savings
2388
2414
  *
2389
2415
  * @example
2390
2416
  * ```typescript
@@ -2392,7 +2418,6 @@ declare function getPriceInfo(product: ProductDetail, variation?: ProductVariati
2392
2418
  *
2393
2419
  * console.log(result.cartTotal); // 4990 (cents)
2394
2420
  * console.log(result.totalSavings); // 1990 (cents)
2395
- * console.log(result.freeShipping.isEligible); // true
2396
2421
  *
2397
2422
  * // Render calculated items
2398
2423
  * result.calculatedItems.forEach(({ item, paidQuantity, freeQuantity }) => {
@@ -2445,4 +2470,4 @@ declare class VerificationRequiredError extends StorefrontError {
2445
2470
  constructor(message: string, customerId: string);
2446
2471
  }
2447
2472
 
2448
- export { type AddToCartParams, type AddToWishlistResponse, AuthError, type BuyXPayYCampaign, type CalculatedCartItem, type Campaign, type CampaignType, type CartCalculationResult, type CartItem, type CartResponse, type CartSessionOptions, type CartValidationChanges, type CartValidationResponse, type Category, type CategoryReference, type CategoryResponse, type CheckoutCustomerData, type CheckoutErrorCode, type CheckoutErrorDetails, type CheckoutOptions, type CheckoutParams, type CheckoutShipmentMethod, type ConfirmationItemType, type ConfirmationOrderCustomerData, type ConfirmationOrderLineItem, type ConfirmationOrderShipmentMethod, type Customer, type CustomerOrder, type DeleteAccountResponse, type FeatureFlags, type FetchOptions, type ForgotPasswordResponse, type FreeShippingStatus, type GetOrdersResponse, type GetUserResponse, type LoginOptions, type LoginResponse, type LoginVerificationRequiredResponse, type LogoutResponse, NotFoundError, type Order, type OrderLineItem, type OrderProductInfo, type OrderShipmentMethod, type OrderStatus, type PaymentConfig, type PaytrailCheckoutResponse, type PaytrailGroup, type PaytrailProvider, type PickupLocation, type PriceInfo, type Product, type ProductCountResponse, type ProductDetail, type ProductListParams, type ProductListResponse, type ProductSortOption, type ProductVariation, type ProductVariationListing, RateLimitError, type RegisterData, type RegisterResponse, type RemoveFromCartParams, type RemoveFromWishlistResponse, type ResendVerificationResponse, type ResetPasswordResponse, type ShipitShippingMethod, type ShipmentMethod, type ShipmentMethodsWithLocationsResponse, type StoreConfig, type StoreInfo, type StoreSeo, type StorefrontClient, type StorefrontClientConfig, StorefrontError, type StripeCheckoutResponse, type UpdateCartQuantityParams, type UpdateProfileData, type UpdateProfileResponse, ValidationError, type VariationOption, VerificationRequiredError, type VerifyEmailResponse, type WishlistItem, type WishlistProduct, type WishlistResponse, type WishlistVariation, type WishlistVariationOption, calculateCartWithCampaigns, createStorefrontClient, getPriceInfo, isSaleActive };
2473
+ export { type AddToCartParams, type AddToWishlistResponse, AuthError, type BuyXPayYCampaign, type CalculatedCartItem, type Campaign, type CampaignType, type CartCalculationResult, type CartItem, type CartResponse, type CartSessionOptions, type CartValidationChanges, type CartValidationResponse, type Category, type CategoryReference, type CategoryResponse, type CheckoutCustomerData, type CheckoutErrorCode, type CheckoutErrorDetails, type CheckoutOptions, type CheckoutParams, type CheckoutShipmentMethod, type ConfirmationItemType, type ConfirmationOrderCustomerData, type ConfirmationOrderLineItem, type ConfirmationOrderShipmentMethod, type Customer, type CustomerOrder, type DeleteAccountResponse, type FeatureFlags, type FetchOptions, type ForgotPasswordResponse, type GetOrdersResponse, type GetUserResponse, type HomeDeliveryOption, type LoginOptions, type LoginResponse, type LoginVerificationRequiredResponse, type LogoutResponse, NotFoundError, type OpeningHours, type Order, type OrderLineItem, type OrderProductInfo, type OrderShipmentMethod, type OrderStatus, type PaymentConfig, type PaytrailCheckoutResponse, type PaytrailGroup, type PaytrailProvider, type PickupPointOption, type PriceInfo, type Product, type ProductCountResponse, type ProductDetail, type ProductListParams, type ProductListResponse, type ProductSortOption, type ProductVariation, type ProductVariationListing, RateLimitError, type RegisterData, type RegisterResponse, type RemoveFromCartParams, type RemoveFromWishlistResponse, type ResendVerificationResponse, type ResetPasswordResponse, type ShipitShippingMethod, type ShipmentMethod, type ShipmentMethodsResponse, type StoreConfig, type StoreInfo, type StoreSeo, type StorefrontClient, type StorefrontClientConfig, StorefrontError, type StripeCheckoutResponse, type UpdateCartQuantityParams, type UpdateProfileData, type UpdateProfileResponse, ValidationError, type VariationOption, VerificationRequiredError, type VerifyEmailResponse, type WishlistItem, type WishlistProduct, type WishlistResponse, type WishlistVariation, type WishlistVariationOption, calculateCartWithCampaigns, createStorefrontClient, getPriceInfo, isSaleActive };
package/dist/index.d.ts CHANGED
@@ -507,21 +507,6 @@ interface CalculatedCartItem {
507
507
  /** Total quantity in cart */
508
508
  totalQuantity: number;
509
509
  }
510
- /**
511
- * Free shipping eligibility status
512
- */
513
- interface FreeShippingStatus {
514
- /** Whether the cart qualifies for free shipping */
515
- isEligible: boolean;
516
- /** Minimum spend required for free shipping (in cents) */
517
- minimumSpend: number;
518
- /** Amount remaining to qualify for free shipping (in cents) */
519
- remainingAmount: number;
520
- /** Name of the free shipping campaign */
521
- campaignName?: string;
522
- /** IDs of shipment methods eligible for free shipping (when isEligible is true) */
523
- eligibleShipmentMethodIds?: string[];
524
- }
525
510
  /**
526
511
  * Result of cart calculation with campaigns applied
527
512
  */
@@ -534,21 +519,18 @@ interface CartCalculationResult {
534
519
  originalTotal: number;
535
520
  /** Total savings from campaigns (in cents) */
536
521
  totalSavings: number;
537
- /** Free shipping eligibility status */
538
- freeShipping: FreeShippingStatus;
539
522
  }
540
523
 
541
524
  /**
542
525
  * Shipping Types
543
526
  *
544
527
  * Types for shipment methods and pickup locations.
545
- * ShipmentMethod and ShipitShippingMethod are re-exported from storeconfig.
528
+ * Uses unified response format that works with any provider (Shipit, custom, future integrations).
546
529
  */
547
-
548
530
  /**
549
531
  * Opening hours for a pickup location
550
532
  */
551
- interface PickupLocationOpeningHours {
533
+ interface OpeningHours {
552
534
  monday: string[];
553
535
  tuesday: string[];
554
536
  wednesday: string[];
@@ -559,57 +541,82 @@ interface PickupLocationOpeningHours {
559
541
  exceptions: string[];
560
542
  }
561
543
  /**
562
- * A pickup location (parcel locker, pickup point, etc.)
563
- * Returned from Shipit API with shipmentMethodId and price attached
544
+ * A home delivery option (works for any provider)
545
+ */
546
+ interface HomeDeliveryOption {
547
+ /** ShipmentMethods.id - unique identifier for this method */
548
+ id: string;
549
+ /** Display name (e.g., "Posti Kotipaketti") */
550
+ name: string;
551
+ /** Optional description */
552
+ description: string | null;
553
+ /** Price in cents (0 if free shipping applies) */
554
+ price: number;
555
+ /** Original price in cents (always the base price before free shipping) */
556
+ originalPrice: number;
557
+ /** Free shipping threshold in cents, null = no free shipping available for this method */
558
+ freeShippingThreshold: number | null;
559
+ /** Carrier logo URL */
560
+ logo: string | null;
561
+ /** Provider type */
562
+ provider: "shipit" | "custom";
563
+ /** Carrier name (e.g., "Posti", "Matkahuolto") - null for custom methods */
564
+ carrier: string | null;
565
+ /** Estimated delivery time (e.g., "1-3") - null if not available */
566
+ estimatedDelivery: string | null;
567
+ }
568
+ /**
569
+ * A pickup point option (parcel locker, service point, etc.)
570
+ * Works for any provider that supports pickup locations.
564
571
  */
565
- interface PickupLocation {
566
- /** Unique location ID from Shipit */
572
+ interface PickupPointOption {
573
+ /** Unique pickup point ID from carrier */
567
574
  id: string;
568
- /** Shipit service ID */
575
+ /** ShipmentMethods.id - needed for checkout */
576
+ shipmentMethodId: string;
577
+ /** Shipit service ID - needed for checkout and shipment creation */
569
578
  serviceId: string;
570
- /** Location name */
579
+ /** Location name (e.g., "Lidl Graniittitalo") */
571
580
  name: string;
572
581
  /** Street address */
573
- address1: string;
582
+ address: string;
574
583
  /** City */
575
584
  city: string;
576
585
  /** Postal code */
577
- zipcode: string;
578
- /** Country code (e.g., "FI") */
579
- countryCode: string;
580
- /** Carrier name (e.g., "Posti", "Matkahuolto") */
581
- carrier: string;
586
+ postalCode: string;
587
+ /** Price in cents (0 if free shipping applies) */
588
+ price: number;
589
+ /** Original price in cents (always the base price before free shipping) */
590
+ originalPrice: number;
591
+ /** Free shipping threshold in cents, null = no free shipping available for this method */
592
+ freeShippingThreshold: number | null;
582
593
  /** Carrier logo URL */
583
- carrierLogo: string;
584
- /** GPS latitude */
585
- latitude?: number;
586
- /** GPS longitude */
587
- longitude?: number;
588
- /** Distance from postal code in meters */
589
- distanceInMeters: number;
590
- /** Distance from postal code in kilometers */
591
- distanceInKilometers: number;
592
- /** Location type (e.g., "parcel_locker", "service_point", "outdoor_parcel_locker") */
593
- type?: string;
594
+ logo: string | null;
595
+ /** Provider type */
596
+ provider: "shipit" | "custom";
597
+ /** Carrier name (e.g., "Posti", "Matkahuolto") */
598
+ carrier: string | null;
599
+ /** Distance from customer's postal code in meters */
600
+ distance: number | null;
594
601
  /** Structured opening hours */
595
- openingHours?: PickupLocationOpeningHours | null;
596
- /** Raw opening hours string from Shipit */
597
- openingHoursRaw?: string | null;
598
- /** Additional metadata */
599
- metadata?: unknown | null;
600
- /** The shipment method ID this location belongs to */
601
- shipmentMethodId: string;
602
- /** Price in cents (from store settings) */
603
- price: number;
602
+ openingHours: OpeningHours | null;
603
+ /** GPS coordinates */
604
+ coordinates: {
605
+ lat: number;
606
+ lng: number;
607
+ } | null;
604
608
  }
605
609
  /**
606
610
  * Response from GET /shipment-methods/[postalCode]
611
+ *
612
+ * Returns unified shipping options regardless of provider.
613
+ * Pickup points are sorted by distance, home delivery by price.
607
614
  */
608
- interface ShipmentMethodsWithLocationsResponse {
609
- /** Home delivery methods (custom methods + Shipit home delivery) */
610
- homeDeliveryMethods: ShipmentMethod[];
611
- /** Pickup locations with shipmentMethodId and price attached */
612
- pickupLocations: PickupLocation[];
615
+ interface ShipmentMethodsResponse {
616
+ /** Home delivery options (sorted by price) */
617
+ homeDelivery: HomeDeliveryOption[];
618
+ /** Pickup point options (sorted by distance) */
619
+ pickupPoints: PickupPointOption[];
613
620
  }
614
621
 
615
622
  /**
@@ -1126,6 +1133,8 @@ interface CheckoutShipmentMethod {
1126
1133
  shipmentMethodId: string;
1127
1134
  /** ID of pickup point (for pickup delivery methods) */
1128
1135
  pickupId: string | null;
1136
+ /** Shipit service ID (for Shipit pickup points) */
1137
+ serviceId: string | null;
1129
1138
  }
1130
1139
  /**
1131
1140
  * Parameters for creating a checkout session
@@ -1686,9 +1695,13 @@ type CartResource = ReturnType<typeof createCartResource>;
1686
1695
  /**
1687
1696
  * Options for fetching shipment methods with weight-based filtering
1688
1697
  */
1689
- interface GetMethodsOptions extends FetchOptions {
1690
- /** Cart items - weight will be calculated automatically */
1698
+ interface GetShippingOptionsParams extends FetchOptions {
1699
+ /** Cart items - weight and total will be calculated automatically */
1691
1700
  cartItems?: CartItem[];
1701
+ /** Active campaigns - used to calculate cart total with discounts for free shipping */
1702
+ campaigns?: Campaign[];
1703
+ /** Country code (default: "FI") */
1704
+ country?: string;
1692
1705
  }
1693
1706
  /**
1694
1707
  * Shipping resource for fetching shipment methods and pickup locations
@@ -1696,40 +1709,55 @@ interface GetMethodsOptions extends FetchOptions {
1696
1709
  declare function createShippingResource(fetcher: Fetcher): {
1697
1710
  /**
1698
1711
  * Get shipping options for a specific postal code.
1699
- * Returns home delivery methods and pickup locations.
1712
+ * Returns pickup points and home delivery options in a unified format.
1713
+ *
1714
+ * **Pickup points are returned first** as they are more popular in Finland.
1700
1715
  *
1701
1716
  * @param postalCode - Customer's postal code (e.g., "00100")
1702
1717
  * @param options - Fetch options including optional cartItems for weight-based filtering
1703
- * @returns Home delivery methods and pickup locations
1718
+ * @returns Unified shipping options (pickupPoints sorted by distance, homeDelivery sorted by price)
1704
1719
  *
1705
1720
  * @example
1706
1721
  * ```typescript
1707
- * const { homeDeliveryMethods, pickupLocations } = await client.shipping.getWithLocations("00100");
1708
- *
1709
- * // Show home delivery options
1710
- * homeDeliveryMethods.forEach(method => {
1711
- * console.log(`${method.name}: ${method.price / 100}€`);
1722
+ * const { pickupPoints, homeDelivery } = await client.shipping.getOptions("00100");
1723
+ *
1724
+ * // Show pickup points (more popular in Finland)
1725
+ * pickupPoints.forEach(point => {
1726
+ * console.log(`${point.name} - ${point.carrier}`);
1727
+ * console.log(` ${point.address}, ${point.city}`);
1728
+ * console.log(` ${(point.distance! / 1000).toFixed(1)} km away`);
1729
+ * console.log(` Price: ${point.price / 100}€`);
1712
1730
  * });
1713
1731
  *
1714
- * // Show pickup locations
1715
- * pickupLocations.forEach(location => {
1716
- * console.log(`${location.name} - ${location.carrier}`);
1717
- * console.log(` ${location.address1}, ${location.city}`);
1718
- * console.log(` ${location.distanceInKilometers.toFixed(1)} km away`);
1719
- * console.log(` Price: ${location.price / 100}€`);
1732
+ * // Show home delivery options
1733
+ * homeDelivery.forEach(option => {
1734
+ * console.log(`${option.name}: ${option.price / 100}€`);
1735
+ * if (option.estimatedDelivery) {
1736
+ * console.log(` Delivery: ${option.estimatedDelivery} days`);
1737
+ * }
1720
1738
  * });
1721
1739
  * ```
1722
1740
  *
1723
1741
  * @example Weight-based filtering
1724
1742
  * ```typescript
1725
- * const { homeDeliveryMethods, pickupLocations } = await client.shipping.getWithLocations(
1726
- * "00100",
1727
- * { cartItems: cartItems }
1728
- * );
1743
+ * const options = await client.shipping.getOptions("00100", {
1744
+ * cartItems: cartItems
1745
+ * });
1729
1746
  * // Only shows methods that support the cart's total weight
1730
1747
  * ```
1748
+ *
1749
+ * @example International shipping
1750
+ * ```typescript
1751
+ * const options = await client.shipping.getOptions("112 22", {
1752
+ * country: "SE"
1753
+ * });
1754
+ * ```
1755
+ */
1756
+ getOptions(postalCode: string, options?: GetShippingOptionsParams): Promise<ShipmentMethodsResponse>;
1757
+ /**
1758
+ * @deprecated Use getOptions() instead. This method is kept for backwards compatibility.
1731
1759
  */
1732
- getWithLocations(postalCode: string, options?: GetMethodsOptions): Promise<ShipmentMethodsWithLocationsResponse>;
1760
+ getWithLocations(postalCode: string, options?: GetShippingOptionsParams): Promise<ShipmentMethodsResponse>;
1733
1761
  };
1734
1762
  /**
1735
1763
  * Type for the shipping resource
@@ -2378,13 +2406,11 @@ declare function getPriceInfo(product: ProductDetail, variation?: ProductVariati
2378
2406
  /**
2379
2407
  * Calculate cart totals with campaign discounts applied.
2380
2408
  *
2381
- * Supports two campaign types:
2382
- * - **FREE_SHIPPING**: Free shipping when cart total exceeds minimum spend
2383
- * - **BUY_X_PAY_Y**: Buy X items, pay for Y (e.g., Buy 3 Pay 2 = 1 free item)
2409
+ * Supports BUY_X_PAY_Y campaigns: Buy X items, pay for Y (e.g., Buy 3 Pay 2 = 1 free item)
2384
2410
  *
2385
2411
  * @param items - Cart items to calculate
2386
2412
  * @param campaigns - Active campaigns to apply
2387
- * @returns Calculation result with totals, savings, and free shipping status
2413
+ * @returns Calculation result with totals and savings
2388
2414
  *
2389
2415
  * @example
2390
2416
  * ```typescript
@@ -2392,7 +2418,6 @@ declare function getPriceInfo(product: ProductDetail, variation?: ProductVariati
2392
2418
  *
2393
2419
  * console.log(result.cartTotal); // 4990 (cents)
2394
2420
  * console.log(result.totalSavings); // 1990 (cents)
2395
- * console.log(result.freeShipping.isEligible); // true
2396
2421
  *
2397
2422
  * // Render calculated items
2398
2423
  * result.calculatedItems.forEach(({ item, paidQuantity, freeQuantity }) => {
@@ -2445,4 +2470,4 @@ declare class VerificationRequiredError extends StorefrontError {
2445
2470
  constructor(message: string, customerId: string);
2446
2471
  }
2447
2472
 
2448
- export { type AddToCartParams, type AddToWishlistResponse, AuthError, type BuyXPayYCampaign, type CalculatedCartItem, type Campaign, type CampaignType, type CartCalculationResult, type CartItem, type CartResponse, type CartSessionOptions, type CartValidationChanges, type CartValidationResponse, type Category, type CategoryReference, type CategoryResponse, type CheckoutCustomerData, type CheckoutErrorCode, type CheckoutErrorDetails, type CheckoutOptions, type CheckoutParams, type CheckoutShipmentMethod, type ConfirmationItemType, type ConfirmationOrderCustomerData, type ConfirmationOrderLineItem, type ConfirmationOrderShipmentMethod, type Customer, type CustomerOrder, type DeleteAccountResponse, type FeatureFlags, type FetchOptions, type ForgotPasswordResponse, type FreeShippingStatus, type GetOrdersResponse, type GetUserResponse, type LoginOptions, type LoginResponse, type LoginVerificationRequiredResponse, type LogoutResponse, NotFoundError, type Order, type OrderLineItem, type OrderProductInfo, type OrderShipmentMethod, type OrderStatus, type PaymentConfig, type PaytrailCheckoutResponse, type PaytrailGroup, type PaytrailProvider, type PickupLocation, type PriceInfo, type Product, type ProductCountResponse, type ProductDetail, type ProductListParams, type ProductListResponse, type ProductSortOption, type ProductVariation, type ProductVariationListing, RateLimitError, type RegisterData, type RegisterResponse, type RemoveFromCartParams, type RemoveFromWishlistResponse, type ResendVerificationResponse, type ResetPasswordResponse, type ShipitShippingMethod, type ShipmentMethod, type ShipmentMethodsWithLocationsResponse, type StoreConfig, type StoreInfo, type StoreSeo, type StorefrontClient, type StorefrontClientConfig, StorefrontError, type StripeCheckoutResponse, type UpdateCartQuantityParams, type UpdateProfileData, type UpdateProfileResponse, ValidationError, type VariationOption, VerificationRequiredError, type VerifyEmailResponse, type WishlistItem, type WishlistProduct, type WishlistResponse, type WishlistVariation, type WishlistVariationOption, calculateCartWithCampaigns, createStorefrontClient, getPriceInfo, isSaleActive };
2473
+ export { type AddToCartParams, type AddToWishlistResponse, AuthError, type BuyXPayYCampaign, type CalculatedCartItem, type Campaign, type CampaignType, type CartCalculationResult, type CartItem, type CartResponse, type CartSessionOptions, type CartValidationChanges, type CartValidationResponse, type Category, type CategoryReference, type CategoryResponse, type CheckoutCustomerData, type CheckoutErrorCode, type CheckoutErrorDetails, type CheckoutOptions, type CheckoutParams, type CheckoutShipmentMethod, type ConfirmationItemType, type ConfirmationOrderCustomerData, type ConfirmationOrderLineItem, type ConfirmationOrderShipmentMethod, type Customer, type CustomerOrder, type DeleteAccountResponse, type FeatureFlags, type FetchOptions, type ForgotPasswordResponse, type GetOrdersResponse, type GetUserResponse, type HomeDeliveryOption, type LoginOptions, type LoginResponse, type LoginVerificationRequiredResponse, type LogoutResponse, NotFoundError, type OpeningHours, type Order, type OrderLineItem, type OrderProductInfo, type OrderShipmentMethod, type OrderStatus, type PaymentConfig, type PaytrailCheckoutResponse, type PaytrailGroup, type PaytrailProvider, type PickupPointOption, type PriceInfo, type Product, type ProductCountResponse, type ProductDetail, type ProductListParams, type ProductListResponse, type ProductSortOption, type ProductVariation, type ProductVariationListing, RateLimitError, type RegisterData, type RegisterResponse, type RemoveFromCartParams, type RemoveFromWishlistResponse, type ResendVerificationResponse, type ResetPasswordResponse, type ShipitShippingMethod, type ShipmentMethod, type ShipmentMethodsResponse, type StoreConfig, type StoreInfo, type StoreSeo, type StorefrontClient, type StorefrontClientConfig, StorefrontError, type StripeCheckoutResponse, type UpdateCartQuantityParams, type UpdateProfileData, type UpdateProfileResponse, ValidationError, type VariationOption, VerificationRequiredError, type VerifyEmailResponse, type WishlistItem, type WishlistProduct, type WishlistResponse, type WishlistVariation, type WishlistVariationOption, calculateCartWithCampaigns, createStorefrontClient, getPriceInfo, isSaleActive };