@storepecker/storefront-core 2.9.0 → 2.10.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/address-BdIB6IuI.d.cts +42 -0
- package/dist/address-BdIB6IuI.d.ts +42 -0
- package/dist/api/index.cjs +38 -30
- package/dist/api/index.d.cts +27 -9
- package/dist/api/index.d.ts +27 -9
- package/dist/api/index.js +3 -3
- package/dist/{buy-now-B1dkx82V.d.cts → buy-now-B_15RUVT.d.cts} +2 -2
- package/dist/{buy-now-BgKd5p4J.d.ts → buy-now-kII0KrhP.d.ts} +2 -2
- package/dist/{cart-BGIsIZdM.d.ts → cart-DZq1ZEnE.d.ts} +1 -1
- package/dist/{cart-CyN2JQTw.d.cts → cart-DwMFBmpC.d.cts} +1 -1
- package/dist/checkout/index.cjs +115 -22
- package/dist/checkout/index.d.cts +28 -4
- package/dist/checkout/index.d.ts +28 -4
- package/dist/checkout/index.js +4 -3
- package/dist/{chunk-IG4BW3ZB.cjs → chunk-32X4SWN4.cjs} +3 -3
- package/dist/{chunk-RDUT4W3B.cjs → chunk-6APRQ2ED.cjs} +4 -1
- package/dist/{chunk-ICKTXS6B.js → chunk-6IXTFZFS.js} +3 -3
- package/dist/{chunk-7M5CVYZJ.js → chunk-A7EI7XLU.js} +8 -1
- package/dist/{chunk-CBKJ3Y2I.js → chunk-EWZ7TGI7.js} +11 -1
- package/dist/{chunk-5XVHYPOC.js → chunk-FF5N7PTB.js} +1 -1
- package/dist/{chunk-XFOUNOKO.cjs → chunk-KNG4OMS5.cjs} +8 -0
- package/dist/{chunk-CIBMO44U.cjs → chunk-NOT6VKXA.cjs} +18 -15
- package/dist/{chunk-ETXIP5XE.cjs → chunk-NRPK5GCJ.cjs} +8 -0
- package/dist/{chunk-K44JZ5NL.cjs → chunk-NSAHGMS7.cjs} +6 -1
- package/dist/chunk-QED6QJZC.cjs +603 -0
- package/dist/{chunk-SU5LVRZD.js → chunk-QQHQTBAM.js} +12 -9
- package/dist/{chunk-W6BDMNSU.js → chunk-QVO56X4E.js} +1 -1
- package/dist/{chunk-6LS5F4R3.cjs → chunk-SGJUMI3M.cjs} +11 -0
- package/dist/{chunk-YLLAP3H2.cjs → chunk-SGKLMS7W.cjs} +2 -2
- package/dist/{chunk-WFDKKOO7.js → chunk-VAU5OL72.js} +6 -1
- package/dist/{chunk-ZGMLOLTC.js → chunk-VRZRV2BR.js} +4 -1
- package/dist/{chunk-IVKJJLG7.cjs → chunk-WWJAPKRQ.cjs} +8 -8
- package/dist/chunk-Y4RNRPBC.js +545 -0
- package/dist/{chunk-YMZZCVZ2.js → chunk-ZAWZ3RB6.js} +8 -1
- package/dist/{collections-ycrA2cPL.d.ts → collections-CNh2OGbl.d.ts} +1 -1
- package/dist/{collections-8YdINtUf.d.cts → collections-CXgOv5_G.d.cts} +1 -1
- package/dist/components/address-form.cjs +6 -6
- package/dist/components/address-form.d.cts +10 -6
- package/dist/components/address-form.d.ts +10 -6
- package/dist/components/address-form.js +5 -5
- package/dist/components/digital-product-download-modal.d.cts +2 -2
- package/dist/components/digital-product-download-modal.d.ts +2 -2
- package/dist/components/index.cjs +8 -8
- package/dist/components/index.d.cts +7 -7
- package/dist/components/index.d.ts +7 -7
- package/dist/components/index.js +6 -6
- package/dist/components/search-dropdown.d.cts +4 -4
- package/dist/components/search-dropdown.d.ts +4 -4
- package/dist/components/share-button.cjs +3 -3
- package/dist/components/share-button.d.cts +1 -1
- package/dist/components/share-button.d.ts +1 -1
- package/dist/components/share-button.js +2 -2
- package/dist/components/theme-data-initializer.d.cts +5 -5
- package/dist/components/theme-data-initializer.d.ts +5 -5
- package/dist/hooks/index.cjs +685 -34
- package/dist/hooks/index.d.cts +238 -13
- package/dist/hooks/index.d.ts +238 -13
- package/dist/hooks/index.js +655 -12
- package/dist/{instagram-CqJBZ-0X.d.ts → instagram-BADLnNQ3.d.ts} +1 -1
- package/dist/{instagram-D4JUT4ZU.d.cts → instagram-DalreBu6.d.cts} +1 -1
- package/dist/models/index.d.cts +9 -8
- package/dist/models/index.d.ts +9 -8
- package/dist/{orders-COKWr7K7.d.cts → orders-B3G4CyhH.d.cts} +1 -1
- package/dist/{orders-Cp8qNCrl.d.ts → orders-Bl-Slh72.d.ts} +1 -1
- package/dist/pincode-8u7yWLpQ.d.cts +29 -0
- package/dist/pincode-8u7yWLpQ.d.ts +29 -0
- package/dist/pincode-CHM-ZD3H.d.ts +179 -0
- package/dist/pincode-Ch3bZSJz.d.cts +179 -0
- package/dist/{pixelEvents-BJNH06rS.d.cts → pixelEvents-COqZIgTu.d.cts} +5 -4
- package/dist/{pixelEvents-2Tb-_fRP.d.ts → pixelEvents-Ds6fwS9t.d.ts} +5 -4
- package/dist/{product-CZtFWhxO.d.ts → product-D9liEtl4.d.cts} +1 -0
- package/dist/{product-CZtFWhxO.d.cts → product-D9liEtl4.d.ts} +1 -0
- package/dist/store/index.cjs +7 -7
- package/dist/store/index.d.cts +6 -6
- package/dist/store/index.d.ts +6 -6
- package/dist/store/index.js +2 -2
- package/dist/{useAddressForm-DGbEn91-.d.cts → useAddressForm-fMOb5Z-a.d.ts} +6 -1
- package/dist/{useAddressForm-cO3Au33k.d.ts → useAddressForm-wleIo78M.d.cts} +6 -1
- package/dist/utils/index.cjs +60 -56
- package/dist/utils/index.d.cts +17 -8
- package/dist/utils/index.d.ts +17 -8
- package/dist/utils/index.js +4 -4
- package/dist/{wishlist-Cx9Vrszq.d.cts → wishlist-BakHvIFN.d.cts} +1 -1
- package/dist/{wishlist-CRNbfFIx.d.ts → wishlist-Cj0sQxiY.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/address-DwBZHzbI.d.cts +0 -19
- package/dist/address-DwBZHzbI.d.ts +0 -19
- package/dist/chunk-TFWTQTWE.cjs +0 -246
- package/dist/chunk-UWW5YIHL.js +0 -232
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as Yup from 'yup';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import '../
|
|
2
|
+
export { A as AddressFormat, a as AddressSchemaMessages, D as DEFAULT_ADDRESS_SCHEMA_MESSAGES, I as INVALID_PINCODE, N as NO_POSTAL_CODE, P as PINCODE_DEBOUNCE_MS, b as PINCODE_MIN_LENGTH, c as PINCODE_VALIDATION_UNAVAILABLE, d as PincodeCheck, e as PincodeMatch, R as RawAddressData, f as buildAddressFormat, g as buildAddressSchema, h as clearPincodeCache, i as findStateByName, j as findSubdivision, k as getAreaOptions, l as getPincodeError, m as getPostcodeHint, n as joinAddressLines, o as loadAddressFormat, p as lowerLabel, q as normalizePostcode, s as sanitizePincode, u as usableEmail, v as validatePincode } from '../pincode-Ch3bZSJz.cjs';
|
|
3
|
+
import { C as Cart, c as Coupon } from '../cart-DwMFBmpC.cjs';
|
|
4
|
+
import { O as Order } from '../orders-B3G4CyhH.cjs';
|
|
5
|
+
import '../pincode-8u7yWLpQ.cjs';
|
|
6
|
+
import '../product-D9liEtl4.cjs';
|
|
5
7
|
import 'react-toastify';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -24,6 +26,10 @@ declare const addressFormInitialValues: AddressFormValues;
|
|
|
24
26
|
/**
|
|
25
27
|
* Strip country calling code prefix and trim whitespace from a phone number.
|
|
26
28
|
* E.g. "+919876543210" with countryCode "IN" → "9876543210"
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Strips a leading calling code without checking the rest is a
|
|
31
|
+
* valid number, so an Indian number starting with 91 loses digits. Use
|
|
32
|
+
* `sanitizePhoneInput` from `/checkout`.
|
|
27
33
|
*/
|
|
28
34
|
declare function sanitizePhoneNumber(input: string, countryCode: string): string;
|
|
29
35
|
/**
|
|
@@ -127,6 +133,24 @@ declare function buildSubmitPayload(values: AddressFormValues & {
|
|
|
127
133
|
name: string;
|
|
128
134
|
}>): any;
|
|
129
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Validate a national phone number for a given country (e.g. "IN").
|
|
138
|
+
*
|
|
139
|
+
* Uses libphonenumber-js's default (min) metadata, which checks the number's
|
|
140
|
+
* length for the country rather than its full digit pattern
|
|
141
|
+
*/
|
|
142
|
+
declare function isValidNumber(input: string, code: string): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Address forms have a separate country/calling-code dropdown, but users often
|
|
145
|
+
* still type the code into the phone field itself (e.g. "+91 98765...",
|
|
146
|
+
* "0091...", "91 98765..."). This strips the code so only the national number
|
|
147
|
+
* is kept.
|
|
148
|
+
*
|
|
149
|
+
* @param raw The raw value typed into the phone input.
|
|
150
|
+
* @param countryCode The ISO code currently selected (e.g. "IN").
|
|
151
|
+
*/
|
|
152
|
+
declare function sanitizePhoneInput(raw: string, countryCode: string): string;
|
|
153
|
+
|
|
130
154
|
interface CartTotals {
|
|
131
155
|
totalSellingAmount: number;
|
|
132
156
|
discountAmount: number;
|
|
@@ -291,4 +315,4 @@ declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentS
|
|
|
291
315
|
isPublic?: boolean;
|
|
292
316
|
}): Promise<void>;
|
|
293
317
|
|
|
294
|
-
export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneNumber, saveAddressFormToSession };
|
|
318
|
+
export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidNumber, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneInput, sanitizePhoneNumber, saveAddressFormToSession };
|
package/dist/checkout/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as Yup from 'yup';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import '../
|
|
2
|
+
export { A as AddressFormat, a as AddressSchemaMessages, D as DEFAULT_ADDRESS_SCHEMA_MESSAGES, I as INVALID_PINCODE, N as NO_POSTAL_CODE, P as PINCODE_DEBOUNCE_MS, b as PINCODE_MIN_LENGTH, c as PINCODE_VALIDATION_UNAVAILABLE, d as PincodeCheck, e as PincodeMatch, R as RawAddressData, f as buildAddressFormat, g as buildAddressSchema, h as clearPincodeCache, i as findStateByName, j as findSubdivision, k as getAreaOptions, l as getPincodeError, m as getPostcodeHint, n as joinAddressLines, o as loadAddressFormat, p as lowerLabel, q as normalizePostcode, s as sanitizePincode, u as usableEmail, v as validatePincode } from '../pincode-CHM-ZD3H.js';
|
|
3
|
+
import { C as Cart, c as Coupon } from '../cart-DZq1ZEnE.js';
|
|
4
|
+
import { O as Order } from '../orders-Bl-Slh72.js';
|
|
5
|
+
import '../pincode-8u7yWLpQ.js';
|
|
6
|
+
import '../product-D9liEtl4.js';
|
|
5
7
|
import 'react-toastify';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -24,6 +26,10 @@ declare const addressFormInitialValues: AddressFormValues;
|
|
|
24
26
|
/**
|
|
25
27
|
* Strip country calling code prefix and trim whitespace from a phone number.
|
|
26
28
|
* E.g. "+919876543210" with countryCode "IN" → "9876543210"
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Strips a leading calling code without checking the rest is a
|
|
31
|
+
* valid number, so an Indian number starting with 91 loses digits. Use
|
|
32
|
+
* `sanitizePhoneInput` from `/checkout`.
|
|
27
33
|
*/
|
|
28
34
|
declare function sanitizePhoneNumber(input: string, countryCode: string): string;
|
|
29
35
|
/**
|
|
@@ -127,6 +133,24 @@ declare function buildSubmitPayload(values: AddressFormValues & {
|
|
|
127
133
|
name: string;
|
|
128
134
|
}>): any;
|
|
129
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Validate a national phone number for a given country (e.g. "IN").
|
|
138
|
+
*
|
|
139
|
+
* Uses libphonenumber-js's default (min) metadata, which checks the number's
|
|
140
|
+
* length for the country rather than its full digit pattern
|
|
141
|
+
*/
|
|
142
|
+
declare function isValidNumber(input: string, code: string): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Address forms have a separate country/calling-code dropdown, but users often
|
|
145
|
+
* still type the code into the phone field itself (e.g. "+91 98765...",
|
|
146
|
+
* "0091...", "91 98765..."). This strips the code so only the national number
|
|
147
|
+
* is kept.
|
|
148
|
+
*
|
|
149
|
+
* @param raw The raw value typed into the phone input.
|
|
150
|
+
* @param countryCode The ISO code currently selected (e.g. "IN").
|
|
151
|
+
*/
|
|
152
|
+
declare function sanitizePhoneInput(raw: string, countryCode: string): string;
|
|
153
|
+
|
|
130
154
|
interface CartTotals {
|
|
131
155
|
totalSellingAmount: number;
|
|
132
156
|
discountAmount: number;
|
|
@@ -291,4 +315,4 @@ declare function checkTabbyReturnStatus(orderNumber: number, callbacks: PaymentS
|
|
|
291
315
|
isPublic?: boolean;
|
|
292
316
|
}): Promise<void>;
|
|
293
317
|
|
|
294
|
-
export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneNumber, saveAddressFormToSession };
|
|
318
|
+
export { type AddressFormValues, type CartTotals, type CouponCallbacks, IP_API_CACHE_KEY, type PaymentCallbacks, type PaymentStatusCallbacks, type PlacementErrorAction, type PlacementErrorInfo, addressFormInitialValues, addressValidationSchema, applyCheckoutCoupon, buildAddressPayload, buildSubmitPayload, calculateCartTotals, checkPhonepeReturnStatus, checkPhonepeReturnStatusWithOrder, checkStripeReturnStatus, checkTabbyReturnStatus, clearAddressFormSession, decodeAddress, describePlacementError, encodeAddress, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidNumber, isValidPhoneNumber, loadAddressFormFromSession, openRazorpayCheckout, parseEditAddress, processPayment, removeCheckoutCoupon, sanitizePhoneInput, sanitizePhoneNumber, saveAddressFormToSession };
|
package/dist/checkout/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { applyCheckoutCoupon, fetchAppliedCoupon, fetchAvailableCoupons, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, openRazorpayCheckout, processPayment, removeCheckoutCoupon } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import { pixelEvents } from '../chunk-
|
|
1
|
+
export { DEFAULT_ADDRESS_SCHEMA_MESSAGES, INVALID_PINCODE, NO_POSTAL_CODE, PINCODE_DEBOUNCE_MS, PINCODE_MIN_LENGTH, PINCODE_VALIDATION_UNAVAILABLE, applyCheckoutCoupon, buildAddressFormat, buildAddressSchema, clearPincodeCache, fetchAppliedCoupon, fetchAvailableCoupons, findStateByName, findSubdivision, getAreaOptions, getPincodeError, getPostcodeHint, handleCODPayment, handlePhonepePayment, handleRazorpayFail, handleRazorpaySuccess, handleStripePayment, handleStripeSuccess, handleTabbyPayment, isValidNumber, joinAddressLines, loadAddressFormat, lowerLabel, normalizePostcode, openRazorpayCheckout, processPayment, removeCheckoutCoupon, sanitizePhoneInput, sanitizePincode, usableEmail, validatePincode } from '../chunk-Y4RNRPBC.js';
|
|
2
|
+
import '../chunk-A7EI7XLU.js';
|
|
3
|
+
import { pixelEvents } from '../chunk-VAU5OL72.js';
|
|
4
4
|
import { checkPhonepePaymentStatusPublic, checkPhonepePaymentStatus, getPublicOrderDetailsByNumber, getOrderDetailsByNumber, getStripePaymentStatusPublic, getStripePaymentStatus, verifyTabbyPayment } from '../chunk-KCLVR6G5.js';
|
|
5
5
|
export { IP_API_CACHE_KEY, addressFormInitialValues, addressValidationSchema, buildAddressPayload, buildSubmitPayload, clearAddressFormSession, decodeAddress, encodeAddress, isValidPhoneNumber, loadAddressFormFromSession, parseEditAddress, sanitizePhoneNumber, saveAddressFormToSession } from '../chunk-ELP23UGF.js';
|
|
6
|
+
import '../chunk-OSM73ETC.js';
|
|
6
7
|
import '../chunk-3SYYP3XV.js';
|
|
7
8
|
import '../chunk-WEMNXIRS.js';
|
|
8
9
|
import '../chunk-BQ256JKN.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk3YRSHPM6_cjs = require('./chunk-3YRSHPM6.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkSGJUMI3M_cjs = require('./chunk-SGJUMI3M.cjs');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
var ShareButton = ({
|
|
@@ -10,8 +10,8 @@ var ShareButton = ({
|
|
|
10
10
|
iconSize = 22
|
|
11
11
|
}) => {
|
|
12
12
|
const _handleShare = () => {
|
|
13
|
-
|
|
14
|
-
`Buy ${product.name} at ${
|
|
13
|
+
chunkSGJUMI3M_cjs.shareLink(
|
|
14
|
+
`Buy ${product.name} at ${chunkSGJUMI3M_cjs.convertToCurrency(
|
|
15
15
|
Number(product.selling_price)
|
|
16
16
|
)}`,
|
|
17
17
|
product.name
|
|
@@ -25,7 +25,10 @@ var getCountries = async () => {
|
|
|
25
25
|
};
|
|
26
26
|
var getSubdivisions = async (countryId) => {
|
|
27
27
|
return chunkECHV2JSY_cjs.http_service_default.get(`utils/subdivisions/`, {
|
|
28
|
-
params: {
|
|
28
|
+
params: {
|
|
29
|
+
country_id: countryId,
|
|
30
|
+
page_size: 500
|
|
31
|
+
}
|
|
29
32
|
});
|
|
30
33
|
};
|
|
31
34
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { updateAddress, addAddress, getCountries, getSubdivisions } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import { getAddressMeta } from './chunk-CBKJ3Y2I.js';
|
|
1
|
+
import { updateAddress, addAddress, getCountries, getSubdivisions } from './chunk-VRZRV2BR.js';
|
|
2
|
+
import { getAddressMeta } from './chunk-EWZ7TGI7.js';
|
|
4
3
|
import { addressFormInitialValues, IP_API_CACHE_KEY, addressValidationSchema, buildSubmitPayload } from './chunk-ELP23UGF.js';
|
|
4
|
+
import { getCache } from './chunk-OSM73ETC.js';
|
|
5
5
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
6
6
|
import { useFormik } from 'formik';
|
|
7
7
|
import { isSupportedCountry, getCountryCallingCode } from 'libphonenumber-js';
|
|
@@ -14,4 +14,11 @@ async function removeCoupon(couponCode) {
|
|
|
14
14
|
return http_service_default.delete("/coupon/use/");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// src/api/pincode.ts
|
|
18
|
+
var getPincodeDetails = async (pincode, country) => {
|
|
19
|
+
return http_service_default.get("utils/pincode/", {
|
|
20
|
+
params: country ? { pincode, country } : { pincode }
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { applyCoupon, getAppliedCoupon, getCoupons, getPincodeDetails, removeCoupon };
|
|
@@ -226,5 +226,15 @@ function getOrderStatus(order) {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
function focusFirstInvalidField(errors, root) {
|
|
230
|
+
if (typeof document === "undefined") return;
|
|
231
|
+
const invalid = Object.keys(errors);
|
|
232
|
+
if (invalid.length === 0) return;
|
|
233
|
+
const controls = (root ?? document).querySelectorAll("input[name], select[name], textarea[name]");
|
|
234
|
+
const target = Array.from(controls).find((el) => invalid.includes(el.getAttribute("name") ?? ""));
|
|
235
|
+
if (!target) return;
|
|
236
|
+
target.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
237
|
+
target.focus({ preventScroll: true });
|
|
238
|
+
}
|
|
229
239
|
|
|
230
|
-
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink };
|
|
240
|
+
export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, focusFirstInvalidField, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink };
|
|
@@ -16,7 +16,15 @@ async function removeCoupon(couponCode) {
|
|
|
16
16
|
return chunkECHV2JSY_cjs.http_service_default.delete("/coupon/use/");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// src/api/pincode.ts
|
|
20
|
+
var getPincodeDetails = async (pincode, country) => {
|
|
21
|
+
return chunkECHV2JSY_cjs.http_service_default.get("utils/pincode/", {
|
|
22
|
+
params: country ? { pincode, country } : { pincode }
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
19
26
|
exports.applyCoupon = applyCoupon;
|
|
20
27
|
exports.getAppliedCoupon = getAppliedCoupon;
|
|
21
28
|
exports.getCoupons = getCoupons;
|
|
29
|
+
exports.getPincodeDetails = getPincodeDetails;
|
|
22
30
|
exports.removeCoupon = removeCoupon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNRPK5GCJ_cjs = require('./chunk-NRPK5GCJ.cjs');
|
|
4
4
|
var chunkNQZ5GUOG_cjs = require('./chunk-NQZ5GUOG.cjs');
|
|
5
5
|
var chunkH6FJYRO3_cjs = require('./chunk-H6FJYRO3.cjs');
|
|
6
6
|
var chunkBBRXE57K_cjs = require('./chunk-BBRXE57K.cjs');
|
|
@@ -23,7 +23,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
23
23
|
}),
|
|
24
24
|
fetchCartItemQuantity: async () => {
|
|
25
25
|
try {
|
|
26
|
-
const { total_quantity } = await
|
|
26
|
+
const { total_quantity } = await chunkNRPK5GCJ_cjs.getCartItemQuantity();
|
|
27
27
|
set({ total_quantity });
|
|
28
28
|
} catch (error) {
|
|
29
29
|
console.error("Failed to fetch cart item quantity", error);
|
|
@@ -32,7 +32,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
32
32
|
syncCart: async (addressId, shippingOptionId) => {
|
|
33
33
|
set({ status: "loading" /* LOADING */ });
|
|
34
34
|
try {
|
|
35
|
-
const response = await
|
|
35
|
+
const response = await chunkNRPK5GCJ_cjs.getCart("/customer/cart/", addressId, shippingOptionId);
|
|
36
36
|
if (response) {
|
|
37
37
|
set({ cart: response, total_quantity: response.total_quantity, status: "idle" /* IDLE */ });
|
|
38
38
|
}
|
|
@@ -43,7 +43,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
43
43
|
fetchCart: async (addressId, shippingOptionId) => {
|
|
44
44
|
set({ status: "loading" /* LOADING */ });
|
|
45
45
|
try {
|
|
46
|
-
const response = await
|
|
46
|
+
const response = await chunkNRPK5GCJ_cjs.getCart("/customer/cart/", addressId, shippingOptionId);
|
|
47
47
|
if (response) {
|
|
48
48
|
set({ cart: response, total_quantity: response.total_quantity, status: "idle" /* IDLE */ });
|
|
49
49
|
}
|
|
@@ -55,7 +55,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
55
55
|
set({ status: "loading" /* LOADING */ });
|
|
56
56
|
try {
|
|
57
57
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
58
|
-
await
|
|
58
|
+
await chunkNRPK5GCJ_cjs.addToCart(items, customizationInputs);
|
|
59
59
|
await useCartStore.getState().syncCart(addressId);
|
|
60
60
|
} else {
|
|
61
61
|
const cart = chunkNQZ5GUOG_cjs.cart_default.get();
|
|
@@ -78,7 +78,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
78
78
|
set({ status: "loading" /* LOADING */ });
|
|
79
79
|
try {
|
|
80
80
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
81
|
-
await
|
|
81
|
+
await chunkNRPK5GCJ_cjs.removeFromCart(items);
|
|
82
82
|
await useCartStore.getState().syncCart(addressId);
|
|
83
83
|
} else {
|
|
84
84
|
const cart = chunkNQZ5GUOG_cjs.cart_default.get();
|
|
@@ -109,7 +109,7 @@ var useCartStore = zustand.create((set) => ({
|
|
|
109
109
|
set({ status: "loading" /* LOADING */ });
|
|
110
110
|
try {
|
|
111
111
|
if (chunkBBRXE57K_cjs.auth_default.getUserDetails()) {
|
|
112
|
-
await
|
|
112
|
+
await chunkNRPK5GCJ_cjs.updateCart(items);
|
|
113
113
|
await useCartStore.getState().syncCart(addressId);
|
|
114
114
|
} else {
|
|
115
115
|
const cart = chunkNQZ5GUOG_cjs.cart_default.get();
|
|
@@ -171,14 +171,7 @@ var useAuthStore = zustand.create((set, get) => ({
|
|
|
171
171
|
set({ user, status: "success" /* SUCCESS */, isAuthenticated: true });
|
|
172
172
|
const localCartItems = chunkNQZ5GUOG_cjs.cart_default.get();
|
|
173
173
|
if (localCartItems) {
|
|
174
|
-
await
|
|
175
|
-
Object.entries(localCartItems.products_quantity).map(
|
|
176
|
-
([key, value]) => ({
|
|
177
|
-
variant_id: parseInt(key),
|
|
178
|
-
quantity: value
|
|
179
|
-
})
|
|
180
|
-
)
|
|
181
|
-
);
|
|
174
|
+
await mergeLocalCart(localCartItems);
|
|
182
175
|
chunkNQZ5GUOG_cjs.cart_default.clear();
|
|
183
176
|
await useCartStore.getState().fetchCart();
|
|
184
177
|
setTimeout(() => {
|
|
@@ -210,6 +203,16 @@ var useAuthStore = zustand.create((set, get) => ({
|
|
|
210
203
|
}, 1e3);
|
|
211
204
|
}
|
|
212
205
|
}));
|
|
206
|
+
async function mergeLocalCart(localCart) {
|
|
207
|
+
const cartItems = Object.entries(localCart.products_quantity || {}).map(([key, value]) => ({
|
|
208
|
+
variant_id: parseInt(key),
|
|
209
|
+
quantity: value
|
|
210
|
+
})).filter(
|
|
211
|
+
(item) => !Number.isNaN(item.variant_id) && Number.isInteger(item.quantity) && item.quantity >= 1
|
|
212
|
+
);
|
|
213
|
+
if (cartItems.length === 0) return;
|
|
214
|
+
await chunkNRPK5GCJ_cjs.mergeCart(cartItems, localCart.customization_inputs);
|
|
215
|
+
}
|
|
213
216
|
var loginUser = async (user) => {
|
|
214
217
|
const { access, refresh, ...userData } = user;
|
|
215
218
|
localStorage.setItem(chunkNE3ZHELZ_cjs.USER_CREDENTIALS, JSON.stringify(userData));
|
|
@@ -38,6 +38,13 @@ async function addToCart(product, customizationInputs) {
|
|
|
38
38
|
customization_inputs: customizationInputs
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
async function mergeCart(product, customizationInputs) {
|
|
42
|
+
return chunkECHV2JSY_cjs.http_service_default.post("/customer/cart/", {
|
|
43
|
+
action: "merge",
|
|
44
|
+
cart_items: product,
|
|
45
|
+
customization_inputs: customizationInputs
|
|
46
|
+
});
|
|
47
|
+
}
|
|
41
48
|
async function removeFromCart(product) {
|
|
42
49
|
return chunkECHV2JSY_cjs.http_service_default.post("/customer/cart/", {
|
|
43
50
|
action: "remove",
|
|
@@ -134,6 +141,7 @@ exports.getProductDetailBySlug = getProductDetailBySlug;
|
|
|
134
141
|
exports.getProductList = getProductList;
|
|
135
142
|
exports.getProducts = getProducts;
|
|
136
143
|
exports.getWishlist = getWishlist;
|
|
144
|
+
exports.mergeCart = mergeCart;
|
|
137
145
|
exports.notifyProductStock = notifyProductStock;
|
|
138
146
|
exports.removeFromCart = removeFromCart;
|
|
139
147
|
exports.removeFromWishlist = removeFromWishlist;
|
|
@@ -31,6 +31,7 @@ var pixelEvents = {
|
|
|
31
31
|
content_slug: product.slug,
|
|
32
32
|
content_name: product.name,
|
|
33
33
|
content_type: "product",
|
|
34
|
+
currency: window.currency_code || "INR",
|
|
34
35
|
price: Number(product.selling_price) * quantity,
|
|
35
36
|
num_items: quantity,
|
|
36
37
|
attributes: product.attributes
|
|
@@ -46,6 +47,7 @@ var pixelEvents = {
|
|
|
46
47
|
content_slug: product.slug,
|
|
47
48
|
content_name: product.name,
|
|
48
49
|
content_type: "product",
|
|
50
|
+
currency: window.currency_code || "INR",
|
|
49
51
|
price: Number(product.selling_price),
|
|
50
52
|
attributes: product.attributes
|
|
51
53
|
});
|
|
@@ -63,6 +65,7 @@ var pixelEvents = {
|
|
|
63
65
|
content_slug: product.slug,
|
|
64
66
|
content_name: product.name,
|
|
65
67
|
content_type: "product",
|
|
68
|
+
currency: window.currency_code || "INR",
|
|
66
69
|
price: Number(product.selling_price),
|
|
67
70
|
attributes: product.attributes
|
|
68
71
|
});
|
|
@@ -144,6 +147,7 @@ var pixelEvents = {
|
|
|
144
147
|
try {
|
|
145
148
|
window.fbq("track", "cart_viewed", {
|
|
146
149
|
content_type: "cart",
|
|
150
|
+
currency: window.currency_code || "INR",
|
|
147
151
|
value: cart.total_amount,
|
|
148
152
|
number_of_products: cart.total_quantity
|
|
149
153
|
});
|
|
@@ -161,7 +165,7 @@ var pixelEvents = {
|
|
|
161
165
|
content_ids: [orderSummary.order_number],
|
|
162
166
|
order_number: orderSummary.order_number,
|
|
163
167
|
content_type: "product",
|
|
164
|
-
currency: "INR",
|
|
168
|
+
currency: window.currency_code || "INR",
|
|
165
169
|
value: orderSummary.total_amount,
|
|
166
170
|
num_items: orderSummary.purchased_products.length,
|
|
167
171
|
contents: orderSummary.purchased_products.map((item) => ({
|
|
@@ -192,6 +196,7 @@ var pixelEvents = {
|
|
|
192
196
|
if (!window.fbq) return;
|
|
193
197
|
try {
|
|
194
198
|
window.fbq("track", "checkout_started", {
|
|
199
|
+
currency: window.currency_code || "INR",
|
|
195
200
|
value: cart.total_amount,
|
|
196
201
|
number_of_products: cart.total_quantity
|
|
197
202
|
});
|