@dropins/storefront-account 0.1.0-alpha4 → 0.1.0-alpha6

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.
Files changed (131) hide show
  1. package/api/createCustomerAddress/createCustomerAddress.d.ts +4 -0
  2. package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +2 -0
  3. package/api/createCustomerAddress/index.d.ts +2 -0
  4. package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
  5. package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
  6. package/api/getAttributesForm/index.d.ts +2 -0
  7. package/api/getCountries/getCountries.d.ts +5 -0
  8. package/api/getCountries/graphql/getCountries.graphql.d.ts +2 -0
  9. package/api/getCountries/index.d.ts +2 -0
  10. package/api/getCustomer/getCustomer.d.ts +4 -0
  11. package/api/getCustomer/graphql/getCustomer.graphql.d.ts +2 -0
  12. package/api/getCustomer/index.d.ts +2 -0
  13. package/api/getCustomerAddress/getCustomerAddress.d.ts +4 -0
  14. package/api/getCustomerAddress/graphql/getCustomerAddress.graphql.d.ts +2 -0
  15. package/api/getCustomerAddress/index.d.ts +2 -0
  16. package/api/getOrderHistoryList/getOrderHistoryList.d.ts +4 -0
  17. package/api/getOrderHistoryList/graphql/getOrderHistoryList.graphql.d.ts +2 -0
  18. package/api/getOrderHistoryList/index.d.ts +2 -0
  19. package/api/getRegions/getRegions.d.ts +2 -0
  20. package/api/getRegions/graphql/getRegions.graphql.d.ts +2 -0
  21. package/api/getRegions/index.d.ts +2 -0
  22. package/api/index.d.ts +9 -0
  23. package/api/initialize/initialize.d.ts +4 -0
  24. package/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.d.ts +2 -0
  25. package/api/removeCustomerAddress/index.d.ts +2 -0
  26. package/api/removeCustomerAddress/removeCustomerAddress.d.ts +2 -0
  27. package/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.d.ts +2 -0
  28. package/api/updateCustomerAddress/index.d.ts +2 -0
  29. package/api/updateCustomerAddress/updateCustomerAddress.d.ts +8 -0
  30. package/api.js +9 -1
  31. package/chunks/AddressFormWrapper.js +1 -0
  32. package/chunks/AddressFormWrapper2.js +1 -0
  33. package/chunks/checkIsFunction.js +1 -0
  34. package/chunks/convertCase.js +1 -0
  35. package/chunks/getOrderHistoryList.js +90 -0
  36. package/chunks/removeCustomerAddress.js +35 -0
  37. package/chunks/transform-customer-address.js +1 -0
  38. package/chunks/updateCustomerAddress.js +78 -0
  39. package/components/AccountLoaders/AccountLoaders.d.ts +7 -0
  40. package/components/AccountLoaders/index.d.ts +3 -0
  41. package/components/AddressActions/AddressActions.d.ts +5 -0
  42. package/components/AddressActions/index.d.ts +3 -0
  43. package/components/AddressCard/AddressCard.d.ts +5 -0
  44. package/components/AddressCard/index.d.ts +3 -0
  45. package/components/AddressFormWrapper/AddressFormWrapper.d.ts +5 -0
  46. package/components/AddressFormWrapper/index.d.ts +3 -0
  47. package/components/AddressModal/AddressModal.d.ts +5 -0
  48. package/components/AddressModal/index.d.ts +3 -0
  49. package/components/AddressesWrapper/AddressesWrapper.d.ts +5 -0
  50. package/components/AddressesWrapper/index.d.ts +3 -0
  51. package/components/EmptyList/EmptyList.d.ts +5 -0
  52. package/components/EmptyList/index.d.ts +3 -0
  53. package/components/Form/Form.d.ts +5 -0
  54. package/components/Form/FormInputs/FormInputs.d.ts +5 -0
  55. package/components/Form/FormInputs/index.d.ts +3 -0
  56. package/components/Form/index.d.ts +3 -0
  57. package/components/OrdersListAction/OrdersListAction.d.ts +5 -0
  58. package/components/OrdersListAction/index.d.ts +3 -0
  59. package/components/OrdersListCard/OrdersListCard.d.ts +5 -0
  60. package/components/OrdersListCard/index.d.ts +3 -0
  61. package/components/OrdersListWrapper/OrdersListWrapper.d.ts +5 -0
  62. package/components/OrdersListWrapper/index.d.ts +3 -0
  63. package/components/index.d.ts +13 -0
  64. package/configs/addressField.config.d.ts +39 -0
  65. package/configs/defaultAttributePreset.config.d.ts +2 -0
  66. package/configs/mockDefaultAddress.config.d.ts +184 -0
  67. package/configs/mockOrdersList.config.d.ts +96 -0
  68. package/containers/AddressForm/AddressForm.d.ts +5 -0
  69. package/containers/AddressForm/index.d.ts +3 -0
  70. package/containers/AddressForm.d.ts +3 -0
  71. package/containers/AddressForm.js +1 -0
  72. package/containers/Addresses/Addresses.d.ts +5 -0
  73. package/containers/Addresses/index.d.ts +3 -0
  74. package/containers/Addresses.d.ts +3 -0
  75. package/containers/Addresses.js +1 -0
  76. package/containers/OrdersList/OrdersList.d.ts +5 -0
  77. package/containers/OrdersList/index.d.ts +3 -0
  78. package/containers/OrdersList.d.ts +3 -0
  79. package/containers/OrdersList.js +1 -0
  80. package/containers/index.d.ts +4 -0
  81. package/data/models/attributes-form.d.ts +45 -0
  82. package/data/models/country.d.ts +5 -0
  83. package/data/models/customer-address.d.ts +21 -0
  84. package/data/models/customer.d.ts +6 -0
  85. package/data/models/index.d.ts +5 -1
  86. package/data/models/order-history-list.d.ts +63 -0
  87. package/data/models/region.d.ts +10 -0
  88. package/data/transforms/index.d.ts +6 -1
  89. package/data/transforms/transform-attributes-form.d.ts +6 -0
  90. package/data/transforms/transform-countries.d.ts +6 -0
  91. package/data/transforms/transform-customer-address.d.ts +8 -0
  92. package/data/transforms/transform-customer.d.ts +5 -0
  93. package/data/transforms/transform-order-history-list.d.ts +5 -0
  94. package/data/transforms/transform-regions.d.ts +6 -0
  95. package/hooks/api/useCountryRegionOptions.d.ts +7 -0
  96. package/hooks/components/useForm.d.ts +12 -0
  97. package/hooks/containers/useAddressForm.d.ts +20 -0
  98. package/hooks/containers/useAddresses.d.ts +22 -0
  99. package/hooks/containers/useOrdersList.d.ts +11 -0
  100. package/hooks/useDebounce.d.ts +3 -0
  101. package/i18n/en_US.json.d.ts +85 -1
  102. package/lib/checkIsFunction.d.ts +2 -0
  103. package/lib/convertCase.d.ts +4 -0
  104. package/lib/convertToBoolean.d.ts +2 -0
  105. package/lib/convertToInputDateFormat.d.ts +2 -0
  106. package/lib/fetch-error.d.ts +5 -0
  107. package/lib/formatDateToLocale.d.ts +31 -0
  108. package/lib/getFieldsConfig.d.ts +24 -0
  109. package/lib/getFormValues.d.ts +2 -0
  110. package/lib/manageAddressDeletion.d.ts +9 -0
  111. package/lib/network-error.d.ts +6 -0
  112. package/lib/normalizeAttributes.d.ts +2 -0
  113. package/lib/serializeAddressForm.d.ts +4 -0
  114. package/package.json +1 -1
  115. package/render.js +3 -1
  116. package/types/addressForm.types.d.ts +41 -0
  117. package/types/addresses.types.d.ts +56 -0
  118. package/types/api/createCustomerAddress.types.d.ts +47 -0
  119. package/types/api/getAttributesForm.types.d.ts +31 -0
  120. package/types/api/getCountries.types.d.ts +15 -0
  121. package/types/api/getCustomer.types.d.ts +13 -0
  122. package/types/api/getCustomerAddress.type.d.ts +36 -0
  123. package/types/api/getOrderHistoryList.types.d.ts +73 -0
  124. package/types/api/getRegions.types.d.ts +16 -0
  125. package/types/api/removeCustomerAddress.types.d.ts +9 -0
  126. package/types/api/updateCustomerAddress.types.d.ts +11 -0
  127. package/types/emptyList.types.d.ts +8 -0
  128. package/types/form.types.d.ts +40 -0
  129. package/types/index.d.ts +16 -0
  130. package/types/ordersList.types.d.ts +49 -0
  131. package/types/translations.types.d.ts +9 -0
