@bluepic/embed 0.1.51 → 0.1.52

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.
@@ -94757,7 +94757,6 @@ async function rasterize(m) {
94757
94757
  async function applyColorMatrix(m, c) {
94758
94758
  return m;
94759
94759
  }
94760
- pLimit(1);
94761
94760
  async function renderRemote(m, c, ne, we, $e, Me, Ze, ie, ii, di, li) {
94762
94761
  const mi = `${m}/api/export/${c}?${new URLSearchParams({
94763
94762
  env: "prod"
@@ -98489,7 +98488,7 @@ list should be an Array.`), er.length === 0)
98489
98488
  }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
98490
98489
  });
98491
98490
  })(object_hash);
98492
- const hash = object_hash.exports, embedAPIV2BaseUrl = {}.V_EMBEDV2_BACKEDND_URL, IMAGE_TTL_IN_SECONDS = 60 * 60 * 24 * 1;
98491
+ const hash = object_hash.exports, IMAGE_TTL_IN_SECONDS = 60 * 60 * 24 * 1;
98493
98492
  function parseCloudflareImagesDeliveryUrl(m) {
98494
98493
  try {
98495
98494
  const c = new URL(m);
@@ -98508,20 +98507,20 @@ function parseCloudflareImagesDeliveryUrl(m) {
98508
98507
  throw new Error("Invalid URL");
98509
98508
  }
98510
98509
  }
98511
- async function uploadImage(m, c, ne, we, $e) {
98512
- const Me = `${embedAPIV2BaseUrl}/api/image/session?${new URLSearchParams({
98513
- key: hash({ field: c.field, templateId: m }),
98510
+ async function uploadImage(m, c, ne, we, $e, Me) {
98511
+ const Ze = `${m}/api/image/session?${new URLSearchParams({
98512
+ key: hash({ field: ne.field, templateId: c }),
98514
98513
  ttl: String(IMAGE_TTL_IN_SECONDS)
98515
- })}`, Ze = new FormData();
98516
- Ze.append("file", ne, we);
98517
- const ie = await fetchWithProgressV1({
98518
- url: Me,
98514
+ })}`, ie = new FormData();
98515
+ ie.append("file", we, $e);
98516
+ const ii = await fetchWithProgressV1({
98517
+ url: Ze,
98519
98518
  method: "POST",
98520
- data: Ze,
98521
- onUploadProgress: $e
98519
+ data: ie,
98520
+ onUploadProgress: Me
98522
98521
  });
98523
- if (ie.type === "application/json")
98524
- return JSON.parse(await ie.text());
98522
+ if (ii.type === "application/json")
98523
+ return JSON.parse(await ii.text());
98525
98524
  throw new Error("Invalid response from Cloudflare Images");
98526
98525
  }
98527
98526
  const colorNames = {
@@ -99688,17 +99687,17 @@ class BluepicEmbed extends EventTarget {
99688
99687
  stripeEnv = ref$1("prod");
99689
99688
  init() {
99690
99689
  const c = `bluepic-app-${nanoid()}`;
99691
- this.embedProjectId && getProjectWithRetries("live.bluepic.io", this.embedProjectId, 3, 2e3, this.stripeEnv.value).then(({ embedProject: $e }) => {
99692
- const Me = Color($e.config.backgroundColor).isDark();
99693
- this.darkmode.value = Me, this.displayMode.value = $e.config.layout, this.allowPanAndZoom.value = $e.config.allowPanAndZoom, this.theme.value = (() => {
99690
+ this.embedProjectId && getProjectWithRetries("live.bluepic.io", this.embedProjectId, 3, 2e3, this.stripeEnv.value).then(({ embedProject: $e, isAllowedToDisableBranding: Me }) => {
99691
+ const Ze = Color($e.config.backgroundColor).isDark();
99692
+ this.darkmode.value = Ze, this.displayMode.value = $e.config.layout, this.allowPanAndZoom.value = $e.config.allowPanAndZoom, this.theme.value = (() => {
99694
99693
  if ($e.config.backgroundColor) {
99695
- const Ze = $e.config.backgroundColor, ie = Me ? Color(Ze).darken(0.1).hex() : Color(Ze).lighten(0.1).hex();
99694
+ const ie = $e.config.backgroundColor, ii = Ze ? Color(ie).darken(0.1).hex() : Color(ie).lighten(0.1).hex();
99696
99695
  return {
99697
- fieldsViewBackgroundColor: Ze,
99698
- editorViewBackgroundColor: ie
99696
+ fieldsViewBackgroundColor: ie,
99697
+ editorViewBackgroundColor: ii
99699
99698
  };
99700
99699
  }
99701
- })(), this.branding.value = $e.isAllowedToDisableBranding ? $e.config.bluepicBranding : !0, this.templateId.value = $e.templates[0];
99700
+ })(), this.branding.value = Me ? $e.config.bluepicBranding : !0, this.templateId.value = $e.templates[0];
99702
99701
  });
99703
99702
  const ne = document.createElement("style");
99704
99703
  ne.textContent = `
@@ -99754,6 +99753,7 @@ class BluepicEmbed extends EventTarget {
99754
99753
  bridge: {
99755
99754
  async handleUpload({ blob: Me, context: Ze, width: ie, height: ii, name: di, onProgress: li }) {
99756
99755
  const { variants: mi, filename: Ci, id: Ai } = await uploadImage(
99756
+ "https://embed-api-v2.bluepic.workers.dev",
99757
99757
  we.templateId.value,
99758
99758
  Ze,
99759
99759
  Me,