@builder-builder/builder 0.0.26 → 0.0.28

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.
Files changed (120) hide show
  1. package/dist/bb.js +4 -4
  2. package/dist/client/client.d.ts +2 -1
  3. package/dist/client/client.js +4 -1
  4. package/dist/client/public.d.ts +2 -2
  5. package/dist/client/public.js +1 -1
  6. package/dist/client/schema.d.ts +103 -17
  7. package/dist/client/schema.js +7 -0
  8. package/dist/components/Builder.svelte.d.ts +24 -0
  9. package/dist/components/BuilderCollectionButtons.svelte.d.ts +22 -0
  10. package/dist/components/BuilderCollections.svelte.d.ts +23 -0
  11. package/dist/components/BuilderDescription.svelte.d.ts +18 -0
  12. package/dist/components/BuilderLayout.svelte.d.ts +24 -0
  13. package/dist/components/BuilderOption.svelte.d.ts +31 -0
  14. package/dist/components/BuilderOptionSelect.svelte.d.ts +21 -0
  15. package/dist/components/BuilderOptionToggleBoolean.svelte.d.ts +20 -0
  16. package/dist/components/BuilderOptionToggleNumber.svelte.d.ts +21 -0
  17. package/dist/components/BuilderOptionToggleString.svelte.d.ts +21 -0
  18. package/dist/components/BuilderPrice.svelte.d.ts +21 -0
  19. package/dist/components/BuilderRender.svelte.d.ts +39 -0
  20. package/dist/components/config.d.ts +2 -0
  21. package/dist/components/config.js +1 -0
  22. package/dist/components/dispatch.d.ts +1 -0
  23. package/dist/components/dispatch.js +3 -0
  24. package/dist/components/id.d.ts +1 -0
  25. package/dist/components/id.js +3 -0
  26. package/dist/components/index.d.ts +25 -0
  27. package/dist/components/index.js +7515 -0
  28. package/dist/components/index.min.js +3 -0
  29. package/dist/entities/collection/collection.d.ts +66 -66
  30. package/dist/entities/collection/config.d.ts +17 -17
  31. package/dist/entities/collection/when.d.ts +1 -1
  32. package/dist/entities/component/component.d.ts +64 -64
  33. package/dist/entities/component/config.d.ts +33 -33
  34. package/dist/entities/component/config.js +18 -16
  35. package/dist/entities/component/detail.d.ts +61 -0
  36. package/dist/entities/component/detail.js +71 -0
  37. package/dist/entities/component/index.d.ts +2 -2
  38. package/dist/entities/component/index.js +1 -1
  39. package/dist/entities/component/when.d.ts +2 -2
  40. package/dist/entities/expectation.d.ts +1 -1
  41. package/dist/entities/index.d.ts +4 -4
  42. package/dist/entities/index.js +1 -1
  43. package/dist/entities/kind.d.ts +3 -3
  44. package/dist/entities/kind.js +20 -20
  45. package/dist/entities/model/methods.d.ts +1 -1
  46. package/dist/entities/option/config.d.ts +7 -7
  47. package/dist/entities/option/config.js +1 -1
  48. package/dist/entities/option/index.d.ts +4 -4
  49. package/dist/entities/option/index.js +2 -2
  50. package/dist/entities/option/option.d.ts +22 -22
  51. package/dist/entities/option/select.d.ts +1 -1
  52. package/dist/entities/option/toggle.d.ts +9 -9
  53. package/dist/entities/option/toggle.js +15 -10
  54. package/dist/entities/option/when.d.ts +1 -1
  55. package/dist/entities/paths.d.ts +2 -2
  56. package/dist/entities/pricing/expression.d.ts +16 -39
  57. package/dist/entities/pricing/expression.js +1 -16
  58. package/dist/entities/pricing/index.d.ts +1 -1
  59. package/dist/entities/pricing/rates.d.ts +1 -1
  60. package/dist/entities/references.d.ts +72 -24
  61. package/dist/entities/serialise.d.ts +148 -32
  62. package/dist/entities/serialise.js +7 -7
  63. package/dist/entities/ui/describe.d.ts +49 -1
  64. package/dist/entities/ui/input.d.ts +67 -2
  65. package/dist/entities/ui/input.js +8 -2
  66. package/dist/entities/ui/page.d.ts +49 -1
  67. package/dist/entities/ui/pages.d.ts +10 -2
  68. package/dist/entities/validated.d.ts +2 -2
  69. package/dist/entities/when.d.ts +5 -5
  70. package/dist/environment.d.ts +2 -2
  71. package/dist/errors/errors.d.ts +86 -55
  72. package/dist/errors/errors.js +36 -5
  73. package/dist/errors/exception.d.ts +3 -3
  74. package/dist/errors/index.d.ts +1 -1
  75. package/dist/errors/index.js +1 -1
  76. package/dist/errors/public.d.ts +1 -1
  77. package/dist/index.d.ts +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/instance.d.ts +53 -9
  80. package/dist/instance.js +6 -2
  81. package/dist/mappers/dependencies.d.ts +3 -0
  82. package/dist/mappers/dependencies.js +44 -0
  83. package/dist/mappers/index.d.ts +2 -2
  84. package/dist/mappers/index.js +2 -1
  85. package/dist/mappers/instance.js +26 -21
  86. package/dist/mappers/order.js +4 -2
  87. package/dist/mappers/price.js +6 -4
  88. package/dist/mappers/render/option.d.ts +1 -0
  89. package/dist/mappers/render/option.js +1 -0
  90. package/dist/mappers/variants/index.d.ts +1 -2
  91. package/dist/mappers/variants/index.js +1 -2
  92. package/dist/mappers/variants/option-graph.d.ts +1 -2
  93. package/dist/mappers/variants/option-graph.js +3 -17
  94. package/dist/mappers/variants/variants.d.ts +3 -6
  95. package/dist/mappers/variants/variants.js +34 -11
  96. package/dist/primitive.d.ts +3 -0
  97. package/dist/primitive.js +2 -0
  98. package/dist/public.d.ts +8 -8
  99. package/dist/public.js +1 -1
  100. package/dist/validate/builder.d.ts +2 -2
  101. package/dist/validate/builder.js +15 -15
  102. package/dist/validate/expectations.d.ts +2 -2
  103. package/dist/validate/expectations.js +3 -3
  104. package/dist/validate/instance.d.ts +2 -2
  105. package/dist/validate/instance.js +31 -13
  106. package/dist/validate/model.d.ts +4 -4
  107. package/dist/validate/model.js +51 -42
  108. package/dist/validate/paths.d.ts +2 -2
  109. package/dist/validate/paths.js +19 -14
  110. package/dist/validate/pricing.d.ts +4 -4
  111. package/dist/validate/pricing.js +31 -31
  112. package/dist/validate/resolve.d.ts +2 -2
  113. package/dist/validate/resolve.js +18 -18
  114. package/dist/validate/ui.d.ts +4 -4
  115. package/dist/validate/ui.js +38 -38
  116. package/dist/validate/variants.d.ts +3 -3
  117. package/dist/validate/variants.js +32 -31
  118. package/package.json +9 -5
  119. package/dist/entities/component/field.d.ts +0 -59
  120. package/dist/entities/component/field.js +0 -52
