@goodhood-web/nebenan-base 4.4.2-development.3 → 4.5.0-development.2

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.
Files changed (40) hide show
  1. package/index.js +103 -102
  2. package/index.mjs +22896 -22114
  3. package/lib/ContentCreator/ContentCreator.d.ts +8 -2
  4. package/lib/ContentCreator/ContentCreatorForm.d.ts +3 -0
  5. package/lib/ContentCreator/{ContentCreator.types.d.ts → ContentCreatorForm.types.d.ts} +2 -0
  6. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/ContentCreatorFieldsWrapper.d.ts +2 -2
  7. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/components/ContentFieldsSheet/ContentFieldsSheet.d.ts +1 -1
  8. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/components/ContentFieldsSheet/ContentFieldsSheet.types.d.ts +1 -0
  9. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/components/MarketplaceFields/MarketplaceFields.d.ts +1 -1
  10. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/components/MarketplaceFields/MarketplaceFields.types.d.ts +1 -0
  11. package/lib/ContentCreator/components/ContentCreatorFieldWrapper/components/PostFields/FormRichTextArea.d.ts +5 -0
  12. package/lib/ContentCreator/constants.d.ts +20 -0
  13. package/lib/ContentCreator/network.d.ts +2 -2
  14. package/lib/ContentCreator/utils/general.d.ts +3 -1
  15. package/lib/ContentCreator/utils/payloadGenerators.d.ts +1 -1
  16. package/lib/ContentCreator/validationSchemas/dynamicValidationSchema.d.ts +33 -0
  17. package/lib/ContentCreator/validationSchemas/marketplaceSchema.d.ts +33 -0
  18. package/lib/Feed/FeedItem/Marketplace/MarketplaceBody/MarketplaceBody.d.ts +1 -1
  19. package/lib/Feed/FeedItem/Marketplace/MarketplaceBody/MarketplaceBody.types.d.ts +3 -0
  20. package/lib/Feed/FeedItem/Marketplace/MarketplaceDetailPage/MarketplaceDetailPage.d.ts +1 -1
  21. package/lib/Feed/FeedItem/Marketplace/MarketplaceDetailPage/MarketplaceDetailPage.types.d.ts +5 -0
  22. package/lib/Feed/utils.d.ts +1 -1
  23. package/lib/Forms/Fields/FormPremiumFeatureSelector.d.ts +8 -0
  24. package/lib/PremiumFeaturePanel/PremiumFeaturePanel.d.ts +3 -0
  25. package/lib/PremiumFeaturePanel/PremiumFeaturePanel.types.d.ts +7 -0
  26. package/lib/PremiumFeaturePanel/components/PaymentChargebeeModal/PaymentChargebeeModal.d.ts +9 -0
  27. package/lib/PremiumFeaturePanel/components/PaymentModal/PaymentModal.d.ts +7 -0
  28. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/PremiumFeatureSelector.d.ts +3 -0
  29. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/PremiumFeatureSelector.types.d.ts +48 -0
  30. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/components/InfoModal/InfoModal.d.ts +5 -0
  31. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/components/InfoModal/InfoModal.types.d.ts +15 -0
  32. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/network.d.ts +19 -0
  33. package/lib/PremiumFeaturePanel/components/PremiumFeatureSelector/utils.d.ts +3 -0
  34. package/lib/utils/client.d.ts +16 -0
  35. package/lib/utils/index.d.ts +2 -0
  36. package/lib/utils/server.d.ts +3 -1
  37. package/lib/utils/usePremiumFeatureCheckout.d.ts +7 -0
  38. package/lib/utils/usePremiumFeatureCheckoutCompletion.d.ts +8 -0
  39. package/package.json +1 -1
  40. package/style.css +1 -1