@@ -0,0 +1,6 @@
1
+ import { RegionsFormResponse } from '../../types';
2
+ import { RegionTransform } from '../models';
3
+
4
+ export declare const transformRegions: (response: RegionsFormResponse) => RegionTransform[] | [
5
+ ];
6
+ //# sourceMappingURL=transform-regions.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Country } from '../../data/models';
2
+
3
+ export declare const useCountryRegionOptions: () => {
4
+ countryRegionOptions: Record<string, [] | Country[]>;
5
+ handleSetCountryCode: (value: string) => void;
6
+ };
7
+ //# sourceMappingURL=useCountryRegionOptions.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { useFormProps } from '../../types';
2
+
3
+ export declare const useForm: ({ fieldsConfig, onSubmit, handleSetCountryCode, onChange, }: useFormProps) => {
4
+ formData: Record<string, string | number | boolean>;
5
+ errors: Record<string, string>;
6
+ formRef: import('preact').RefObject<HTMLFormElement>;
7
+ handleInputChange: (event: Event) => void;
8
+ handleFormChange: (event: Event) => void;
9
+ handleBlur: (event: Event) => void;
10
+ handleSubmit: (event: SubmitEvent) => void;
11
+ };
12
+ //# sourceMappingURL=useForm.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { AttributesFormModel } from '../../data/models';
2
+ import { FieldsProps, useAddressFormProps } from '../../types';
3
+ import { VNode } from 'preact';
4
+ import { HTMLAttributes } from 'preact/compat';
5
+
6
+ export declare const getFieldWithOptions: (address: AttributesFormModel, regionOptions: any[]) => any;
7
+ export declare const useAddressForm: ({ addressFormId, billingCheckBoxValue, shippingCheckBoxValue, showShippingCheckBox, showBillingCheckBox, countryRegionOptions, inputsDefaultValueSet, onCloseBtnClick, onSuccess, onError, }: useAddressFormProps) => {
8
+ inLineAlert: {
9
+ text: string;
10
+ type: 'success' | 'warning' | 'error';
11
+ icon?: VNode<HTMLAttributes<SVGSVGElement>> | undefined;
12
+ };
13
+ addressId: string;
14
+ submitLoading: boolean;
15
+ normalizeFieldsConfig: FieldsProps[];
16
+ handleUpdateAddress: (event: Event, valid: boolean) => Promise<null | undefined>;
17
+ handleCreateAddress: (event: Event, valid: boolean) => Promise<null | undefined>;
18
+ handleOnCloseForm: () => void;
19
+ };
20
+ //# sourceMappingURL=useAddressForm.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { CustomerAddressesModel } from '../../data/models';
2
+ import { KeysSortOrderProps, useAddressesProps } from '../../types';
3
+
4
+ export declare const useAddresses: ({ minifiedView, routeAddressesPage, onSuccess, }: useAddressesProps) => {
5
+ keysSortOrder: [] | KeysSortOrderProps[];
6
+ submitLoading: boolean;
7
+ isModalRendered: boolean;
8
+ isFormRendered: boolean;
9
+ loading: boolean;
10
+ addNewAddress: boolean;
11
+ addressesList: CustomerAddressesModel[];
12
+ addressId: string;
13
+ handleRenderForm: () => void;
14
+ handleRenderModal: () => void;
15
+ removeAddress: () => Promise<void>;
16
+ onCloseBtnClick: () => void;
17
+ setEditingAddressId: (id: string) => void;
18
+ closeNewAddressForm: () => void;
19
+ redirectToAddressesRoute: () => void;
20
+ handleOnSuccess: () => Promise<void>;
21
+ };
22
+ //# sourceMappingURL=useAddresses.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { OrderDetails } from '../../data/models';
2
+ import { useOrdersListProps } from '../../types';
3
+
4
+ export declare const useOrdersList: ({ ordersInMinifiedView, minifiedView, pageSize, }: useOrdersListProps) => {
5
+ loading: boolean;
6
+ orderHistoryListItems: OrderDetails[];
7
+ pageInfo: {};
8
+ selectedId: string;
9
+ handleSelectId: (id: string) => void;
10
+ };
11
+ //# sourceMappingURL=useOrdersList.d.ts.map
@@ -0,0 +1,3 @@
1
+ declare const useDebounce: (value: string, delay: number) => string;
2
+ export default useDebounce;
3
+ //# sourceMappingURL=useDebounce.d.ts.map
@@ -1,5 +1,89 @@
1
1
  declare const _default: {
2
- "": {}
2
+ "Account": {
3
+ "EmptyList": {
4
+ "minifiedView": {
5
+ "Addresses": {
6
+ "message": "No saved addresses"
7
+ },
8
+ "OrdersList": {
9
+ "message": "No orders"
10
+ }
11
+ },
12
+ "fullSizeView": {
13
+ "Addresses": {
14
+ "message": "No saved addresses"
15
+ },
16
+ "OrdersList": {
17
+ "message": "No orders"
18
+ }
19
+ }
20
+ },
21
+ "OrdersList": {
22
+ "minifiedView": {
23
+ "containerTitle": "Recent orders",
24
+ "viewAllOrdersButton": "View all orders",
25
+ "OrdersListCard": {
26
+ "orderNumber": "Order number:",
27
+ "itemsAmount": "items"
28
+ }
29
+ },
30
+ "fullSizeView": {
31
+ "containerTitle": "Your orders",
32
+ "OrdersListCard": {
33
+ "orderNumber": "Order number:",
34
+ "itemsAmount": "items"
35
+ }
36
+ }
37
+ },
38
+ "Addresses": {
39
+ "minifiedView": {
40
+ "containerTitle": "Addresses",
41
+ "editAddressFormTitle": "Edit address",
42
+ "viewAllAddressesButton": "View address list",
43
+ "addressCard": {
44
+ "actionRemove": "Remove",
45
+ "actionEdit": "Edit",
46
+ "cardLabelShipping": "Shipping",
47
+ "cardLabelBilling": "Billing"
48
+ },
49
+ "removeAddressModal": {
50
+ "title": "Remove address",
51
+ "description": "Are you sure you would like to remove this address?",
52
+ "actionCancel": "Cancel",
53
+ "actionConfirm": "Remove"
54
+ }
55
+ },
56
+ "fullSizeView": {
57
+ "containerTitle": "Addresses",
58
+ "editAddressFormTitle": "Edit address",
59
+ "newAddressFormTitle": "Add address",
60
+ "addNewAddressButton": "Create new",
61
+ "addressCard": {
62
+ "actionRemove": "Remove",
63
+ "actionEdit": "Edit",
64
+ "cardLabelShipping": "Shipping",
65
+ "cardLabelBilling": "Billing"
66
+ },
67
+ "removeAddressModal": {
68
+ "title": "Remove address",
69
+ "description": "Are you sure you would like to remove this address?",
70
+ "actionCancel": "Cancel",
71
+ "actionConfirm": "Remove"
72
+ }
73
+ }
74
+ },
75
+ "AddressForm": {
76
+ "formText": {
77
+ "secondaryButton": "Cancel",
78
+ "primaryButton": "Save",
79
+ "defaultShippingLabel": "Set as default shipping address",
80
+ "defaultBillingLabel": "Set as default billing address"
81
+ }
82
+ },
83
+ "FormText": {
84
+ "requiredFieldError": "This is a required field."
85
+ }
86
+ }
3
87
  };