package/dist/bb.js CHANGED
@@ -43,7 +43,7 @@ function bbFactory(environment, references = []) {
43
43
  string: (input) => throwInProd(validateString(input, references)),
44
44
  boolean: (input) => throwInProd(validateBoolean(input, references)),
45
45
  instance: (model, instance) => throwInProd(validateInstance(model, instance)),
46
- variants: (model, input, variantOptions) => throwInProd(validateVariants(model, input, variantOptions))
46
+ variants: (model, input, variantOptions) => throwInProd(validateVariants(model, input, variantOptions, references))
47
47
  },
48
48
  instance: (entity, partial) => {
49
49
  assertValidated(entity);
@@ -66,17 +66,17 @@ function bbFactory(environment, references = []) {
66
66
  },
67
67
  variants: (entity) => {
68
68
  assertValidated(entity);
69
- return createVariants(entity);
69
+ return createVariants(entity, references);
70
70
  }
71
71
  };
72
72
  function throwInProd(result) {
73
- const [entity, errors] = result;
73
+ const [entity, errors, warnings] = result;
74
74
  if (environment === 'development') {
75
75
  return result;
76
76
  }
77
77
  if (errors.length > 0) {
78
78
  throw new BuilderException({ category: 'validation', errors });
79
79
  }
80
- return [entity, []];
80
+ return [entity, [], warnings];
81
81
  }
82
82
  }
@@ -1,8 +1,9 @@
1
- import type { BuilderBuilderClientOptions, BuilderBuilderGetResponse, BuilderBuilderPriceResponse } from './schema.js';
2
1
  import type { BuilderInstance } from '../instance.js';
2
+ import type { BuilderBuilderClientOptions, BuilderBuilderGetResponse, BuilderBuilderPriceResponse, BuilderBuilderVariantsResponse } from './schema.js';
3
3
  export type BuilderBuilderClient = {
4
4
  builder: {
5
5
  get(id: string): Promise<BuilderBuilderGetResponse>;
6
+ variants(id: string): Promise<BuilderBuilderVariantsResponse>;
6
7
  price(id: string, instance: BuilderInstance): Promise<BuilderBuilderPriceResponse>;
7
8
  };
8
9
  };
