@wix/auto_sdk_ecom_totals-calculator 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +2 -2
- package/build/cjs/{ecom-v1-totals-calculation-totals-calculator.universal-CUhBtDqC.d.ts → index.typings.d.ts} +23 -1
- package/build/cjs/index.typings.js +413 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +2 -1
- package/build/es/index.d.mts +2 -2
- package/build/es/{ecom-v1-totals-calculation-totals-calculator.universal-CUhBtDqC.d.mts → index.typings.d.mts} +23 -1
- package/build/es/index.typings.mjs +374 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +2 -1
- package/build/internal/cjs/index.d.ts +2 -2
- package/build/internal/cjs/{ecom-v1-totals-calculation-totals-calculator.universal-B3E9TY7m.d.ts → index.typings.d.ts} +23 -1
- package/build/internal/cjs/index.typings.js +413 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +2 -1
- package/build/internal/es/index.d.mts +2 -2
- package/build/internal/es/{ecom-v1-totals-calculation-totals-calculator.universal-B3E9TY7m.d.mts → index.typings.d.mts} +23 -1
- package/build/internal/es/index.typings.mjs +374 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +2 -1
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { CalculateTotalsOptions, CalculateTotalsResponse } from './index.typings.js';
|
|
3
|
+
export { AdditionalFee, AdditionalFeeSource, Address, AddressLocation, AggregatedTaxBreakdown, ApiV1AdditionalFee, ApplicableLineItems, ApplicationError, AppliedDiscount, AppliedDiscountDiscountSourceOneOf, AutoTaxFallbackCalculationDetails, CalculateTotalsOptionsCouponOneOf, CalculateTotalsOptionsGiftCardOneOf, CalculateTotalsRequest, CalculateTotalsRequestCouponOneOf, CalculateTotalsRequestGiftCardOneOf, CalculatedItemModifier, CalculatedLineItem, CalculationErrors, CalculationErrorsShippingCalculationErrorOneOf, Carrier, CarrierError, CarrierErrors, CarrierServiceOption, CarrierShippingOption, CatalogReference, ChargeType, Coupon, DataFetchType, DeliveryAllocation, DeliveryLogistics, DeliveryTimeSlot, Details, DetailsKindOneOf, DiscountRule, DiscountRuleName, DiscountType, ExternalReference, FallbackReason, FieldViolation, GiftCard, Group, InvalidMembership, ItemModifier, ItemTaxFullDetails, ItemType, ItemTypeItemType, ItemTypeItemTypeDataOneOf, JurisdictionType, LineItem, LineItemDiscount, LineItemPricesData, ManualCalculationReason, Membership, MembershipName, MembershipOptions, MembershipPaymentCredits, MerchantDiscount, MerchantDiscountInput, ModifierGroup, MultiCurrencyPrice, OtherCharge, PaymentOptionType, PhysicalProperties, PickupDetails, PickupMethod, PriceSummary, RateType, Region, RuleType, Scope, SelectedCarrierServiceOption, SelectedCarrierServiceOptionOtherCharge, SelectedCarrierServiceOptionPrices, SelectedMembership, SelectedMemberships, SelectedShippingOption, ServiceProperties, ShippingInformation, ShippingOption, ShippingPrice, ShippingRegion, StreetAddress, SubscriptionFrequency, SubscriptionSettings, SystemError, TaxBreakdown, TaxCalculationDetails, TaxCalculationDetailsCalculationDetailsOneOf, TaxDetails, TaxRateBreakdown, TaxSummary, TaxableAddress, TaxableAddressTaxableAddressDataOneOf, TaxableAddressType, TotalsCalculationEntity, TranslatableString, V1AdditionalFee, V1TaxDetails, ValidationError, WeightUnit } from './index.typings.js';
|
|
4
4
|
|
|
5
5
|
declare function calculateTotals$1(httpClient: HttpClient): CalculateTotalsSignature;
|
|
6
6
|
interface CalculateTotalsSignature {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
1
3
|
interface TotalsCalculationEntity {
|
|
2
4
|
}
|
|
3
5
|
interface CalculateTotalsRequest extends CalculateTotalsRequestCouponOneOf, CalculateTotalsRequestGiftCardOneOf {
|
|
@@ -803,6 +805,8 @@ declare enum DataFetchType {
|
|
|
803
805
|
ADDITIONAL_FEES = "ADDITIONAL_FEES",
|
|
804
806
|
ORDER_VALIDATION = "ORDER_VALIDATION"
|
|
805
807
|
}
|
|
808
|
+
/** @enumType */
|
|
809
|
+
type DataFetchTypeWithLiterals = DataFetchType | 'SHIPPING' | 'DISCOUNT' | 'ADDITIONAL_FEES' | 'ORDER_VALIDATION';
|
|
806
810
|
interface ExternalReference {
|
|
807
811
|
/**
|
|
808
812
|
* ID of the app associated with the purchase flow.
|
|
@@ -1543,6 +1547,24 @@ declare enum AdditionalFeeSource {
|
|
|
1543
1547
|
}
|
|
1544
1548
|
/** @enumType */
|
|
1545
1549
|
type AdditionalFeeSourceWithLiterals = AdditionalFeeSource | 'UNKNOWN_ADDITIONAL_FEE_SOURCE' | 'SERVICE_PLUGIN' | 'ITEM' | 'MANUAL' | 'SHIPPING';
|
|
1550
|
+
/**
|
|
1551
|
+
* Returns a totals calculation for specified line items.
|
|
1552
|
+
* @public
|
|
1553
|
+
* @documentationMaturity preview
|
|
1554
|
+
* @requiredField options.lineItems._id
|
|
1555
|
+
* @requiredField options.lineItems.price
|
|
1556
|
+
* @requiredField options.lineItems.quantity
|
|
1557
|
+
* @requiredField options.merchantDiscounts.amount
|
|
1558
|
+
* @requiredField options.selectedMemberships.memberships._id
|
|
1559
|
+
* @requiredField options.selectedMemberships.memberships.appId
|
|
1560
|
+
* @requiredField options.selectedMemberships.memberships.lineItemIds
|
|
1561
|
+
* @requiredField options.selectedShippingOption.code
|
|
1562
|
+
* @permissionId ECOM.CALCULATE_TOTALS
|
|
1563
|
+
* @applicableIdentity APP
|
|
1564
|
+
* @applicableIdentity VISITOR
|
|
1565
|
+
* @fqn com.wix.ecom.totals_calculator.v1.TotalsCalculator.CalculateTotals
|
|
1566
|
+
*/
|
|
1567
|
+
declare function calculateTotals(options?: NonNullablePaths<CalculateTotalsOptions, `lineItems.${number}._id` | `lineItems.${number}.price` | `lineItems.${number}.quantity` | `merchantDiscounts.${number}.amount` | `selectedMemberships.memberships.${number}._id` | `selectedMemberships.memberships.${number}.appId` | `selectedMemberships.memberships.${number}.lineItemIds` | `selectedShippingOption.code`>): Promise<NonNullablePaths<CalculateTotalsResponse, `calculatedLineItems` | `calculatedLineItems.${number}.lineItemId` | `calculatedLineItems.${number}.pricesBreakdown.totalPriceAfterTax.amount` | `calculatedLineItems.${number}.pricesBreakdown.totalPriceAfterTax.convertedAmount` | `calculatedLineItems.${number}.pricesBreakdown.totalPriceAfterTax.formattedAmount` | `calculatedLineItems.${number}.pricesBreakdown.totalPriceAfterTax.formattedConvertedAmount` | `calculatedLineItems.${number}.pricesBreakdown.taxDetails.taxRate` | `calculatedLineItems.${number}.paymentOption` | `calculatedLineItems.${number}.taxableAddress.addressType` | `priceSummary.subtotal.amount` | `priceSummary.subtotal.convertedAmount` | `priceSummary.subtotal.formattedAmount` | `priceSummary.subtotal.formattedConvertedAmount` | `giftCard._id` | `giftCard.obfuscatedCode` | `giftCard.amount.amount` | `giftCard.amount.convertedAmount` | `giftCard.amount.formattedAmount` | `giftCard.amount.formattedConvertedAmount` | `giftCard.appId` | `taxSummary.taxableAmount.amount` | `taxSummary.taxableAmount.convertedAmount` | `taxSummary.taxableAmount.formattedAmount` | `taxSummary.taxableAmount.formattedConvertedAmount` | `taxSummary.calculationDetails.manualRateReason` | `taxSummary.calculationDetails.autoTaxFallbackDetails.fallbackReason` | `taxSummary.calculationDetails.autoTaxFallbackDetails.error.code` | `taxSummary.calculationDetails.autoTaxFallbackDetails.error.description` | `taxSummary.calculationDetails.rateType` | `shippingInfo.region._id` | `shippingInfo.region.name` | `shippingInfo.selectedCarrierServiceOption.code` | `shippingInfo.selectedCarrierServiceOption.title` | `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.streetAddress.number` | `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.streetAddress.name` | `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.businessLocation` | `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.pickupMethod` | `shippingInfo.selectedCarrierServiceOption.cost.totalPriceAfterTax.amount` | `shippingInfo.selectedCarrierServiceOption.cost.totalPriceAfterTax.convertedAmount` | `shippingInfo.selectedCarrierServiceOption.cost.totalPriceAfterTax.formattedAmount` | `shippingInfo.selectedCarrierServiceOption.cost.totalPriceAfterTax.formattedConvertedAmount` | `shippingInfo.selectedCarrierServiceOption.cost.taxDetails.taxRate` | `shippingInfo.selectedCarrierServiceOption.cost.taxDetails.rateBreakdown` | `shippingInfo.selectedCarrierServiceOption.cost.taxDetails.rateBreakdown.${number}.name` | `shippingInfo.selectedCarrierServiceOption.cost.taxDetails.rateBreakdown.${number}.rate` | `shippingInfo.selectedCarrierServiceOption.requestedShippingOption` | `shippingInfo.selectedCarrierServiceOption.otherCharges` | `shippingInfo.selectedCarrierServiceOption.otherCharges.${number}.type` | `shippingInfo.selectedCarrierServiceOption.deliveryAllocations` | `shippingInfo.selectedCarrierServiceOption.deliveryAllocations.${number}.deliveryCarrier.code` | `shippingInfo.carrierServiceOptions` | `shippingInfo.carrierServiceOptions.${number}.carrierId` | `appliedDiscounts` | `appliedDiscounts.${number}.coupon._id` | `appliedDiscounts.${number}.coupon.code` | `appliedDiscounts.${number}.coupon.amount.amount` | `appliedDiscounts.${number}.coupon.amount.convertedAmount` | `appliedDiscounts.${number}.coupon.amount.formattedAmount` | `appliedDiscounts.${number}.coupon.amount.formattedConvertedAmount` | `appliedDiscounts.${number}.coupon.name` | `appliedDiscounts.${number}.discountRule._id` | `appliedDiscounts.${number}.discountRule.name.original` | `appliedDiscounts.${number}.discountType` | `calculationErrors.generalShippingCalculationError.applicationError.code` | `calculationErrors.generalShippingCalculationError.applicationError.description` | `calculationErrors.generalShippingCalculationError.validationError.fieldViolations` | `calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.field` | `calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.description` | `calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.violatedRule` | `calculationErrors.carrierErrors.errors` | `calculationErrors.carrierErrors.errors.${number}.carrierId` | `calculationErrors.orderValidationErrors` | `weightUnit` | `currency` | `conversionCurrency` | `taxIncludedInPrice` | `payNow.subtotal.amount` | `payNow.subtotal.convertedAmount` | `payNow.subtotal.formattedAmount` | `payNow.subtotal.formattedConvertedAmount` | `payLater.subtotal.amount` | `payLater.subtotal.convertedAmount` | `payLater.subtotal.formattedAmount` | `payLater.subtotal.formattedConvertedAmount` | `membershipOptions.eligibleMemberships` | `membershipOptions.eligibleMemberships.${number}._id` | `membershipOptions.eligibleMemberships.${number}.appId` | `membershipOptions.eligibleMemberships.${number}.name.original` | `membershipOptions.eligibleMemberships.${number}.credits.total` | `membershipOptions.eligibleMemberships.${number}.credits.remaining` | `membershipOptions.invalidMemberships` | `membershipOptions.invalidMemberships.${number}.reason` | `membershipOptions.selectedMemberships` | `membershipOptions.selectedMemberships.${number}._id` | `membershipOptions.selectedMemberships.${number}.appId` | `additionalFees` | `additionalFees.${number}.name` | `additionalFees.${number}.price.amount` | `additionalFees.${number}.price.convertedAmount` | `additionalFees.${number}.price.formattedAmount` | `additionalFees.${number}.price.formattedConvertedAmount` | `additionalFees.${number}.taxDetails.taxRate` | `additionalFees.${number}.source` | `siteCurrency` | `payNowTotalAfterGiftCard.amount` | `payNowTotalAfterGiftCard.convertedAmount` | `payNowTotalAfterGiftCard.formattedAmount` | `payNowTotalAfterGiftCard.formattedConvertedAmount` | `totalAfterGiftCard.amount` | `totalAfterGiftCard.convertedAmount` | `totalAfterGiftCard.formattedAmount` | `totalAfterGiftCard.formattedConvertedAmount` | `payAfterFreeTrial.subtotal.amount` | `payAfterFreeTrial.subtotal.convertedAmount` | `payAfterFreeTrial.subtotal.formattedAmount` | `payAfterFreeTrial.subtotal.formattedConvertedAmount`>>;
|
|
1546
1568
|
interface CalculateTotalsOptions extends CalculateTotalsOptionsCouponOneOf, CalculateTotalsOptionsGiftCardOneOf {
|
|
1547
1569
|
/**
|
|
1548
1570
|
* Calculation ID. An identifier of the entity that you are calculating totals for, for example, cart ID or checkout ID.
|
|
@@ -1629,4 +1651,4 @@ interface CalculateTotalsOptionsGiftCardOneOf {
|
|
|
1629
1651
|
giftCardCode?: string | null;
|
|
1630
1652
|
}
|
|
1631
1653
|
|
|
1632
|
-
export { type
|
|
1654
|
+
export { type AdditionalFee, AdditionalFeeSource, type AdditionalFeeSourceWithLiterals, type Address, type AddressLocation, type AggregatedTaxBreakdown, type ApiV1AdditionalFee, type ApplicableLineItems, type ApplicationError, type AppliedDiscount, type AppliedDiscountDiscountSourceOneOf, type AutoTaxFallbackCalculationDetails, type CalculateTotalsOptions, type CalculateTotalsOptionsCouponOneOf, type CalculateTotalsOptionsGiftCardOneOf, type CalculateTotalsRequest, type CalculateTotalsRequestCouponOneOf, type CalculateTotalsRequestGiftCardOneOf, type CalculateTotalsResponse, type CalculatedItemModifier, type CalculatedLineItem, type CalculationErrors, type CalculationErrorsShippingCalculationErrorOneOf, type Carrier, type CarrierError, type CarrierErrors, type CarrierServiceOption, type CarrierShippingOption, type CatalogReference, ChargeType, type ChargeTypeWithLiterals, type Coupon, DataFetchType, type DataFetchTypeWithLiterals, type DeliveryAllocation, type DeliveryLogistics, type DeliveryTimeSlot, type Details, type DetailsKindOneOf, type DiscountRule, type DiscountRuleName, DiscountType, type DiscountTypeWithLiterals, type ExternalReference, FallbackReason, type FallbackReasonWithLiterals, type FieldViolation, type GiftCard, type Group, type InvalidMembership, type ItemModifier, type ItemTaxFullDetails, type ItemType, ItemTypeItemType, type ItemTypeItemTypeDataOneOf, type ItemTypeItemTypeWithLiterals, JurisdictionType, type JurisdictionTypeWithLiterals, type LineItem, type LineItemDiscount, type LineItemPricesData, ManualCalculationReason, type ManualCalculationReasonWithLiterals, type Membership, type MembershipName, type MembershipOptions, type MembershipPaymentCredits, type MerchantDiscount, type MerchantDiscountInput, type ModifierGroup, type MultiCurrencyPrice, type OtherCharge, PaymentOptionType, type PaymentOptionTypeWithLiterals, type PhysicalProperties, type PickupDetails, PickupMethod, type PickupMethodWithLiterals, type PriceSummary, RateType, type RateTypeWithLiterals, type Region, RuleType, type RuleTypeWithLiterals, type Scope, type SelectedCarrierServiceOption, type SelectedCarrierServiceOptionOtherCharge, type SelectedCarrierServiceOptionPrices, type SelectedMembership, type SelectedMemberships, type SelectedShippingOption, type ServiceProperties, type ShippingInformation, type ShippingOption, type ShippingPrice, type ShippingRegion, type StreetAddress, SubscriptionFrequency, type SubscriptionFrequencyWithLiterals, type SubscriptionSettings, type SystemError, type TaxBreakdown, type TaxCalculationDetails, type TaxCalculationDetailsCalculationDetailsOneOf, type TaxDetails, type TaxRateBreakdown, type TaxSummary, type TaxableAddress, type TaxableAddressTaxableAddressDataOneOf, TaxableAddressType, type TaxableAddressTypeWithLiterals, type TotalsCalculationEntity, type TranslatableString, type V1AdditionalFee, type V1TaxDetails, type ValidationError, WeightUnit, type WeightUnitWithLiterals, calculateTotals };
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.typings.ts
|
|
21
|
+
var index_typings_exports = {};
|
|
22
|
+
__export(index_typings_exports, {
|
|
23
|
+
AdditionalFeeSource: () => AdditionalFeeSource,
|
|
24
|
+
ChargeType: () => ChargeType,
|
|
25
|
+
DataFetchType: () => DataFetchType,
|
|
26
|
+
DiscountType: () => DiscountType,
|
|
27
|
+
FallbackReason: () => FallbackReason,
|
|
28
|
+
ItemTypeItemType: () => ItemTypeItemType,
|
|
29
|
+
JurisdictionType: () => JurisdictionType,
|
|
30
|
+
ManualCalculationReason: () => ManualCalculationReason,
|
|
31
|
+
PaymentOptionType: () => PaymentOptionType,
|
|
32
|
+
PickupMethod: () => PickupMethod,
|
|
33
|
+
RateType: () => RateType,
|
|
34
|
+
RuleType: () => RuleType,
|
|
35
|
+
SubscriptionFrequency: () => SubscriptionFrequency,
|
|
36
|
+
TaxableAddressType: () => TaxableAddressType,
|
|
37
|
+
WeightUnit: () => WeightUnit,
|
|
38
|
+
calculateTotals: () => calculateTotals2
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(index_typings_exports);
|
|
41
|
+
|
|
42
|
+
// src/ecom-v1-totals-calculation-totals-calculator.universal.ts
|
|
43
|
+
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
44
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
45
|
+
|
|
46
|
+
// src/ecom-v1-totals-calculation-totals-calculator.http.ts
|
|
47
|
+
var import_float = require("@wix/sdk-runtime/transformations/float");
|
|
48
|
+
var import_float2 = require("@wix/sdk-runtime/transformations/float");
|
|
49
|
+
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
50
|
+
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
51
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
52
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
53
|
+
function resolveComWixEcomTotalsCalculatorV1TotalsCalculatorUrl(opts) {
|
|
54
|
+
const domainToMappings = {
|
|
55
|
+
"bo._base_domain_": [
|
|
56
|
+
{
|
|
57
|
+
srcPath: "/totals-calculator",
|
|
58
|
+
destPath: ""
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"wixbo.ai": [
|
|
62
|
+
{
|
|
63
|
+
srcPath: "/totals-calculator",
|
|
64
|
+
destPath: ""
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"wix-bo.com": [
|
|
68
|
+
{
|
|
69
|
+
srcPath: "/totals-calculator",
|
|
70
|
+
destPath: ""
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"www.wixapis.com": [
|
|
74
|
+
{
|
|
75
|
+
srcPath: "/ecom/v1/calculate-totals",
|
|
76
|
+
destPath: "/v1/calculate-totals"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
_: [
|
|
80
|
+
{
|
|
81
|
+
srcPath: "/_api/totals-calculator",
|
|
82
|
+
destPath: ""
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"*.dev.wix-code.com": [
|
|
86
|
+
{
|
|
87
|
+
srcPath: "/_api/totals-calculator",
|
|
88
|
+
destPath: ""
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
93
|
+
}
|
|
94
|
+
var PACKAGE_NAME = "@wix/auto_sdk_ecom_totals-calculator";
|
|
95
|
+
function calculateTotals(payload) {
|
|
96
|
+
function __calculateTotals({ host }) {
|
|
97
|
+
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
98
|
+
{
|
|
99
|
+
transformFn: import_float.transformSDKFloatToRESTFloat,
|
|
100
|
+
paths: [
|
|
101
|
+
{ path: "lineItems.physicalProperties.weight" },
|
|
102
|
+
{ path: "shippingAddress.geocode.latitude" },
|
|
103
|
+
{ path: "shippingAddress.geocode.longitude" },
|
|
104
|
+
{ path: "billingAddress.geocode.latitude" },
|
|
105
|
+
{ path: "billingAddress.geocode.longitude" },
|
|
106
|
+
{
|
|
107
|
+
path: "shippingOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
path: "shippingOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude"
|
|
111
|
+
},
|
|
112
|
+
{ path: "appliedDiscounts.merchantDiscount.percentage" }
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
|
|
117
|
+
paths: [
|
|
118
|
+
{ path: "lineItems.serviceProperties.scheduledDate" },
|
|
119
|
+
{
|
|
120
|
+
path: "shippingOptions.shippingOptions.logistics.deliveryTimeSlot.from"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
path: "shippingOptions.shippingOptions.logistics.deliveryTimeSlot.to"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
]);
|
|
128
|
+
const metadata = {
|
|
129
|
+
entityFqdn: "wix.ecom.v1.totals_calculation",
|
|
130
|
+
method: "POST",
|
|
131
|
+
methodFqn: "com.wix.ecom.totals_calculator.v1.TotalsCalculator.CalculateTotals",
|
|
132
|
+
packageName: PACKAGE_NAME,
|
|
133
|
+
url: resolveComWixEcomTotalsCalculatorV1TotalsCalculatorUrl({
|
|
134
|
+
protoPath: "/v1/calculate-totals",
|
|
135
|
+
data: serializedData,
|
|
136
|
+
host
|
|
137
|
+
}),
|
|
138
|
+
data: serializedData,
|
|
139
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
140
|
+
{
|
|
141
|
+
transformFn: import_float2.transformRESTFloatToSDKFloat,
|
|
142
|
+
paths: [
|
|
143
|
+
{
|
|
144
|
+
path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude"
|
|
154
|
+
},
|
|
155
|
+
{ path: "appliedDiscounts.merchantDiscount.percentage" }
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
160
|
+
paths: [
|
|
161
|
+
{
|
|
162
|
+
path: "shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
path: "shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to"
|
|
172
|
+
},
|
|
173
|
+
{ path: "membershipOptions.eligibleMemberships.expirationDate" },
|
|
174
|
+
{
|
|
175
|
+
path: "membershipOptions.invalidMemberships.membership.expirationDate"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
])
|
|
180
|
+
};
|
|
181
|
+
return metadata;
|
|
182
|
+
}
|
|
183
|
+
return __calculateTotals;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/ecom-v1-totals-calculation-totals-calculator.universal.ts
|
|
187
|
+
var import_address = require("@wix/sdk-runtime/transformations/address");
|
|
188
|
+
var import_address2 = require("@wix/sdk-runtime/transformations/address");
|
|
189
|
+
var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
190
|
+
var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
|
|
191
|
+
SubscriptionFrequency2["UNDEFINED"] = "UNDEFINED";
|
|
192
|
+
SubscriptionFrequency2["DAY"] = "DAY";
|
|
193
|
+
SubscriptionFrequency2["WEEK"] = "WEEK";
|
|
194
|
+
SubscriptionFrequency2["MONTH"] = "MONTH";
|
|
195
|
+
SubscriptionFrequency2["YEAR"] = "YEAR";
|
|
196
|
+
return SubscriptionFrequency2;
|
|
197
|
+
})(SubscriptionFrequency || {});
|
|
198
|
+
var PaymentOptionType = /* @__PURE__ */ ((PaymentOptionType2) => {
|
|
199
|
+
PaymentOptionType2["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
|
|
200
|
+
PaymentOptionType2["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
|
|
201
|
+
PaymentOptionType2["MEMBERSHIP"] = "MEMBERSHIP";
|
|
202
|
+
PaymentOptionType2["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
|
|
203
|
+
PaymentOptionType2["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
|
|
204
|
+
return PaymentOptionType2;
|
|
205
|
+
})(PaymentOptionType || {});
|
|
206
|
+
var ItemTypeItemType = /* @__PURE__ */ ((ItemTypeItemType2) => {
|
|
207
|
+
ItemTypeItemType2["UNRECOGNISED"] = "UNRECOGNISED";
|
|
208
|
+
ItemTypeItemType2["PHYSICAL"] = "PHYSICAL";
|
|
209
|
+
ItemTypeItemType2["DIGITAL"] = "DIGITAL";
|
|
210
|
+
ItemTypeItemType2["GIFT_CARD"] = "GIFT_CARD";
|
|
211
|
+
ItemTypeItemType2["SERVICE"] = "SERVICE";
|
|
212
|
+
return ItemTypeItemType2;
|
|
213
|
+
})(ItemTypeItemType || {});
|
|
214
|
+
var TaxableAddressType = /* @__PURE__ */ ((TaxableAddressType2) => {
|
|
215
|
+
TaxableAddressType2["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
|
|
216
|
+
TaxableAddressType2["BUSINESS"] = "BUSINESS";
|
|
217
|
+
TaxableAddressType2["BILLING"] = "BILLING";
|
|
218
|
+
TaxableAddressType2["SHIPPING"] = "SHIPPING";
|
|
219
|
+
return TaxableAddressType2;
|
|
220
|
+
})(TaxableAddressType || {});
|
|
221
|
+
var PickupMethod = /* @__PURE__ */ ((PickupMethod2) => {
|
|
222
|
+
PickupMethod2["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
223
|
+
PickupMethod2["STORE_PICKUP"] = "STORE_PICKUP";
|
|
224
|
+
PickupMethod2["PICKUP_POINT"] = "PICKUP_POINT";
|
|
225
|
+
return PickupMethod2;
|
|
226
|
+
})(PickupMethod || {});
|
|
227
|
+
var ChargeType = /* @__PURE__ */ ((ChargeType2) => {
|
|
228
|
+
ChargeType2["HANDLING_FEE"] = "HANDLING_FEE";
|
|
229
|
+
ChargeType2["INSURANCE"] = "INSURANCE";
|
|
230
|
+
return ChargeType2;
|
|
231
|
+
})(ChargeType || {});
|
|
232
|
+
var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
|
|
233
|
+
DiscountType2["GLOBAL"] = "GLOBAL";
|
|
234
|
+
DiscountType2["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
235
|
+
DiscountType2["SHIPPING"] = "SHIPPING";
|
|
236
|
+
return DiscountType2;
|
|
237
|
+
})(DiscountType || {});
|
|
238
|
+
var DataFetchType = /* @__PURE__ */ ((DataFetchType2) => {
|
|
239
|
+
DataFetchType2["SHIPPING"] = "SHIPPING";
|
|
240
|
+
DataFetchType2["DISCOUNT"] = "DISCOUNT";
|
|
241
|
+
DataFetchType2["ADDITIONAL_FEES"] = "ADDITIONAL_FEES";
|
|
242
|
+
DataFetchType2["ORDER_VALIDATION"] = "ORDER_VALIDATION";
|
|
243
|
+
return DataFetchType2;
|
|
244
|
+
})(DataFetchType || {});
|
|
245
|
+
var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
|
|
246
|
+
JurisdictionType2["UNDEFINED"] = "UNDEFINED";
|
|
247
|
+
JurisdictionType2["COUNTRY"] = "COUNTRY";
|
|
248
|
+
JurisdictionType2["STATE"] = "STATE";
|
|
249
|
+
JurisdictionType2["COUNTY"] = "COUNTY";
|
|
250
|
+
JurisdictionType2["CITY"] = "CITY";
|
|
251
|
+
JurisdictionType2["SPECIAL"] = "SPECIAL";
|
|
252
|
+
return JurisdictionType2;
|
|
253
|
+
})(JurisdictionType || {});
|
|
254
|
+
var RateType = /* @__PURE__ */ ((RateType2) => {
|
|
255
|
+
RateType2["NO_TAX_COLLECTED"] = "NO_TAX_COLLECTED";
|
|
256
|
+
RateType2["MANUAL_RATE"] = "MANUAL_RATE";
|
|
257
|
+
RateType2["AUTO_RATE"] = "AUTO_RATE";
|
|
258
|
+
RateType2["FALLBACK_RATE"] = "FALLBACK_RATE";
|
|
259
|
+
return RateType2;
|
|
260
|
+
})(RateType || {});
|
|
261
|
+
var ManualCalculationReason = /* @__PURE__ */ ((ManualCalculationReason2) => {
|
|
262
|
+
ManualCalculationReason2["GLOBAL_SETTING_TO_MANUAL"] = "GLOBAL_SETTING_TO_MANUAL";
|
|
263
|
+
ManualCalculationReason2["REGION_SETTING_TO_MANUAL"] = "REGION_SETTING_TO_MANUAL";
|
|
264
|
+
return ManualCalculationReason2;
|
|
265
|
+
})(ManualCalculationReason || {});
|
|
266
|
+
var FallbackReason = /* @__PURE__ */ ((FallbackReason2) => {
|
|
267
|
+
FallbackReason2["AUTO_TAX_FAILED"] = "AUTO_TAX_FAILED";
|
|
268
|
+
FallbackReason2["AUTO_TAX_DEACTIVATED"] = "AUTO_TAX_DEACTIVATED";
|
|
269
|
+
return FallbackReason2;
|
|
270
|
+
})(FallbackReason || {});
|
|
271
|
+
var RuleType = /* @__PURE__ */ ((RuleType2) => {
|
|
272
|
+
RuleType2["VALIDATION"] = "VALIDATION";
|
|
273
|
+
RuleType2["OTHER"] = "OTHER";
|
|
274
|
+
RuleType2["MAX"] = "MAX";
|
|
275
|
+
RuleType2["MIN"] = "MIN";
|
|
276
|
+
RuleType2["MAX_LENGTH"] = "MAX_LENGTH";
|
|
277
|
+
RuleType2["MIN_LENGTH"] = "MIN_LENGTH";
|
|
278
|
+
RuleType2["MAX_SIZE"] = "MAX_SIZE";
|
|
279
|
+
RuleType2["MIN_SIZE"] = "MIN_SIZE";
|
|
280
|
+
RuleType2["FORMAT"] = "FORMAT";
|
|
281
|
+
RuleType2["DECIMAL_LTE"] = "DECIMAL_LTE";
|
|
282
|
+
RuleType2["DECIMAL_GTE"] = "DECIMAL_GTE";
|
|
283
|
+
RuleType2["DECIMAL_LT"] = "DECIMAL_LT";
|
|
284
|
+
RuleType2["DECIMAL_GT"] = "DECIMAL_GT";
|
|
285
|
+
RuleType2["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
|
|
286
|
+
RuleType2["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
|
|
287
|
+
RuleType2["REQUIRED_FIELD"] = "REQUIRED_FIELD";
|
|
288
|
+
RuleType2["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
|
|
289
|
+
RuleType2["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
|
|
290
|
+
RuleType2["EXACT_LENGTH"] = "EXACT_LENGTH";
|
|
291
|
+
RuleType2["EXACT_SIZE"] = "EXACT_SIZE";
|
|
292
|
+
RuleType2["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
|
|
293
|
+
return RuleType2;
|
|
294
|
+
})(RuleType || {});
|
|
295
|
+
var WeightUnit = /* @__PURE__ */ ((WeightUnit2) => {
|
|
296
|
+
WeightUnit2["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
|
|
297
|
+
WeightUnit2["KG"] = "KG";
|
|
298
|
+
WeightUnit2["LB"] = "LB";
|
|
299
|
+
return WeightUnit2;
|
|
300
|
+
})(WeightUnit || {});
|
|
301
|
+
var AdditionalFeeSource = /* @__PURE__ */ ((AdditionalFeeSource2) => {
|
|
302
|
+
AdditionalFeeSource2["UNKNOWN_ADDITIONAL_FEE_SOURCE"] = "UNKNOWN_ADDITIONAL_FEE_SOURCE";
|
|
303
|
+
AdditionalFeeSource2["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
|
|
304
|
+
AdditionalFeeSource2["ITEM"] = "ITEM";
|
|
305
|
+
AdditionalFeeSource2["MANUAL"] = "MANUAL";
|
|
306
|
+
AdditionalFeeSource2["SHIPPING"] = "SHIPPING";
|
|
307
|
+
return AdditionalFeeSource2;
|
|
308
|
+
})(AdditionalFeeSource || {});
|
|
309
|
+
async function calculateTotals2(options) {
|
|
310
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
311
|
+
const payload = (0, import_transform_paths2.transformPaths)(
|
|
312
|
+
(0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
313
|
+
calculationId: options?.calculationId,
|
|
314
|
+
lineItems: options?.lineItems,
|
|
315
|
+
shippingAddress: options?.shippingAddress,
|
|
316
|
+
billingAddress: options?.billingAddress,
|
|
317
|
+
selectedShippingOption: options?.selectedShippingOption,
|
|
318
|
+
couponId: options?.couponId,
|
|
319
|
+
couponCode: options?.couponCode,
|
|
320
|
+
giftCardId: options?.giftCardId,
|
|
321
|
+
giftCardCode: options?.giftCardCode,
|
|
322
|
+
merchantDiscounts: options?.merchantDiscounts,
|
|
323
|
+
buyerEmail: options?.buyerEmail,
|
|
324
|
+
memberId: options?.memberId,
|
|
325
|
+
selectedMemberships: options?.selectedMemberships,
|
|
326
|
+
buyerPhone: options?.buyerPhone,
|
|
327
|
+
purchaseFlowId: options?.purchaseFlowId,
|
|
328
|
+
externalReferences: options?.externalReferences
|
|
329
|
+
}),
|
|
330
|
+
[
|
|
331
|
+
{
|
|
332
|
+
transformFn: import_address.transformSDKAddressToRESTAddress,
|
|
333
|
+
paths: [
|
|
334
|
+
{ path: "shippingAddress" },
|
|
335
|
+
{ path: "billingAddress" },
|
|
336
|
+
{
|
|
337
|
+
path: "shippingOptions.shippingOptions.logistics.pickupDetails.address"
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
);
|
|
343
|
+
const reqOpts = calculateTotals(payload);
|
|
344
|
+
sideEffects?.onSiteCall?.();
|
|
345
|
+
try {
|
|
346
|
+
const result = await httpClient.request(reqOpts);
|
|
347
|
+
sideEffects?.onSuccess?.(result);
|
|
348
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
|
|
349
|
+
(0, import_transform_paths2.transformPaths)(result.data, [
|
|
350
|
+
{
|
|
351
|
+
transformFn: import_address2.transformRESTAddressToSDKAddress,
|
|
352
|
+
paths: [
|
|
353
|
+
{
|
|
354
|
+
path: "shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
path: "shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
])
|
|
362
|
+
);
|
|
363
|
+
} catch (err) {
|
|
364
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
365
|
+
err,
|
|
366
|
+
{
|
|
367
|
+
spreadPathsToArguments: {},
|
|
368
|
+
explicitPathsToArguments: {
|
|
369
|
+
calculationId: "$[0].calculationId",
|
|
370
|
+
lineItems: "$[0].lineItems",
|
|
371
|
+
shippingAddress: "$[0].shippingAddress",
|
|
372
|
+
billingAddress: "$[0].billingAddress",
|
|
373
|
+
selectedShippingOption: "$[0].selectedShippingOption",
|
|
374
|
+
couponId: "$[0].couponId",
|
|
375
|
+
couponCode: "$[0].couponCode",
|
|
376
|
+
giftCardId: "$[0].giftCardId",
|
|
377
|
+
giftCardCode: "$[0].giftCardCode",
|
|
378
|
+
merchantDiscounts: "$[0].merchantDiscounts",
|
|
379
|
+
buyerEmail: "$[0].buyerEmail",
|
|
380
|
+
memberId: "$[0].memberId",
|
|
381
|
+
selectedMemberships: "$[0].selectedMemberships",
|
|
382
|
+
buyerPhone: "$[0].buyerPhone",
|
|
383
|
+
purchaseFlowId: "$[0].purchaseFlowId",
|
|
384
|
+
externalReferences: "$[0].externalReferences"
|
|
385
|
+
},
|
|
386
|
+
singleArgumentUnchanged: false
|
|
387
|
+
},
|
|
388
|
+
["options"]
|
|
389
|
+
);
|
|
390
|
+
sideEffects?.onError?.(err);
|
|
391
|
+
throw transformedError;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
395
|
+
0 && (module.exports = {
|
|
396
|
+
AdditionalFeeSource,
|
|
397
|
+
ChargeType,
|
|
398
|
+
DataFetchType,
|
|
399
|
+
DiscountType,
|
|
400
|
+
FallbackReason,
|
|
401
|
+
ItemTypeItemType,
|
|
402
|
+
JurisdictionType,
|
|
403
|
+
ManualCalculationReason,
|
|
404
|
+
PaymentOptionType,
|
|
405
|
+
PickupMethod,
|
|
406
|
+
RateType,
|
|
407
|
+
RuleType,
|
|
408
|
+
SubscriptionFrequency,
|
|
409
|
+
TaxableAddressType,
|
|
410
|
+
WeightUnit,
|
|
411
|
+
calculateTotals
|
|
412
|
+
});
|
|
413
|
+
//# sourceMappingURL=index.typings.js.map
|