storefront-layouts 1.0.18 → 1.0.19
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/components/ui/category-tree.d.ts +5 -1
- package/dist/components/ui/category-tree.d.ts.map +1 -1
- package/dist/components/ui/category-tree.js +36 -12
- package/dist/components/ui/product-card.d.ts +1 -1
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +15 -15
- package/dist/editor/alignment-schemas/booking.d.ts.map +1 -1
- package/dist/editor/alignment-schemas/booking.js +104 -61
- package/dist/editor/alignment-schemas/clothing-minimal.d.ts.map +1 -1
- package/dist/editor/alignment-schemas/clothing-minimal.js +74 -30
- package/dist/editor/alignment-schemas/clothing.d.ts.map +1 -1
- package/dist/editor/alignment-schemas/clothing.js +87 -32
- package/dist/editor/alignment-schemas/food.d.ts.map +1 -1
- package/dist/editor/alignment-schemas/food.js +103 -48
- package/dist/editor/payaza-form/PayazaFormEditor.d.ts.map +1 -1
- package/dist/editor/payaza-form/PayazaFormEditor.js +13 -1
- package/dist/editor/payaza-form/components/ImageField.d.ts.map +1 -1
- package/dist/editor/payaza-form/components/ImageField.js +1 -1
- package/dist/editor/payaza-form/components/ToggleField.d.ts.map +1 -1
- package/dist/editor/payaza-form/components/ToggleField.js +2 -1
- package/dist/editor/payaza-form/data-merger.d.ts.map +1 -1
- package/dist/editor/payaza-form/data-merger.js +61 -9
- package/dist/editor/shared/EditorHeader.d.ts.map +1 -1
- package/dist/editor/shared/EditorHeader.js +20 -25
- package/dist/editor/shared/IframePreview.d.ts.map +1 -1
- package/dist/editor/shared/IframePreview.js +46 -22
- package/dist/hooks/use-payaza-checkout.d.ts.map +1 -1
- package/dist/hooks/use-payaza-checkout.js +0 -2
- package/dist/layouts/booking/components/booking-about-defaults.d.ts +16 -0
- package/dist/layouts/booking/components/booking-about-defaults.d.ts.map +1 -1
- package/dist/layouts/booking/components/booking-about-defaults.js +171 -1
- package/dist/layouts/booking/components/booking-footer-defaults.d.ts +2 -2
- package/dist/layouts/booking/components/booking-footer-defaults.d.ts.map +1 -1
- package/dist/layouts/booking/components/booking-footer-defaults.js +5 -8
- package/dist/layouts/booking/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/booking/pages/AboutPage.js +43 -36
- package/dist/layouts/booking/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/booking/pages/ContactPage.js +2 -2
- package/dist/layouts/booking-agenda/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/booking-agenda/pages/AboutPage.js +7 -24
- package/dist/layouts/booking-agenda/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/booking-agenda/pages/ContactPage.js +2 -2
- package/dist/layouts/clothing/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/clothing/pages/AboutPage.js +34 -17
- package/dist/layouts/clothing/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/clothing/pages/ContactPage.js +3 -3
- package/dist/layouts/clothing/pages/ProductsPage.d.ts.map +1 -1
- package/dist/layouts/clothing/pages/ProductsPage.js +18 -4
- package/dist/layouts/clothing/styles/clothing.css +28 -1
- package/dist/layouts/clothing-minimal/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/pages/AboutPage.js +36 -36
- package/dist/layouts/clothing-minimal/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/pages/ContactPage.js +2 -2
- package/dist/layouts/electronics/components/ElectronicsStoreFooter.d.ts.map +1 -1
- package/dist/layouts/electronics/components/ElectronicsStoreFooter.js +1 -1
- package/dist/layouts/electronics/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/electronics/pages/AboutPage.js +7 -24
- package/dist/layouts/electronics/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/electronics/pages/ContactPage.js +2 -2
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.js +1 -1
- package/dist/layouts/electronics-grid/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/pages/AboutPage.js +7 -24
- package/dist/layouts/electronics-grid/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/electronics-grid/pages/ContactPage.js +2 -2
- package/dist/layouts/food/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/food/pages/AboutPage.js +48 -56
- package/dist/layouts/food/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/food/pages/ContactPage.js +2 -2
- package/dist/layouts/food-modern/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/food-modern/pages/AboutPage.js +7 -24
- package/dist/layouts/food-modern/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/food-modern/pages/ContactPage.js +2 -2
- package/dist/layouts/motivational-speaker/pages/AboutPage.d.ts.map +1 -1
- package/dist/layouts/motivational-speaker/pages/AboutPage.js +7 -24
- package/dist/layouts/motivational-speaker/pages/ContactPage.d.ts.map +1 -1
- package/dist/layouts/motivational-speaker/pages/ContactPage.js +2 -2
- package/dist/layouts/shared/components/StoreFooter.d.ts.map +1 -1
- package/dist/layouts/shared/components/StoreFooter.js +4 -6
- package/dist/layouts/shared/components/StoreHeader.d.ts.map +1 -1
- package/dist/layouts/shared/components/StoreHeader.js +60 -6
- package/dist/layouts/shared/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/layouts/shared/pages/CheckoutPage.js +0 -78
- package/dist/layouts/shared/wrappers/ClothingLayout.d.ts.map +1 -1
- package/dist/layouts/shared/wrappers/ClothingLayout.js +17 -0
- package/dist/lib/mock-stores.js +1 -1
- package/dist/lib/payaza-checkout.d.ts.map +1 -1
- package/dist/lib/payaza-checkout.js +0 -33
- package/dist/lib/preview-data.d.ts.map +1 -1
- package/dist/lib/preview-data.js +3 -2
- package/dist/lib/utils/category-tree.d.ts +2 -0
- package/dist/lib/utils/category-tree.d.ts.map +1 -1
- package/dist/lib/utils/category-tree.js +15 -0
- package/dist/lib/utils/footer-nav-defaults.d.ts +11 -2
- package/dist/lib/utils/footer-nav-defaults.d.ts.map +1 -1
- package/dist/lib/utils/footer-nav-defaults.js +29 -22
- package/dist/styles/index.css +203 -212
- package/package.json +1 -1
|
@@ -283,14 +283,12 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
283
283
|
setLoading(false);
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
|
-
console.log('[Checkout] SDK callback received, verifying payment...');
|
|
287
286
|
addToast('Verifying payment...', 'info');
|
|
288
287
|
// Step 1: Immediate check if webhook already processed payment (no delay)
|
|
289
288
|
let immediateVerification;
|
|
290
289
|
try {
|
|
291
290
|
immediateVerification = await paymentService.verifyPayment(transactionRef, storeConfig.id);
|
|
292
291
|
if (immediateVerification.verified && immediateVerification.paymentStatus === 'completed') {
|
|
293
|
-
console.log('[Checkout] Payment already completed by webhook, proceeding to success page');
|
|
294
292
|
const orderId = immediateVerification.orderId || transactionRef;
|
|
295
293
|
const orderNumber = immediateVerification.orderNumber || '';
|
|
296
294
|
router.push(`/${storeConfig.slug}/order/success?orderId=${orderId}&ref=${transactionRef}${orderNumber ? `&orderNumber=${orderNumber}` : ''}`);
|
|
@@ -298,12 +296,10 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
298
296
|
}
|
|
299
297
|
}
|
|
300
298
|
catch (error) {
|
|
301
|
-
console.log('[Checkout] Immediate verification failed, proceeding with confirmation');
|
|
302
299
|
}
|
|
303
300
|
// Step 2: If webhook hasn't processed yet, immediately confirm from callback data
|
|
304
301
|
// We have the callback data from Payaza, so we can confirm immediately instead of waiting
|
|
305
302
|
if (response.callbackData) {
|
|
306
|
-
console.log('[Checkout] Processing Payaza callback confirmation immediately');
|
|
307
303
|
// Retry logic for payment confirmation
|
|
308
304
|
const MAX_RETRIES = 3;
|
|
309
305
|
const RETRY_DELAY = 1000; // 1 second
|
|
@@ -314,37 +310,30 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
314
310
|
// Confirm payment with backend and trigger order processing
|
|
315
311
|
confirmation = await paymentService.confirmPaymentFromCallback(response.callbackData);
|
|
316
312
|
if (confirmation.alreadyProcessed) {
|
|
317
|
-
console.log('[Checkout] Payment already processed, redirecting to success page');
|
|
318
313
|
}
|
|
319
314
|
else {
|
|
320
|
-
console.log('[Checkout] Payment confirmed, order processing initiated');
|
|
321
315
|
}
|
|
322
316
|
// Success - break out of retry loop
|
|
323
317
|
break;
|
|
324
318
|
}
|
|
325
319
|
catch (error) {
|
|
326
320
|
lastError = error;
|
|
327
|
-
console.error(`[Checkout] Payment confirmation attempt ${attempt} failed:`, error);
|
|
328
321
|
// If this is not the last attempt, wait before retrying
|
|
329
322
|
if (attempt < MAX_RETRIES) {
|
|
330
|
-
console.log(`[Checkout] Retrying payment confirmation in ${RETRY_DELAY}ms...`);
|
|
331
323
|
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY * attempt)); // Exponential backoff
|
|
332
324
|
}
|
|
333
325
|
}
|
|
334
326
|
}
|
|
335
327
|
// If all retries failed, do a short poll to catch webhook processing (max 3 seconds)
|
|
336
328
|
if (!confirmation) {
|
|
337
|
-
console.log('[Checkout] Confirmation failed, doing short poll for webhook processing...');
|
|
338
329
|
try {
|
|
339
330
|
const polledVerification = await paymentService.pollPaymentStatus(transactionRef, storeConfig.id, {
|
|
340
331
|
maxAttempts: 3, // Poll for max 3 seconds (3 * 1s)
|
|
341
332
|
intervalMs: 1000, // Poll every 1 second
|
|
342
333
|
onProgress: (attempt, maxAttempts) => {
|
|
343
|
-
console.log(`[Checkout] Polling for webhook (${attempt}/${maxAttempts})...`);
|
|
344
334
|
}
|
|
345
335
|
});
|
|
346
336
|
if (polledVerification && polledVerification.verified && polledVerification.paymentStatus === 'completed') {
|
|
347
|
-
console.log('[Checkout] Payment completed by webhook, proceeding to success page');
|
|
348
337
|
const orderId = polledVerification.orderId || transactionRef;
|
|
349
338
|
const orderNumber = polledVerification.orderNumber || '';
|
|
350
339
|
router.push(`/${storeConfig.slug}/order/success?orderId=${orderId}&ref=${transactionRef}${orderNumber ? `&orderNumber=${orderNumber}` : ''}`);
|
|
@@ -352,10 +341,8 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
352
341
|
}
|
|
353
342
|
}
|
|
354
343
|
catch (pollError) {
|
|
355
|
-
console.error('[Checkout] Polling also failed:', pollError);
|
|
356
344
|
}
|
|
357
345
|
// Final fallback: Redirect to callback page for manual verification
|
|
358
|
-
console.log('[Checkout] Redirecting to callback page for verification');
|
|
359
346
|
addToast('Payment successful. Verifying transaction...', 'info');
|
|
360
347
|
router.push(`/${storeConfig.slug}/payment/callback?reference=${transactionRef}&storeId=${storeConfig.id}`);
|
|
361
348
|
return;
|
|
@@ -368,7 +355,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
368
355
|
}
|
|
369
356
|
else {
|
|
370
357
|
// Fallback: Use transaction reference to verify payment
|
|
371
|
-
console.log('[Checkout] No callback data, verifying payment with transaction reference:', response.transactionRef);
|
|
372
358
|
if (response.transactionRef) {
|
|
373
359
|
// Redirect to callback page for verification and confirmation
|
|
374
360
|
router.push(`/${storeConfig.slug}/payment/callback?reference=${response.transactionRef}&storeId=${storeConfig.id}`);
|
|
@@ -380,7 +366,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
380
366
|
}
|
|
381
367
|
}
|
|
382
368
|
catch (error) {
|
|
383
|
-
console.error('[Checkout] Error processing payment callback:', error);
|
|
384
369
|
// Fallback: Try to redirect to callback page for verification
|
|
385
370
|
const transactionRef = response.transactionRef || response.callbackData?.data?.transaction_reference;
|
|
386
371
|
if (transactionRef) {
|
|
@@ -682,7 +667,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
682
667
|
}
|
|
683
668
|
}
|
|
684
669
|
catch (error) {
|
|
685
|
-
console.warn('[Checkout] Fee preview unavailable:', error);
|
|
686
670
|
if (!cancelled) {
|
|
687
671
|
setFeePreview(null);
|
|
688
672
|
lastFeePreviewKeyRef.current = null;
|
|
@@ -812,7 +796,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
812
796
|
// Validate currency availability
|
|
813
797
|
const hasCurrency = storeConfig.settings?.currency || checkoutItems.some(item => item.product.currency);
|
|
814
798
|
if (!hasCurrency) {
|
|
815
|
-
console.warn('[Checkout] No currency found, will use USD fallback');
|
|
816
799
|
}
|
|
817
800
|
return { isValid: true };
|
|
818
801
|
};
|
|
@@ -838,11 +821,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
838
821
|
let checkoutConfig;
|
|
839
822
|
try {
|
|
840
823
|
// Step 1: Create order via API before payment
|
|
841
|
-
console.log('[Checkout] Step 1: Creating order via API', {
|
|
842
|
-
storeId: storeConfig.id,
|
|
843
|
-
itemCount: checkoutItems.length,
|
|
844
|
-
customerEmail: formData.email,
|
|
845
|
-
});
|
|
846
824
|
try {
|
|
847
825
|
checkoutResponse = await checkoutService.processCheckout({
|
|
848
826
|
storeId: storeConfig.id,
|
|
@@ -877,12 +855,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
877
855
|
displayCurrency: currency,
|
|
878
856
|
chargeCurrency: currency,
|
|
879
857
|
});
|
|
880
|
-
console.log('[Checkout] Step 1: Order created successfully', {
|
|
881
|
-
orderId: checkoutResponse.orderId,
|
|
882
|
-
orderNumber: checkoutResponse.orderNumber,
|
|
883
|
-
currency: checkoutResponse.currency,
|
|
884
|
-
transactionReference: checkoutResponse.transactionReference,
|
|
885
|
-
});
|
|
886
858
|
const isFreeOrderResponse = checkoutResponse.paymentNotRequired === true ||
|
|
887
859
|
(checkoutResponse.totalAmount != null && Number(checkoutResponse.totalAmount) <= 0);
|
|
888
860
|
if (isFreeOrderResponse) {
|
|
@@ -893,16 +865,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
893
865
|
}
|
|
894
866
|
}
|
|
895
867
|
catch (apiError) {
|
|
896
|
-
console.error('[Checkout] Step 1: API call failed', {
|
|
897
|
-
error: apiError,
|
|
898
|
-
message: apiError?.message,
|
|
899
|
-
status: apiError?.status,
|
|
900
|
-
data: apiError?.data,
|
|
901
|
-
requestData: {
|
|
902
|
-
storeId: storeConfig.id,
|
|
903
|
-
itemCount: checkoutItems.length,
|
|
904
|
-
},
|
|
905
|
-
});
|
|
906
868
|
if (apiError?.status === 0 || apiError?.code === 'ECONNABORTED' || apiError?.message?.includes('timeout')) {
|
|
907
869
|
addToast('Unable to connect to server. Please check your internet connection.', 'error');
|
|
908
870
|
}
|
|
@@ -923,13 +885,11 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
923
885
|
effectivePayazaPublicKey = requireCheckoutPayazaPublicKey(checkoutResponse);
|
|
924
886
|
}
|
|
925
887
|
catch (error) {
|
|
926
|
-
console.error('[Checkout] No Payaza public key from backend', error);
|
|
927
888
|
addToast(error instanceof Error ? error.message : 'Payment gateway not configured. Please contact support.', 'error');
|
|
928
889
|
setLoading(false);
|
|
929
890
|
return;
|
|
930
891
|
}
|
|
931
892
|
// Step 2: Convert checkout items to Payaza format
|
|
932
|
-
console.log('[Checkout] Step 2: Converting checkout items to Payaza format');
|
|
933
893
|
try {
|
|
934
894
|
const payazaItems = checkoutItems.map(item => ({
|
|
935
895
|
product: {
|
|
@@ -940,13 +900,7 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
940
900
|
quantity: item.quantity,
|
|
941
901
|
price: item.price,
|
|
942
902
|
}));
|
|
943
|
-
console.log('[Checkout] Step 2: Items converted', { itemCount: payazaItems.length });
|
|
944
903
|
// Step 3: Generate Payaza checkout config with order details
|
|
945
|
-
console.log('[Checkout] Step 3: Generating Payaza checkout config', {
|
|
946
|
-
currency: checkoutResponse.currency || storeConfig.settings?.currency,
|
|
947
|
-
orderId: checkoutResponse.orderId,
|
|
948
|
-
orderNumber: checkoutResponse.orderNumber,
|
|
949
|
-
});
|
|
950
904
|
checkoutConfig = generateCheckoutConfig(payazaItems, formData.email, effectivePayazaPublicKey, {
|
|
951
905
|
firstName: formData.firstName,
|
|
952
906
|
lastName: formData.lastName,
|
|
@@ -969,27 +923,14 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
969
923
|
zipCode: formData.postalCode,
|
|
970
924
|
},
|
|
971
925
|
});
|
|
972
|
-
console.log('[Checkout] Step 3: Checkout config generated', {
|
|
973
|
-
amount: checkoutConfig.amount,
|
|
974
|
-
currency: checkoutConfig.currency,
|
|
975
|
-
reference: checkoutConfig.reference,
|
|
976
|
-
});
|
|
977
926
|
}
|
|
978
927
|
catch (configError) {
|
|
979
|
-
console.error('[Checkout] Step 2-3: Config generation failed', {
|
|
980
|
-
error: configError,
|
|
981
|
-
message: configError?.message,
|
|
982
|
-
stack: configError?.stack,
|
|
983
|
-
});
|
|
984
928
|
addToast(configError?.message || 'Invalid checkout configuration. Please contact support.', 'error');
|
|
985
929
|
setLoading(false);
|
|
986
930
|
return;
|
|
987
931
|
}
|
|
988
932
|
// Step 4: Use transaction reference from order
|
|
989
933
|
checkoutConfig.reference = checkoutResponse.transactionReference;
|
|
990
|
-
console.log('[Checkout] Step 4: Transaction reference set', {
|
|
991
|
-
reference: checkoutConfig.reference,
|
|
992
|
-
});
|
|
993
934
|
// Step 5: Save address if requested (for authenticated users)
|
|
994
935
|
if (isAuthenticated && saveNewAddress && !selectedAddressId) {
|
|
995
936
|
try {
|
|
@@ -1009,7 +950,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
1009
950
|
isDefault: savedAddresses.length === 0, // Set as default if it's the first address
|
|
1010
951
|
label: addressLabel || undefined,
|
|
1011
952
|
});
|
|
1012
|
-
console.log('[Checkout] Address saved successfully');
|
|
1013
953
|
// Refresh addresses list
|
|
1014
954
|
const addresses = await customerService.getAddresses();
|
|
1015
955
|
setSavedAddresses(addresses);
|
|
@@ -1018,17 +958,14 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
1018
958
|
addToast('Address saved successfully!', 'success');
|
|
1019
959
|
}
|
|
1020
960
|
catch (addressError) {
|
|
1021
|
-
console.error('[Checkout] Failed to save address:', addressError);
|
|
1022
961
|
addToast('Failed to save address. You can save it later from your account.', 'error');
|
|
1023
962
|
// Don't block checkout if address save fails - just log the error
|
|
1024
963
|
// User can save address later from their account
|
|
1025
964
|
}
|
|
1026
965
|
}
|
|
1027
966
|
// Step 6: Initiate Payaza checkout
|
|
1028
|
-
console.log('[Checkout] Step 6: Initiating Payaza checkout');
|
|
1029
967
|
try {
|
|
1030
968
|
await initiateCheckout(checkoutConfig);
|
|
1031
|
-
console.log('[Checkout] Step 6: Payaza checkout initiated successfully');
|
|
1032
969
|
// Clear buyNowItem after successful checkout initiation
|
|
1033
970
|
// The item has been processed and order created
|
|
1034
971
|
if (effectiveBuyNowItem) {
|
|
@@ -1036,15 +973,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
1036
973
|
}
|
|
1037
974
|
}
|
|
1038
975
|
catch (sdkError) {
|
|
1039
|
-
console.error('[Checkout] Step 5: Payaza SDK initiation failed', {
|
|
1040
|
-
error: sdkError,
|
|
1041
|
-
message: sdkError?.message,
|
|
1042
|
-
config: {
|
|
1043
|
-
amount: checkoutConfig.amount,
|
|
1044
|
-
currency: checkoutConfig.currency,
|
|
1045
|
-
publicKey: checkoutConfig.publicKey?.substring(0, 20) + '...',
|
|
1046
|
-
},
|
|
1047
|
-
});
|
|
1048
976
|
if (sdkError?.message?.includes('SDK not loaded') || sdkError?.message?.includes('PayazaCheckout')) {
|
|
1049
977
|
addToast('Payment system is loading. Please wait a moment and try again.', 'error');
|
|
1050
978
|
}
|
|
@@ -1059,12 +987,6 @@ export function CheckoutPage({ storeConfig }) {
|
|
|
1059
987
|
}
|
|
1060
988
|
}
|
|
1061
989
|
catch (error) {
|
|
1062
|
-
console.error('[Checkout] Unexpected error in checkout flow', {
|
|
1063
|
-
error,
|
|
1064
|
-
message: error?.message,
|
|
1065
|
-
stack: error?.stack,
|
|
1066
|
-
name: error?.name,
|
|
1067
|
-
});
|
|
1068
990
|
addToast('Failed to initiate checkout. Please try again.', 'error');
|
|
1069
991
|
setLoading(false);
|
|
1070
992
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClothingLayout.d.ts","sourceRoot":"","sources":["../../../../src/layouts/shared/wrappers/ClothingLayout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClothingLayout.d.ts","sourceRoot":"","sources":["../../../../src/layouts/shared/wrappers/ClothingLayout.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AASvD,OAAO,oCAAoC,CAAC;AAE5C,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,mBAAmB,+BAmE5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { StoreHeader } from '../components/StoreHeader.js';
|
|
4
5
|
import { StoreFooter } from '../components/StoreFooter.js';
|
|
5
6
|
import { PageAnimateWrapper } from '../../../components/ui/page-animate-wrapper.js';
|
|
@@ -13,6 +14,19 @@ import '../../clothing/styles/clothing.css';
|
|
|
13
14
|
export function ClothingLayout({ children, storeConfig }) {
|
|
14
15
|
const { cartCount } = useStore();
|
|
15
16
|
const { isBackendLoading } = useLoading();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const root = document.documentElement;
|
|
19
|
+
root.dataset.storeLayout = 'clothing';
|
|
20
|
+
root.style.setProperty('--radius', '0.125rem');
|
|
21
|
+
root.style.setProperty('--radius-2xl', '0.25rem');
|
|
22
|
+
root.style.setProperty('--radius-3xl', '0.375rem');
|
|
23
|
+
return () => {
|
|
24
|
+
delete root.dataset.storeLayout;
|
|
25
|
+
root.style.removeProperty('--radius');
|
|
26
|
+
root.style.removeProperty('--radius-2xl');
|
|
27
|
+
root.style.removeProperty('--radius-3xl');
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
16
30
|
const shouldShowHeader = storeConfig.headerConfig?.show ?? true;
|
|
17
31
|
const bgPrimary = getThemeColor(storeConfig, 'background', 'primary', '#FFFFFF');
|
|
18
32
|
const bgSecondary = getThemeColor(storeConfig, 'background', 'secondary', '#FAFAFA');
|
|
@@ -39,6 +53,9 @@ export function ClothingLayout({ children, storeConfig }) {
|
|
|
39
53
|
'--theme-border-secondary': borderSecondary,
|
|
40
54
|
'--theme-accent-hover': accentHover,
|
|
41
55
|
...(accentFocus ? { '--theme-accent-focus': accentFocus } : {}),
|
|
56
|
+
'--radius': '0.125rem',
|
|
57
|
+
'--radius-2xl': '0.25rem',
|
|
58
|
+
'--radius-3xl': '0.375rem',
|
|
42
59
|
};
|
|
43
60
|
return (_jsx(AlertModalProvider, { children: _jsxs("div", { "data-layout": "clothing", className: "layout-clothing min-h-screen flex flex-col bg-white text-gray-900", style: cssVariables, children: [shouldShowHeader && _jsx(StoreHeader, { storeConfig: storeConfig, cartItemCount: cartCount }), _jsxs("main", { className: "flex-1 relative", children: [isBackendLoading && _jsx(PageContentLoader, {}), _jsx(PageAnimateWrapper, { children: children })] }), _jsx(StoreFooter, { storeConfig: storeConfig })] }) }));
|
|
44
61
|
}
|
package/dist/lib/mock-stores.js
CHANGED
|
@@ -503,7 +503,7 @@ export const mockStores = [
|
|
|
503
503
|
price: 85,
|
|
504
504
|
duration: 45,
|
|
505
505
|
categoryId: 'cat2',
|
|
506
|
-
image: 'https://
|
|
506
|
+
image: 'https://images.unsplash.com/photo-1487412947147-5cebf100ffc2?w=800&q=80',
|
|
507
507
|
},
|
|
508
508
|
{
|
|
509
509
|
id: 's4',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payaza-checkout.d.ts","sourceRoot":"","sources":["../../src/lib/payaza-checkout.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,MAAM,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jC,OAAO,KAAK,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC9G,eAAe,MAAM,EACrB,WAAW,MAAM,EACjB,UAAU;IACR,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kKAAkK;IAClK,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,eAAe,CAAC,EAAE;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,KACA,oBA2GF,CAAC"}
|
|
@@ -157,8 +157,6 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
157
157
|
catch {
|
|
158
158
|
throw new Error(`Invalid currency code: ${config.currency}. Currency must be a valid 3-letter ISO 4217 code (e.g., USD, NGN, KES, GHS)`);
|
|
159
159
|
}
|
|
160
|
-
console.log('[Payaza] Initiating checkout with npm package...');
|
|
161
|
-
console.log('[Payaza] SDK verified ready, proceeding with checkout setup');
|
|
162
160
|
if (!Number.isFinite(config.amount) || config.amount <= 0) {
|
|
163
161
|
throw new Error('Invalid payment amount. Please refresh and try again.');
|
|
164
162
|
}
|
|
@@ -174,25 +172,17 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
174
172
|
const normalizedPhone = config.phone ? normalizePhoneForPayaza(config.phone) : '';
|
|
175
173
|
// Generate transaction reference
|
|
176
174
|
const reference = config.reference || `PL${Math.floor((Math.random() * 10000000) + 1)}`;
|
|
177
|
-
console.log('[Payaza] Transaction reference:', reference);
|
|
178
175
|
// Determine connection mode — backend config is authoritative; default Live
|
|
179
176
|
if (!config.publicKey) {
|
|
180
177
|
throw new Error('Payment gateway not configured. Please contact support.');
|
|
181
178
|
}
|
|
182
179
|
const connectionMode = normalizeConnectionMode(config.connectionMode);
|
|
183
|
-
console.log('[Payaza] Connection mode:', connectionMode, config.connectionMode ? '(from backend config)' : '(default Live)');
|
|
184
180
|
// Build comprehensive additional_details metadata
|
|
185
181
|
// This data will be available in Payaza webhooks and transaction responses
|
|
186
182
|
const additionalDetails = {
|
|
187
183
|
// Merge any custom metadata first
|
|
188
184
|
...(config.metadata || {}),
|
|
189
185
|
};
|
|
190
|
-
console.log('[Payaza] Building checkout configuration...', {
|
|
191
|
-
amount: config.amount,
|
|
192
|
-
currency: validatedCurrency,
|
|
193
|
-
email: config.email,
|
|
194
|
-
connectionMode,
|
|
195
|
-
});
|
|
196
186
|
// Core order identifiers
|
|
197
187
|
if (config.storeId) {
|
|
198
188
|
additionalDetails.storeId = config.storeId;
|
|
@@ -265,9 +255,7 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
265
255
|
payazaConfig.callback_url = config.callbackUrl;
|
|
266
256
|
}
|
|
267
257
|
// Create checkout instance
|
|
268
|
-
console.log('[Payaza] Calling setup() from payaza-web-sdk...');
|
|
269
258
|
const payazaCheckout = PayazaCheckout.setup(payazaConfig);
|
|
270
|
-
console.log('[Payaza] PayazaCheckout instance created successfully');
|
|
271
259
|
// Track payment success state to prevent misleading "Payment canceled" message
|
|
272
260
|
// when checkout window closes after successful payment
|
|
273
261
|
let paymentSuccessful = false;
|
|
@@ -503,16 +491,13 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
503
491
|
});
|
|
504
492
|
// Set onClose handler: always call config.onClose() so UI loading state clears
|
|
505
493
|
payazaCheckout.setOnClose(() => {
|
|
506
|
-
console.log('[Payaza] Checkout closed', { paymentSuccessful });
|
|
507
494
|
handleClose();
|
|
508
495
|
});
|
|
509
496
|
// Show the popup
|
|
510
|
-
console.log('[Payaza] Showing checkout popup');
|
|
511
497
|
try {
|
|
512
498
|
stopIframeObserver = observePayazaIframeInsertion();
|
|
513
499
|
payazaCheckout.showPopup();
|
|
514
500
|
patchPayazaIframesInDom();
|
|
515
|
-
console.log('[Payaza] Checkout popup opened successfully');
|
|
516
501
|
// Fallback: poll for Payaza loader removal (actual load) and iframe close.
|
|
517
502
|
if (typeof document !== 'undefined' && document.querySelector) {
|
|
518
503
|
const checkLoadedAndClose = setInterval(() => {
|
|
@@ -533,10 +518,8 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
533
518
|
}
|
|
534
519
|
}
|
|
535
520
|
if (!iframe && !closeHandled && !paymentSuccessful) {
|
|
536
|
-
console.log('[Payaza] Fallback: Payaza iframe no longer in DOM, waiting for SDK callback...');
|
|
537
521
|
setTimeout(() => {
|
|
538
522
|
if (!closeHandled && !paymentSuccessful) {
|
|
539
|
-
console.log('[Payaza] Fallback: no success callback received, treating checkout as closed');
|
|
540
523
|
handleClose();
|
|
541
524
|
}
|
|
542
525
|
}, 2500);
|
|
@@ -553,16 +536,6 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
553
536
|
return;
|
|
554
537
|
stopIframeObserver?.();
|
|
555
538
|
stopIframeObserver = null;
|
|
556
|
-
console.error('[Payaza] Loader timeout: checkout overlay did not clear', {
|
|
557
|
-
keyPrefix: config.publicKey?.substring(0, 8),
|
|
558
|
-
amount: config.amount,
|
|
559
|
-
currency: validatedCurrency,
|
|
560
|
-
connectionMode,
|
|
561
|
-
email: config.email,
|
|
562
|
-
reference,
|
|
563
|
-
loaderStillVisible,
|
|
564
|
-
iframePresent,
|
|
565
|
-
});
|
|
566
539
|
teardownPayazaCheckoutDom();
|
|
567
540
|
closeHandled = true;
|
|
568
541
|
clearCloseCheckInterval();
|
|
@@ -576,7 +549,6 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
576
549
|
}
|
|
577
550
|
}
|
|
578
551
|
catch (popupError) {
|
|
579
|
-
console.error('[Payaza] Failed to show popup:', popupError);
|
|
580
552
|
// Call onError if popup fails to open
|
|
581
553
|
if (config.onError) {
|
|
582
554
|
config.onError('Failed to open payment popup. Please check if popups are blocked in your browser.');
|
|
@@ -591,11 +563,6 @@ export const initiatePayazaCheckout = async (config) => {
|
|
|
591
563
|
};
|
|
592
564
|
}
|
|
593
565
|
catch (error) {
|
|
594
|
-
console.error('[Payaza] Checkout initiation error:', {
|
|
595
|
-
error,
|
|
596
|
-
message: error instanceof Error ? error.message : 'Unknown error',
|
|
597
|
-
stack: error instanceof Error ? error.stack : undefined,
|
|
598
|
-
});
|
|
599
566
|
// Throw error instead of returning error object - let the caller handle it
|
|
600
567
|
// This ensures errors are properly propagated and not masked
|
|
601
568
|
throw error instanceof Error ? error : new Error('Failed to initialize checkout');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-data.d.ts","sourceRoot":"","sources":["../../src/lib/preview-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;GASG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAgShD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,WAAW,CA2XpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,WAAW,CAmPnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CA+JtD;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,WAAW,
|
|
1
|
+
{"version":3,"file":"preview-data.d.ts","sourceRoot":"","sources":["../../src/lib/preview-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;GASG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAgShD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,WAAW,CA2XpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,WAAW,CAmPnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CA+JtD;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,WAAW,CA6O3D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,WAAW,CA2JzD;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,WAAW,CAme3D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,WAAW,CAiSvD;AAED;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,WAAW,CAiP/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiCzE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqBvE"}
|
package/dist/lib/preview-data.js
CHANGED
|
@@ -636,6 +636,7 @@ export function getClothingPreviewData() {
|
|
|
636
636
|
about: {
|
|
637
637
|
hero: {
|
|
638
638
|
show: true,
|
|
639
|
+
badgeText: 'Est. 2024',
|
|
639
640
|
heroImage: "https://images.unsplash.com/photo-1558769132-cb1aea458c5e?q=80&w=2074&auto=format&fit=crop",
|
|
640
641
|
title: "Crafting Experiences, Delivering Joy.",
|
|
641
642
|
missionStatement: "Empowering individuals through style."
|
|
@@ -643,7 +644,6 @@ export function getClothingPreviewData() {
|
|
|
643
644
|
story: {
|
|
644
645
|
show: true,
|
|
645
646
|
content: "Fashion Hub was born from a desire to create clothing that looks good and feels even better. We believe in sustainable fashion and ethical production practices.",
|
|
646
|
-
gallerySection: []
|
|
647
647
|
},
|
|
648
648
|
stats: { show: true },
|
|
649
649
|
'contact-info': {
|
|
@@ -745,7 +745,7 @@ export function getBookingPreviewData() {
|
|
|
745
745
|
price: 85,
|
|
746
746
|
duration: 45,
|
|
747
747
|
categoryId: 'cat2',
|
|
748
|
-
image: 'https://
|
|
748
|
+
image: 'https://images.unsplash.com/photo-1487412947147-5cebf100ffc2?w=800&q=80',
|
|
749
749
|
},
|
|
750
750
|
{
|
|
751
751
|
id: 's4',
|
|
@@ -1289,6 +1289,7 @@ export function getClothingMinimalPreviewData() {
|
|
|
1289
1289
|
about: {
|
|
1290
1290
|
aboutHeader: {
|
|
1291
1291
|
show: true,
|
|
1292
|
+
badgeText: 'Est. 2024',
|
|
1292
1293
|
title: "Crafting Experiences, Delivering Joy.",
|
|
1293
1294
|
missionStatement: "Empowering individuals through style.",
|
|
1294
1295
|
heroImage: "https://images.unsplash.com/photo-1558769132-cb1aea458c5e?q=80&w=2074&auto=format&fit=crop",
|
|
@@ -7,6 +7,8 @@ import { StoreCategory } from '../store-types.js';
|
|
|
7
7
|
* @returns Array of root categories with nested children
|
|
8
8
|
*/
|
|
9
9
|
export declare function buildCategoryTree(categories: StoreCategory[]): StoreCategory[];
|
|
10
|
+
/** Sort siblings by product count (desc), then name. Recurses into children. */
|
|
11
|
+
export declare function sortCategoryTreeByProductCount(tree: StoreCategory[], counts: Record<string, number>): StoreCategory[];
|
|
10
12
|
/**
|
|
11
13
|
* Flattens a category tree back to a flat array (useful for filtering)
|
|
12
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-tree.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/category-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,a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,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,CAUnE;AAED,KAAK,kBAAkB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7E,8EAA8E;AAC9E,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,aAAa,EAAE,EAC9B,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,MAAM,CAKR;AAED,wFAAwF;AACxF,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,aAAa,EAAE,EAC3B,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,KAAK,SAAI,GACR,aAAa,EAAE,CAoBjB"}
|
|
@@ -48,6 +48,21 @@ export function buildCategoryTree(categories) {
|
|
|
48
48
|
};
|
|
49
49
|
return sortCategories(rootCategories);
|
|
50
50
|
}
|
|
51
|
+
/** Sort siblings by product count (desc), then name. Recurses into children. */
|
|
52
|
+
export function sortCategoryTreeByProductCount(tree, counts) {
|
|
53
|
+
const sortSiblings = (cats) => [...cats]
|
|
54
|
+
.sort((a, b) => {
|
|
55
|
+
const diff = (counts[b.id] ?? 0) - (counts[a.id] ?? 0);
|
|
56
|
+
if (diff !== 0)
|
|
57
|
+
return diff;
|
|
58
|
+
return a.name.localeCompare(b.name);
|
|
59
|
+
})
|
|
60
|
+
.map((cat) => ({
|
|
61
|
+
...cat,
|
|
62
|
+
children: cat.children?.length ? sortSiblings(cat.children) : cat.children,
|
|
63
|
+
}));
|
|
64
|
+
return sortSiblings(tree);
|
|
65
|
+
}
|
|
51
66
|
/**
|
|
52
67
|
* Flattens a category tree back to a flat array (useful for filtering)
|
|
53
68
|
*
|
|
@@ -3,9 +3,18 @@ export type FooterNavLink = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
href: string;
|
|
5
5
|
};
|
|
6
|
+
export declare function isContactPageEnabled(storeConfig: Pick<StoreConfig, 'pageFeatures'>): boolean;
|
|
7
|
+
export declare function resolveStoreHeaderNavLinks<T extends FooterNavLink>(storeConfig: Pick<StoreConfig, 'navigation' | 'pageFeatures'>): {
|
|
8
|
+
allLinks: T[];
|
|
9
|
+
centerLinks: T[];
|
|
10
|
+
contactLink: T | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function appendContactNavLink<T extends FooterNavLink>(links: readonly T[], storeConfig: Pick<StoreConfig, 'pageFeatures'>): T[];
|
|
13
|
+
/** Keep /contact in the Contact column only — not duplicated under Shop. */
|
|
14
|
+
export declare function withoutContactPageNavLinks<T extends FooterNavLink>(links: readonly T[]): T[];
|
|
6
15
|
/** Primary footer column links when merchant navigation.main is empty. */
|
|
7
16
|
export declare function getDefaultFooterMainLinks(storeConfig: Pick<StoreConfig, 'layout' | 'type'>): FooterNavLink[];
|
|
8
|
-
/** Support column links —
|
|
9
|
-
export declare function getDefaultFooterSupportLinks(
|
|
17
|
+
/** Support column links — hidden globally (no footer Support column). */
|
|
18
|
+
export declare function getDefaultFooterSupportLinks(_storeConfig: Pick<StoreConfig, 'layout' | 'type' | 'pageFeatures'>): FooterNavLink[];
|
|
10
19
|
export declare function getFooterPrimaryColumnTitle(storeConfig: Pick<StoreConfig, 'layout' | 'type'>): string;
|
|
11
20
|
//# sourceMappingURL=footer-nav-defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer-nav-defaults.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/footer-nav-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"footer-nav-defaults.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/footer-nav-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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Config.pageFeatures?.contactPage !== false;
|
|
3
|
+
}
|
|
4
|
+
function hrefPointsToContact(href) {
|
|
5
|
+
const normalized = href.split('?')[0]?.replace(/\/+$/, '') || '';
|
|
6
|
+
return normalized === '/contact' || normalized.endsWith('/contact');
|
|
7
|
+
}
|
|
8
|
+
export function resolveStoreHeaderNavLinks(storeConfig) {
|
|
9
|
+
const allLinks = appendContactNavLink(storeConfig.navigation?.main ?? [], storeConfig);
|
|
10
|
+
const contactLink = allLinks.find((link) => hrefPointsToContact(link.href)) ?? null;
|
|
11
|
+
const centerLinks = withoutContactPageNavLinks(allLinks);
|
|
12
|
+
return { allLinks, centerLinks, contactLink };
|
|
13
|
+
}
|
|
14
|
+
export function appendContactNavLink(links, storeConfig) {
|
|
15
|
+
if (!isContactPageEnabled(storeConfig)) {
|
|
16
|
+
return withoutContactPageNavLinks(links);
|
|
17
|
+
}
|
|
18
|
+
if (links.some((link) => hrefPointsToContact(link.href))) {
|
|
19
|
+
return [...links];
|
|
20
|
+
}
|
|
21
|
+
return [...links, { label: 'Contact Us', href: '/contact' }];
|
|
22
|
+
}
|
|
23
|
+
/** Keep /contact in the Contact column only — not duplicated under Shop. */
|
|
24
|
+
export function withoutContactPageNavLinks(links) {
|
|
25
|
+
return links.filter((link) => !hrefPointsToContact(link.href));
|
|
26
|
+
}
|
|
1
27
|
function layoutKey(storeConfig) {
|
|
2
28
|
return String(storeConfig.layout || storeConfig.type || '').toLowerCase();
|
|
3
29
|
}
|
|
@@ -32,28 +58,9 @@ export function getDefaultFooterMainLinks(storeConfig) {
|
|
|
32
58
|
{ label: 'Featured', href: '/products?featured=true' },
|
|
33
59
|
];
|
|
34
60
|
}
|
|
35
|
-
/** Support column links —
|
|
36
|
-
export function getDefaultFooterSupportLinks(
|
|
37
|
-
|
|
38
|
-
if (key === 'booking' || key === 'booking-agenda') {
|
|
39
|
-
return [
|
|
40
|
-
{ label: 'Help Center', href: '/help-center' },
|
|
41
|
-
{ label: 'Book Appointment', href: '/book' },
|
|
42
|
-
{ label: 'Contact Us', href: '/contact' },
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
if (key === 'food' || key === 'food-modern') {
|
|
46
|
-
return [
|
|
47
|
-
{ label: 'Help Center', href: '/help-center' },
|
|
48
|
-
{ label: 'Track Order', href: '/track-order' },
|
|
49
|
-
{ label: 'Contact', href: '/contact' },
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
return [
|
|
53
|
-
{ label: 'Help Center', href: '/help-center' },
|
|
54
|
-
{ label: 'Track Order', href: '/track-order' },
|
|
55
|
-
{ label: 'Style Guide', href: '/style-guide' },
|
|
56
|
-
];
|
|
61
|
+
/** Support column links — hidden globally (no footer Support column). */
|
|
62
|
+
export function getDefaultFooterSupportLinks(_storeConfig) {
|
|
63
|
+
return [];
|
|
57
64
|
}
|
|
58
65
|
export function getFooterPrimaryColumnTitle(storeConfig) {
|
|
59
66
|
const key = layoutKey(storeConfig);
|