@kgalexander/mcreate 0.0.9 → 0.0.11

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.
@@ -216,7 +216,7 @@ function formatOpenHouseTime(time24) {
216
216
  function propertyCardMockMjml(block, context) {
217
217
  const a = block.attributes;
218
218
  const trackingClasses = context.mode === "editing" ? getTrackingClasses(context.idx, "property-card") : "";
219
- const href = a["href"] || a["link"] || "#";
219
+ const href = a["href"] || "#";
220
220
  const price = formatPrice(a["price"] || "$0");
221
221
  const address = a["address"] || "123 Main Street";
222
222
  const city = a["city"] || "City, ST 00000";
@@ -577,7 +577,7 @@ function propertyCardSingleTwoMockMjml(block, context) {
577
577
  // src/render/Mockup/mock-property-triple-better.ts
578
578
  function renderCard(child, childIdx, context, uniqueId, borderRadius, imageHeight, border, fontFamily, textColor, backgroundColor, innerBorderRadius) {
579
579
  const attrs = child.attributes;
580
- const href = attrs["href"] || attrs["link"] || "#";
580
+ const href = attrs["href"] || "#";
581
581
  const price = formatPrice(attrs["price"] || "$0");
582
582
  const beds = formatNumber(attrs["beds"] || "--");
583
583
  const baths = formatNumber(attrs["baths"] || "--");
@@ -880,7 +880,7 @@ function propertyCardTripleToMjml(block, context) {
880
880
  const cardNum = index + 1;
881
881
  const childAttrs = child.attributes || {};
882
882
  productionAttrs[`image-src-${cardNum}`] = childAttrs["image-src"] || "";
883
- productionAttrs[`href-${cardNum}`] = childAttrs["href"] || childAttrs["link"] || "#";
883
+ productionAttrs[`href-${cardNum}`] = childAttrs["href"] || "#";
884
884
  productionAttrs[`price-${cardNum}`] = childAttrs["price"] || "$0";
885
885
  productionAttrs[`beds-${cardNum}`] = childAttrs["beds"] || "--";
886
886
  productionAttrs[`baths-${cardNum}`] = childAttrs["baths"] || "--";
@@ -1406,7 +1406,7 @@ function createPropertyCardElement(payload) {
1406
1406
  "beds": "--",
1407
1407
  "baths": "--",
1408
1408
  "sqft": "--",
1409
- "link": "#",
1409
+ "href": "#",
1410
1410
  "status": "Empty",
1411
1411
  "is-status": "show",
1412
1412
  "status-color": "#B8B8B8",
@@ -1435,7 +1435,7 @@ function createPropertyCardSingleTwoElement(payload) {
1435
1435
  "beds": "--",
1436
1436
  "baths": "--",
1437
1437
  "sqft": "--",
1438
- "link": "#",
1438
+ "href": "#",
1439
1439
  "status": "Empty",
1440
1440
  "is-status": "show",
1441
1441
  "status-color": "#B8B8B8",
@@ -1522,7 +1522,7 @@ function createPropertyCardTripleItemElement(payload) {
1522
1522
  data: { value: {} },
1523
1523
  attributes: {
1524
1524
  "image-src": payload?.attributes?.["image-src"] || "https://cornerstonepropertymgmt.com/wp-content/themes/cornerstone/assets/img/nofeaturedimage.jpg",
1525
- "link": payload?.attributes?.["link"] || "#",
1525
+ "href": payload?.attributes?.["href"] || "#",
1526
1526
  "price": payload?.attributes?.["price"] || "$0",
1527
1527
  "beds": payload?.attributes?.["beds"] || "--",
1528
1528
  "baths": payload?.attributes?.["baths"] || "--",
@@ -13961,22 +13961,8 @@ import { EyeIcon } from "lucide-react";
13961
13961
 
13962
13962
  // src/render/useMjmlCompiler.ts
13963
13963
  import { useState as useState13, useCallback as useCallback15 } from "react";
13964
- var htmlCache = /* @__PURE__ */ new Map();
13965
- var MAX_CACHE = 50;
13966
- function hashMjml(mjml) {
13967
- let hash = 0;
13968
- for (let i = 0; i < mjml.length; i++) {
13969
- hash = (hash << 5) - hash + mjml.charCodeAt(i);
13970
- hash |= 0;
13971
- }
13972
- return hash.toString(36);
13973
- }
13974
13964
  async function compileMjml(mjml) {
13975
- const key = hashMjml(mjml);
13976
- const cached = htmlCache.get(key);
13977
- if (cached) {
13978
- return cached;
13979
- }
13965
+ console.log("Compiling MJML", mjml);
13980
13966
  const response = await fetch("/api/mrender", {
13981
13967
  method: "POST",
13982
13968
  headers: { "Content-Type": "application/json" },
@@ -13987,11 +13973,6 @@ async function compileMjml(mjml) {
13987
13973
  throw new Error(errorData.message || "Failed to compile MJML");
13988
13974
  }
13989
13975
  const result = await response.json();
13990
- if (htmlCache.size >= MAX_CACHE) {
13991
- const firstKey = htmlCache.keys().next().value;
13992
- if (firstKey) htmlCache.delete(firstKey);
13993
- }
13994
- htmlCache.set(key, result);
13995
13976
  return result;
13996
13977
  }
13997
13978
 
@@ -14029,6 +14010,7 @@ function Preview() {
14029
14010
  const convertMjml = async () => {
14030
14011
  try {
14031
14012
  const mjmlString = json2mjml(template, "production", { isPaid });
14013
+ console.log("MJML string:", mjmlString);
14032
14014
  const result = await compileMjml(mjmlString);
14033
14015
  if (result.errors?.length > 0) {
14034
14016
  console.warn("MJML warnings:", result.errors);
@@ -15080,11 +15062,7 @@ export {
15080
15062
  SOCIAL_OPTIONS,
15081
15063
  parseBorder,
15082
15064
  formatBorder,
15083
- formatPrice,
15084
15065
  parsePrice,
15085
- formatNumber,
15086
- formatOpenHouseDate,
15087
- formatOpenHouseTime,
15088
15066
  json2mjml,
15089
15067
  MAX_TEMPLATE_SIZE,
15090
15068
  useEditorStore,
@@ -5,7 +5,7 @@ import {
5
5
  MAILLOW_EMAIL_EDITOR_VERSION,
6
6
  Preview,
7
7
  useEditorStore
8
- } from "./chunk-Y52MW7DH.mjs";
8
+ } from "./chunk-TDZCSKBT.mjs";
9
9
  export {
10
10
  Editor,
11
11
  History,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { BodyComponent } from 'mjml-core';
3
2
 
4
3
  type PageElement = {
5
4
  id?: string;
@@ -274,228 +273,6 @@ declare function TemplatePage({ templateId, initialTemplate, onSave }: {
274
273
  onSave?: OnSaveCallback;
275
274
  }): react_jsx_runtime.JSX.Element;
276
275
 
277
- declare class MjColproperty extends BodyComponent {
278
- static componentName: string;
279
- static endingTag: boolean;
280
- static dependencies: {
281
- 'mj-column': string[];
282
- 'mj-colproperty': never[];
283
- };
284
- static allowedAttributes: {
285
- 'image-src': string;
286
- 'image-alt': string;
287
- price: string;
288
- address: string;
289
- city: string;
290
- country: string;
291
- beds: string;
292
- baths: string;
293
- sqft: string;
294
- href: string;
295
- status: string;
296
- 'status-color': string;
297
- 'is-new': string;
298
- brokerage: string;
299
- 'mls-logo': string;
300
- width: string;
301
- 'border-radius': string;
302
- description: string;
303
- 'is-open-house': string;
304
- 'open-house-date': string;
305
- 'open-house-time': string;
306
- border: string;
307
- 'font-family': string;
308
- 'text-color': string;
309
- 'is-description': string;
310
- 'is-brokerage': string;
311
- 'is-status': string;
312
- };
313
- static defaultAttributes: {
314
- 'image-src': string;
315
- 'image-alt': string;
316
- price: string;
317
- address: string;
318
- city: string;
319
- country: string;
320
- beds: string;
321
- baths: string;
322
- sqft: string;
323
- href: string;
324
- status: string;
325
- 'status-color': string;
326
- 'is-new': string;
327
- brokerage: string;
328
- 'mls-logo': string;
329
- 'border-radius': string;
330
- width: string;
331
- description: string;
332
- 'is-open-house': string;
333
- 'open-house-date': string;
334
- 'open-house-time': string;
335
- border: string;
336
- 'font-family': string;
337
- 'text-color': string;
338
- 'is-description': string;
339
- 'is-brokerage': string;
340
- 'is-status': string;
341
- };
342
- componentHeadStyle: (breakpoint: number) => string;
343
- render(): string;
344
- }
345
-
346
- declare class MjPropertysingletwo extends BodyComponent {
347
- static componentName: string;
348
- static endingTag: boolean;
349
- borderRadius: string;
350
- innerBorderRadius: string;
351
- uniqueId: string;
352
- constructor(initialDatas?: {});
353
- static dependencies: {
354
- 'mj-column': string[];
355
- 'mj-propertysingletwo': never[];
356
- };
357
- static allowedAttributes: {
358
- 'image-src': string;
359
- 'image-alt': string;
360
- price: string;
361
- address: string;
362
- city: string;
363
- country: string;
364
- beds: string;
365
- baths: string;
366
- sqft: string;
367
- href: string;
368
- status: string;
369
- 'status-color': string;
370
- 'is-new': string;
371
- brokerage: string;
372
- 'mls-logo': string;
373
- width: string;
374
- 'border-radius': string;
375
- description: string;
376
- 'is-open-house': string;
377
- 'open-house-date': string;
378
- 'open-house-time': string;
379
- border: string;
380
- 'font-family': string;
381
- 'text-color': string;
382
- 'is-description': string;
383
- 'is-brokerage': string;
384
- 'is-status': string;
385
- };
386
- static defaultAttributes: {
387
- 'image-src': string;
388
- 'image-alt': string;
389
- price: string;
390
- address: string;
391
- city: string;
392
- country: string;
393
- beds: string;
394
- baths: string;
395
- sqft: string;
396
- href: string;
397
- status: string;
398
- 'status-color': string;
399
- 'is-new': string;
400
- brokerage: string;
401
- 'mls-logo': string;
402
- 'border-radius': string;
403
- width: string;
404
- description: string;
405
- 'is-open-house': string;
406
- 'open-house-date': string;
407
- 'open-house-time': string;
408
- border: string;
409
- 'font-family': string;
410
- 'text-color': string;
411
- 'is-description': string;
412
- 'is-brokerage': string;
413
- 'is-status': string;
414
- };
415
- componentHeadStyle: (breakpoint: number) => string;
416
- render(): string;
417
- }
418
-
419
- declare class MjPropertytriplebetter extends BodyComponent {
420
- static componentName: string;
421
- static endingTag: boolean;
422
- borderRadius: string;
423
- innerBorderRadius: string;
424
- uniqueId: string;
425
- constructor(initialDatas?: {});
426
- static dependencies: {
427
- 'mj-column': string[];
428
- 'mj-propertytriple': never[];
429
- };
430
- static allowedAttributes: {
431
- width: string;
432
- 'card-width': string;
433
- gap: string;
434
- 'border-radius': string;
435
- border: string;
436
- 'image-height': string;
437
- 'font-family': string;
438
- 'text-color': string;
439
- 'background-color': string;
440
- 'image-src-1': string;
441
- 'href-1': string;
442
- 'price-1': string;
443
- 'beds-1': string;
444
- 'baths-1': string;
445
- 'sqft-1': string;
446
- 'city-1': string;
447
- 'image-src-2': string;
448
- 'href-2': string;
449
- 'price-2': string;
450
- 'beds-2': string;
451
- 'baths-2': string;
452
- 'sqft-2': string;
453
- 'city-2': string;
454
- 'image-src-3': string;
455
- 'href-3': string;
456
- 'price-3': string;
457
- 'beds-3': string;
458
- 'baths-3': string;
459
- 'sqft-3': string;
460
- 'city-3': string;
461
- };
462
- static defaultAttributes: {
463
- width: string;
464
- 'card-width': string;
465
- gap: string;
466
- 'border-radius': string;
467
- border: string;
468
- 'image-height': string;
469
- 'font-family': string;
470
- 'text-color': string;
471
- 'background-color': string;
472
- 'image-src-1': string;
473
- 'href-1': string;
474
- 'price-1': string;
475
- 'beds-1': string;
476
- 'baths-1': string;
477
- 'sqft-1': string;
478
- 'city-1': string;
479
- 'image-src-2': string;
480
- 'href-2': string;
481
- 'price-2': string;
482
- 'beds-2': string;
483
- 'baths-2': string;
484
- 'sqft-2': string;
485
- 'city-2': string;
486
- 'image-src-3': string;
487
- 'href-3': string;
488
- 'price-3': string;
489
- 'beds-3': string;
490
- 'baths-3': string;
491
- 'sqft-3': string;
492
- 'city-3': string;
493
- };
494
- componentHeadStyle: (breakpoint: number) => string;
495
- renderCard(index: number): string;
496
- render(): string;
497
- }
498
-
499
276
  /**
500
277
  * JSON to MJML Converter
501
278
  * Converts template JSON to MJML string for rendering
@@ -514,4 +291,4 @@ interface RenderOptions {
514
291
  */
515
292
  declare function json2mjml(template: TemplateJSON, mode?: RenderMode, options?: RenderOptions): string;
516
293
 
517
- export { Editor, MjColproperty, MjPropertysingletwo, MjPropertytriplebetter, type OnSaveCallback, type TemplateJSON, TemplatePage, MjColproperty as default, json2mjml };
294
+ export { Editor, type OnSaveCallback, type TemplateJSON, TemplatePage, json2mjml };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { BodyComponent } from 'mjml-core';
3
2
 
4
3
  type PageElement = {
5
4
  id?: string;
@@ -274,228 +273,6 @@ declare function TemplatePage({ templateId, initialTemplate, onSave }: {
274
273
  onSave?: OnSaveCallback;
275
274
  }): react_jsx_runtime.JSX.Element;
276
275
 
277
- declare class MjColproperty extends BodyComponent {
278
- static componentName: string;
279
- static endingTag: boolean;
280
- static dependencies: {
281
- 'mj-column': string[];
282
- 'mj-colproperty': never[];
283
- };
284
- static allowedAttributes: {
285
- 'image-src': string;
286
- 'image-alt': string;
287
- price: string;
288
- address: string;
289
- city: string;
290
- country: string;
291
- beds: string;
292
- baths: string;
293
- sqft: string;
294
- href: string;
295
- status: string;
296
- 'status-color': string;
297
- 'is-new': string;
298
- brokerage: string;
299
- 'mls-logo': string;
300
- width: string;
301
- 'border-radius': string;
302
- description: string;
303
- 'is-open-house': string;
304
- 'open-house-date': string;
305
- 'open-house-time': string;
306
- border: string;
307
- 'font-family': string;
308
- 'text-color': string;
309
- 'is-description': string;
310
- 'is-brokerage': string;
311
- 'is-status': string;
312
- };
313
- static defaultAttributes: {
314
- 'image-src': string;
315
- 'image-alt': string;
316
- price: string;
317
- address: string;
318
- city: string;
319
- country: string;
320
- beds: string;
321
- baths: string;
322
- sqft: string;
323
- href: string;
324
- status: string;
325
- 'status-color': string;
326
- 'is-new': string;
327
- brokerage: string;
328
- 'mls-logo': string;
329
- 'border-radius': string;
330
- width: string;
331
- description: string;
332
- 'is-open-house': string;
333
- 'open-house-date': string;
334
- 'open-house-time': string;
335
- border: string;
336
- 'font-family': string;
337
- 'text-color': string;
338
- 'is-description': string;
339
- 'is-brokerage': string;
340
- 'is-status': string;
341
- };
342
- componentHeadStyle: (breakpoint: number) => string;
343
- render(): string;
344
- }
345
-
346
- declare class MjPropertysingletwo extends BodyComponent {
347
- static componentName: string;
348
- static endingTag: boolean;
349
- borderRadius: string;
350
- innerBorderRadius: string;
351
- uniqueId: string;
352
- constructor(initialDatas?: {});
353
- static dependencies: {
354
- 'mj-column': string[];
355
- 'mj-propertysingletwo': never[];
356
- };
357
- static allowedAttributes: {
358
- 'image-src': string;
359
- 'image-alt': string;
360
- price: string;
361
- address: string;
362
- city: string;
363
- country: string;
364
- beds: string;
365
- baths: string;
366
- sqft: string;
367
- href: string;
368
- status: string;
369
- 'status-color': string;
370
- 'is-new': string;
371
- brokerage: string;
372
- 'mls-logo': string;
373
- width: string;
374
- 'border-radius': string;
375
- description: string;
376
- 'is-open-house': string;
377
- 'open-house-date': string;
378
- 'open-house-time': string;
379
- border: string;
380
- 'font-family': string;
381
- 'text-color': string;
382
- 'is-description': string;
383
- 'is-brokerage': string;
384
- 'is-status': string;
385
- };
386
- static defaultAttributes: {
387
- 'image-src': string;
388
- 'image-alt': string;
389
- price: string;
390
- address: string;
391
- city: string;
392
- country: string;
393
- beds: string;
394
- baths: string;
395
- sqft: string;
396
- href: string;
397
- status: string;
398
- 'status-color': string;
399
- 'is-new': string;
400
- brokerage: string;
401
- 'mls-logo': string;
402
- 'border-radius': string;
403
- width: string;
404
- description: string;
405
- 'is-open-house': string;
406
- 'open-house-date': string;
407
- 'open-house-time': string;
408
- border: string;
409
- 'font-family': string;
410
- 'text-color': string;
411
- 'is-description': string;
412
- 'is-brokerage': string;
413
- 'is-status': string;
414
- };
415
- componentHeadStyle: (breakpoint: number) => string;
416
- render(): string;
417
- }
418
-
419
- declare class MjPropertytriplebetter extends BodyComponent {
420
- static componentName: string;
421
- static endingTag: boolean;
422
- borderRadius: string;
423
- innerBorderRadius: string;
424
- uniqueId: string;
425
- constructor(initialDatas?: {});
426
- static dependencies: {
427
- 'mj-column': string[];
428
- 'mj-propertytriple': never[];
429
- };
430
- static allowedAttributes: {
431
- width: string;
432
- 'card-width': string;
433
- gap: string;
434
- 'border-radius': string;
435
- border: string;
436
- 'image-height': string;
437
- 'font-family': string;
438
- 'text-color': string;
439
- 'background-color': string;
440
- 'image-src-1': string;
441
- 'href-1': string;
442
- 'price-1': string;
443
- 'beds-1': string;
444
- 'baths-1': string;
445
- 'sqft-1': string;
446
- 'city-1': string;
447
- 'image-src-2': string;
448
- 'href-2': string;
449
- 'price-2': string;
450
- 'beds-2': string;
451
- 'baths-2': string;
452
- 'sqft-2': string;
453
- 'city-2': string;
454
- 'image-src-3': string;
455
- 'href-3': string;
456
- 'price-3': string;
457
- 'beds-3': string;
458
- 'baths-3': string;
459
- 'sqft-3': string;
460
- 'city-3': string;
461
- };
462
- static defaultAttributes: {
463
- width: string;
464
- 'card-width': string;
465
- gap: string;
466
- 'border-radius': string;
467
- border: string;
468
- 'image-height': string;
469
- 'font-family': string;
470
- 'text-color': string;
471
- 'background-color': string;
472
- 'image-src-1': string;
473
- 'href-1': string;
474
- 'price-1': string;
475
- 'beds-1': string;
476
- 'baths-1': string;
477
- 'sqft-1': string;
478
- 'city-1': string;
479
- 'image-src-2': string;
480
- 'href-2': string;
481
- 'price-2': string;
482
- 'beds-2': string;
483
- 'baths-2': string;
484
- 'sqft-2': string;
485
- 'city-2': string;
486
- 'image-src-3': string;
487
- 'href-3': string;
488
- 'price-3': string;
489
- 'beds-3': string;
490
- 'baths-3': string;
491
- 'sqft-3': string;
492
- 'city-3': string;
493
- };
494
- componentHeadStyle: (breakpoint: number) => string;
495
- renderCard(index: number): string;
496
- render(): string;
497
- }
498
-
499
276
  /**
500
277
  * JSON to MJML Converter
501
278
  * Converts template JSON to MJML string for rendering
@@ -514,4 +291,4 @@ interface RenderOptions {
514
291
  */
515
292
  declare function json2mjml(template: TemplateJSON, mode?: RenderMode, options?: RenderOptions): string;
516
293
 
517
- export { Editor, MjColproperty, MjPropertysingletwo, MjPropertytriplebetter, type OnSaveCallback, type TemplateJSON, TemplatePage, MjColproperty as default, json2mjml };
294
+ export { Editor, type OnSaveCallback, type TemplateJSON, TemplatePage, json2mjml };