@eluvio/elv-client-js 3.1.76 → 3.1.80

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.
@@ -4,7 +4,7 @@ const currencyOptions = [...new Set(Object.values(require("country-codes-list").
4
4
  const MarketplaceSpec = {
5
5
  "profile": {
6
6
  "name": "Eluvio LIVE Marketplace",
7
- "version": "0.1",
7
+ "version": "0.3",
8
8
  },
9
9
  "manageApp": "default",
10
10
  "hide_image_tab": true,
@@ -17,50 +17,232 @@ const MarketplaceSpec = {
17
17
  "controls": [],
18
18
  "associated_assets": [],
19
19
  "info_fields": [
20
+ {
21
+ "label": "Branding and Customization",
22
+ "name": "header_branding",
23
+ "type": "header"
24
+ },
20
25
  {
21
26
  "name": "tenant_id",
22
27
  "label": "Tenant ID",
23
28
  "type": "Text"
24
29
  },
25
30
  {
26
- "label": "Eluvio LIVE Tenant",
27
- "name": "tenant",
28
- "type": "fabric_link",
29
- "hash_only": true,
30
- "no_localize": true
31
- },
32
- {
33
- "name": "name",
34
- "type": "text",
35
- },
36
- {
37
- "name": "description",
38
- "type": "textarea",
31
+ "name": "branding",
32
+ "type": "subsection",
33
+ "fields": [
34
+ {
35
+ "name": "discovery",
36
+ "type": "subsection",
37
+ "hint": "These attributes will be used to display your marketplace in the list of available marketplaces",
38
+ "fields": [
39
+ {
40
+ "name": "name",
41
+ "type": "text"
42
+ },
43
+ {
44
+ "name": "subheader",
45
+ "type": "text",
46
+ "default_value": "Marketplace"
47
+ },
48
+ {
49
+ "name": "description",
50
+ "type": "textarea"
51
+ },
52
+ {
53
+ "name": "round_logo",
54
+ "extensions": imageTypes,
55
+ "type": "file",
56
+ "hint": "This logo will be displayed in the list of available marketplaces"
57
+ },
58
+ {
59
+ "name": "card_banner",
60
+ "extensions": imageTypes,
61
+ "type": "file",
62
+ "hint": "This logo will be displayed in the list of available marketplaces. It should be roughly 2:1 aspect ratio."
63
+ },
64
+ {
65
+ "name": "tags",
66
+ "type": "multiselect",
67
+ "hint": "These tags will be used to help users discover your marketplace based on their interests.",
68
+ "options": [
69
+ "Film",
70
+ "Music",
71
+ "Software",
72
+ "TV"
73
+ ]
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "name": "marketplace",
79
+ "type": "subsection",
80
+ "hint": "These attributes will be used to customize the user experience when browsing your marketplace",
81
+ "fields": [
82
+ {
83
+ "name": "name",
84
+ "label": "Marketplace Name",
85
+ "type": "text"
86
+ },
87
+ {
88
+ "name": "top_banner_logo",
89
+ "extensions": imageTypes,
90
+ "type": "file",
91
+ "hint": "This logo will be displayed at the top of the page when browsing your marketplace"
92
+ },
93
+ {
94
+ "name": "description",
95
+ "type": "textarea",
96
+ "hint": "Displayed below the top banner logo"
97
+ },
98
+ {
99
+ "name": "color_scheme",
100
+ "type": "select",
101
+ "default_value": "Light",
102
+ "options": [
103
+ "Light",
104
+ "Dark",
105
+ "User Preference"
106
+ ]
107
+ },
108
+ {
109
+ "name": "font",
110
+ "type": "select",
111
+ "options": [
112
+ "Helvetica Neue",
113
+ "Inter",
114
+ "Selawik"
115
+ ]
116
+ }
117
+ ]
118
+ }
119
+ ]
39
120
  },
40
121
  {
122
+ "name": "login_customization",
123
+ "label": "Login Customization",
124
+ "type": "subsection",
41
125
  "fields": [
42
126
  {
43
- "extensions": imageTypes,
127
+ "label": "Login Page Logo",
44
128
  "name": "logo",
45
- "type": "file"
129
+ "type": "file",
130
+ "extensions": imageTypes
46
131
  },
47
132
  {
48
- "extensions": imageTypes,
49
- "name": "image",
50
- "type": "file"
133
+ "label": "Login Page Background",
134
+ "name": "background",
135
+ "type": "file",
136
+ "extensions": imageTypes
137
+ },
138
+ {
139
+ "name": "background_mobile",
140
+ "label": "Login Page Background (Mobile)",
141
+ "type": "file",
142
+ "extensions": imageTypes
143
+ },
144
+ {
145
+ "name": "large_logo_mode",
146
+ "type": "checkbox",
147
+ "hint": "If specified, the logo in the login box will be significantly larger, but *the background image will NOT be visible in the Live app*."
148
+ },
149
+ {
150
+ "name": "log_in_button",
151
+ "type": "subsection",
152
+ "fields": [
153
+ {
154
+ "name": "text_color",
155
+ "type": "color",
156
+ "no_label": true,
157
+ "default_value": {
158
+ "color": "#FFFFFF"
159
+ }
160
+ },
161
+ {
162
+ "name": "background_color",
163
+ "type": "color",
164
+ "no_label": true,
165
+ "default_value": {
166
+ "color": "#0885fb"
167
+ }
168
+ },
169
+ {
170
+ "name": "border_color",
171
+ "type": "color",
172
+ "no_label": true,
173
+ "default_value": {
174
+ "color": "#0885fb"
175
+ }
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ "name": "sign_up_button",
181
+ "type": "subsection",
182
+ "fields": [
183
+ {
184
+ "name": "text_color",
185
+ "type": "color",
186
+ "no_label": true,
187
+ "default_value": {
188
+ "color": "#000000"
189
+ }
190
+ },
191
+ {
192
+ "name": "background_color",
193
+ "type": "color",
194
+ "no_label": true,
195
+ "default_value": {
196
+ "color": "#FFFFFF"
197
+ }
198
+ },
199
+ {
200
+ "name": "border_color",
201
+ "type": "color",
202
+ "no_label": true,
203
+ "default_value": {
204
+ "color": "#000000"
205
+ }
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "name": "require_email_verification",
211
+ "type": "checkbox",
212
+ "default_value": true
213
+ },
214
+ {
215
+ "name": "disable_third_party",
216
+ "label": "Disable third party login providers",
217
+ "type": "checkbox",
218
+ "default_value": false
219
+ },
220
+ {
221
+ "name": "disable_private_key",
222
+ "label": "Disable Private Key Login",
223
+ "type": "checkbox",
224
+ "default_value": false
51
225
  }
52
- ],
53
- "name": "images",
54
- "type": "subsection"
226
+ ]
55
227
  },
56
228
  {
57
- "name": "events",
58
- "type": "list",
59
- "no_localize": true,
60
- "fields": [{
61
- "name": "event",
62
- "type": "fabric_link"
63
- }]
229
+ "label": "Terms and Conditions",
230
+ "name": "terms",
231
+ "type": "rich_text"
232
+ },
233
+ {
234
+ "label": "Terms and Conditions (HTML)",
235
+ "name": "terms_html",
236
+ "type": "file",
237
+ "extensions": [".html"]
238
+ },
239
+
240
+
241
+
242
+ {
243
+ "label": "Item Definitions",
244
+ "name": "header_items",
245
+ "type": "header"
64
246
  },
65
247
  {
66
248
  "name": "payment_currencies",
@@ -146,6 +328,13 @@ const MarketplaceSpec = {
146
328
  "name": "items",
147
329
  "type": "list"
148
330
  },
331
+
332
+
333
+ {
334
+ "label": "Storefront Organization",
335
+ "name": "header_storefront",
336
+ "type": "header"
337
+ },
149
338
  {
150
339
  "name": "storefront",
151
340
  "type": "subsection",
@@ -204,6 +393,14 @@ const MarketplaceSpec = {
204
393
  },
205
394
  ]
206
395
  },
396
+
397
+
398
+
399
+ {
400
+ "label": "Collections",
401
+ "name": "header_collections",
402
+ "type": "header"
403
+ },
207
404
  {
208
405
  "name": "collections",
209
406
  "type": "list",
@@ -284,125 +481,6 @@ const MarketplaceSpec = {
284
481
  "allow_null": true
285
482
  }
286
483
  ]
287
- },
288
- {
289
- "name": "login_customization",
290
- "label": "Custom Branding",
291
- "type": "subsection",
292
- "fields": [
293
- {
294
- "name": "require_email_verification",
295
- "type": "checkbox",
296
- "default_value": true
297
- },
298
- {
299
- "name": "font",
300
- "type": "select",
301
- "options": [
302
- "Helvetica Neue",
303
- "Inter",
304
- "Selawik"
305
- ]
306
- },
307
- {
308
- "name": "logo",
309
- "type": "file",
310
- "extensions": imageTypes
311
- },
312
- {
313
- "name": "background",
314
- "type": "file",
315
- "extensions": imageTypes
316
- },
317
- {
318
- "name": "background_mobile",
319
- "label": "Background (Mobile)",
320
- "type": "file",
321
- "extensions": imageTypes
322
- },
323
- {
324
- "name": "large_logo_mode",
325
- "type": "checkbox",
326
- "hint": "If specified, the logo in the login box will be significantly larger, but *the background image will NOT be visible in the Live app*."
327
- },
328
- {
329
- "name": "log_in_button",
330
- "type": "subsection",
331
- "fields": [
332
- {
333
- "name": "text_color",
334
- "type": "color",
335
- "no_label": true,
336
- "default_value": {
337
- "color": "#FFFFFF"
338
- }
339
- },
340
- {
341
- "name": "background_color",
342
- "type": "color",
343
- "no_label": true,
344
- "default_value": {
345
- "color": "#0885fb"
346
- }
347
- },
348
- {
349
- "name": "border_color",
350
- "type": "color",
351
- "no_label": true,
352
- "default_value": {
353
- "color": "#0885fb"
354
- }
355
- }
356
- ]
357
- },
358
- {
359
- "name": "sign_up_button",
360
- "type": "subsection",
361
- "fields": [
362
- {
363
- "name": "text_color",
364
- "type": "color",
365
- "no_label": true,
366
- "default_value": {
367
- "color": "#000000"
368
- }
369
- },
370
- {
371
- "name": "background_color",
372
- "type": "color",
373
- "no_label": true,
374
- "default_value": {
375
- "color": "#FFFFFF"
376
- }
377
- },
378
- {
379
- "name": "border_color",
380
- "type": "color",
381
- "no_label": true,
382
- "default_value": {
383
- "color": "#000000"
384
- }
385
- }
386
- ]
387
- },
388
- {
389
- "name": "disable_third_party",
390
- "label": "Disable third party login providers",
391
- "type": "checkbox",
392
- "default_value": false
393
- },
394
- {
395
- "name": "disable_private_key",
396
- "label": "Disable Private Key Login",
397
- "type": "checkbox",
398
- "default_value": false
399
- }
400
- ]
401
- },
402
- {
403
- "label": "Terms and Conditions",
404
- "name": "terms",
405
- "type": "rich_text"
406
484
  }
407
485
  ]
408
486
  };
@@ -3,7 +3,7 @@ const imageTypes = ["gif", "jpg", "jpeg", "png", "svg", "webp"];
3
3
  const NFTTemplateSpec = {
4
4
  "profile": {
5
5
  "name": "NFT Template",
6
- "version": "0.1",
6
+ "version": "0.3",
7
7
  },
8
8
  "playable": true,
9
9
  "display_app": "default",
@@ -93,6 +93,20 @@ const NFTTemplateSpec = {
93
93
  "name": "rich_text",
94
94
  "type": "rich_text"
95
95
  },
96
+ {
97
+ "name": "media_type",
98
+ "type": "select",
99
+ "options": [
100
+ "Video",
101
+ "Image",
102
+ "Ebook"
103
+ ]
104
+ },
105
+ {
106
+ "name": "media",
107
+ "type": "file",
108
+ "hint": "Additional media for this NFT, for example the Ebook file."
109
+ },
96
110
  {
97
111
  "name": "address",
98
112
  "label": "NFT Contract Address",
@@ -129,6 +143,11 @@ const NFTTemplateSpec = {
129
143
  "type": "checkbox",
130
144
  "default_value": true
131
145
  },
146
+ {
147
+ "name": "has_audio",
148
+ "type": "checkbox",
149
+ "default_value": false
150
+ },
132
151
  {
133
152
  "name": "token_uri",
134
153
  "label": "Token URI",
@@ -145,7 +164,8 @@ const NFTTemplateSpec = {
145
164
  "loop": true,
146
165
  "hide_controls": true,
147
166
  "muted": true,
148
- "autoplay": true
167
+ "autoplay": true,
168
+ "check_has_audio_flag": true
149
169
  },
150
170
  {
151
171
  "name": "external_url",
@@ -157,7 +177,8 @@ const NFTTemplateSpec = {
157
177
  "loop": true,
158
178
  "hide_controls": true,
159
179
  "muted": true,
160
- "autoplay": true
180
+ "autoplay": true,
181
+ "check_has_audio_flag": true
161
182
  },
162
183
  {
163
184
  "name": "background_color",
@@ -185,7 +206,8 @@ const NFTTemplateSpec = {
185
206
  "loop": true,
186
207
  "hide_controls": true,
187
208
  "muted": true,
188
- "autoplay": true
209
+ "autoplay": true,
210
+ "check_has_audio_flag": true
189
211
  }
190
212
  ]
191
213
  },
@@ -0,0 +1,92 @@
1
+ const { ElvClient } = require("../src/ElvClient");
2
+ const isEqual = require("lodash/isEqual");
3
+
4
+ if(!process.env.PRIVATE_KEY || !process.env.NETWORK) {
5
+ console.error("USAGE: PRIVATE_KEY=<key> NETWORK=<network-name> node UpdateTypes.js");
6
+ process.exit(-1);
7
+ }
8
+
9
+ const specs = {
10
+ "Event Site": {
11
+ spec: require("./DropEventSite"),
12
+ },
13
+ "Tenant": {
14
+ spec: require("./EventTenant"),
15
+ },
16
+ "NFT Collection": {
17
+ spec: require("./NFTCollection")
18
+ },
19
+ "NFT Template": {
20
+ spec: require("./NFTTemplate")
21
+ },
22
+ "Marketplace": {
23
+ spec: require("./Marketplace")
24
+ }
25
+ };
26
+
27
+ const Test = async () => {
28
+ try {
29
+ const client = await ElvClient.FromNetworkName({
30
+ networkName: process.env.NETWORK
31
+ });
32
+
33
+ let wallet = client.GenerateWallet();
34
+ let signer = wallet.AddAccount({
35
+ privateKey: process.env.PRIVATE_KEY
36
+ });
37
+
38
+ client.SetSigner({signer});
39
+
40
+ const types = await client.ContentTypes();
41
+
42
+ await Promise.all(
43
+ Object.values(types).map(async (type) => {
44
+ try {
45
+ const typeName = (type.meta && type.meta.public && type.meta.public.name && type.meta.public.name) || "";
46
+ const typeSpec = Object.keys(specs)
47
+ .find(name => typeName.toLowerCase().includes(name.toLowerCase()));
48
+
49
+ if(!typeSpec) {
50
+ console.log("Skipping", typeName);
51
+ return;
52
+ }
53
+
54
+ const specMetadata = specs[typeSpec].spec;
55
+
56
+ if(isEqual(specMetadata, type.meta.public.title_configuration || {})) {
57
+ await new Promise(resolve => setTimeout(resolve, 1000));
58
+ console.log("Type already up to date: ", typeName);
59
+ return;
60
+ }
61
+
62
+ await client.EditAndFinalizeContentObject({
63
+ libraryId: client.contentSpaceLibraryId,
64
+ objectId: type.id,
65
+ commitMessage: "Updated type spec via UpdateTypes.js",
66
+ callback: async ({writeToken}) => {
67
+ await client.ReplaceMetadata({
68
+ libraryId: client.contentSpaceLibraryId,
69
+ objectId: type.id,
70
+ writeToken,
71
+ metadataSubtree: "public/title_configuration",
72
+ metadata: specMetadata
73
+ });
74
+ }
75
+ });
76
+
77
+ console.log("Updated", typeName);
78
+ } catch(error) {
79
+ console.log(type);
80
+ console.log(error);
81
+ }
82
+ })
83
+ );
84
+ } catch(error) {
85
+ console.error(error);
86
+ console.error(JSON.stringify(error, null, 2));
87
+ }
88
+
89
+ process.exit(0);
90
+ };
91
+
92
+ Test();