@foxy.io/elements 1.39.0-beta.4 → 1.39.0-beta.6
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-customer-portal.js +5 -5
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/translations/store-form/en.json +75 -17
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.d.ts +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js +10 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js.map +1 -1
- package/dist/elements/public/ItemCard/ItemCard.js +6 -3
- package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
- package/dist/elements/public/StoreForm/StoreForm.d.ts +8 -12
- package/dist/elements/public/StoreForm/StoreForm.js +173 -83
- package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
- package/dist/elements/public/StoreForm/index.d.ts +1 -0
- package/dist/elements/public/StoreForm/index.js +1 -0
- package/dist/elements/public/StoreForm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,6 +7,14 @@ import slugify from '@sindresorhus/slugify';
|
|
|
7
7
|
import merge from 'lodash-es/merge';
|
|
8
8
|
const NS = 'store-form';
|
|
9
9
|
const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
|
|
10
|
+
function parseWebhookKey(webhookKey) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(webhookKey);
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* Form element for store settings (`fx:store`).
|
|
12
20
|
*
|
|
@@ -22,6 +30,8 @@ export class StoreForm extends Base {
|
|
|
22
30
|
this.customerPasswordHashTypes = null;
|
|
23
31
|
/** URL of the `fx:shipping_address_types` property helper resource. */
|
|
24
32
|
this.shippingAddressTypes = null;
|
|
33
|
+
/** URL of the Store Secrets settings page if you are using this form on multiple pages. */
|
|
34
|
+
this.storeSecretsPageUrl = null;
|
|
25
35
|
/** hCaptcha site key for signup verification. If provided, requires users to complete a captcha before creating a store. */
|
|
26
36
|
this.hCaptchaSiteKey = null;
|
|
27
37
|
/**
|
|
@@ -212,30 +222,31 @@ export class StoreForm extends Base {
|
|
|
212
222
|
{ label: 'option_tls', value: 'tls' },
|
|
213
223
|
{ label: 'option_none', value: '' },
|
|
214
224
|
];
|
|
215
|
-
this.
|
|
216
|
-
this.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this.__setWebhookKey('cart_signing', newValue);
|
|
227
|
-
};
|
|
228
|
-
this.__webhookKeyXmlDatafeedGetValue = () => {
|
|
229
|
-
return this.__getWebhookKey().xml_datafeed;
|
|
230
|
-
};
|
|
231
|
-
this.__webhookKeyXmlDatafeedSetValue = (newValue) => {
|
|
232
|
-
this.__setWebhookKey('xml_datafeed', newValue);
|
|
233
|
-
};
|
|
234
|
-
this.__webhookKeySsoGetValue = () => {
|
|
235
|
-
return this.__getWebhookKey().sso;
|
|
225
|
+
this.__singleWebhookKeyGeneratorOptions = { length: 128, separator: '' };
|
|
226
|
+
this.__jsonWebhookKeyGeneratorOptions = { length: 64, separator: '' };
|
|
227
|
+
this.__useSingleWebhookKeyGetValue = () => {
|
|
228
|
+
var _a;
|
|
229
|
+
try {
|
|
230
|
+
JSON.parse((_a = this.form.webhook_key) !== null && _a !== void 0 ? _a : '');
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
catch (_b) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
236
|
};
|
|
237
|
-
this.
|
|
238
|
-
|
|
237
|
+
this.__useSingleWebhookKeySetValue = (newValue) => {
|
|
238
|
+
if (newValue) {
|
|
239
|
+
this.edit({ webhook_key: '' });
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
const parsedKey = {
|
|
243
|
+
cart_signing: '',
|
|
244
|
+
xml_datafeed: '',
|
|
245
|
+
api_legacy: '',
|
|
246
|
+
sso: '',
|
|
247
|
+
};
|
|
248
|
+
this.edit({ webhook_key: JSON.stringify(parsedKey) });
|
|
249
|
+
}
|
|
239
250
|
};
|
|
240
251
|
this.__hCaptchaToken = null;
|
|
241
252
|
}
|
|
@@ -245,6 +256,7 @@ export class StoreForm extends Base {
|
|
|
245
256
|
reportingStoreDomainExists: { attribute: 'reporting-store-domain-exists' },
|
|
246
257
|
customerPasswordHashTypes: { attribute: 'customer-password-hash-types' },
|
|
247
258
|
shippingAddressTypes: { attribute: 'shipping-address-types' },
|
|
259
|
+
storeSecretsPageUrl: { attribute: 'store-secrets-page-url' },
|
|
248
260
|
hCaptchaSiteKey: { attribute: 'h-captcha-site-key' },
|
|
249
261
|
storeVersions: { attribute: 'store-versions' },
|
|
250
262
|
checkoutTypes: { attribute: 'checkout-types' },
|
|
@@ -291,15 +303,47 @@ export class StoreForm extends Base {
|
|
|
291
303
|
({ region: v }) => (v && v.length <= 100) || 'region:v8n_too_long',
|
|
292
304
|
({ country: v }) => !!v || 'country:v8n_required',
|
|
293
305
|
({ logo_url: v }) => !v || v.length <= 200 || 'logo-url:v8n_too_long',
|
|
306
|
+
({ webhook_url: v, use_webhook }) => !use_webhook || !!v || 'webhook-url:v8n_required',
|
|
294
307
|
({ webhook_url: v, use_webhook }) => {
|
|
295
308
|
return !use_webhook || !v || v.length <= 300 || 'webhook-url:v8n_too_long';
|
|
296
309
|
},
|
|
297
|
-
({ webhook_key: v
|
|
298
|
-
|
|
310
|
+
({ webhook_key: v }) => v === void 0 || v.length > 0 || 'webhook-key:v8n_required',
|
|
311
|
+
({ webhook_key: v }, host) => {
|
|
312
|
+
var _a;
|
|
313
|
+
// TODO remove the line below when API limit is corrected to match the legacy admin
|
|
314
|
+
if (((_a = host.data) === null || _a === void 0 ? void 0 : _a.webhook_key) === v)
|
|
315
|
+
return true;
|
|
316
|
+
return !v || v.length <= 100 || 'webhook-key:v8n_too_long';
|
|
299
317
|
},
|
|
300
|
-
({ webhook_key: v, use_webhook: on
|
|
301
|
-
|
|
318
|
+
({ webhook_key: v, use_webhook: on }) => {
|
|
319
|
+
const parsedV = parseWebhookKey(v !== null && v !== void 0 ? v : '');
|
|
320
|
+
const code = 'use-webhook:v8n_webhook_key_required';
|
|
321
|
+
return !on || !!(parsedV ? parsedV.xml_datafeed : v) || code;
|
|
302
322
|
},
|
|
323
|
+
({ webhook_key: v, use_cart_validation: on }) => {
|
|
324
|
+
const parsedV = parseWebhookKey(v !== null && v !== void 0 ? v : '');
|
|
325
|
+
const code = 'use-cart-validation:v8n_webhook_key_required';
|
|
326
|
+
return !on || !!(parsedV ? parsedV.cart_signing : v) || code;
|
|
327
|
+
},
|
|
328
|
+
({ webhook_key: v, use_single_sign_on: on }) => {
|
|
329
|
+
const parsedV = parseWebhookKey(v !== null && v !== void 0 ? v : '');
|
|
330
|
+
const code = 'use-single-sign-on:v8n_webhook_key_required';
|
|
331
|
+
return !on || !!(parsedV ? parsedV.sso : v) || code;
|
|
332
|
+
},
|
|
333
|
+
...['xml_datafeed', 'cart_signing', 'api_legacy', 'sso']
|
|
334
|
+
.map(prop => [
|
|
335
|
+
({ webhook_key: v }) => {
|
|
336
|
+
const parsedV = parseWebhookKey(v !== null && v !== void 0 ? v : '');
|
|
337
|
+
const code = `webhook-key-${prop.replace(/_/g, '-')}:v8n_required`;
|
|
338
|
+
return !parsedV || !!parsedV[prop] || code;
|
|
339
|
+
},
|
|
340
|
+
({ webhook_key: v }) => {
|
|
341
|
+
const parsedV = parseWebhookKey(v !== null && v !== void 0 ? v : '');
|
|
342
|
+
const code = `webhook-key-${prop.replace(/_/g, '-')}:v8n_too_long`;
|
|
343
|
+
return !parsedV || parsedV[prop].length <= 100 || code;
|
|
344
|
+
},
|
|
345
|
+
])
|
|
346
|
+
.flat(),
|
|
303
347
|
({ single_sign_on_url: v, use_single_sign_on: on }) => {
|
|
304
348
|
return !on || !!v || 'single-sign-on-url:v8n_required';
|
|
305
349
|
},
|
|
@@ -319,7 +363,7 @@ export class StoreForm extends Base {
|
|
|
319
363
|
return { context: ((_a = this.data) === null || _a === void 0 ? void 0 : _a.is_active) ? 'active' : 'inactive' };
|
|
320
364
|
}
|
|
321
365
|
renderBody() {
|
|
322
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
366
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
323
367
|
const storeDomainHelperText = this.t(this.form.use_remote_domain && !((_a = this.data) === null || _a === void 0 ? void 0 : _a.use_remote_domain)
|
|
324
368
|
? 'essentials.store-domain.custom_domain_note'
|
|
325
369
|
: 'essentials.store-domain.helper_text');
|
|
@@ -353,7 +397,7 @@ export class StoreForm extends Base {
|
|
|
353
397
|
regionsURL.searchParams.set('country_code', country);
|
|
354
398
|
regionsUrl = regionsURL.toString();
|
|
355
399
|
}
|
|
356
|
-
catch (
|
|
400
|
+
catch (_v) {
|
|
357
401
|
regionsUrl = undefined;
|
|
358
402
|
}
|
|
359
403
|
const customDisplayIdConfig = this.__getCustomDisplayIdConfig();
|
|
@@ -361,6 +405,11 @@ export class StoreForm extends Base {
|
|
|
361
405
|
const logDetailRequestTypes = transactionJournalEntriesConfig.log_detail_request_types;
|
|
362
406
|
const displayIdExamples = this.__displayIdExamples;
|
|
363
407
|
const journalIdExamples = this.__journalIdExamples;
|
|
408
|
+
const rawWebhookKey = (_p = (_o = this.data) === null || _o === void 0 ? void 0 : _o.webhook_key) !== null && _p !== void 0 ? _p : '';
|
|
409
|
+
const parsedWebhookKey = parseWebhookKey(rawWebhookKey);
|
|
410
|
+
const cartSigningKey = (_q = parsedWebhookKey === null || parsedWebhookKey === void 0 ? void 0 : parsedWebhookKey.cart_signing) !== null && _q !== void 0 ? _q : rawWebhookKey;
|
|
411
|
+
const xmlDatafeedKey = (_r = parsedWebhookKey === null || parsedWebhookKey === void 0 ? void 0 : parsedWebhookKey.xml_datafeed) !== null && _r !== void 0 ? _r : rawWebhookKey;
|
|
412
|
+
const ssoKey = (_s = parsedWebhookKey === null || parsedWebhookKey === void 0 ? void 0 : parsedWebhookKey.sso) !== null && _s !== void 0 ? _s : rawWebhookKey;
|
|
364
413
|
return html `
|
|
365
414
|
${this.renderHeader()}
|
|
366
415
|
|
|
@@ -447,23 +496,72 @@ export class StoreForm extends Base {
|
|
|
447
496
|
</foxy-internal-select-control>
|
|
448
497
|
</foxy-internal-summary-control>
|
|
449
498
|
|
|
450
|
-
<foxy-internal-summary-control infer="
|
|
451
|
-
<foxy-internal-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
.generatorOptions=${this.__webhookKeyGeneratorOptions}
|
|
456
|
-
.getValue=${this.__webhookKeyApiLegacyGetValue}
|
|
457
|
-
.setValue=${this.__webhookKeyApiLegacySetValue}
|
|
499
|
+
<foxy-internal-summary-control infer="store-secrets" id="store-secrets">
|
|
500
|
+
<foxy-internal-switch-control
|
|
501
|
+
infer="use-single-secret"
|
|
502
|
+
.getValue=${this.__useSingleWebhookKeyGetValue}
|
|
503
|
+
.setValue=${this.__useSingleWebhookKeySetValue}
|
|
458
504
|
>
|
|
459
|
-
</foxy-internal-
|
|
505
|
+
</foxy-internal-switch-control>
|
|
506
|
+
|
|
507
|
+
${this.__useSingleWebhookKeyGetValue()
|
|
508
|
+
? html `
|
|
509
|
+
<foxy-internal-password-control
|
|
510
|
+
layout="summary-item"
|
|
511
|
+
infer="webhook-key"
|
|
512
|
+
show-generator
|
|
513
|
+
.generatorOptions=${this.__singleWebhookKeyGeneratorOptions}
|
|
514
|
+
>
|
|
515
|
+
</foxy-internal-password-control>
|
|
516
|
+
`
|
|
517
|
+
: html `
|
|
518
|
+
<foxy-internal-password-control
|
|
519
|
+
json-path="api_legacy"
|
|
520
|
+
property="webhook_key"
|
|
521
|
+
layout="summary-item"
|
|
522
|
+
infer="webhook-key-api-legacy"
|
|
523
|
+
show-generator
|
|
524
|
+
.generatorOptions=${this.__jsonWebhookKeyGeneratorOptions}
|
|
525
|
+
>
|
|
526
|
+
</foxy-internal-password-control>
|
|
527
|
+
|
|
528
|
+
<foxy-internal-password-control
|
|
529
|
+
json-path="cart_signing"
|
|
530
|
+
property="webhook_key"
|
|
531
|
+
layout="summary-item"
|
|
532
|
+
infer="webhook-key-cart-signing"
|
|
533
|
+
show-generator
|
|
534
|
+
.generatorOptions=${this.__jsonWebhookKeyGeneratorOptions}
|
|
535
|
+
>
|
|
536
|
+
</foxy-internal-password-control>
|
|
537
|
+
|
|
538
|
+
<foxy-internal-password-control
|
|
539
|
+
json-path="sso"
|
|
540
|
+
property="webhook_key"
|
|
541
|
+
layout="summary-item"
|
|
542
|
+
infer="webhook-key-sso"
|
|
543
|
+
show-generator
|
|
544
|
+
.generatorOptions=${this.__jsonWebhookKeyGeneratorOptions}
|
|
545
|
+
>
|
|
546
|
+
</foxy-internal-password-control>
|
|
547
|
+
|
|
548
|
+
<foxy-internal-password-control
|
|
549
|
+
json-path="xml_datafeed"
|
|
550
|
+
property="webhook_key"
|
|
551
|
+
layout="summary-item"
|
|
552
|
+
infer="webhook-key-xml-datafeed"
|
|
553
|
+
show-generator
|
|
554
|
+
.generatorOptions=${this.__jsonWebhookKeyGeneratorOptions}
|
|
555
|
+
>
|
|
556
|
+
</foxy-internal-password-control>
|
|
557
|
+
`}
|
|
460
558
|
</foxy-internal-summary-control>
|
|
461
559
|
|
|
462
560
|
<foxy-internal-summary-control infer="emails">
|
|
463
561
|
<foxy-internal-text-control
|
|
464
562
|
layout="summary-item"
|
|
465
563
|
infer="from-email"
|
|
466
|
-
placeholder=${(
|
|
564
|
+
placeholder=${(_u = (_t = this.__getStoreEmailValue()[0]) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : this.t('emails.from-email.placeholder')}
|
|
467
565
|
>
|
|
468
566
|
</foxy-internal-text-control>
|
|
469
567
|
|
|
@@ -560,15 +658,9 @@ export class StoreForm extends Base {
|
|
|
560
658
|
<foxy-internal-switch-control infer="use-cart-validation" helper-text-as-tooltip>
|
|
561
659
|
</foxy-internal-switch-control>
|
|
562
660
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
show-generator
|
|
567
|
-
.generatorOptions=${this.__webhookKeyGeneratorOptions}
|
|
568
|
-
.getValue=${this.__webhookKeyCartSigningGetValue}
|
|
569
|
-
.setValue=${this.__webhookKeyCartSigningSetValue}
|
|
570
|
-
>
|
|
571
|
-
</foxy-internal-password-control>
|
|
661
|
+
${cartSigningKey && this.form.use_cart_validation
|
|
662
|
+
? this.__renderReadonlyWebhookKey('webhook-key-cart-signing', cartSigningKey)
|
|
663
|
+
: ''}
|
|
572
664
|
</foxy-internal-summary-control>
|
|
573
665
|
|
|
574
666
|
<foxy-internal-summary-control infer="checkout">
|
|
@@ -619,15 +711,7 @@ export class StoreForm extends Base {
|
|
|
619
711
|
? html `
|
|
620
712
|
<foxy-internal-text-control layout="summary-item" infer="single-sign-on-url">
|
|
621
713
|
</foxy-internal-text-control>
|
|
622
|
-
|
|
623
|
-
layout="summary-item"
|
|
624
|
-
infer="webhook-key-sso"
|
|
625
|
-
show-generator
|
|
626
|
-
.generatorOptions=${this.__webhookKeyGeneratorOptions}
|
|
627
|
-
.getValue=${this.__webhookKeySsoGetValue}
|
|
628
|
-
.setValue=${this.__webhookKeySsoSetValue}
|
|
629
|
-
>
|
|
630
|
-
</foxy-internal-password-control>
|
|
714
|
+
${ssoKey ? this.__renderReadonlyWebhookKey('webhook-key-sso', ssoKey) : ''}
|
|
631
715
|
`
|
|
632
716
|
: ''}
|
|
633
717
|
</foxy-internal-summary-control>
|
|
@@ -816,15 +900,9 @@ export class StoreForm extends Base {
|
|
|
816
900
|
? html `
|
|
817
901
|
<foxy-internal-text-control layout="summary-item" infer="webhook-url">
|
|
818
902
|
</foxy-internal-text-control>
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
show-generator
|
|
823
|
-
.generatorOptions=${this.__webhookKeyGeneratorOptions}
|
|
824
|
-
.getValue=${this.__webhookKeyXmlDatafeedGetValue}
|
|
825
|
-
.setValue=${this.__webhookKeyXmlDatafeedSetValue}
|
|
826
|
-
>
|
|
827
|
-
</foxy-internal-password-control>
|
|
903
|
+
${xmlDatafeedKey
|
|
904
|
+
? this.__renderReadonlyWebhookKey('webhook-key-xml-datafeed', xmlDatafeedKey)
|
|
905
|
+
: ''}
|
|
828
906
|
`
|
|
829
907
|
: ''}
|
|
830
908
|
</foxy-internal-summary-control>
|
|
@@ -945,23 +1023,6 @@ export class StoreForm extends Base {
|
|
|
945
1023
|
get __hCaptcha() {
|
|
946
1024
|
return this.renderRoot.querySelector('h-captcha');
|
|
947
1025
|
}
|
|
948
|
-
__getWebhookKey() {
|
|
949
|
-
var _a, _b;
|
|
950
|
-
let parsedKey;
|
|
951
|
-
try {
|
|
952
|
-
parsedKey = JSON.parse((_a = this.form.webhook_key) !== null && _a !== void 0 ? _a : '');
|
|
953
|
-
}
|
|
954
|
-
catch (_c) {
|
|
955
|
-
const v = (_b = this.form.webhook_key) !== null && _b !== void 0 ? _b : '';
|
|
956
|
-
parsedKey = { cart_signing: v, xml_datafeed: v, api_legacy: v, sso: v };
|
|
957
|
-
}
|
|
958
|
-
return parsedKey;
|
|
959
|
-
}
|
|
960
|
-
__setWebhookKey(key, value) {
|
|
961
|
-
const parsedKey = this.__getWebhookKey();
|
|
962
|
-
parsedKey[key] = value;
|
|
963
|
-
this.edit({ webhook_key: JSON.stringify(parsedKey) });
|
|
964
|
-
}
|
|
965
1026
|
__getCustomDisplayIdConfig() {
|
|
966
1027
|
const defaultConfig = {
|
|
967
1028
|
enabled: false,
|
|
@@ -1039,5 +1100,34 @@ export class StoreForm extends Base {
|
|
|
1039
1100
|
`,
|
|
1040
1101
|
};
|
|
1041
1102
|
}
|
|
1103
|
+
__renderReadonlyWebhookKey(scope, key) {
|
|
1104
|
+
var _a;
|
|
1105
|
+
return html `
|
|
1106
|
+
<div class="leading-xs">
|
|
1107
|
+
<div class="flex items-center gap-s">
|
|
1108
|
+
<p class="flex-1">
|
|
1109
|
+
<foxy-i18n infer=${scope} key="label"></foxy-i18n>
|
|
1110
|
+
</p>
|
|
1111
|
+
<p class="text-tertiary">${'*'.repeat(8)}${key.substr(-4)}</p>
|
|
1112
|
+
<foxy-copy-to-clipboard
|
|
1113
|
+
layout="complete"
|
|
1114
|
+
infer="${scope} copy-to-clipboard"
|
|
1115
|
+
theme="contrast tertiary-inline"
|
|
1116
|
+
text=${key}
|
|
1117
|
+
>
|
|
1118
|
+
</foxy-copy-to-clipboard>
|
|
1119
|
+
</div>
|
|
1120
|
+
<p class="text-xs text-secondary">
|
|
1121
|
+
<foxy-i18n infer=${scope} key="helper_text"></foxy-i18n>
|
|
1122
|
+
<a
|
|
1123
|
+
class="text-body font-medium rounded-s hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50"
|
|
1124
|
+
href=${(_a = this.storeSecretsPageUrl) !== null && _a !== void 0 ? _a : '#store-secrets'}
|
|
1125
|
+
>
|
|
1126
|
+
<foxy-i18n infer=${scope} key="link_text"></foxy-i18n>
|
|
1127
|
+
</a>
|
|
1128
|
+
</p>
|
|
1129
|
+
</div>
|
|
1130
|
+
`;
|
|
1131
|
+
}
|
|
1042
1132
|
}
|
|
1043
1133
|
//# sourceMappingURL=StoreForm.js.map
|