@nfcard/validation 0.9.0 → 0.10.0

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
@@ -1467,6 +1467,33 @@ declare const digitalVisibilitySchema: z.ZodObject<{
1467
1467
  showBio?: boolean | undefined;
1468
1468
  showSocialLinks?: boolean | undefined;
1469
1469
  }>;
1470
+ declare const MAX_CTA_BUTTONS = 5;
1471
+ declare const ctaButtonSchema: z.ZodObject<{
1472
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1473
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1474
+ }, "strip", z.ZodTypeAny, {
1475
+ url: string;
1476
+ label: string;
1477
+ }, {
1478
+ url?: string | undefined;
1479
+ label?: string | undefined;
1480
+ }>;
1481
+ declare const ctaButtonsSchema: z.ZodEffects<z.ZodArray<z.ZodObject<{
1482
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1483
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ url: string;
1486
+ label: string;
1487
+ }, {
1488
+ url?: string | undefined;
1489
+ label?: string | undefined;
1490
+ }>, "many">, {
1491
+ url: string;
1492
+ label: string;
1493
+ }[], {
1494
+ url?: string | undefined;
1495
+ label?: string | undefined;
1496
+ }[]>;
1470
1497
  declare const digitalConfigSchema: z.ZodObject<{
1471
1498
  templateId: z.ZodEnum<["minimal", "bold", "card", "aurora"]>;
1472
1499
  accentColor: z.ZodString;
@@ -1538,6 +1565,22 @@ declare const digitalConfigSchema: z.ZodObject<{
1538
1565
  customUrl?: string | undefined;
1539
1566
  customUrlLabel?: string | undefined;
1540
1567
  }>>;
1568
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
1569
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1570
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
1571
+ }, "strip", z.ZodTypeAny, {
1572
+ url: string;
1573
+ label: string;
1574
+ }, {
1575
+ url?: string | undefined;
1576
+ label?: string | undefined;
1577
+ }>, "many">, {
1578
+ url: string;
1579
+ label: string;
1580
+ }[], {
1581
+ url?: string | undefined;
1582
+ label?: string | undefined;
1583
+ }[]>>;
1541
1584
  }, "strip", z.ZodTypeAny, {
1542
1585
  templateId: "minimal" | "bold" | "card" | "aurora";
1543
1586
  accentColor: string;
@@ -1569,6 +1612,10 @@ declare const digitalConfigSchema: z.ZodObject<{
1569
1612
  customUrl?: string | undefined;
1570
1613
  customUrlLabel?: string | undefined;
1571
1614
  } | undefined;
1615
+ ctaButtons?: {
1616
+ url: string;
1617
+ label: string;
1618
+ }[] | undefined;
1572
1619
  }, {
1573
1620
  templateId: "minimal" | "bold" | "card" | "aurora";
1574
1621
  accentColor: string;
@@ -1600,6 +1647,10 @@ declare const digitalConfigSchema: z.ZodObject<{
1600
1647
  customUrl?: string | undefined;
1601
1648
  customUrlLabel?: string | undefined;
1602
1649
  } | undefined;
1650
+ ctaButtons?: {
1651
+ url?: string | undefined;
1652
+ label?: string | undefined;
1653
+ }[] | undefined;
1603
1654
  }>;
