@pairbo/ui-kit 0.1.1 → 0.2.1
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/pairbo.es.js +140 -91
- package/dist/pairbo.umd.js +40 -36
- package/dist/src/components/editor/editor.component.d.ts +5 -2
- package/dist/src/components/handwritten-form/handwritten-form.component.d.ts +8 -0
- package/dist/src/components/page-manager/page-manager.component.d.ts +7 -1
- package/dist/src/components/type-form/type-form.component.d.ts +3 -7
- package/dist/src/core/pbo-bridge/PboBridge.d.ts +21 -22
- package/dist/src/core/pbo-bridge/createPboBridge.d.ts +2 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/mocks/shopifyHandler.d.ts +1 -0
- package/dist/src/utilities/{mobile.d.ts → index.d.ts} +1 -0
- package/package.json +1 -1
package/dist/pairbo.es.js
CHANGED
|
@@ -12841,6 +12841,7 @@ let PboSelector = class extends r$5 {
|
|
|
12841
12841
|
firstUpdated() {
|
|
12842
12842
|
this._initializeChoices();
|
|
12843
12843
|
}
|
|
12844
|
+
// @ts-ignore
|
|
12844
12845
|
_initializeChoices() {
|
|
12845
12846
|
var _a2;
|
|
12846
12847
|
(_a2 = this._choices) == null ? void 0 : _a2.destroy();
|
|
@@ -15246,6 +15247,15 @@ const styles$b = i$7`
|
|
|
15246
15247
|
font-size: var(--pbo-font-size-medium);
|
|
15247
15248
|
}
|
|
15248
15249
|
`;
|
|
15250
|
+
const isMobileDevice = () => {
|
|
15251
|
+
return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
15252
|
+
};
|
|
15253
|
+
const isValid = (value) => {
|
|
15254
|
+
return value !== null && value !== void 0;
|
|
15255
|
+
};
|
|
15256
|
+
const removeNullUndefined = (obj) => Object.entries(obj).reduce((acc, [k3, v2]) => {
|
|
15257
|
+
return v2 == null ? acc : (acc[k3] = v2, acc);
|
|
15258
|
+
}, {});
|
|
15249
15259
|
var __defProp$c = Object.defineProperty;
|
|
15250
15260
|
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
15251
15261
|
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
@@ -15261,15 +15271,13 @@ let PboTypeForm$1 = class PboTypeForm extends PairboElement {
|
|
|
15261
15271
|
super(...arguments);
|
|
15262
15272
|
this.windowHeight = window.innerHeight;
|
|
15263
15273
|
this.resizeTimeout = null;
|
|
15264
|
-
this.formData = {
|
|
15265
|
-
font: "",
|
|
15266
|
-
text: "",
|
|
15267
|
-
color: "",
|
|
15268
|
-
alignment: ""
|
|
15269
|
-
};
|
|
15270
15274
|
this.charsNum = 0;
|
|
15271
15275
|
this.ctaButtonState = PboTypeForm$1.CTA_STATES.primary;
|
|
15272
15276
|
this.cardInnerImageUrl = "../../../public/Greeting Card from Pairbo.png";
|
|
15277
|
+
this.card = null;
|
|
15278
|
+
this.submitTypeForm = (formData) => {
|
|
15279
|
+
console.error("submitTypingForm function not implemented", formData);
|
|
15280
|
+
};
|
|
15273
15281
|
this.handleResize = () => {
|
|
15274
15282
|
if (this.resizeTimeout) {
|
|
15275
15283
|
window.clearTimeout(this.resizeTimeout);
|
|
@@ -15284,34 +15292,24 @@ let PboTypeForm$1 = class PboTypeForm extends PairboElement {
|
|
|
15284
15292
|
alert("Please add a message to continue");
|
|
15285
15293
|
});
|
|
15286
15294
|
}
|
|
15287
|
-
get
|
|
15288
|
-
var _a2, _b, _c, _d;
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15295
|
+
get formData() {
|
|
15296
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h;
|
|
15297
|
+
const formData = {
|
|
15298
|
+
pboCardId: ((_a2 = this.card) == null ? void 0 : _a2.pboId) || "Unknown",
|
|
15299
|
+
productId: (_b = this.card) == null ? void 0 : _b.productId,
|
|
15300
|
+
sku: (_c = this.card) == null ? void 0 : _c.sku,
|
|
15301
|
+
variantId: (_d = this.card) == null ? void 0 : _d.variantId,
|
|
15302
|
+
font: ((_e2 = this.fontSelector) == null ? void 0 : _e2.value) || "",
|
|
15303
|
+
text: ((_f = this.greetingText) == null ? void 0 : _f.value) || "",
|
|
15304
|
+
color: ((_g = this.textColor) == null ? void 0 : _g.value) || "",
|
|
15305
|
+
alignment: ((_h = this.textAlignment) == null ? void 0 : _h.value) || ""
|
|
15294
15306
|
};
|
|
15307
|
+
return removeNullUndefined(formData);
|
|
15295
15308
|
}
|
|
15296
15309
|
handleFormChange(e3) {
|
|
15297
|
-
var _a2;
|
|
15298
15310
|
this.ctaButtonState = PboTypeForm$1.CTA_STATES.primary;
|
|
15299
|
-
const target = e3.target;
|
|
15300
|
-
const tempForm = {
|
|
15301
|
-
...this.formData
|
|
15302
|
-
};
|
|
15303
|
-
if (target.classList.contains("font-selector")) {
|
|
15304
|
-
tempForm.font = ((_a2 = target == null ? void 0 : target.value) == null ? void 0 : _a2.value) || " Font form control not implemented yet";
|
|
15305
|
-
} else if (target.classList.contains("greeting-text")) {
|
|
15306
|
-
tempForm.text = target.value;
|
|
15307
|
-
} else if (target.classList.contains("text-color")) {
|
|
15308
|
-
tempForm.color = target.value;
|
|
15309
|
-
} else if (target.classList.contains("text-alignment")) {
|
|
15310
|
-
tempForm.alignment = target.value;
|
|
15311
|
-
}
|
|
15312
|
-
this.formData = { ...tempForm };
|
|
15313
15311
|
this.emit("pbo-change", {
|
|
15314
|
-
detail: this.
|
|
15312
|
+
detail: this.formData
|
|
15315
15313
|
});
|
|
15316
15314
|
}
|
|
15317
15315
|
hostConnected() {
|
|
@@ -15326,7 +15324,7 @@ let PboTypeForm$1 = class PboTypeForm extends PairboElement {
|
|
|
15326
15324
|
const submitterName = (_a2 = e3.submitter) == null ? void 0 : _a2.name;
|
|
15327
15325
|
if (this.ctaButtonState.type === "danger") {
|
|
15328
15326
|
if (submitterName === "skip") {
|
|
15329
|
-
|
|
15327
|
+
this.submitTypeForm(this.formData);
|
|
15330
15328
|
}
|
|
15331
15329
|
return;
|
|
15332
15330
|
}
|
|
@@ -15335,7 +15333,7 @@ let PboTypeForm$1 = class PboTypeForm extends PairboElement {
|
|
|
15335
15333
|
this.greetingText.focus();
|
|
15336
15334
|
return;
|
|
15337
15335
|
}
|
|
15338
|
-
|
|
15336
|
+
this.submitTypeForm(this.formData);
|
|
15339
15337
|
}
|
|
15340
15338
|
connectedCallback() {
|
|
15341
15339
|
super.connectedCallback();
|
|
@@ -15494,9 +15492,6 @@ __decorateClass$c([
|
|
|
15494
15492
|
__decorateClass$c([
|
|
15495
15493
|
r$3()
|
|
15496
15494
|
], PboTypeForm$1.prototype, "windowHeight", 2);
|
|
15497
|
-
__decorateClass$c([
|
|
15498
|
-
r$3()
|
|
15499
|
-
], PboTypeForm$1.prototype, "formData", 2);
|
|
15500
15495
|
__decorateClass$c([
|
|
15501
15496
|
r$3()
|
|
15502
15497
|
], PboTypeForm$1.prototype, "charsNum", 2);
|
|
@@ -15506,6 +15501,12 @@ __decorateClass$c([
|
|
|
15506
15501
|
__decorateClass$c([
|
|
15507
15502
|
n$3({ type: String, reflect: true })
|
|
15508
15503
|
], PboTypeForm$1.prototype, "cardInnerImageUrl", 2);
|
|
15504
|
+
__decorateClass$c([
|
|
15505
|
+
n$3()
|
|
15506
|
+
], PboTypeForm$1.prototype, "card", 2);
|
|
15507
|
+
__decorateClass$c([
|
|
15508
|
+
n$3()
|
|
15509
|
+
], PboTypeForm$1.prototype, "submitTypeForm", 2);
|
|
15509
15510
|
PboTypeForm$1 = __decorateClass$c([
|
|
15510
15511
|
t$3("pbo-type-form")
|
|
15511
15512
|
], PboTypeForm$1);
|
|
@@ -15655,12 +15656,6 @@ const styles$a = i$7`
|
|
|
15655
15656
|
}
|
|
15656
15657
|
`;
|
|
15657
15658
|
const splideCss = ".splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:-ms-flexbox;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{-ms-flex-align:center;align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:-ms-flexbox;display:flex;height:2em;-ms-flex-pack:center;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:rgba(0,0,0,0)}.splide__slide:focus{outline:0}@supports (outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports (outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}";
|
|
15658
|
-
const isMobileDevice = () => {
|
|
15659
|
-
return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
15660
|
-
};
|
|
15661
|
-
const isValid = (value) => {
|
|
15662
|
-
return value !== null && value !== void 0;
|
|
15663
|
-
};
|
|
15664
15659
|
var __defProp$b = Object.defineProperty;
|
|
15665
15660
|
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
15666
15661
|
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
@@ -16007,7 +16002,7 @@ let PboEditor$1 = class PboEditor extends PairboElement {
|
|
|
16007
16002
|
this.handwrittenFormState = { isLoading: false, processedFileUrl: "" };
|
|
16008
16003
|
this.editorType = "type";
|
|
16009
16004
|
this.handleTypingFormChange = () => {
|
|
16010
|
-
this.formData = this.
|
|
16005
|
+
this.formData = this.typeForm.formData;
|
|
16011
16006
|
this.slider.focusOn(1);
|
|
16012
16007
|
};
|
|
16013
16008
|
this.handelHandwrittenFormChange = (e3) => {
|
|
@@ -16032,7 +16027,7 @@ let PboEditor$1 = class PboEditor extends PairboElement {
|
|
|
16032
16027
|
this.addEventListener("handwritten-image-dimensions-changed", (e3) => {
|
|
16033
16028
|
this.handwrittenForm.setDimensions(e3.detail);
|
|
16034
16029
|
});
|
|
16035
|
-
this.
|
|
16030
|
+
this.typeForm.addEventListener("pbo-change", this.handleTypingFormChange);
|
|
16036
16031
|
this.handwrittenForm.addEventListener("pbo-change", this.handelHandwrittenFormChange);
|
|
16037
16032
|
document.addEventListener("pbo-zoomed-preview-open", () => {
|
|
16038
16033
|
this.openZoomedPreview();
|
|
@@ -16045,19 +16040,12 @@ let PboEditor$1 = class PboEditor extends PairboElement {
|
|
|
16045
16040
|
if (this.card) {
|
|
16046
16041
|
this.slider.card = this.card;
|
|
16047
16042
|
this.requestUpdate();
|
|
16043
|
+
this.typeForm.card = this.card;
|
|
16044
|
+
this.handwrittenForm.card = this.card;
|
|
16048
16045
|
}
|
|
16049
16046
|
}
|
|
16050
|
-
// updated(changedProperties: PropertyValues<this>): void {
|
|
16051
|
-
// if (changedProperties.has("cardInnerImageUrl")) {
|
|
16052
|
-
// this.requestUpdate();
|
|
16053
|
-
// }
|
|
16054
|
-
// if (changedProperties.has("card")) {
|
|
16055
|
-
// this.slider.card = this.card;
|
|
16056
|
-
// this.requestUpdate();
|
|
16057
|
-
// }
|
|
16058
|
-
// }
|
|
16059
16047
|
disconnectedCallback() {
|
|
16060
|
-
this.
|
|
16048
|
+
this.typeForm.removeEventListener("pbo-change", this.handleTypingFormChange);
|
|
16061
16049
|
this.handwrittenForm.removeEventListener("pbo-change", this.handelHandwrittenFormChange);
|
|
16062
16050
|
}
|
|
16063
16051
|
render() {
|
|
@@ -16076,6 +16064,7 @@ let PboEditor$1 = class PboEditor extends PairboElement {
|
|
|
16076
16064
|
<div class="editor__form">
|
|
16077
16065
|
<pbo-editor-selector @pbo-change=${this.handleEditorChange}></pbo-editor-selector>
|
|
16078
16066
|
<pbo-type-form
|
|
16067
|
+
.submitTypeForm=${this.submitTypeForm}
|
|
16079
16068
|
style=${o$1({
|
|
16080
16069
|
display: this.editorType === "type" ? "block" : "none"
|
|
16081
16070
|
})}
|
|
@@ -16084,6 +16073,8 @@ let PboEditor$1 = class PboEditor extends PairboElement {
|
|
|
16084
16073
|
style=${o$1({
|
|
16085
16074
|
display: this.editorType === "handwritten" ? "block" : "none"
|
|
16086
16075
|
})}
|
|
16076
|
+
.submitHandwrittenForm=${this.submitHandwrittenForm}
|
|
16077
|
+
.getProcessedImg=${this.getProcessedImg}
|
|
16087
16078
|
></pbo-handwritten-form>
|
|
16088
16079
|
</div>
|
|
16089
16080
|
</div>
|
|
@@ -16116,9 +16107,21 @@ PboEditor$1.dependencies = {
|
|
|
16116
16107
|
__decorateClass$a([
|
|
16117
16108
|
n$3({ type: String, reflect: true })
|
|
16118
16109
|
], PboEditor$1.prototype, "cardInnerImageUrl", 2);
|
|
16110
|
+
__decorateClass$a([
|
|
16111
|
+
n$3({ type: Object })
|
|
16112
|
+
], PboEditor$1.prototype, "card", 2);
|
|
16113
|
+
__decorateClass$a([
|
|
16114
|
+
n$3()
|
|
16115
|
+
], PboEditor$1.prototype, "submitTypeForm", 2);
|
|
16116
|
+
__decorateClass$a([
|
|
16117
|
+
n$3()
|
|
16118
|
+
], PboEditor$1.prototype, "submitHandwrittenForm", 2);
|
|
16119
|
+
__decorateClass$a([
|
|
16120
|
+
n$3()
|
|
16121
|
+
], PboEditor$1.prototype, "getProcessedImg", 2);
|
|
16119
16122
|
__decorateClass$a([
|
|
16120
16123
|
e$5("pbo-type-form")
|
|
16121
|
-
], PboEditor$1.prototype, "
|
|
16124
|
+
], PboEditor$1.prototype, "typeForm", 2);
|
|
16122
16125
|
__decorateClass$a([
|
|
16123
16126
|
e$5("pbo-handwritten-form")
|
|
16124
16127
|
], PboEditor$1.prototype, "handwrittenForm", 2);
|
|
@@ -16128,9 +16131,6 @@ __decorateClass$a([
|
|
|
16128
16131
|
__decorateClass$a([
|
|
16129
16132
|
e$5(".editor__zoomed")
|
|
16130
16133
|
], PboEditor$1.prototype, "zoomedPreview", 2);
|
|
16131
|
-
__decorateClass$a([
|
|
16132
|
-
n$3({ type: Object })
|
|
16133
|
-
], PboEditor$1.prototype, "card", 2);
|
|
16134
16134
|
__decorateClass$a([
|
|
16135
16135
|
r$3()
|
|
16136
16136
|
], PboEditor$1.prototype, "formData", 2);
|
|
@@ -18869,7 +18869,7 @@ let PboCategory$1 = class PboCategory extends PairboElement {
|
|
|
18869
18869
|
src=${card.medias.cover.url}
|
|
18870
18870
|
alt="${card.medias.cover.alt}"
|
|
18871
18871
|
@click=${this.clickHandler}
|
|
18872
|
-
data-card-id="${card.
|
|
18872
|
+
data-card-id="${card.pboId}"
|
|
18873
18873
|
/>
|
|
18874
18874
|
</li>
|
|
18875
18875
|
`;
|
|
@@ -19211,8 +19211,8 @@ let PboPageManager$1 = class PboPageManager extends PairboElement {
|
|
|
19211
19211
|
this.onClose = () => {
|
|
19212
19212
|
};
|
|
19213
19213
|
this.currentPage = "selection";
|
|
19214
|
-
this.selectedCard = null;
|
|
19215
19214
|
this.categories = [];
|
|
19215
|
+
this.selectedCard = null;
|
|
19216
19216
|
this.selectedCardId = null;
|
|
19217
19217
|
this.selectedCardDetails = null;
|
|
19218
19218
|
this.handleCardSelected = (event) => {
|
|
@@ -19223,6 +19223,15 @@ let PboPageManager$1 = class PboPageManager extends PairboElement {
|
|
|
19223
19223
|
this.goToEditor();
|
|
19224
19224
|
};
|
|
19225
19225
|
}
|
|
19226
|
+
handleSubmitTypeFormUpdate() {
|
|
19227
|
+
this.editorEl.submitTypeForm = this.submitTypeForm;
|
|
19228
|
+
}
|
|
19229
|
+
handleSubmitHandwrittenFormUpdate() {
|
|
19230
|
+
this.editorEl.submitHandwrittenForm = this.submitHandwrittenForm;
|
|
19231
|
+
}
|
|
19232
|
+
handleGetProcessedImgUpdate() {
|
|
19233
|
+
this.editorEl.getProcessedImg = this.getProcessedImg;
|
|
19234
|
+
}
|
|
19226
19235
|
goToEditor() {
|
|
19227
19236
|
this.currentPage = "editor";
|
|
19228
19237
|
}
|
|
@@ -19252,7 +19261,7 @@ let PboPageManager$1 = class PboPageManager extends PairboElement {
|
|
|
19252
19261
|
findCardInCategoryById(cardId) {
|
|
19253
19262
|
console.log("Categories from findCardInCategoryById", this.categories);
|
|
19254
19263
|
for (const category of this.categories) {
|
|
19255
|
-
const card = category.cards.find((card2) => card2.
|
|
19264
|
+
const card = category.cards.find((card2) => card2.pboId === cardId);
|
|
19256
19265
|
console.log("card from findCardInCategoryById", card);
|
|
19257
19266
|
if (card) {
|
|
19258
19267
|
return card;
|
|
@@ -19319,18 +19328,36 @@ __decorateClass$7([
|
|
|
19319
19328
|
__decorateClass$7([
|
|
19320
19329
|
n$3({ type: String, reflect: true })
|
|
19321
19330
|
], PboPageManager$1.prototype, "currentPage", 2);
|
|
19322
|
-
__decorateClass$7([
|
|
19323
|
-
r$3()
|
|
19324
|
-
], PboPageManager$1.prototype, "selectedCard", 2);
|
|
19325
19331
|
__decorateClass$7([
|
|
19326
19332
|
n$3()
|
|
19327
19333
|
], PboPageManager$1.prototype, "categories", 2);
|
|
19334
|
+
__decorateClass$7([
|
|
19335
|
+
n$3()
|
|
19336
|
+
], PboPageManager$1.prototype, "submitTypeForm", 2);
|
|
19337
|
+
__decorateClass$7([
|
|
19338
|
+
n$3()
|
|
19339
|
+
], PboPageManager$1.prototype, "submitHandwrittenForm", 2);
|
|
19340
|
+
__decorateClass$7([
|
|
19341
|
+
n$3()
|
|
19342
|
+
], PboPageManager$1.prototype, "getProcessedImg", 2);
|
|
19343
|
+
__decorateClass$7([
|
|
19344
|
+
r$3()
|
|
19345
|
+
], PboPageManager$1.prototype, "selectedCard", 2);
|
|
19328
19346
|
__decorateClass$7([
|
|
19329
19347
|
r$3()
|
|
19330
19348
|
], PboPageManager$1.prototype, "selectedCardId", 2);
|
|
19331
19349
|
__decorateClass$7([
|
|
19332
19350
|
r$3()
|
|
19333
19351
|
], PboPageManager$1.prototype, "selectedCardDetails", 2);
|
|
19352
|
+
__decorateClass$7([
|
|
19353
|
+
watch("submitTypeForm")
|
|
19354
|
+
], PboPageManager$1.prototype, "handleSubmitTypeFormUpdate", 1);
|
|
19355
|
+
__decorateClass$7([
|
|
19356
|
+
watch("submitHandwrittenForm")
|
|
19357
|
+
], PboPageManager$1.prototype, "handleSubmitHandwrittenFormUpdate", 1);
|
|
19358
|
+
__decorateClass$7([
|
|
19359
|
+
watch("getProcessedImg")
|
|
19360
|
+
], PboPageManager$1.prototype, "handleGetProcessedImgUpdate", 1);
|
|
19334
19361
|
__decorateClass$7([
|
|
19335
19362
|
watch("categories")
|
|
19336
19363
|
], PboPageManager$1.prototype, "handleCategoriesUpdate", 1);
|
|
@@ -19961,7 +19988,22 @@ var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
|
19961
19988
|
let PboHandwrittenForm$1 = class PboHandwrittenForm extends PairboElement {
|
|
19962
19989
|
constructor() {
|
|
19963
19990
|
super(...arguments);
|
|
19991
|
+
this.card = null;
|
|
19992
|
+
this.submitHandwrittenForm = (formData) => {
|
|
19993
|
+
console.warn("submitHandwrittenForm not implemented", formData);
|
|
19994
|
+
};
|
|
19995
|
+
this.getProcessedImg = async (file) => {
|
|
19996
|
+
console.warn("getProcessedImg not implemented", file.name);
|
|
19997
|
+
return {
|
|
19998
|
+
pred_image_uid: "",
|
|
19999
|
+
masked_img: ""
|
|
20000
|
+
};
|
|
20001
|
+
};
|
|
19964
20002
|
this.sourceImg = null;
|
|
20003
|
+
this.processedImg = {
|
|
20004
|
+
fileUrl: null,
|
|
20005
|
+
imgId: null
|
|
20006
|
+
};
|
|
19965
20007
|
this.processedFileUrl = null;
|
|
19966
20008
|
this.handwrittenDimensions = {
|
|
19967
20009
|
top: null,
|
|
@@ -19997,6 +20039,23 @@ let PboHandwrittenForm$1 = class PboHandwrittenForm extends PairboElement {
|
|
|
19997
20039
|
}
|
|
19998
20040
|
});
|
|
19999
20041
|
}
|
|
20042
|
+
get formData() {
|
|
20043
|
+
var _a2, _b, _c, _d;
|
|
20044
|
+
const pixelsPerMMHeight = 177.8 / this.handwrittenDimensions.cardHeight;
|
|
20045
|
+
const pixelsPerMMWidth = 127 / this.handwrittenDimensions.cardWidth;
|
|
20046
|
+
const formData = {
|
|
20047
|
+
pboCardId: ((_a2 = this.card) == null ? void 0 : _a2.pboId) || "Unknown",
|
|
20048
|
+
productId: (_b = this.card) == null ? void 0 : _b.productId,
|
|
20049
|
+
sku: (_c = this.card) == null ? void 0 : _c.sku,
|
|
20050
|
+
variantId: (_d = this.card) == null ? void 0 : _d.variantId,
|
|
20051
|
+
pred_image_uid: this.processedImg.imgId || "",
|
|
20052
|
+
position_x: this.handwrittenDimensions.top * pixelsPerMMWidth,
|
|
20053
|
+
position_y: this.handwrittenDimensions.left * pixelsPerMMHeight,
|
|
20054
|
+
height: this.handwrittenDimensions.height * pixelsPerMMHeight,
|
|
20055
|
+
width: this.handwrittenDimensions.width * pixelsPerMMWidth
|
|
20056
|
+
};
|
|
20057
|
+
return removeNullUndefined(formData);
|
|
20058
|
+
}
|
|
20000
20059
|
setDimensions(dimensions) {
|
|
20001
20060
|
this.handwrittenDimensions = dimensions;
|
|
20002
20061
|
}
|
|
@@ -20011,36 +20070,12 @@ let PboHandwrittenForm$1 = class PboHandwrittenForm extends PairboElement {
|
|
|
20011
20070
|
const file = (_b = (_a2 = e3.target) == null ? void 0 : _a2.files) == null ? void 0 : _b[0];
|
|
20012
20071
|
if (file == null) return;
|
|
20013
20072
|
this.sourceImg = file;
|
|
20014
|
-
const
|
|
20015
|
-
|
|
20016
|
-
resolve({ fileUrl: file ? URL.createObjectURL(file) : null });
|
|
20017
|
-
}, 2e3);
|
|
20018
|
-
});
|
|
20019
|
-
const processedFileUrl = await fetchSimulation();
|
|
20020
|
-
this.processedFileUrl = processedFileUrl.fileUrl;
|
|
20073
|
+
const processedImage = await this.getProcessedImg(file);
|
|
20074
|
+
this.processedFileUrl = `data:image/png;base64,${processedImage.masked_img}`;
|
|
20021
20075
|
}
|
|
20022
20076
|
handleSubmit(e3) {
|
|
20023
20077
|
e3.preventDefault();
|
|
20024
|
-
|
|
20025
|
-
const pixelsPerMMHeight = 177.8 / this.handwrittenDimensions.cardHeight;
|
|
20026
|
-
const pixelsPerMMWidth = 127 / this.handwrittenDimensions.cardWidth;
|
|
20027
|
-
let formData = {
|
|
20028
|
-
items: [
|
|
20029
|
-
{
|
|
20030
|
-
// id: card.shopifyVariantId,
|
|
20031
|
-
quantity: 1,
|
|
20032
|
-
properties: {
|
|
20033
|
-
// _pairbo_id: card.pairboId,
|
|
20034
|
-
// _pred_image_uid: imgId,
|
|
20035
|
-
_position_x: this.handwrittenDimensions.top * pixelsPerMMWidth,
|
|
20036
|
-
_position_y: this.handwrittenDimensions.left * pixelsPerMMHeight,
|
|
20037
|
-
_height: this.handwrittenDimensions.height * pixelsPerMMHeight,
|
|
20038
|
-
_width: this.handwrittenDimensions.width * pixelsPerMMWidth
|
|
20039
|
-
}
|
|
20040
|
-
}
|
|
20041
|
-
]
|
|
20042
|
-
};
|
|
20043
|
-
console.log(formData);
|
|
20078
|
+
this.submitHandwrittenForm(this.formData);
|
|
20044
20079
|
}
|
|
20045
20080
|
render() {
|
|
20046
20081
|
return x$1`
|
|
@@ -20090,8 +20125,9 @@ let PboHandwrittenForm$1 = class PboHandwrittenForm extends PairboElement {
|
|
|
20090
20125
|
style=${o$1({
|
|
20091
20126
|
display: this.sourceImg && this.processedFileUrl ? "block" : "none"
|
|
20092
20127
|
})}
|
|
20093
|
-
>Save and Continue</pbo-button
|
|
20094
20128
|
>
|
|
20129
|
+
Save and Continue
|
|
20130
|
+
</pbo-button>
|
|
20095
20131
|
<pbo-button
|
|
20096
20132
|
name="reupload"
|
|
20097
20133
|
variant="text"
|
|
@@ -20116,9 +20152,21 @@ __decorateClass$2([
|
|
|
20116
20152
|
__decorateClass$2([
|
|
20117
20153
|
e$5(".handwritten-form")
|
|
20118
20154
|
], PboHandwrittenForm$1.prototype, "handwrittenForm", 2);
|
|
20155
|
+
__decorateClass$2([
|
|
20156
|
+
n$3()
|
|
20157
|
+
], PboHandwrittenForm$1.prototype, "card", 2);
|
|
20158
|
+
__decorateClass$2([
|
|
20159
|
+
n$3()
|
|
20160
|
+
], PboHandwrittenForm$1.prototype, "submitHandwrittenForm", 2);
|
|
20161
|
+
__decorateClass$2([
|
|
20162
|
+
n$3()
|
|
20163
|
+
], PboHandwrittenForm$1.prototype, "getProcessedImg", 2);
|
|
20119
20164
|
__decorateClass$2([
|
|
20120
20165
|
r$3()
|
|
20121
20166
|
], PboHandwrittenForm$1.prototype, "sourceImg", 2);
|
|
20167
|
+
__decorateClass$2([
|
|
20168
|
+
r$3()
|
|
20169
|
+
], PboHandwrittenForm$1.prototype, "processedImg", 2);
|
|
20122
20170
|
__decorateClass$2([
|
|
20123
20171
|
r$3()
|
|
20124
20172
|
], PboHandwrittenForm$1.prototype, "processedFileUrl", 2);
|
|
@@ -20219,6 +20267,7 @@ let PboHandwrittenCanvas$1 = class PboHandwrittenCanvas extends PairboElement {
|
|
|
20219
20267
|
this.handwrittenImage.selectable = true;
|
|
20220
20268
|
this.handwrittenImage.lockRotation = true;
|
|
20221
20269
|
this.handwrittenImage.lockScalingFlip = true;
|
|
20270
|
+
this.handwrittenImage.noScaleCache = false;
|
|
20222
20271
|
const scaleWidth = this.areaSize.width / this.handwrittenImage.width;
|
|
20223
20272
|
const scaleHeight = this.areaSize.height / this.handwrittenImage.height;
|
|
20224
20273
|
const scale = Math.min(scaleWidth, scaleHeight);
|
|
@@ -20237,7 +20286,7 @@ let PboHandwrittenCanvas$1 = class PboHandwrittenCanvas extends PairboElement {
|
|
|
20237
20286
|
scaleY: scale,
|
|
20238
20287
|
bringToFrontOnSelect: false,
|
|
20239
20288
|
borderColor: "#4287f5",
|
|
20240
|
-
borderScaleFactor:
|
|
20289
|
+
borderScaleFactor: 10
|
|
20241
20290
|
});
|
|
20242
20291
|
this.setHandwrittenImageDimensions({
|
|
20243
20292
|
top: this.areaPosition.top,
|