@drawbridge/components 0.1.24 → 0.1.25

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.
@@ -48,15 +48,16 @@ const FormOrganizationCampaignIntegrationGtm = ({
48
48
  }) => {
49
49
  const { control, handleSubmit, formState } = (0, import_form.useForm)({
50
50
  defaultValues: values,
51
+ // @story integrations/gtm
52
+ // The container is needed only to run: off saves with it blank. On,
53
+ // or with anything typed, every rule applies. The api checks the same.
51
54
  resolver: (0, import_yup.resolver)(
52
- import_yup.default.object({
55
+ import_yup.default.lazy(({ enabled, settings }) => import_yup.default.object({
53
56
  enabled: import_yup.default.boolean(),
54
- // Container ID is required whether or not the integration is
55
- // enabled — a disabled-and-empty GTM integration is just noise.
56
57
  settings: import_yup.default.object({
57
- containerId: import_yup.default.string().label("Container ID").required().min(10).max(20).matches(/^\S*$/, "Container ID must not contain spaces").prefix("GTM", 3)
58
+ containerId: !enabled && !(settings == null ? void 0 : settings.containerId) ? import_yup.default.string().label("Container ID") : import_yup.default.string().label("Container ID").required().min(10).max(20).matches(/^\S*$/, "Container ID must not contain spaces").prefix("GTM", 3)
58
59
  })
59
- })
60
+ }))
60
61
  )
61
62
  });
62
63
  const onSubmit = async ({
@@ -16,15 +16,16 @@ const FormOrganizationCampaignIntegrationGtm = ({
16
16
  }) => {
17
17
  const { control, handleSubmit, formState } = useForm({
18
18
  defaultValues: values,
19
+ // @story integrations/gtm
20
+ // The container is needed only to run: off saves with it blank. On,
21
+ // or with anything typed, every rule applies. The api checks the same.
19
22
  resolver: resolver(
20
- yup.object({
23
+ yup.lazy(({ enabled, settings }) => yup.object({
21
24
  enabled: yup.boolean(),
22
- // Container ID is required whether or not the integration is
23
- // enabled — a disabled-and-empty GTM integration is just noise.
24
25
  settings: yup.object({
25
- containerId: yup.string().label("Container ID").required().min(10).max(20).matches(/^\S*$/, "Container ID must not contain spaces").prefix("GTM", 3)
26
+ containerId: !enabled && !(settings == null ? void 0 : settings.containerId) ? yup.string().label("Container ID") : yup.string().label("Container ID").required().min(10).max(20).matches(/^\S*$/, "Container ID must not contain spaces").prefix("GTM", 3)
26
27
  })
27
- })
28
+ }))
28
29
  )
29
30
  });
30
31
  const onSubmit = async ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",