1604
1655
  declare const configurationCreateSchema: z.ZodObject<{
1605
1656
  sessionId: z.ZodString;
@@ -2678,6 +2729,22 @@ declare const configurationCreateSchema: z.ZodObject<{
2678
2729
  customUrl?: string | undefined;
2679
2730
  customUrlLabel?: string | undefined;
2680
2731
  }>>;
2732
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
2733
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
2734
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
2735
+ }, "strip", z.ZodTypeAny, {
2736
+ url: string;
2737
+ label: string;
2738
+ }, {
2739
+ url?: string | undefined;
2740
+ label?: string | undefined;
2741
+ }>, "many">, {
2742
+ url: string;
2743
+ label: string;
2744
+ }[], {
2745
+ url?: string | undefined;
2746
+ label?: string | undefined;
2747
+ }[]>>;
2681
2748
  }, "strip", z.ZodTypeAny, {
2682
2749
  templateId: "minimal" | "bold" | "card" | "aurora";
2683
2750
  accentColor: string;
@@ -2709,6 +2776,10 @@ declare const configurationCreateSchema: z.ZodObject<{
2709
2776
  customUrl?: string | undefined;
2710
2777
  customUrlLabel?: string | undefined;
2711
2778
  } | undefined;
2779
+ ctaButtons?: {
2780
+ url: string;
2781
+ label: string;
2782
+ }[] | undefined;
2712
2783
  }, {
2713
2784
  templateId: "minimal" | "bold" | "card" | "aurora";
2714
2785
  accentColor: string;
@@ -2740,6 +2811,10 @@ declare const configurationCreateSchema: z.ZodObject<{
2740
2811
  customUrl?: string | undefined;
2741
2812
  customUrlLabel?: string | undefined;
2742
2813
  } | undefined;
2814
+ ctaButtons?: {
2815
+ url?: string | undefined;
2816
+ label?: string | undefined;
2817
+ }[] | undefined;
2743
2818
  }>;
2744
2819
  quantity: z.ZodDefault<z.ZodNumber>;
2745
2820
  existingProfileId: z.ZodOptional<z.ZodString>;
@@ -2895,6 +2970,10 @@ declare const configurationCreateSchema: z.ZodObject<{
2895
2970
  customUrl?: string | undefined;
2896
2971
  customUrlLabel?: string | undefined;
2897
2972
  } | undefined;
2973
+ ctaButtons?: {
2974
+ url: string;
2975
+ label: string;
2976
+ }[] | undefined;
2898
2977
  };
2899
2978
  quantity: number;
2900
2979
  existingProfileId?: string | undefined;
@@ -3050,6 +3129,10 @@ declare const configurationCreateSchema: z.ZodObject<{
3050
3129
  customUrl?: string | undefined;
3051
3130
  customUrlLabel?: string | undefined;
3052
3131
  } | undefined;
3132
+ ctaButtons?: {
3133
+ url?: string | undefined;
3134
+ label?: string | undefined;
3135
+ }[] | undefined;
3053
3136
  };
3054
3137
  quantity?: number | undefined;
3055
3138
  existingProfileId?: string | undefined;
@@ -4131,6 +4214,22 @@ declare const configurationUpdateSchema: z.ZodObject<{
4131
4214
  customUrl?: string | undefined;
4132
4215
  customUrlLabel?: string | undefined;
4133
4216
  }>>;
4217
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
4218
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
4219
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
4220
+ }, "strip", z.ZodTypeAny, {
4221
+ url: string;
4222
+ label: string;
4223
+ }, {
4224
+ url?: string | undefined;
4225
+ label?: string | undefined;
4226
+ }>, "many">, {
4227
+ url: string;
4228
+ label: string;
4229
+ }[], {
4230
+ url?: string | undefined;
4231
+ label?: string | undefined;
4232
+ }[]>>;
4134
4233
  }, "strip", z.ZodTypeAny, {
4135
4234
  templateId: "minimal" | "bold" | "card" | "aurora";
4136
4235
  accentColor: string;
@@ -4162,6 +4261,10 @@ declare const configurationUpdateSchema: z.ZodObject<{
4162
4261
  customUrl?: string | undefined;
4163
4262
  customUrlLabel?: string | undefined;
4164
4263
  } | undefined;
4264
+ ctaButtons?: {
4265
+ url: string;
4266
+ label: string;
4267
+ }[] | undefined;
4165
4268
  }, {
4166
4269
  templateId: "minimal" | "bold" | "card" | "aurora";
4167
4270
  accentColor: string;
@@ -4193,6 +4296,10 @@ declare const configurationUpdateSchema: z.ZodObject<{
4193
4296
  customUrl?: string | undefined;
4194
4297
  customUrlLabel?: string | undefined;
4195
4298
  } | undefined;
4299
+ ctaButtons?: {
4300
+ url?: string | undefined;
4301
+ label?: string | undefined;
4302
+ }[] | undefined;
4196
4303
  }>>;
4197
4304
  quantity: z.ZodOptional<z.ZodNumber>;
