@anker-in/campaign-ui 0.2.10-beta.23 → 0.2.10-beta.24
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/components/chat/action.d.ts +25 -0
- package/dist/cjs/components/chat/button.d.ts +3 -0
- package/dist/cjs/components/chat/chatContext.d.ts +101 -0
- package/dist/cjs/components/chat/index.d.ts +71 -0
- package/dist/cjs/components/chat/markdown.d.ts +5 -0
- package/dist/cjs/components/chat/messages.d.ts +3 -0
- package/dist/cjs/components/chat/props.d.ts +43 -0
- package/dist/cjs/components/chat/response.d.ts +4 -0
- package/dist/cjs/components/chat/suggestions.d.ts +3 -0
- package/dist/cjs/components/chat/utils.d.ts +3 -0
- package/dist/cjs/components/credits/context/const.d.ts +81 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/cjs/components/credits/context/provider.d.ts +49 -0
- package/dist/cjs/components/credits/context/response.d.ts +63 -0
- package/dist/cjs/components/credits/context/utils.d.ts +25 -0
- package/dist/cjs/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/cjs/components/credits/creditsBenefits/index.d.ts +12 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +15 -0
- package/dist/cjs/components/credits/creditsCash/index.d.ts +13 -0
- package/dist/cjs/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/cjs/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +20 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +77 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +60 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +96 -0
- package/dist/cjs/components/credits/index.d.ts +10 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +32 -0
- package/dist/cjs/components/credits/modal/activitiesModal.d.ts +32 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/cjs/components/credits/modal/loadingDots.d.ts +6 -0
- package/dist/cjs/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/cjs/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/cjs/components/credits/modal/tip.d.ts +5 -0
- package/dist/cjs/components/credits/type.d.ts +55 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/debug-env.d.ts +7 -0
- package/dist/cjs/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/helpers/index.d.ts +2 -0
- package/dist/cjs/helpers/track.d.ts +19 -0
- package/dist/cjs/helpers/utils.d.ts +3 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/stories/chat.stories.d.ts +7 -0
- package/dist/esm/components/chat/action.d.ts +25 -0
- package/dist/esm/components/chat/button.d.ts +3 -0
- package/dist/esm/components/chat/chatContext.d.ts +101 -0
- package/dist/esm/components/chat/index.d.ts +71 -0
- package/dist/esm/components/chat/markdown.d.ts +5 -0
- package/dist/esm/components/chat/messages.d.ts +3 -0
- package/dist/esm/components/chat/props.d.ts +43 -0
- package/dist/esm/components/chat/response.d.ts +4 -0
- package/dist/esm/components/chat/suggestions.d.ts +3 -0
- package/dist/esm/components/chat/utils.d.ts +3 -0
- package/dist/esm/components/credits/context/const.d.ts +81 -0
- package/dist/esm/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/esm/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/esm/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +17 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/esm/components/credits/context/provider.d.ts +49 -0
- package/dist/esm/components/credits/context/response.d.ts +63 -0
- package/dist/esm/components/credits/context/utils.d.ts +25 -0
- package/dist/esm/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/esm/components/credits/creditsBenefits/index.d.ts +12 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +15 -0
- package/dist/esm/components/credits/creditsCash/index.d.ts +13 -0
- package/dist/esm/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/esm/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +20 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/index.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +77 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +60 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +96 -0
- package/dist/esm/components/credits/index.d.ts +10 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +32 -0
- package/dist/esm/components/credits/modal/activitiesModal.d.ts +32 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/esm/components/credits/modal/loadingDots.d.ts +6 -0
- package/dist/esm/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/esm/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/esm/components/credits/modal/tip.d.ts +5 -0
- package/dist/esm/components/credits/type.d.ts +55 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/debug-env.d.ts +7 -0
- package/dist/esm/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/helpers/fetcher.d.ts +2 -0
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/track.d.ts +19 -0
- package/dist/esm/helpers/utils.d.ts +3 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/stories/chat.stories.d.ts +7 -0
- package/package.json +10 -9
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { CreditsProvider, useCreditsContext } from './context/provider';
|
|
2
|
+
export { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt';
|
|
3
|
+
export { CreditsUploadReceiptModal } from './modal/creditsUploadReceiptModal';
|
|
4
|
+
export { CreditsBanner } from './creditsBanner';
|
|
5
|
+
export { CreditsBenefits } from './creditsBenefits';
|
|
6
|
+
export { CreditsInfoCard } from './creditsInfoCard';
|
|
7
|
+
export { CreditsWaysToGetCredits } from './creditsWaysToGetCredits';
|
|
8
|
+
export { CreditsFaq } from './creditsFaq';
|
|
9
|
+
export { CreditsCash } from './creditsCash';
|
|
10
|
+
export { CreditsRedeemList } from './creditsRedeemList';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './modalContainer';
|
|
2
|
+
export interface MyRewardsMetafields {
|
|
3
|
+
title: string;
|
|
4
|
+
orderNumberLabel: string;
|
|
5
|
+
valueLabel: string;
|
|
6
|
+
receivedLabel: string;
|
|
7
|
+
failedLabel: string;
|
|
8
|
+
approveSuccessLabel: string;
|
|
9
|
+
couponTab: string;
|
|
10
|
+
productTab: string;
|
|
11
|
+
pendingLabel: string;
|
|
12
|
+
unfulfilledLabel: string;
|
|
13
|
+
fulfilledLabel: string;
|
|
14
|
+
confirmedTip: string;
|
|
15
|
+
pendingTip: string;
|
|
16
|
+
processingTip: string;
|
|
17
|
+
ShippedTip: string;
|
|
18
|
+
emptyListLabel: string;
|
|
19
|
+
pointUnit: string;
|
|
20
|
+
code: string;
|
|
21
|
+
copied: string;
|
|
22
|
+
copy: string;
|
|
23
|
+
emptyListImage: {
|
|
24
|
+
url: string;
|
|
25
|
+
alt?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface MyRewardsModalProps extends ModalContainerProps {
|
|
29
|
+
data: MyRewardsMetafields;
|
|
30
|
+
}
|
|
31
|
+
declare function MyRewardsModal({ data, ...props }: MyRewardsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default MyRewardsModal;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './modalContainer';
|
|
2
|
+
export interface MyActivitiesMetafields {
|
|
3
|
+
title: string;
|
|
4
|
+
tips: string;
|
|
5
|
+
allTab: string;
|
|
6
|
+
earnedTab: string;
|
|
7
|
+
deductedTab: string;
|
|
8
|
+
expiredTab: string;
|
|
9
|
+
activationTask: string;
|
|
10
|
+
updateNameTask: string;
|
|
11
|
+
updatePhoneTask: string;
|
|
12
|
+
updateBirthdayTask: string;
|
|
13
|
+
updateAppNameTask: string;
|
|
14
|
+
subscriptionTask: string;
|
|
15
|
+
refundTask: string;
|
|
16
|
+
productUnApprovedTask: string;
|
|
17
|
+
pendingTips?: string;
|
|
18
|
+
pendingTips2?: string;
|
|
19
|
+
firstPurchaseTask: string;
|
|
20
|
+
uploadReceiptTask: string;
|
|
21
|
+
shoppingTask: string;
|
|
22
|
+
emptyListImage: {
|
|
23
|
+
url: string;
|
|
24
|
+
alt?: string;
|
|
25
|
+
};
|
|
26
|
+
emptyListLabel: string;
|
|
27
|
+
}
|
|
28
|
+
interface ActivitiesModalProps extends ModalContainerProps {
|
|
29
|
+
data: MyActivitiesMetafields;
|
|
30
|
+
}
|
|
31
|
+
declare function ActivitiesModal({ data, ...props }: ActivitiesModalProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default ActivitiesModal;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ReceiptCopy = {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
placeholder: string;
|
|
5
|
+
note: string;
|
|
6
|
+
submit: string;
|
|
7
|
+
successTitle: string;
|
|
8
|
+
successDescription: string;
|
|
9
|
+
gotIt: string;
|
|
10
|
+
failedTitle: string;
|
|
11
|
+
successIcon: string;
|
|
12
|
+
failedIcon: string;
|
|
13
|
+
failedReasons: {
|
|
14
|
+
code: string;
|
|
15
|
+
id: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
export declare function CreditsUploadReceiptModal({ isOpen, onClose, copy, onSuccess, }: {
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
copy: ReceiptCopy;
|
|
23
|
+
onSuccess: () => void;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UIEvent } from 'react';
|
|
2
|
+
export type ModalContainerProps = {
|
|
3
|
+
overlayClassName?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
scrollClassName?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
titleClassName?: string;
|
|
8
|
+
useAnimation?: boolean;
|
|
9
|
+
animationClassName?: string;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
children?: any;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
onScrollEnd?: (event: UIEvent<HTMLDivElement>) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const CreditsModalContainer: ({ isOpen, title, className, overlayClassName, scrollClassName, onClose, onScrollEnd, children, useAnimation, animationClassName, titleClassName, ...props }: ModalContainerProps) => React.ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './modalContainer';
|
|
2
|
+
declare function RulesModal({ rules, className, ruleClassName, ...props }: {
|
|
3
|
+
rules: string | string[];
|
|
4
|
+
ruleClassName?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
} & ModalContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default RulesModal;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Product, ProductVariant } from '@anker-in/lib';
|
|
2
|
+
import type { AlpcConsumeType, ConsumeType } from './context/const';
|
|
3
|
+
export interface Subscription {
|
|
4
|
+
preference: {
|
|
5
|
+
subscribe: boolean;
|
|
6
|
+
brand: string;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
9
|
+
export type RedeemableItem = {
|
|
10
|
+
config: {
|
|
11
|
+
title: string;
|
|
12
|
+
desc: string;
|
|
13
|
+
rules: string[];
|
|
14
|
+
image: {
|
|
15
|
+
url: string;
|
|
16
|
+
};
|
|
17
|
+
type: ConsumeType;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
alpc: {
|
|
21
|
+
id: string;
|
|
22
|
+
consumeCredits: number;
|
|
23
|
+
remainingInventory: number;
|
|
24
|
+
isLimited: boolean;
|
|
25
|
+
consumeType: AlpcConsumeType;
|
|
26
|
+
showCredit: boolean;
|
|
27
|
+
title: string;
|
|
28
|
+
};
|
|
29
|
+
product: Product;
|
|
30
|
+
variant: ProductVariant;
|
|
31
|
+
};
|
|
32
|
+
export interface ShippingCountry {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
code: string;
|
|
36
|
+
provinces: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
code: string;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
export interface ShippingZone {
|
|
43
|
+
name: string;
|
|
44
|
+
countries: ShippingCountry[];
|
|
45
|
+
}
|
|
46
|
+
export type CreditsPageCommon = {
|
|
47
|
+
pointUnit: string;
|
|
48
|
+
ruleLabel: string;
|
|
49
|
+
soldOut: string;
|
|
50
|
+
imageMapping: {
|
|
51
|
+
[key in ConsumeType]: {
|
|
52
|
+
url: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function getAsyncError(res: {
|
|
2
|
+
json: () => any;
|
|
3
|
+
status: any;
|
|
4
|
+
statusText: any;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
status: any;
|
|
7
|
+
statusText: any;
|
|
8
|
+
errors: any;
|
|
9
|
+
type: any;
|
|
10
|
+
data: any;
|
|
11
|
+
message: any;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
declare const handleFetchResponse: (res: Response) => Promise<any>;
|
|
14
|
+
export default handleFetchResponse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
dataLayer?: Array<any>;
|
|
4
|
+
fbq?: (...args: any[]) => void;
|
|
5
|
+
klaviyo?: any;
|
|
6
|
+
gtag?: any;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const gaTrack: (data: any) => "" | undefined;
|
|
10
|
+
export declare function gaNormalClick({ position, label }: {
|
|
11
|
+
position: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}): void;
|
|
14
|
+
export declare const fbq: (...args: any[]) => "" | undefined;
|
|
15
|
+
export declare const gtag: (...args: any[]) => "" | undefined;
|
|
16
|
+
export declare const getGtmGroup: ({ query, asPath }: {
|
|
17
|
+
query: any;
|
|
18
|
+
asPath: string;
|
|
19
|
+
}) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Chat } from '../components/index';
|
|
3
|
+
import '../styles/chat.css';
|
|
4
|
+
type Story = StoryObj<typeof meta>;
|
|
5
|
+
declare const meta: Meta<typeof Chat>;
|
|
6
|
+
export default meta;
|
|
7
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Message {
|
|
3
|
+
content: string;
|
|
4
|
+
role: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
scope?: any;
|
|
7
|
+
arguments?: any;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionProps {
|
|
10
|
+
start?: string;
|
|
11
|
+
history: Message[];
|
|
12
|
+
addtocartHandler?: (_args: any) => Promise<any>;
|
|
13
|
+
commonRender?: string | ((_props: any) => React.ReactElement);
|
|
14
|
+
pointsExchangeCouponRender?: string | ((_props: any) => React.ReactElement);
|
|
15
|
+
gotocheckoutRender?: string | ((_props: any) => React.ReactElement);
|
|
16
|
+
gotocartRender?: string | ((_props: any) => React.ReactElement);
|
|
17
|
+
addtocartRender?: string | ((_props: any) => React.ReactElement);
|
|
18
|
+
signupRender?: string | ((_props: any) => React.ReactElement);
|
|
19
|
+
shulexRender?: string | ((_props: any) => React.ReactElement);
|
|
20
|
+
productRender?: string | ((_props: any) => React.ReactElement);
|
|
21
|
+
productRenderTipMessage?: string;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare const CopilotAction: ({ start, history, addtocartHandler, commonRender, pointsExchangeCouponRender, gotocheckoutRender, gotocartRender, addtocartRender, productRender, signupRender, shulexRender, children, }: ActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Icons for CopilotChat component.
|
|
4
|
+
*/
|
|
5
|
+
export interface CopilotChatIcons {
|
|
6
|
+
/**
|
|
7
|
+
* The icon to use for the open chat button.
|
|
8
|
+
* @default <OpenIcon />
|
|
9
|
+
*/
|
|
10
|
+
openIcon?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The icon to use for the close chat button.
|
|
13
|
+
* @default <CloseIcon />
|
|
14
|
+
*/
|
|
15
|
+
closeIcon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The icon to use for the close chat button in the header.
|
|
18
|
+
* @default <HeaderCloseIcon />
|
|
19
|
+
*/
|
|
20
|
+
headerCloseIcon?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The icon to use for the send button.
|
|
23
|
+
* @default <SendIcon />
|
|
24
|
+
*/
|
|
25
|
+
sendIcon?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* The icon to use for the activity indicator.
|
|
28
|
+
* @default <ActivityIcon />
|
|
29
|
+
*/
|
|
30
|
+
activityIcon?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* The icon to use for the spinner.
|
|
33
|
+
* @default <SpinnerIcon />
|
|
34
|
+
*/
|
|
35
|
+
spinnerIcon?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* The icon to use for the stop button.
|
|
38
|
+
* @default <StopIcon />
|
|
39
|
+
*/
|
|
40
|
+
stopIcon?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* The icon to use for the regenerate button.
|
|
43
|
+
* @default <RegenerateIcon />
|
|
44
|
+
*/
|
|
45
|
+
regenerateIcon?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* The icons to use for push to talk.
|
|
48
|
+
* @default <PushToTalkIcon />
|
|
49
|
+
*/
|
|
50
|
+
pushToTalkIcon?: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Labels for CopilotChat component.
|
|
54
|
+
*/
|
|
55
|
+
export interface CopilotChatLabels {
|
|
56
|
+
/**
|
|
57
|
+
* The initial message(s) to display in the chat window.
|
|
58
|
+
*/
|
|
59
|
+
initial?: string | string[];
|
|
60
|
+
/**
|
|
61
|
+
* The title to display in the header.
|
|
62
|
+
* @default "CopilotKit"
|
|
63
|
+
*/
|
|
64
|
+
title?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The placeholder to display in the input.
|
|
67
|
+
* @default "Type a message..."
|
|
68
|
+
*/
|
|
69
|
+
placeholder?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The message to display when an error occurs.
|
|
72
|
+
* @default "❌ An error occurred. Please try again."
|
|
73
|
+
*/
|
|
74
|
+
error?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The label to display on the stop button.
|
|
77
|
+
* @default "Stop generating"
|
|
78
|
+
*/
|
|
79
|
+
stopGenerating?: string;
|
|
80
|
+
/**
|
|
81
|
+
* The label to display on the regenerate button.
|
|
82
|
+
* @default "Regenerate response"
|
|
83
|
+
*/
|
|
84
|
+
regenerateResponse?: string;
|
|
85
|
+
}
|
|
86
|
+
interface ChatContext {
|
|
87
|
+
labels: Required<CopilotChatLabels>;
|
|
88
|
+
icons: Required<CopilotChatIcons>;
|
|
89
|
+
open: boolean;
|
|
90
|
+
setOpen: (_open: boolean) => void;
|
|
91
|
+
}
|
|
92
|
+
export declare const ChatContext: React.Context<ChatContext | undefined>;
|
|
93
|
+
export declare function useChatContext(): ChatContext;
|
|
94
|
+
export interface ChatContextProps {
|
|
95
|
+
labels?: CopilotChatLabels;
|
|
96
|
+
icons?: CopilotChatIcons;
|
|
97
|
+
children?: React.ReactNode;
|
|
98
|
+
open: boolean;
|
|
99
|
+
setOpen: (_open: boolean) => void;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ChatProps {
|
|
3
|
+
title: string;
|
|
4
|
+
runtimeUrl: string;
|
|
5
|
+
shopifyDomain: string;
|
|
6
|
+
/** GA 的 client id
|
|
7
|
+
*/
|
|
8
|
+
userId: string;
|
|
9
|
+
/** 是否登陆用户 0 or 1
|
|
10
|
+
*/
|
|
11
|
+
account?: string;
|
|
12
|
+
/** 用户浏览器语言
|
|
13
|
+
*/
|
|
14
|
+
locale?: string;
|
|
15
|
+
/** 开场白
|
|
16
|
+
*/
|
|
17
|
+
prologue?: string;
|
|
18
|
+
/** ?a=1&b=2
|
|
19
|
+
*/
|
|
20
|
+
query?: string;
|
|
21
|
+
/** 'follow' or 'unfollow' | true or false
|
|
22
|
+
* follow: ResponseButton 会跟随在 messages 的后边
|
|
23
|
+
* unfollow: ResponseButton 在聊天框底部
|
|
24
|
+
*/
|
|
25
|
+
showResponseButton?: string | boolean;
|
|
26
|
+
/** messages 的回调事件
|
|
27
|
+
* 每次生成/接受新的messages,会将 整个 messages list 传递给外部
|
|
28
|
+
*/
|
|
29
|
+
messagesCallback?: (_messages: any) => void;
|
|
30
|
+
/** 通用 action 的触发事件
|
|
31
|
+
*/
|
|
32
|
+
commonRender?: string | ((_props: any) => React.ReactElement);
|
|
33
|
+
/** shulex的 action 的触发事件
|
|
34
|
+
*/
|
|
35
|
+
shulexRender?: string | ((_props: any) => React.ReactElement);
|
|
36
|
+
/** 通用 积分 换 Coupon 的触发事件
|
|
37
|
+
*/
|
|
38
|
+
pointsExchangeCouponRender?: string | ((_props: any) => React.ReactElement);
|
|
39
|
+
/** 跳转 checkout action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
|
|
40
|
+
* 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
|
|
41
|
+
*/
|
|
42
|
+
gotocheckoutRender?: string | ((_props: any) => React.ReactElement);
|
|
43
|
+
/** 打开购物车 action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
|
|
44
|
+
* 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
|
|
45
|
+
*/
|
|
46
|
+
gotocartRender?: string | ((_props: any) => React.ReactElement);
|
|
47
|
+
/** 打开购物车 action 的触发事件
|
|
48
|
+
*/
|
|
49
|
+
addtocartHandler?: (_args: any) => Promise<any>;
|
|
50
|
+
/** 加购卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
|
|
51
|
+
* 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
|
|
52
|
+
*/
|
|
53
|
+
addtocartRender?: string | ((_props: any) => React.ReactElement);
|
|
54
|
+
/** 订阅卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
|
|
55
|
+
* 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
|
|
56
|
+
*/
|
|
57
|
+
signupRender?: string | ((_props: any) => React.ReactElement);
|
|
58
|
+
/** 产品卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
|
|
59
|
+
* 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
|
|
60
|
+
*/
|
|
61
|
+
productRender?: string | ((_props: any) => React.ReactElement);
|
|
62
|
+
/** CopilotPopup 自定义参数,参考:https://docs.copilotkit.ai/reference/components/CopilotPopup */
|
|
63
|
+
popup?: any;
|
|
64
|
+
/** 文案,{"productRenderTipMessage": "","popupTip": "Hi ! Welcome to soundcore Innovations live chat!", "popupTipTimeout": [3000, 6000]} */
|
|
65
|
+
lang?: any;
|
|
66
|
+
/** 参考此文档:https://docs.copilotkit.ai/concepts/customize-look-and-feel */
|
|
67
|
+
style?: any;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
declare const Chat: (props: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
export default Chat;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '@copilotkit/runtime-client-gql';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
setOpen: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface WindowProps {
|
|
8
|
+
open: boolean;
|
|
9
|
+
setOpen: (open: boolean) => void;
|
|
10
|
+
clickOutsideToClose: boolean;
|
|
11
|
+
hitEscapeToClose: boolean;
|
|
12
|
+
shortcut: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface HeaderProps {
|
|
16
|
+
open: boolean;
|
|
17
|
+
setOpen: (open: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ChatSuggestions {
|
|
20
|
+
currentSuggestions: SuggestionsProps[];
|
|
21
|
+
}
|
|
22
|
+
export interface SuggestionsProps {
|
|
23
|
+
title: string;
|
|
24
|
+
message: string;
|
|
25
|
+
partial?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MessagesProps {
|
|
29
|
+
messages: Message[];
|
|
30
|
+
inProgress: boolean;
|
|
31
|
+
ResponseButton?: React.ReactElement;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
messagesCallback?: (messages: any) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface InputProps {
|
|
36
|
+
inProgress: boolean;
|
|
37
|
+
onSend: (text: string) => Promise<Message>;
|
|
38
|
+
isVisible?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ResponseButtonProps {
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
inProgress: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { useCopilotChat, useCopilotAction, useCopilotReadable } from '@copilotkit/react-core';
|
|
2
|
+
import { Role, ActionExecutionMessage, TextMessage } from '@copilotkit/runtime-client-gql';
|
|
3
|
+
export { useCopilotChat, useCopilotAction, useCopilotReadable, Role, ActionExecutionMessage, TextMessage };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare enum CreditType {
|
|
2
|
+
All = 0,
|
|
3
|
+
Earned = 1,
|
|
4
|
+
Deducted = 2,
|
|
5
|
+
Expired = 3
|
|
6
|
+
}
|
|
7
|
+
export declare enum ConsumeType {
|
|
8
|
+
Coupon = "coupon",
|
|
9
|
+
GiftCard = "giftCard",
|
|
10
|
+
GoGift = "goGift",
|
|
11
|
+
Product = "product"
|
|
12
|
+
}
|
|
13
|
+
export declare enum AlpcConsumeType {
|
|
14
|
+
Coupon = 1,
|
|
15
|
+
Product = 2
|
|
16
|
+
}
|
|
17
|
+
export declare enum TaskType {
|
|
18
|
+
Program = 1,
|
|
19
|
+
Operation = 2,
|
|
20
|
+
Redeem = 3
|
|
21
|
+
}
|
|
22
|
+
export declare enum DTC_TASK_TYPE {
|
|
23
|
+
FirstPurchase = "firstPurchase",
|
|
24
|
+
UploadReceipt = "uploadReceipt",
|
|
25
|
+
Shopping = "shopping"
|
|
26
|
+
}
|
|
27
|
+
export declare enum TaskSubType {
|
|
28
|
+
Activation = 1,// 激活事件
|
|
29
|
+
UpdateName = 2,// 完善姓名
|
|
30
|
+
UpdatePhone = 3,// 更新手机号
|
|
31
|
+
UpdateBirthday = 4,// 更新生日
|
|
32
|
+
Subscription = 5,// 订阅
|
|
33
|
+
UpadteAppName = 7,// 完善APP姓名
|
|
34
|
+
Refund = 3000,// 购物送积分任务退款
|
|
35
|
+
ProductUnApproved = 5000
|
|
36
|
+
}
|
|
37
|
+
export declare enum CouponType {
|
|
38
|
+
FixedMount = "fixed_amount",
|
|
39
|
+
Percent = "percent"
|
|
40
|
+
}
|
|
41
|
+
export declare enum RewardType {
|
|
42
|
+
Received = 0,
|
|
43
|
+
Pending = 1,
|
|
44
|
+
ApproveSuccess = 2,
|
|
45
|
+
ApproveFail = 3,
|
|
46
|
+
Unfulfilled = 4,
|
|
47
|
+
Fulfilled = 5,
|
|
48
|
+
Failed = 6
|
|
49
|
+
}
|
|
50
|
+
export declare enum AlpcErrorCode {
|
|
51
|
+
CodeLpcRedeemFailed = 180001,
|
|
52
|
+
CodeLpcUserNotFound = 180002,
|
|
53
|
+
CodeLpcCreditRuleNotFound = 180003,
|
|
54
|
+
CodeLpcUnknownError = 180004,
|
|
55
|
+
CodeLpcNotEnoughCredits = 180005,
|
|
56
|
+
CodeLpcUserMigrate = 180006,
|
|
57
|
+
CodeLpcRuleInventoryNotEnough = 180007,
|
|
58
|
+
CodeLpcShopifyCouponRuleRedeemLimit = 180009,
|
|
59
|
+
CodeCrossSiteError = 180011
|
|
60
|
+
}
|
|
61
|
+
export declare const ALPC_COUNTRY_MAP: Map<string, string>;
|
|
62
|
+
export declare enum ApprovalStatus {
|
|
63
|
+
Pending = 0,
|
|
64
|
+
Success = 1,
|
|
65
|
+
Failed = 2,
|
|
66
|
+
DoubleConfirm = 3
|
|
67
|
+
}
|
|
68
|
+
export declare const PRICE_SYMBOL: {
|
|
69
|
+
us: string;
|
|
70
|
+
uk: string;
|
|
71
|
+
ca: string;
|
|
72
|
+
eu: string;
|
|
73
|
+
pl: string;
|
|
74
|
+
fr: string;
|
|
75
|
+
de: string;
|
|
76
|
+
vn: string;
|
|
77
|
+
cl: string;
|
|
78
|
+
sg: string;
|
|
79
|
+
ae: string;
|
|
80
|
+
es: string;
|
|
81
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CreditLogResponse } from '../response';
|
|
2
|
+
declare function useActivities({ page, pageSize, options }: {
|
|
3
|
+
page: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
options?: any;
|
|
6
|
+
}): {
|
|
7
|
+
activities: CreditLogResponse[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
total: number;
|
|
10
|
+
canNext: boolean;
|
|
11
|
+
};
|
|
12
|
+
export default useActivities;
|