@@ -1,6 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  import { BuilderException } from '../errors/index.js';
3
- import { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceResponseSchema } from './schema.js';
3
+ import { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceResponseSchema, BuilderBuilderVariantsResponseSchema } from './schema.js';
4
4
  export function client(options) {
5
5
  const { url, apiKey, headers } = v.parse(BuilderBuilderClientOptionsSchema, options);
6
6
  const baseHeaders = {
@@ -12,6 +12,9 @@ export function client(options) {
12
12
  get: (id) => request(BuilderBuilderGetResponseSchema, `${url}/api/builder/${id}`, {
13
13
  headers: baseHeaders
14
14
  }),
15
+ variants: (id) => request(BuilderBuilderVariantsResponseSchema, `${url}/api/builder/${id}/variants`, {
16
+ headers: baseHeaders
17
+ }),
15
18
  price: (id, instance) => request(BuilderBuilderPriceResponseSchema, `${url}/api/builder/${id}/price`, {
16
19
  method: 'POST',
17
20
  headers: {
@@ -1,4 +1,4 @@
1
- export type { BuilderBuilderClientOptions, BuilderBuilderGetResponse, BuilderBuilderPriceRequest, BuilderBuilderPriceResponse } from './schema.js';
1
+ export type { BuilderBuilderClientOptions, BuilderBuilderGetResponse, BuilderBuilderPriceRequest, BuilderBuilderPriceResponse, BuilderBuilderVariantsRequest, BuilderBuilderVariantsResponse } from './schema.js';
2
2
  export type { BuilderBuilderClient } from './client.js';
3
- export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceRequestSchema, BuilderBuilderPriceResponseSchema } from './schema.js';
3
+ export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceRequestSchema, BuilderBuilderPriceResponseSchema, BuilderBuilderVariantsRequestSchema, BuilderBuilderVariantsResponseSchema } from './schema.js';
4
4
  export { client } from './client.js';
@@ -1,2 +1,2 @@
1
- export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceRequestSchema, BuilderBuilderPriceResponseSchema } from './schema.js';
1
+ export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema, BuilderBuilderPriceRequestSchema, BuilderBuilderPriceResponseSchema, BuilderBuilderVariantsRequestSchema, BuilderBuilderVariantsResponseSchema } from './schema.js';
2
2
  export { client } from './client.js';
@@ -21,7 +21,7 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
21
21
  tags?: readonly string[] | undefined;
22
22
  }> | Readonly<{
23
23
  type: "toggle";
24
- valueType: "string" | "number" | "boolean";
24
+ kind: "string" | "number" | "boolean";
25
25
  defaultValue: string | number | boolean | null;
26
26
  isOptional: boolean;
27
27
  tags?: readonly string[] | undefined;
@@ -40,7 +40,7 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
40
40
  tags?: readonly string[] | undefined;
41
41
  }>> | Readonly<Readonly<{
42
42
  type: "toggle";
43
- valueType: "string" | "number" | "boolean";
43
+ kind: "string" | "number" | "boolean";
44
44
  defaultValue: string | number | boolean | null;
45
45
  isOptional: boolean;
46
46
  tags?: readonly string[] | undefined;
@@ -55,12 +55,12 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
55
55
  tags?: readonly string[] | undefined;
56
56
  }>> | Readonly<Readonly<{
57
57
  type: "toggle";
58
- valueType: "string" | "number" | "boolean";
58
+ kind: "string" | "number" | "boolean";
59
59
  defaultValue: string | number | boolean | null;
60
60
  isOptional: boolean;
61
61
  tags?: readonly string[] | undefined;
62
62
  }>>> | Readonly<{
63
- fields: Readonly<{
63
+ details: Readonly<{
64
64
  type: "parameter";
65
65
  id: string;
66
66
  name: string;
@@ -68,9 +68,9 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
68
68
  type: "ref";
69
69
  id: string;
70
70
  }> | readonly Readonly<{
71
- type: "component-field";
71
+ type: "component-detail";
72
72
  name: string;
73
- valueType: "string" | "number" | "boolean";
73
+ kind: "string" | "number" | "boolean" | "price" | "image";
74
74
  isOptional: boolean;
75
75
  tags?: readonly string[] | undefined;
76
76
  }>[];
@@ -80,7 +80,7 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
80
80
  id: string;
81
81
  name: string;
82
82
  }> | Readonly<{
83
- fields: Readonly<{
83
+ details: Readonly<{
84
84
  type: "parameter";
85
85
  id: string;
86
86
  name: string;
@@ -88,15 +88,15 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
88
88
  type: "ref";
89
89
  id: string;
90
90
  }> | readonly Readonly<{
91
- type: "component-field";
91
+ type: "component-detail";
92
92
  name: string;
93
- valueType: "string" | "number" | "boolean";
93
+ kind: "string" | "number" | "boolean" | "price" | "image";
94
94
  isOptional: boolean;
95
95
  tags?: readonly string[] | undefined;
96
96
  }>[];
97
97
  tags?: readonly string[] | undefined;
98
98
  }>> | import("../public.js").BuilderWhenSerialised<Readonly<{
99
- fields: Readonly<{
99
+ details: Readonly<{
100
100
  type: "parameter";
101
101
  id: string;
102
102
  name: string;
@@ -104,9 +104,9 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
104
104
  type: "ref";
105
105
  id: string;
106
106
  }> | readonly Readonly<{
107
- type: "component-field";
107
+ type: "component-detail";
108
108
  name: string;
109
- valueType: "string" | "number" | "boolean";
109
+ kind: "string" | "number" | "boolean" | "price" | "image";
110
110
  isOptional: boolean;
111
111
  tags?: readonly string[] | undefined;
112
112
  }>[];
@@ -219,6 +219,14 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
219
219
  type: "ref";
220
220
  id: string;
221
221
  }> | undefined;
222
+ placeholderLabel?: string | Readonly<{
223
+ type: "parameter";
224
+ id: string;
225
+ name: string;
226
+ }> | Readonly<{
227
+ type: "ref";
228
+ id: string;
229
+ }> | undefined;
222
230
  metadata?: Readonly<{
223
231
  type: "parameter";
224
232
  id: string;
@@ -280,6 +288,14 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
280
288
  type: "ref";
281
289
  id: string;
282
290
  }> | undefined;
291
+ placeholderLabel?: string | Readonly<{
292
+ type: "parameter";
293
+ id: string;
294
+ name: string;
295
+ }> | Readonly<{
296
+ type: "ref";
297
+ id: string;
298
+ }> | undefined;
283
299
  metadata?: Readonly<{
284
300
  type: "parameter";
285
301
  id: string;
@@ -343,6 +359,14 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
343
359
  type: "ref";
344
360
  id: string;
345
361
  }> | undefined;
362
+ placeholderLabel?: string | Readonly<{
363
+ type: "parameter";
364
+ id: string;
365
+ name: string;
366
+ }> | Readonly<{
367
+ type: "ref";
368
+ id: string;
369
+ }> | undefined;
346
370
  metadata?: Readonly<{
347
371
  type: "parameter";
348
372
  id: string;
@@ -368,33 +392,95 @@ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
368
392
  kind: "option" | "component" | "collection";
369
393
  }>[]>;
370
394
  }, undefined>, undefined>;
395
+ readonly environment: v.PicklistSchema<["development", "staging", "production"], undefined>;
396
+ }, undefined>;
397
+ export type BuilderBuilderGetResponse = v.InferOutput<typeof BuilderBuilderGetResponseSchema>;
398
+ export declare const BuilderBuilderVariantsResponseSchema: v.ObjectSchema<{
399
+ readonly variants: v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
400
+ readonly instance: v.GenericSchema<import("../instance.js").BuilderInstance>;
401
+ readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
402
+ readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
403
+ readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
404
+ }, undefined>, v.ReadonlyAction<{
405
+ kind: "string" | "number" | "boolean" | "price" | "image";
406
+ value: string | number | boolean | null;
407
+ }>]>, undefined>, undefined>;
408
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
409
+ }, undefined>, v.ReadonlyAction<{
410
+ instance: import("../instance.js").BuilderInstance;
411
+ details?: {
412
+ readonly [x: string]: Readonly<{
413
+ kind: "string" | "number" | "boolean" | "price" | "image";
414
+ value: string | number | boolean | null;
415
+ }>;
416
+ } | undefined;
417
+ tags?: readonly string[] | undefined;
418
+ }>]>, undefined>, v.ReadonlyAction<Readonly<{
419
+ instance: import("../instance.js").BuilderInstance;
420
+ details?: {
421
+ readonly [x: string]: Readonly<{
422
+ kind: "string" | "number" | "boolean" | "price" | "image";
423
+ value: string | number | boolean | null;
424
+ }>;
425
+ } | undefined;
426
+ tags?: readonly string[] | undefined;
427
+ }>[]>]>, undefined>, v.ReadonlyAction<{
428
+ readonly [x: string]: readonly Readonly<{
429
+ instance: import("../instance.js").BuilderInstance;
430
+ details?: {
431
+ readonly [x: string]: Readonly<{
432
+ kind: "string" | "number" | "boolean" | "price" | "image";
433
+ value: string | number | boolean | null;
434
+ }>;
435
+ } | undefined;
436
+ tags?: readonly string[] | undefined;
437
+ }>[];
438
+ }>]>;
439
+ }, undefined>;
440
+ export type BuilderBuilderVariantsResponse = v.InferOutput<typeof BuilderBuilderVariantsResponseSchema>;
441
+ export declare const BuilderBuilderVariantsRequestSchema: v.ObjectSchema<{
371
442
  readonly variants: v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
372
443
  readonly instance: v.GenericSchema<import("../instance.js").BuilderInstance>;
373
- readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>, undefined>;
444
+ readonly details: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
445
+ readonly kind: v.PicklistSchema<["string", "boolean", "number", "price", "image"], undefined>;
446
+ readonly value: v.NullableSchema<v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
447
+ }, undefined>, v.ReadonlyAction<{
448
+ kind: "string" | "number" | "boolean" | "price" | "image";
449
+ value: string | number | boolean | null;
450
+ }>]>, undefined>, undefined>;
374
451
  readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