4198
4305
  existingProfileId: z.ZodOptional<z.ZodString>;
@@ -4347,6 +4454,10 @@ declare const configurationUpdateSchema: z.ZodObject<{
4347
4454
  customUrl?: string | undefined;
4348
4455
  customUrlLabel?: string | undefined;
4349
4456
  } | undefined;
4457
+ ctaButtons?: {
4458
+ url: string;
4459
+ label: string;
4460
+ }[] | undefined;
4350
4461
  } | undefined;
4351
4462
  quantity?: number | undefined;
4352
4463
  existingProfileId?: string | undefined;
@@ -4501,6 +4612,10 @@ declare const configurationUpdateSchema: z.ZodObject<{
4501
4612
  customUrl?: string | undefined;
4502
4613
  customUrlLabel?: string | undefined;
4503
4614
  } | undefined;
4615
+ ctaButtons?: {
4616
+ url?: string | undefined;
4617
+ label?: string | undefined;
4618
+ }[] | undefined;
4504
4619
  } | undefined;
4505
4620
  quantity?: number | undefined;
4506
4621
  existingProfileId?: string | undefined;
@@ -4591,6 +4706,22 @@ declare const cardUpdateSchema: z.ZodObject<{
4591
4706
  customUrl?: string | undefined;
4592
4707
  customUrlLabel?: string | undefined;
4593
4708
  }>>>>;
4709
+ ctaButtons: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
4710
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
4711
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
4712
+ }, "strip", z.ZodTypeAny, {
4713
+ url: string;
4714
+ label: string;
4715
+ }, {
4716
+ url?: string | undefined;
4717
+ label?: string | undefined;
4718
+ }>, "many">, {
4719
+ url: string;
4720
+ label: string;
4721
+ }[], {
4722
+ url?: string | undefined;
4723
+ label?: string | undefined;
4724
+ }[]>>>>;
4594
4725
  profilePhotoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
4595
4726
  companyLogoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
4596
4727
  }, "strip", z.ZodTypeAny, {
@@ -4626,6 +4757,10 @@ declare const cardUpdateSchema: z.ZodObject<{
4626
4757
  customUrl?: string | undefined;
4627
4758
  customUrlLabel?: string | undefined;
4628
4759
  } | undefined;
4760
+ ctaButtons?: {
4761
+ url: string;
4762
+ label: string;
4763
+ }[] | undefined;
4629
4764
  }, {
4630
4765
  profilePhotoUrl?: string | undefined;
4631
4766
  companyLogoUrl?: string | undefined;
@@ -4659,6 +4794,10 @@ declare const cardUpdateSchema: z.ZodObject<{
4659
4794
  customUrl?: string | undefined;
4660
4795
  customUrlLabel?: string | undefined;
4661
4796
  } | undefined;
4797
+ ctaButtons?: {
4798
+ url?: string | undefined;
4799
+ label?: string | undefined;
4800
+ }[] | undefined;
4662
4801
  }>>;
4663
4802
  status: z.ZodOptional<z.ZodEnum<["active", "suspended", "archived"]>>;
4664
4803
  }, "strip", z.ZodTypeAny, {
@@ -4696,6 +4835,10 @@ declare const cardUpdateSchema: z.ZodObject<{
4696
4835
  customUrl?: string | undefined;
4697
4836
  customUrlLabel?: string | undefined;
4698
4837
  } | undefined;
4838
+ ctaButtons?: {
4839
+ url: string;
4840
+ label: string;
4841
+ }[] | undefined;
4699
4842
  } | undefined;
4700
4843
  }, {
4701
4844
  status?: "active" | "suspended" | "archived" | undefined;
@@ -4732,6 +4875,10 @@ declare const cardUpdateSchema: z.ZodObject<{
4732
4875
  customUrl?: string | undefined;
4733
4876
  customUrlLabel?: string | undefined;
4734
4877
  } | undefined;
4878
+ ctaButtons?: {
4879
+ url?: string | undefined;
4880
+ label?: string | undefined;
4881
+ }[] | undefined;
4735
4882
  } | undefined;
4736
4883
  }>;
