@nfcard/validation 0.19.0 → 0.20.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 +234 -2
- package/dist/index.js +13 -1
- package/package.json +2 -2
- package/src/index.ts +0 -0
- package/src/tipJar.test.ts +77 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _nfcard_types from '@nfcard/types';
|
|
2
2
|
import { CardAsset, CardElement, ElementTransform } from '@nfcard/types';
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Manufacturing-printability envelope for the free-transform element layer
|
|
@@ -5181,6 +5182,15 @@ declare const ctaButtonsSchema: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
|
5181
5182
|
url?: string | undefined;
|
|
5182
5183
|
label?: string | undefined;
|
|
5183
5184
|
}[]>;
|
|
5185
|
+
declare const tipJarSchema: z.ZodEffects<z.ZodUnknown, {
|
|
5186
|
+
provider: _nfcard_types.TipProviderId;
|
|
5187
|
+
handle: string;
|
|
5188
|
+
label: string;
|
|
5189
|
+
} | {
|
|
5190
|
+
provider: _nfcard_types.TipProviderId;
|
|
5191
|
+
handle: string;
|
|
5192
|
+
label?: undefined;
|
|
5193
|
+
} | undefined, unknown>;
|
|
5184
5194
|
declare const digitalConfigSchema: z.ZodObject<{
|
|
5185
5195
|
templateId: z.ZodEnum<["minimal", "bold", "card", "aurora", "classic", "spotlight", "marquee", "riso"]>;
|
|
5186
5196
|
accentColor: z.ZodString;
|
|
@@ -5268,6 +5278,15 @@ declare const digitalConfigSchema: z.ZodObject<{
|
|
|
5268
5278
|
url?: string | undefined;
|
|
5269
5279
|
label?: string | undefined;
|
|
5270
5280
|
}[]>>;
|
|
5281
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
5282
|
+
provider: _nfcard_types.TipProviderId;
|
|
5283
|
+
handle: string;
|
|
5284
|
+
label: string;
|
|
5285
|
+
} | {
|
|
5286
|
+
provider: _nfcard_types.TipProviderId;
|
|
5287
|
+
handle: string;
|
|
5288
|
+
label?: undefined;
|
|
5289
|
+
} | undefined, unknown>>;
|
|
5271
5290
|
}, "strip", z.ZodTypeAny, {
|
|
5272
5291
|
fontKey: string;
|
|
5273
5292
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -5303,6 +5322,15 @@ declare const digitalConfigSchema: z.ZodObject<{
|
|
|
5303
5322
|
url: string;
|
|
5304
5323
|
label: string;
|
|
5305
5324
|
}[] | undefined;
|
|
5325
|
+
tipJar?: {
|
|
5326
|
+
provider: _nfcard_types.TipProviderId;
|
|
5327
|
+
handle: string;
|
|
5328
|
+
label: string;
|
|
5329
|
+
} | {
|
|
5330
|
+
provider: _nfcard_types.TipProviderId;
|
|
5331
|
+
handle: string;
|
|
5332
|
+
label?: undefined;
|
|
5333
|
+
} | undefined;
|
|
5306
5334
|
}, {
|
|
5307
5335
|
fontKey: string;
|
|
5308
5336
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -5338,6 +5366,7 @@ declare const digitalConfigSchema: z.ZodObject<{
|
|
|
5338
5366
|
url?: string | undefined;
|
|
5339
5367
|
label?: string | undefined;
|
|
5340
5368
|
}[] | undefined;
|
|
5369
|
+
tipJar?: unknown;
|
|
5341
5370
|
}>;
|
|
5342
5371
|
declare const entrySourceSchema: z.ZodObject<{
|
|
5343
5372
|
output: z.ZodOptional<z.ZodEnum<["with-card", "digital-only"]>>;
|
|
@@ -8831,6 +8860,15 @@ declare const configurationCreateSchema: z.ZodObject<{
|
|
|
8831
8860
|
url?: string | undefined;
|
|
8832
8861
|
label?: string | undefined;
|
|
8833
8862
|
}[]>>;
|
|
8863
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
8864
|
+
provider: _nfcard_types.TipProviderId;
|
|
8865
|
+
handle: string;
|
|
8866
|
+
label: string;
|
|
8867
|
+
} | {
|
|
8868
|
+
provider: _nfcard_types.TipProviderId;
|
|
8869
|
+
handle: string;
|
|
8870
|
+
label?: undefined;
|
|
8871
|
+
} | undefined, unknown>>;
|
|
8834
8872
|
}, "strip", z.ZodTypeAny, {
|
|
8835
8873
|
fontKey: string;
|
|
8836
8874
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -8866,6 +8904,15 @@ declare const configurationCreateSchema: z.ZodObject<{
|
|
|
8866
8904
|
url: string;
|
|
8867
8905
|
label: string;
|
|
8868
8906
|
}[] | undefined;
|
|
8907
|
+
tipJar?: {
|
|
8908
|
+
provider: _nfcard_types.TipProviderId;
|
|
8909
|
+
handle: string;
|
|
8910
|
+
label: string;
|
|
8911
|
+
} | {
|
|
8912
|
+
provider: _nfcard_types.TipProviderId;
|
|
8913
|
+
handle: string;
|
|
8914
|
+
label?: undefined;
|
|
8915
|
+
} | undefined;
|
|
8869
8916
|
}, {
|
|
8870
8917
|
fontKey: string;
|
|
8871
8918
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -8901,6 +8948,7 @@ declare const configurationCreateSchema: z.ZodObject<{
|
|
|
8901
8948
|
url?: string | undefined;
|
|
8902
8949
|
label?: string | undefined;
|
|
8903
8950
|
}[] | undefined;
|
|
8951
|
+
tipJar?: unknown;
|
|
8904
8952
|
}>;
|
|
8905
8953
|
quantity: z.ZodDefault<z.ZodNumber>;
|
|
8906
8954
|
existingProfileId: z.ZodOptional<z.ZodString>;
|
|
@@ -9285,6 +9333,15 @@ declare const configurationCreateSchema: z.ZodObject<{
|
|
|
9285
9333
|
url: string;
|
|
9286
9334
|
label: string;
|
|
9287
9335
|
}[] | undefined;
|
|
9336
|
+
tipJar?: {
|
|
9337
|
+
provider: _nfcard_types.TipProviderId;
|
|
9338
|
+
handle: string;
|
|
9339
|
+
label: string;
|
|
9340
|
+
} | {
|
|
9341
|
+
provider: _nfcard_types.TipProviderId;
|
|
9342
|
+
handle: string;
|
|
9343
|
+
label?: undefined;
|
|
9344
|
+
} | undefined;
|
|
9288
9345
|
};
|
|
9289
9346
|
quantity: number;
|
|
9290
9347
|
existingProfileId?: string | undefined;
|
|
@@ -9651,6 +9708,7 @@ declare const configurationCreateSchema: z.ZodObject<{
|
|
|
9651
9708
|
url?: string | undefined;
|
|
9652
9709
|
label?: string | undefined;
|
|
9653
9710
|
}[] | undefined;
|
|
9711
|
+
tipJar?: unknown;
|
|
9654
9712
|
};
|
|
9655
9713
|
quantity?: number | undefined;
|
|
9656
9714
|
existingProfileId?: string | undefined;
|
|
@@ -13129,6 +13187,15 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
13129
13187
|
url?: string | undefined;
|
|
13130
13188
|
label?: string | undefined;
|
|
13131
13189
|
}[]>>;
|
|
13190
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
13191
|
+
provider: _nfcard_types.TipProviderId;
|
|
13192
|
+
handle: string;
|
|
13193
|
+
label: string;
|
|
13194
|
+
} | {
|
|
13195
|
+
provider: _nfcard_types.TipProviderId;
|
|
13196
|
+
handle: string;
|
|
13197
|
+
label?: undefined;
|
|
13198
|
+
} | undefined, unknown>>;
|
|
13132
13199
|
}, "strip", z.ZodTypeAny, {
|
|
13133
13200
|
fontKey: string;
|
|
13134
13201
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -13164,6 +13231,15 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
13164
13231
|
url: string;
|
|
13165
13232
|
label: string;
|
|
13166
13233
|
}[] | undefined;
|
|
13234
|
+
tipJar?: {
|
|
13235
|
+
provider: _nfcard_types.TipProviderId;
|
|
13236
|
+
handle: string;
|
|
13237
|
+
label: string;
|
|
13238
|
+
} | {
|
|
13239
|
+
provider: _nfcard_types.TipProviderId;
|
|
13240
|
+
handle: string;
|
|
13241
|
+
label?: undefined;
|
|
13242
|
+
} | undefined;
|
|
13167
13243
|
}, {
|
|
13168
13244
|
fontKey: string;
|
|
13169
13245
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -13199,6 +13275,7 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
13199
13275
|
url?: string | undefined;
|
|
13200
13276
|
label?: string | undefined;
|
|
13201
13277
|
}[] | undefined;
|
|
13278
|
+
tipJar?: unknown;
|
|
13202
13279
|
}>>;
|
|
13203
13280
|
quantity: z.ZodOptional<z.ZodNumber>;
|
|
13204
13281
|
existingProfileId: z.ZodOptional<z.ZodString>;
|
|
@@ -13554,6 +13631,15 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
13554
13631
|
url: string;
|
|
13555
13632
|
label: string;
|
|
13556
13633
|
}[] | undefined;
|
|
13634
|
+
tipJar?: {
|
|
13635
|
+
provider: _nfcard_types.TipProviderId;
|
|
13636
|
+
handle: string;
|
|
13637
|
+
label: string;
|
|
13638
|
+
} | {
|
|
13639
|
+
provider: _nfcard_types.TipProviderId;
|
|
13640
|
+
handle: string;
|
|
13641
|
+
label?: undefined;
|
|
13642
|
+
} | undefined;
|
|
13557
13643
|
} | undefined;
|
|
13558
13644
|
quantity?: number | undefined;
|
|
13559
13645
|
existingProfileId?: string | undefined;
|
|
@@ -13909,6 +13995,7 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
13909
13995
|
url?: string | undefined;
|
|
13910
13996
|
label?: string | undefined;
|
|
13911
13997
|
}[] | undefined;
|
|
13998
|
+
tipJar?: unknown;
|
|
13912
13999
|
} | undefined;
|
|
13913
14000
|
quantity?: number | undefined;
|
|
13914
14001
|
existingProfileId?: string | undefined;
|
|
@@ -14015,6 +14102,15 @@ declare const cardUpdateSchema: z.ZodObject<{
|
|
|
14015
14102
|
url?: string | undefined;
|
|
14016
14103
|
label?: string | undefined;
|
|
14017
14104
|
}[]>>>>;
|
|
14105
|
+
tipJar: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
14106
|
+
provider: _nfcard_types.TipProviderId;
|
|
14107
|
+
handle: string;
|
|
14108
|
+
label: string;
|
|
14109
|
+
} | {
|
|
14110
|
+
provider: _nfcard_types.TipProviderId;
|
|
14111
|
+
handle: string;
|
|
14112
|
+
label?: undefined;
|
|
14113
|
+
} | undefined, unknown>>>>;
|
|
14018
14114
|
profilePhotoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
|
|
14019
14115
|
companyLogoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
|
|
14020
14116
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -14054,6 +14150,15 @@ declare const cardUpdateSchema: z.ZodObject<{
|
|
|
14054
14150
|
url: string;
|
|
14055
14151
|
label: string;
|
|
14056
14152
|
}[] | undefined;
|
|
14153
|
+
tipJar?: {
|
|
14154
|
+
provider: _nfcard_types.TipProviderId;
|
|
14155
|
+
handle: string;
|
|
14156
|
+
label: string;
|
|
14157
|
+
} | {
|
|
14158
|
+
provider: _nfcard_types.TipProviderId;
|
|
14159
|
+
handle: string;
|
|
14160
|
+
label?: undefined;
|
|
14161
|
+
} | undefined;
|
|
14057
14162
|
}, {
|
|
14058
14163
|
profilePhotoUrl?: string | undefined;
|
|
14059
14164
|
companyLogoUrl?: string | undefined;
|
|
@@ -14091,6 +14196,7 @@ declare const cardUpdateSchema: z.ZodObject<{
|
|
|
14091
14196
|
url?: string | undefined;
|
|
14092
14197
|
label?: string | undefined;
|
|
14093
14198
|
}[] | undefined;
|
|
14199
|
+
tipJar?: unknown;
|
|
14094
14200
|
}>>;
|
|
14095
14201
|
status: z.ZodOptional<z.ZodEnum<["active", "suspended", "archived"]>>;
|
|
14096
14202
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -14132,6 +14238,15 @@ declare const cardUpdateSchema: z.ZodObject<{
|
|
|
14132
14238
|
url: string;
|
|
14133
14239
|
label: string;
|
|
14134
14240
|
}[] | undefined;
|
|
14241
|
+
tipJar?: {
|
|
14242
|
+
provider: _nfcard_types.TipProviderId;
|
|
14243
|
+
handle: string;
|
|
14244
|
+
label: string;
|
|
14245
|
+
} | {
|
|
14246
|
+
provider: _nfcard_types.TipProviderId;
|
|
14247
|
+
handle: string;
|
|
14248
|
+
label?: undefined;
|
|
14249
|
+
} | undefined;
|
|
14135
14250
|
} | undefined;
|
|
14136
14251
|
}, {
|
|
14137
14252
|
status?: "active" | "suspended" | "archived" | undefined;
|
|
@@ -14172,6 +14287,7 @@ declare const cardUpdateSchema: z.ZodObject<{
|
|
|
14172
14287
|
url?: string | undefined;
|
|
14173
14288
|
label?: string | undefined;
|
|
14174
14289
|
}[] | undefined;
|
|
14290
|
+
tipJar?: unknown;
|
|
14175
14291
|
} | undefined;
|
|
14176
14292
|
}>;
|
|
14177
14293
|
declare const adminCardCreateSchema: z.ZodObject<{
|
|
@@ -14351,6 +14467,15 @@ declare const adminCardCreateSchema: z.ZodObject<{
|
|
|
14351
14467
|
url?: string | undefined;
|
|
14352
14468
|
label?: string | undefined;
|
|
14353
14469
|
}[]>>;
|
|
14470
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
14471
|
+
provider: _nfcard_types.TipProviderId;
|
|
14472
|
+
handle: string;
|
|
14473
|
+
label: string;
|
|
14474
|
+
} | {
|
|
14475
|
+
provider: _nfcard_types.TipProviderId;
|
|
14476
|
+
handle: string;
|
|
14477
|
+
label?: undefined;
|
|
14478
|
+
} | undefined, unknown>>;
|
|
14354
14479
|
}, "strip", z.ZodTypeAny, {
|
|
14355
14480
|
fontKey: string;
|
|
14356
14481
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -14386,6 +14511,15 @@ declare const adminCardCreateSchema: z.ZodObject<{
|
|
|
14386
14511
|
url: string;
|
|
14387
14512
|
label: string;
|
|
14388
14513
|
}[] | undefined;
|
|
14514
|
+
tipJar?: {
|
|
14515
|
+
provider: _nfcard_types.TipProviderId;
|
|
14516
|
+
handle: string;
|
|
14517
|
+
label: string;
|
|
14518
|
+
} | {
|
|
14519
|
+
provider: _nfcard_types.TipProviderId;
|
|
14520
|
+
handle: string;
|
|
14521
|
+
label?: undefined;
|
|
14522
|
+
} | undefined;
|
|
14389
14523
|
}, {
|
|
14390
14524
|
fontKey: string;
|
|
14391
14525
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -14421,6 +14555,7 @@ declare const adminCardCreateSchema: z.ZodObject<{
|
|
|
14421
14555
|
url?: string | undefined;
|
|
14422
14556
|
label?: string | undefined;
|
|
14423
14557
|
}[] | undefined;
|
|
14558
|
+
tipJar?: unknown;
|
|
14424
14559
|
}>;
|
|
14425
14560
|
physicalConfig: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
14426
14561
|
material: z.ZodEnum<["plastic", "3dprint_standard", "metal", "bamboo"]>;
|
|
@@ -17769,6 +17904,15 @@ declare const adminCardCreateSchema: z.ZodObject<{
|
|
|
17769
17904
|
url: string;
|
|
17770
17905
|
label: string;
|
|
17771
17906
|
}[] | undefined;
|
|
17907
|
+
tipJar?: {
|
|
17908
|
+
provider: _nfcard_types.TipProviderId;
|
|
17909
|
+
handle: string;
|
|
17910
|
+
label: string;
|
|
17911
|
+
} | {
|
|
17912
|
+
provider: _nfcard_types.TipProviderId;
|
|
17913
|
+
handle: string;
|
|
17914
|
+
label?: undefined;
|
|
17915
|
+
} | undefined;
|
|
17772
17916
|
};
|
|
17773
17917
|
targetUserId: string;
|
|
17774
17918
|
physicalConfig?: {
|
|
@@ -18122,6 +18266,7 @@ declare const adminCardCreateSchema: z.ZodObject<{
|
|
|
18122
18266
|
url?: string | undefined;
|
|
18123
18267
|
label?: string | undefined;
|
|
18124
18268
|
}[] | undefined;
|
|
18269
|
+
tipJar?: unknown;
|
|
18125
18270
|
};
|
|
18126
18271
|
targetUserId: string;
|
|
18127
18272
|
physicalConfig?: {
|
|
@@ -18686,6 +18831,15 @@ declare const profileCreateSchema: z.ZodObject<{
|
|
|
18686
18831
|
url?: string | undefined;
|
|
18687
18832
|
label?: string | undefined;
|
|
18688
18833
|
}[]>>;
|
|
18834
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
18835
|
+
provider: _nfcard_types.TipProviderId;
|
|
18836
|
+
handle: string;
|
|
18837
|
+
label: string;
|
|
18838
|
+
} | {
|
|
18839
|
+
provider: _nfcard_types.TipProviderId;
|
|
18840
|
+
handle: string;
|
|
18841
|
+
label?: undefined;
|
|
18842
|
+
} | undefined, unknown>>;
|
|
18689
18843
|
}, "strip", z.ZodTypeAny, {
|
|
18690
18844
|
fontKey: string;
|
|
18691
18845
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -18721,6 +18875,15 @@ declare const profileCreateSchema: z.ZodObject<{
|
|
|
18721
18875
|
url: string;
|
|
18722
18876
|
label: string;
|
|
18723
18877
|
}[] | undefined;
|
|
18878
|
+
tipJar?: {
|
|
18879
|
+
provider: _nfcard_types.TipProviderId;
|
|
18880
|
+
handle: string;
|
|
18881
|
+
label: string;
|
|
18882
|
+
} | {
|
|
18883
|
+
provider: _nfcard_types.TipProviderId;
|
|
18884
|
+
handle: string;
|
|
18885
|
+
label?: undefined;
|
|
18886
|
+
} | undefined;
|
|
18724
18887
|
}, {
|
|
18725
18888
|
fontKey: string;
|
|
18726
18889
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -18756,6 +18919,7 @@ declare const profileCreateSchema: z.ZodObject<{
|
|
|
18756
18919
|
url?: string | undefined;
|
|
18757
18920
|
label?: string | undefined;
|
|
18758
18921
|
}[] | undefined;
|
|
18922
|
+
tipJar?: unknown;
|
|
18759
18923
|
}>;
|
|
18760
18924
|
visibility: z.ZodDefault<z.ZodEnum<["public", "private", "link_only"]>>;
|
|
18761
18925
|
accessPin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
@@ -18820,6 +18984,15 @@ declare const profileCreateSchema: z.ZodObject<{
|
|
|
18820
18984
|
url: string;
|
|
18821
18985
|
label: string;
|
|
18822
18986
|
}[] | undefined;
|
|
18987
|
+
tipJar?: {
|
|
18988
|
+
provider: _nfcard_types.TipProviderId;
|
|
18989
|
+
handle: string;
|
|
18990
|
+
label: string;
|
|
18991
|
+
} | {
|
|
18992
|
+
provider: _nfcard_types.TipProviderId;
|
|
18993
|
+
handle: string;
|
|
18994
|
+
label?: undefined;
|
|
18995
|
+
} | undefined;
|
|
18823
18996
|
};
|
|
18824
18997
|
label?: string | undefined;
|
|
18825
18998
|
cardId?: string | undefined;
|
|
@@ -18885,6 +19058,7 @@ declare const profileCreateSchema: z.ZodObject<{
|
|
|
18885
19058
|
url?: string | undefined;
|
|
18886
19059
|
label?: string | undefined;
|
|
18887
19060
|
}[] | undefined;
|
|
19061
|
+
tipJar?: unknown;
|
|
18888
19062
|
};
|
|
18889
19063
|
label?: string | undefined;
|
|
18890
19064
|
visibility?: "public" | "private" | "link_only" | undefined;
|
|
@@ -19077,6 +19251,15 @@ declare const signupWithProfileSchema: z.ZodObject<{
|
|
|
19077
19251
|
url?: string | undefined;
|
|
19078
19252
|
label?: string | undefined;
|
|
19079
19253
|
}[]>>;
|
|
19254
|
+
tipJar: z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
19255
|
+
provider: _nfcard_types.TipProviderId;
|
|
19256
|
+
handle: string;
|
|
19257
|
+
label: string;
|
|
19258
|
+
} | {
|
|
19259
|
+
provider: _nfcard_types.TipProviderId;
|
|
19260
|
+
handle: string;
|
|
19261
|
+
label?: undefined;
|
|
19262
|
+
} | undefined, unknown>>;
|
|
19080
19263
|
}, "strip", z.ZodTypeAny, {
|
|
19081
19264
|
fontKey: string;
|
|
19082
19265
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -19112,6 +19295,15 @@ declare const signupWithProfileSchema: z.ZodObject<{
|
|
|
19112
19295
|
url: string;
|
|
19113
19296
|
label: string;
|
|
19114
19297
|
}[] | undefined;
|
|
19298
|
+
tipJar?: {
|
|
19299
|
+
provider: _nfcard_types.TipProviderId;
|
|
19300
|
+
handle: string;
|
|
19301
|
+
label: string;
|
|
19302
|
+
} | {
|
|
19303
|
+
provider: _nfcard_types.TipProviderId;
|
|
19304
|
+
handle: string;
|
|
19305
|
+
label?: undefined;
|
|
19306
|
+
} | undefined;
|
|
19115
19307
|
}, {
|
|
19116
19308
|
fontKey: string;
|
|
19117
19309
|
templateId: "minimal" | "bold" | "card" | "aurora" | "classic" | "spotlight" | "marquee" | "riso";
|
|
@@ -19147,6 +19339,7 @@ declare const signupWithProfileSchema: z.ZodObject<{
|
|
|
19147
19339
|
url?: string | undefined;
|
|
19148
19340
|
label?: string | undefined;
|
|
19149
19341
|
}[] | undefined;
|
|
19342
|
+
tipJar?: unknown;
|
|
19150
19343
|
}>;
|
|
19151
19344
|
}, "strip", z.ZodTypeAny, {
|
|
19152
19345
|
email: string;
|
|
@@ -19209,6 +19402,15 @@ declare const signupWithProfileSchema: z.ZodObject<{
|
|
|
19209
19402
|
url: string;
|
|
19210
19403
|
label: string;
|
|
19211
19404
|
}[] | undefined;
|
|
19405
|
+
tipJar?: {
|
|
19406
|
+
provider: _nfcard_types.TipProviderId;
|
|
19407
|
+
handle: string;
|
|
19408
|
+
label: string;
|
|
19409
|
+
} | {
|
|
19410
|
+
provider: _nfcard_types.TipProviderId;
|
|
19411
|
+
handle: string;
|
|
19412
|
+
label?: undefined;
|
|
19413
|
+
} | undefined;
|
|
19212
19414
|
};
|
|
19213
19415
|
password: string;
|
|
19214
19416
|
acceptedTerms: true;
|
|
@@ -19278,6 +19480,7 @@ declare const signupWithProfileSchema: z.ZodObject<{
|
|
|
19278
19480
|
url?: string | undefined;
|
|
19279
19481
|
label?: string | undefined;
|
|
19280
19482
|
}[] | undefined;
|
|
19483
|
+
tipJar?: unknown;
|
|
19281
19484
|
};
|
|
19282
19485
|
password: string;
|
|
19283
19486
|
acceptedTerms: true;
|
|
@@ -19466,6 +19669,15 @@ declare const profileUpdateSchema: z.ZodObject<{
|
|
|
19466
19669
|
url?: string | undefined;
|
|
19467
19670
|
label?: string | undefined;
|
|
19468
19671
|
}[]>>>>;
|
|
19672
|
+
tipJar: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodUnknown, {
|
|
19673
|
+
provider: _nfcard_types.TipProviderId;
|
|
19674
|
+
handle: string;
|
|
19675
|
+
label: string;
|
|
19676
|
+
} | {
|
|
19677
|
+
provider: _nfcard_types.TipProviderId;
|
|
19678
|
+
handle: string;
|
|
19679
|
+
label?: undefined;
|
|
19680
|
+
} | undefined, unknown>>>>;
|
|
19469
19681
|
profilePhotoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
|
|
19470
19682
|
companyLogoUrl: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
|
|
19471
19683
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -19505,6 +19717,15 @@ declare const profileUpdateSchema: z.ZodObject<{
|
|
|
19505
19717
|
url: string;
|
|
19506
19718
|
label: string;
|
|
19507
19719
|
}[] | undefined;
|
|
19720
|
+
tipJar?: {
|
|
19721
|
+
provider: _nfcard_types.TipProviderId;
|
|
19722
|
+
handle: string;
|
|
19723
|
+
label: string;
|
|
19724
|
+
} | {
|
|
19725
|
+
provider: _nfcard_types.TipProviderId;
|
|
19726
|
+
handle: string;
|
|
19727
|
+
label?: undefined;
|
|
19728
|
+
} | undefined;
|
|
19508
19729
|
}, {
|
|
19509
19730
|
profilePhotoUrl?: string | undefined;
|
|
19510
19731
|
companyLogoUrl?: string | undefined;
|
|
@@ -19542,6 +19763,7 @@ declare const profileUpdateSchema: z.ZodObject<{
|
|
|
19542
19763
|
url?: string | undefined;
|
|
19543
19764
|
label?: string | undefined;
|
|
19544
19765
|
}[] | undefined;
|
|
19766
|
+
tipJar?: unknown;
|
|
19545
19767
|
}>>;
|
|
19546
19768
|
visibility: z.ZodOptional<z.ZodEnum<["public", "private", "link_only"]>>;
|
|
19547
19769
|
accessPin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
@@ -19609,6 +19831,15 @@ declare const profileUpdateSchema: z.ZodObject<{
|
|
|
19609
19831
|
url: string;
|
|
19610
19832
|
label: string;
|
|
19611
19833
|
}[] | undefined;
|
|
19834
|
+
tipJar?: {
|
|
19835
|
+
provider: _nfcard_types.TipProviderId;
|
|
19836
|
+
handle: string;
|
|
19837
|
+
label: string;
|
|
19838
|
+
} | {
|
|
19839
|
+
provider: _nfcard_types.TipProviderId;
|
|
19840
|
+
handle: string;
|
|
19841
|
+
label?: undefined;
|
|
19842
|
+
} | undefined;
|
|
19612
19843
|
} | undefined;
|
|
19613
19844
|
icon?: string | undefined;
|
|
19614
19845
|
accessPin?: string | undefined;
|
|
@@ -19676,6 +19907,7 @@ declare const profileUpdateSchema: z.ZodObject<{
|
|
|
19676
19907
|
url?: string | undefined;
|
|
19677
19908
|
label?: string | undefined;
|
|
19678
19909
|
}[] | undefined;
|
|
19910
|
+
tipJar?: unknown;
|
|
19679
19911
|
} | undefined;
|
|
19680
19912
|
icon?: string | undefined;
|
|
19681
19913
|
accessPin?: string | undefined;
|
|
@@ -19824,4 +20056,4 @@ declare function validatePhysicalConfig(data: unknown): ValidationResult<z.infer
|
|
|
19824
20056
|
declare function validateDigitalConfig(data: unknown): ValidationResult<z.infer<typeof digitalConfigSchema>>;
|
|
19825
20057
|
declare function validateConfiguration(data: unknown): ValidationResult<z.infer<typeof configurationCreateSchema>>;
|
|
19826
20058
|
|
|
19827
|
-
export { ADVANCE_FALLBACK_EM, CARD_H_MM, CARD_W_MM, CHIP_RADIUS_MM, CHIP_SCALE_FLOOR, type ChipAxis, EDGE_MARGIN_MM, EMPTY_TEXT_FLOOR_EM, ITALIC_OVERHANG_EM, MAX_CTA_BUTTONS, MIN_WALL_MM, NFC_COIL_DIAMETER_MM, NFC_RADIAL_CLEARANCE_MM, type PrintabilityCtx, type Pt, QR_MATRIX_CELLS, QR_MIN_SIZE_MM, QR_MODULE_MIN_MM, TEXT_LINE_FACTOR_EM, TEXT_MIN_EM_MM, type ValidationResult, type Violation, adminCardCreateSchema, cardAssetSchema, cardDesignMaterialSchema, cardDesignPatternSchema, cardDesignSchema, cardElementSchema, cardElementsSchema, cardProfileUpdateSchema, cardUpdateSchema, chipAnchorToMm, chipPlacementMaxXY, comboIdSchema, configurationCreateSchema, configurationUpdateSchema, contactDetailTogglesSchema, contactExchangeSchema, cornersOnCard, createOrderSchema, ctaButtonSchema, ctaButtonsSchema, digitalConfigSchema, digitalVisibilitySchema, elementPrintability, elementTransformSchema, entrySourceSchema, footprintOf, hubConfigSchema, hubProfilesUpdateSchema, isFiniteTransform, materialSchema, mmToNearestChipAnchor, obbCorners, patternFamilySchema, physicalConfigSchema, physicalContentOverridesSchema, profileAccessTokenCreateSchema, profileCreateSchema, profilePinVerifySchema, profileUpdateSchema, profileUserDataSchema, profileVisibilitySchema, sanitizeHttpUrl, sanitizeText, signupWithProfileSchema, socialLinksSchema, socialOverridesSchema, textAdvanceEm, userDataSchema, validateConfiguration, validateDigitalConfig, validatePhysicalConfig, validateUserData, webAddressSchema };
|
|
20059
|
+
export { ADVANCE_FALLBACK_EM, CARD_H_MM, CARD_W_MM, CHIP_RADIUS_MM, CHIP_SCALE_FLOOR, type ChipAxis, EDGE_MARGIN_MM, EMPTY_TEXT_FLOOR_EM, ITALIC_OVERHANG_EM, MAX_CTA_BUTTONS, MIN_WALL_MM, NFC_COIL_DIAMETER_MM, NFC_RADIAL_CLEARANCE_MM, type PrintabilityCtx, type Pt, QR_MATRIX_CELLS, QR_MIN_SIZE_MM, QR_MODULE_MIN_MM, TEXT_LINE_FACTOR_EM, TEXT_MIN_EM_MM, type ValidationResult, type Violation, adminCardCreateSchema, cardAssetSchema, cardDesignMaterialSchema, cardDesignPatternSchema, cardDesignSchema, cardElementSchema, cardElementsSchema, cardProfileUpdateSchema, cardUpdateSchema, chipAnchorToMm, chipPlacementMaxXY, comboIdSchema, configurationCreateSchema, configurationUpdateSchema, contactDetailTogglesSchema, contactExchangeSchema, cornersOnCard, createOrderSchema, ctaButtonSchema, ctaButtonsSchema, digitalConfigSchema, digitalVisibilitySchema, elementPrintability, elementTransformSchema, entrySourceSchema, footprintOf, hubConfigSchema, hubProfilesUpdateSchema, isFiniteTransform, materialSchema, mmToNearestChipAnchor, obbCorners, patternFamilySchema, physicalConfigSchema, physicalContentOverridesSchema, profileAccessTokenCreateSchema, profileCreateSchema, profilePinVerifySchema, profileUpdateSchema, profileUserDataSchema, profileVisibilitySchema, sanitizeHttpUrl, sanitizeText, signupWithProfileSchema, socialLinksSchema, socialOverridesSchema, textAdvanceEm, tipJarSchema, userDataSchema, validateConfiguration, validateDigitalConfig, validatePhysicalConfig, validateUserData, webAddressSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { isTipProviderId, normalizeTipHandle } from "@nfcard/types";
|
|
3
4
|
|
|
4
5
|
// src/printability.ts
|
|
5
6
|
var CARD_W_MM = 85.6;
|
|
@@ -735,6 +736,15 @@ var ctaButtonSchema = z.object({
|
|
|
735
736
|
var ctaButtonsSchema = z.array(ctaButtonSchema).max(50).transform(
|
|
736
737
|
(arr) => arr.filter((b) => b.url !== "" && b.label !== "").slice(0, MAX_CTA_BUTTONS)
|
|
737
738
|
);
|
|
739
|
+
var tipJarSchema = z.unknown().transform((raw) => {
|
|
740
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
741
|
+
const rec = raw;
|
|
742
|
+
if (!isTipProviderId(rec.provider)) return void 0;
|
|
743
|
+
const handle = normalizeTipHandle(rec.provider, rec.handle);
|
|
744
|
+
if (!handle) return void 0;
|
|
745
|
+
const label = typeof rec.label === "string" ? sanitizeText(rec.label, 40) : "";
|
|
746
|
+
return label ? { provider: rec.provider, handle, label } : { provider: rec.provider, handle };
|
|
747
|
+
});
|
|
738
748
|
var digitalConfigSchema = z.object({
|
|
739
749
|
templateId: z.enum(["minimal", "bold", "card", "aurora", "classic", "spotlight", "marquee", "riso"]),
|
|
740
750
|
accentColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/),
|
|
@@ -753,7 +763,8 @@ var digitalConfigSchema = z.object({
|
|
|
753
763
|
// NFCARD-211 — Pro-only custom CTA buttons. Sanitised + capped here; the
|
|
754
764
|
// public renderer additionally gates them on the owner's tier (free →
|
|
755
765
|
// none). Optional, so existing profiles/configs validate unchanged.
|
|
756
|
-
ctaButtons: ctaButtonsSchema.optional()
|
|
766
|
+
ctaButtons: ctaButtonsSchema.optional(),
|
|
767
|
+
tipJar: tipJarSchema.optional()
|
|
757
768
|
});
|
|
758
769
|
var entrySourceSchema = z.object({
|
|
759
770
|
output: z.enum(["with-card", "digital-only"]).optional(),
|
|
@@ -1011,6 +1022,7 @@ export {
|
|
|
1011
1022
|
socialLinksSchema,
|
|
1012
1023
|
socialOverridesSchema,
|
|
1013
1024
|
textAdvanceEm,
|
|
1025
|
+
tipJarSchema,
|
|
1014
1026
|
userDataSchema,
|
|
1015
1027
|
validateConfiguration,
|
|
1016
1028
|
validateDigitalConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nfcard/validation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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.
|
|
20
|
+
"@nfcard/types": "0.14.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsup": "^8.0.0"
|
package/src/index.ts
CHANGED
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { tipJarSchema, digitalConfigSchema } from './index'
|
|
3
|
+
|
|
4
|
+
const baseConfig = {
|
|
5
|
+
templateId: 'classic' as const,
|
|
6
|
+
accentColor: '#123456',
|
|
7
|
+
fontKey: 'inter',
|
|
8
|
+
showAvatar: true,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe('tipJarSchema', () => {
|
|
12
|
+
it('accepts a valid provider + handle and stores only { provider, handle }', () => {
|
|
13
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 'ricsi' })).toEqual({
|
|
14
|
+
provider: 'kofi',
|
|
15
|
+
handle: 'ricsi',
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('normalizes a pasted full URL down to the handle', () => {
|
|
20
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 'https://ko-fi.com/ricsi?x=1' })).toEqual(
|
|
21
|
+
{ provider: 'kofi', handle: 'ricsi' },
|
|
22
|
+
)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('lowercases revolut handles', () => {
|
|
26
|
+
expect(tipJarSchema.parse({ provider: 'revolut', handle: 'RicSi' })).toEqual({
|
|
27
|
+
provider: 'revolut',
|
|
28
|
+
handle: 'ricsi',
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('keeps a sanitized custom label, capped at 40 chars', () => {
|
|
33
|
+
const out = tipJarSchema.parse({
|
|
34
|
+
provider: 'kofi',
|
|
35
|
+
handle: 'ricsi',
|
|
36
|
+
label: '<b>Támogass</b> ' + 'x'.repeat(60),
|
|
37
|
+
})
|
|
38
|
+
expect(out?.provider).toBe('kofi')
|
|
39
|
+
expect(out?.label).not.toContain('<')
|
|
40
|
+
expect((out?.label ?? '').length).toBeLessThanOrEqual(40)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('drops everything invalid to undefined instead of throwing (never 400)', () => {
|
|
44
|
+
expect(tipJarSchema.parse(undefined)).toBeUndefined()
|
|
45
|
+
expect(tipJarSchema.parse(null)).toBeUndefined()
|
|
46
|
+
expect(tipJarSchema.parse('nonsense')).toBeUndefined()
|
|
47
|
+
expect(tipJarSchema.parse({})).toBeUndefined()
|
|
48
|
+
expect(tipJarSchema.parse({ provider: 'stripe', handle: 'ricsi' })).toBeUndefined()
|
|
49
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 'x' })).toBeUndefined() // too short
|
|
50
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 'https://evil.com/ricsi' })).toBeUndefined()
|
|
51
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 'javascript:alert(1)' })).toBeUndefined()
|
|
52
|
+
expect(tipJarSchema.parse({ provider: 'kofi', handle: 123 })).toBeUndefined()
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe('digitalConfigSchema — tipJar field', () => {
|
|
57
|
+
it('round-trips a valid tipJar', () => {
|
|
58
|
+
const parsed = digitalConfigSchema.parse({
|
|
59
|
+
...baseConfig,
|
|
60
|
+
tipJar: { provider: 'revolut', handle: 'ricsi' },
|
|
61
|
+
})
|
|
62
|
+
expect(parsed.tipJar).toEqual({ provider: 'revolut', handle: 'ricsi' })
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('drops an invalid tipJar without failing the whole config save', () => {
|
|
66
|
+
const parsed = digitalConfigSchema.parse({
|
|
67
|
+
...baseConfig,
|
|
68
|
+
tipJar: { provider: 'kofi', handle: 'https://evil.com/x' },
|
|
69
|
+
})
|
|
70
|
+
expect(parsed.tipJar).toBeUndefined()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('is optional — a config without a tipJar parses fine', () => {
|
|
74
|
+
const parsed = digitalConfigSchema.parse(baseConfig)
|
|
75
|
+
expect(parsed.tipJar).toBeUndefined()
|
|
76
|
+
})
|
|
77
|
+
})
|