@bikdotai/bik-component-library 0.0.725-beta.0 → 0.0.725-beta.10
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/cjs/assets/icons/searchIcon.svg.js +1 -0
- package/dist/cjs/assets/icons/whatsNew.svg.js +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +1 -5
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.d.ts +0 -6
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.js +2 -23
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.d.ts +0 -12
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/VideoModal.d.ts +3 -0
- package/dist/cjs/components/feature-announcements/VideoModal.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/animations.d.ts +27 -0
- package/dist/cjs/components/feature-announcements/constants/animations.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/dimensions.d.ts +56 -0
- package/dist/cjs/components/feature-announcements/constants/dimensions.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/index.d.ts +19 -0
- package/dist/cjs/components/feature-announcements/constants/index.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/localStorageKeys.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/constants/localStorageKeys.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/selectors.d.ts +21 -0
- package/dist/cjs/components/feature-announcements/constants/selectors.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/zIndex.d.ts +10 -0
- package/dist/cjs/components/feature-announcements/constants/zIndex.js +1 -0
- package/dist/cjs/components/feature-announcements/hooks/index.d.ts +1 -0
- package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -0
- package/dist/cjs/components/feature-announcements/index.d.ts +7 -0
- package/dist/cjs/components/feature-announcements/styles/index.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/styles/joyride.styles.d.ts +125 -0
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.d.ts +23 -0
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/styles/minorPopup.styles.d.ts +16 -0
- package/dist/cjs/components/feature-announcements/styles/minorPopup.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/styles/videoModal.styles.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/styles/videoModal.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/types/feature.types.d.ts +41 -0
- package/dist/cjs/components/feature-announcements/types/index.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/types/props.types.d.ts +43 -0
- package/dist/cjs/components/feature-announcements/types/repository.types.d.ts +11 -0
- package/dist/cjs/components/feature-announcements/types/router.types.d.ts +7 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/utils/animationHelpers.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/utils/animationHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/elementHelpers.d.ts +30 -0
- package/dist/cjs/components/feature-announcements/utils/elementHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/htmlHelpers.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/utils/htmlHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/index.d.ts +3 -0
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/cjs/components/whats-new/WhatsNew.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/cjs/components/whats-new/index.d.ts +7 -0
- package/dist/cjs/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/cjs/components/whats-new/useWhatsNew.js +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/searchIcon.svg.js +1 -0
- package/dist/esm/assets/icons/whatsNew.svg.js +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +1 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.d.ts +0 -6
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.js +3 -24
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.d.ts +0 -12
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.d.ts +4 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.d.ts +4 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.d.ts +4 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/VideoModal.d.ts +3 -0
- package/dist/esm/components/feature-announcements/VideoModal.js +1 -0
- package/dist/esm/components/feature-announcements/constants/animations.d.ts +27 -0
- package/dist/esm/components/feature-announcements/constants/animations.js +1 -0
- package/dist/esm/components/feature-announcements/constants/dimensions.d.ts +56 -0
- package/dist/esm/components/feature-announcements/constants/dimensions.js +1 -0
- package/dist/esm/components/feature-announcements/constants/index.d.ts +19 -0
- package/dist/esm/components/feature-announcements/constants/index.js +1 -0
- package/dist/esm/components/feature-announcements/constants/localStorageKeys.d.ts +18 -0
- package/dist/esm/components/feature-announcements/constants/localStorageKeys.js +1 -0
- package/dist/esm/components/feature-announcements/constants/selectors.d.ts +21 -0
- package/dist/esm/components/feature-announcements/constants/selectors.js +1 -0
- package/dist/esm/components/feature-announcements/constants/zIndex.d.ts +10 -0
- package/dist/esm/components/feature-announcements/constants/zIndex.js +1 -0
- package/dist/esm/components/feature-announcements/hooks/index.d.ts +1 -0
- package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.d.ts +13 -0
- package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -0
- package/dist/esm/components/feature-announcements/index.d.ts +7 -0
- package/dist/esm/components/feature-announcements/styles/index.d.ts +4 -0
- package/dist/esm/components/feature-announcements/styles/joyride.styles.d.ts +125 -0
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.d.ts +23 -0
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.js +1 -0
- package/dist/esm/components/feature-announcements/styles/minorPopup.styles.d.ts +16 -0
- package/dist/esm/components/feature-announcements/styles/minorPopup.styles.js +1 -0
- package/dist/esm/components/feature-announcements/styles/videoModal.styles.d.ts +13 -0
- package/dist/esm/components/feature-announcements/styles/videoModal.styles.js +1 -0
- package/dist/esm/components/feature-announcements/types/feature.types.d.ts +41 -0
- package/dist/esm/components/feature-announcements/types/index.d.ts +4 -0
- package/dist/esm/components/feature-announcements/types/props.types.d.ts +43 -0
- package/dist/esm/components/feature-announcements/types/repository.types.d.ts +11 -0
- package/dist/esm/components/feature-announcements/types/router.types.d.ts +7 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.d.ts +13 -0
- package/dist/esm/components/feature-announcements/utils/animationHelpers.d.ts +18 -0
- package/dist/esm/components/feature-announcements/utils/animationHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/elementHelpers.d.ts +30 -0
- package/dist/esm/components/feature-announcements/utils/elementHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/htmlHelpers.d.ts +18 -0
- package/dist/esm/components/feature-announcements/utils/htmlHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/index.d.ts +3 -0
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/esm/components/whats-new/WhatsNew.js +1 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/esm/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/esm/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/esm/components/whats-new/index.d.ts +7 -0
- package/dist/esm/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/esm/components/whats-new/useWhatsNew.js +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.js +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.js +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firestore Timestamp type
|
|
3
|
+
*/
|
|
4
|
+
export interface FirestoreTimestamp {
|
|
5
|
+
seconds: number;
|
|
6
|
+
nanoseconds?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Feature announcement data model
|
|
10
|
+
*/
|
|
11
|
+
export interface FeatureAnnouncement {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
body: string;
|
|
15
|
+
content: string;
|
|
16
|
+
buttonText: string;
|
|
17
|
+
displayImage: string;
|
|
18
|
+
featureTag: string;
|
|
19
|
+
featureUpdateType: 'Major' | 'Minor';
|
|
20
|
+
image: string;
|
|
21
|
+
module: string[];
|
|
22
|
+
pageUrls: string[];
|
|
23
|
+
productVideo: string;
|
|
24
|
+
redirectUrl: string;
|
|
25
|
+
updates: string;
|
|
26
|
+
visibility: boolean;
|
|
27
|
+
archived?: boolean;
|
|
28
|
+
createdAt: FirestoreTimestamp;
|
|
29
|
+
expirationDate?: FirestoreTimestamp | string | Date;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Store feature progress tracking
|
|
33
|
+
*/
|
|
34
|
+
export interface StoreFeatureProgress {
|
|
35
|
+
storeId: string;
|
|
36
|
+
viewedFeatures: Record<string, boolean>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Feature update types
|
|
40
|
+
*/
|
|
41
|
+
export type FeatureUpdateType = 'Major' | 'Minor';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FeatureAnnouncement } from './feature.types';
|
|
3
|
+
import { FeatureAnnouncementRepository } from './repository.types';
|
|
4
|
+
import { RouterProps } from './router.types';
|
|
5
|
+
/**
|
|
6
|
+
* Base popup component props
|
|
7
|
+
*/
|
|
8
|
+
export interface PopupBaseProps {
|
|
9
|
+
feature: FeatureAnnouncement;
|
|
10
|
+
currentIndex: number;
|
|
11
|
+
totalFeatures: number;
|
|
12
|
+
onSkip: () => void;
|
|
13
|
+
onExplore: () => void;
|
|
14
|
+
onPrevious: () => void;
|
|
15
|
+
onNext: () => void;
|
|
16
|
+
setIsClosing?: (isClosing: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Major update popup props
|
|
20
|
+
*/
|
|
21
|
+
export interface MajorUpdatePopupProps extends PopupBaseProps {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Minor update popup props
|
|
25
|
+
*/
|
|
26
|
+
export interface MinorUpdatePopupProps extends PopupBaseProps {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Video modal props
|
|
30
|
+
*/
|
|
31
|
+
export interface VideoModalProps {
|
|
32
|
+
isOpen: boolean;
|
|
33
|
+
videoUrl: string;
|
|
34
|
+
onClose: () => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Feature announcement provider props
|
|
38
|
+
*/
|
|
39
|
+
export interface FeatureAnnouncementProviderProps extends FeatureAnnouncementRepository {
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
module?: string;
|
|
42
|
+
router?: RouterProps;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FeatureAnnouncement, StoreFeatureProgress } from './feature.types';
|
|
2
|
+
/**
|
|
3
|
+
* Repository function types for dependency injection
|
|
4
|
+
*/
|
|
5
|
+
export interface FeatureAnnouncementRepository {
|
|
6
|
+
fetchVisibleFeatures: (module?: string) => Promise<[Error | null, FeatureAnnouncement[] | null]>;
|
|
7
|
+
getStoreFeatureProgress: (storeId: string) => Promise<[Error | null, StoreFeatureProgress | null]>;
|
|
8
|
+
fetchFeatureById: (featureId: string) => Promise<[Error | null, FeatureAnnouncement | null]>;
|
|
9
|
+
markFeatureAsViewedForStore: (storeId: string, featureId: string) => Promise<[Error | null]>;
|
|
10
|
+
isFeatureApplicableToCurrentPage: (feature: FeatureAnnouncement) => boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FeatureAnnouncement, FeatureAnnouncementRepository, RouterProps } from './types';
|
|
2
|
+
export declare const useFeatureAnnouncements: ({ fetchVisibleFeatures, getStoreFeatureProgress, fetchFeatureById, markFeatureAsViewedForStore, isFeatureApplicableToCurrentPage, module, router, }: FeatureAnnouncementRepository & {
|
|
3
|
+
module?: string | undefined;
|
|
4
|
+
router?: RouterProps | undefined;
|
|
5
|
+
}) => {
|
|
6
|
+
features: FeatureAnnouncement[];
|
|
7
|
+
majorUpdateFeatures: FeatureAnnouncement[];
|
|
8
|
+
minorUpdateFeatures: FeatureAnnouncement[];
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
markFeatureAsViewed: (featureId: string) => Promise<void>;
|
|
12
|
+
refetch: () => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculate transform for closing animation
|
|
3
|
+
* @param popupElement - Popup element reference
|
|
4
|
+
* @param targetElement - Target element to animate towards
|
|
5
|
+
* @returns Transform CSS string
|
|
6
|
+
*/
|
|
7
|
+
export declare const calculateCloseTransform: (popupElement: HTMLElement, targetElement: Element) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Hide Joyride arrow element
|
|
10
|
+
* @param popupRef - Reference to popup element
|
|
11
|
+
*/
|
|
12
|
+
export declare const hideJoyrideArrow: (popupRef: HTMLElement | null) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Execute callback after animation completes
|
|
15
|
+
* @param callback - Function to execute
|
|
16
|
+
* @param delay - Optional delay override
|
|
17
|
+
*/
|
|
18
|
+
export declare const executeAfterAnimation: (callback: () => void, delay?: number) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ANIMATION_TIMING as t}from"../constants/animations.js";const e=(t,e)=>{const i=t.getBoundingClientRect(),o=e.getBoundingClientRect();return`translate(${o.left+o.width/2-(i.left+i.width/2)}px, ${o.top+o.height/2-(i.top+i.height/2)}px) scale(0)`},i=t=>{if(!t)return;const e=t.closest('[class*="react-joyride__tooltip"]');if(!e)return;const i=e.querySelector('[class*="react-joyride__arrow"]');i&&(i.style.display="none",i.style.visibility="hidden",i.style.opacity="0")},o=function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.CLOSE_DURATION;setTimeout(e,i)};export{e as calculateCloseTransform,o as executeAfterAnimation,i as hideJoyrideArrow};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find What's New button using multiple strategies
|
|
3
|
+
* @returns Element or null
|
|
4
|
+
*/
|
|
5
|
+
export declare const findWhatsNewButton: () => Element | null;
|
|
6
|
+
/**
|
|
7
|
+
* Find target element for minor update
|
|
8
|
+
* @param featureTag - Feature tag selector
|
|
9
|
+
* @returns Element or null
|
|
10
|
+
*/
|
|
11
|
+
export declare const findFeatureTagElement: (featureTag: string) => Element | null;
|
|
12
|
+
/**
|
|
13
|
+
* Normalize selector string
|
|
14
|
+
* @param selector - Selector string
|
|
15
|
+
* @returns Normalized selector
|
|
16
|
+
*/
|
|
17
|
+
export declare const normalizeSelector: (selector: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Check if element is fully visible in viewport
|
|
20
|
+
* @param element - Element to check
|
|
21
|
+
* @returns True if element is fully visible
|
|
22
|
+
*/
|
|
23
|
+
export declare const isElementInViewport: (element: Element) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Scroll to element smoothly with offset
|
|
26
|
+
* @param element - Element to scroll to
|
|
27
|
+
* @param offset - Offset from top (default 120px for popup space)
|
|
28
|
+
* @returns Promise that resolves when scroll completes
|
|
29
|
+
*/
|
|
30
|
+
export declare const scrollToElementSmooth: (element: Element, offset?: number) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../constants/animations.js";import{SELECTORS as t}from"../constants/selectors.js";const e=()=>{let e=document.querySelector(t.WHATS_NEW_BUTTON);if(e)return e;if(e=document.querySelector(t.MAIN_ICON_CLASS),e)return e;const n=document.querySelector(t.SVG_VIEWBOX);if(n){if(n.querySelector(t.CLIPPATH_PATTERN))return n.closest(t.WHATS_NEW_BUTTON)||n.parentElement}return null},n=t=>{const e=t.startsWith("#")||t.startsWith(".")||t.startsWith("[")?t:`#${t}`;return document.querySelector(e)},o=t=>t.startsWith("#")||t.startsWith(".")||t.startsWith("[")?t:`#${t}`,r=t=>{const e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,r=e.top>=120&&e.bottom<=n,i=e.left>=0&&e.right<=o;return r&&i},i=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:120;return new Promise((n=>{if(r(t))return void n();const o=t.getBoundingClientRect().top+window.pageYOffset-e;let i;window.scrollTo({top:o,behavior:"smooth"});const s=()=>{clearTimeout(i),i=setTimeout((()=>{window.removeEventListener("scroll",s),setTimeout((()=>n()),100)}),100)};window.addEventListener("scroll",s,{passive:!0}),setTimeout((()=>{window.removeEventListener("scroll",s),n()}),1e3)}))};export{n as findFeatureTagElement,e as findWhatsNewButton,r as isElementInViewport,o as normalizeSelector,i as scrollToElementSmooth};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode HTML entities in text
|
|
3
|
+
* @param text - Text containing HTML entities
|
|
4
|
+
* @returns Decoded text
|
|
5
|
+
*/
|
|
6
|
+
export declare const decodeHTMLEntities: (text: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Format video URL for embedding
|
|
9
|
+
* @param videoUrl - Original video URL
|
|
10
|
+
* @returns Formatted video URL
|
|
11
|
+
*/
|
|
12
|
+
export declare const formatVideoUrl: (videoUrl: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Check if URL is a YouTube video
|
|
15
|
+
* @param videoUrl - Video URL to check
|
|
16
|
+
* @returns True if YouTube video
|
|
17
|
+
*/
|
|
18
|
+
export declare const isYouTubeVideo: (videoUrl: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value},t=e=>e.replace("watch?v=","embed/").replace("youtu.be/","youtube.com/embed/"),u=e=>e.includes("youtube.com")||e.includes("youtu.be");export{e as decodeHTMLEntities,t as formatVideoUrl,u as isYouTubeVideo};
|
|
@@ -27,6 +27,8 @@ interface CollectionsScreenInterface {
|
|
|
27
27
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
28
28
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
29
29
|
appType: ApplicationType;
|
|
30
|
+
limit?: number;
|
|
31
|
+
exactLimit?: number;
|
|
30
32
|
}
|
|
31
33
|
export declare const CollectionsScreen: (props: CollectionsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
32
34
|
export interface CollectionCardInterface {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import t from"../../assets/icons/chevronRight.svg.js";import{useRef as i,useState as o,useEffect as l}from"react";import{CheckBox as s}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Tag as c}from"../tag/Tag.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{TitleRegular as d,BodyPrimary as a}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{ProductPickerShimmer as h}from"./ProductPickerShimmer.js";import{CollectionCardStyle as
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import t from"../../assets/icons/chevronRight.svg.js";import{useRef as i,useState as o,useEffect as l}from"react";import{CheckBox as s}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Tag as c}from"../tag/Tag.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{TitleRegular as d,BodyPrimary as a}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{ProductPickerShimmer as h}from"./ProductPickerShimmer.js";import{CollectionCardStyle as m,CollectionCardInfoStyle as p,CollectionCardDetailStyle as C,CollectionNameHolder as j}from"./style.js";import{isCollectionPartiallyChecked as g}from"./utility.js";const v=(e,t,i)=>{if(!e)return"";if(e.length<=t)return e;const o=e.slice(0,t-1);return(i?o.slice(0,o.lastIndexOf(" ")):o)+"..."},x=t=>{var s;const{customCollectionRestriction:n,dataLoading:c,collections:r,selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:m,selectedCollections:p,setScreen:C,collectionFetcher:j,collectionsDispatch:v,pagingControls:x,storeId:b,setSaveDisabled:f,hideCollectionCheckbox:k,renderWithoutModal:O,pickerType:I,scrollContainerRef:S,appType:T,limit:L,exactLimit:P}=t,D=i(x.curPage),R=!!n&&(null==p?void 0:p.isCustom),[E,N]=o(!1),w=i(!1),B=i(!1),F=()=>{if(!S||!(null==S?void 0:S.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:i}=S.current;e+t>=i-20&&!w.current&&!B.current&&(f(!0),N(!0),B.current=!0,f(!0),N(!0),j(D.current,b,T).then((e=>{v({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(D.current+1),N(!1),f(!1),B.current=!1,Object.keys(null==e?void 0:e.collections).length||(w.current=!0)})).catch())};l((()=>{var e;return null===(e=null==S?void 0:S.current)||void 0===e||e.addEventListener("scroll",F),()=>{var e;null===(e=null==S?void 0:S.current)||void 0===e||e.removeEventListener("scroll",F)}}),[]),l((()=>{D.current=x.curPage}),[x.curPage]);const W=Object.keys(p||{}).filter((e=>"isCustom"!==e)).length;return e.jsxs("div",{children:[(null===(s=Object.keys(null!=r?r:{}))||void 0===s?void 0:s.length)?Object.keys(r).map((t=>{var i,o;const l=!!(null==p?void 0:p[t])&&("PRODUCT"!==I||!!Object.keys(null!==(o=null===(i=null==p?void 0:p[t])||void 0===i?void 0:i.products)&&void 0!==o?o:{}).length),s="COLLECTION"===I&&!l&&(!!P&&W>=P||!!L&&W>=L);return e.jsx(y,{customCollectionRestriction:n,data:r[t],isDisabled:R&&!(null==p?void 0:p[t])||s,isChecked:l,isPartiallyChecked:g(t,null==r?void 0:r[t],p),selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:m,setScreen:C,id:t,hideCollectionCheckbox:k||"-1"===t,selectedCollections:p,renderWithoutModal:O,pickerType:I},t)})):c?e.jsx(h,{}):e.jsx(u,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),E&&e.jsx(h,{})]})},y=i=>{const{customCollectionRestriction:o,data:l,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:g,isPartiallyChecked:v,setScreen:x,id:y,isChecked:b,isDisabled:f,hideCollectionCheckbox:k,pickerType:O,usedInSearch:I}=i;return l?e.jsxs(m,Object.assign({isDisabled:f,onClick:e=>{if(!f){if("COLLECTION"===O)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:y,val:l,isRestricted:o}}),h(y),void g(y);h(y),g(y),x("products")}},isActive:b,usedInSearch:null!=I&&I},{children:[e.jsxs(p,{children:[!k&&e.jsx(s,{isDisabled:f,isChecked:b,isPartiallyChecked:v,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:y,val:l,isRestricted:o}}:{type:"unselected",data:{id:y}}),g(e?y:"")}}),e.jsx(C,{children:e.jsx(r,Object.assign({body:l.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(j,{children:[I?e.jsx(a,Object.assign({numberOfLines:1},{children:l.name})):e.jsx(d,Object.assign({numberOfLines:1},{children:l.name})),l.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==O&&e.jsx(n,{height:12,width:12,disabled:f,Icon:t})]})):e.jsx(e.Fragment,{})};export{y as CollectionCard,x as CollectionsScreen,v as truncate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as O,ScreenName as P}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:L,visible:A,zIndex:E,exactLimit:$,limit:B,hideCollectionCheckbox:z,hideProductCheckbox:V,outOfStockAction:M=O.BLUR,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,hideSelectionCount:W,title:G,width:K,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=P.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections),[he,pe]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Oe]=s(!1),[Pe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Le]=c(b,Object.keys(w).length>0?w:{}),Ae=r(null),[Ee,$e]=s(!1),[Be,ze]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;"COLLECTION"===q?e=Object.keys(we||{}).filter((e=>"isCustom"!==e)).length:J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J,q]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Oe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),Ve())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),Ve())}),[Z,we,Se]);const Ve=()=>{Le({type:"reset",data:{}})},Me=()=>{let t,o;return"COLLECTION"===q?(t="collection",o="collections"):J?(t="product",o="products"):(t="variant",o="variants"),$&&Se>$?e.jsx(p,{tagText:`You can only select ${$} ${1===$?t:o}`,type:"negative"}):B&&Se>B?e.jsx(p,{tagText:`You can only select ${B} ${1===B?t:o}`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?P.RearrangeProducts:P.SelectedProducts)},buttonText:$?`${Se}/${$} ${1===Se?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:$?`${Se}/${$} ${1===$?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:"tertiaryGray"})},Ne=e=>be?"Loading...":de===P.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",He=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(h,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Ae,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Pe,collections:le,selectedCollectionsDispatch:Le,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:z,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Ae,limit:B,exactLimit:$}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Le,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:V,outOfStockAction:M,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{$e(!0),ze(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Ae})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Ae,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Le,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:V,hideProductVariants:J,hideVariantCheckbox:N,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:z,outOfStockAction:M,limit:B,exactLimit:$})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[He,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:Ne(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&Be?e.jsx(g,{productData:Be,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:A,onClose:()=>{null==L||L(),Ve()},headingTitle:G||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:K||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:L},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||e.disabled,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}}))(se):{buttonText:Ne(),disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{D.onAdd(we,Se),Ve()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[He,Ee&&Be?e.jsx(g,{productData:Be,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
|
|
@@ -26,6 +26,8 @@ interface SearchScreenInterface {
|
|
|
26
26
|
hideCollectionCheckbox?: boolean;
|
|
27
27
|
renderWithoutModal?: boolean;
|
|
28
28
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
29
|
+
limit?: number;
|
|
30
|
+
exactLimit?: number;
|
|
29
31
|
}
|
|
30
32
|
export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
31
33
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import o from"../../assets/icons/arrow_left.svg.js";import{useEffect as t}from"react";import{IconButton as l}from"../icon-button/IconButton.js";import{BodyCaption as i}from"../TypographyStyle.js";import{CollectionCard as c}from"./collectionScreen.js";import{EmptyState as s}from"./emptyState.js";import{ProductGroup as d}from"./product.js";import{SelectedScreenHeader as r}from"./style.js";import{fetchFbStatusCollection as n,isCollectionPartiallyChecked as u,isProductPartiallyChecked as a,liftTheStateUp as p}from"./utility.js";const h=h=>{var v;const{customCollectionRestriction:m,selectedCollections:j,searchedCollections:C,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:x,collections:b,onBackPress:f,hideVariantCheckbox:O,pickerType:S,hideProductVariants:g,hideProductCheckbox:I,storeId:P,fbStatusFetcher:D,setCollectionId:T,setSelectedCollectionId:F,hideCollectionCheckbox:V,renderWithoutModal:w,outOfStockAction:A,appType:L,limit:R,exactLimit:W}=h;t((()=>{var e;n(null!==(e=C.products)&&void 0!==e?e:{},P,L,k,D,"setProducts")}),[null==C?void 0:C.products]);const B=!!m&&(null==j?void 0:j.isCustom),M=Object.keys(j||{}).filter((e=>"isCustom"!==e)).length;return e.jsxs("div",{children:[e.jsxs(r,{children:[e.jsx(l,{Icon:o,onClick:()=>{x("collections"),f()}}),e.jsx(i,{children:(null===(v=Object.keys(null==C?void 0:C.collections))||void 0===v?void 0:v.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==C?void 0:C.products).length||Object.keys(null==C?void 0:C.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==C?void 0:C.collections).map((o=>{const t=!!(null==j?void 0:j[o]),l="COLLECTION"===S&&!t&&(!!W&&M>=W||!!R&&M>=R);return e.jsx(c,{customCollectionRestriction:m,data:null==b?void 0:b[o],isDisabled:B&&!(null==j?void 0:j[o])||l,isChecked:t,isPartiallyChecked:u(o,null==b?void 0:b[o],j,g),selectedCollectionsDispatch:y,setCollectionId:T,setSelectedCollectionId:F,setScreen:x,id:o,hideCollectionCheckbox:V||"-1"===o,selectedCollections:j,renderWithoutModal:w,pickerType:S,usedInSearch:!0},o)}))}),e.jsx(e.Fragment,{children:Object.keys(null==C?void 0:C.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==C?void 0:C.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let s=!1;return(null===(l=null==C?void 0:C.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d,{collectionId:o,upliftAdditions:(e,t)=>((e,o,t)=>{var l;const i=p(t,null===(l=null==C?void 0:C.products)||void 0===l?void 0:l[e]);y({type:o,data:Object.assign(Object.assign({},i),{isRestricted:m})})})(o,e,t),productId:t,data:(null===(i=null==C?void 0:C.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:a(o,t,j,null===(c=C.products)||void 0===c?void 0:c[o],g),selectedData:j,selectedCollectionsDispatch:y,viewOnly:s,hideProductCheckbox:I,hideVariantCheckbox:O,hideProductVariants:g,pickerType:S,outOfStockAction:A},t)}))}))})]}):e.jsx(s,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{h as SearchScreen};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WhatsNewContent } from './WhatsNew.types';
|
|
3
|
+
interface WhatsNewProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
searchPlaceholder?: string;
|
|
7
|
+
emptyStateTitle?: string;
|
|
8
|
+
emptyStateDescription?: string;
|
|
9
|
+
noResultsText?: string;
|
|
10
|
+
width?: string;
|
|
11
|
+
onContentClick?: (content: WhatsNewContent) => void;
|
|
12
|
+
renderCustomContent?: (content: WhatsNewContent) => React.ReactNode;
|
|
13
|
+
buttonTestId?: string;
|
|
14
|
+
iconWidth?: number;
|
|
15
|
+
iconHeight?: number;
|
|
16
|
+
customIcon?: React.ComponentType<{
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare const WhatsNew: React.FC<WhatsNewProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"../../node_modules/react/jsx-runtime.js";import{useState as e}from"react";import{WhatsNewButton as o}from"./WhatsNewButton.js";import{WhatsNewPanel as n}from"./WhatsNewPanel.js";import{useWhatsNewContext as s}from"./WhatsNewProvider.js";const i=i=>{let{title:r="What's new",tooltip:a="What's new",searchPlaceholder:c="Search posts",emptyStateTitle:h="Nothing new!",emptyStateDescription:m="There are no new updates or features at the moment. Check back soon!",noResultsText:l="Sorry, no results found.",width:d="480px",onContentClick:p,renderCustomContent:u,buttonTestId:C="whats-new-button",iconWidth:w=32,iconHeight:j=32,customIcon:x}=i;const[f,g]=e(!1),{whatsNewContent:W,isLoading:S,newContentCount:T}=s();return t.jsxs(t.Fragment,{children:[t.jsx(o,{onClick:()=>g(!0),newContentCount:T,isOpen:f,isLoading:S,tooltip:a,testId:C,iconWidth:w,iconHeight:j,customIcon:x}),t.jsx(n,{isOpen:f,onClose:()=>g(!1),content:W,isLoading:S,title:r,searchPlaceholder:c,emptyStateTitle:h,emptyStateDescription:m,noResultsText:l,width:d,onContentClick:t=>{p&&p(t)},renderCustomContent:u})]})};export{i as WhatsNew};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const WhatsNewIconContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
count?: number | undefined;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const WhatsNewWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const MainContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const MainCardContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const BackgroundImageContainer: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
imageUrl: string;
|
|
9
|
+
height?: string | undefined;
|
|
10
|
+
width?: string | undefined;
|
|
11
|
+
}, never>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import e from"styled-components";import{COLORS as t}from"../../constants/Theme.js";const i=e.div`
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
position: relative;
|
|
4
|
+
|
|
5
|
+
.main-icon-class {
|
|
6
|
+
padding: 6px;
|
|
7
|
+
border-radius: 32px;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
transition: background-color 0.2s ease;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.icon-active {
|
|
15
|
+
background: ${t.background.brandLight};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.main-icon-class:hover {
|
|
19
|
+
background: ${t.background.base};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.notification--count {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 6px;
|
|
26
|
+
top: 4px;
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
width: 14px;
|
|
29
|
+
height: 14px;
|
|
30
|
+
background: ${t.background.negative.vibrant};
|
|
31
|
+
border: 1.25px solid ${t.surface.standard};
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.count--text {
|
|
38
|
+
font-size: 8px;
|
|
39
|
+
line-height: 7.2px;
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
color: ${t.surface.standard};
|
|
42
|
+
}
|
|
43
|
+
`,n=e.div`
|
|
44
|
+
overflow-y: auto;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
height: 100%;
|
|
48
|
+
max-height: calc(100vh - 60px);
|
|
49
|
+
|
|
50
|
+
&::-webkit-scrollbar {
|
|
51
|
+
display: block;
|
|
52
|
+
width: 6px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
::-webkit-scrollbar-thumb {
|
|
56
|
+
background: ${t.content.inactive};
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
min-height: 30px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.icon--wrapper {
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: center;
|
|
65
|
+
width: 64px;
|
|
66
|
+
height: 64px;
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
background: ${t.background.base};
|
|
69
|
+
margin-bottom: 16px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.no--data--found {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
height: 300px;
|
|
78
|
+
text-align: center;
|
|
79
|
+
padding: 24px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.text--align {
|
|
83
|
+
text-align: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.scroller {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: 16px;
|
|
90
|
+
padding: 16px 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.full--width {
|
|
94
|
+
width: 100%;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.flex {
|
|
98
|
+
display: flex;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.flex--row {
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.flex--column {
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.mt-8 {
|
|
110
|
+
margin-top: 8px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.mt-20 {
|
|
114
|
+
margin-top: 20px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mt--8 {
|
|
118
|
+
margin-top: 8px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.mt--12 {
|
|
122
|
+
margin-top: 12px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mb-mt-8 {
|
|
126
|
+
margin-bottom: 8px;
|
|
127
|
+
margin-top: 8px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.padding--16 {
|
|
131
|
+
padding: 16px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.card--desc {
|
|
135
|
+
max-height: 200px;
|
|
136
|
+
overflow-y: auto;
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
color: ${t.content.secondary};
|
|
139
|
+
|
|
140
|
+
p {
|
|
141
|
+
margin-bottom: 0px;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.created--at {
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 4px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.new--content--tag {
|
|
151
|
+
padding: 2px 6px;
|
|
152
|
+
gap: 4px;
|
|
153
|
+
border-radius: 14px;
|
|
154
|
+
background: ${t.background.warning.vibrant};
|
|
155
|
+
display: flex;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
align-items: center;
|
|
158
|
+
margin-right: 8px;
|
|
159
|
+
}
|
|
160
|
+
`,r=e.div`
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
height: 100%;
|
|
164
|
+
`,o=e.div`
|
|
165
|
+
background: ${t.surface.standard};
|
|
166
|
+
border-radius: 8px;
|
|
167
|
+
border: 1px solid ${t.stroke.primary};
|
|
168
|
+
padding: 16px;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
gap: 8px;
|
|
172
|
+
transition: all 0.2s ease;
|
|
173
|
+
|
|
174
|
+
&:hover {
|
|
175
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
176
|
+
}
|
|
177
|
+
`,a=e.div`
|
|
178
|
+
background-image: url(${e=>e.imageUrl});
|
|
179
|
+
background-size: cover;
|
|
180
|
+
background-position: center;
|
|
181
|
+
background-repeat: no-repeat;
|
|
182
|
+
height: ${e=>e.height||"200px"};
|
|
183
|
+
width: ${e=>e.width||"100%"};
|
|
184
|
+
border-radius: 4px;
|
|
185
|
+
`;export{a as BackgroundImageContainer,o as MainCardContainer,r as MainContainer,i as WhatsNewIconContainer,n as WhatsNewWrapper};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface WhatsNewContent {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
body: string;
|
|
6
|
+
content: string;
|
|
7
|
+
image: string;
|
|
8
|
+
buttonText: string;
|
|
9
|
+
redirectUrl: string;
|
|
10
|
+
productVideo?: string;
|
|
11
|
+
docId?: string;
|
|
12
|
+
createdAt: any;
|
|
13
|
+
module: string[];
|
|
14
|
+
visibility: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface WhatsNewProviderProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
fetchWhatsNewContent: () => Promise<[Error | null, WhatsNewContent[] | null]>;
|
|
19
|
+
markContentAsViewed?: (contentId: string) => Promise<void>;
|
|
20
|
+
module?: string;
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface WhatsNewButtonProps {
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
newContentCount?: number;
|
|
26
|
+
isOpen?: boolean;
|
|
27
|
+
isLoading?: boolean;
|
|
28
|
+
tooltip?: string;
|
|
29
|
+
testId?: string;
|
|
30
|
+
iconWidth?: number;
|
|
31
|
+
iconHeight?: number;
|
|
32
|
+
customIcon?: React.ComponentType<{
|
|
33
|
+
width?: number;
|
|
34
|
+
height?: number;
|
|
35
|
+
color?: string;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export interface WhatsNewPanelProps {
|
|
39
|
+
isOpen: boolean;
|
|
40
|
+
onClose: () => void;
|
|
41
|
+
content: WhatsNewContent[];
|
|
42
|
+
isLoading?: boolean;
|
|
43
|
+
title?: string;
|
|
44
|
+
searchPlaceholder?: string;
|
|
45
|
+
emptyStateTitle?: string;
|
|
46
|
+
emptyStateDescription?: string;
|
|
47
|
+
noResultsText?: string;
|
|
48
|
+
width?: string;
|
|
49
|
+
onContentClick?: (content: WhatsNewContent) => void;
|
|
50
|
+
renderCustomContent?: (content: WhatsNewContent) => React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
export interface WhatsNewHookReturn {
|
|
53
|
+
whatsNewContent: WhatsNewContent[];
|
|
54
|
+
isLoading: boolean;
|
|
55
|
+
newContentCount: number;
|
|
56
|
+
markAsViewed: (contentId: string) => Promise<void>;
|
|
57
|
+
refreshContent: () => Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"../../node_modules/react/jsx-runtime.js";import s from"../../assets/icons/whatsNew.svg.js";import{COLORS as n}from"../../constants/Theme.js";import{Tooltip as i}from"../tooltips/Tooltip.js";import{WhatsNewIconContainer as e}from"./WhatsNew.styles.js";const o=o=>{let{onClick:r,newContentCount:a=0,isOpen:c=!1,isLoading:d=!1,tooltip:l="What's new",testId:m="whats-new-button",iconWidth:h=32,iconHeight:j=32,customIcon:p}=o;return d?t.jsxs("div",Object.assign({style:{margin:"0px 8px"}},{children:[t.jsx("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),t.jsx("style",{children:"\n\t\t\t\t\t\t@keyframes spin {\n\t\t\t\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t\t\t\t}\n\t\t\t\t\t"})]})):t.jsx(e,Object.assign({count:a},{children:t.jsxs("div",Object.assign({className:"main-icon-class "+(c?"icon-active":""),style:{color:c?n.content.brand:n.content.primary},onClick:r,"data-testid":m},{children:[t.jsx(i,Object.assign({body:l},{children:t.jsx("div",{children:p?t.jsx(p,{width:h,height:j,color:c?n.content.brand:n.content.primary}):t.jsx(s,{width:h,height:j})})})),a>0&&t.jsx("div",Object.assign({className:"notification--count"},{children:t.jsx("div",Object.assign({className:"count--text"},{children:a}))}))]}))}))};export{o as WhatsNewButton};
|