@haus-tech/badge-plugin 4.0.6-0 → 4.0.7

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 4.0.6
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - handle update asset ([33e1c58](https://github.com/WeAreHausTech/haus-tech-vendure-plugins/commit/33e1c58))
6
+
7
+ ## 4.0.6-0
8
+
9
+ ### 🚀 Features
10
+
11
+ - **badge-plugin:** add dashboard integration and enhance badge management ([2603563](https://github.com/WeAreHausTech/haus-tech-vendure-plugins/commit/2603563))
12
+
1
13
  ## 4.0.5
2
14
 
3
15
  This was a version bump only for badge-plugin to align it with other projects, there were no code changes.
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
  name: badge-plugin
3
3
  title: Badge Plugin
4
4
  description: Vendure plugin that allows you to manage and display badges for products in your e-commerce store.
5
- version: 4.0.3
5
+ version: 4.0.6
6
+ tags: [vendure, plugin, badge]
6
7
  ---
7
8
 
8
9
  # Badge Plugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/badge-plugin",
3
- "version": "4.0.6-0",
3
+ "version": "4.0.7",
4
4
  "description": "Adds a badge to product images",
5
5
  "author": "Haus Tech",
6
6
  "repository": "https://github.com/WeAreHausTech/haus-tech-vendure-plugins",
@@ -45,6 +45,7 @@ exports.adminApiExtensions = (0, graphql_tag_1.gql) `
45
45
  id: ID!
46
46
  collectionId: ID
47
47
  position: String
48
+ assetId: ID
48
49
  }
49
50
 
50
51
  extend type Mutation {
@@ -1 +1 @@
1
- {"version":3,"file":"api-extensions.js","sourceRoot":"","sources":["../../../../../packages/badge-plugin/src/api/api-extensions.ts"],"names":[],"mappings":";;;AAAA,6CAAiC;AAEpB,QAAA,kBAAkB,GAAG,IAAA,iBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDpC,CAAA;AAEY,QAAA,iBAAiB,GAAG,IAAA,iBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CnC,CAAA"}
1
+ {"version":3,"file":"api-extensions.js","sourceRoot":"","sources":["../../../../../packages/badge-plugin/src/api/api-extensions.ts"],"names":[],"mappings":";;;AAAA,6CAAiC;AAEpB,QAAA,kBAAkB,GAAG,IAAA,iBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDpC,CAAA;AAEY,QAAA,iBAAiB,GAAG,IAAA,iBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CnC,CAAA"}
@@ -5,7 +5,7 @@ import {
5
5
  Page,
6
6
  PageTitle,
7
7
  PageActionBar,
8
- PageActionBarRight,
8
+ ActionBarItem,
9
9
  PageLayout,
10
10
  PageBlock,
11
11
  FormFieldWrapper,
@@ -23,8 +23,9 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
23
23
  import { useCallback, useState, useRef, useEffect } from 'react'
24
24
  import { toast } from 'sonner'
25
25
  import { api } from '@vendure/dashboard'
26
- import { graphql } from '@/gql'
26
+ import { graphql } from './gql'
27
27
  import { UploadIcon } from 'lucide-react'
28
+ import type { ComponentProps } from 'react'
28
29
 
29
30
  const getBadgeDetailDocument = graphql(`
30
31
  query GetBadgeDetail($id: ID!) {
@@ -116,7 +117,7 @@ export const badgeDetailRoute: DashboardRouteDefinition = {
116
117
  ],
117
118
  }),
118
119
  component: (route) => {
119
- return <BadgeDetailPage route={route as any} />
120
+ return <BadgeDetailPage route={route as AnyRoute} />
120
121
  },
121
122
  }
122
123
 
@@ -130,6 +131,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
130
131
  id: string
131
132
  name: string
132
133
  preview: string
134
+ source: string
133
135
  } | null>(null)
134
136
  const [uploading, setUploading] = useState(false)
135
137
 
@@ -151,16 +153,16 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
151
153
  (
152
154
  badge:
153
155
  | {
156
+ id: string
157
+ position: string
158
+ collectionId: string | null
159
+ assetId: string
160
+ asset: {
154
161
  id: string
155
- position: string
156
- collectionId: string | null
157
- assetId: string
158
- asset: {
159
- id: string
160
- name: string
161
- preview: string
162
- }
162
+ name: string
163
+ preview: string
163
164
  }
165
+ }
164
166
  | null
165
167
  | undefined,
166
168
  ) => {
@@ -175,6 +177,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
175
177
  id: badge?.id ?? '',
176
178
  position: position || 'top-left',
177
179
  collectionId: badge?.collectionId ?? null,
180
+ assetId: badge?.assetId ?? '',
178
181
  }
179
182
  },