375
452
  }, undefined>, v.ReadonlyAction<{
376
453
  instance: import("../instance.js").BuilderInstance;
377
454
  details?: {
378
- [x: string]: string | number | boolean | null;
455
+ readonly [x: string]: Readonly<{
456
+ kind: "string" | "number" | "boolean" | "price" | "image";
457
+ value: string | number | boolean | null;
458
+ }>;
379
459
  } | undefined;
380
460
  tags?: readonly string[] | undefined;
381
461
  }>]>, undefined>, v.ReadonlyAction<Readonly<{
382
462
  instance: import("../instance.js").BuilderInstance;
383
463
  details?: {
384
- [x: string]: string | number | boolean | null;
464
+ readonly [x: string]: Readonly<{
465
+ kind: "string" | "number" | "boolean" | "price" | "image";
466
+ value: string | number | boolean | null;
467
+ }>;
385
468
  } | undefined;
386
469
  tags?: readonly string[] | undefined;
387
470
  }>[]>]>, undefined>, v.ReadonlyAction<{
388
471
  readonly [x: string]: readonly Readonly<{
389
472
  instance: import("../instance.js").BuilderInstance;
390
473
  details?: {
391
- [x: string]: string | number | boolean | null;
474
+ readonly [x: string]: Readonly<{
475
+ kind: "string" | "number" | "boolean" | "price" | "image";
476
+ value: string | number | boolean | null;
477
+ }>;
392
478
  } | undefined;
393
479
  tags?: readonly string[] | undefined;
394
480
  }>[];
395
481
  }>]>;
