@weareconceptstudio/account 2.1.16 → 2.1.17

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 (135) hide show
  1. package/README.md +5 -0
  2. package/dist/AccountProvider.d.ts.map +1 -1
  3. package/dist/AccountProvider.js +7 -1
  4. package/dist/AccountProvider.js.map +1 -1
  5. package/dist/components/AccountButton/index.d.ts.map +1 -1
  6. package/dist/components/AccountButton/index.js +18 -23
  7. package/dist/components/AccountButton/index.js.map +1 -1
  8. package/dist/components/AccountButton/style.d.ts.map +1 -1
  9. package/dist/components/AccountButton/style.js +47 -9
  10. package/dist/components/AccountButton/style.js.map +1 -1
  11. package/dist/components/LineItemProductInfo/index.js +1 -1
  12. package/dist/components/LineItemProductInfo/index.js.map +1 -1
  13. package/dist/components/TotalCheckout/BalanceComp/index.js +1 -1
  14. package/dist/components/TotalCheckout/BalanceComp/index.js.map +1 -1
  15. package/dist/components/TotalCheckout/BalanceComp/style.d.ts.map +1 -1
  16. package/dist/components/TotalCheckout/BalanceComp/style.js +2 -1
  17. package/dist/components/TotalCheckout/BalanceComp/style.js.map +1 -1
  18. package/dist/components/TotalCheckout/PromoCodeComp/index.js +1 -1
  19. package/dist/components/TotalCheckout/PromoCodeComp/index.js.map +1 -1
  20. package/dist/components/TotalCheckout/PromoCodeComp/style.d.ts.map +1 -1
  21. package/dist/components/TotalCheckout/PromoCodeComp/style.js +2 -1
  22. package/dist/components/TotalCheckout/PromoCodeComp/style.js.map +1 -1
  23. package/dist/components/TotalCheckout/style.d.ts.map +1 -1
  24. package/dist/components/TotalCheckout/style.js +4 -2
  25. package/dist/components/TotalCheckout/style.js.map +1 -1
  26. package/dist/components/WarningMessageForPopup/index.js +4 -4
  27. package/dist/components/WarningMessageForPopup/index.js.map +1 -1
  28. package/dist/config.d.ts +2 -2
  29. package/dist/config.js +2 -2
  30. package/dist/config.js.map +1 -1
  31. package/dist/modules/account/AccountBalanceTemplate/StatusBalance/index.js +1 -1
  32. package/dist/modules/account/AccountBalanceTemplate/StatusBalance/index.js.map +1 -1
  33. package/dist/modules/account/AccountSettingsTemplate/AccountInfo/index.js +3 -3
  34. package/dist/modules/account/AccountSettingsTemplate/AccountInfo/index.js.map +1 -1
  35. package/dist/modules/account/AccountSettingsTemplate/AccountPassword/index.js +3 -3
  36. package/dist/modules/account/AccountSettingsTemplate/AccountPassword/index.js.map +1 -1
  37. package/dist/modules/account/AccountSettingsTemplate/Subscription/index.js +3 -3
  38. package/dist/modules/account/AccountSettingsTemplate/Subscription/index.js.map +1 -1
  39. package/dist/modules/account/AccountTemplate/index.d.ts +2 -1
  40. package/dist/modules/account/AccountTemplate/index.d.ts.map +1 -1
  41. package/dist/modules/account/AccountTemplate/index.js +5 -3
  42. package/dist/modules/account/AccountTemplate/index.js.map +1 -1
  43. package/dist/modules/address/AddressForm/index.d.ts.map +1 -1
  44. package/dist/modules/address/AddressForm/index.js +8 -5
  45. package/dist/modules/address/AddressForm/index.js.map +1 -1
  46. package/dist/modules/address/AddressForm/style.d.ts.map +1 -1
  47. package/dist/modules/address/AddressForm/style.js +85 -44
  48. package/dist/modules/address/AddressForm/style.js.map +1 -1
  49. package/dist/modules/address/AddressItem/index.js +3 -3
  50. package/dist/modules/address/AddressItem/index.js.map +1 -1
  51. package/dist/modules/address/AddressProvider.d.ts.map +1 -1
  52. package/dist/modules/address/AddressProvider.js +10 -0
  53. package/dist/modules/address/AddressProvider.js.map +1 -1
  54. package/dist/modules/address/AddressWrap/index.js +1 -1
  55. package/dist/modules/address/AddressWrap/index.js.map +1 -1
  56. package/dist/modules/address/SelectAddressPopup/index.js +3 -3
  57. package/dist/modules/address/SelectAddressPopup/index.js.map +1 -1
  58. package/dist/modules/cart/CartModificationWarningPopup/index.d.ts.map +1 -1
  59. package/dist/modules/cart/CartModificationWarningPopup/index.js +5 -8
  60. package/dist/modules/cart/CartModificationWarningPopup/index.js.map +1 -1
  61. package/dist/modules/cart/CartModificationWarningPopup/style.d.ts.map +1 -1
  62. package/dist/modules/cart/CartModificationWarningPopup/style.js +31 -49
  63. package/dist/modules/cart/CartModificationWarningPopup/style.js.map +1 -1
  64. package/dist/modules/cart/CartTemplate/index.js +2 -2
  65. package/dist/modules/cart/CartTemplate/index.js.map +1 -1
  66. package/dist/modules/cart/EmptyCart/index.js +1 -1
  67. package/dist/modules/cart/EmptyCart/index.js.map +1 -1
  68. package/dist/modules/cart/components/CartItems/Item/EditButton.js +1 -1
  69. package/dist/modules/cart/components/CartItems/Item/EditButton.js.map +1 -1
  70. package/dist/modules/cart/components/CartItems/Item/ItemActions.js +1 -1
  71. package/dist/modules/cart/components/CartItems/Item/ItemActions.js.map +1 -1
  72. package/dist/modules/cart/components/CartItems/Item/ItemTitle.js +2 -2
  73. package/dist/modules/cart/components/CartItems/Item/ItemTitle.js.map +1 -1
  74. package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemActions.js +2 -2
  75. package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemActions.js.map +1 -1
  76. package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemTitle.js +2 -2
  77. package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemTitle.js.map +1 -1
  78. package/dist/modules/cart/components/CartItems/index.js +1 -1
  79. package/dist/modules/cart/components/CartItems/index.js.map +1 -1
  80. package/dist/modules/checkout/PaymentFailedTemplate/index.js +1 -1
  81. package/dist/modules/checkout/PaymentFailedTemplate/index.js.map +1 -1
  82. package/dist/modules/checkout/ThankYouTemplate/index.js +1 -1
  83. package/dist/modules/checkout/ThankYouTemplate/index.js.map +1 -1
  84. package/dist/modules/delivery/DeliveryOptions/style.d.ts.map +1 -1
  85. package/dist/modules/delivery/DeliveryOptions/style.js +4 -6
  86. package/dist/modules/delivery/DeliveryOptions/style.js.map +1 -1
  87. package/dist/modules/guest/GuestContactInformation/index.js +1 -1
  88. package/dist/modules/guest/GuestContactInformation/index.js.map +1 -1
  89. package/dist/modules/order/EmptyOrders/index.js +1 -1
  90. package/dist/modules/order/EmptyOrders/index.js.map +1 -1
  91. package/dist/modules/order/OrderIndividualTemplate/index.js +1 -1
  92. package/dist/modules/order/OrderIndividualTemplate/index.js.map +1 -1
  93. package/dist/modules/order/OrderedItems/Review/Popup/index.js +1 -1
  94. package/dist/modules/order/OrderedItems/Review/Popup/index.js.map +1 -1
  95. package/dist/modules/order/OrdersList/Item/index.js +1 -1
  96. package/dist/modules/order/OrdersList/Item/index.js.map +1 -1
  97. package/dist/modules/order/OrdersList/ItemMobile/index.js +1 -1
  98. package/dist/modules/order/OrdersList/ItemMobile/index.js.map +1 -1
  99. package/dist/modules/payment/Card/index.js +1 -1
  100. package/dist/modules/payment/Card/index.js.map +1 -1
  101. package/dist/modules/payment/Payment/index.js +1 -1
  102. package/dist/modules/payment/Payment/index.js.map +1 -1
  103. package/dist/modules/payment/SelectPaymentMethodPopup/index.js +2 -2
  104. package/dist/modules/payment/SelectPaymentMethodPopup/index.js.map +1 -1
  105. package/dist/user/UserProvider.d.ts.map +1 -1
  106. package/dist/user/UserProvider.js +3 -2
  107. package/dist/user/UserProvider.js.map +1 -1
  108. package/dist/user/useClientSearchParams.d.ts +5 -0
  109. package/dist/user/useClientSearchParams.d.ts.map +1 -0
  110. package/dist/user/useClientSearchParams.js +13 -0
  111. package/dist/user/useClientSearchParams.js.map +1 -0
  112. package/dist/utils/buttonClassNames.d.ts +19 -5
  113. package/dist/utils/buttonClassNames.d.ts.map +1 -1
  114. package/dist/utils/buttonClassNames.js +30 -2
  115. package/dist/utils/buttonClassNames.js.map +1 -1
  116. package/dist/utils/buttonTypes.d.ts +16 -1
  117. package/dist/utils/buttonTypes.d.ts.map +1 -1
  118. package/dist/utils/buttonTypes.js +52 -6
  119. package/dist/utils/buttonTypes.js.map +1 -1
  120. package/dist/utils/config.d.ts +17 -9
  121. package/dist/utils/config.d.ts.map +1 -1
  122. package/dist/utils/config.js +13 -3
  123. package/dist/utils/config.js.map +1 -1
  124. package/dist/utils/createAccountButtonEntry.d.ts +4 -2
  125. package/dist/utils/createAccountButtonEntry.d.ts.map +1 -1
  126. package/dist/utils/createAccountButtonEntry.js +6 -9
  127. package/dist/utils/createAccountButtonEntry.js.map +1 -1
  128. package/dist/utils/useClientPathname.d.ts +6 -0
  129. package/dist/utils/useClientPathname.d.ts.map +1 -0
  130. package/dist/utils/useClientPathname.js +23 -0
  131. package/dist/utils/useClientPathname.js.map +1 -0
  132. package/package.json +2 -2
  133. package/templates/README.md +2 -0
  134. package/templates/account.buttons.md +181 -0
  135. package/templates/account.config.example.ts +47 -7