4
88
 
5
89
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const checkIsFunction: (value: any) => value is Function;
2
+ //# sourceMappingURL=checkIsFunction.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare const convertToCamelCase: (key: string) => string;
2
+ export declare const convertToSnakeCase: (key: string) => string;
3
+ export declare const convertKeysCase: (data: any, type: 'snakeCase' | 'camelCase', dictionary?: Record<string, string>) => any;
4
+ //# sourceMappingURL=convertCase.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const convertToBoolean: (element: string | number) => boolean;
2
+ //# sourceMappingURL=convertToBoolean.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const convertToInputDateFormat: (dateTimeString: string) => string;
2
+ //# sourceMappingURL=convertToInputDateFormat.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** Actions */
2
+ export declare const handleFetchError: (errors: Array<{
3
+ message: string;
4
+ }>) => never;
5
+ //# sourceMappingURL=fetch-error.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Formats a date string according to a specified locale and options.
3
+ * Returns "Invalid Date" if the input date string is invalid.
4
+ *
5
+ * @param {string} date - The date string to be formatted.
6
+ * @param {string} [locale='en-US'] - The locale to use for formatting. Defaults to 'en-US'.
7
+ * @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options to customize the output.
8
+ * @returns {string} The formatted date string, or "Invalid Date" if the input is invalid.
9
+ *
10
+ * @example
11
+ * // Default formatting (en-US locale, MM/DD/YYYY)
12
+ * console.log(formatDateToLocale('2023-08-29'));
13
+ * // Output: "08/29/2023"
14
+ *
15
+ * @example
16
+ * // Formatting with a specified locale (e.g., en-GB for DD/MM/YYYY)
17
+ * console.log(formatDateToLocale('2023-08-29', 'en-GB'));
18
+ * // Output: "29/08/2023"
19
+ *
20
+ * @example
21
+ * // Formatting with a specified locale and custom options (e.g., de-DE with long month format)
22
+ * console.log(formatDateToLocale('2023-08-29', 'de-DE', { month: 'long', year: 'numeric' }));
23
+ * // Output: "29. August 2023"
24
+ *
25
+ * @example
26
+ * // Handling an invalid date string
27
+ * console.log(formatDateToLocale('invalid-date'));
28
+ * // Output: "Invalid Date"
29
+ */
30
+ export declare const formatDateToLocale: (date: string, locale?: string, options?: Intl.DateTimeFormatOptions) => string;
31
+ //# sourceMappingURL=formatDateToLocale.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { AttributesFormModel } from '../data/models';
2
+
3
+ export declare const getFieldsConfig: (itemValues: Record<string, any>, attributesFormList: AttributesFormModel[]) => {
4
+ code?: string | undefined;
5
+ name?: string | undefined;
6
+ id?: string | undefined;
7
+ required?: boolean | undefined;
8
+ label?: string | undefined;
9
+ options?: {
10
+ is_default: boolean;
11
+ label: string;
12
+ value: string;
13
+ }[] | undefined;
14
+ entityType?: string | undefined;
15
+ className?: string | undefined;
16
+ defaultValue?: string | number | boolean | undefined;
17
+ fieldType?: import('../data/models').FieldEnumList | undefined;
18
+ multilineCount?: number | undefined;
19
+ isUnique?: boolean | undefined;
20
+ orderNumber: number;
21
+ isHidden?: boolean | undefined;
22
+ customUpperCode: string;
23
+ }[];
24
+ //# sourceMappingURL=getFieldsConfig.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const getFormValues: (form: HTMLFormElement) => any;
2
+ //# sourceMappingURL=getFormValues.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { CustomerAddressesModel } from '../data/models';
2
+
3
+ /**
4
+
5
+ Manages the deletion of an address from a list. If the address is the last one in the list, it removes any default properties before deletion. If the address is not the last, it ensures that no default properties are set on the item, transfers them if necessary to another address, and then deletes the address.
6
+
7
+ */
8
+ export declare const manageAddressDeletion: (removeId: string, addressesList: CustomerAddressesModel[]) => Promise<boolean>;
9
+ //# sourceMappingURL=manageAddressDeletion.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A function which can be attached to fetchGraphQL to handle thrown errors in
3
+ * a generic way.
4
+ */
5
+ export declare const handleNetworkError: (error: Error) => never;
6
+ //# sourceMappingURL=network-error.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const normalizeAttributes: (input: Record<string, any>) => Record<string, any>;
2
+ //# sourceMappingURL=normalizeAttributes.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { CustomerAddressesModel } from '../data/models';
2
+
3
+ export declare const serializeAddressForm: (formValues: Record<string, string>) => CustomerAddressesModel;
4
+ //# sourceMappingURL=serializeAddressForm.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-account", "version": "0.1.0-alpha4", "@dropins/elsie": "0.27.1-alpha591"}
1
+ {"name": "@dropins/storefront-account", "version": "0.1.0-alpha6", "@dropins/elsie": "0.29.0"}
package/render.js CHANGED
@@ -1 +1,3 @@
1
- import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import{useState as i,useEffect as m}from"@dropins/tools/preact-hooks.js";import{UIProvider as c}from"@dropins/tools/components.js";import{events as a}from"@dropins/tools/event-bus.js";const p={"":{}},u={default:p},d=({children:o})=>{const[t,n]=i("en_US");return m(()=>{const r=a.on("locale",s=>{n(s)},{eager:!0});return()=>{r==null||r.off()}},[]),e(c,{lang:t,langDefinitions:u,children:o})},x=new f(e(d,{}));export{x as render};
1
+ (function(o,i){try{if(typeof document<"u"){const r=document.createElement("style"),n=i.styleId;for(const d in i.attributes)r.setAttribute(d,i.attributes[d]);r.setAttribute("data-dropin",n),r.appendChild(document.createTextNode(o));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(r);else{const d=document.querySelector('link[rel="stylesheet"], style');d?d.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-orders-list-header{margin-bottom:var(--spacing-medium)}
2
+ .dropin-form{display:flex;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.dropin-form{display:grid;grid-template-columns:repeat(2,1fr)}.dropin-form>.dropin-field:nth-child(1),.dropin-form>.dropin-field:nth-child(2){grid-column:span 1}.dropin-form>.dropin-field:nth-child(3),.dropin-form>.dropin-field:nth-child(4),.dropin-form>.dropin-field:nth-child(5){grid-column:span 2}.dropin-form>.dropin-field:nth-child(6),.dropin-form>.dropin-field:nth-child(7){grid-column:span 1}.dropin-form>.dropin-field:nth-child(8),.dropin-form>.dropin-field:nth-child(9){grid-column:span 1}.dropin-form>.dropin-field:nth-child(n+10){grid-column:span 2}}.dropin-form [class$=-hidden]{position:absolute;opacity:0;height:0;width:0;overflow:hidden;clip:rect(0,0,0,0)}.dropin-address-card{border-radius:var(--shape-border-radius-1);margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1)}.dropin-address-card .dropin-card__content{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-small) 0px;grid-template-areas:"description action" "labels action"}.dropin-address-card .dropin-address-card__action{display:flex;justify-content:flex-end;align-items:baseline;cursor:pointer;grid-area:action}.dropin-address-card .dropin-address-card__action--editbutton{margin-left:var(--spacing-small)}.dropin-address-card .dropin-address-card__action button{padding:0}.dropin-address-card .dropin-address-card__action button:hover{text-decoration:underline}.dropin-address-card .dropin-address-card__description{grid-area:description;margin:0;padding:0}.dropin-address-card .dropin-address-card__description p{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800);margin:0;padding:0;display:inline;overflow:hidden}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(2){margin:0 0 var(--spacing-small) 0;color:var(--color-neutral-800);font:var(--type-button-2-font);text-align:left;font-weight:500;cursor:default}.dropin-address-card__description p{margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(5),.dropin-address-card .dropin-address-card__description p:nth-child(7){float:left;width:auto;margin-right:var(--spacing-xsmall)}.dropin-address-card .dropin-address-card__description p:nth-child(2),.dropin-address-card .dropin-address-card__description p:nth-child(6),.dropin-address-card .dropin-address-card__description p:nth-child(8){display:inline;width:50%}.dropin-address-card .dropin-address-card__description p:nth-child(2):after,.dropin-address-card .dropin-address-card__description p:nth-child(6):after,.dropin-address-card .dropin-address-card__description p:nth-child(8):after{content:"\\a";white-space:pre;display:block;height:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(3),.dropin-address-card .dropin-address-card__description p:nth-child(4),.dropin-address-card .dropin-address-card__description p:nth-child(n+9){display:block;width:100%;margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__labels{display:flex;gap:0 var(--spacing-xsmall);grid-area:labels}.dropin-account-loaders--card-loader{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-actions-address{cursor:pointer;padding:var(--spacing-xsmall) var(--spacing-medium);border-radius:var(--shape-border-radius-1);border:var(--shape-border-width-1) solid var(--color-neutral-400);background-color:var(--color-neutral-50);width:100%;height:88px;display:flex;align-items:center;justify-content:space-between}.dropin-actions-address--title{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-actions-address svg{stroke:var(--shape-icon-stroke-4);color:var(--color-neutral-800)}.dropin-address-modal{position:relative;padding:var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig);width:100%;margin:auto;max-width:721px}.dropin-modal__body--medium>.dropin-modal__header-title,.dropin-modal__body--full>.dropin-modal__header-title,.dropin-address-modal .dropin-modal__content{margin:0;align-items:center}.dropin-address-modal .dropin-modal__header-title-content h3{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0;padding:0}.dropin-address-modal .dropin-address-modal__spinner{position:absolute;top:0;left:0;background-color:var(--color-neutral-200);opacity:.8;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1}.dropin-address-modal p{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-modal .dropin-address-modal__wrapper--buttons{display:flex;align-items:center;justify-content:right;gap:0 var(--spacing-small)}.dropin-empty-list{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-empty-list.dropin-empty-list--minified,.dropin-empty-list .dropin-card{border:none}.dropin-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.dropin-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.dropin-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.dropin-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.dropin-orders-list-action{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.dropin-orders-list-action--minifiedView{width:100%;text-align:left;font:var(--type-body-1-default-font)}.dropin-orders-list-action.dropin-orders-list-action--minifiedView:hover{text-decoration:none}.dropin-orders-list-action--minifiedView .dropin-orders-list-action__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.dropin-orders-list-action__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-orders-list-action__card-wrapper svg,.dropin-orders-list-action svg{color:var(--color-neutral-800)}.dropin-orders-list-action--minifiedView .dropin-card--secondary{border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-action--minifiedView .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.dropin-orders-list-action--minifiedView p{font:var(--type-body-1-strong-font)}.dropin-orders-list-card{height:100%;margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-card .dropin-card__content{padding:var(--spacing-medium);display:grid;grid-template-areas:"content actions" "imageList actions";gap:0;max-height:100%}.dropin-orders-list-card .dropin-orders-list-card--content{grid-area:content;margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--content>div:first-child{font-weight:500}.dropin-orders-list-card .dropin-orders-list-card--content p,.dropin-orders-list-card .dropin-orders-list-card--content div{padding:0;text-align:left;font:var(--type-body-1-default-font);margin-bottom:var(--spacing-small);color:var(--color-neutral-800)}.dropin-orders-list-card .dropin-orders-list-card--content p:last-child{margin:0}.dropin-orders-list-card .dropin-orders-list-card--content div{font:var(--type-button-2-font);margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--actions{grid-area:actions}.dropin-orders-list-card .dropin-orders-list-card--images{max-width:calc(6 * 65px + 5 * var(--spacing-small));grid-area:imageList;display:grid;grid-template-columns:repeat(auto-fill,65px);grid-template-rows:65px;gap:var(--spacing-small);overflow:hidden}.dropin-orders-list-card .dropin-orders-list-card--images img{object-fit:contain;width:65px;height:65px}.dropin-orders-list-card .dropin-orders-list-card--actions{position:relative;align-self:center;margin-left:auto}@media (min-width: 768px){.dropin-orders-list-card .dropin-card__content{max-height:290px}.dropin-orders-list-card.dropin-orders-list-card--full .dropin-card__content{max-height:100%}}.dropin-addresses-header{margin-bottom:var(--spacing-medium)}.dropin-addresses-wrapper{box-sizing:border-box;position:relative}.dropin-address-form-wrapper{box-sizing:border-box;background-color:var(--color-neutral-50)}.dropin-address-form-wrapper--notification{margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--buttons{display:flex;align-items:center;justify-content:end;gap:0 var(--spacing-medium);margin-top:var(--spacing-medium)}.dropin-address-form-wrapper--buttons button{min-width:142px}`,{styleId:"account"});
3
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as o}from"@dropins/tools/lib.js";import{useState as n,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const c={EmptyList:{minifiedView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}},fullSizeView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}}},OrdersList:{minifiedView:{containerTitle:"Recent orders",viewAllOrdersButton:"View all orders",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"}},fullSizeView:{containerTitle:"Your orders",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"}}},Addresses:{minifiedView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",viewAllAddressesButton:"View address list",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}},fullSizeView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",newAddressFormTitle:"Add address",addNewAddressButton:"Create new",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}}},AddressForm:{formText:{secondaryButton:"Cancel",primaryButton:"Save",defaultShippingLabel:"Set as default shipping address",defaultBillingLabel:"Set as default billing address"}},FormText:{requiredFieldError:"This is a required field."}},u={Account:c},f={default:u},p=({children:s})=>{const[d,i]=n("en_US");return a(()=>{const e=m.on("locale",t=>{i(t)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:d,langDefinitions:f,children:s})},L=new o(r(p,{}));export{L as render};
@@ -0,0 +1,41 @@
1
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
+ import { AttributesFormModel, Country } from '../data/models';
3
+
4
+ interface AddressFormActionsContext {
5
+ handleUpdateAddress?: (event: Event, valid: boolean) => void;
6
+ handleCreateAddress?: (event: Event, valid: boolean) => void;
7
+ addressId: string | number;
8
+ }
9
+ interface AddressFormInputsContext {
10
+ formActions: {
11
+ handleChange: (event: Event) => void;
12
+ };
13
+ }
14
+ export interface AddressFormProps {
15
+ addressFormId?: string;
16
+ className?: string;
17
+ addressesFormTitle?: string;
18
+ inputsDefaultValueSet?: AttributesFormModel;
19
+ shippingCheckBoxValue?: boolean;
20
+ billingCheckBoxValue?: boolean;
21
+ showShippingCheckBox?: boolean;
22
+ showBillingCheckBox?: boolean;
23
+ isOpen?: boolean;
24
+ onSubmit?: () => Promise<void>;
25
+ slots?: {
26
+ AddressFormActions?: SlotProps<AddressFormActionsContext>;
27
+ AddressFormInputs?: SlotProps<AddressFormInputsContext>;
28
+ };
29
+ onCloseBtnClick?: () => void;
30
+ onSuccess?: () => void;
31
+ onError?: (error: string) => void;
32
+ handleRenderForm?: () => void;
33
+ onChange?: (values: Record<string, FormDataEntryValue>, inputValue: Record<string, string>, event: Event) => void;
34
+ }
35
+ export interface AddressFormWrapperProps extends AddressFormProps {
36
+ }
37
+ export interface useAddressFormProps extends Omit<AddressFormProps, 'className' | 'addressesFormTitle' | 'handleCloseForm'> {
38
+ countryRegionOptions: Record<string, Country[]>;
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=addressForm.types.d.ts.map
@@ -0,0 +1,56 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { AttributesFormModel, CustomerAddressesModel } from '../data/models';
3
+ import { FieldsProps } from './form.types';
4
+
5
+ export interface DefaultCheckBox extends Omit<FieldsProps, 'options'> {
6
+ }
7
+ export interface AddressesProps {
8
+ className?: string;
9
+ withHeader?: boolean;
10
+ minifiedView: boolean;
11
+ withActionsInMinifiedView?: boolean;
12
+ withActionsInFullSizeView?: boolean;
13
+ inputsDefaultValueSet?: AttributesFormModel;
14
+ addressesFormTitle?: string;
15
+ showShippingCheckBox?: boolean;
16
+ showBillingCheckBox?: boolean;
17
+ shippingCheckBoxValue?: boolean;
18
+ billingCheckBoxValue?: boolean;
19
+ routeAddressesPage?: () => string;
20
+ onSuccess?: () => void;
21
+ onError?: (error: string) => void;
22
+ }
23
+ export interface AddressesWrapperProps extends AddressesProps {
24
+ }
25
+ export interface useAddressesProps extends Omit<AddressesProps, 'className' | 'inputsDefaultValueSet' | 'addressesFormTitle' | 'shippingCheckBoxValue' | 'billingCheckBoxValue'> {
26
+ }
27
+ export interface KeysSortOrderProps {
28
+ name?: string;
29
+ orderNumber?: number;
30
+ label?: string | null;
31
+ }
32
+ export interface AddressCardProps {
33
+ minifiedView: boolean;
34
+ addressData: CustomerAddressesModel | undefined;
35
+ keysSortOrder?: KeysSortOrderProps[];
36
+ loading?: boolean;
37
+ setAddressId?: (id: string) => void;
38
+ handleRenderModal?: () => void | undefined;
39
+ handleRenderForm?: () => void | undefined;
40
+ }
41
+ export interface AddressActionsProps extends HTMLAttributes<HTMLButtonElement> {
42
+ minifiedView: boolean;
43
+ addNewAddress: boolean;
44
+ viewAllAddressesText?: string;
45
+ routeAddressesPage: () => void;
46
+ }
47
+ export interface AddressModalProps {
48
+ minifiedView: boolean;
49
+ addressData?: CustomerAddressesModel;
50
+ keysSortOrder?: KeysSortOrderProps[];
51
+ open: boolean;
52
+ submitLoading: boolean;
53
+ onRemoveAddress: () => void;
54
+ closeModal: () => void;
55
+ }
56
+ //# sourceMappingURL=addresses.types.d.ts.map
@@ -0,0 +1,47 @@
1
+ export interface CreateCustomerAddressResponse {
2
+ data: {
3
+ createCustomerAddress: {
4
+ firstname: string;
5
+ };
6
+ };
7
+ errors?: {
8
+ message: string;
9
+ }[];
10
+ }
11
+ interface Region {
12
+ region_id: number;
13
+ region: string;
14
+ region_code: string;
15
+ }
16
+ interface CustomAttributes {
17
+ attribute_code: string;
18
+ value: string;
19
+ }
20
+ interface CustomAttributesV2 extends CustomAttributes {
21
+ selected_options: {
22
+ value: string;
23
+ }[];
24
+ }
25
+ export interface AddressForm {
26
+ region?: Region;
27
+ city?: string;
28
+ company?: string;
29
+ country_code?: string;
30
+ country_id?: string;
31
+ custom_attributes?: CustomAttributes[];
32
+ custom_attributesV2?: CustomAttributesV2[];
33
+ default_billing?: boolean;
34
+ default_shipping?: boolean;
35
+ fax?: string;
36
+ firstname?: string;
37
+ lastname?: string;
38
+ middlename?: string;
39
+ postcode?: string;
40
+ prefix?: string;
41
+ street?: string[];
42
+ suffix?: string;
43
+ telephone?: string;
44
+ vat_id?: string;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=createCustomerAddress.types.d.ts.map
@@ -0,0 +1,31 @@
1
+ export interface ResponseAttributesFormItemsProps {
2
+ code: string;
3
+ sort_order: string;
4
+ default_value: null | string;
5
+ entity_type: string;
6
+ frontend_class: null | string;
7
+ multiline_count: number;
8
+ frontend_input: string;
9
+ is_required: boolean;
10
+ is_unique: boolean;
11
+ label: string;
12
+ options: {
13
+ is_default: boolean;
14
+ label: string;
15
+ value: string;
16
+ }[];
17
+ }
18
+ export interface GetAttributesFormResponse {
19
+ data: {
20
+ attributesForm: {
21
+ errors?: {
22
+ message: string;
23
+ }[];
24
+ items?: ResponseAttributesFormItemsProps[];
25
+ };
26
+ };
27
+ errors?: {
28
+ message: string;
29
+ }[];
30
+ }
31
+ //# sourceMappingURL=getAttributesForm.types.d.ts.map
@@ -0,0 +1,15 @@
1
+ export interface CountriesFormResponse {
2
+ data: {
3
+ countries: {
4
+ two_letter_abbreviation: string;
5
+ full_name_locale: string;
6
+ available_regions: {
7
+ code: string;
8
+ }[] | null;
9
+ }[];
10
+ };
11
+ errors?: {
12
+ message: string;
13
+ }[];
14
+ }
15
+ //# sourceMappingURL=getCountries.types.d.ts.map
@@ -0,0 +1,13 @@
1
+ export interface getCustomerShortResponse {
2
+ data: {
3
+ customer: {
4
+ firstname: string;
5
+ lastname: string;
6
+ email: string;
7
+ };
8
+ };
9
+ errors?: {
10
+ message: string;
11
+ }[];
12
+ }
13
+ //# sourceMappingURL=getCustomer.types.d.ts.map
@@ -0,0 +1,36 @@
1
+ export type RegionProps = {
2
+ region: string;
3
+ region_code: string;
4
+ region_id: string | number;
5
+ };
6
+ export interface UserAddressesProps {
7
+ firstname: string;
8
+ lastname: string;
9
+ city: string;
10
+ company: string;
11
+ country_code: string;
12
+ region: RegionProps;
13
+ telephone: string;
14
+ id?: string;
15
+ vat_id: string;
16
+ postcode: string;
17
+ street: string | string[] | [];
18
+ street_2?: string;
19
+ default_shipping: boolean;
20
+ default_billing: boolean;
21
+ custom_attributesV2: {
22
+ code: string;
23
+ value: string;
24
+ }[];
25
+ }
26
+ export interface AddressResponse {
27
+ data: {
28
+ customer?: {
29
+ addresses: UserAddressesProps[];
30
+ };
31
+ };
32
+ errors?: {
33
+ message: string;
34
+ }[];
35
+ }
36
+ //# sourceMappingURL=getCustomerAddress.type.d.ts.map
@@ -0,0 +1,73 @@
1
+ import { UserAddressesProps } from '..';
2
+
3
+ export interface PaymentMethodProps {
4
+ name: string;
5
+ }
6
+ export interface ProductProps {
7
+ small_image: {
8
+ url: string;
9
+ };
10
+ }
11
+ export interface OrderItemProps {
12
+ status: string;
13
+ product_name: string;
14
+ id: string;
15
+ product: ProductProps;
16
+ }
17
+ export interface AmountProps {
18
+ value: number;
19
+ currency: string;
20
+ }
21
+ export interface TaxProps {
22
+ amount: AmountProps;
23
+ rate: number;
24
+ title: string;
25
+ }
26
+ export interface DiscountProps {
27
+ amount: AmountProps;
28
+ label: string;
29
+ }
30
+ export interface TotalProps {
31
+ grand_total: AmountProps;
32
+ subtotal: AmountProps;
33
+ taxes: TaxProps[];
34
+ total_tax: AmountProps;
35
+ total_shipping: AmountProps;
36
+ discounts: DiscountProps[];
37
+ }
38
+ export interface OrderProps {
39
+ token: string;
40
+ email: string;
41
+ shipping_method: string;
42
+ shipping_address: UserAddressesProps;
43
+ billing_address: UserAddressesProps;
44
+ payment_methods: PaymentMethodProps[];
45
+ number: string;
46
+ order_date: string;
47
+ carrier: string;
48
+ items: OrderItemProps[];
49
+ total: TotalProps;
50
+ status: string;
51
+ id: string;
52
+ }
53
+ export interface PageInfoProps {
54
+ page_size: number;
55
+ total_pages: number;
56
+ current_page: number;
57
+ }
58
+ export interface OrdersProps {
59
+ page_info: PageInfoProps;
60
+ total_count: number;
61
+ items: OrderProps[];
62
+ }
63
+ export interface OrderHistoryListResponse {
64
+ data: {
65
+ customer?: {
66
+ orders: OrdersProps;
67
+ };
68
+ };
69
+ errors?: {
70
+ message: string;
71
+ }[];
72
+ }
73
+ //# sourceMappingURL=getOrderHistoryList.types.d.ts.map