@mobielnl/elements 0.8.1 → 0.8.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.
package/dist/index.d.ts CHANGED
@@ -3,6 +3,9 @@ import { ReactNode } from 'react';
3
3
  import { z } from 'zod';
4
4
  import * as z_2 from 'zod';
5
5
 
6
+ /** Union type of all action events */
7
+ declare type ActionEvent = FiltersChangedEvent | SortChangedEvent | ProfileChangedEvent | DealSelectedEvent | DetailsViewedEvent;
8
+
6
9
  declare type ActiveFilterChipsClassNames = {
7
10
  /** The container of the filter chips */
8
11
  container?: string;
@@ -226,6 +229,13 @@ declare type CreditInfoClassNames_2 = {
226
229
  descriptionLink?: string;
227
230
  };
228
231
 
232
+ /** Event fired when a deal/proposition is selected (clicked) */
233
+ declare type DealSelectedEvent = {
234
+ type: 'deal_selected';
235
+ /** The full proposition data */
236
+ proposition: ProductCardPropositionFragment;
237
+ };
238
+
229
239
  declare type DetailsModalClassNames = {
230
240
  /** Modal class names */
231
241
  modal?: ModalClassNames_5;
@@ -251,6 +261,17 @@ declare type DetailsModalClassNames = {
251
261
  costOverview?: CostOverviewClassNames;
252
262
  };
253
263
 
264
+ declare type DetailsModalTab = 'general' | 'conditions' | 'channels' | 'costs';
265
+
266
+ /** Event fired when proposition details are viewed */
267
+ declare type DetailsViewedEvent = {
268
+ type: 'details_viewed';
269
+ /** The full proposition data */
270
+ proposition: ProductCardPropositionFragment;
271
+ /** Which tab was opened */
272
+ tab: DetailsModalTab;
273
+ };
274
+
254
275
  declare type DiscountSectionClassNames = {
255
276
  /** Container for the discount section */
256
277
  container?: string;
@@ -356,6 +377,19 @@ declare type FilterChipClassNames = {
356
377
  closeButton?: string;
357
378
  };
358
379
 
380
+ /** Event fired when filter values change */
381
+ declare type FiltersChangedEvent = {
382
+ type: 'filters_changed';
383
+ /** The filter that was changed */
384
+ filter: {
385
+ slug: string;
386
+ from: string | string[] | undefined;
387
+ to: string | string[] | undefined;
388
+ };
389
+ /** All active filters after the change */
390
+ activeFilters: FilterValue[];
391
+ };
392
+
359
393
  /**
360
394
  * ClassNames for styling different parts of the `Filters` component
361
395
  */
@@ -777,9 +811,220 @@ declare type PricingClassNames = {
777
811
  averagePriceValue?: string;
778
812
  };
779
813
 
814
+ declare type ProductCardPropositionFragment = {
815
+ __typename?: 'Proposition';
816
+ key: string;
817
+ creditFee: number;
818
+ baseMonthlyFee: number;
819
+ lifetimeMonthlyFee: number;
820
+ tcoPerMonth: number;
821
+ activationFee: number;
822
+ tcoTerm: number;
823
+ tcoCorrection: number;
824
+ installationFee: number;
825
+ cashback: number;
826
+ price: number;
827
+ productType: string;
828
+ modificationPromotions: Array<string>;
829
+ handsetCreditMonthlyFee: number;
830
+ bundles: Array<{
831
+ __typename?: 'PropositionBundle';
832
+ displayName?: string | null;
833
+ promotionMonthlyFee?: number | null;
834
+ isExtra?: boolean | null;
835
+ usps: Array<string>;
836
+ contentTypes?: Array<string | null> | null;
837
+ baseMonthlyFee?: number | null;
838
+ }>;
839
+ plan: {
840
+ __typename?: 'PropositionPlan';
841
+ name?: string | null;
842
+ bundleExceedanceDataLimitReached?: string | null;
843
+ bundleExceedanceRate?: string | null;
844
+ bundleExceedanceRateCeiling?: string | null;
845
+ bundleExceedanceWarning?: string | null;
846
+ bundleExceedanceMinutesRounding?: string | null;
847
+ bundleUpgrade?: string | null;
848
+ bundleDowngrade?: string | null;
849
+ };
850
+ planVariant: {
851
+ __typename?: 'PropositionPlanVariant';
852
+ contractTerm: number;
853
+ contractType: string;
854
+ name: string;
855
+ };
856
+ monthlyFees: Array<{
857
+ __typename?: 'PropositionMonthlyFee';
858
+ fee: number;
859
+ term: number;
860
+ }>;
861
+ tags: Array<{
862
+ __typename?: 'Tag';
863
+ type?: string | null;
864
+ label?: string | null;
865
+ slug: string;
866
+ }>;
867
+ content: {
868
+ __typename?: 'PropositionContent';
869
+ dataSpeedDown: number;
870
+ dataAvgSpeedDown: number;
871
+ dataSpeedUp: number;
872
+ dataAvgSpeedUp: number;
873
+ channels: Array<string>;
874
+ hdChannels: Array<string>;
875
+ networkGeneration: number;
876
+ minutesEu: number;
877
+ minutesToEu: number;
878
+ dataEu: number;
879
+ receivers: number;
880
+ types: Array<string>;
881
+ data: number;
882
+ minutes: number;
883
+ sms: number;
884
+ sharedCredits?: Array<string | null> | null;
885
+ };
886
+ provider: {
887
+ __typename?: 'Provider';
888
+ name: string;
889
+ imageUrl: string;
890
+ slug: string;
891
+ network?: string | null;
892
+ networkCoverage?: string | null;
893
+ termsAndConditionsUrl?: string | null;
894
+ creditProviderName?: string | null;
895
+ };
896
+ productVersion?: {
897
+ __typename?: 'ProductVersion';
898
+ fullName?: string | null;
899
+ id: string;
900
+ slug: string;
901
+ stock: {
902
+ __typename?: 'ProductStock';
903
+ status: string;
904
+ backInStockExpectation?: string | null;
905
+ expectedDeliveryDate?: string | null;
906
+ lowOnStock: boolean;
907
+ };
908
+ pricing: {
909
+ __typename?: 'ProductPricing';
910
+ sellingPriceInclVat: string;
911
+ suggestedRetailPrice?: string | null;
912
+ crossSellSellingPriceInclVat: string;
913
+ };
914
+ media: {
915
+ __typename?: 'Media';
916
+ main?: {
917
+ __typename?: 'ProductImage';
918
+ url?: string | null;
919
+ altText?: string | null;
920
+ } | null;
921
+ };
922
+ distinctProperties: Array<{
923
+ __typename?: 'VersionDistinctProperty';
924
+ key: string;
925
+ label: string;
926
+ option: {
927
+ __typename?: 'DistinctPropertyOptionColor';
928
+ key: string;
929
+ slug: string;
930
+ label: string;
931
+ } | {
932
+ __typename?: 'DistinctPropertyOptionDefault';
933
+ key: string;
934
+ slug: string;
935
+ label: string;
936
+ };
937
+ }>;
938
+ specifications: Array<{
939
+ __typename?: 'Specification';
940
+ value: {
941
+ __typename?: 'SpecificationValue';
942
+ descriptiveText?: string | null;
943
+ };
944
+ }>;
945
+ specialPromotions: Array<{
946
+ __typename?: 'SpecialPromotion';
947
+ type: string;
948
+ visualType: string;
949
+ slideOutDescription?: string | null;
950
+ publicTitle: string;
951
+ description: string;
952
+ weight: number;
953
+ validUntil: string;
954
+ showBanner: boolean;
955
+ shortDescription?: string | null;
956
+ stickerImageUrl?: string | null;
957
+ }>;
958
+ product: {
959
+ __typename?: 'Product';
960
+ fullName: string;
961
+ name: string;
962
+ slug: string;
963
+ accessory?: boolean | null;
964
+ hasAvpTag: boolean;
965
+ brand: {
966
+ __typename?: 'Brand';
967
+ name: string;
968
+ slug: string;
969
+ };
970
+ distinctProperties: Array<{
971
+ __typename?: 'ProductDistinctProperty';
972
+ key: string;
973
+ label: string;
974
+ options: Array<{
975
+ __typename?: 'DistinctPropertyOptionColor';
976
+ key: string;
977
+ slug: string;
978
+ label: string;
979
+ } | {
980
+ __typename?: 'DistinctPropertyOptionDefault';
981
+ key: string;
982
+ slug: string;
983
+ label: string;
984
+ }>;
985
+ }>;
986
+ productVersions: Array<{
987
+ __typename?: 'ProductVersion';
988
+ status?: ProductVersionStatusEnum | null;
989
+ distinctProperties: Array<{
990
+ __typename?: 'VersionDistinctProperty';
991
+ key: string;
992
+ label: string;
993
+ option: {
994
+ __typename?: 'DistinctPropertyOptionColor';
995
+ key: string;
996
+ slug: string;
997
+ label: string;
998
+ hex?: string | null;
999
+ } | {
1000
+ __typename?: 'DistinctPropertyOptionDefault';
1001
+ key: string;
1002
+ slug: string;
1003
+ label: string;
1004
+ hex?: string | null;
1005
+ };
1006
+ }>;
1007
+ }>;
1008
+ };
1009
+ } | null;
1010
+ specialPromotions: Array<{
1011
+ __typename?: 'SpecialPromotion';
1012
+ type: string;
1013
+ visualType: string;
1014
+ publicTitle: string;
1015
+ cashback: string;
1016
+ description: string;
1017
+ weight: number;
1018
+ validUntil: string;
1019
+ showBanner: boolean;
1020
+ shortDescription?: string | null;
1021
+ stickerImageUrl?: string | null;
1022
+ }>;
1023
+ };
1024
+
780
1025
  export declare type ProductCategory = 'sim-only-proposition' | 'fixed-proposition' | 'smartphone-proposition' | 'smartphone-proposition-extended';
781
1026
 
782
- export declare function ProductResults({ classNames, initialSelectedFilters, initialProfile, onProfileChange, onError, ...props }: ProductResultsProps): JSX.Element;
1027
+ export declare function ProductResults({ classNames, initialSelectedFilters, initialProfile, onProfileChange, onError, onAction, ...props }: ProductResultsProps): JSX.Element;
783
1028
 
784
1029
  /**
785
1030
  * ClassNames for styling different parts of the `ProductResults` component
@@ -842,10 +1087,59 @@ export declare type ProductResultsProps = {
842
1087
  addClickoutSearchParams?: (searchParams: URLSearchParams) => URLSearchParams;
843
1088
  /** Callback function called when an error occurs */
844
1089
  onError?: (error: Error) => void;
1090
+ /**
1091
+ * Callback function fired when user actions occur.
1092
+ *
1093
+ * Events:
1094
+ * - `filters_changed`: Filter values changed (includes from/to values)
1095
+ * - `sort_changed`: Sort option changed (includes from/to values)
1096
+ * - `profile_changed`: User profile changed (includes from/to values)
1097
+ * - `deal_selected`: User clicked on a proposition/deal
1098
+ * - `details_viewed`: User opened proposition details modal
1099
+ *
1100
+ * @example
1101
+ * onAction={(event) => {
1102
+ * switch(event.type) {
1103
+ * case 'filters_changed':
1104
+ * console.log(event.filter, event.activeFilters)
1105
+ * break
1106
+ * case 'sort_changed':
1107
+ * console.log(event.from, event.to)
1108
+ * break
1109
+ * case 'profile_changed':
1110
+ * console.log(event.from, event.to)
1111
+ * break
1112
+ * case 'deal_selected':
1113
+ * console.log(event.proposition)
1114
+ * break
1115
+ * case 'details_viewed':
1116
+ * console.log(event.proposition, event.tab)
1117
+ * break
1118
+ * }
1119
+ * }}
1120
+ */
1121
+ onAction?: (event: ActionEvent) => void;
845
1122
  };
846
1123
 
1124
+ /** Product version lifecycle status */
1125
+ declare enum ProductVersionStatusEnum {
1126
+ Available = "AVAILABLE",
1127
+ AvailableIfStock = "AVAILABLE_IF_STOCK",
1128
+ Preparing = "PREPARING",
1129
+ Prerelease = "PRERELEASE",
1130
+ Terminated = "TERMINATED",
1131
+ Unavailable = "UNAVAILABLE"
1132
+ }
1133
+
847
1134
  declare type Profile = z.infer<typeof profileSchema>;
848
1135
 
1136
+ /** Event fired when user profile changes */
1137
+ declare type ProfileChangedEvent = {
1138
+ type: 'profile_changed';
1139
+ from: Partial<Profile>;
1140
+ to: Partial<Profile>;
1141
+ };
1142
+
849
1143
  declare const profileSchema: z_2.ZodObject<{
850
1144
  keepCurrentMsisdn: z_2.ZodOptional<z_2.ZodBoolean>;
851
1145
  currentMsisdn: z_2.ZodOptional<z_2.ZodString>;
@@ -1183,6 +1477,13 @@ declare type SliderFilterClassNames = {
1183
1477
  thumb?: string;
1184
1478
  };
1185
1479
 
1480
+ /** Event fired when sort option changes */
1481
+ declare type SortChangedEvent = {
1482
+ type: 'sort_changed';
1483
+ from: string | undefined;
1484
+ to: string;
1485
+ };
1486
+
1186
1487
  declare type SortSelectClassNames = {
1187
1488
  description?: string;
1188
1489
  errorMessage?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobielnl/elements",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Mobiel.nl Elements - React component library for partner websites",
5
5
  "private": false,
6
6
  "type": "module",