@@ -0,0 +1,181 @@
1
+ # Account button types & CSS classes
2
+
3
+ Reference for `@weareconceptstudio/account` `AccountButton` — semantic `btnType` values, default BEM classes, layout, and project configuration.
4
+
5
+ ## Quick reference
6
+
7
+ | btnType | Role | Layout | Wrapper classes | Button element classes | Legacy config key¹ |
8
+ |---------|------|--------|-----------------|------------------------|-------------------|
9
+ | `auth` | Sign-in, sign-up, forgot/reset password | block | `btn-wrap auth account-button-wrap account-button-wrap--auth` | `account-button account-button--auth` | — |
10
+ | `submit` | Save changes in forms (pill) | fit | `btn-wrap submit account-button-wrap account-button-wrap--submit` | `account-button account-button--submit` | `form` |
11
+ | `cancel` | Form / popup cancel, dismiss | fit | `btn-wrap cancel account-button-wrap account-button-wrap--cancel` | `account-button account-button--cancel` | `green-large-text` |
12
+ | `checkout` | Proceed to checkout CTA | block | `btn-wrap checkout account-button-wrap account-button-wrap--checkout` | `account-button account-button--checkout` | — |
13
+ | `link` | Back to shop, continue shopping | fit | `btn-wrap link account-button-wrap account-button-wrap--link` | `account-button account-button--link` | `purple-text` |
14
+ | `link-sm` | Remove item, edit item, small actions | fit | `btn-wrap link-sm account-button-wrap account-button-wrap--link-sm` | `account-button account-button--link-sm` | `green-small-text` |
15
+ | `link-lg` | Section Edit, product title link | fit | `btn-wrap link-lg account-button-wrap account-button-wrap--link-lg` | `account-button account-button--link-lg` | `green-large-text` |
16
+ | `promo` | Apply promo code | fit | `btn-wrap promo account-button-wrap account-button-wrap--promo` | `account-button account-button--promo` | `promo-code-version` |
17
+ | `balance` | Apply account balance | fit | `btn-wrap balance account-button-wrap account-button-wrap--balance` | `account-button account-button--balance` | `balance-version` |
18
+ | `full-width` | Full-width popup primary | block | `btn-wrap full-width account-button-wrap account-button-wrap--full-width` | `account-button account-button--full-width` | `auth`, `submit` |
19
+ | `outline` | Outlined CTA (e.g. edit review) | fit | `btn-wrap outline account-button-wrap account-button-wrap--outline` | `account-button account-button--outline` | — |
20
+ | `icon` | Icon-only actions | fit | `btn-wrap icon account-button-wrap account-button-wrap--icon` | `account-button account-button--icon` | — |
21
+
22
+ ¹ **Legacy config key** — old `accountConfig.button` property name still resolved if the semantic key is missing (migration only). Do not use in new projects.
23
+
24
+ ## Class layers
25
+
26
+ Every `AccountButton` renders with up to three hook layers:
27
+
28
+ ```
29
+ .btn-wrap.{btnType} ← layout hooks used inside the package
30
+ .account-button-wrap ← BEM block for project rewrite CSS
31
+ .account-button-wrap--{btnType} ← BEM modifier (one per role)
32
+ ```
33
+
34
+ **Package default button** (no custom component in config):
35
+
36
+ ```html
37
+ <div class="btn-wrap submit account-button-wrap account-button-wrap--submit">
38
+ <button class="account-button account-button--submit">
39
+ <div class="content-button">Save changes</div>
40
+ </button>
41
+ </div>
42
+ ```
43
+
44
+ **Custom project button** (`accountConfig.button.submit`):
45
+
46
+ ```html
47
+ <div class="btn-wrap submit account-button-wrap account-button-wrap--submit" data-account-button-layout="block">
48
+ <MyButton class="account-button account-button--submit width-100 medium" />
49
+ </div>
50
+ ```
51
+
52
+ `data-account-button-layout` is `block` or `fit` — controls width inside `AccountButtonCustomWrap`.
53
+
54
+ ## Layout
55
+
56
+ | Layout | btnTypes | Behaviour |
57
+ |--------|----------|-----------|
58
+ | **block** | `auth`, `checkout`, `full-width` | Full width of parent |
59
+ | **fit** | `submit`, `cancel`, `link`, `link-sm`, `link-lg`, `promo`, `balance`, `outline`, `icon` | `width: fit-content` |
60
+
61
+ ## Project configuration
62
+
63
+ ### 1. Custom button component (per type)
64
+
65
+ ```ts
66
+ import Button from '@/components/Button';
67
+ import { createAccountButtonEntry } from '@weareconceptstudio/account/config';
68
+
69
+ accountConfig: {
70
+ button: {
71
+ // Block CTAs
72
+ auth: createAccountButtonEntry(Button, 'auth', { className: 'width-100 medium' }),
73
+ submit: createAccountButtonEntry(Button, 'submit', { className: 'width-100 medium' }),
74
+ checkout: createAccountButtonEntry(Button, 'checkout', { className: 'width-100 medium' }),
75
+
76
+ // Link-style actions
77
+ 'link-sm': createAccountButtonEntry(Button, 'link-sm', {
78
+ className: 'fonts-greenST',
79
+ btnType: 'float-underline',
80
+ }),
81
+
82
+ // Promo / balance — plain entry also works
83
+ promo: { component: Button, props: { className: 'medium' } },
84
+ balance: { component: Button, props: { className: 'medium' } },
85
+
86
+ // Omit keys you don't need — package default styles apply for:
87
+ // cancel, link, link-lg
88
+ },
89
+ }
90
+ ```
91
+
92
+ `createAccountButtonEntry(Component, variant, props)` automatically adds `account-button` + `account-button--{variant}` to the component `className`.
93
+
94
+ ### 2. Override BEM class tokens
95
+
96
+ ```ts
97
+ accountConfig: {
98
+ buttonClassNames: {
99
+ base: 'account-button', // default: account-button
100
+ wrapBase: 'account-button-wrap', // default: account-button-wrap
101
+ variants: {
102
+ submit: 'account-button--save', // replaces account-button--submit
103
+ },
104
+ wrapVariants: {
105
+ submit: 'account-button-wrap--save', // optional per-type wrap modifier
106
+ },
107
+ },
108
+ }
109
+ ```
110
+
111
+ Resolved via `getAccountButtonClassName(btnType)` from `@weareconceptstudio/account/config`.
112
+
113
+ ### 3. Project rewrite CSS
114
+
115
+ Target semantic classes (and wrap modifiers) in global rewrite styles:
116
+
117
+ ```css
118
+ /* Account form — save button hover */
119
+ .cancel-and-save-and-apply-wrap .submit,
120
+ .cancel-and-save-and-apply-wrap .account-button-wrap--submit {
121
+ button:hover { /* … */ }
122
+ }
123
+
124
+ /* Cart product title — no underline */
125
+ .cart-items-table-wrap .link-lg,
126
+ .cart-items-table-wrap .account-button-wrap--link-lg {
127
+ button { text-decoration: none; }
128
+ }
129
+
130
+ /* Popup cancel — smaller text */
131
+ .popup-content-container .cancel,
132
+ .popup-content-container .account-button-wrap--cancel {
133
+ button { font-size: var(--h5); }
134
+ }
135
+ ```
136
+
137
+ Prefer `.account-button-wrap--{type}` when scoping; `.btn-wrap.{type}` also works.
138
+
139
+ ## Package usage map
140
+
141
+ | btnType | Used in (examples) |
142
+ |---------|-------------------|
143
+ | `auth` | Sign-in, sign-up, forgot/reset password, verify email, unsubscribe |
144
+ | `submit` | Account settings save, address/payment popup save, warning popup OK |
145
+ | `cancel` | Account settings cancel, address/payment popup cancel |
146
+ | `checkout` | TotalCheckout proceed button |
147
+ | `link` | Cart back to shop, continue shopping, empty cart, thank-you page |
148
+ | `link-sm` | Cart remove/edit, order list actions, address item actions |
149
+ | `link-lg` | Account Edit, cart product title, order product link |
150
+ | `promo` | Promo code apply |
151
+ | `balance` | Balance apply |
152
+ | `full-width` | Cart modification warning confirm |
153
+ | `outline` | Order review edit (when review exists) |
154
+ | `icon` | Order review like/dislike icons |
155
+
156
+ ## Exports
157
+
158
+ ```ts
159
+ import {
160
+ ACCOUNT_BUTTON_TYPES,
161
+ ACCOUNT_BUTTON_LAYOUT,
162
+ ACCOUNT_BUTTON_CLASS_NAMES,
163
+ getAccountButtonLayout,
164
+ getAccountButtonClassName,
165
+ createAccountButtonEntry,
166
+ } from '@weareconceptstudio/account/config';
167
+ ```
168
+
169
+ ## Migration from legacy names
170
+
171
+ | Old `btnType` / config key | New |
172
+ |----------------------------|-----|
173
+ | `form` | `submit` |
174
+ | `purple-text` | `link` |
175
+ | `green-small-text` | `link-sm` |
176
+ | `green-large-text` (edit / title) | `link-lg` |
177
+ | `green-large-text` (cancel) | `cancel` |
178
+ | `promo-code-version` | `promo` |
179
+ | `balance-version` | `balance` |
180
+
181
+ Update `rewrite.css` selectors in each demo project from legacy class names to the table above.
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * AccountProvider overrides — merged with package defaults in @weareconceptstudio/account.
3
3
  *
