@nfcard/validation 0.3.0 → 0.5.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
@@ -1170,6 +1170,7 @@ declare const configurationCreateSchema: z.ZodObject<{
1170
1170
  }>;
1171
1171
  quantity: z.ZodDefault<z.ZodNumber>;
1172
1172
  existingProfileId: z.ZodOptional<z.ZodString>;
1173
+ physicalTemplateId: z.ZodOptional<z.ZodString>;
1173
1174
  }, "strip", z.ZodTypeAny, {
1174
1175
  sessionId: string;
1175
1176
  userData: {
@@ -1276,6 +1277,7 @@ declare const configurationCreateSchema: z.ZodObject<{
1276
1277
  };
1277
1278
  quantity: number;
1278
1279
  existingProfileId?: string | undefined;
1280
+ physicalTemplateId?: string | undefined;
1279
1281
  }, {
1280
1282
  sessionId: string;
1281
1283
  userData: {
@@ -1382,6 +1384,7 @@ declare const configurationCreateSchema: z.ZodObject<{
1382
1384
  };
1383
1385
  quantity?: number | undefined;
1384
1386
  existingProfileId?: string | undefined;
1387
+ physicalTemplateId?: string | undefined;
1385
1388
  }>;
1386
1389
  declare const configurationUpdateSchema: z.ZodObject<{
1387
1390
  userData: z.ZodOptional<z.ZodObject<{
@@ -1902,6 +1905,7 @@ declare const configurationUpdateSchema: z.ZodObject<{
1902
1905
  }>>;
1903
1906
  quantity: z.ZodOptional<z.ZodNumber>;
1904
1907
  existingProfileId: z.ZodOptional<z.ZodString>;
1908
+ physicalTemplateId: z.ZodOptional<z.ZodString>;
1905
1909
  }, "strip", z.ZodTypeAny, {
1906
1910
  userData?: {
1907
1911
  email: string;
@@ -2007,6 +2011,7 @@ declare const configurationUpdateSchema: z.ZodObject<{
2007
2011
  } | undefined;
2008
2012
  quantity?: number | undefined;
2009
2013
  existingProfileId?: string | undefined;
2014
+ physicalTemplateId?: string | undefined;
2010
2015
  }, {
2011
2016
  userData?: {
2012
2017
  email: string;
@@ -2112,6 +2117,7 @@ declare const configurationUpdateSchema: z.ZodObject<{
2112
2117
  } | undefined;
2113
2118
  quantity?: number | undefined;
2114
2119
  existingProfileId?: string | undefined;
2120
+ physicalTemplateId?: string | undefined;
2115
2121
  }>;
2116
2122
  declare const createOrderSchema: z.ZodObject<{
2117
2123
  configurationId: z.ZodString;
@@ -3153,7 +3159,7 @@ declare const profileUserDataSchema: z.ZodObject<{
3153
3159
  }>;
3154
3160
  declare const profileCreateSchema: z.ZodObject<{
3155
3161
  cardId: z.ZodOptional<z.ZodString>;
3156
- label: z.ZodString;
3162
+ label: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
3157
3163
  icon: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
3158
3164
  userData: z.ZodObject<{
3159
3165
  firstName: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
@@ -3432,8 +3438,8 @@ declare const profileCreateSchema: z.ZodObject<{
3432
3438
  customUrlLabel?: string | undefined;
3433
3439
  } | undefined;
3434
3440
  };
3435
- label: string;
3436
3441
  cardId?: string | undefined;
3442
+ label?: string | undefined;
3437
3443
  icon?: string | undefined;
3438
3444
  accessPin?: string | undefined;
3439
3445
  }, {
@@ -3492,9 +3498,9 @@ declare const profileCreateSchema: z.ZodObject<{
3492
3498
  customUrlLabel?: string | undefined;
3493
3499
  } | undefined;
3494
3500
  };
3495
- label: string;
3496
3501
  visibility?: "public" | "private" | "link_only" | undefined;
3497
3502
  cardId?: string | undefined;
3503
+ label?: string | undefined;
3498
3504
  icon?: string | undefined;
3499
3505
  accessPin?: string | undefined;
3500
3506
  }>;
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.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Shared Zod validation schemas for the NFCard product family.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.test.ts CHANGED
@@ -425,6 +425,29 @@ describe('validateConfiguration', () => {
425
425
  });
426
426
  expect(r.success).toBe(false);
427
427
  });
428
+
429
+ it('keeps physicalTemplateId when provided (NFCARD-3 Template path)', () => {
430
+ const r = configurationCreateSchema.safeParse({
431
+ sessionId: '550e8400-e29b-41d4-a716-446655440000',
432
+ userData: validUserData,
433
+ physicalConfig: validPhysicalConfig,
434
+ digitalConfig: validDigitalConfig,
435
+ physicalTemplateId: 'tpl-pvc-white',
436
+ });
437
+ expect(r.success).toBe(true);
438
+ if (r.success) expect(r.data.physicalTemplateId).toBe('tpl-pvc-white');
439
+ });
440
+
441
+ it('omits physicalTemplateId for the Custom path (optional)', () => {
442
+ const r = configurationCreateSchema.safeParse({
443
+ sessionId: '550e8400-e29b-41d4-a716-446655440000',
444
+ userData: validUserData,
445
+ physicalConfig: validPhysicalConfig,
446
+ digitalConfig: validDigitalConfig,
447
+ });
448
+ expect(r.success).toBe(true);
449
+ if (r.success) expect(r.data.physicalTemplateId).toBeUndefined();
450
+ });
428
451
  });
429
452
 
430
453
  // ── profileCreateSchema ─────────────────────────────────────────
@@ -459,12 +482,21 @@ describe('profileCreateSchema', () => {
459
482
  expect(r.success).toBe(false);
460
483
  });
461
484
 
462
- it('rejects missing label', () => {
485
+ it('accepts a missing label (NFCARD-128 — blank profile, label set later in the editor)', () => {
463
486
  const r = profileCreateSchema.safeParse({
464
487
  userData: { ...validUserData, email: '' },
465
488
  digitalConfig: validDigitalConfig,
466
489
  });
467
- expect(r.success).toBe(false);
490
+ expect(r.success).toBe(true);
491
+ });
492
+
493
+ it('accepts an empty label', () => {
494
+ const r = profileCreateSchema.safeParse({
495
+ label: '',
496
+ userData: { ...validUserData, email: '' },
497
+ digitalConfig: validDigitalConfig,
498
+ });
499
+ expect(r.success).toBe(true);
468
500
  });
469
501
  });
470
502
 
package/src/index.ts CHANGED
Binary file