@foxy.io/elements 1.56.2 → 1.58.0
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/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/translations/store-form/en.json +27 -2
- package/dist/elements/public/StoreForm/StoreForm.d.ts +2 -0
- package/dist/elements/public/StoreForm/StoreForm.js +117 -15
- package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
- package/dist/types/hapi.d.ts +2 -0
- package/dist/types/hapi.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
|
3
3
|
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
4
4
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
5
5
|
import { isHttpUrl } from "../../../utils/is-http-url.js";
|
|
6
|
-
import { html } from 'lit-html';
|
|
6
|
+
import { html, svg } from 'lit-html';
|
|
7
7
|
import slugify from '@sindresorhus/slugify';
|
|
8
8
|
import merge from 'lodash-es/merge';
|
|
9
9
|
const NS = 'store-form';
|
|
@@ -146,6 +146,10 @@ export class StoreForm extends Base {
|
|
|
146
146
|
this.__setAutoAnonymizeDaysValue = (newValue) => {
|
|
147
147
|
this.edit({ data_retention: { ...this.__getDataRetention(), auto_anonymize_days: newValue } });
|
|
148
148
|
};
|
|
149
|
+
// null is a UI-only state (switch on, no limit yet) that v8n blocks from being submitted.
|
|
150
|
+
this.__setPackageWeightMax = (newValue) => {
|
|
151
|
+
this.edit({ package_weight_max: newValue });
|
|
152
|
+
};
|
|
149
153
|
this.__getStoreEmailValue = () => {
|
|
150
154
|
var _a;
|
|
151
155
|
const emails = (_a = this.form.store_email) !== null && _a !== void 0 ? _a : '';
|
|
@@ -400,6 +404,12 @@ export class StoreForm extends Base {
|
|
|
400
404
|
const days = v.auto_anonymize_days;
|
|
401
405
|
return (typeof days === 'number' && days >= 90) || 'auto-anonymize-days:v8n_required';
|
|
402
406
|
},
|
|
407
|
+
({ package_weight_max: v }) => {
|
|
408
|
+
return v !== null || 'package-weight-max:v8n_required';
|
|
409
|
+
},
|
|
410
|
+
({ package_weight_max: v }) => {
|
|
411
|
+
return !v || v >= 0 || 'package-weight-max:v8n_negative';
|
|
412
|
+
},
|
|
403
413
|
];
|
|
404
414
|
}
|
|
405
415
|
get headerSubtitleOptions() {
|
|
@@ -407,7 +417,7 @@ export class StoreForm extends Base {
|
|
|
407
417
|
return { context: ((_a = this.data) === null || _a === void 0 ? void 0 : _a.is_active) ? 'active' : 'inactive' };
|
|
408
418
|
}
|
|
409
419
|
renderBody() {
|
|
410
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
411
421
|
const storeDomainHelperText = this.t(this.form.use_remote_domain && !((_a = this.data) === null || _a === void 0 ? void 0 : _a.use_remote_domain)
|
|
412
422
|
? 'essentials-group-one.store-domain.custom_domain_note'
|
|
413
423
|
: 'essentials-group-one.store-domain.helper_text');
|
|
@@ -441,7 +451,7 @@ export class StoreForm extends Base {
|
|
|
441
451
|
regionsURL.searchParams.set('country_code', country);
|
|
442
452
|
regionsUrl = regionsURL.toString();
|
|
443
453
|
}
|
|
444
|
-
catch (
|
|
454
|
+
catch (_x) {
|
|
445
455
|
regionsUrl = undefined;
|
|
446
456
|
}
|
|
447
457
|
const customDisplayIdConfig = this.__getCustomDisplayIdConfig();
|
|
@@ -449,6 +459,8 @@ export class StoreForm extends Base {
|
|
|
449
459
|
const logDetailRequestTypes = transactionJournalEntriesConfig.log_detail_request_types;
|
|
450
460
|
const displayIdExamples = this.__displayIdExamples;
|
|
451
461
|
const journalIdExamples = this.__journalIdExamples;
|
|
462
|
+
const packageWeightMax = this.form.package_weight_max;
|
|
463
|
+
const isPackageWeightSplitEnabled = packageWeightMax !== undefined && packageWeightMax !== 0;
|
|
452
464
|
const rawWebhookKey = (_p = (_o = this.data) === null || _o === void 0 ? void 0 : _o.webhook_key) !== null && _p !== void 0 ? _p : '';
|
|
453
465
|
const parsedWebhookKey = parseWebhookKey(rawWebhookKey);
|
|
454
466
|
const cartSigningKey = (_q = parsedWebhookKey === null || parsedWebhookKey === void 0 ? void 0 : parsedWebhookKey.cart_signing) !== null && _q !== void 0 ? _q : rawWebhookKey;
|
|
@@ -609,9 +621,25 @@ export class StoreForm extends Base {
|
|
|
609
621
|
>
|
|
610
622
|
</foxy-internal-text-control>
|
|
611
623
|
|
|
612
|
-
<foxy-internal-
|
|
613
|
-
|
|
624
|
+
<foxy-internal-select-control
|
|
625
|
+
layout="summary-item"
|
|
626
|
+
infer="send-html-email"
|
|
627
|
+
.getValue=${this.__sendHtmlEmailGetValue}
|
|
628
|
+
.setValue=${this.__sendHtmlEmailSetValue}
|
|
629
|
+
.options=${this.__sendHtmlEmailOptions}
|
|
630
|
+
>
|
|
631
|
+
</foxy-internal-select-control>
|
|
632
|
+
|
|
633
|
+
<foxy-internal-switch-control infer="use-email-dns"> </foxy-internal-switch-control>
|
|
634
|
+
</foxy-internal-summary-control>
|
|
614
635
|
|
|
636
|
+
${this.form.use_email_dns &&
|
|
637
|
+
!((_v = this.data) === null || _v === void 0 ? void 0 : _v.use_email_dns) &&
|
|
638
|
+
!this.hiddenSelector.matches('emails:email-dns', true)
|
|
639
|
+
? this.__renderEmailDnsRecords()
|
|
640
|
+
: ''}
|
|
641
|
+
|
|
642
|
+
<foxy-internal-summary-control infer="emails" label="" helper-text="">
|
|
615
643
|
<foxy-internal-switch-control
|
|
616
644
|
infer="use-smtp-config"
|
|
617
645
|
helper-text-as-tooltip
|
|
@@ -666,15 +694,6 @@ export class StoreForm extends Base {
|
|
|
666
694
|
</foxy-internal-select-control>
|
|
667
695
|
`
|
|
668
696
|
: ''}
|
|
669
|
-
|
|
670
|
-
<foxy-internal-select-control
|
|
671
|
-
layout="summary-item"
|
|
672
|
-
infer="send-html-email"
|
|
673
|
-
.getValue=${this.__sendHtmlEmailGetValue}
|
|
674
|
-
.setValue=${this.__sendHtmlEmailSetValue}
|
|
675
|
-
.options=${this.__sendHtmlEmailOptions}
|
|
676
|
-
>
|
|
677
|
-
</foxy-internal-select-control>
|
|
678
697
|
</foxy-internal-summary-control>
|
|
679
698
|
|
|
680
699
|
<foxy-internal-summary-control infer="shipping">
|
|
@@ -690,6 +709,29 @@ export class StoreForm extends Base {
|
|
|
690
709
|
|
|
691
710
|
<foxy-internal-switch-control infer="require-signed-shipping-rates" helper-text-as-tooltip>
|
|
692
711
|
</foxy-internal-switch-control>
|
|
712
|
+
|
|
713
|
+
<foxy-internal-switch-control
|
|
714
|
+
infer="package-weight-split"
|
|
715
|
+
helper-text-as-tooltip
|
|
716
|
+
.getValue=${() => isPackageWeightSplitEnabled}
|
|
717
|
+
.setValue=${(newValue) => this.__setPackageWeightMax(newValue ? null : 0)}
|
|
718
|
+
>
|
|
719
|
+
</foxy-internal-switch-control>
|
|
720
|
+
|
|
721
|
+
${isPackageWeightSplitEnabled
|
|
722
|
+
? html `
|
|
723
|
+
<foxy-internal-number-control
|
|
724
|
+
layout="summary-item"
|
|
725
|
+
infer="package-weight-max"
|
|
726
|
+
min="0"
|
|
727
|
+
.setValue=${(newValue) => {
|
|
728
|
+
// 0 means "don't split" in the API, so keep the switch on and ask for a real limit instead.
|
|
729
|
+
this.__setPackageWeightMax(newValue === 0 ? null : newValue);
|
|
730
|
+
}}
|
|
731
|
+
>
|
|
732
|
+
</foxy-internal-number-control>
|
|
733
|
+
`
|
|
734
|
+
: ''}
|
|
693
735
|
</foxy-internal-summary-control>
|
|
694
736
|
|
|
695
737
|
<foxy-internal-summary-control infer="cart">
|
|
@@ -968,7 +1010,7 @@ export class StoreForm extends Base {
|
|
|
968
1010
|
.setValue=${this.__setAutoAnonymizeValue}
|
|
969
1011
|
>
|
|
970
1012
|
</foxy-internal-switch-control>
|
|
971
|
-
${((
|
|
1013
|
+
${((_w = this.form.data_retention) === null || _w === void 0 ? void 0 : _w.auto_anonymize) ? html `
|
|
972
1014
|
<foxy-internal-number-control
|
|
973
1015
|
layout="summary-item"
|
|
974
1016
|
infer="auto-anonymize-days"
|
|
@@ -1175,6 +1217,66 @@ export class StoreForm extends Base {
|
|
|
1175
1217
|
`,
|
|
1176
1218
|
};
|
|
1177
1219
|
}
|
|
1220
|
+
__renderEmailDnsRecords() {
|
|
1221
|
+
const records = [
|
|
1222
|
+
{
|
|
1223
|
+
host: 'smtpapi._domainkey',
|
|
1224
|
+
value: 'k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPtW5iwpXVPiH5FzJ7Nrl8USzuY9zqqzjE0D1r04xDN6qwziDnmgcFNNfMewVKN2D1O+2J9N14hRprzByFwfQW76yojh54Xu3uSbQ3JP0A7k8o8GutRF8zbFUA8n0ZH2y0cIEjMliXY4W4LwPA7m4q0ObmvSjhd63O9d8z1XkUBwIDAQAB',
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
host: '@',
|
|
1228
|
+
value: 'v=spf1 include:_spf.foxycart.com ~all',
|
|
1229
|
+
},
|
|
1230
|
+
];
|
|
1231
|
+
const renderField = (key, text) => html `
|
|
1232
|
+
<foxy-i18n
|
|
1233
|
+
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);"
|
|
1234
|
+
class="bg-contrast-5 h-full"
|
|
1235
|
+
infer="emails email-dns"
|
|
1236
|
+
key=${key}
|
|
1237
|
+
>
|
|
1238
|
+
</foxy-i18n>
|
|
1239
|
+
<div
|
|
1240
|
+
class="flex items-start bg-contrast-5 gap-s h-full"
|
|
1241
|
+
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);"
|
|
1242
|
+
>
|
|
1243
|
+
<code class="flex-1" style="overflow-wrap: anywhere">${text}</code>
|
|
1244
|
+
<foxy-copy-to-clipboard infer="emails email-dns copy-to-clipboard" text=${text}>
|
|
1245
|
+
</foxy-copy-to-clipboard>
|
|
1246
|
+
</div>
|
|
1247
|
+
`;
|
|
1248
|
+
return html `
|
|
1249
|
+
<div class="grid" style="gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);">
|
|
1250
|
+
<div
|
|
1251
|
+
class="flex items-start border border-primary rounded bg-base"
|
|
1252
|
+
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
1253
|
+
>
|
|
1254
|
+
${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`}
|
|
1255
|
+
<div class="grid" style="gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);">
|
|
1256
|
+
<foxy-i18n infer="emails email-dns" key="helper_text"></foxy-i18n>
|
|
1257
|
+
|
|
1258
|
+
<a
|
|
1259
|
+
target="_blank"
|
|
1260
|
+
class="rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50"
|
|
1261
|
+
href="https://www.foxy.io/help/articles/set-up-email-deliverability-with-spf-dkim-and-dmarc#set-up-email-dns"
|
|
1262
|
+
rel="noopener noreferrer"
|
|
1263
|
+
>
|
|
1264
|
+
<foxy-i18n infer="emails email-dns" key="link_text"></foxy-i18n>
|
|
1265
|
+
</a>
|
|
1266
|
+
|
|
1267
|
+
${records.map(({ host, value }) => html `
|
|
1268
|
+
<div
|
|
1269
|
+
class="grid rounded-s overflow-hidden text-s"
|
|
1270
|
+
style="grid-template-columns: auto 1fr; gap: 1px;"
|
|
1271
|
+
>
|
|
1272
|
+
${renderField('host', host)} ${renderField('value', value)}
|
|
1273
|
+
</div>
|
|
1274
|
+
`)}
|
|
1275
|
+
</div>
|
|
1276
|
+
</div>
|
|
1277
|
+
</div>
|
|
1278
|
+
`;
|
|
1279
|
+
}
|
|
1178
1280
|
__renderReadonlyWebhookKey(scope, key) {
|
|
1179
1281
|
var _a;
|
|
1180
1282
|
return html `
|