4737
4884
  declare const adminCardCreateSchema: z.ZodObject<{
@@ -4895,6 +5042,22 @@ declare const adminCardCreateSchema: z.ZodObject<{
4895
5042
  customUrl?: string | undefined;
4896
5043
  customUrlLabel?: string | undefined;
4897
5044
  }>>;
5045
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
5046
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
5047
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
5048
+ }, "strip", z.ZodTypeAny, {
5049
+ url: string;
5050
+ label: string;
5051
+ }, {
5052
+ url?: string | undefined;
5053
+ label?: string | undefined;
5054
+ }>, "many">, {
5055
+ url: string;
5056
+ label: string;
5057
+ }[], {
5058
+ url?: string | undefined;
5059
+ label?: string | undefined;
5060
+ }[]>>;
4898
5061
  }, "strip", z.ZodTypeAny, {
4899
5062
  templateId: "minimal" | "bold" | "card" | "aurora";
4900
5063
  accentColor: string;
@@ -4926,6 +5089,10 @@ declare const adminCardCreateSchema: z.ZodObject<{
4926
5089
  customUrl?: string | undefined;
4927
5090
  customUrlLabel?: string | undefined;
4928
5091
  } | undefined;
5092
+ ctaButtons?: {
5093
+ url: string;
5094
+ label: string;
5095
+ }[] | undefined;
4929
5096
  }, {
4930
5097
  templateId: "minimal" | "bold" | "card" | "aurora";
4931
5098
  accentColor: string;
@@ -4957,6 +5124,10 @@ declare const adminCardCreateSchema: z.ZodObject<{
4957
5124
  customUrl?: string | undefined;
4958
5125
  customUrlLabel?: string | undefined;
4959
5126
  } | undefined;
5127
+ ctaButtons?: {
5128
+ url?: string | undefined;
5129
+ label?: string | undefined;
5130
+ }[] | undefined;
4960
5131
  }>;
4961
5132
  physicalConfig: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
4962
5133
  material: z.ZodEnum<["plastic", "3dprint_standard", "metal", "bamboo"]>;
@@ -5930,6 +6101,10 @@ declare const adminCardCreateSchema: z.ZodObject<{
5930
6101
  customUrl?: string | undefined;
5931
6102
  customUrlLabel?: string | undefined;
5932
6103
  } | undefined;
6104
+ ctaButtons?: {
6105
+ url: string;
6106
+ label: string;
6107
+ }[] | undefined;
5933
6108
  };
5934
6109
  targetUserId: string;
5935
6110
  physicalConfig?: {
@@ -6082,6 +6257,10 @@ declare const adminCardCreateSchema: z.ZodObject<{
6082
6257
  customUrl?: string | undefined;
6083
6258
  customUrlLabel?: string | undefined;
6084
6259
  } | undefined;
6260
+ ctaButtons?: {
6261
+ url?: string | undefined;
6262
+ label?: string | undefined;
6263
+ }[] | undefined;
6085
6264
  };
6086
6265
  targetUserId: string;
6087
6266
  physicalConfig?: {
@@ -6433,6 +6612,22 @@ declare const profileCreateSchema: z.ZodObject<{
6433
6612
  customUrl?: string | undefined;
6434
6613
  customUrlLabel?: string | undefined;
6435
6614
  }>>;
6615
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
6616
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
6617
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
6618
+ }, "strip", z.ZodTypeAny, {
6619
+ url: string;
6620
+ label: string;
6621
+ }, {
6622
+ url?: string | undefined;
6623
+ label?: string | undefined;
6624
+ }>, "many">, {
6625
+ url: string;
6626
+ label: string;
6627
+ }[], {
6628
+ url?: string | undefined;
6629
+ label?: string | undefined;
6630
+ }[]>>;
6436
6631
  }, "strip", z.ZodTypeAny, {
6437
6632
  templateId: "minimal" | "bold" | "card" | "aurora";
6438
6633
  accentColor: string;
@@ -6464,6 +6659,10 @@ declare const profileCreateSchema: z.ZodObject<{
6464
6659
  customUrl?: string | undefined;
6465
6660
  customUrlLabel?: string | undefined;
6466
6661
  } | undefined;
6662
+ ctaButtons?: {
6663
+ url: string;
6664
+ label: string;
6665
+ }[] | undefined;
6467
6666
  }, {
6468
6667
  templateId: "minimal" | "bold" | "card" | "aurora";
6469
6668
  accentColor: string;
@@ -6495,6 +6694,10 @@ declare const profileCreateSchema: z.ZodObject<{
6495
6694
  customUrl?: string | undefined;
6496
6695
  customUrlLabel?: string | undefined;
6497
6696
  } | undefined;
6697
+ ctaButtons?: {
6698
+ url?: string | undefined;
6699
+ label?: string | undefined;
6700
+ }[] | undefined;
6498
6701
  }>;
