@nfcard/validation 0.15.0 → 0.16.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
@@ -5306,9 +5306,13 @@ declare const entrySourceSchema: z.ZodObject<{
5306
5306
  ref: z.ZodOptional<z.ZodString>;
5307
5307
  path: z.ZodOptional<z.ZodString>;
5308
5308
  referrer: z.ZodOptional<z.ZodString>;
5309
+ material: z.ZodOptional<z.ZodEnum<["plastic", "3dprint_standard", "metal", "bamboo"]>>;
5310
+ template: z.ZodOptional<z.ZodString>;
5309
5311
  utm: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
5310
5312
  }, "strict", z.ZodTypeAny, {
5311
5313
  path?: string | undefined;
5314
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
5315
+ template?: string | undefined;
5312
5316
  output?: "with-card" | "digital-only" | undefined;
5313
5317
  entryFlow?: "order" | "try" | undefined;
5314
5318
  ref?: string | undefined;
@@ -5316,6 +5320,8 @@ declare const entrySourceSchema: z.ZodObject<{
5316
5320
  utm?: Record<string, string> | undefined;
5317
5321
  }, {
5318
5322
  path?: string | undefined;
5323
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
5324
+ template?: string | undefined;
5319
5325
  output?: "with-card" | "digital-only" | undefined;
5320
5326
  entryFlow?: "order" | "try" | undefined;
5321
5327
  ref?: string | undefined;
@@ -8866,9 +8872,13 @@ declare const configurationCreateSchema: z.ZodObject<{
8866
8872
  ref: z.ZodOptional<z.ZodString>;
8867
8873
  path: z.ZodOptional<z.ZodString>;
8868
8874
  referrer: z.ZodOptional<z.ZodString>;
8875
+ material: z.ZodOptional<z.ZodEnum<["plastic", "3dprint_standard", "metal", "bamboo"]>>;
8876
+ template: z.ZodOptional<z.ZodString>;
8869
8877
  utm: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
8870
8878
  }, "strict", z.ZodTypeAny, {
8871
8879
  path?: string | undefined;
8880
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
8881
+ template?: string | undefined;
8872
8882
  output?: "with-card" | "digital-only" | undefined;
8873
8883
  entryFlow?: "order" | "try" | undefined;
8874
8884
  ref?: string | undefined;
@@ -8876,6 +8886,8 @@ declare const configurationCreateSchema: z.ZodObject<{
8876
8886
  utm?: Record<string, string> | undefined;
8877
8887
  }, {
8878
8888
  path?: string | undefined;
8889
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
8890
+ template?: string | undefined;
8879
8891
  output?: "with-card" | "digital-only" | undefined;
8880
8892
  entryFlow?: "order" | "try" | undefined;
8881
8893
  ref?: string | undefined;
@@ -9240,6 +9252,8 @@ declare const configurationCreateSchema: z.ZodObject<{
9240
9252
  physicalTemplateId?: string | undefined;
9241
9253
  entrySource?: {
9242
9254
  path?: string | undefined;
9255
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
9256
+ template?: string | undefined;
9243
9257
  output?: "with-card" | "digital-only" | undefined;
9244
9258
  entryFlow?: "order" | "try" | undefined;
9245
9259
  ref?: string | undefined;
@@ -9604,6 +9618,8 @@ declare const configurationCreateSchema: z.ZodObject<{
9604
9618
  physicalTemplateId?: string | undefined;
9605
9619
  entrySource?: {
9606
9620
  path?: string | undefined;
9621
+ material?: "plastic" | "3dprint_standard" | "metal" | "bamboo" | undefined;
9622
+ template?: string | undefined;
9607
9623
  output?: "with-card" | "digital-only" | undefined;
9608
9624
  entryFlow?: "order" | "try" | undefined;
9609
9625
  ref?: string | undefined;
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.15.0",
3
+ "version": "0.16.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
@@ -1045,3 +1045,33 @@ describe('entrySourceSchema on configurationCreateSchema', () => {
1045
1045
  if (r.success) expect((r.data as Record<string, unknown>).entrySource).toBeUndefined();
1046
1046
  });
1047
1047
  });
1048
+
1049
+ describe('entrySourceSchema material/template preselects (NFCARD-393)', () => {
1050
+ const base = {
1051
+ sessionId: '550e8400-e29b-41d4-a716-446655440000',
1052
+ userData: validUserData,
1053
+ physicalConfig: validPhysicalConfig,
1054
+ digitalConfig: validDigitalConfig,
1055
+ };
1056
+
1057
+ it('accepts the deep-link preselects', () => {
1058
+ const r = configurationCreateSchema.safeParse({
1059
+ ...base,
1060
+ entrySource: { output: 'with-card', material: '3dprint_standard', template: 'tpl-pvc-white' },
1061
+ });
1062
+ expect(r.success).toBe(true);
1063
+ if (r.success) {
1064
+ expect(r.data.entrySource?.material).toBe('3dprint_standard');
1065
+ expect(r.data.entrySource?.template).toBe('tpl-pvc-white');
1066
+ }
1067
+ });
1068
+
1069
+ it('rejects a non-enum material', () => {
1070
+ expect(
1071
+ configurationCreateSchema.safeParse({
1072
+ ...base,
1073
+ entrySource: { material: 'carbon-fiber' },
1074
+ }).success,
1075
+ ).toBe(false);
1076
+ });
1077
+ });
package/src/index.ts CHANGED
Binary file