@@ -1,3 +1,9 @@
1
- import { ContentCreatorProps } from './ContentCreator.types';
2
- declare const ContentCreator: ({ contentType, hoodGroupId, onDismiss, onSubmitSuccess, open, post, }: ContentCreatorProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { ContentCreatorProps } from './ContentCreatorForm.types';
2
+ declare const ContentCreator: ({ config, contentType, hoodGroupId, onDismiss, onSubmitSuccess, open, post, postId, }: ContentCreatorProps & {
3
+ config: {
4
+ chargebee: {
5
+ site: string;
6
+ };
7
+ };
8
+ }) => import("react/jsx-runtime").JSX.Element;
3
9
  export default ContentCreator;
@@ -0,0 +1,3 @@
1
+ import { ContentCreatorProps } from './ContentCreatorForm.types';
2
+ declare const ContentCreatorForm: ({ contentType, hoodGroupId, onDismiss, onSubmitSuccess, open, post, postId, }: ContentCreatorProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default ContentCreatorForm;
@@ -12,6 +12,7 @@ export type ContentCreatorProps = {
12
12
  onSubmitSuccess: (response: HoodMessage) => void;
13
13
  open: boolean;
14
14
  post?: PostItem;
15
+ postId?: number | string;
15
16
  };
16
17
  export type ContentCreatorFormProps = {
17
18
  formError?: string | null;
@@ -21,6 +22,7 @@ export type ContentCreatorFormProps = {
21
22
  onContentCreatorDismiss: () => void;
22
23
  onFormSheetClose: () => void;
23
24
  onFormSheetOpen: () => void;
25
+ postId?: number | string;
24
26
  };
25
27
  export type PostFormData = Extract<ContentFormData, {
26
28
  content_type: 'post' | 'search' | 'recommendation';
@@ -1,3 +1,3 @@
1
- import { ContentCreatorFormProps } from '../../ContentCreator.types';
2
- declare const ContentCreatorFieldsWrapper: ({ formError, isEditMode, isFormSheetOpen, isSubmitting, onContentCreatorDismiss, onFormSheetClose, onFormSheetOpen, }: ContentCreatorFormProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { ContentCreatorFormProps } from '../../ContentCreatorForm.types';
2
+ declare const ContentCreatorFieldsWrapper: ({ formError, isEditMode, isFormSheetOpen, isSubmitting, onContentCreatorDismiss, onFormSheetClose, onFormSheetOpen, postId, }: ContentCreatorFormProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default ContentCreatorFieldsWrapper;
@@ -1,4 +1,4 @@
1
1
  import { ContentProps, FooterProps, HeaderProps } from './ContentFieldsSheet.types';
2
2
  export declare const Header: ({ isSubmitting, onContentTypeSelectorOpen, onDismiss, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
3
- export declare const Content: ({ onOpenReachTypeSelector, onPoiDismiss, poiClicked, richTextAreaRef, }: ContentProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Content: ({ onOpenReachTypeSelector, onPoiDismiss, poiClicked, postId, richTextAreaRef, }: ContentProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export declare const Footer: ({ formError, isSubmitting, onImageUploadClick, onOpenReachTypeSelector, onPoiOpen, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,7 @@ export type ContentProps = {
9
9
  onOpenReachTypeSelector: () => void;
10
10
  onPoiDismiss: () => void;
11
11
  poiClicked: boolean;
12
+ postId?: number | string;
12
13
  richTextAreaRef?: RefObject<RichTextAreaRef>;
13
14
  };
14
15
  export type FooterProps = {
@@ -1,3 +1,3 @@
1
1
  import { MarketplaceFieldsProps } from './MarketplaceFields.types';
2
- declare const MarketplaceFields: ({ onOpenReachTypeSelector }: MarketplaceFieldsProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const MarketplaceFields: ({ onOpenReachTypeSelector, postId, }: MarketplaceFieldsProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MarketplaceFields;
@@ -1,5 +1,6 @@
1
1
  export type MarketplaceFieldsProps = {
2
2
  onOpenReachTypeSelector: () => void;
3
+ postId?: number | string;
3
4
  };
4
5
  export type MarketplaceItemsType = 'verschenken' | 'verkaufen';
5
6
  export declare enum MarketplaceItems {
@@ -132,6 +132,11 @@ declare const FormRichTextAreaInput: import('react').ForwardRefExoticComponent<U
132
132
  subject: string;
133
133
  reach: "profile" | "public" | "hood" | "extended";
134
134
  marketplace_item_type: string;
135
+ premium_feature: {
136
+ id: string;
137
+ value?: string | undefined;
138
+ pill?: string | undefined;
139
+ };
135
140
  price?: string | null | undefined;
136
141
  }> & Partial<RichTextAreaProps> & {
137
142
  name: string;
@@ -16,6 +16,11 @@ export declare const DEFAULT_FORM_VALUES: {
16
16
  label: string;
17
17
  };
18
18
  marketplace_item_type: MarketplaceItems;
19
+ premium_feature: {
20
+ id: string;
21
+ pill: string;
22
+ value: string;
23
+ };
19
24
  price: null;
20
25
  reach: string;
21
26
  starts_at_date: Date;
@@ -39,6 +44,11 @@ export declare const POST_DEFAULT_VALUES: {
39
44
  label: string;
40
45
  };
41
46
  marketplace_item_type: MarketplaceItems;
47
+ premium_feature: {
48
+ id: string;
49
+ pill: string;
50
+ value: string;
51
+ };
42
52
  price: null;
43
53
  reach: string;
44
54
  starts_at_date: Date;
@@ -62,6 +72,11 @@ export declare const EVENT_DEFAULT_VALUES: {
62
72
  label: string;
63
73
  };
64
74
  marketplace_item_type: MarketplaceItems;
75
+ premium_feature: {
76
+ id: string;
77
+ pill: string;
78
+ value: string;
79
+ };
65
80
  price: null;
66
81
  reach: string;
67
82
  starts_at_date: Date;
@@ -86,6 +101,11 @@ export declare const MARKETPLACE_DEFAULT_VALUES: {
86
101
  label: string;
87
102
  };
88
103
  marketplace_item_type: MarketplaceItems;
104
+ premium_feature: {
105
+ id: string;
106
+ pill: string;
107
+ value: string;
108
+ };
89
109
  price: null;
90
110
  starts_at_date: Date;
91
111
  starts_at_time: Date;
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { OnFormSubmitType } from '../Forms/Form/Form.types';
3
- import { HoodMessage } from './ContentCreator.types';
3
+ import { HoodMessage, MarketplaceFormData } from './ContentCreatorForm.types';
4
4
  import { ContentFormData } from './validationSchemas';
5
- export declare const handleSubmit: (data: OnFormSubmitType<ContentFormData>, isEditMode: boolean, setFormError: Dispatch<SetStateAction<string | null>>, hoodGroupId?: number | null, onSuccess?: (responseData: HoodMessage | undefined) => void, onError?: (error: unknown) => void) => Promise<boolean | undefined>;
5
+ export declare const handleSubmit: (data: OnFormSubmitType<ContentFormData>, isEditMode: boolean, setFormError: Dispatch<SetStateAction<string | null>>, hoodGroupId?: number | null, onSuccess?: (responseData: HoodMessage | undefined, premiumFeature?: MarketplaceFormData["premium_feature"]) => void, onError?: (error: unknown) => void) => Promise<boolean | undefined>;
@@ -1,5 +1,6 @@
1
1
  import { DefaultValues } from 'react-hook-form';
2
- import { FailureError, PostItem } from '../ContentCreator.types';
2
+ import { SelectedPremiumFeature } from '../../PremiumFeaturePanel/components/PremiumFeatureSelector/PremiumFeatureSelector.types';
3
+ import { FailureError, PostItem } from '../ContentCreatorForm.types';
3
4
  import { ContentType } from '../components/ContentCreatorFieldWrapper/components/ContentTypeField/ContentTypeField.types';
4
5
  import { LocationValue } from '../components/ContentCreatorFieldWrapper/components/ListModalField/FormModalFields/FormModalsFields.types';
5
6
  import { ContentFormData } from '../validationSchemas';
@@ -21,3 +22,4 @@ export declare const removePoiFromContent: (content: BodyWithEmbeds) => {
21
22
  gid: string;
22
23
  indices?: number[] | null | undefined;
23
24
  }[];
25
+ export declare const getSubmitButtonText: (submitText: string, submitPriceText: string, checkoutValue?: SelectedPremiumFeature) => string;
@@ -1,4 +1,4 @@
1
- import { EventFormData, MarketplaceFormData, PostFormData } from '../ContentCreator.types';
1
+ import { EventFormData, MarketplaceFormData, PostFormData } from '../ContentCreatorForm.types';
2
2
  import { MarketplaceContentType } from '../components/ContentCreatorFieldWrapper/components/ContentTypeField/ContentTypeField.types';
3
3
  export declare const generatePostPayload: (data: PostFormData) => {
4
4
  body: string;
@@ -280,6 +280,19 @@ export declare const contentValidationSchema: z.ZodUnion<[z.ZodObject<{
280
280
  signedId?: string | undefined;
281
281
  }>, "atleastone">;
282
282
  marketplace_item_type: z.ZodString;
283
+ premium_feature: z.ZodObject<{
284
+ id: z.ZodString;
285
+ pill: z.ZodOptional<z.ZodString>;
286
+ value: z.ZodOptional<z.ZodString>;
287
+ }, "strip", z.ZodTypeAny, {
288
+ id: string;
289
+ value?: string | undefined;
290
+ pill?: string | undefined;
291
+ }, {
292
+ id: string;
293
+ value?: string | undefined;
294
+ pill?: string | undefined;
295
+ }>;
283
296
  price: z.ZodNullable<z.ZodOptional<z.ZodString>>;
284
297
  reach: z.ZodEnum<["profile", "hood", "extended", "public"]>;
285
298
  subject: z.ZodString;
@@ -316,6 +329,11 @@ export declare const contentValidationSchema: z.ZodUnion<[z.ZodObject<{
316
329
  subject: string;
317
330
  reach: "profile" | "public" | "hood" | "extended";
318
331
  marketplace_item_type: string;
332
+ premium_feature: {
333
+ id: string;
334
+ value?: string | undefined;
335
+ pill?: string | undefined;
336
+ };
319
337
  price?: string | null | undefined;
320
338
  }, {
321
339
  content: {
@@ -350,6 +368,11 @@ export declare const contentValidationSchema: z.ZodUnion<[z.ZodObject<{
350
368
  subject: string;
351
369
  reach: "profile" | "public" | "hood" | "extended";
352
370
  marketplace_item_type: string;
371
+ premium_feature: {
372
+ id: string;
373
+ value?: string | undefined;
374
+ pill?: string | undefined;
375
+ };
353
376
  price?: string | null | undefined;
354
377
  }>, {
355
378
  content: {
@@ -384,6 +407,11 @@ export declare const contentValidationSchema: z.ZodUnion<[z.ZodObject<{
384
407
  subject: string;
385
408
  reach: "profile" | "public" | "hood" | "extended";
386
409
  marketplace_item_type: string;
410
+ premium_feature: {
411
+ id: string;
412
+ value?: string | undefined;
413
+ pill?: string | undefined;
414
+ };
387
415
  price?: string | null | undefined;
388
416
  }, {
389
417
  content: {
@@ -418,6 +446,11 @@ export declare const contentValidationSchema: z.ZodUnion<[z.ZodObject<{
418
446
  subject: string;
419
447
  reach: "profile" | "public" | "hood" | "extended";
420
448
  marketplace_item_type: string;
449
+ premium_feature: {
450
+ id: string;
451
+ value?: string | undefined;
452
+ pill?: string | undefined;
453
+ };
421
454
  price?: string | null | undefined;
422
455
  }>, z.ZodObject<{
423
456
  content: z.ZodObject<{
@@ -97,6 +97,19 @@ export declare const marketplaceValidationSchema: z.ZodEffects<z.ZodObject<{
97
97
  signedId?: string | undefined;
98
98
  }>, "atleastone">;
99
99
  marketplace_item_type: z.ZodString;
100
+ premium_feature: z.ZodObject<{
101
+ id: z.ZodString;
102
+ pill: z.ZodOptional<z.ZodString>;
103
+ value: z.ZodOptional<z.ZodString>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ id: string;
106
+ value?: string | undefined;
107
+ pill?: string | undefined;
108
+ }, {
109
+ id: string;
110
+ value?: string | undefined;
111
+ pill?: string | undefined;
112
+ }>;
100
113
  price: z.ZodNullable<z.ZodOptional<z.ZodString>>;
101
114
  reach: z.ZodEnum<["profile", "hood", "extended", "public"]>;
102
115
  subject: z.ZodString;
@@ -133,6 +146,11 @@ export declare const marketplaceValidationSchema: z.ZodEffects<z.ZodObject<{
133
146
  subject: string;
134
147
  reach: "profile" | "public" | "hood" | "extended";
135
148
  marketplace_item_type: string;
149
+ premium_feature: {
150
+ id: string;
151
+ value?: string | undefined;
152
+ pill?: string | undefined;
153
+ };
136
154
  price?: string | null | undefined;
137
155
  }, {
138
156
  content: {
@@ -167,6 +185,11 @@ export declare const marketplaceValidationSchema: z.ZodEffects<z.ZodObject<{
167
185
  subject: string;
168
186
  reach: "profile" | "public" | "hood" | "extended";
169
187
  marketplace_item_type: string;
188
+ premium_feature: {
189
+ id: string;
190
+ value?: string | undefined;
191
+ pill?: string | undefined;
192
+ };
170
193
  price?: string | null | undefined;
171
194
  }>, {
172
195
  content: {
@@ -201,6 +224,11 @@ export declare const marketplaceValidationSchema: z.ZodEffects<z.ZodObject<{
201
224
  subject: string;
202
225
  reach: "profile" | "public" | "hood" | "extended";
203
226
  marketplace_item_type: string;
227
+ premium_feature: {
228
+ id: string;
229
+ value?: string | undefined;
230
+ pill?: string | undefined;
231
+ };
204
232
  price?: string | null | undefined;
205
233
  }, {
206
234
  content: {
@@ -235,5 +263,10 @@ export declare const marketplaceValidationSchema: z.ZodEffects<z.ZodObject<{
235
263
  subject: string;
236
264
  reach: "profile" | "public" | "hood" | "extended";
237
265
  marketplace_item_type: string;
266
+ premium_feature: {
267
+ id: string;
268
+ value?: string | undefined;
269
+ pill?: string | undefined;
270
+ };
238
271
  price?: string | null | undefined;
239
272
  }>;
@@ -1,3 +1,3 @@
1
1
  import { MarketplaceBodyTypes } from './MarketplaceBody.types';
2
- declare const MarketplaceBody: ({ feedItem, isAuthenticated, isMine, }: MarketplaceBodyTypes) => import("react/jsx-runtime").JSX.Element;
2
+ declare const MarketplaceBody: ({ chargebeeProviderConfig, feedItem, isAuthenticated, isMine, }: MarketplaceBodyTypes) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MarketplaceBody;
@@ -1,5 +1,8 @@
1
1
  import { components } from '../../../../../../../api/src/lib/core/generated_types';
2
2
  export interface MarketplaceBodyTypes {
3
+ chargebeeProviderConfig: {
4
+ site: string;
5
+ };
3
6
  feedItem: components['schemas']['Core_V3_HoodMessage'];
4
7
  isAuthenticated?: boolean;
5
8
  isMine?: boolean;
@@ -17,5 +17,5 @@ import { MarketplaceDetailPageProps } from './MarketplaceDetailPage.types';
17
17
  *
18
18
  * @returns {Promise<JSX.Element>} The rendered marketplace detail page
19
19
  */
20
- export declare function MarketplaceDetailPage({ ads, feedItem, isAuthenticated, relatedSections, renderAdSlot, }: MarketplaceDetailPageProps): Promise<import("react/jsx-runtime").JSX.Element>;
20
+ export declare function MarketplaceDetailPage({ ads, config, feedItem, isAuthenticated, relatedSections, renderAdSlot, }: MarketplaceDetailPageProps): Promise<import("react/jsx-runtime").JSX.Element>;
21
21
  export default MarketplaceDetailPage;
@@ -12,6 +12,11 @@ export interface ProfileData {
12
12
  }
13
13
  export interface MarketplaceDetailPageProps {
14
14
  ads?: AdSlot[];
15
+ config: {
16
+ chargebee: {
17
+ site: string;
18
+ };
19
+ };
15
20
  feedItem: components['schemas']['Core_V3_HoodMessage'];
16
21
  isAuthenticated?: boolean;
17
22
  relatedSections?: components['schemas']['Core_V3_RelatedSection'][];
@@ -4,7 +4,7 @@ export declare const isBookmarked: (id: number, list: number[]) => boolean;
4
4
  export declare const getRelatedItemThumbnail: (item: HoodMessage) => string;
5
5
  export declare const isPublic: (item: HoodMessage) => boolean;
6
6
  export declare const getElapsedTime: (timestamp: string) => string | null;
7
- export declare const getFormattedDate: (date: string | null | undefined) => {
7
+ export declare const getFormattedDate: (date: string | null | undefined, dateFormat?: "dd.MM.yyyy" | "dd.MM") => {
8
8
  date: string;
9
9
  time: string;
10
10
  } | null;
@@ -0,0 +1,8 @@
1
+ import { UseControllerProps } from 'react-hook-form';
2
+ import { NameAbbreviationProps } from './NameAbbreviation/NameAbbreviation.types';
3
+ export type FormNameAbbreviationProps = UseControllerProps & Partial<NameAbbreviationProps> & {
4
+ defaultChecked?: boolean;
5
+ postId?: number | string;
6
+ };
7
+ export declare const FormPremiumFeatureSelector: ({ defaultChecked, name, postId, rules, }: FormNameAbbreviationProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default FormPremiumFeatureSelector;
@@ -0,0 +1,3 @@
1
+ import { PremiumFeaturePanelProps } from './PremiumFeaturePanel.types';
2
+ declare const PremiumFeaturePanel: ({ chargebeeProviderConfig, isMine, postId, }: PremiumFeaturePanelProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default PremiumFeaturePanel;
@@ -0,0 +1,7 @@
1
+ export interface PremiumFeaturePanelProps {
2
+ chargebeeProviderConfig: {
3
+ site: string;
4
+ };
5
+ isMine: boolean;
6
+ postId: string;
7
+ }
@@ -0,0 +1,9 @@
1
+ interface PaymentChargebeeModalProps {
2
+ isLoading: boolean;
3
+ onCheckout: () => void;
4
+ onDismiss: () => void;
5
+ open: boolean;
6
+ paymentInterrupted: boolean;
7
+ }
8
+ declare const PaymentChargebeeModal: ({ isLoading, onCheckout, onDismiss, open, paymentInterrupted, }: PaymentChargebeeModalProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default PaymentChargebeeModal;
@@ -0,0 +1,7 @@
1
+ interface PremiumFeatureSheetProps {
2
+ onDismiss: () => void;
3
+ open: boolean;
4
+ postId: string;
5
+ }
6
+ export declare const PremiumFeatureSheet: ({ onDismiss, open, postId, }: PremiumFeatureSheetProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { PremiumFeatureSelectorProps } from './PremiumFeatureSelector.types';
2
+ declare const PremiumFeatureSelector: ({ defaultValue, hasPremiumFeature, includeNoneOption, onChange, onDismiss, postId, }: PremiumFeatureSelectorProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default PremiumFeatureSelector;
@@ -0,0 +1,48 @@
1
+ import { InfoModal } from './components/InfoModal/InfoModal.types';
2
+ export type PremiumOptionSlug = 'boost-highlight' | 'boost' | 'highlight';
3
+ export interface PremiumFeatureSticker {
4
+ color: 'darkGrey' | 'lavender';
5
+ icon: 'star_filled' | 'sparkle_filled' | 'cross_circle' | 'arrow_up_filled';
6
+ iconSize: '16' | '24';
7
+ size: 'tiny' | 'small' | 'medium' | 'large';
8
+ }
9
+ export interface PremiumFeatureOption {
10
+ id: string;
11
+ info?: InfoModal | null;
12
+ isDefault?: boolean;
13
+ label?: string;
14
+ order: number;
15
+ pill: string;
16
+ selectedUntil: string;
17
+ slug: PremiumOptionSlug | 'none';
18
+ sticker: PremiumFeatureSticker;
19
+ text: string;
20
+ title: string;
21
+ value: string;
22
+ }
23
+ export interface SelectedPremiumFeature {
24
+ id: string;
25
+ pill: string;
26
+ value: string;
27
+ }
28
+ export declare enum PremiumFeatureOptions {
29
+ MARKETPLACE_BOOST = "push",
30
+ MARKETPLACE_BOOST_HIGHLIGHT = "best_offer",
31
+ MARKETPLACE_HIGHLIGHT = "highlight"
32
+ }
33
+ export type IconKeys = 'bundle' | 'feature';
34
+ export type PremiumFeatureSelectorProps = {
35
+ defaultValue?: SelectedPremiumFeature;
36
+ hasPremiumFeature: boolean;
37
+ includeNoneOption?: boolean;
38
+ onChange?: (option: SelectedPremiumFeature) => void;
39
+ onDismiss?: () => void;
40
+ postId?: number | string;
41
+ } | {
42
+ defaultValue?: SelectedPremiumFeature;
43
+ hasPremiumFeature?: boolean;
44
+ includeNoneOption?: boolean;
45
+ onChange: (option: SelectedPremiumFeature) => void;
46
+ onDismiss?: () => void;
47
+ postId?: number | string;
48
+ };
@@ -0,0 +1,5 @@
1
+ import { InfoModalProps } from './InfoModal.types';
2
+ export declare const InfoModalHeader: ({ onDismiss }: {
3
+ onDismiss: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const InfoModalContent: ({ defaultValue, modals, onDismiss, onSelect, }: InfoModalProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ export interface InfoModal {
2
+ alt: string;
3
+ cta: string;
4
+ label?: string;
5
+ text: string;
6
+ title: string;
7
+ url: string;
8
+ value: string;
9
+ }
10
+ export type InfoModalProps = {
11
+ defaultValue: string;
12
+ modals: InfoModal[];
13
+ onDismiss: () => void;
14
+ onSelect?: (id: string) => void;
15
+ };
@@ -0,0 +1,19 @@
1
+ export declare const fetchPremiumFeatureProducts: (postId?: number | string) => Promise<{
2
+ id: string;
3
+ gid: string;
4
+ identifier: string;
5
+ name: string;
6
+ description: string;
7
+ icon?: "feature" | "bundle";
8
+ price_cents: number;
9
+ tax_rate: number;
10
+ duration_days?: number | null;
11
+ purchasable_for: string;
12
+ apple_store_sku?: string | null;
13
+ google_play_sku?: string | null;
14
+ chargebee_sku?: string | null;
15
+ created_at: string;
16
+ updated_at: string;
17
+ available: boolean;
18
+ available_after?: string | null;
19
+ }[] | null | undefined>;
@@ -0,0 +1,3 @@
1
+ import { components } from '../../../../../../api/src/lib/core';
2
+ import { PremiumFeatureOption } from './PremiumFeatureSelector.types';
3
+ export declare const getFormattedPremiumFeatureOptions: (options: components["schemas"]["Core_V3_Product_List"] | undefined, includeNoneOption: boolean, postId?: number | string) => PremiumFeatureOption[];
@@ -5,3 +5,19 @@ export declare const useIsBreakpointMatch: (tabletScreenBreakpoint?: number) =>
5
5
  * Returns 0 if extraction fails or result is not a number.
6
6
  */
7
7
  export declare const extractUserId: (gid: string | undefined | null) => number;
8
+ export declare const formatCurrency: (cents: number, locale?: string) => string;
9
+ /**
10
+ * Returns the URL string of an imported image.
11
+ *
12
+ * Next.js image imports can return an object with metadata (src, height, width, blurDataURL, etc.).
13
+ * In some environments (like Jest tests or Storybook), the import may resolve to a plain string.
14
+ * This function ensures we always get a usable string URL for <img> or <Image> components.
15
+ */
16
+ export declare const getImageSrc: (img: string | {
17
+ blurDataURL?: string;
18
+ blurHeight?: number;
19
+ blurWidth?: number;
20
+ height: number;
21
+ src: string;
22
+ width: number;
23
+ }) => string;
@@ -4,3 +4,5 @@ export * from './hooks';
4
4
  export * from './breakpoints';
5
5
  export * from './gidParser';
6
6
  export * from './priceFormatter';
7
+ export * from './usePremiumFeatureCheckout';
8
+ export * from './usePremiumFeatureCheckoutCompletion';
@@ -1,2 +1,4 @@
1
1
  export declare const getLang: <T>(lang: Record<string, T>, selectedLang?: string) => T;
2
- export declare const interpolateKey: (template: string, key: string, value?: string) => string;
2
+ type Replacements = string | Record<string, string>;
3
+ export declare const interpolate: (template: string, keyOrReplacements: Replacements, value?: string) => string;
4
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook to handle Premium Feature checkout with Chargebee.
3
+ */
4
+ export declare const usePremiumFeatureCheckout: () => {
5
+ PremiumFeatureCheckoutModal: import("react/jsx-runtime").JSX.Element;
6
+ startCheckout: (postId: string, productId: string) => Promise<void>;
7
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Hook to handle completion of Premium Feature checkout after redirect.
3
+ * @param postId - ID of the post associated with the checkout
4
+ */
5
+ export declare const usePremiumFeatureCheckoutCompletion: (postId: string) => {
6
+ PremiumFeatureCompletionModal: import("react/jsx-runtime").JSX.Element;
7
+ loading: boolean;
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodhood-web/nebenan-base",
3
- "version": "4.4.2-development.3",
3
+ "version": "4.5.0-development.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "repository": "https://github.com/good-hood-gmbh/goodhood-web",