6499
6702
  visibility: z.ZodDefault<z.ZodEnum<["public", "private", "link_only"]>>;
6500
6703
  accessPin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
@@ -6555,9 +6758,13 @@ declare const profileCreateSchema: z.ZodObject<{
6555
6758
  customUrl?: string | undefined;
6556
6759
  customUrlLabel?: string | undefined;
6557
6760
  } | undefined;
6761
+ ctaButtons?: {
6762
+ url: string;
6763
+ label: string;
6764
+ }[] | undefined;
6558
6765
  };
6559
- cardId?: string | undefined;
6560
6766
  label?: string | undefined;
6767
+ cardId?: string | undefined;
6561
6768
  icon?: string | undefined;
6562
6769
  accessPin?: string | undefined;
6563
6770
  }, {
@@ -6616,10 +6823,14 @@ declare const profileCreateSchema: z.ZodObject<{
6616
6823
  customUrl?: string | undefined;
6617
6824
  customUrlLabel?: string | undefined;
6618
6825
  } | undefined;
6826
+ ctaButtons?: {
6827
+ url?: string | undefined;
6828
+ label?: string | undefined;
6829
+ }[] | undefined;
6619
6830
  };
6831
+ label?: string | undefined;
6620
6832
  visibility?: "public" | "private" | "link_only" | undefined;
6621
6833
  cardId?: string | undefined;
6622
- label?: string | undefined;
6623
6834
  icon?: string | undefined;
6624
6835
  accessPin?: string | undefined;
6625
6836
  }>;
@@ -6792,6 +7003,22 @@ declare const signupWithProfileSchema: z.ZodObject<{
6792
7003
  customUrl?: string | undefined;
6793
7004
  customUrlLabel?: string | undefined;
6794
7005
  }>>;
7006
+ ctaButtons: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
7007
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
7008
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
7009
+ }, "strip", z.ZodTypeAny, {
7010
+ url: string;
7011
+ label: string;
7012
+ }, {
7013
+ url?: string | undefined;
7014
+ label?: string | undefined;
7015
+ }>, "many">, {
7016
+ url: string;
7017
+ label: string;
7018
+ }[], {
7019
+ url?: string | undefined;
7020
+ label?: string | undefined;
7021
+ }[]>>;
6795
7022
  }, "strip", z.ZodTypeAny, {
6796
7023
  templateId: "minimal" | "bold" | "card" | "aurora";
6797
7024
  accentColor: string;
@@ -6823,6 +7050,10 @@ declare const signupWithProfileSchema: z.ZodObject<{
6823
7050
  customUrl?: string | undefined;
6824
7051
  customUrlLabel?: string | undefined;
6825
7052
  } | undefined;
7053
+ ctaButtons?: {
7054
+ url: string;
7055
+ label: string;
7056
+ }[] | undefined;
6826
7057
  }, {
6827
7058
  templateId: "minimal" | "bold" | "card" | "aurora";
6828
7059
  accentColor: string;
@@ -6854,6 +7085,10 @@ declare const signupWithProfileSchema: z.ZodObject<{
6854
7085
  customUrl?: string | undefined;
6855
7086
  customUrlLabel?: string | undefined;
6856
7087
  } | undefined;
7088
+ ctaButtons?: {
7089
+ url?: string | undefined;
7090
+ label?: string | undefined;
7091
+ }[] | undefined;
6857
7092
  }>;