4
- * Import createAccountButtonEntry from '@weareconceptstudio/account/config'
5
- * and pass your project Button component in layout or here.
4
+ * @see ./account.buttons.md full button types, CSS classes, layout & migration guide
6
5
  */
7
6
  import type { UserIntegrationConfig } from '@weareconceptstudio/account';
8
7
 
@@ -56,19 +55,60 @@ export const accountProviderConfig = {
56
55
  paymentPlacement: 'review' as const,
57
56
  },
58
57
 
59
- /** Same shape as UserProvider userIntegration — optional duplicate for reference */
60
58
  userIntegration: null as UserIntegrationConfig | null,
61
59
 
62
60
  /**
61
+ * Custom buttons — one config entry per btnType (see account.buttons.md).
62
+ *
63
+ * | btnType | Layout | Wrapper modifier | Button modifier |
64
+ * |-------------|--------|-------------------------------|------------------------------|
65
+ * | auth | block | account-button-wrap--auth | account-button--auth |
66
+ * | submit | fit | account-button-wrap--submit | account-button--submit |
67
+ * | cancel | fit | account-button-wrap--cancel | account-button--cancel |
68
+ * | checkout | block | account-button-wrap--checkout | account-button--checkout |
69
+ * | link | fit | account-button-wrap--link | account-button--link |
70
+ * | link-sm | fit | account-button-wrap--link-sm | account-button--link-sm |
71
+ * | link-lg | fit | account-button-wrap--link-lg | account-button--link-lg |
72
+ * | promo | fit | account-button-wrap--promo | account-button--promo |
73
+ * | balance | fit | account-button-wrap--balance | account-button--balance |
74
+ * | full-width | block | account-button-wrap--full-width | account-button--full-width |
75
+ * | outline | fit | account-button-wrap--outline | account-button--outline |
76
+ * | icon | fit | account-button-wrap--icon | account-button--icon |
77
+ *
78
+ * @example
79
+ * import Button from '@/components/Button';
80
+ * import { createAccountButtonEntry } from '@weareconceptstudio/account/config';
81
+ *
63
82
  * button: {
64
- * auth: createAccountButtonEntry(Button, 'auth', { btnType: 'primary' }),
65
- * form: createAccountButtonEntry(Button, 'form', { btnType: 'primary' }),
66
- * checkout: createAccountButtonEntry(Button, 'checkout', { btnType: 'primary' }),
83
+ * auth: createAccountButtonEntry(Button, 'auth', { className: 'width-100 medium' }),
84
+ * submit: createAccountButtonEntry(Button, 'submit', { className: 'width-100 medium' }),
85
+ * checkout: createAccountButtonEntry(Button, 'checkout', { className: 'width-100 medium' }),
86
+ * 'link-sm': createAccountButtonEntry(Button, 'link-sm', { btnType: 'float-underline' }),
87
+ * promo: { component: Button, props: { className: 'medium' } },
67
88
  * },
68
89
  */
69
90
  button: {},
70
91
 
71
- /** import { addressFormFields } from './address.config' */
92
+ /** Optional BEM overrides merged with package defaults via getAccountButtonClassName */
93
+ buttonClassNames: {
94
+ base: 'account-button',
95
+ wrapBase: 'account-button-wrap',
96
+ variants: {
97
+ auth: 'account-button--auth',
98
+ submit: 'account-button--submit',
99
+ cancel: 'account-button--cancel',
100
+ checkout: 'account-button--checkout',
101
+ link: 'account-button--link',
102
+ 'link-sm': 'account-button--link-sm',
103
+ 'link-lg': 'account-button--link-lg',
104
+ promo: 'account-button--promo',
105
+ balance: 'account-button--balance',
106
+ 'full-width': 'account-button--full-width',
107
+ outline: 'account-button--outline',
108
+ icon: 'account-button--icon',
109
+ },
110
+ },
111
+
72
112
  addressFormFields: null,
73
113
  addressFormFieldsShipping: null,
74
114
  addressFormFieldsBilling: null,