180
183
  [availablePositions],
@@ -206,7 +209,9 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
206
209
  const createAssetMutation = useMutation({
207
210
  mutationFn: async (file: File) => {
208
211
  const input = [{ file }]
209
- const result: any = await api.mutate(createAssetsDocument, { input })
212
+ const result = await api.mutate(createAssetsDocument, { input }) as {
213
+ createAssets: Array<{ id?: string; name?: string; source?: string; preview?: string; message?: string }>
214
+ }
210
215
  const assetResult = result.createAssets[0]
211
216
  if ('id' in assetResult) {
212
217
  return assetResult
@@ -220,7 +225,9 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
220
225
  id: asset.id,
221
226
  name: asset.name || 'Uploaded image',
222
227
  preview: asset.preview || '',
228
+ source: asset.source || asset.preview || '',
223
229
  })
230
+ form.setValue('assetId', asset.id, { shouldDirty: true, shouldValidate: true })
224
231
  setUploading(false)
225
232
  toast.success('Image uploaded successfully')
226
233
  },
@@ -246,6 +253,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
246
253
  id: entity.asset.id,
247
254
  name: entity.asset.name,
248
255
  preview: entity.asset.preview,
256
+ source: entity.asset.source,
249
257
  })
250
258
  }
251
259
  }
@@ -271,6 +279,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
271
279
 
272
280
  // Always sync collection - set it immediately
273
281
  form.setValue('collectionId', entityCollectionId ?? null, { shouldDirty: false })
282
+ form.setValue('assetId', badge.assetId ?? '', { shouldDirty: false })
274
283
  }
275
284
 
276
285
  // Initialize default values for new badges
@@ -317,7 +326,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
317
326
  toast.success('Badge created successfully')
318
327
  await navigate({ to: `/badges/${result.createBadge.id}` })
319
328
  queryClient.invalidateQueries({ queryKey: ['badges'] })
320
- } catch (error: any) {
329
+ } catch (error: unknown) {
321
330
  toast.error('Failed to create badge', {
322
331
  description: error instanceof Error ? error.message : 'Unknown error',
323
332
  })
@@ -332,11 +341,21 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
332
341
  uploadedAsset ||
333
342
  (entity?.asset
334
343
  ? {
335
- id: entity.asset.id,
336
- name: entity.asset.name,
337
- preview: entity.asset.preview,
338
- }
344
+ id: entity.asset.id,
345
+ name: entity.asset.name,
346
+ preview: entity.asset.preview,
347
+ source: entity.asset.source,
348
+ }
339
349
  : null)
350
+ const currentAssetForPreview =
351
+ currentAsset == null
352
+ ? null
353
+ : (entity?.asset && currentAsset.id === entity.asset.id
354
+ ? entity.asset
355
+ : { ...currentAsset, type: 'IMAGE' }) as ComponentProps<typeof VendureImage>['asset']
356
+ const hasAssetChanged = Boolean(
357
+ !creatingNewEntity && uploadedAsset?.id && uploadedAsset.id !== entity?.assetId,
358
+ )
340
359
 