6858
7093
  }, "strip", z.ZodTypeAny, {
6859
7094
  email: string;
@@ -6912,6 +7147,10 @@ declare const signupWithProfileSchema: z.ZodObject<{
6912
7147
  customUrl?: string | undefined;
6913
7148
  customUrlLabel?: string | undefined;
6914
7149
  } | undefined;
7150
+ ctaButtons?: {
7151
+ url: string;
7152
+ label: string;
7153
+ }[] | undefined;
6915
7154
  };
6916
7155
  password: string;
6917
7156
  acceptedTerms: true;
@@ -6977,6 +7216,10 @@ declare const signupWithProfileSchema: z.ZodObject<{
6977
7216
  customUrl?: string | undefined;
6978
7217
  customUrlLabel?: string | undefined;
6979
7218
  } | undefined;
7219
+ ctaButtons?: {
7220
+ url?: string | undefined;
7221
+ label?: string | undefined;
7222
+ }[] | undefined;
6980
7223
  };
6981
7224
  password: string;
6982
7225
  acceptedTerms: true;
@@ -7149,6 +7392,22 @@ declare const profileUpdateSchema: z.ZodObject<{
7149
7392
  customUrl?: string | undefined;
7150
7393
  customUrlLabel?: string | undefined;
7151
7394
  }>>>>;
7395
+ ctaButtons: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
7396
+ label: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
7397
+ url: z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, string, string | undefined>;
7398
+ }, "strip", z.ZodTypeAny, {
7399
+ url: string;
7400
+ label: string;
7401
+ }, {
7402
+ url?: string | undefined;
7403
+ label?: string | undefined;
7404
+ }>, "many">, {
7405
+ url: string;
7406
+ label: string;
7407
+ }[], {
7408
+ url?: string | undefined;
7409
+ label?: string | undefined;
7410
+ }[]>>>>;
7152
7411
  profilePhotoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
7153
7412
  companyLogoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
7154
7413
  }, "strip", z.ZodTypeAny, {
@@ -7184,6 +7443,10 @@ declare const profileUpdateSchema: z.ZodObject<{
7184
7443
  customUrl?: string | undefined;
7185
7444
  customUrlLabel?: string | undefined;
7186
7445
  } | undefined;
7446
+ ctaButtons?: {
7447
+ url: string;
7448
+ label: string;
7449
+ }[] | undefined;
7187
7450
  }, {
7188
7451
  profilePhotoUrl?: string | undefined;
7189
7452
  companyLogoUrl?: string | undefined;
@@ -7217,10 +7480,15 @@ declare const profileUpdateSchema: z.ZodObject<{
7217
7480
  customUrl?: string | undefined;
7218
7481
  customUrlLabel?: string | undefined;
7219
7482
  } | undefined;
7483
+ ctaButtons?: {
7484
+ url?: string | undefined;
7485
+ label?: string | undefined;
7486
+ }[] | undefined;
7220
7487
  }>>;
7221
7488
  visibility: z.ZodOptional<z.ZodEnum<["public", "private", "link_only"]>>;
7222
7489
  accessPin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
7223
7490
  }, "strip", z.ZodTypeAny, {
7491
+ label?: string | undefined;
7224
7492
  visibility?: "public" | "private" | "link_only" | undefined;
7225
7493
  userData?: {
7226
7494
  firstName?: string | undefined;
@@ -7279,11 +7547,15 @@ declare const profileUpdateSchema: z.ZodObject<{
7279
7547
  customUrl?: string | undefined;
7280
7548
  customUrlLabel?: string | undefined;
7281
7549
  } | undefined;
7550
+ ctaButtons?: {
7551
+ url: string;
7552
+ label: string;
7553
+ }[] | undefined;
7282
7554
  } | undefined;
7283
- label?: string | undefined;
7284
7555
  icon?: string | undefined;
7285
7556
  accessPin?: string | undefined;
7286
7557
  }, {
7558
+ label?: string | undefined;
7287
7559
  visibility?: "public" | "private" | "link_only" | undefined;
7288
7560
  userData?: {
7289
7561
  firstName?: string | undefined;
@@ -7342,8 +7614,11 @@ declare const profileUpdateSchema: z.ZodObject<{
7342
7614
  customUrl?: string | undefined;
7343
7615
  customUrlLabel?: string | undefined;
7344
7616
  } | undefined;
7617
+ ctaButtons?: {
7618
+ url?: string | undefined;
7619
+ label?: string | undefined;
7620
+ }[] | undefined;
7345
7621
  } | undefined;
7346
- label?: string | undefined;
7347
7622
  icon?: string | undefined;
7348
7623
  accessPin?: string | undefined;
7349
7624
  }>;
