@bluepic/embed 0.6.3 → 0.6.5
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/dist/bluepic-embed.iife.js +2 -2
- package/dist/bluepic-embed.umd.js +2 -2
- package/dist/main.cjs +2 -2
- package/dist/main.mjs +2 -2
- package/package.json +1 -1
|
@@ -2183,7 +2183,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2183
2183
|
:zoom-and-pan="allowPanAndZoom"
|
|
2184
2184
|
:export-options="exportOptions"
|
|
2185
2185
|
:campaign-id="campaignId"
|
|
2186
|
-
:branding="
|
|
2186
|
+
:branding="branding"
|
|
2187
2187
|
:watermark="watermark && !isEmbeddedWithinBluepicStudio ? 'BLUEPIC' : undefined"
|
|
2188
2188
|
:export="campaign.config.export"
|
|
2189
2189
|
v-model:ready="ready"
|
|
@@ -2206,7 +2206,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2206
2206
|
</div>
|
|
2207
2207
|
|
|
2208
2208
|
</div>
|
|
2209
|
-
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:cF,BxSpin:Qv},setup(){let{createPopup:e}=jx();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await gC(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new wi.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await AB(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),
|
|
2209
|
+
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:cF,BxSpin:Qv},setup(){let{createPopup:e}=jx();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await gC(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new wi.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await AB(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),branding:n.branding,ready:(0,t.ref)(!1),watermark:!1,bearerToken:void 0,finalPassword:void 0,VITE_STUDIO_API_URL:n.apiBaseUrl.value,VITE_STRIPE_ENV:n.stripeEnv.value,enforceServerSideRendering:!1,enforceVideoServerSideRendering:!1}}}).mount(`#${this.id}`)})}setVariable(e,t){this.data.value||(this.data.value={}),this.data.value[e]=t}setData(e,t=!1){this.data.value=t?e:{...this.data.value,...e}}getTransform(){return this.editorRef.value?.templateViewRef?.transform}setTransform(e,t,n,r){let i=this.editorRef.value?.templateViewRef;i&&(i.transform={scale:e,translateX:t,translateY:n,rotate:r})}applyTransform(e,t,n){this.editorRef.value?.templateViewRef?.zoompinchRef?.applyTransform(e,t,n)}isMultiFrame(){return this.editorRef.value?.templateViewRef?.isMultiFrame}getCenteredFrame(){return this.editorRef.value?.templateViewRef?.currentlyFocusedFrame}centerFrame(e,t){this.editorRef.value?.templateViewRef?.focusFrame(e,t)}isReady(){return!!this.editorRef.value?.templateViewRef?.bxLiveTemplateRef?.ready}};async function PB(e,t,n,r,i){let a=0;for(;a<r;){try{let r=await fetch(`${e}/api/public/campaign?${new URLSearchParams({env:n,hostname:`template.bluepic.io`,slug:t.toString()})}`,{method:`GET`});if(!r.ok)throw Error(`Campaign fetch failed with status ${r.status}`);return await r.json()}catch(e){if(console.error(`[BluepicEmbed] campaign fetch attempt ${a+1} failed`,e),a<r-1)await new Promise(e=>setTimeout(e,i));else throw e}a++}throw Error(`Unknown error in fetchCampaignWithRetries`)}var FB=async()=>{let e=document.querySelectorAll(`.bluepic-embed[data-campaign-id]`);for(let t of e){let e=t.getAttribute(`data-campaign-id`);if(!e)continue;let n=t.getAttribute(`data-template-id`)??void 0,r=t.getAttribute(`data-stripe-env`)===`dev`?`dev`:`prod`,i=t.getAttribute(`data-init-data`),a=t.getAttribute(`data-api-base-url`)??`https://api.bluepic.io`,o=t.getAttribute(`data-remote-video-render-base-url`)??void 0,s=t.getAttribute(`data-bx-core-version`)??void 0,c=t.getAttribute(`data-theme`)??`auto`;new NB(t,e,{templateId:n,initData:i?JSON.parse(i):void 0,apiBaseUrl:a,remoteVideoRenderBaseUrl:o,bxCoreVersion:s,stripeEnv:r,theme:c})}};window.addEventListener(`load`,FB),window.BluepicEmbed=NB;var IB={class:`user-info`},LB={class:`user-content`},RB={key:0,class:`user-name`},zB={key:1,class:`user-email`},BB={key:0,class:`user-extra`},VB={class:`actions`},HB=aa((0,t.defineComponent)({__name:`UserInfo`,props:{user:{},showSettings:{type:Boolean,default:!1}},emits:[`logout`,`settings`],setup(e,{emit:n}){let r=n,i=(0,t.useSlots)();return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,IB,[(0,t.createElementVNode)(`main`,null,[(0,t.createVNode)(qR,{user:e.user,width:40,height:40},null,8,[`user`]),(0,t.createElementVNode)(`div`,LB,[e.user.name?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,RB,(0,t.toDisplayString)(e.user.name),1)):(0,t.createCommentVNode)(``,!0),e.user.email?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,zB,(0,t.toDisplayString)(e.user.email),1)):(0,t.createCommentVNode)(``,!0)])]),i.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,BB,[(0,t.renderSlot)(n.$slots,`default`,{},void 0,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`footer`,null,[(0,t.createElementVNode)(`div`,VB,[e.showSettings?((0,t.openBlock)(),(0,t.createBlock)(ty,{key:0,size:`medium`,onClick:a[0]||=e=>r(`settings`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(gb,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vte))]),_:1})]),default:(0,t.withCtx)(()=>[a[2]||=(0,t.createTextVNode)(` Settings `,-1)]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(ty,{size:`medium`,onClick:a[1]||=e=>r(`logout`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(gb,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(lte))]),_:1})]),default:(0,t.withCtx)(()=>[a[3]||=(0,t.createTextVNode)(` Logout `,-1)]),_:1})])])]))}}),[[`__scopeId`,`data-v-8e175b2d`]]),UB={class:`category-tabs`},WB={class:`tabs-wrapper`},GB=[`onClick`],KB=aa((0,t.defineComponent)({__name:`Tabs`,props:(0,t.mergeModels)({tabs:{}},{activeTab:{required:!0},activeTabModifiers:{}}),emits:(0,t.mergeModels)([`click:category`],[`update:activeTab`]),setup(e,{emit:n}){let r=n,i=(0,t.useModel)(e,`activeTab`);function a(e){i.value=e,r(`click:category`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,UB,[(0,t.createElementVNode)(`div`,WB,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.tabs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,class:(0,t.normalizeClass)({active:e===i.value}),onClick:t=>a(e)},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e),1)],10,GB))),128))])]))}}),[[`__scopeId`,`data-v-a1d3c812`]]),qB=[`A0`,`A1`,`A2`,`A3`,`A4`,`A5`,`A6`,`A7`,`A8`,`A9`,`A10`],JB={w:841,h:1189};function YB(){let e=[{w:JB.w,h:JB.h}];for(let t=1;t<=10;t++){let n=e[t-1],r=Math.round(n.h/2),i=n.w,a=r<=i?{w:r,h:i}:{w:i,h:r};e.push(a)}let t={};return qB.forEach((n,r)=>t[n]=e[r]),t}var XB=YB(),ZB=25.4;function QB(e){return e/ZB}function $B(e,t){return e*t}function eV(e,t){return e/t*ZB}function tV(e,t){let n=XB[e],r=QB(n.w),i=QB(n.h),a=$B(r,t),o=$B(i,t);return{widthPx:Math.round(a),heightPx:Math.round(o),widthPxExact:a,heightPxExact:o,aspect:n.h/n.w,sizeMm:{w:n.w,h:n.h}}}function nV(e,t,n,r=2){let i=e>t,[a,o]=e<=t?[e,t]:[t,e],s=eV(a,n),c=eV(o,n),l=null;for(let e of qB){let t=XB[e],n=s-t.w,i=c-t.h;if(Math.abs(n)<=r&&Math.abs(i)<=r){let r=Math.abs(n)+Math.abs(i);(!l||r<l.score)&&(l={level:e,score:r,delta:{dw:n,dh:i},iso:t})}}if(!l)return null;let u=c/s,d=Math.abs(u/Math.SQRT2-1);return{level:l.level,matchedOrientation:i?`landscape`:`portrait`,measuredMm:{w:s,h:c},isoMm:{w:l.iso.w,h:l.iso.h},deltaMm:l.delta,aspectError:d}}function rV(e){let t=window.getSelection();if(!t)throw Error(`No selection descriptor`);if(!t.anchorNode)throw Error(`No anchor node`);if(!t.focusNode)throw Error(`No focus node`);if(t.anchorNode.textContent===null)throw Error(`Anchor node's text content: null`);if(t.focusNode.textContent===null)throw Error(`Focus node's text content: null`);let n=oV(e,e=>e===t.anchorNode),r=oV(e,e=>e===t.focusNode),i=n.length+t.anchorOffset;return{start:i,length:r.length+t.focusOffset-i}}function iV(e){let n=(0,t.ref)(null);function r(){let t=document.getSelection();if(e.value&&t&&t.rangeCount>0){let r=t.getRangeAt(0);if(e.value.contains(r.commonAncestorContainer))try{n.value=rV(e.value)}catch(e){console.error(`Failed to get selection`,e),n.value=null}}}return document.addEventListener(`selectionchange`,r),(0,t.onUnmounted)(()=>{document.removeEventListener(`selectionchange`,r)}),n}function aV({text:e,format:t},...n){return{text:e.slice(...n),format:t}}function oV(e,t){let n=document.createTreeWalker(e),r=n.nextNode(),i=``;for(;r;){if(t(r))return i;let e=n.nextNode();if(r.nodeType===Node.TEXT_NODE)i+=r.textContent??``;else if(r.nodeType===Node.ELEMENT_NODE){let e=r;(e.tagName===`BR`||e.tagName===`DIV`&&!i.endsWith(`
|
|
2210
2210
|
`)&&i!==``)&&(i+=`
|
|
2211
2211
|
`)}r=e}return i.endsWith(`
|
|
2212
2212
|
`)&&(i=i.slice(0,-1)),i}window.collectContentEditableText=oV;function sV(e,t){let n=``;function r(e){if(!e)return``;let n=``,i=e.previousSibling;for(;i;){if(i.nodeType===Node.TEXT_NODE)n=i.textContent+n;else if(i.nodeType===Node.ELEMENT_NODE){let e=i;n=e.tagName===`BR`?`
|
|
@@ -2183,7 +2183,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2183
2183
|
:zoom-and-pan="allowPanAndZoom"
|
|
2184
2184
|
:export-options="exportOptions"
|
|
2185
2185
|
:campaign-id="campaignId"
|
|
2186
|
-
:branding="
|
|
2186
|
+
:branding="branding"
|
|
2187
2187
|
:watermark="watermark && !isEmbeddedWithinBluepicStudio ? 'BLUEPIC' : undefined"
|
|
2188
2188
|
:export="campaign.config.export"
|
|
2189
2189
|
v-model:ready="ready"
|
|
@@ -2206,7 +2206,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2206
2206
|
</div>
|
|
2207
2207
|
|
|
2208
2208
|
</div>
|
|
2209
|
-
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:cF,BxSpin:Qv},setup(){let{createPopup:e}=jx();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await gC(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new wi.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await AB(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),
|
|
2209
|
+
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:cF,BxSpin:Qv},setup(){let{createPopup:e}=jx();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await gC(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new wi.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await AB(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),branding:n.branding,ready:(0,t.ref)(!1),watermark:!1,bearerToken:void 0,finalPassword:void 0,VITE_STUDIO_API_URL:n.apiBaseUrl.value,VITE_STRIPE_ENV:n.stripeEnv.value,enforceServerSideRendering:!1,enforceVideoServerSideRendering:!1}}}).mount(`#${this.id}`)})}setVariable(e,t){this.data.value||(this.data.value={}),this.data.value[e]=t}setData(e,t=!1){this.data.value=t?e:{...this.data.value,...e}}getTransform(){return this.editorRef.value?.templateViewRef?.transform}setTransform(e,t,n,r){let i=this.editorRef.value?.templateViewRef;i&&(i.transform={scale:e,translateX:t,translateY:n,rotate:r})}applyTransform(e,t,n){this.editorRef.value?.templateViewRef?.zoompinchRef?.applyTransform(e,t,n)}isMultiFrame(){return this.editorRef.value?.templateViewRef?.isMultiFrame}getCenteredFrame(){return this.editorRef.value?.templateViewRef?.currentlyFocusedFrame}centerFrame(e,t){this.editorRef.value?.templateViewRef?.focusFrame(e,t)}isReady(){return!!this.editorRef.value?.templateViewRef?.bxLiveTemplateRef?.ready}};async function PB(e,t,n,r,i){let a=0;for(;a<r;){try{let r=await fetch(`${e}/api/public/campaign?${new URLSearchParams({env:n,hostname:`template.bluepic.io`,slug:t.toString()})}`,{method:`GET`});if(!r.ok)throw Error(`Campaign fetch failed with status ${r.status}`);return await r.json()}catch(e){if(console.error(`[BluepicEmbed] campaign fetch attempt ${a+1} failed`,e),a<r-1)await new Promise(e=>setTimeout(e,i));else throw e}a++}throw Error(`Unknown error in fetchCampaignWithRetries`)}var FB=async()=>{let e=document.querySelectorAll(`.bluepic-embed[data-campaign-id]`);for(let t of e){let e=t.getAttribute(`data-campaign-id`);if(!e)continue;let n=t.getAttribute(`data-template-id`)??void 0,r=t.getAttribute(`data-stripe-env`)===`dev`?`dev`:`prod`,i=t.getAttribute(`data-init-data`),a=t.getAttribute(`data-api-base-url`)??`https://api.bluepic.io`,o=t.getAttribute(`data-remote-video-render-base-url`)??void 0,s=t.getAttribute(`data-bx-core-version`)??void 0,c=t.getAttribute(`data-theme`)??`auto`;new NB(t,e,{templateId:n,initData:i?JSON.parse(i):void 0,apiBaseUrl:a,remoteVideoRenderBaseUrl:o,bxCoreVersion:s,stripeEnv:r,theme:c})}};window.addEventListener(`load`,FB),window.BluepicEmbed=NB;var IB={class:`user-info`},LB={class:`user-content`},RB={key:0,class:`user-name`},zB={key:1,class:`user-email`},BB={key:0,class:`user-extra`},VB={class:`actions`},HB=aa((0,t.defineComponent)({__name:`UserInfo`,props:{user:{},showSettings:{type:Boolean,default:!1}},emits:[`logout`,`settings`],setup(e,{emit:n}){let r=n,i=(0,t.useSlots)();return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,IB,[(0,t.createElementVNode)(`main`,null,[(0,t.createVNode)(qR,{user:e.user,width:40,height:40},null,8,[`user`]),(0,t.createElementVNode)(`div`,LB,[e.user.name?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,RB,(0,t.toDisplayString)(e.user.name),1)):(0,t.createCommentVNode)(``,!0),e.user.email?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,zB,(0,t.toDisplayString)(e.user.email),1)):(0,t.createCommentVNode)(``,!0)])]),i.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,BB,[(0,t.renderSlot)(n.$slots,`default`,{},void 0,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`footer`,null,[(0,t.createElementVNode)(`div`,VB,[e.showSettings?((0,t.openBlock)(),(0,t.createBlock)(ty,{key:0,size:`medium`,onClick:a[0]||=e=>r(`settings`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(gb,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vte))]),_:1})]),default:(0,t.withCtx)(()=>[a[2]||=(0,t.createTextVNode)(` Settings `,-1)]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(ty,{size:`medium`,onClick:a[1]||=e=>r(`logout`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(gb,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(lte))]),_:1})]),default:(0,t.withCtx)(()=>[a[3]||=(0,t.createTextVNode)(` Logout `,-1)]),_:1})])])]))}}),[[`__scopeId`,`data-v-8e175b2d`]]),UB={class:`category-tabs`},WB={class:`tabs-wrapper`},GB=[`onClick`],KB=aa((0,t.defineComponent)({__name:`Tabs`,props:(0,t.mergeModels)({tabs:{}},{activeTab:{required:!0},activeTabModifiers:{}}),emits:(0,t.mergeModels)([`click:category`],[`update:activeTab`]),setup(e,{emit:n}){let r=n,i=(0,t.useModel)(e,`activeTab`);function a(e){i.value=e,r(`click:category`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,UB,[(0,t.createElementVNode)(`div`,WB,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.tabs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,class:(0,t.normalizeClass)({active:e===i.value}),onClick:t=>a(e)},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e),1)],10,GB))),128))])]))}}),[[`__scopeId`,`data-v-a1d3c812`]]),qB=[`A0`,`A1`,`A2`,`A3`,`A4`,`A5`,`A6`,`A7`,`A8`,`A9`,`A10`],JB={w:841,h:1189};function YB(){let e=[{w:JB.w,h:JB.h}];for(let t=1;t<=10;t++){let n=e[t-1],r=Math.round(n.h/2),i=n.w,a=r<=i?{w:r,h:i}:{w:i,h:r};e.push(a)}let t={};return qB.forEach((n,r)=>t[n]=e[r]),t}var XB=YB(),ZB=25.4;function QB(e){return e/ZB}function $B(e,t){return e*t}function eV(e,t){return e/t*ZB}function tV(e,t){let n=XB[e],r=QB(n.w),i=QB(n.h),a=$B(r,t),o=$B(i,t);return{widthPx:Math.round(a),heightPx:Math.round(o),widthPxExact:a,heightPxExact:o,aspect:n.h/n.w,sizeMm:{w:n.w,h:n.h}}}function nV(e,t,n,r=2){let i=e>t,[a,o]=e<=t?[e,t]:[t,e],s=eV(a,n),c=eV(o,n),l=null;for(let e of qB){let t=XB[e],n=s-t.w,i=c-t.h;if(Math.abs(n)<=r&&Math.abs(i)<=r){let r=Math.abs(n)+Math.abs(i);(!l||r<l.score)&&(l={level:e,score:r,delta:{dw:n,dh:i},iso:t})}}if(!l)return null;let u=c/s,d=Math.abs(u/Math.SQRT2-1);return{level:l.level,matchedOrientation:i?`landscape`:`portrait`,measuredMm:{w:s,h:c},isoMm:{w:l.iso.w,h:l.iso.h},deltaMm:l.delta,aspectError:d}}function rV(e){let t=window.getSelection();if(!t)throw Error(`No selection descriptor`);if(!t.anchorNode)throw Error(`No anchor node`);if(!t.focusNode)throw Error(`No focus node`);if(t.anchorNode.textContent===null)throw Error(`Anchor node's text content: null`);if(t.focusNode.textContent===null)throw Error(`Focus node's text content: null`);let n=oV(e,e=>e===t.anchorNode),r=oV(e,e=>e===t.focusNode),i=n.length+t.anchorOffset;return{start:i,length:r.length+t.focusOffset-i}}function iV(e){let n=(0,t.ref)(null);function r(){let t=document.getSelection();if(e.value&&t&&t.rangeCount>0){let r=t.getRangeAt(0);if(e.value.contains(r.commonAncestorContainer))try{n.value=rV(e.value)}catch(e){console.error(`Failed to get selection`,e),n.value=null}}}return document.addEventListener(`selectionchange`,r),(0,t.onUnmounted)(()=>{document.removeEventListener(`selectionchange`,r)}),n}function aV({text:e,format:t},...n){return{text:e.slice(...n),format:t}}function oV(e,t){let n=document.createTreeWalker(e),r=n.nextNode(),i=``;for(;r;){if(t(r))return i;let e=n.nextNode();if(r.nodeType===Node.TEXT_NODE)i+=r.textContent??``;else if(r.nodeType===Node.ELEMENT_NODE){let e=r;(e.tagName===`BR`||e.tagName===`DIV`&&!i.endsWith(`
|
|
2210
2210
|
`)&&i!==``)&&(i+=`
|
|
2211
2211
|
`)}r=e}return i.endsWith(`
|
|
2212
2212
|
`)&&(i=i.slice(0,-1)),i}window.collectContentEditableText=oV;function sV(e,t){let n=``;function r(e){if(!e)return``;let n=``,i=e.previousSibling;for(;i;){if(i.nodeType===Node.TEXT_NODE)n=i.textContent+n;else if(i.nodeType===Node.ELEMENT_NODE){let e=i;n=e.tagName===`BR`?`
|
package/dist/main.cjs
CHANGED
|
@@ -2169,7 +2169,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2169
2169
|
:zoom-and-pan="allowPanAndZoom"
|
|
2170
2170
|
:export-options="exportOptions"
|
|
2171
2171
|
:campaign-id="campaignId"
|
|
2172
|
-
:branding="
|
|
2172
|
+
:branding="branding"
|
|
2173
2173
|
:watermark="watermark && !isEmbeddedWithinBluepicStudio ? 'BLUEPIC' : undefined"
|
|
2174
2174
|
:export="campaign.config.export"
|
|
2175
2175
|
v-model:ready="ready"
|
|
@@ -2192,7 +2192,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
2192
2192
|
</div>
|
|
2193
2193
|
|
|
2194
2194
|
</div>
|
|
2195
|
-
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:uU,BxSpin:Wy},setup(){let{createPopup:e}=Rw();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await mO(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new _i.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await tq(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),
|
|
2195
|
+
`;let n=this;(0,t.nextTick)(()=>{(0,t.createApp)({components:{BxTemplateEditor:uU,BxSpin:Wy},setup(){let{createPopup:e}=Rw();return{bridge:{async handleUpload({blob:e,context:t,width:r,height:i,name:a,onProgress:o}){let s=await mO(e),c=s.width/s.height,l=r/i,u,d;c>l?d=i:u=r;let f=await new Promise((t,n)=>{new _i.default(e,{maxWidth:u,maxHeight:d,checkOrientation:!0,quality:.95,success(e){t(e)},error(){t(e)}})}),{url:p,key:m}=await tq(n.apiBaseUrl.value,n.templateId.value,t,f,a,(e,t)=>{o(e/t)}),h=p;if(!h)throw Error(`No public variant`);return{width:r,height:i,key:m,name:`Session Image #${m}`,src:h}},async handleSocialShare(e,t,n,r){return{status:`error`,message:`Social share failed`}}},templateName:n.templateName,editorRef:n.editorRef,campaignId:n.campaignId,campaign:n.campaign,allowPanAndZoom:n.allowPanAndZoom,templateId:n.templateId,serial:n.serial,preview:n.preview,apiBaseUrl:n.apiBaseUrl,data:n.data,bxCoreVersion:n.bxCoreVersion,bxThemeStyleVars:n.bxThemeStyleVars,stripeEnv:n.stripeEnv,remoteVideoRenderBaseUrl:n.remoteVideoRenderBaseUrl,exportOptions:(0,t.computed)(()=>{if(n.campaign.value)return n.campaign.value.config.export}),branding:n.branding,ready:(0,t.ref)(!1),watermark:!1,bearerToken:void 0,finalPassword:void 0,VITE_STUDIO_API_URL:n.apiBaseUrl.value,VITE_STRIPE_ENV:n.stripeEnv.value,enforceServerSideRendering:!1,enforceVideoServerSideRendering:!1}}}).mount(`#${this.id}`)})}setVariable(e,t){this.data.value||(this.data.value={}),this.data.value[e]=t}setData(e,t=!1){this.data.value=t?e:{...this.data.value,...e}}getTransform(){return this.editorRef.value?.templateViewRef?.transform}setTransform(e,t,n,r){let i=this.editorRef.value?.templateViewRef;i&&(i.transform={scale:e,translateX:t,translateY:n,rotate:r})}applyTransform(e,t,n){this.editorRef.value?.templateViewRef?.zoompinchRef?.applyTransform(e,t,n)}isMultiFrame(){return this.editorRef.value?.templateViewRef?.isMultiFrame}getCenteredFrame(){return this.editorRef.value?.templateViewRef?.currentlyFocusedFrame}centerFrame(e,t){this.editorRef.value?.templateViewRef?.focusFrame(e,t)}isReady(){return!!this.editorRef.value?.templateViewRef?.bxLiveTemplateRef?.ready}};async function aq(e,t,n,r,i){let a=0;for(;a<r;){try{let r=await fetch(`${e}/api/public/campaign?${new URLSearchParams({env:n,hostname:`template.bluepic.io`,slug:t.toString()})}`,{method:`GET`});if(!r.ok)throw Error(`Campaign fetch failed with status ${r.status}`);return await r.json()}catch(e){if(console.error(`[BluepicEmbed] campaign fetch attempt ${a+1} failed`,e),a<r-1)await new Promise(e=>setTimeout(e,i));else throw e}a++}throw Error(`Unknown error in fetchCampaignWithRetries`)}var oq=async()=>{let e=document.querySelectorAll(`.bluepic-embed[data-campaign-id]`);for(let t of e){let e=t.getAttribute(`data-campaign-id`);if(!e)continue;let n=t.getAttribute(`data-template-id`)??void 0,r=t.getAttribute(`data-stripe-env`)===`dev`?`dev`:`prod`,i=t.getAttribute(`data-init-data`),a=t.getAttribute(`data-api-base-url`)??`https://api.bluepic.io`,o=t.getAttribute(`data-remote-video-render-base-url`)??void 0,s=t.getAttribute(`data-bx-core-version`)??void 0,c=t.getAttribute(`data-theme`)??`auto`;new iq(t,e,{templateId:n,initData:i?JSON.parse(i):void 0,apiBaseUrl:a,remoteVideoRenderBaseUrl:o,bxCoreVersion:s,stripeEnv:r,theme:c})}};window.addEventListener(`load`,oq),window.BluepicEmbed=iq;var sq={class:`user-info`},cq={class:`user-content`},lq={key:0,class:`user-name`},uq={key:1,class:`user-email`},dq={key:0,class:`user-extra`},fq={class:`actions`},pq=V((0,t.defineComponent)({__name:`UserInfo`,props:{user:{},showSettings:{type:Boolean,default:!1}},emits:[`logout`,`settings`],setup(e,{emit:n}){let r=n,i=(0,t.useSlots)();return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,sq,[(0,t.createElementVNode)(`main`,null,[(0,t.createVNode)(vG,{user:e.user,width:40,height:40},null,8,[`user`]),(0,t.createElementVNode)(`div`,cq,[e.user.name?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,lq,(0,t.toDisplayString)(e.user.name),1)):(0,t.createCommentVNode)(``,!0),e.user.email?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,uq,(0,t.toDisplayString)(e.user.email),1)):(0,t.createCommentVNode)(``,!0)])]),i.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,dq,[(0,t.renderSlot)(n.$slots,`default`,{},void 0,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`footer`,null,[(0,t.createElementVNode)(`div`,fq,[e.showSettings?((0,t.openBlock)(),(0,t.createBlock)(X,{key:0,size:`medium`,onClick:a[0]||=e=>r(`settings`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(Z,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Bx))]),_:1})]),default:(0,t.withCtx)(()=>[a[2]||=(0,t.createTextVNode)(` Settings `,-1)]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(X,{size:`medium`,onClick:a[1]||=e=>r(`logout`)},{icon:(0,t.withCtx)(()=>[(0,t.createVNode)(Z,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(cx))]),_:1})]),default:(0,t.withCtx)(()=>[a[3]||=(0,t.createTextVNode)(` Logout `,-1)]),_:1})])])]))}}),[[`__scopeId`,`data-v-8e175b2d`]]),mq={class:`category-tabs`},hq={class:`tabs-wrapper`},gq=[`onClick`],_q=V((0,t.defineComponent)({__name:`Tabs`,props:(0,t.mergeModels)({tabs:{}},{activeTab:{required:!0},activeTabModifiers:{}}),emits:(0,t.mergeModels)([`click:category`],[`update:activeTab`]),setup(e,{emit:n}){let r=n,i=(0,t.useModel)(e,`activeTab`);function a(e){i.value=e,r(`click:category`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mq,[(0,t.createElementVNode)(`div`,hq,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.tabs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,class:(0,t.normalizeClass)({active:e===i.value}),onClick:t=>a(e)},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e),1)],10,gq))),128))])]))}}),[[`__scopeId`,`data-v-a1d3c812`]]),vq=[`A0`,`A1`,`A2`,`A3`,`A4`,`A5`,`A6`,`A7`,`A8`,`A9`,`A10`],yq={w:841,h:1189};function bq(){let e=[{w:yq.w,h:yq.h}];for(let t=1;t<=10;t++){let n=e[t-1],r=Math.round(n.h/2),i=n.w,a=r<=i?{w:r,h:i}:{w:i,h:r};e.push(a)}let t={};return vq.forEach((n,r)=>t[n]=e[r]),t}var xq=bq(),Sq=25.4;function Cq(e){return e/Sq}function wq(e,t){return e*t}function Tq(e,t){return e/t*Sq}function Eq(e,t){let n=xq[e],r=Cq(n.w),i=Cq(n.h),a=wq(r,t),o=wq(i,t);return{widthPx:Math.round(a),heightPx:Math.round(o),widthPxExact:a,heightPxExact:o,aspect:n.h/n.w,sizeMm:{w:n.w,h:n.h}}}function Dq(e,t,n,r=2){let i=e>t,[a,o]=e<=t?[e,t]:[t,e],s=Tq(a,n),c=Tq(o,n),l=null;for(let e of vq){let t=xq[e],n=s-t.w,i=c-t.h;if(Math.abs(n)<=r&&Math.abs(i)<=r){let r=Math.abs(n)+Math.abs(i);(!l||r<l.score)&&(l={level:e,score:r,delta:{dw:n,dh:i},iso:t})}}if(!l)return null;let u=c/s,d=Math.abs(u/Math.SQRT2-1);return{level:l.level,matchedOrientation:i?`landscape`:`portrait`,measuredMm:{w:s,h:c},isoMm:{w:l.iso.w,h:l.iso.h},deltaMm:l.delta,aspectError:d}}function Oq(e){let t=window.getSelection();if(!t)throw Error(`No selection descriptor`);if(!t.anchorNode)throw Error(`No anchor node`);if(!t.focusNode)throw Error(`No focus node`);if(t.anchorNode.textContent===null)throw Error(`Anchor node's text content: null`);if(t.focusNode.textContent===null)throw Error(`Focus node's text content: null`);let n=jq(e,e=>e===t.anchorNode),r=jq(e,e=>e===t.focusNode),i=n.length+t.anchorOffset;return{start:i,length:r.length+t.focusOffset-i}}function kq(e){let n=(0,t.ref)(null);function r(){let t=document.getSelection();if(e.value&&t&&t.rangeCount>0){let r=t.getRangeAt(0);if(e.value.contains(r.commonAncestorContainer))try{n.value=Oq(e.value)}catch(e){console.error(`Failed to get selection`,e),n.value=null}}}return document.addEventListener(`selectionchange`,r),(0,t.onUnmounted)(()=>{document.removeEventListener(`selectionchange`,r)}),n}function Aq({text:e,format:t},...n){return{text:e.slice(...n),format:t}}function jq(e,t){let n=document.createTreeWalker(e),r=n.nextNode(),i=``;for(;r;){if(t(r))return i;let e=n.nextNode();if(r.nodeType===Node.TEXT_NODE)i+=r.textContent??``;else if(r.nodeType===Node.ELEMENT_NODE){let e=r;(e.tagName===`BR`||e.tagName===`DIV`&&!i.endsWith(`
|
|
2196
2196
|
`)&&i!==``)&&(i+=`
|
|
2197
2197
|
`)}r=e}return i.endsWith(`
|
|
2198
2198
|
`)&&(i=i.slice(0,-1)),i}window.collectContentEditableText=jq;function Mq(e,t){let n=``;function r(e){if(!e)return``;let n=``,i=e.previousSibling;for(;i;){if(i.nodeType===Node.TEXT_NODE)n=i.textContent+n;else if(i.nodeType===Node.ELEMENT_NODE){let e=i;n=e.tagName===`BR`?`
|
package/dist/main.mjs
CHANGED
|
@@ -72696,7 +72696,7 @@ var rJ = "https://bx-studio-api-production.bluepic.workers.dev", iJ = "https://r
|
|
|
72696
72696
|
:zoom-and-pan="allowPanAndZoom"
|
|
72697
72697
|
:export-options="exportOptions"
|
|
72698
72698
|
:campaign-id="campaignId"
|
|
72699
|
-
:branding="
|
|
72699
|
+
:branding="branding"
|
|
72700
72700
|
:watermark="watermark && !isEmbeddedWithinBluepicStudio ? 'BLUEPIC' : undefined"
|
|
72701
72701
|
:export="campaign.config.export"
|
|
72702
72702
|
v-model:ready="ready"
|
|
@@ -72783,7 +72783,7 @@ var rJ = "https://bx-studio-api-production.bluepic.workers.dev", iJ = "https://r
|
|
|
72783
72783
|
exportOptions: l(() => {
|
|
72784
72784
|
if (t.campaign.value) return t.campaign.value.config.export;
|
|
72785
72785
|
}),
|
|
72786
|
-
|
|
72786
|
+
branding: t.branding,
|
|
72787
72787
|
ready: L(!1),
|
|
72788
72788
|
watermark: !1,
|
|
72789
72789
|
bearerToken: void 0,
|