341
360
  return (
342
361
  <Page pageId="badge-detail" form={form} submitHandler={handleSubmit}>
@@ -344,18 +363,18 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
344
363
  {creatingNewEntity ? 'New Badge' : entity?.id ? `Badge ${entity.id}` : 'Edit Badge'}
345
364
  </PageTitle>
346
365
  <PageActionBar>
347
- <PageActionBarRight>
366
+ <ActionBarItem itemId="save-button">
348
367
  <Button
349
368
  type="submit"
350
369
  disabled={
351
370
  creatingNewEntity
352
371
  ? !uploadedAsset || !form.formState.isValid || isPending || uploading
353
- : !form.formState.isDirty || !form.formState.isValid || isPending
372
+ : (!form.formState.isDirty && !hasAssetChanged) || isPending || uploading
354
373
  }
355
374
  >
356
375
  {isPending || uploading ? 'Saving...' : creatingNewEntity ? 'Create' : 'Update'}
357
376
  </Button>
358
- </PageActionBarRight>
377
+ </ActionBarItem>
359
378
  </PageActionBar>
360
379
  <PageLayout>
361
380
  <PageBlock column="main" blockId="main-form">
@@ -365,11 +384,7 @@ function BadgeDetailPage({ route }: { route: AnyRoute }) {
365
384
  <div className="space-y-4">
366
385
  {currentAsset ? (
367
386
  <div className="space-y-2">
368
- <VendureImage
369
- asset={entity?.asset || ({ ...currentAsset, type: 'IMAGE' } as any)}
370
- alt={currentAsset.name}
371
- preset="medium"
372
- />
387
+ <VendureImage asset={currentAssetForPreview} alt={currentAsset.name} preset="full" />
373
388
  <div className="text-sm text-muted-foreground">{currentAsset.name}</div>
374
389
  </div>
375
390
  ) : (
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  DashboardRouteDefinition,
3
3
  ListPage,
4
- PageActionBarRight,
4
+ ActionBarItem,
5
5
  Button,
6
6
  VendureImage,
7
7
  Badge as BadgeComponent,
8
8
  } from '@vendure/dashboard'
9
9
  import { PencilIcon, PlusIcon } from 'lucide-react'
10
10
  import { Link } from '@tanstack/react-router'
11
- import { graphql } from '@/gql'
11
+ import { graphql } from './gql'
12
12
 
13
13
  const getBadgeListDocument = graphql(`
14
14
  query GetBadges($options: BadgeListOptions) {
@@ -128,14 +128,12 @@ export const badgeListRoute: DashboardRouteDefinition = {
128
128
  }}
129
129
  defaultColumnOrder={['asset', 'position', 'collection', 'updatedAt']}
130
130
  >
131
- <PageActionBarRight>
132
- <Button asChild>
133
- <Link to="./new">
134
- <PlusIcon className="mr-2 h-4 w-4" />
135
- New Badge
136
- </Link>
131
+ <ActionBarItem itemId="create-button">
132
+ <Button render={<Link to="./new" />}>
133
+ <PlusIcon />
134
+ New Badge
137
135
  </Button>
138
- </PageActionBarRight>
136
+ </ActionBarItem>
139
137
  </ListPage>
140
138
  )
141
139
  },
@@ -0,0 +1,146 @@
1
+ import gql from 'graphql-tag'
2
+ import type { TypedDocumentNode } from '@graphql-typed-document-node/core'
3
+
4
+ type AnyDoc = TypedDocumentNode<any, any>
5
+
6
+ const getBadgesDocument = gql(`
7
+ query GetBadges($options: BadgeListOptions) {
8
+ badges(options: $options) {
9
+ items {
10
+ id
11
+ createdAt
12
+ updatedAt
13
+ collection {
14
+ id
15
+ name
16
+ }
17
+ collectionId
18
+ position
19
+ asset {
20
+ id
21
+ name
22
+ type
23
+ mimeType
24
+ width
25
+ height
26
+ fileSize
27
+ source
28
+ preview
29
+ }
30
+ }
31
+ totalItems
32
+ }
33
+ }
34
+ `) as AnyDoc
35
+
36
+ const deleteBadgeDocument = gql(`
37
+ mutation DeleteBadge($id: ID!) {
38
+ deleteBadge(ids: [$id]) {
39
+ result
40
+ message
41
+ }
42
+ }
43
+ `) as AnyDoc
44
+
45
+ const getBadgeDetailDocument = gql(`
46
+ query GetBadgeDetail($id: ID!) {
47
+ badge(id: $id) {
48
+ id
49
+ createdAt
50
+ updatedAt
51
+ collection {
52
+ id
53
+ name
54
+ }
55
+ collectionId
56
+ position
57
+ assetId
58
+ asset {
59
+ id
60
+ name
61
+ type
62
+ mimeType
63
+ width
64
+ height
65
+ fileSize
66
+ source
67
+ preview
68
+ }
69
+ }
70
+ }
71
+ `) as AnyDoc
72
+
73
+ const createBadgeDocument = gql(`
74
+ mutation CreateBadge($input: CreateBadgeInput!) {
75
+ createBadge(input: $input) {
76
+ id
77
+ }
78
+ }
79
+ `) as AnyDoc
80
+
81
+ const updateBadgeDocument = gql(`
82
+ mutation UpdateBadge($input: UpdateBadgeInput!) {
83
+ updateBadge(input: $input) {
84
+ id
85
+ }
86
+ }
87
+ `) as AnyDoc
88
+
89
+ const getBadgePluginConfigDocument = gql(`
90
+ query GetBadgePluginConfig {
91
+ getBadgePluginConfig {
92
+ availablePositions
93
+ }
94
+ }
95
+ `) as AnyDoc
96
+
97
+ const getCollectionsDocument = gql(`
98
+ query GetCollections {
99
+ collections {
100
+ items {
101
+ id
102
+ name
103
+ slug
104
+ }
105
+ }
106
+ }
107
+ `) as AnyDoc
108
+
109
+ const createAssetsDocument = gql(`
110
+ mutation CreateAssets($input: [CreateAssetInput!]!) {
111
+ createAssets(input: $input) {
112
+ ... on Asset {
113
+ id
114
+ name
115
+ source
116
+ preview
117
+ }
118
+ ... on MimeTypeError {
119
+ message
120
+ }
121
+ }
122
+ }
123
+ `) as AnyDoc
124
+
125
+ function normalize(source: string): string {
126
+ return source.replace(/\s+/g, ' ').trim()
127
+ }
128
+
129
+ const documents = new Map<string, AnyDoc>([
130
+ [normalize(getBadgesDocument.loc?.source.body ?? ''), getBadgesDocument],
131
+ [normalize(deleteBadgeDocument.loc?.source.body ?? ''), deleteBadgeDocument],
132
+ [normalize(getBadgeDetailDocument.loc?.source.body ?? ''), getBadgeDetailDocument],
133
+ [normalize(createBadgeDocument.loc?.source.body ?? ''), createBadgeDocument],
134
+ [normalize(updateBadgeDocument.loc?.source.body ?? ''), updateBadgeDocument],
135
+ [normalize(getBadgePluginConfigDocument.loc?.source.body ?? ''), getBadgePluginConfigDocument],
136
+ [normalize(getCollectionsDocument.loc?.source.body ?? ''), getCollectionsDocument],
137
+ [normalize(createAssetsDocument.loc?.source.body ?? ''), createAssetsDocument],
138
+ ])
139
+
140
+ export function graphql(source: string): AnyDoc {
141
+ const document = documents.get(normalize(source))
142
+ if (!document) {
143
+ throw new Error('Unknown dashboard GraphQL operation in badge-plugin')
144
+ }
145
+ return document
146
+ }
@@ -5582,6 +5582,7 @@ export type UpdateAssetInput = {
5582
5582
  tags?: InputMaybe<Array<Scalars['String']['input']>>;
5583
5583
  };
5584
5584
  export type UpdateBadgeInput = {
5585
+ assetId?: InputMaybe<Scalars['ID']['input']>;
5585
5586
  collectionId?: InputMaybe<Scalars['ID']['input']>;
5586
5587
  id: Scalars['ID']['input'];
5587
5588
  position?: InputMaybe<Scalars['String']['input']>;
@@ -91,6 +91,7 @@ let BadgeService = class BadgeService {
91
91
  await this.connection.getRepository(ctx, badge_entity_1.Badge).update(input.id, {
92
92
  position: input.position,
93
93
  collectionId: input.collectionId,
94
+ assetId: input.assetId ?? badge.assetId,
94
95
  });
95
96
  badge = await this.connection
96
97
  .getRepository(ctx, badge_entity_1.Badge)
@@ -1 +1 @@
1
- {"version":3,"file":"badge.service.js","sourceRoot":"","sources":["../../../../../packages/badge-plugin/src/service/badge.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,qCAA4B;AAC5B,wCAYsB;AACtB,yDAA8C;AAC9C,gDAKyB;AAKlB,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEb;IACA;IACA;IACA;IACA;IACA;IANV,YACU,gBAAkC,EAClC,UAAmC,EACnC,YAA0B,EAC1B,qBAAqC,EACrC,iBAAoC,EACpC,cAA8B;QAL9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,0BAAqB,GAArB,qBAAqB,CAAgB;QACrC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,mBAAc,GAAd,cAAc,CAAgB;IACrC,CAAC;IAEJ,KAAK,CAAC,sBAAsB;QAC1B,iFAAiF;QACjF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAA;QACpE,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa;aAC9D,aAAa,CAAC,oBAAK,CAAC;aACpB,kBAAkB,CAAC,OAAO,CAAC;aAC3B,iBAAiB,CAAC,gBAAgB,EAAE,SAAS,CAAC;aAC9C,KAAK,CAAC,oBAAoB,CAAC;aAC3B,OAAO,EAAE,CAAA;QAEZ,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAA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AC,QAAQ,EACd,GAAG,CAAC,SAAS,EACb,EAAE,CACH,CAAA;QACD,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,EAAE,oBAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;QACrF,CAAC,CAAC,CACH,CAAA;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,kBAAkB,CACvC,GAAG,EACH,oBAAK,EACL,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACvB,GAAG,CAAC,SAAS,EACb,EAAE,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA5JY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAGiB,uBAAgB;QACtB,8BAAuB;QACrB,mBAAY;QACH,qBAAc;QAClB,wBAAiB;QACpB,qBAAc;GAP7B,YAAY,CA4JxB"}
1
+ {"version":3,"file":"badge.service.js","sourceRoot":"","sources":["../../../../../packages/badge-plugin/src/service/badge.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,qCAA4B;AAC5B,wCAYsB;AACtB,yDAA8C;AAC9C,gDAKyB;AAKlB,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEb;IACA;IACA;IACA;IACA;IACA;IANV,YACU,gBAAkC,EAClC,UAAmC,EACnC,YAA0B,EAC1B,qBAAqC,EACrC,iBAAoC,EACpC,cAA8B;QAL9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,0BAAqB,GAArB,qBAAqB,CAAgB;QACrC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,mBAAc,GAAd,cAAc,CAA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2
  import { OnInit, OnChanges, SimpleChanges } from '@angular/core';
3
3
  import { Badge } from './gql/graphql';
4
4
  import { Asset } from '@vendure/core';
5
- declare const getBadgeListDocument: import("apollo-angular").TypedDocumentNode<import("./gql/graphql").GetBadgesQuery, import("./gql/graphql").Exact<{
5
+ declare const getBadgeListDocument: import("@graphql-typed-document-node/core").TypedDocumentNode<import("./gql/graphql").GetBadgesQuery, import("./gql/graphql").Exact<{
6
6
  options?: import("./gql/graphql").InputMaybe<import("./gql/graphql").BadgeListOptions>;
7
7
  }>>;
8
8
  export interface BadgePluginOptions {
@@ -27,7 +27,7 @@
27
27
  [disabled]="true"
28
28
  [hiddenWhenOff]="true"
29
29
  ></vdr-select-toggle>
30
- <img class="asset-thumb" [src]="item.asset | assetPreview : 'medium'" />
30
+ <img class="asset-thumb" [src]="item.asset | assetPreview: 'medium'" />
31
31
  </div>
32
32
  <div class="detail">
33
33
  <span [title]="item.position">{{ item.position }}</span>
@@ -67,7 +67,7 @@
67
67
  <div class="card stack" [class.visible]="selectionManager.selection.length > 1"></div>
68
68
  <div class="selection-count" [class.visible]="selectionManager.selection.length > 1">
69
69
  {{
70
- 'asset.assets-selected-count' | translate : { count: selectionManager.selection.length }
70
+ 'asset.assets-selected-count' | translate: { count: selectionManager.selection.length }
71
71
  }}
72
72
  <ul>
73
73
  <li *ngFor="let asset of selectionManager.selection">{{ asset.name }}</li>
@@ -86,14 +86,18 @@ vdr-select-toggle {
86
86
  opacity: 0;
87
87
  transform: perspective(500px) translateZ(0px) translateY(-16px);
88
88
  height: 16px;
89
- transition: transform 0.3s, opacity 0s 0.3s;
89
+ transition:
90
+ transform 0.3s,
91
+ opacity 0s 0.3s;
90
92
  background-color: white;
91
93
 
92
94
  &.visible {
93
95
  opacity: 1;
94
96
  transform: perspective(500px) translateZ(-44px) translateY(0px);
95
97
  background-color: var(--color-component-bg-100);
96
- transition: transform 0.3s, color 0.3s;
98
+ transition:
99
+ transform 0.3s,
100
+ color 0.3s;
97
101
  }
98
102
  }
99
103
 
@@ -102,11 +106,15 @@ vdr-select-toggle {
102
106
  position: relative;
103
107
  text-align: center;
104
108
  visibility: hidden;
105
- transition: opacity 0.3s, visibility 0s 0.3s;
109
+ transition:
110
+ opacity 0.3s,
111
+ visibility 0s 0.3s;
106
112
  &.visible {
107
113
  opacity: 1;
108
114
  visibility: visible;
109
- transition: opacity 0.3s, visibility 0s;
115
+ transition:
116
+ opacity 0.3s,
117
+ visibility 0s;
110
118
  }
111
119
  ul {
112
120
  text-align: start;
@@ -5586,6 +5586,7 @@ export type UpdateAssetInput = {
5586
5586
  tags?: InputMaybe<Array<Scalars['String']['input']>>;
5587
5587
  };
5588
5588
  export type UpdateBadgeInput = {
5589
+ assetId?: InputMaybe<Scalars['ID']['input']>;
5589
5590
  collectionId?: InputMaybe<Scalars['ID']['input']>;
5590
5591
  id: Scalars['ID']['input'];
5591
5592
  position?: InputMaybe<Scalars['String']['input']>;