@@ -7491,4 +7766,4 @@ declare function validatePhysicalConfig(data: unknown): ValidationResult<z.infer
7491
7766
  declare function validateDigitalConfig(data: unknown): ValidationResult<z.infer<typeof digitalConfigSchema>>;
7492
7767
  declare function validateConfiguration(data: unknown): ValidationResult<z.infer<typeof configurationCreateSchema>>;
7493
7768
 
7494
- export { type ValidationResult, adminCardCreateSchema, cardDesignMaterialSchema, cardDesignPatternSchema, cardDesignSchema, cardElementsSchema, cardProfileUpdateSchema, cardUpdateSchema, comboIdSchema, configurationCreateSchema, configurationUpdateSchema, contactDetailTogglesSchema, contactExchangeSchema, createOrderSchema, digitalConfigSchema, digitalVisibilitySchema, hubConfigSchema, hubProfilesUpdateSchema, materialSchema, patternFamilySchema, physicalConfigSchema, physicalContentOverridesSchema, profileAccessTokenCreateSchema, profileCreateSchema, profilePinVerifySchema, profileUpdateSchema, profileUserDataSchema, profileVisibilitySchema, sanitizeHttpUrl, sanitizeText, signupWithProfileSchema, socialLinksSchema, socialOverridesSchema, userDataSchema, validateConfiguration, validateDigitalConfig, validatePhysicalConfig, validateUserData, webAddressSchema };
7769
+ export { MAX_CTA_BUTTONS, type ValidationResult, adminCardCreateSchema, cardDesignMaterialSchema, cardDesignPatternSchema, cardDesignSchema, cardElementsSchema, cardProfileUpdateSchema, cardUpdateSchema, comboIdSchema, configurationCreateSchema, configurationUpdateSchema, contactDetailTogglesSchema, contactExchangeSchema, createOrderSchema, ctaButtonSchema, ctaButtonsSchema, digitalConfigSchema, digitalVisibilitySchema, hubConfigSchema, hubProfilesUpdateSchema, materialSchema, patternFamilySchema, physicalConfigSchema, physicalContentOverridesSchema, profileAccessTokenCreateSchema, profileCreateSchema, profilePinVerifySchema, profileUpdateSchema, profileUserDataSchema, profileVisibilitySchema, sanitizeHttpUrl, sanitizeText, signupWithProfileSchema, socialLinksSchema, socialOverridesSchema, userDataSchema, validateConfiguration, validateDigitalConfig, validatePhysicalConfig, validateUserData, webAddressSchema };
package/dist/index.js CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nfcard/validation",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Shared Zod validation schemas for the NFCard product family.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "zod": "^3.24.0",
20
- "@nfcard/types": "0.8.0"
20
+ "@nfcard/types": "0.9.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsup": "^8.0.0"
package/src/index.test.ts CHANGED
@@ -6,9 +6,11 @@ import {
6
6
  configurationCreateSchema,
7
7
  contactExchangeSchema,
8
8
  createOrderSchema,
9
+ ctaButtonsSchema,
9
10
  digitalConfigSchema,
10
11
  hubConfigSchema,
11
12
  materialSchema,
13
+ MAX_CTA_BUTTONS,
12
14
  physicalConfigSchema,
13
15
  profileCreateSchema,
14
16
  profileVisibilitySchema,
@@ -268,6 +270,93 @@ describe('socialOverridesSchema (FOXHOLE-595 input side)', () => {
268
270
  });
269
271
  });
270
272
 