396
482
  }, undefined>;
397
- export type BuilderBuilderGetResponse = v.InferOutput<typeof BuilderBuilderGetResponseSchema>;
483
+ export type BuilderBuilderVariantsRequest = v.InferOutput<typeof BuilderBuilderVariantsRequestSchema>;
398
484
  export declare const BuilderBuilderPriceRequestSchema: v.ObjectSchema<{
399
485
  readonly instance: v.GenericSchema<import("../instance.js").BuilderInstance>;
400
486
  }, undefined>;
@@ -1,5 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  import { BuilderReferencesSchema, BuilderSerialisedSchema } from '../entities/index.js';
3
+ import { BuilderEnvironmentSchema } from '../environment.js';
3
4
  import { BuilderInstanceSchema, BuilderVariantsSchema } from '../instance.js';
4
5
  export const BuilderBuilderClientOptionsSchema = v.object({
5
6
  url: v.string(),
@@ -10,6 +11,12 @@ export const BuilderBuilderGetResponseSchema = v.object({
10
11
  name: v.string(),
11
12
  serialised: BuilderSerialisedSchema,
12
13
  references: BuilderReferencesSchema,
14
+ environment: BuilderEnvironmentSchema
15
+ });
16
+ export const BuilderBuilderVariantsResponseSchema = v.object({
17
+ variants: BuilderVariantsSchema
18
+ });
19
+ export const BuilderBuilderVariantsRequestSchema = v.object({
13
20
  variants: BuilderVariantsSchema
14
21
  });
15
22
  export const BuilderBuilderPriceRequestSchema = v.object({
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderBuilderUpdate } from './BuilderRender.svelte';
3
+ import type { BuilderConfig } from './config.js';
4
+ export type BuilderBuilderProps = {
5
+ readonly builderId: string;
6
+ readonly url: string;
7
+ readonly apiKey: string;
8
+ readonly config?: BuilderConfig;
9
+ };
10
+ export type BuilderBuilderUpdateEvent = CustomEvent<BuilderBuilderUpdate>;
11
+ import './BuilderRender.svelte';
12
+ declare const __propDef: {
13
+ props: Record<string, never>;
14
+ events: {
15
+ [evt: string]: CustomEvent<any>;
16
+ };
17
+ slots: {};
18
+ };
19
+ export type BuilderProps = typeof __propDef.props;
20
+ export type BuilderEvents = typeof __propDef.events;
21
+ export type BuilderSlots = typeof __propDef.slots;
22
+ export default class Builder extends SvelteComponentTyped<BuilderProps, BuilderEvents, BuilderSlots> {
23
+ }
24
+ export {};
@@ -0,0 +1,22 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderRenderCollection } from '../index.js';
3
+ export type BuilderBuilderCollectionButtonsProps = {
4
+ readonly collection: BuilderRenderCollection;
5
+ readonly add?: string;
6
+ readonly remove?: string;
7
+ };
8
+ export type BuilderBuilderCollectionButtonsAddEvent = CustomEvent<null>;
9
+ export type BuilderBuilderCollectionButtonsRemoveEvent = CustomEvent<null>;
10
+ declare const __propDef: {
11
+ props: Record<string, never>;
12
+ events: {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {};
16
+ };
17
+ export type BuilderCollectionButtonsProps = typeof __propDef.props;
18
+ export type BuilderCollectionButtonsEvents = typeof __propDef.events;
19
+ export type BuilderCollectionButtonsSlots = typeof __propDef.slots;
20
+ export default class BuilderCollectionButtons extends SvelteComponentTyped<BuilderCollectionButtonsProps, BuilderCollectionButtonsEvents, BuilderCollectionButtonsSlots> {
21
+ }
22
+ export {};
@@ -0,0 +1,23 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderInstance, BuilderRenderPages } from '../index.js';
3
+ import type { BuilderBuilderCollectionButtonsProps } from './BuilderCollectionButtons.svelte';
4
+ export type BuilderBuilderCollectionsProps = {
5
+ readonly layout: BuilderRenderPages;
6
+ readonly instance: BuilderInstance;
7
+ readonly buttons?: Partial<BuilderBuilderCollectionButtonsProps>;
8
+ };
9
+ export type BuilderBuilderCollectionsUpdateEvent = CustomEvent<BuilderInstance>;
10
+ import './BuilderCollectionButtons.svelte';
11
+ declare const __propDef: {
12
+ props: Record<string, never>;
13
+ events: {
14
+ [evt: string]: CustomEvent<any>;
15
+ };
16
+ slots: {};
17
+ };
18
+ export type BuilderCollectionsProps = typeof __propDef.props;
19
+ export type BuilderCollectionsEvents = typeof __propDef.events;
20
+ export type BuilderCollectionsSlots = typeof __propDef.slots;
21
+ export default class BuilderCollections extends SvelteComponentTyped<BuilderCollectionsProps, BuilderCollectionsEvents, BuilderCollectionsSlots> {
22
+ }
23
+ export {};
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderDescription } from '../index.js';
3
+ export type BuilderBuilderDescriptionProps = {
4
+ readonly description: BuilderDescription;
5
+ };
6
+ declare const __propDef: {
7
+ props: Record<string, never>;
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type BuilderDescriptionProps = typeof __propDef.props;
14
+ export type BuilderDescriptionEvents = typeof __propDef.events;
15
+ export type BuilderDescriptionSlots = typeof __propDef.slots;
16
+ export default class BuilderDescription extends SvelteComponentTyped<BuilderDescriptionProps, BuilderDescriptionEvents, BuilderDescriptionSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderInstance, BuilderRenderPages } from '../index.js';
3
+ import type { BuilderBuilderOptionProps } from './BuilderOption.svelte';
4
+ export type BuilderBuilderLayoutProps = {
5
+ readonly layout: BuilderRenderPages;
6
+ readonly instance: BuilderInstance;
7
+ readonly headingLevel?: number;
8
+ readonly options?: Partial<BuilderBuilderOptionProps>;
9
+ };
10
+ export type BuilderBuilderLayoutUpdateEvent = CustomEvent<BuilderInstance>;
11
+ import './BuilderOption.svelte';
12
+ declare const __propDef: {
13
+ props: Record<string, never>;
14
+ events: {
15
+ [evt: string]: CustomEvent<any>;
16
+ };
17
+ slots: {};
18
+ };
19
+ export type BuilderLayoutProps = typeof __propDef.props;
20
+ export type BuilderLayoutEvents = typeof __propDef.events;
21
+ export type BuilderLayoutSlots = typeof __propDef.slots;
22
+ export default class BuilderLayout extends SvelteComponentTyped<BuilderLayoutProps, BuilderLayoutEvents, BuilderLayoutSlots> {
23
+ }
24
+ export {};
@@ -0,0 +1,31 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderPrimitive, BuilderRenderOption } from '../index.js';
3
+ import type { BuilderBuilderOptionSelectProps } from './BuilderOptionSelect.svelte';
4
+ import type { BuilderBuilderOptionToggleBooleanProps } from './BuilderOptionToggleBoolean.svelte';
5
+ import type { BuilderBuilderOptionToggleNumberProps } from './BuilderOptionToggleNumber.svelte';
6
+ import type { BuilderBuilderOptionToggleStringProps } from './BuilderOptionToggleString.svelte';
7
+ export type BuilderBuilderOptionProps = {
8
+ readonly option: BuilderRenderOption;
9
+ readonly select?: Partial<BuilderBuilderOptionSelectProps>;
10
+ readonly toggleBoolean?: Partial<BuilderBuilderOptionToggleBooleanProps>;
11
+ readonly toggleNumber?: Partial<BuilderBuilderOptionToggleNumberProps>;
12
+ readonly toggleString?: Partial<BuilderBuilderOptionToggleStringProps>;
13
+ };
14
+ export type BuilderBuilderOptionUpdateEvent = CustomEvent<BuilderPrimitive>;
15
+ import './BuilderOptionSelect.svelte';
16
+ import './BuilderOptionToggleBoolean.svelte';
17
+ import './BuilderOptionToggleNumber.svelte';
18
+ import './BuilderOptionToggleString.svelte';
19
+ declare const __propDef: {
20
+ props: Record<string, never>;
21
+ events: {
22
+ [evt: string]: CustomEvent<any>;
23
+ };
24
+ slots: {};
25
+ };
26
+ export type BuilderOptionProps = typeof __propDef.props;
27
+ export type BuilderOptionEvents = typeof __propDef.events;
28
+ export type BuilderOptionSlots = typeof __propDef.slots;
29
+ export default class BuilderOption extends SvelteComponentTyped<BuilderOptionProps, BuilderOptionEvents, BuilderOptionSlots> {
30
+ }
31
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderRenderOption } from '../index.js';
3
+ export type BuilderBuilderOptionSelectProps = {
4
+ readonly option: BuilderRenderOption;
5
+ readonly placeholder?: string;
6
+ readonly id?: string;
7
+ };
8
+ export type BuilderBuilderOptionSelectUpdateEvent = CustomEvent<string | null>;
9
+ declare const __propDef: {
10
+ props: Record<string, never>;
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BuilderOptionSelectProps = typeof __propDef.props;
17
+ export type BuilderOptionSelectEvents = typeof __propDef.events;
18
+ export type BuilderOptionSelectSlots = typeof __propDef.slots;
19
+ export default class BuilderOptionSelect extends SvelteComponentTyped<BuilderOptionSelectProps, BuilderOptionSelectEvents, BuilderOptionSelectSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,20 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderRenderOption } from '../index.js';
3
+ export type BuilderBuilderOptionToggleBooleanProps = {
4
+ readonly option: BuilderRenderOption;
5
+ readonly id?: string;
6
+ };
7
+ export type BuilderBuilderOptionToggleBooleanUpdateEvent = CustomEvent<boolean>;
8
+ declare const __propDef: {
9
+ props: Record<string, never>;
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export type BuilderOptionToggleBooleanProps = typeof __propDef.props;
16
+ export type BuilderOptionToggleBooleanEvents = typeof __propDef.events;
17
+ export type BuilderOptionToggleBooleanSlots = typeof __propDef.slots;
18
+ export default class BuilderOptionToggleBoolean extends SvelteComponentTyped<BuilderOptionToggleBooleanProps, BuilderOptionToggleBooleanEvents, BuilderOptionToggleBooleanSlots> {
19
+ }
20
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderRenderOption } from '../index.js';
3
+ export type BuilderBuilderOptionToggleNumberProps = {
4
+ readonly option: BuilderRenderOption;
5
+ readonly placeholder?: string;
6
+ readonly id?: string;
7
+ };
8
+ export type BuilderBuilderOptionToggleNumberUpdateEvent = CustomEvent<number>;
9
+ declare const __propDef: {
10
+ props: Record<string, never>;
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BuilderOptionToggleNumberProps = typeof __propDef.props;
17
+ export type BuilderOptionToggleNumberEvents = typeof __propDef.events;
18
+ export type BuilderOptionToggleNumberSlots = typeof __propDef.slots;
19
+ export default class BuilderOptionToggleNumber extends SvelteComponentTyped<BuilderOptionToggleNumberProps, BuilderOptionToggleNumberEvents, BuilderOptionToggleNumberSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderRenderOption } from '../index.js';
3
+ export type BuilderBuilderOptionToggleStringProps = {
4
+ readonly option: BuilderRenderOption;
5
+ readonly placeholder?: string;
6
+ readonly id?: string;
7
+ };
8
+ export type BuilderBuilderOptionToggleStringUpdateEvent = CustomEvent<string>;
9
+ declare const __propDef: {
10
+ props: Record<string, never>;
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BuilderOptionToggleStringProps = typeof __propDef.props;
17
+ export type BuilderOptionToggleStringEvents = typeof __propDef.events;
18
+ export type BuilderOptionToggleStringSlots = typeof __propDef.slots;
19
+ export default class BuilderOptionToggleString extends SvelteComponentTyped<BuilderOptionToggleStringProps, BuilderOptionToggleStringEvents, BuilderOptionToggleStringSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ export type BuilderBuilderPriceProps = {
3
+ readonly price: number | null;
4
+ readonly empty?: string;
5
+ readonly locale?: string;
6
+ readonly currency?: string;
7
+ readonly rate?: number;
8
+ };
9
+ declare const __propDef: {
10
+ props: Record<string, never>;
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BuilderPriceProps = typeof __propDef.props;
17
+ export type BuilderPriceEvents = typeof __propDef.events;
18
+ export type BuilderPriceSlots = typeof __propDef.slots;
19
+ export default class BuilderPrice extends SvelteComponentTyped<BuilderPriceProps, BuilderPriceEvents, BuilderPriceSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,39 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { BuilderEnvironment, BuilderInstance, BuilderOrder, BuilderReferences, BuilderSerialised, BuilderVariants } from '../index.js';
3
+ import type { BuilderBuilderCollectionsProps } from './BuilderCollections.svelte';
4
+ import type { BuilderBuilderDescriptionProps } from './BuilderDescription.svelte';
5
+ import type { BuilderBuilderLayoutProps } from './BuilderLayout.svelte';
6
+ import type { BuilderBuilderPriceProps } from './BuilderPrice.svelte';
7
+ export type BuilderBuilderRenderProps = {
8
+ readonly serialised: BuilderSerialised;
9
+ readonly references: BuilderReferences;
10
+ readonly variants: BuilderVariants | Promise<BuilderVariants> | null;
11
+ readonly environment: BuilderEnvironment;
12
+ readonly layout?: Partial<BuilderBuilderLayoutProps>;
13
+ readonly collections?: Partial<BuilderBuilderCollectionsProps>;
14
+ readonly description?: Partial<BuilderBuilderDescriptionProps>;
15
+ readonly price?: Partial<BuilderBuilderPriceProps>;
16
+ };
17
+ export type BuilderBuilderUpdate = {
18
+ readonly instance: BuilderInstance;
19
+ readonly order: BuilderOrder | null;
20
+ readonly price: number | null;
21
+ };
22
+ export type BuilderBuilderRenderUpdateEvent = CustomEvent<BuilderBuilderUpdate>;
23
+ import './BuilderCollections.svelte';
24
+ import './BuilderDescription.svelte';
25
+ import './BuilderLayout.svelte';
26
+ import './BuilderPrice.svelte';
27
+ declare const __propDef: {
28
+ props: Record<string, never>;
29
+ events: {
30
+ [evt: string]: CustomEvent<any>;
31
+ };
32
+ slots: {};
33
+ };
34
+ export type BuilderRenderProps = typeof __propDef.props;
35
+ export type BuilderRenderEvents = typeof __propDef.events;
36
+ export type BuilderRenderSlots = typeof __propDef.slots;
37
+ export default class BuilderRender extends SvelteComponentTyped<BuilderRenderProps, BuilderRenderEvents, BuilderRenderSlots> {
38
+ }
39
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { BuilderBuilderRenderProps } from './BuilderRender.svelte';
2
+ export type BuilderConfig = Omit<BuilderBuilderRenderProps, 'serialised' | 'references' | 'variants' | 'environment'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function dispatch(host: HTMLElement, name: string, detail?: unknown, options?: EventInit): void;
@@ -0,0 +1,3 @@
1
+ export function dispatch(host, name, detail, options) {
2
+ host.dispatchEvent(new CustomEvent(name, { bubbles: true, ...options, detail }));
3
+ }
@@ -0,0 +1 @@
1
+ export declare function toId(prefix: string): string;
@@ -0,0 +1,3 @@
1
+ export function toId(prefix) {
2
+ return `${prefix}-${crypto.randomUUID()}`;
3
+ }