@foxy.io/elements 1.36.0-beta.3 → 1.36.0-beta.4
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-cart-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +27 -13
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/shared-231687fd.js +1 -0
- package/dist/cdn/{shared-5a9e9e89.js → shared-82e82908.js} +1 -1
- package/dist/cdn/shared-9ca85d1e.js +1 -0
- package/dist/cdn/translations/customer-portal/de.json +18 -0
- package/dist/cdn/translations/customer-portal/en.json +18 -0
- package/dist/cdn/translations/customer-portal/es.json +18 -0
- package/dist/cdn/translations/customer-portal/fr.json +18 -0
- package/dist/cdn/translations/customer-portal/nl.json +18 -0
- package/dist/cdn/translations/customer-portal/pl.json +18 -0
- package/dist/cdn/translations/customer-portal/sv.json +18 -0
- package/dist/cdn/translations/customer-portal/zh-hk.json +18 -0
- package/dist/elements/public/CartForm/types.d.ts +1 -9
- package/dist/elements/public/CartForm/types.js.map +1 -1
- package/dist/elements/public/CustomerPortal/CustomerPortal.d.ts +4 -0
- package/dist/elements/public/CustomerPortal/CustomerPortal.js +48 -13
- package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +7 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.d.ts +25 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js +72 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js.map +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
- package/dist/elements/public/CustomerPortal/index.d.ts +2 -0
- package/dist/elements/public/CustomerPortal/index.js +4 -0
- package/dist/elements/public/CustomerPortal/index.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/types.d.ts +1 -3
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
- package/dist/elements/public/StoreForm/types.d.ts +4 -38
- package/dist/elements/public/StoreForm/types.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +1 -3
- package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +13 -17
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/UserCard/UserCard.js +0 -2
- package/dist/elements/public/UserCard/UserCard.js.map +1 -1
- package/dist/elements/public/UserInvitationCard/types.d.ts +3 -1
- package/dist/elements/public/UserInvitationCard/types.js +1 -1
- package/dist/elements/public/UserInvitationCard/types.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/types.d.ts +2 -41
- package/dist/elements/public/UserInvitationForm/types.js.map +1 -1
- package/package.json +3 -3
- package/dist/cdn/shared-0e156ee7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n"]}
|
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
2
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
+
import type { StoreCustomDisplayIdConfigJson, StoreSmtpConfigJson, StoreWebhookKeyJson } from '@foxy.io/sdk/dist/types/backend/Rels';
|
|
3
4
|
export declare type Data = Resource<Rels.Store>;
|
|
4
|
-
export declare type ParsedWebhookKey =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
api_legacy: string;
|
|
8
|
-
sso: string;
|
|
9
|
-
};
|
|
10
|
-
export declare type ParsedSmtpConfig = {
|
|
11
|
-
username: string;
|
|
12
|
-
password: string;
|
|
13
|
-
security: string;
|
|
14
|
-
host: string;
|
|
15
|
-
port: string;
|
|
16
|
-
};
|
|
17
|
-
export declare type ParsedCustomDisplayIdConfig = {
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
start: string;
|
|
20
|
-
length: string;
|
|
21
|
-
prefix: string;
|
|
22
|
-
suffix: string;
|
|
23
|
-
transaction_journal_entries: {
|
|
24
|
-
enabled: boolean;
|
|
25
|
-
transaction_separator: string;
|
|
26
|
-
log_detail_request_types: {
|
|
27
|
-
transaction_authcapture: {
|
|
28
|
-
prefix: string;
|
|
29
|
-
};
|
|
30
|
-
transaction_capture: {
|
|
31
|
-
prefix: string;
|
|
32
|
-
};
|
|
33
|
-
transaction_refund: {
|
|
34
|
-
prefix: string;
|
|
35
|
-
};
|
|
36
|
-
transaction_void: {
|
|
37
|
-
prefix: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
5
|
+
export declare type ParsedWebhookKey = StoreWebhookKeyJson;
|
|
6
|
+
export declare type ParsedSmtpConfig = StoreSmtpConfigJson;
|
|
7
|
+
export declare type ParsedCustomDisplayIdConfig = StoreCustomDisplayIdConfigJson;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/StoreForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.Store>;\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/StoreForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type {\n StoreCustomDisplayIdConfigJson,\n StoreSmtpConfigJson,\n StoreWebhookKeyJson,\n} from '@foxy.io/sdk/dist/types/backend/Rels';\n\nexport type Data = Resource<Rels.Store>;\nexport type ParsedWebhookKey = StoreWebhookKeyJson;\nexport type ParsedSmtpConfig = StoreSmtpConfigJson;\nexport type ParsedCustomDisplayIdConfig = StoreCustomDisplayIdConfigJson;\n"]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
2
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
-
export declare type Data =
|
|
4
|
-
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists' | '';
|
|
5
|
-
};
|
|
3
|
+
export declare type Data = Resource<Rels.SubscriptionSettings>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionSettingsForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data =
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionSettingsForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.SubscriptionSettings>;\n"]}
|
|
@@ -29,8 +29,6 @@ export class Transaction extends Base {
|
|
|
29
29
|
onClick: async (selection) => {
|
|
30
30
|
if (!this.data)
|
|
31
31
|
return;
|
|
32
|
-
// TODO remove ts-expect-error when SDK has the types
|
|
33
|
-
// @ts-expect-error SDK types are incomplete
|
|
34
32
|
const url = this.data._links['fx:send_webhooks'].href;
|
|
35
33
|
const api = new Transaction.API(this);
|
|
36
34
|
const response = await api.fetch(url, {
|
|
@@ -201,7 +199,7 @@ export class Transaction extends Base {
|
|
|
201
199
|
`;
|
|
202
200
|
}
|
|
203
201
|
renderBody() {
|
|
204
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
205
203
|
let shipmentsLink = undefined;
|
|
206
204
|
let webhooksLink = undefined;
|
|
207
205
|
let itemsLink = undefined;
|
|
@@ -210,9 +208,7 @@ export class Transaction extends Base {
|
|
|
210
208
|
if (this.data) {
|
|
211
209
|
try {
|
|
212
210
|
const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);
|
|
213
|
-
|
|
214
|
-
// @ts-expect-error SDK doesn't have the types
|
|
215
|
-
const webhooksUrl = new URL((_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data._links['fx:webhooks'].href) !== null && _b !== void 0 ? _b : '');
|
|
211
|
+
const webhooksUrl = new URL((_c = (_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:webhooks'].href) !== null && _c !== void 0 ? _c : '');
|
|
216
212
|
const itemsUrl = new URL(this.data._links['fx:items'].href);
|
|
217
213
|
shipmentsUrl.searchParams.set('zoom', 'items:item_category');
|
|
218
214
|
webhooksUrl.searchParams.set('event_resource', 'transaction');
|
|
@@ -221,19 +217,19 @@ export class Transaction extends Base {
|
|
|
221
217
|
webhooksLink = webhooksUrl.toString();
|
|
222
218
|
itemsLink = itemsUrl.toString();
|
|
223
219
|
}
|
|
224
|
-
catch (
|
|
220
|
+
catch (_s) {
|
|
225
221
|
//
|
|
226
222
|
}
|
|
227
223
|
}
|
|
228
224
|
return html `
|
|
229
225
|
${this.renderHeader()}
|
|
230
|
-
${alertStatuses.includes((
|
|
226
|
+
${alertStatuses.includes((_e = (_d = this.data) === null || _d === void 0 ? void 0 : _d.status) !== null && _e !== void 0 ? _e : '')
|
|
231
227
|
? html `
|
|
232
228
|
<p
|
|
233
229
|
class="leading-xs text-body rounded bg-error-10 block"
|
|
234
230
|
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
235
231
|
>
|
|
236
|
-
<foxy-i18n infer="header" key="alert_status_${(
|
|
232
|
+
<foxy-i18n infer="header" key="alert_status_${(_f = this.data) === null || _f === void 0 ? void 0 : _f.status}"></foxy-i18n>
|
|
237
233
|
</p>
|
|
238
234
|
`
|
|
239
235
|
: ''}
|
|
@@ -257,9 +253,9 @@ export class Transaction extends Base {
|
|
|
257
253
|
.related=${[this.href]}
|
|
258
254
|
.itemProps=${{ 'locale-codes': this.localeCodes }}
|
|
259
255
|
.formProps=${{
|
|
260
|
-
'item-categories': (
|
|
256
|
+
'item-categories': (_h = (_g = this.__storeLoader) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h._links['fx:item_categories'].href,
|
|
261
257
|
'locale-codes': this.localeCodes,
|
|
262
|
-
'store': (
|
|
258
|
+
'store': (_j = this.data) === null || _j === void 0 ? void 0 : _j._links['fx:store'].href,
|
|
263
259
|
}}
|
|
264
260
|
>
|
|
265
261
|
</foxy-internal-async-list-control>
|
|
@@ -270,7 +266,7 @@ export class Transaction extends Base {
|
|
|
270
266
|
|
|
271
267
|
<foxy-internal-async-list-control
|
|
272
268
|
infer="billing-addresses"
|
|
273
|
-
first=${ifDefined((
|
|
269
|
+
first=${ifDefined((_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:billing_addresses'].href)}
|
|
274
270
|
item="foxy-billing-address-card"
|
|
275
271
|
form="foxy-address-form"
|
|
276
272
|
hide-create-button
|
|
@@ -281,7 +277,7 @@ export class Transaction extends Base {
|
|
|
281
277
|
|
|
282
278
|
<foxy-internal-async-list-control
|
|
283
279
|
infer="payments"
|
|
284
|
-
first=${ifDefined((
|
|
280
|
+
first=${ifDefined((_l = this.data) === null || _l === void 0 ? void 0 : _l._links['fx:payments'].href)}
|
|
285
281
|
item="foxy-payment-card"
|
|
286
282
|
.itemProps=${{
|
|
287
283
|
'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,
|
|
@@ -293,7 +289,7 @@ export class Transaction extends Base {
|
|
|
293
289
|
<foxy-internal-async-list-control
|
|
294
290
|
infer="custom-fields"
|
|
295
291
|
class="min-w-0"
|
|
296
|
-
first=${ifDefined((
|
|
292
|
+
first=${ifDefined((_m = this.data) === null || _m === void 0 ? void 0 : _m._links['fx:custom_fields'].href)}
|
|
297
293
|
limit="5"
|
|
298
294
|
form="foxy-custom-field-form"
|
|
299
295
|
item="foxy-custom-field-card"
|
|
@@ -304,7 +300,7 @@ export class Transaction extends Base {
|
|
|
304
300
|
<foxy-internal-async-list-control
|
|
305
301
|
infer="attributes"
|
|
306
302
|
class="min-w-0"
|
|
307
|
-
first=${ifDefined((
|
|
303
|
+
first=${ifDefined((_o = this.data) === null || _o === void 0 ? void 0 : _o._links['fx:attributes'].href)}
|
|
308
304
|
limit="5"
|
|
309
305
|
form="foxy-attribute-form"
|
|
310
306
|
item="foxy-attribute-card"
|
|
@@ -337,7 +333,7 @@ export class Transaction extends Base {
|
|
|
337
333
|
<foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control>
|
|
338
334
|
<foxy-internal-transaction-post-action-control
|
|
339
335
|
infer="process-webhook"
|
|
340
|
-
href=${ifDefined((
|
|
336
|
+
href=${ifDefined((_q = (_p = this.data) === null || _p === void 0 ? void 0 : _p._links['fx:process_webhook']) === null || _q === void 0 ? void 0 : _q.href)}
|
|
341
337
|
>
|
|
342
338
|
</foxy-internal-transaction-post-action-control>
|
|
343
339
|
</foxy-internal-summary-control>
|
|
@@ -345,7 +341,7 @@ export class Transaction extends Base {
|
|
|
345
341
|
<foxy-nucleon
|
|
346
342
|
class="hidden"
|
|
347
343
|
infer=""
|
|
348
|
-
href=${ifDefined((
|
|
344
|
+
href=${ifDefined((_r = this.data) === null || _r === void 0 ? void 0 : _r._links['fx:store'].href)}
|
|
349
345
|
id="storeLoader"
|
|
350
346
|
@update=${() => this.requestUpdate()}
|
|
351
347
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAYE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,6EAA6E;QAC7E,gBAAW,GAAkB,IAAI,CAAC;QAElC,4BAAuB,GAAsC,IAAI,CAAC;QAElE,wBAAmB,GAAsC,IAAI,CAAC;QAE7C,0BAAqB,GAAG;YACvC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,KAAK,EA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AI,CAAC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;;gBAOO,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUlD,SAAS,CAAC,aAAa,CAAC;;;;;;;gBAOxB,SAAS,CAAC,YAAY,CAAC;;;;;;uBAMhB,IAAI,CAAC,qBAAqB;qBAC5B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;qBAC7B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;iBAQjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;;;;;;;;eAQ1D,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n // TODO remove ts-expect-error when SDK has the types\n // @ts-expect-error SDK types are incomplete\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n // TODO: Remove the ts-expect-error comment when SDK has the types\n // @ts-expect-error SDK doesn't have the types\n const webhooksUrl = new URL(this.__storeLoader?.data._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,o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EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const webhooksUrl = new URL(this.__storeLoader?.data?._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|
|
@@ -75,8 +75,6 @@ export class UserCard extends Base {
|
|
|
75
75
|
try {
|
|
76
76
|
if (!this.showInvitations)
|
|
77
77
|
return;
|
|
78
|
-
// TODO remove this when SDK has types for invitations.
|
|
79
|
-
// @ts-expect-error SDK does not have types for invitations yet.
|
|
80
78
|
const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:user_invitations'].href) !== null && _b !== void 0 ? _b : '');
|
|
81
79
|
url.searchParams.set('status', 'sent');
|
|
82
80
|
url.searchParams.set('limit', '1');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserCard.js","sourceRoot":"","sources":["../../../../src/elements/public/UserCard/UserCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,0CAAuC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,WAAW,CAAC;AACvB,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAU;IAAxC;;QAQE,0GAA0G;QAC1G,oBAAe,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"UserCard.js","sourceRoot":"","sources":["../../../../src/elements/public/UserCard/UserCard.ts"],"names":[],"mappings":"AAOA,OAAO,EA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nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { getGravatarUrl } from '../../../utils/get-gravatar-url';\nimport { asyncReplace } from 'lit-html/directives/async-replace';\nimport { TwoLineCard } from '../CustomFieldCard/TwoLineCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nconst NS = 'user-card';\nconst Base = TranslatableMixin(TwoLineCard, NS);\n\n/**\n * Card element representing a `fx:user` resource.\n *\n * @element foxy-user-card\n * @since 1.22.0\n */\nexport class UserCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n showInvitations: { type: Boolean, attribute: 'show-invitations' },\n };\n }\n\n /** When true, displays the number of unanswered invitations next to profile picture if there are some. */\n showInvitations = false;\n\n renderBody(): TemplateResult {\n const invitationsCount = this.__invitationsLoader?.data?.total_items ?? 0;\n\n return html`\n <div\n class=\"flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <div class=\"relative flex-shrink-0\">\n ${asyncReplace(this.__getGravatar(this.data?.email))}\n <span\n data-testid=\"invitations-count\"\n style=\"min-height: 1.5em; min-width: 1.5em; border-radius: 1.5em; left: calc(100% - 1em); top: -0.5em;\"\n class=${classMap({\n 'flex items-center justify-center bg-error text-error-contrast': true,\n 'font-medium px-xs leading-none text-xs absolute transform': true,\n 'scale-0': !this.showInvitations || invitationsCount === 0,\n })}\n >\n ${invitationsCount}\n </span>\n </div>\n <div class=\"min-w-0 flex-1\">\n ${super.renderBody({\n title: data => {\n const name = [data.first_name.trim(), data.last_name.trim()];\n return html`${name.filter(v => !!v).join(' ') || this.t('no_name')}`;\n },\n subtitle: data => html`${data.email}`,\n })}\n </div>\n </div>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__invitationsHref)}\n id=\"invitationsLoader\"\n @update=${this.requestUpdate}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __invitationsLoader() {\n type Loader = NucleonElement<Resource<Rels.UserInvitations>>;\n return this.renderRoot.querySelector<Loader>('#invitationsLoader');\n }\n\n private get __invitationsHref() {\n try {\n if (!this.showInvitations) return;\n const url = new URL(this.data?._links['fx:user_invitations'].href ?? '');\n url.searchParams.set('status', 'sent');\n url.searchParams.set('limit', '1');\n return url.toString();\n } catch {\n return;\n }\n }\n\n private async *__getGravatar(email?: string) {\n yield html`<div class=\"rounded-full w-s h-s bg-contrast-5\"></div>`;\n\n if (email) {\n yield html`\n <img\n class=\"rounded-full w-s h-s bg-contrast-5 shadow-xs\"\n src=${await getGravatarUrl(email)}\n alt=\"\"\n />\n `;\n }\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationCard/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.UserInvitation>;\n"]}
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Graph, Resource } from '@foxy.io/sdk/core';
|
|
1
|
+
import type { Resource } from '@foxy.io/sdk/core';
|
|
3
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
4
|
-
export
|
|
5
|
-
curie: 'fx:user_invitation';
|
|
6
|
-
links: {
|
|
7
|
-
'self': UserInvitation;
|
|
8
|
-
'fx:user': Rels.User;
|
|
9
|
-
'fx:store': Rels.Store;
|
|
10
|
-
'fx:resend': {
|
|
11
|
-
curie: 'fx:resend';
|
|
12
|
-
};
|
|
13
|
-
'fx:accept': {
|
|
14
|
-
curie: 'fx:accept';
|
|
15
|
-
};
|
|
16
|
-
'fx:reject': {
|
|
17
|
-
curie: 'fx:reject';
|
|
18
|
-
};
|
|
19
|
-
'fx:revoke': {
|
|
20
|
-
curie: 'fx:revoke';
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
props: {
|
|
24
|
-
store_url: string;
|
|
25
|
-
store_name: string;
|
|
26
|
-
store_email: string;
|
|
27
|
-
store_domain: string;
|
|
28
|
-
first_name: string | null;
|
|
29
|
-
last_name: string | null;
|
|
30
|
-
email: string;
|
|
31
|
-
status: 'sent' | 'accepted' | 'rejected' | 'revoked' | 'expired';
|
|
32
|
-
date_created: string;
|
|
33
|
-
date_modified: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface UserInvitations extends Graph {
|
|
37
|
-
curie: 'fx:user_invitations';
|
|
38
|
-
links: CollectionGraphLinks<UserInvitations>;
|
|
39
|
-
props: CollectionGraphProps;
|
|
40
|
-
child: UserInvitation;
|
|
41
|
-
}
|
|
42
|
-
export declare type Data = Resource<UserInvitation>;
|
|
3
|
+
export declare type Data = Resource<Rels.UserInvitation>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.UserInvitation>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxy.io/elements",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.36.0-beta.
|
|
4
|
+
"version": "1.36.0-beta.4",
|
|
5
5
|
"description": "E-commerce web components by Foxy.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@foxy.io/sdk": "^1.
|
|
30
|
+
"@foxy.io/sdk": "^1.13.0",
|
|
31
31
|
"@open-wc/lit-helpers": "^0.3.12",
|
|
32
32
|
"@open-wc/scoped-elements": "^1.2.1",
|
|
33
33
|
"@polymer/iron-icons": "^3.0.1",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"cookie-storage": "^6.1.0",
|
|
39
39
|
"dedent": "^1.5.3",
|
|
40
40
|
"email-validator": "^2.0.4",
|
|
41
|
+
"highlight.js": "^10.7.3",
|
|
41
42
|
"html-entities": "^2.4.0",
|
|
42
43
|
"i18next": "^19.7.0",
|
|
43
44
|
"i18next-http-backend": "^1.0.18",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
"uainfer": "^0.5.0",
|
|
50
51
|
"vanilla-hcaptcha": "^1.0.2",
|
|
51
52
|
"webcomponent-qr-code": "^1.0.5",
|
|
52
|
-
"highlight.js": "^10.7.3",
|
|
53
53
|
"xstate": "^4.16.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,aF as t,aG as s}from"./shared-d1195c27.js";var n=function(e,t,s,n){return new(s||(s=Promise))((function(i,r){function a(e){try{h(n.next(e))}catch(e){r(e)}}function o(e){try{h(n.throw(e))}catch(e){r(e)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(a,o)}h((n=n.apply(e,t||[])).next())}))};class i extends e{constructor(e){super(Object.assign(Object.assign({},e),{fetch:(...e)=>this.__fetch(...e)}))}signIn(t){return n(this,void 0,void 0,(function*(){i.v8n.credentials.check(t);const s=yield this.fetch(new URL("./authenticate",this.base).toString(),{body:JSON.stringify(t),method:"POST"});if(!s.ok){const t=401===s.status?"UNAUTHORIZED":"UNKNOWN";throw new e.AuthError({code:t})}{const e=yield s.json(),t=Object.assign(Object.assign({},e),{date_created:(new Date).toISOString()});this.storage.setItem(i.SESSION,JSON.stringify(t))}}))}signUp(t){return n(this,void 0,void 0,(function*(){i.v8n.signUpParams.check(t);const s=new URL("./sign_up",this.base),n=yield this.fetch(s.toString(),{method:"POST",body:JSON.stringify(t)});if(!n.ok){if(400===n.status)throw new e.AuthError({code:"INVALID_FORM"});if(401===n.status)throw new e.AuthError({code:"UNAUTHORIZED"});if(403===n.status)throw new e.AuthError({code:"UNAVAILABLE"});throw new e.AuthError({code:"UNKNOWN"})}}))}sendPasswordResetEmail(t){return n(this,void 0,void 0,(function*(){i.v8n.email.check(t.email);if(!(yield this.fetch(new URL("./forgot_password",this.base).toString(),{body:JSON.stringify(t),method:"POST"})).ok)throw new e.AuthError({code:"UNKNOWN"})}))}signOut(){return n(this,void 0,void 0,(function*(){if(!(yield this.fetch(new URL("./authenticate",this.base).toString(),{method:"DELETE"})).ok)throw new e.AuthError({code:"UNKNOWN"});this.storage.clear(),this.cache.clear()}))}__fetch(e,t){var r;return n(this,void 0,void 0,(function*(){let n=JSON.parse(null!==(r=this.storage.getItem(i.SESSION))&&void 0!==r?r:"null");const a=new s.Request(e,t);if(null!==n){new Date(n.date_created).getTime()+1e3*n.expires_in<Date.now()?(this.console.info("Session has expired, signing out."),this.storage.clear(),this.cache.clear(),n=null):a.headers.set("Authorization",`Bearer ${n.session_token}`)}a.headers.set("Content-Type","application/json"),a.headers.set("FOXY-API-VERSION","1"),this.console.trace(`${a.method} ${a.url}`);const o=yield s.fetch(a);if(n&&o.ok){const e=Object.assign(Object.assign({},n),{date_created:(new Date).toISOString()});this.storage.setItem(i.SESSION,JSON.stringify(e))}return o}))}}i.SESSION="session",i.v8n=Object.assign({},e.v8n,{signUpParams:t().schema({verification:t().schema({token:t().string(),type:t().passesAnyOf(t().exact("hcaptcha"))}),first_name:t().optional(t().string().maxLength(50)),last_name:t().optional(t().string().maxLength(50)),password:t().string().maxLength(50),email:t().string().maxLength(100)}),credentials:t().schema({email:t().string(),newPassword:t().optional(t().string()),password:t().string()}),email:t().string()});let r=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([a-zµμ]*)/gi;function a(e="",t="ms"){var s=null;return(e=e.replace(/(\d),(\d)/g,"$1$2")).replace(r,(function(e,t,n){(n=a[n]||a[n.toLowerCase().replace(/s$/,"")])&&(s=(s||0)+parseFloat(t,10)*n)})),s&&s/a[t]}a.nanosecond=a.ns=1e-6,a["µs"]=a["μs"]=a.us=a.microsecond=.001,a.millisecond=a.ms=1,a.second=a.sec=a.s=1e3*a.ms,a.minute=a.min=a.m=60*a.s,a.hour=a.hr=a.h=60*a.m,a.day=a.d=24*a.h,a.week=a.wk=a.w=7*a.d,a.month=a.b=30.4375*a.d,a.year=a.yr=a.y=365.25*a.d;var o=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(s[n[i]]=e[n[i]])}return s};class h{constructor(e){var{url:t}=e,s=o(e,["url"]);this.onsubmit=null,this.__tokenizationRequests=[],this.__iframeMessageHandler=e=>{var t,s;const n=JSON.parse(e.data);switch(n.type){case"tokenization_response":{const e=this.__tokenizationRequests.find((e=>e.id===n.id));n.token?null==e||e.resolve(n.token):null==e||e.reject(),this.__tokenizationRequests=this.__tokenizationRequests.filter((e=>e.id!==n.id));break}case"submit":null===(t=this.onsubmit)||void 0===t||t.call(this);break;case"resize":this.__iframe&&(this.__iframe.style.height=n.height);break;case"ready":this.configure(this.__config),null===(s=this.__mountingTask)||void 0===s||s.resolve()}},this.__iframeLoadHandler=e=>{if(this.__channel){const t=e.currentTarget.contentWindow;if(!t)throw new Error("Content window is not available.");t.postMessage("connect","*",[this.__channel.port2])}},this.__mountingTask=null,this.__channel=null,this.__iframe=null,this.__config=s,this.__url=t}configure(e){var t;this.__config=e;const s=Object.assign({type:"config"},e);null===(t=this.__channel)||void 0===t||t.port1.postMessage(JSON.stringify(s))}tokenize(){return new Promise(((e,t)=>{if(this.__channel){const s=this._createId();this.__tokenizationRequests.push({id:s,reject:t,resolve:e}),this.__channel.port1.postMessage(JSON.stringify({id:s,type:"tokenization_request"}))}else t()}))}unmount(){var e,t,s,n,i,r;null===(e=this.__channel)||void 0===e||e.port1.removeEventListener("message",this.__iframeMessageHandler),null===(t=this.__channel)||void 0===t||t.port1.close(),null===(s=this.__channel)||void 0===s||s.port2.close(),this.__channel=null,null===(n=this.__iframe)||void 0===n||n.removeEventListener("load",this.__iframeLoadHandler),null===(i=this.__iframe)||void 0===i||i.remove(),this.__iframe=null,null===(r=this.__mountingTask)||void 0===r||r.reject(),this.__mountingTask=null}mount(e){return this.unmount(),this.__channel=this._createMessageChannel(),this.__channel.port1.addEventListener("message",this.__iframeMessageHandler),this.__channel.port1.start(),this.__iframe=this._createIframe(e),this.__iframe.addEventListener("load",this.__iframeLoadHandler),this.__iframe.style.transition="height 0.15s ease",this.__iframe.style.margin="-2px",this.__iframe.style.height="100px",this.__iframe.style.width="calc(100% + 4px)",this.__iframe.src=this.__url,e.append(this.__iframe),new Promise(((e,t)=>{this.__mountingTask={reject:t,resolve:e}}))}clear(){var e;null===(e=this.__channel)||void 0===e||e.port1.postMessage(JSON.stringify({type:"clear"}))}_createMessageChannel(){return new MessageChannel}_createIframe(e){return e.ownerDocument.createElement("iframe")}_createId(){return`${Date.now()}${Math.random().toFixed(6).slice(2)}`}}export{i as A,h as P,a as p};
|