273
+ // ── ctaButtonsSchema (NFCARD-211 — Pro CTA buttons) ─────────────
274
+
275
+ describe('ctaButtonsSchema (NFCARD-211 — Pro CTA buttons)', () => {
276
+ it('keeps a valid button and upgrades http → https', () => {
277
+ const out = ctaButtonsSchema.parse([
278
+ { label: 'Book a call', url: 'http://calendly.com/foxhome' },
279
+ ]);
280
+ expect(out).toEqual([
281
+ { label: 'Book a call', url: 'https://calendly.com/foxhome' },
282
+ ]);
283
+ });
284
+
285
+ it('prefixes https onto a bare-host url', () => {
286
+ const [btn] = ctaButtonsSchema.parse([
287
+ { label: 'Shop', url: 'foxhome.hu/shop' },
288
+ ]);
289
+ expect(btn.url).toBe('https://foxhome.hu/shop');
290
+ });
291
+
292
+ it.each([
293
+ 'javascript:alert(1)',
294
+ 'JaVaScRiPt:alert(1)',
295
+ 'data:text/html,<script>alert(1)</script>',
296
+ 'vbscript:msgbox(1)',
297
+ 'file:///etc/passwd',
298
+ 'mailto:a@b.c',
299
+ ])('drops a button whose url is a dangerous/non-http scheme: %s', (bad) => {
300
+ // url sanitizes to '' → the button is incomplete → filtered out.
301
+ expect(ctaButtonsSchema.parse([{ label: 'Click me', url: bad }])).toEqual([]);
302
+ });
303
+
304
+ it('strips HTML tags from the label and caps its length at 40', () => {
305
+ const [btn] = ctaButtonsSchema.parse([
306
+ { label: '<b>Pay now</b>', url: 'https://pay.example.com' },
307
+ ]);
308
+ expect(btn.label).toBe('Pay now');
309
+ const long = ctaButtonsSchema.parse([
310
+ { label: 'x'.repeat(200), url: 'https://e.com' },
311
+ ]);
312
+ expect(long[0].label.length).toBe(40);
313
+ });
314
+
315
+ it('drops incomplete buttons (missing label or url)', () => {
316
+ const out = ctaButtonsSchema.parse([
317
+ { label: '', url: 'https://valid.example.com' },
318
+ { label: 'No link', url: '' },
319
+ { label: 'Good', url: 'https://ok.example.com' },
320
+ ]);
321
+ // URL.href normalises a bare origin with a trailing slash.
322
+ expect(out).toEqual([{ label: 'Good', url: 'https://ok.example.com/' }]);
323
+ });
324
+
325
+ it(`caps the list at MAX_CTA_BUTTONS (${MAX_CTA_BUTTONS})`, () => {
326
+ const many = Array.from({ length: MAX_CTA_BUTTONS + 4 }, (_, i) => ({
327
+ label: `Btn ${i}`,
328
+ url: `https://e${i}.example.com`,
329
+ }));
330
+ expect(ctaButtonsSchema.parse(many)).toHaveLength(MAX_CTA_BUTTONS);
331
+ });
332
+
333
+ it('rejects an abusive payload over the hard array cap', () => {
334
+ const huge = Array.from({ length: 51 }, () => ({
335
+ label: 'x',
336
+ url: 'https://e.example.com',
337
+ }));
338
+ expect(ctaButtonsSchema.safeParse(huge).success).toBe(false);
339
+ });
340
+
341
+ it('flows through digitalConfigSchema — unsafe buttons dropped on save', () => {
342
+ const r = digitalConfigSchema.safeParse({
343
+ templateId: 'card',
344
+ accentColor: '#1A6B52',
345
+ fontKey: 'inter',
346
+ showAvatar: true,
347
+ ctaButtons: [
348
+ { label: 'Evil', url: 'javascript:alert(1)' },
349
+ { label: 'Book', url: 'calendly.com/x' },
350
+ ],
351
+ });
352
+ expect(r.success).toBe(true);
353
+ if (r.success)
354
+ expect(r.data.ctaButtons).toEqual([
355
+ { label: 'Book', url: 'https://calendly.com/x' },
356
+ ]);
357
+ });
358
+ });
359
+
271
360
  // ── userDataSchema ──────────────────────────────────────────────
272
361
 
273
362
  describe('userDataSchema / validateUserData', () => {
package/src/index.ts CHANGED
Binary file