@magiclabs.ai/magicbook-client 0.7.7-canary → 0.7.8-canary
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/README.md +2 -1
- package/index.cjs +125 -6
- package/index.cjs.map +1 -1
- package/index.d.cts +320 -11
- package/index.d.ts +320 -11
- package/index.js +125 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,7 +102,8 @@ await designRequest.setGuid('a9ccb406-015a-47df-bb59-ea171b8617ca')
|
|
|
102
102
|
Once the design request is complete, retrieve it in JSON format.
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
|
-
|
|
105
|
+
// format: 'galleon' | 'snapfish'
|
|
106
|
+
await designRequest.getJSON(format)
|
|
106
107
|
```
|
|
107
108
|
|
|
108
109
|
You can get alternate layouts for a specific page.
|
package/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ var occasions = [
|
|
|
112
112
|
"year-in-review"
|
|
113
113
|
];
|
|
114
114
|
var styles = {
|
|
115
|
+
//shutterfly styles
|
|
115
116
|
1005: { slug: "modern-black-sfly" },
|
|
116
117
|
1101: { slug: "bon-voyage-sfly" },
|
|
117
118
|
1103: { slug: "fun-in-the-sun-sfly" },
|
|
@@ -282,9 +283,120 @@ var styles = {
|
|
|
282
283
|
6098: { slug: "black-and-white-rustic-sfly" },
|
|
283
284
|
6099: { slug: "bright-color-pop-sfly" },
|
|
284
285
|
6159: { slug: "grateful-for-you-sfly" },
|
|
285
|
-
6156: { slug: "europe-mementos-sfly" }
|
|
286
|
+
6156: { slug: "europe-mementos-sfly" },
|
|
287
|
+
//snapfish styles
|
|
288
|
+
be5f79d7525f4717844db77a2f1b5e50: { slug: "abstract-baby-first-year-snap" },
|
|
289
|
+
"519bf5f2b6734103a9a359469be4961b": { slug: "album-snap" },
|
|
290
|
+
"029a2ebd65b448bf93753c813b7b7363": { slug: "all-about-love-snap" },
|
|
291
|
+
"16d0d436594b4171bd9688876a85c9c1": { slug: "alphabet-book-snap" },
|
|
292
|
+
"5b95e1d678584558b2c3397ab996da7b": { slug: "always-and-forever-snap" },
|
|
293
|
+
a2c088e32541429ba8e5e15d09991264: { slug: "art-of-travel-snap" },
|
|
294
|
+
"0ddec2b965094c8ea03d669e771ff1a6": { slug: "autumn-snapshots-snap" },
|
|
295
|
+
"339699fedd3743f69c5b05587fbfd41a": { slug: "baby-boy-first-year-snap" },
|
|
296
|
+
"091f9a6a83c349b2a9732177d89f8664": { slug: "baby-girl-first-year-snap" },
|
|
297
|
+
e768ec11406545809ca9598be3bda88c: { slug: "best-dad-ever-snap" },
|
|
298
|
+
"0c55a3eb5cc6414c9f2570886132d331": { slug: "best-year-ever-snap" },
|
|
299
|
+
"9c49df50d76b4789834ca7abaabe2bc6": { slug: "bold-shapes-snap" },
|
|
300
|
+
fd7cf7c4dc244705ad391334d76f7229: { slug: "bold-type-snap" },
|
|
301
|
+
"363ceab4906b47a09dd287f53dc1d30f": { slug: "botanicals-snap" },
|
|
302
|
+
e47017576d0e451180ff4591d2aee2fa: { slug: "celebrating-grandma-snap" },
|
|
303
|
+
d9743da5f46843aab84b1f90ff776ee0: { slug: "celebrating-mum-snap" },
|
|
304
|
+
"13039c15c81b4e50af5e39cd99f4e274": { slug: "chalkboard-snap" },
|
|
305
|
+
"0c98757783874104a488a1a88747344d": { slug: "childs-yearbook-snap" },
|
|
306
|
+
"5b0d80d6ca164919b7ee558c0bc2537b": { slug: "classic-fathers-snap" },
|
|
307
|
+
eb734aa7c87a4db1ac9695e935f13489: { slug: "colour-block-rainbow-snap" },
|
|
308
|
+
"7ed9132a96484ed2b200cf30e73cf049": { slug: "contemporary-travel-snap" },
|
|
309
|
+
"3e15106389764a3cb2b6a6c29c065993": { slug: "contemporary-wedding-snap" },
|
|
310
|
+
"47f9e28d811842a5870c74bb4c6b3608": { slug: "design-your-own-snap" },
|
|
311
|
+
bef3d3bc49f3476aa6f39ad073294a04: { slug: "destination-stamps-snap" },
|
|
312
|
+
"496138703d5346bd9678a2fa487b54fd": { slug: "dip-dye-snap" },
|
|
313
|
+
"303773eee9934e8ba9f676b339c84d39": { slug: "earth-tones-snap" },
|
|
314
|
+
"02c52e4cdccd40b0b99cf2215a6b8fe1": { slug: "elegant-florals-snap" },
|
|
315
|
+
c59f05e866344332b2953199fd2972fa: { slug: "everyday-happiness-snap" },
|
|
316
|
+
"5a2d025aaa3746b2b047daa6206ba8ad": { slug: "family-chalkboard-snap" },
|
|
317
|
+
"1c8784e76020435d88ddab7bc8d72cae": { slug: "family-farmhouse-snap" },
|
|
318
|
+
"1735277701d6483e9934074f25053f3a": { slug: "family-memories-snap" },
|
|
319
|
+
"9c35a7f890204c38adb4255571377114": { slug: "family-yearbook-snap" },
|
|
320
|
+
"9c946c20f0dc45adb3f85735690f3395": { slug: "favourite-things-snap" },
|
|
321
|
+
c216373996d945c186cc6db5a53e10b1: { slug: "framed-full-photo-snap" },
|
|
322
|
+
"6f7cd5c4e4e247f2bdf7c44ace0fdad5": { slug: "fresh-cookbook-snap" },
|
|
323
|
+
"7eae47a7cbd743d4a47ca94f7a6b87a7": { slug: "full-and-multi-square-photo-snap" },
|
|
324
|
+
ac7a649cbd27433c9d0b405f34ff29f5: { slug: "full-photo-snap" },
|
|
325
|
+
"3aa989376bc5414eb2a35f2cb930f57c": { slug: "full-photo-snap" },
|
|
326
|
+
d86767aacb4f464892702ed3ffac1a98: { slug: "fun-dots-snap" },
|
|
327
|
+
c5d1654a989d4f2f87594e486239e77b: { slug: "geometric-lines-snap" },
|
|
328
|
+
"73e54769af5f4943a8403c6a5e38f5fb": { slug: "golden-graduation-snap" },
|
|
329
|
+
"7d15aef8b54d41ee82a99d327d571020": { slug: "graduation-memories-snap" },
|
|
330
|
+
"46594aace0ca42b1bdd086d1b8ac0ad4": { slug: "guest-book-snap" },
|
|
331
|
+
"77c78fbe2b4b4c7fb37e34a9515912d2": { slug: "hearts-for-mum-snap" },
|
|
332
|
+
"659893fcc6c24fef9ea1a3a8ccf2539e": { slug: "hello-baby-snap" },
|
|
333
|
+
"0f1182fcc18c428fb7c3d80c5a637c3b": { slug: "hello-baby-boy-snap" },
|
|
334
|
+
"54b7a8ca59774060835fdd48653dba9a": { slug: "hello-baby-girl-snap" },
|
|
335
|
+
"2d56caccc29a40b5bd16334937de0083": { slug: "i-love-my-cat-snap" },
|
|
336
|
+
"3c12993b18ff473fa6fc7f695bd64180": { slug: "i-love-my-dog-snap" },
|
|
337
|
+
c4393a1da2e54ca4ab9a3ec0aeb682e4: { slug: "lets-celebrate-snap" },
|
|
338
|
+
ee9fd665523c41078a65c5389896d0ab: { slug: "love-lives-here-snap" },
|
|
339
|
+
b84d0171dbb748e1ab2fb535fd318830: { slug: "love-story-snap" },
|
|
340
|
+
"4d61b18d992c4d8eb33a331e4201ae05": { slug: "magical-memories-snap" },
|
|
341
|
+
bdbe9158b33343c6ae11217fde9c8a57: { slug: "milestone-memories-snap" },
|
|
342
|
+
"790a78454af94287b2a84c2324d6956e": { slug: "modern-graduation-snap" },
|
|
343
|
+
"4211083b4bad4fee87e04dd65e5fed5d": { slug: "modern-highlights-snap" },
|
|
344
|
+
"47bb41bb9e174657aa0c48ec140ed2c8": { slug: "modern-rustic-snap" },
|
|
345
|
+
bac69bcc341c445d9c5c81f04231c685: { slug: "my-family-snap" },
|
|
346
|
+
"2d561db2b849457f8f830c2e977ced6c": { slug: "my-graduation-snap" },
|
|
347
|
+
e2727f32f9e248a3a7fd02f50cf493ab: { slug: "natural-blues-snap" },
|
|
348
|
+
"85005f9b9c1c4a4485508c52465b7110": { slug: "nautical-summer-snap" },
|
|
349
|
+
df1eded2d6e24c81a9e9bd66567b39f0: { slug: "organic-patterns-snap" },
|
|
350
|
+
bfdc9b325b1a4471a948eccb7c76fd2e: { slug: "organic-shapes-snap" },
|
|
351
|
+
"7cb42c74e4704c08a51f0930703fff34": { slug: "our-wedding-guests-snap" },
|
|
352
|
+
c88a62c1e3584591b278fe0ccfe3b02b: { slug: "over-the-moon-snap" },
|
|
353
|
+
"2a682e5b38d64f77b7c1b6c0a8a06670": { slug: "painterly-patterns-snap" },
|
|
354
|
+
"5eddabc29f704c66ba03deff870f2c18": { slug: "precious-experiences-snap" },
|
|
355
|
+
"18f048f0a07f40c09495fdc3830f7228": { slug: "reflections-on-our-year-snap" },
|
|
356
|
+
f2fd5fd83bbb4e9ebf3af33ba4589561: { slug: "roadtrip-snap" },
|
|
357
|
+
"31ed7e06afb347f2a302ba35267c8a0a": { slug: "rustic-chic-snap" },
|
|
358
|
+
"17e8062b9ed749ba8428cbb3924e719d": { slug: "rustic-family-snapshots-snap" },
|
|
359
|
+
"7573b1a594e8405295adfcf145c5322a": { slug: "serene-memories-snap" },
|
|
360
|
+
acc3ac3b7e724c288a849b471616e373: { slug: "simple-snap" },
|
|
361
|
+
ddb203e3ae0443209ada75135e13a63e: { slug: "simple-family-moments-snap" },
|
|
362
|
+
bdee0a45e5144156b88621238cd31bbe: { slug: "simply-love-snap" },
|
|
363
|
+
dc0d15f9aa474bd89c49e6da49bb3cc5: { slug: "sketched-botanicals-snap" },
|
|
364
|
+
"55cebda93e1c4f52b07d824a57f8677b": { slug: "smitten-snap" },
|
|
365
|
+
"2172f706eedf4c36a3fba10a0fe5448d": { slug: "snow-days-snap" },
|
|
366
|
+
"0964a6d8e0234df7ad7df8e56c33ff2b": { slug: "solid-brights-snap" },
|
|
367
|
+
e47b1860677e45909de56915a350a84e: { slug: "studio-snap" },
|
|
368
|
+
"0b8fcc5f30cb4649bb4d8ea9cf35578c": { slug: "studio-multi-snap" },
|
|
369
|
+
"2972e73653da4dc5805853e22717f1ee": { slug: "summer-snapshots-snap" },
|
|
370
|
+
f292a52aff774e698fe26dc61a7a3f71: { slug: "team-spirit-snap" },
|
|
371
|
+
b9192bf9df6b4984b29f4731b5f0bb63: { slug: "ten-things-i-love-snap" },
|
|
372
|
+
d2dd8fe6e2e44c78935206323ee89af1: { slug: "travel-maps-snap" },
|
|
373
|
+
"61f74eec39ff425b85e4f1c7e9e15ef6": { slug: "travel-memories-snap" },
|
|
374
|
+
"148b777f385c4df2bc1b4900a4208e82": { slug: "travel-stamps-snap" },
|
|
375
|
+
"77550e4c36b34454bac2ae9c4d9d2bd1": { slug: "tropical-beach-escape-snap" },
|
|
376
|
+
"6aac0d2309744e9ea8fd4621f8213dbd": { slug: "unfurgettable-kitty-snap" },
|
|
377
|
+
f5ef0aaddd294a0ba37ebc76012858ff: { slug: "vibrant-memories-snap" },
|
|
378
|
+
"73966e2885a544ed9ba8e0a314a6528c": { slug: "vintage-birthday-memories-snap" },
|
|
379
|
+
"33242c4285024ccfafc57d72a7292ea9": { slug: "warm-neutrals-snap" },
|
|
380
|
+
"605f06522caa449ba93b7c5fa4d8e54b": { slug: "warmest-memories-snap" },
|
|
381
|
+
c154e4664672441fa640f1ddff883db1: { slug: "watercolour-memories-snap" },
|
|
382
|
+
"86024d3f1def489495cc7525d8232bea": { slug: "watercolour-sketchbook-snap" },
|
|
383
|
+
f52d1dd24f9c49ae82d8f70449fe40b7: { slug: "watercolour-wonders-snap" },
|
|
384
|
+
"1cbbd20a3a4542f38d2f9932016c4584": { slug: "watercolours-snap" },
|
|
385
|
+
fdf4b31ea3434b03a5c3ddaab1579084: { slug: "wedding-studio-snap" },
|
|
386
|
+
"1b104c3a036e4825bd60a5c7ceac4e66": { slug: "winter-magic-snap" },
|
|
387
|
+
"03f332e3b2b947ebae73b67a9a22b6f4": { slug: "winter-sparkle-snap" },
|
|
388
|
+
"97f70f6cdb5244a08d45772cccfa2788": { slug: "year-of-memories-snap" }
|
|
286
389
|
};
|
|
287
|
-
var bookSizes = [
|
|
390
|
+
var bookSizes = [
|
|
391
|
+
"5x7",
|
|
392
|
+
"6x6",
|
|
393
|
+
"8x8",
|
|
394
|
+
"10x10",
|
|
395
|
+
"12x12",
|
|
396
|
+
"8x11",
|
|
397
|
+
"11x8",
|
|
398
|
+
"11x14"
|
|
399
|
+
];
|
|
288
400
|
var coverTypes = ["sc", "hc", "pl"];
|
|
289
401
|
var pageTypes = ["sp", "sl", "dl"];
|
|
290
402
|
var imageDensities = ["low", "medium", "high"];
|
|
@@ -371,7 +483,7 @@ function getStyleIdBySlug(slug) {
|
|
|
371
483
|
for (const id in styles) {
|
|
372
484
|
const style = styles[id];
|
|
373
485
|
if (style.slug === slug) {
|
|
374
|
-
return
|
|
486
|
+
return id;
|
|
375
487
|
}
|
|
376
488
|
}
|
|
377
489
|
return void 0;
|
|
@@ -4336,6 +4448,7 @@ var bookPropsSchema = z.object({
|
|
|
4336
4448
|
title: z.string(),
|
|
4337
4449
|
subtitle: z.string().optional(),
|
|
4338
4450
|
design_request: bookDesignRequestSchema,
|
|
4451
|
+
sku: z.string().optional(),
|
|
4339
4452
|
state: z.enum(states).optional(),
|
|
4340
4453
|
guid: z.string().optional(),
|
|
4341
4454
|
cancelled_at: z.string().optional(),
|
|
@@ -4349,6 +4462,7 @@ var Book = class {
|
|
|
4349
4462
|
revision;
|
|
4350
4463
|
subtitle;
|
|
4351
4464
|
design_request;
|
|
4465
|
+
sku;
|
|
4352
4466
|
state;
|
|
4353
4467
|
guid;
|
|
4354
4468
|
cancelled_at;
|
|
@@ -4359,6 +4473,7 @@ var Book = class {
|
|
|
4359
4473
|
this.title = props.title;
|
|
4360
4474
|
this.subtitle = props.subtitle;
|
|
4361
4475
|
this.design_request = new BookDesignRequest(props.design_request);
|
|
4476
|
+
this.sku = props.sku;
|
|
4362
4477
|
this.state = props.state;
|
|
4363
4478
|
this.guid = props.guid;
|
|
4364
4479
|
this.cancelled_at = props.cancelled_at;
|
|
@@ -4509,6 +4624,7 @@ var DesignRequest = class {
|
|
|
4509
4624
|
this.subtitle = designRequestProps?.subtitle;
|
|
4510
4625
|
this.occasion = designRequestProps?.occasion || occasions[0];
|
|
4511
4626
|
this.style = designRequestProps?.style || parseInt(Object.keys(styles)[0]);
|
|
4627
|
+
this.sku = designRequestProps?.sku;
|
|
4512
4628
|
this.bookSize = designRequestProps?.bookSize || bookSizes[0];
|
|
4513
4629
|
this.coverType = designRequestProps?.coverType || coverTypes[0];
|
|
4514
4630
|
this.pageType = designRequestProps?.pageType || pageTypes[0];
|
|
@@ -4524,6 +4640,7 @@ var DesignRequest = class {
|
|
|
4524
4640
|
subtitle;
|
|
4525
4641
|
occasion;
|
|
4526
4642
|
style;
|
|
4643
|
+
sku;
|
|
4527
4644
|
bookSize;
|
|
4528
4645
|
coverType;
|
|
4529
4646
|
pageType;
|
|
@@ -4548,7 +4665,8 @@ var DesignRequest = class {
|
|
|
4548
4665
|
await this.client.engineAPI.designOptions.retrieve(
|
|
4549
4666
|
this.bookSize,
|
|
4550
4667
|
imageCount || this.images.length,
|
|
4551
|
-
this.imageFilteringLevel
|
|
4668
|
+
this.imageFilteringLevel,
|
|
4669
|
+
this.sku
|
|
4552
4670
|
)
|
|
4553
4671
|
)
|
|
4554
4672
|
);
|
|
@@ -4664,6 +4782,7 @@ var DesignRequest = class {
|
|
|
4664
4782
|
title: designRequest.title,
|
|
4665
4783
|
subtitle: designRequest.subtitle,
|
|
4666
4784
|
design_request: bookDesignRequest,
|
|
4785
|
+
sku: designRequest.sku,
|
|
4667
4786
|
state: designRequest.state,
|
|
4668
4787
|
user_id: designRequest.userId
|
|
4669
4788
|
});
|
|
@@ -4845,11 +4964,11 @@ var DesignOptionsEndpoints = class {
|
|
|
4845
4964
|
this.engineAPI = engineAPI;
|
|
4846
4965
|
bindThisToFunctions(this);
|
|
4847
4966
|
}
|
|
4848
|
-
retrieve(bookSize, imageCount, imageFilteringLevel) {
|
|
4967
|
+
retrieve(bookSize, imageCount, imageFilteringLevel, sku) {
|
|
4849
4968
|
return handleAsyncFunction(async () => {
|
|
4850
4969
|
const res = await this.engineAPI.fetcher.call({
|
|
4851
4970
|
// eslint-disable-next-line max-len
|
|
4852
|
-
path: `/v1/designoptions/booksize/${bookSize}/imagecount/${imageCount}/imagefilteringlevel/${imageFilteringLevel}`
|
|
4971
|
+
path: `/v1/designoptions/booksize/${bookSize}/imagecount/${imageCount}/imagefilteringlevel/${imageFilteringLevel}${sku ? `?sku=${sku}` : ""}`
|
|
4853
4972
|
});
|
|
4854
4973
|
return designOptionsServerSchema.parse(res);
|
|
4855
4974
|
});
|