@foxy.io/elements 1.50.0 → 1.52.0-beta.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/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-admin-transaction-card.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -195
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-card.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +7 -7
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-490dadf8.js → shared-00b3766c.js} +1 -1
- package/dist/cdn/{shared-1301af85.js → shared-0378a2e7.js} +1 -1
- package/dist/cdn/{shared-67aeac0f.js → shared-058530fc.js} +1 -1
- package/dist/cdn/{shared-4dc0bd88.js → shared-05ee3727.js} +1 -1
- package/dist/cdn/{shared-bb2b7d41.js → shared-0f762c6f.js} +1 -1
- package/dist/cdn/{shared-6880e1f6.js → shared-0f92b865.js} +1 -1
- package/dist/cdn/{shared-021fbb51.js → shared-0fd68dc0.js} +2 -2
- package/dist/cdn/{shared-1fa1abbd.js → shared-11b28365.js} +1 -1
- package/dist/cdn/{shared-ddc1c32f.js → shared-1495abba.js} +1 -1
- package/dist/cdn/{shared-f7965314.js → shared-1597defa.js} +1 -1
- package/dist/cdn/{shared-084e1772.js → shared-1599feba.js} +1 -1
- package/dist/cdn/{shared-b0453b08.js → shared-19073761.js} +1 -1
- package/dist/cdn/{shared-8bf38c47.js → shared-1dc640ee.js} +1 -1
- package/dist/cdn/{shared-a9a8eb7c.js → shared-248965c0.js} +1 -1
- package/dist/cdn/{shared-9a454e09.js → shared-33a23cec.js} +1 -1
- package/dist/cdn/{shared-fc6e64a4.js → shared-377cce47.js} +2 -2
- package/dist/cdn/{shared-ee752063.js → shared-3eac4b7c.js} +1 -1
- package/dist/cdn/{shared-de4ec7bb.js → shared-436e1842.js} +1 -1
- package/dist/cdn/{shared-be071e3d.js → shared-515003f6.js} +1 -1
- package/dist/cdn/{shared-1492fa1c.js → shared-5d82169f.js} +1 -1
- package/dist/cdn/{shared-2a84ee72.js → shared-60497743.js} +1 -1
- package/dist/cdn/{shared-4cc1fb20.js → shared-609c9693.js} +1 -1
- package/dist/cdn/{shared-f05c924a.js → shared-62263428.js} +1 -1
- package/dist/cdn/{shared-0ea24ca2.js → shared-65094878.js} +1 -1
- package/dist/cdn/{shared-3c53446d.js → shared-6a0e1b94.js} +3 -3
- package/dist/cdn/{shared-8dd6e5cc.js → shared-6cdfb858.js} +1 -1
- package/dist/cdn/{shared-0a7a4660.js → shared-72511c81.js} +1 -1
- package/dist/cdn/{shared-3c0e3876.js → shared-7892fd3f.js} +4 -4
- package/dist/cdn/{shared-334b7e24.js → shared-80950330.js} +1 -1
- package/dist/cdn/{shared-bc8a1435.js → shared-81c78cb4.js} +1 -1
- package/dist/cdn/{shared-55fa26c2.js → shared-851a1b41.js} +1 -1
- package/dist/cdn/{shared-328aa161.js → shared-887ac0b0.js} +1 -1
- package/dist/cdn/{shared-591ee1bf.js → shared-8a428414.js} +1 -1
- package/dist/cdn/{shared-7a5d645f.js → shared-8d69329d.js} +1 -1
- package/dist/cdn/{shared-9a291941.js → shared-8d8975d5.js} +1 -1
- package/dist/cdn/{shared-f9bb0924.js → shared-8df8e77c.js} +1 -1
- package/dist/cdn/{shared-7c5881c1.js → shared-8efde31e.js} +1 -1
- package/dist/cdn/{shared-add0286c.js → shared-96207bb5.js} +1 -1
- package/dist/cdn/{shared-1da8110b.js → shared-9687ab7b.js} +1 -1
- package/dist/cdn/{shared-b0db52f7.js → shared-99c53365.js} +1 -1
- package/dist/cdn/{shared-d48e260f.js → shared-9a3bf65c.js} +1 -1
- package/dist/cdn/{shared-26b55da2.js → shared-9b35fe34.js} +1 -1
- package/dist/cdn/{shared-910d49eb.js → shared-a0baefff.js} +1 -1
- package/dist/cdn/{shared-ad470adf.js → shared-a20ef119.js} +2 -2
- package/dist/cdn/{shared-43fb8242.js → shared-a53bd0d6.js} +1 -1
- package/dist/cdn/{shared-ba43928a.js → shared-a5d6db21.js} +1 -1
- package/dist/cdn/{shared-d01853e2.js → shared-a6f696b9.js} +1 -1
- package/dist/cdn/shared-af6ccc54.js +1 -0
- package/dist/cdn/{shared-a18827a4.js → shared-afdf7b0c.js} +1 -1
- package/dist/cdn/shared-b1fa9899.js +1 -0
- package/dist/cdn/{shared-5fbbaea2.js → shared-b5e048f5.js} +1 -1
- package/dist/cdn/{shared-83613f15.js → shared-b948488a.js} +1 -1
- package/dist/cdn/{shared-31e75a4a.js → shared-ce05e482.js} +1 -1
- package/dist/cdn/shared-ce7777ce.js +1 -0
- package/dist/cdn/{shared-aa258319.js → shared-d14a664a.js} +1 -1
- package/dist/cdn/{shared-18e301f2.js → shared-db623837.js} +1 -1
- package/dist/cdn/{shared-47ce4456.js → shared-e2d843ca.js} +1 -1
- package/dist/cdn/{shared-68c69a0f.js → shared-e3c62f45.js} +1 -1
- package/dist/cdn/shared-e650caf3.js +1 -0
- package/dist/cdn/{shared-d74aac59.js → shared-ec015a24.js} +1 -1
- package/dist/cdn/{shared-462566b0.js → shared-f1588331.js} +1 -1
- package/dist/cdn/{shared-8f61408a.js → shared-f4f01846.js} +1 -1
- package/dist/cdn/{shared-097487d0.js → shared-f8e360e6.js} +1 -1
- package/dist/cdn/{shared-7e1a3361.js → shared-f9e4a1cc.js} +1 -1
- package/dist/cdn/{shared-986bcd05.js → shared-fa977775.js} +1 -1
- package/dist/cdn/{shared-e9d87207.js → shared-faa174b6.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +64 -9
- package/dist/cdn/translations/cart-form/en.json +64 -9
- package/dist/cdn/translations/item-form/en.json +64 -9
- package/dist/cdn/translations/report-form/en.json +83 -33
- package/dist/cdn/translations/reports-table/en.json +1 -0
- package/dist/cdn/translations/transaction/en.json +64 -9
- package/dist/elements/internal/InternalNativeDateControl/InternalNativeDateControl.d.ts +18 -0
- package/dist/elements/internal/InternalNativeDateControl/InternalNativeDateControl.js +109 -0
- package/dist/elements/internal/InternalNativeDateControl/InternalNativeDateControl.js.map +1 -0
- package/dist/elements/internal/InternalNativeDateControl/index.d.ts +3 -0
- package/dist/elements/internal/InternalNativeDateControl/index.js +5 -0
- package/dist/elements/internal/InternalNativeDateControl/index.js.map +1 -0
- package/dist/elements/public/ItemForm/ItemForm.d.ts +3 -0
- package/dist/elements/public/ItemForm/ItemForm.js +79 -4
- package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
- package/dist/elements/public/ItemForm/index.d.ts +3 -0
- package/dist/elements/public/ItemForm/index.js +3 -0
- package/dist/elements/public/ItemForm/index.js.map +1 -1
- package/dist/elements/public/ReportForm/ReportForm.d.ts +20 -18
- package/dist/elements/public/ReportForm/ReportForm.js +126 -339
- package/dist/elements/public/ReportForm/ReportForm.js.map +1 -1
- package/dist/elements/public/ReportForm/index.d.ts +5 -9
- package/dist/elements/public/ReportForm/index.js +5 -9
- package/dist/elements/public/ReportForm/index.js.map +1 -1
- package/dist/elements/public/ReportForm/utils.d.ts +1 -0
- package/dist/elements/public/ReportForm/utils.js +4 -0
- package/dist/elements/public/ReportForm/utils.js.map +1 -1
- package/dist/mixins/themeable.js +4 -8
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/utils/safe-date.js +7 -1
- package/dist/utils/safe-date.js.map +1 -1
- package/package.json +2 -2
- package/dist/cdn/shared-04277241.js +0 -1
- package/dist/cdn/shared-200aa12d.js +0 -1
- package/dist/cdn/shared-56a16e03.js +0 -1
- package/dist/cdn/shared-e6c743bd.js +0 -1
|
@@ -201,9 +201,9 @@
|
|
|
201
201
|
"placeholder": "Optional"
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
|
-
"
|
|
204
|
+
"subscription": {
|
|
205
205
|
"label": "Subscription",
|
|
206
|
-
"helper_text": "
|
|
206
|
+
"helper_text": "",
|
|
207
207
|
"subscription-frequency": {
|
|
208
208
|
"label": "Frequency",
|
|
209
209
|
"helper_text": "",
|
|
@@ -230,6 +230,49 @@
|
|
|
230
230
|
"placeholder": "None"
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
|
+
"downloadable-purchase": {
|
|
234
|
+
"label": "Downloadable usage",
|
|
235
|
+
"helper_text": "",
|
|
236
|
+
"no_stats_text": "This item has not been downloaded yet. Download statistics will appear here once the item has been downloaded by a customer.",
|
|
237
|
+
"number-of-downloads": {
|
|
238
|
+
"label": "Number of downloads"
|
|
239
|
+
},
|
|
240
|
+
"first-download-time": {
|
|
241
|
+
"label": "First download",
|
|
242
|
+
"value": "{{ value, date }} at {{ value, time }}"
|
|
243
|
+
},
|
|
244
|
+
"download-link": {
|
|
245
|
+
"label": "Download file"
|
|
246
|
+
},
|
|
247
|
+
"copy-download-link": {
|
|
248
|
+
"failed_to_copy": "Failed to copy",
|
|
249
|
+
"click_to_copy": "Copy URL",
|
|
250
|
+
"copying": "Copying...",
|
|
251
|
+
"done": "Copied to clipboard"
|
|
252
|
+
},
|
|
253
|
+
"reset-usage": {
|
|
254
|
+
"message_idle": "This action will attempt to reset usage for this downloadable purchase. Would you like to proceed?",
|
|
255
|
+
"message_fail": "Failed to reset usage for this downloadable purchase. If you'd like to retry, close this dialog and click the reset usage button again.",
|
|
256
|
+
"message_done": "Usage for this downloadable purchase was reset successfully. You can close this dialog now.",
|
|
257
|
+
"button_close": "Close",
|
|
258
|
+
"button_confirm": "Reset usage",
|
|
259
|
+
"button_cancel": "Go back",
|
|
260
|
+
"loading_busy": "Processing",
|
|
261
|
+
"header": "Reset usage",
|
|
262
|
+
"button": "Reset usage"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"actions": {
|
|
266
|
+
"download": {
|
|
267
|
+
"label": "Download file"
|
|
268
|
+
},
|
|
269
|
+
"copy-download-link": {
|
|
270
|
+
"failed_to_copy": "Failed to copy",
|
|
271
|
+
"click_to_copy": "Copy download link",
|
|
272
|
+
"copying": "Copying...",
|
|
273
|
+
"done": "Copied to clipboard"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
233
276
|
"dimensions": {
|
|
234
277
|
"label": "Dimensions",
|
|
235
278
|
"helper_text": "",
|
|
@@ -258,13 +301,13 @@
|
|
|
258
301
|
"label": "Meta",
|
|
259
302
|
"helper_text": "",
|
|
260
303
|
"url": {
|
|
261
|
-
"label": "URL",
|
|
262
|
-
"helper_text": "
|
|
304
|
+
"label": "Website URL",
|
|
305
|
+
"helper_text": "",
|
|
263
306
|
"placeholder": "None"
|
|
264
307
|
},
|
|
265
308
|
"image": {
|
|
266
|
-
"label": "Image",
|
|
267
|
-
"helper_text": "
|
|
309
|
+
"label": "Image URL",
|
|
310
|
+
"helper_text": "",
|
|
268
311
|
"placeholder": "None"
|
|
269
312
|
},
|
|
270
313
|
"quantity-max": {
|
|
@@ -278,8 +321,8 @@
|
|
|
278
321
|
"placeholder": "1"
|
|
279
322
|
},
|
|
280
323
|
"expires": {
|
|
281
|
-
"label": "
|
|
282
|
-
"helper_text": "
|
|
324
|
+
"label": "Expiry Date",
|
|
325
|
+
"helper_text": "",
|
|
283
326
|
"display_value": "{{ value, date }}",
|
|
284
327
|
"placeholder": "Optional"
|
|
285
328
|
}
|
|
@@ -311,6 +354,9 @@
|
|
|
311
354
|
},
|
|
312
355
|
"discount-details": {
|
|
313
356
|
"label": "Applied discounts",
|
|
357
|
+
"helper_text": "",
|
|
358
|
+
"total_items": "{{ count }} discount",
|
|
359
|
+
"total_items_plural": "{{ count }} discounts",
|
|
314
360
|
"pagination": {
|
|
315
361
|
"first": "First",
|
|
316
362
|
"last": "Last",
|
|
@@ -331,6 +377,9 @@
|
|
|
331
377
|
},
|
|
332
378
|
"coupon-details": {
|
|
333
379
|
"label": "Applied coupons",
|
|
380
|
+
"helper_text": "",
|
|
381
|
+
"total_items": "{{ count }} coupon",
|
|
382
|
+
"total_items_plural": "{{ count }} coupons",
|
|
334
383
|
"pagination": {
|
|
335
384
|
"first": "First",
|
|
336
385
|
"last": "Last",
|
|
@@ -351,6 +400,9 @@
|
|
|
351
400
|
},
|
|
352
401
|
"attributes": {
|
|
353
402
|
"label": "Attributes",
|
|
403
|
+
"helper_text": "",
|
|
404
|
+
"total_items": "{{ count }} attribute",
|
|
405
|
+
"total_items_plural": "{{ count }} attributes",
|
|
354
406
|
"delete_header": "Remove attribute?",
|
|
355
407
|
"delete_message": "Please confirm that you'd like to remove this attribute from the item.",
|
|
356
408
|
"delete_confirm": "Remove",
|
|
@@ -454,6 +506,9 @@
|
|
|
454
506
|
},
|
|
455
507
|
"item-options": {
|
|
456
508
|
"label": "Item options",
|
|
509
|
+
"helper_text": "",
|
|
510
|
+
"total_items": "{{ count }} option",
|
|
511
|
+
"total_items_plural": "{{ count }} options",
|
|
457
512
|
"delete_header": "Remove item option?",
|
|
458
513
|
"delete_message": "Please confirm that you'd like to remove this item option from the item.",
|
|
459
514
|
"delete_confirm": "Remove",
|
|
@@ -1784,4 +1839,4 @@
|
|
|
1784
1839
|
"loading_empty": "No data",
|
|
1785
1840
|
"loading_error": "Unknown error"
|
|
1786
1841
|
}
|
|
1787
|
-
}
|
|
1842
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
|
+
import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
|
|
3
|
+
/**
|
|
4
|
+
* Internal control displaying a basic text box with date input.
|
|
5
|
+
*
|
|
6
|
+
* @since 1.51.0
|
|
7
|
+
* @element foxy-internal-native-date-control
|
|
8
|
+
*/
|
|
9
|
+
export declare class InternalNativeDateControl extends InternalEditableControl {
|
|
10
|
+
static get properties(): PropertyDeclarations;
|
|
11
|
+
static get styles(): CSSResultArray;
|
|
12
|
+
format: 'date' | 'datetime-local';
|
|
13
|
+
private __isErrorVisible;
|
|
14
|
+
reportValidity(): void;
|
|
15
|
+
renderControl(): TemplateResult;
|
|
16
|
+
protected get _value(): string;
|
|
17
|
+
protected set _value(newValue: string);
|
|
18
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
2
|
+
import { html, css, svg } from 'lit-element';
|
|
3
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
4
|
+
import { live } from 'lit-html/directives/live';
|
|
5
|
+
/**
|
|
6
|
+
* Internal control displaying a basic text box with date input.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.51.0
|
|
9
|
+
* @element foxy-internal-native-date-control
|
|
10
|
+
*/
|
|
11
|
+
export class InternalNativeDateControl extends InternalEditableControl {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.format = 'date';
|
|
15
|
+
this.__isErrorVisible = false;
|
|
16
|
+
}
|
|
17
|
+
static get properties() {
|
|
18
|
+
return {
|
|
19
|
+
...super.properties,
|
|
20
|
+
format: {},
|
|
21
|
+
__isErrorVisible: { attribute: false },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static get styles() {
|
|
25
|
+
return [
|
|
26
|
+
super.styles,
|
|
27
|
+
css `input::-webkit-contacts-auto-fill-button{
|
|
28
|
+
visibility:hidden;
|
|
29
|
+
display:none !important;
|
|
30
|
+
pointer-events:none;
|
|
31
|
+
position:absolute;
|
|
32
|
+
right:0;
|
|
33
|
+
}
|
|
34
|
+
`,
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
reportValidity() {
|
|
38
|
+
this.__isErrorVisible = true;
|
|
39
|
+
super.reportValidity();
|
|
40
|
+
}
|
|
41
|
+
renderControl() {
|
|
42
|
+
return html `
|
|
43
|
+
<div class="leading-xs">
|
|
44
|
+
<div class="flex items-center gap-xs">
|
|
45
|
+
<label class="text-m text-body flex-1 whitespace-nowrap" for="input">${this.label}</label>
|
|
46
|
+
|
|
47
|
+
<input
|
|
48
|
+
placeholder=${this.placeholder}
|
|
49
|
+
class=${classMap({
|
|
50
|
+
'appearance-none text-right bg-transparent transition-colors': true,
|
|
51
|
+
'text-m rounded-s focus-outline-none': true,
|
|
52
|
+
'text-secondary': this.readonly,
|
|
53
|
+
'text-disabled': this.disabled,
|
|
54
|
+
'font-medium': !this.readonly,
|
|
55
|
+
})}
|
|
56
|
+
type=${this.format}
|
|
57
|
+
id="input"
|
|
58
|
+
.value=${live(this._value)}
|
|
59
|
+
?disabled=${this.disabled}
|
|
60
|
+
?readonly=${this.readonly}
|
|
61
|
+
@keydown=${(evt) => { var _a; return evt.key === 'Enter' && ((_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.submit()); }}
|
|
62
|
+
@blur=${() => (this.__isErrorVisible = true)}
|
|
63
|
+
@input=${(evt) => {
|
|
64
|
+
evt.stopPropagation();
|
|
65
|
+
this._value = evt.target.value;
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<button
|
|
70
|
+
aria-label=${this.t('clear')}
|
|
71
|
+
class=${classMap({
|
|
72
|
+
'flex-shrink-0 rounded-full transition-colors': true,
|
|
73
|
+
'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
|
|
74
|
+
'cursor-pointer text-tertiary hover-text-body': !this.disabled,
|
|
75
|
+
'cursor-default text-disabled': this.disabled,
|
|
76
|
+
})}
|
|
77
|
+
style="width: 1em; height: 1em;"
|
|
78
|
+
?disabled=${this.disabled}
|
|
79
|
+
?hidden=${this.readonly || !this._value}
|
|
80
|
+
@click=${() => {
|
|
81
|
+
this._value = '';
|
|
82
|
+
this.dispatchEvent(new CustomEvent('clear'));
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`}
|
|
86
|
+
</button>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div style="max-width: 32rem">
|
|
90
|
+
<p class="text-xs text-secondary">${this.helperText}</p>
|
|
91
|
+
<p
|
|
92
|
+
class="text-xs text-error"
|
|
93
|
+
?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}
|
|
94
|
+
>
|
|
95
|
+
${this._errorMessage}
|
|
96
|
+
</p>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
get _value() {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = super._value) !== null && _a !== void 0 ? _a : '';
|
|
104
|
+
}
|
|
105
|
+
set _value(newValue) {
|
|
106
|
+
super._value = newValue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=InternalNativeDateControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalNativeDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalNativeDateControl/InternalNativeDateControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAAtE;;QAwBE,WAAM,GAA8B,MAAM,CAAC;QAEnC,qBAAgB,GAAG,KAAK,CAAC;IA2EnC,CAAC;IApGC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UA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C,QAAQ;YAC9D,8BAA8B,EAAE,IAAI,CAAC,QAAQ;SAC9C,CAAC;;wBAEU,IAAI,CAAC,QAAQ;sBACf,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM;qBAC9B,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,CAAC;;cAEC,GAAG,CAAA,sWAAsW;;;;;8CAKzU,IAAI,CAAC,UAAU;;;sBAGvC,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;;cAEhE,IAAI,CAAC,aAAa;;;;KAI3B,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,aAAQ,KAAK,CAAC,MAA6B,mCAAI,EAAE,CAAC;IACpD,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAA+B,CAAC;IACjD,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css, svg } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\n/**\n * Internal control displaying a basic text box with date input.\n *\n * @since 1.51.0\n * @element foxy-internal-native-date-control\n */\nexport class InternalNativeDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: {},\n __isErrorVisible: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n input::-webkit-contacts-auto-fill-button {\n visibility: hidden;\n display: none !important;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n `,\n ];\n }\n\n format: 'date' | 'datetime-local' = 'date';\n\n private __isErrorVisible = false;\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n renderControl(): TemplateResult {\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=${this.format}\n id=\"input\"\n .value=${live(this._value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @blur=${() => (this.__isErrorVisible = true)}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLInputElement).value;\n }}\n />\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'flex-shrink-0 rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${() => {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n\n protected get _value(): string {\n return (super._value as string | undefined) ?? '';\n }\n\n protected set _value(newValue: string) {\n super._value = newValue as unknown | undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../InternalEditableControl/index.js";
|
|
2
|
+
import { InternalNativeDateControl as Control } from "./InternalNativeDateControl.js";
|
|
3
|
+
customElements.define('foxy-internal-native-date-control', Control);
|
|
4
|
+
export { Control as InternalNativeDateControl };
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalNativeDateControl/index.ts"],"names":[],"mappings":"AAAA,6CAA0C;AAC1C,OAAO,EAAE,yBAAyB,IAAI,OAAO,EAAE,uCAAoC;AAEnF,cAAc,CAAC,MAAM,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,CAAC","sourcesContent":["import '../InternalEditableControl/index';\nimport { InternalNativeDateControl as Control } from './InternalNativeDateControl';\n\ncustomElements.define('foxy-internal-native-date-control', Control);\n\nexport { Control as InternalNativeDateControl };\n"]}
|
|
@@ -26,15 +26,18 @@ export declare class ItemForm extends ItemForm_base<Data> {
|
|
|
26
26
|
coupons: string | null;
|
|
27
27
|
/** Link to `fx:store` this item belongs to. */
|
|
28
28
|
store: string | null;
|
|
29
|
+
private __downloadablePurchase;
|
|
29
30
|
private __itemsLink;
|
|
30
31
|
get headerSubtitleOptions(): Record<string, unknown>;
|
|
31
32
|
get readonlySelector(): BooleanSelector;
|
|
32
33
|
get hiddenSelector(): BooleanSelector;
|
|
34
|
+
renderHeaderActions(): TemplateResult;
|
|
33
35
|
renderBody(): TemplateResult;
|
|
34
36
|
protected _sendGet(): Promise<Data>;
|
|
35
37
|
private get __discountBuilderParsedValue();
|
|
36
38
|
private get __itemOptionRelatedUrls();
|
|
37
39
|
private get __storeLoader();
|
|
40
|
+
private __renderDownloadablePurchaseSection;
|
|
38
41
|
private __handleDiscountBuilderChange;
|
|
39
42
|
}
|
|
40
43
|
export {};
|
|
@@ -23,6 +23,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
23
23
|
this.coupons = null;
|
|
24
24
|
/** Link to `fx:store` this item belongs to. */
|
|
25
25
|
this.store = null;
|
|
26
|
+
this.__downloadablePurchase = null;
|
|
26
27
|
this.__itemsLink = '';
|
|
27
28
|
}
|
|
28
29
|
static get properties() {
|
|
@@ -61,6 +62,8 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
61
62
|
alwaysMatch.unshift('general:shipto');
|
|
62
63
|
if (this.data && !this.data.subscription_frequency)
|
|
63
64
|
alwaysMatch.unshift('subscriptions');
|
|
65
|
+
if (!this.__downloadablePurchase)
|
|
66
|
+
alwaysMatch.unshift('downloadable-purchase');
|
|
64
67
|
if (!this.form.discount_name)
|
|
65
68
|
alwaysMatch.unshift('discount:discount-builder');
|
|
66
69
|
if (!this.href) {
|
|
@@ -68,6 +71,31 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
68
71
|
}
|
|
69
72
|
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
70
73
|
}
|
|
74
|
+
renderHeaderActions() {
|
|
75
|
+
var _a;
|
|
76
|
+
if (!this.__downloadablePurchase)
|
|
77
|
+
return html ``;
|
|
78
|
+
const downloadUrl = (_a = this.__downloadablePurchase) === null || _a === void 0 ? void 0 : _a._links['fx:download_url'].href;
|
|
79
|
+
return html `
|
|
80
|
+
<a
|
|
81
|
+
data-testid="download-link"
|
|
82
|
+
target="_blank"
|
|
83
|
+
class="text-primary font-medium cursor-pointer hover-underline rounded-sm focus-outline-none focus-ring-2 focus-ring-primary-50"
|
|
84
|
+
href=${ifDefined(downloadUrl)}
|
|
85
|
+
rel="noopener noreferrer"
|
|
86
|
+
>
|
|
87
|
+
<foxy-i18n infer="actions download" key="label"></foxy-i18n>
|
|
88
|
+
</a>
|
|
89
|
+
|
|
90
|
+
<foxy-copy-to-clipboard
|
|
91
|
+
layout="text"
|
|
92
|
+
theme="tertiary-inline"
|
|
93
|
+
infer="actions copy-download-link"
|
|
94
|
+
text=${ifDefined(downloadUrl)}
|
|
95
|
+
>
|
|
96
|
+
</foxy-copy-to-clipboard>
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
71
99
|
renderBody() {
|
|
72
100
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
73
101
|
return html `
|
|
@@ -93,7 +121,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
93
121
|
</foxy-internal-text-control>
|
|
94
122
|
</foxy-internal-summary-control>
|
|
95
123
|
|
|
96
|
-
<foxy-internal-summary-control infer="
|
|
124
|
+
<foxy-internal-summary-control infer="subscription" layout="details">
|
|
97
125
|
<foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency">
|
|
98
126
|
</foxy-internal-frequency-control>
|
|
99
127
|
<foxy-internal-date-control layout="summary-item" infer="subscription-start-date">
|
|
@@ -102,7 +130,10 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
102
130
|
</foxy-internal-date-control>
|
|
103
131
|
</foxy-internal-summary-control>
|
|
104
132
|
|
|
133
|
+
${this.__renderDownloadablePurchaseSection()}
|
|
134
|
+
|
|
105
135
|
<foxy-internal-async-list-control
|
|
136
|
+
layout="details"
|
|
106
137
|
infer="item-options"
|
|
107
138
|
first=${ifDefined((_b = this.data) === null || _b === void 0 ? void 0 : _b._links['fx:item_options'].href)}
|
|
108
139
|
form="foxy-item-option-form"
|
|
@@ -113,7 +144,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
113
144
|
>
|
|
114
145
|
</foxy-internal-async-list-control>
|
|
115
146
|
|
|
116
|
-
<foxy-internal-summary-control infer="dimensions">
|
|
147
|
+
<foxy-internal-summary-control infer="dimensions" layout="details">
|
|
117
148
|
<foxy-internal-number-control layout="summary-item" infer="weight" min="0">
|
|
118
149
|
</foxy-internal-number-control>
|
|
119
150
|
<foxy-internal-number-control layout="summary-item" infer="length" min="0">
|
|
@@ -124,7 +155,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
124
155
|
</foxy-internal-number-control>
|
|
125
156
|
</foxy-internal-summary-control>
|
|
126
157
|
|
|
127
|
-
<foxy-internal-summary-control infer="meta">
|
|
158
|
+
<foxy-internal-summary-control infer="meta" layout="details">
|
|
128
159
|
<foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control>
|
|
129
160
|
<foxy-internal-text-control layout="summary-item" infer="image">
|
|
130
161
|
</foxy-internal-text-control>
|
|
@@ -136,7 +167,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
136
167
|
</foxy-internal-date-control>
|
|
137
168
|
</foxy-internal-summary-control>
|
|
138
169
|
|
|
139
|
-
<foxy-internal-summary-control infer="discount">
|
|
170
|
+
<foxy-internal-summary-control infer="discount" layout="details">
|
|
140
171
|
<foxy-internal-text-control layout="summary-item" infer="discount-name">
|
|
141
172
|
</foxy-internal-text-control>
|
|
142
173
|
<foxy-discount-builder
|
|
@@ -149,6 +180,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
149
180
|
</foxy-internal-summary-control>
|
|
150
181
|
|
|
151
182
|
<foxy-internal-async-list-control
|
|
183
|
+
layout="details"
|
|
152
184
|
infer="discount-details"
|
|
153
185
|
first=${ifDefined((_d = this.data) === null || _d === void 0 ? void 0 : _d._links['fx:discount_details'].href)}
|
|
154
186
|
item="foxy-discount-detail-card"
|
|
@@ -156,6 +188,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
156
188
|
</foxy-internal-async-list-control>
|
|
157
189
|
|
|
158
190
|
<foxy-internal-async-list-control
|
|
191
|
+
layout="details"
|
|
159
192
|
infer="coupon-details"
|
|
160
193
|
first=${ifDefined((_e = this.data) === null || _e === void 0 ? void 0 : _e._links['fx:coupon_details'].href)}
|
|
161
194
|
item="foxy-coupon-detail-card"
|
|
@@ -163,6 +196,7 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
163
196
|
</foxy-internal-async-list-control>
|
|
164
197
|
|
|
165
198
|
<foxy-internal-async-list-control
|
|
199
|
+
layout="details"
|
|
166
200
|
infer="attributes"
|
|
167
201
|
first=${ifDefined((_f = this.data) === null || _f === void 0 ? void 0 : _f._links['fx:attributes'].href)}
|
|
168
202
|
item="foxy-attribute-card"
|
|
@@ -185,6 +219,9 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
185
219
|
}
|
|
186
220
|
async _sendGet() {
|
|
187
221
|
const item = await super._sendGet();
|
|
222
|
+
if (item._links['fx:downloadable_purchase']) {
|
|
223
|
+
this.__downloadablePurchase = await super._fetch(item._links['fx:downloadable_purchase'].href);
|
|
224
|
+
}
|
|
188
225
|
if (item._links['fx:subscription']) {
|
|
189
226
|
const subscriptionHref = item._links['fx:subscription'].href;
|
|
190
227
|
const subscription = await super._fetch(subscriptionHref);
|
|
@@ -231,6 +268,44 @@ export class ItemForm extends TranslatableMixin(InternalForm, 'item-form') {
|
|
|
231
268
|
get __storeLoader() {
|
|
232
269
|
return this.renderRoot.querySelector('#storeLoader');
|
|
233
270
|
}
|
|
271
|
+
__renderDownloadablePurchaseSection() {
|
|
272
|
+
const download = this.__downloadablePurchase;
|
|
273
|
+
return html `
|
|
274
|
+
<foxy-internal-summary-control infer="downloadable-purchase" layout="details">
|
|
275
|
+
${(download === null || download === void 0 ? void 0 : download.number_of_downloads) ? html `
|
|
276
|
+
<p class="flex justify-between gap-m">
|
|
277
|
+
<foxy-i18n infer="number-of-downloads" key="label"></foxy-i18n>
|
|
278
|
+
<span class="text-secondary">${download.number_of_downloads}</span>
|
|
279
|
+
</p>
|
|
280
|
+
|
|
281
|
+
<p class="flex justify-between gap-m">
|
|
282
|
+
<foxy-i18n infer="first-download-time" key="label"></foxy-i18n>
|
|
283
|
+
<foxy-i18n
|
|
284
|
+
options=${JSON.stringify({ value: download === null || download === void 0 ? void 0 : download.first_download_time })}
|
|
285
|
+
class="text-secondary"
|
|
286
|
+
infer="first-download-time"
|
|
287
|
+
key="value"
|
|
288
|
+
>
|
|
289
|
+
</foxy-i18n>
|
|
290
|
+
</p>
|
|
291
|
+
|
|
292
|
+
<div class="flex justify-start">
|
|
293
|
+
<foxy-internal-post-action-control
|
|
294
|
+
theme="tertiary-inline"
|
|
295
|
+
infer="reset-usage"
|
|
296
|
+
href=${ifDefined(download === null || download === void 0 ? void 0 : download._links['fx:reset_usage'].href)}
|
|
297
|
+
>
|
|
298
|
+
</foxy-internal-post-action-control>
|
|
299
|
+
</div>
|
|
300
|
+
`
|
|
301
|
+
: html `
|
|
302
|
+
<p class="text-secondary">
|
|
303
|
+
<foxy-i18n infer="" key="no_stats_text"></foxy-i18n>
|
|
304
|
+
</p>
|
|
305
|
+
`}
|
|
306
|
+
</foxy-internal-summary-control>
|
|
307
|
+
`;
|
|
308
|
+
}
|
|
234
309
|
__handleDiscountBuilderChange(evt) {
|
|
235
310
|
const builder = evt.currentTarget;
|
|
236
311
|
const value = builder.parsedValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemForm/ItemForm.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU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scountBuilder';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\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 { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing items (`fx:item`).\n *\n * @element foxy-item-form\n * @since 1.17.0\n */\nexport class ItemForm extends TranslatableMixin(InternalForm, 'item-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n coupons: {},\n store: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (!!v && v.length <= 255) || 'name:v8n_too_long',\n ({ price: v }) => (typeof v === 'number' && !isNaN(v)) || 'price:v8n_required',\n ({ price: v }) => (typeof v === 'number' && v >= 0) || 'price:v8n_negative',\n ({ quantity: v }) => (typeof v === 'number' && v >= 1) || 'quantity:v8n_less_than_one',\n ];\n }\n\n /** @deprecated Link to the collection of customer addresses that can be used with this item. */\n customerAddresses: string | null = null;\n\n /** Link to the collection of item categories that can be used with this item. */\n itemCategories: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n /** @deprecated Link to the collection of coupons that can be used with this item. */\n coupons: string | null = null;\n\n /** Link to `fx:store` this item belongs to. */\n store: string | null = null;\n\n private __itemsLink = '';\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { context: this.data?.is_future_line_item ? 'future_line_item' : 'regular' };\n }\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n if (this.href) alwaysMatch.unshift('subscriptions');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.__storeLoader?.data?.features_multiship) alwaysMatch.unshift('general:shipto');\n if (this.data && !this.data.subscription_frequency) alwaysMatch.unshift('subscriptions');\n if (!this.form.discount_name) alwaysMatch.unshift('discount:discount-builder');\n if (!this.href) {\n alwaysMatch.unshift('discount-details', 'coupon-details', 'item-options', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"price\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-resource-picker-control\n layout=\"summary-item\"\n first=${ifDefined(this?.itemCategories ?? undefined)}\n infer=\"item-category-uri\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-resource-picker-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"code\"></foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"parent-code\">\n </foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"shipto\">\n </foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"subscriptions\">\n <foxy-internal-frequency-control layout=\"summary-item\" infer=\"subscription-frequency\">\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"subscription-start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"subscription-end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n infer=\"item-options\"\n first=${ifDefined(this.data?._links['fx:item_options'].href)}\n form=\"foxy-item-option-form\"\n item=\"foxy-item-option-card\"\n alert\n .related=${this.__itemOptionRelatedUrls}\n .itemProps=${{ 'locale-codes': this.localeCodes ?? '' }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"dimensions\">\n <foxy-internal-number-control layout=\"summary-item\" infer=\"weight\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"length\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"width\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"height\" min=\"0\">\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"meta\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"url\"></foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"image\">\n </foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity-max\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity-min\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"expires\" format=\"unix\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"discount\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"discount-name\">\n </foxy-internal-text-control>\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=${classMap({ hidden: this.hiddenSelector.matches('discount-builder', true) })}\n .parsedValue=${this.__discountBuilderParsedValue}\n @change=${this.__handleDiscountBuilderChange}\n >\n </foxy-discount-builder>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n infer=\"discount-details\"\n first=${ifDefined(this.data?._links['fx:discount_details'].href)}\n item=\"foxy-discount-detail-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"coupon-details\"\n first=${ifDefined(this.data?._links['fx:coupon_details'].href)}\n item=\"foxy-coupon-detail-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store ?? void 0)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n type TransactionTemplate = Resource<Rels.TransactionTemplate>;\n type Subscription = Resource<Rels.Subscription>;\n type Transaction = Resource<Rels.Transaction>;\n type Cart = Resource<Rels.Cart>;\n\n const item = await super._sendGet();\n\n if (item._links['fx:subscription']) {\n const subscriptionHref = item._links['fx:subscription'].href;\n const subscription = await super._fetch<Subscription>(subscriptionHref);\n\n const transactionTemplateHref = subscription._links['fx:transaction_template'].href;\n const transactionTemplate = await super._fetch<TransactionTemplate>(transactionTemplateHref);\n\n this.__itemsLink = transactionTemplate._links['fx:items'].href;\n return item;\n }\n\n if (item._links['fx:transaction']) {\n const transaction = await super._fetch<Transaction>(item._links['fx:transaction'].href);\n this.__itemsLink = transaction._links['fx:items'].href;\n return item;\n }\n\n if (item._links['fx:cart']) {\n const cart = await super._fetch<Cart>(item._links['fx:cart'].href);\n this.__itemsLink = cart._links['fx:items'].href;\n return item;\n }\n\n return item;\n }\n\n private get __discountBuilderParsedValue() {\n return {\n details: this.form.discount_details,\n type: this.form.discount_type,\n name: this.form.discount_name,\n };\n }\n\n private get __itemOptionRelatedUrls() {\n const links = (this.data?._links ?? {}) as Record<string, { href: string }>;\n const urls: string[] = [];\n\n if (links['fx:subscription']) urls.push(links['fx:subscription'].href);\n if (links['fx:transaction']) urls.push(links['fx:transaction'].href);\n if (links['fx:shipment']) urls.push(links['fx:shipment'].href);\n if (links['fx:cart']) urls.push(links['fx:cart'].href);\n if (this.__itemsLink) urls.push(this.__itemsLink);\n\n return urls;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n\n private __handleDiscountBuilderChange(evt: CustomEvent) {\n const builder = evt.currentTarget as DiscountBuilder;\n const value = builder.parsedValue;\n\n this.edit({\n discount_details: value.details,\n discount_type: value.type,\n discount_name: value.name,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ItemForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemForm/ItemForm.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAO;IAAhF;;QAsBE,gGAAgG;QAChG,sBAAiB,GAAkB,IAAI,CAAC;QAExC,iFAAiF;QACjF,mBAAc,GAAkB,IAAI,CAAC;QAErC,6EAA6E;QAC7E,gBAAW,GAAkB,IAAI,CAAC;QAElC,qFAAqF;QACrF,YAAO,GAAkB,IAAI,CAAC;QAE9B,+CAA+C;QAC/C,UAAK,GAAkB,IAAI,CAAC;QAEpB,2BAAsB,GAA+C,IAAI,CAAC;QAE1E,gBAAW,GAAG,EAAE,CAAC;IAiS3B,CAAC;IAvUC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,K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CAAA;;;+CAG+B,QAAQ,CAAC,mBAAmB;;;;;;4BAM/C,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,mBAAmB,EAAE,CAAC;;;;;;;;;;;;yBAY3D,SAAS,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC;;;;aAI9D;YACH,CAAC,CAAC,IAAI,CAAA;;;;aAIH;;KAER,CAAC;IACJ,CAAC;IAEO,6BAA6B,CAAC,GAAgB;QACpD,MAAM,OAAO,GAAG,GAAG,CAAC,aAAgC,CAAC;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC;QAElC,IAAI,CAAC,IAAI,CAAC;YACR,gBAAgB,EAAE,KAAK,CAAC,OAAO;YAC/B,aAAa,EAAE,KAAK,CAAC,IAAI;YACzB,aAAa,EAAE,KAAK,CAAC,IAAI;SAC1B,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { DiscountBuilder } from '../DiscountBuilder/DiscountBuilder';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\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 { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing items (`fx:item`).\n *\n * @element foxy-item-form\n * @since 1.17.0\n */\nexport class ItemForm extends TranslatableMixin(InternalForm, 'item-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n coupons: {},\n store: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (!!v && v.length <= 255) || 'name:v8n_too_long',\n ({ price: v }) => (typeof v === 'number' && !isNaN(v)) || 'price:v8n_required',\n ({ price: v }) => (typeof v === 'number' && v >= 0) || 'price:v8n_negative',\n ({ quantity: v }) => (typeof v === 'number' && v >= 1) || 'quantity:v8n_less_than_one',\n ];\n }\n\n /** @deprecated Link to the collection of customer addresses that can be used with this item. */\n customerAddresses: string | null = null;\n\n /** Link to the collection of item categories that can be used with this item. */\n itemCategories: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n /** @deprecated Link to the collection of coupons that can be used with this item. */\n coupons: string | null = null;\n\n /** Link to `fx:store` this item belongs to. */\n store: string | null = null;\n\n private __downloadablePurchase: Resource<Rels.DownloadablePurchase> | null = null;\n\n private __itemsLink = '';\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { context: this.data?.is_future_line_item ? 'future_line_item' : 'regular' };\n }\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n if (this.href) alwaysMatch.unshift('subscriptions');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.__storeLoader?.data?.features_multiship) alwaysMatch.unshift('general:shipto');\n if (this.data && !this.data.subscription_frequency) alwaysMatch.unshift('subscriptions');\n if (!this.__downloadablePurchase) alwaysMatch.unshift('downloadable-purchase');\n if (!this.form.discount_name) alwaysMatch.unshift('discount:discount-builder');\n if (!this.href) {\n alwaysMatch.unshift('discount-details', 'coupon-details', 'item-options', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderHeaderActions(): TemplateResult {\n if (!this.__downloadablePurchase) return html``;\n const downloadUrl = this.__downloadablePurchase?._links['fx:download_url'].href;\n\n return html`\n <a\n data-testid=\"download-link\"\n target=\"_blank\"\n class=\"text-primary font-medium cursor-pointer hover-underline rounded-sm focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${ifDefined(downloadUrl)}\n rel=\"noopener noreferrer\"\n >\n <foxy-i18n infer=\"actions download\" key=\"label\"></foxy-i18n>\n </a>\n\n <foxy-copy-to-clipboard\n layout=\"text\"\n theme=\"tertiary-inline\"\n infer=\"actions copy-download-link\"\n text=${ifDefined(downloadUrl)}\n >\n </foxy-copy-to-clipboard>\n `;\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"price\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-resource-picker-control\n layout=\"summary-item\"\n first=${ifDefined(this?.itemCategories ?? undefined)}\n infer=\"item-category-uri\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-resource-picker-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"code\"></foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"parent-code\">\n </foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"shipto\">\n </foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"subscription\" layout=\"details\">\n <foxy-internal-frequency-control layout=\"summary-item\" infer=\"subscription-frequency\">\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"subscription-start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"subscription-end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n ${this.__renderDownloadablePurchaseSection()}\n\n <foxy-internal-async-list-control\n layout=\"details\"\n infer=\"item-options\"\n first=${ifDefined(this.data?._links['fx:item_options'].href)}\n form=\"foxy-item-option-form\"\n item=\"foxy-item-option-card\"\n alert\n .related=${this.__itemOptionRelatedUrls}\n .itemProps=${{ 'locale-codes': this.localeCodes ?? '' }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"dimensions\" layout=\"details\">\n <foxy-internal-number-control layout=\"summary-item\" infer=\"weight\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"length\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"width\" min=\"0\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"height\" min=\"0\">\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"meta\" layout=\"details\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"url\"></foxy-internal-text-control>\n <foxy-internal-text-control layout=\"summary-item\" infer=\"image\">\n </foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity-max\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"quantity-min\" step=\"1\" min=\"1\">\n </foxy-internal-number-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"expires\" format=\"unix\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"discount\" layout=\"details\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"discount-name\">\n </foxy-internal-text-control>\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=${classMap({ hidden: this.hiddenSelector.matches('discount-builder', true) })}\n .parsedValue=${this.__discountBuilderParsedValue}\n @change=${this.__handleDiscountBuilderChange}\n >\n </foxy-discount-builder>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n layout=\"details\"\n infer=\"discount-details\"\n first=${ifDefined(this.data?._links['fx:discount_details'].href)}\n item=\"foxy-discount-detail-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n layout=\"details\"\n infer=\"coupon-details\"\n first=${ifDefined(this.data?._links['fx:coupon_details'].href)}\n item=\"foxy-coupon-detail-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n layout=\"details\"\n infer=\"attributes\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store ?? void 0)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n type TransactionTemplate = Resource<Rels.TransactionTemplate>;\n type Subscription = Resource<Rels.Subscription>;\n type Transaction = Resource<Rels.Transaction>;\n type Cart = Resource<Rels.Cart>;\n\n const item = await super._sendGet();\n\n if (item._links['fx:downloadable_purchase']) {\n this.__downloadablePurchase = await super._fetch<Resource<Rels.DownloadablePurchase>>(\n item._links['fx:downloadable_purchase'].href\n );\n }\n\n if (item._links['fx:subscription']) {\n const subscriptionHref = item._links['fx:subscription'].href;\n const subscription = await super._fetch<Subscription>(subscriptionHref);\n\n const transactionTemplateHref = subscription._links['fx:transaction_template'].href;\n const transactionTemplate = await super._fetch<TransactionTemplate>(transactionTemplateHref);\n\n this.__itemsLink = transactionTemplate._links['fx:items'].href;\n return item;\n }\n\n if (item._links['fx:transaction']) {\n const transaction = await super._fetch<Transaction>(item._links['fx:transaction'].href);\n this.__itemsLink = transaction._links['fx:items'].href;\n return item;\n }\n\n if (item._links['fx:cart']) {\n const cart = await super._fetch<Cart>(item._links['fx:cart'].href);\n this.__itemsLink = cart._links['fx:items'].href;\n return item;\n }\n\n return item;\n }\n\n private get __discountBuilderParsedValue() {\n return {\n details: this.form.discount_details,\n type: this.form.discount_type,\n name: this.form.discount_name,\n };\n }\n\n private get __itemOptionRelatedUrls() {\n const links = (this.data?._links ?? {}) as Record<string, { href: string }>;\n const urls: string[] = [];\n\n if (links['fx:subscription']) urls.push(links['fx:subscription'].href);\n if (links['fx:transaction']) urls.push(links['fx:transaction'].href);\n if (links['fx:shipment']) urls.push(links['fx:shipment'].href);\n if (links['fx:cart']) urls.push(links['fx:cart'].href);\n if (this.__itemsLink) urls.push(this.__itemsLink);\n\n return urls;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n\n private __renderDownloadablePurchaseSection(): TemplateResult {\n const download = this.__downloadablePurchase;\n\n return html`\n <foxy-internal-summary-control infer=\"downloadable-purchase\" layout=\"details\">\n ${download?.number_of_downloads\n ? html`\n <p class=\"flex justify-between gap-m\">\n <foxy-i18n infer=\"number-of-downloads\" key=\"label\"></foxy-i18n>\n <span class=\"text-secondary\">${download.number_of_downloads}</span>\n </p>\n\n <p class=\"flex justify-between gap-m\">\n <foxy-i18n infer=\"first-download-time\" key=\"label\"></foxy-i18n>\n <foxy-i18n\n options=${JSON.stringify({ value: download?.first_download_time })}\n class=\"text-secondary\"\n infer=\"first-download-time\"\n key=\"value\"\n >\n </foxy-i18n>\n </p>\n\n <div class=\"flex justify-start\">\n <foxy-internal-post-action-control\n theme=\"tertiary-inline\"\n infer=\"reset-usage\"\n href=${ifDefined(download?._links['fx:reset_usage'].href)}\n >\n </foxy-internal-post-action-control>\n </div>\n `\n : html`\n <p class=\"text-secondary\">\n <foxy-i18n infer=\"\" key=\"no_stats_text\"></foxy-i18n>\n </p>\n `}\n </foxy-internal-summary-control>\n `;\n }\n\n private __handleDiscountBuilderChange(evt: CustomEvent) {\n const builder = evt.currentTarget as DiscountBuilder;\n const value = builder.parsedValue;\n\n this.edit({\n discount_details: value.details,\n discount_type: value.type,\n discount_name: value.name,\n });\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '../../internal/InternalResourcePickerControl/index';
|
|
2
|
+
import '../../internal/InternalPostActionControl/index';
|
|
2
3
|
import '../../internal/InternalAsyncListControl/index';
|
|
3
4
|
import '../../internal/InternalFrequencyControl/index';
|
|
4
5
|
import '../../internal/InternalSummaryControl/index';
|
|
@@ -9,11 +10,13 @@ import '../../internal/InternalForm/index';
|
|
|
9
10
|
import '../DiscountDetailCard/index';
|
|
10
11
|
import '../CouponDetailCard/index';
|
|
11
12
|
import '../ItemCategoryCard/index';
|
|
13
|
+
import '../CopyToClipboard/index';
|
|
12
14
|
import '../DiscountBuilder/index';
|
|
13
15
|
import '../ItemOptionCard/index';
|
|
14
16
|
import '../ItemOptionForm/index';
|
|
15
17
|
import '../NucleonElement/index';
|
|
16
18
|
import '../AttributeCard/index';
|
|
17
19
|
import '../AttributeForm/index';
|
|
20
|
+
import '../I18n/index';
|
|
18
21
|
import { ItemForm } from './ItemForm';
|
|
19
22
|
export { ItemForm };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../internal/InternalResourcePickerControl/index.js";
|
|
2
|
+
import "../../internal/InternalPostActionControl/index.js";
|
|
2
3
|
import "../../internal/InternalAsyncListControl/index.js";
|
|
3
4
|
import "../../internal/InternalFrequencyControl/index.js";
|
|
4
5
|
import "../../internal/InternalSummaryControl/index.js";
|
|
@@ -9,12 +10,14 @@ import "../../internal/InternalForm/index.js";
|
|
|
9
10
|
import "../DiscountDetailCard/index.js";
|
|
10
11
|
import "../CouponDetailCard/index.js";
|
|
11
12
|
import "../ItemCategoryCard/index.js";
|
|
13
|
+
import "../CopyToClipboard/index.js";
|
|
12
14
|
import "../DiscountBuilder/index.js";
|
|
13
15
|
import "../ItemOptionCard/index.js";
|
|
14
16
|
import "../ItemOptionForm/index.js";
|
|
15
17
|
import "../NucleonElement/index.js";
|
|
16
18
|
import "../AttributeCard/index.js";
|
|
17
19
|
import "../AttributeForm/index.js";
|
|
20
|
+
import "../I18n/index.js";
|
|
18
21
|
import { ItemForm } from "./ItemForm.js";
|
|
19
22
|
customElements.define('foxy-item-form', ItemForm);
|
|
20
23
|
export { ItemForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemForm/index.ts"],"names":[],"mappings":"AAAA,+DAA4D;AAC5D,0DAAuD;AACvD,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,qDAAkD;AAClD,qDAAkD;AAClD,8CAA2C;AAE3C,wCAAqC;AACrC,sCAAmC;AACnC,sCAAmC;AACnC,qCAAkC;AAClC,oCAAiC;AACjC,oCAAiC;AACjC,oCAAiC;AACjC,mCAAgC;AAChC,mCAAgC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemForm/index.ts"],"names":[],"mappings":"AAAA,+DAA4D;AAC5D,2DAAwD;AACxD,0DAAuD;AACvD,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,qDAAkD;AAClD,qDAAkD;AAClD,8CAA2C;AAE3C,wCAAqC;AACrC,sCAAmC;AACnC,sCAAmC;AACnC,qCAAkC;AAClC,qCAAkC;AAClC,oCAAiC;AACjC,oCAAiC;AACjC,oCAAiC;AACjC,mCAAgC;AAChC,mCAAgC;AAChC,0BAAuB;AAEvB,OAAO,EAAE,QAAQ,EAAE,sBAAmB;AAEtC,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import '../../internal/InternalResourcePickerControl/index';\nimport '../../internal/InternalPostActionControl/index';\nimport '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalFrequencyControl/index';\nimport '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalNumberControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalDateControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../DiscountDetailCard/index';\nimport '../CouponDetailCard/index';\nimport '../ItemCategoryCard/index';\nimport '../CopyToClipboard/index';\nimport '../DiscountBuilder/index';\nimport '../ItemOptionCard/index';\nimport '../ItemOptionForm/index';\nimport '../NucleonElement/index';\nimport '../AttributeCard/index';\nimport '../AttributeForm/index';\nimport '../I18n/index';\n\nimport { ItemForm } from './ItemForm';\n\ncustomElements.define('foxy-item-form', ItemForm);\n\nexport { ItemForm };\n"]}
|