@salesforce/retail-react-app 1.1.0-preview.0 → 2.0.0

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/CHANGELOG.md CHANGED
@@ -1,10 +1,15 @@
1
- ## v1.1.0-preview.0
1
+ ## v2.0.0 (Sep 21, 2023)
2
2
 
3
- - Fix price display when a discounted price is zero [#1361](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1361)
4
- - Fix price adjustments of a line item when more than one is present [#1362](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1362)
3
+ - V3 Fix checkout card number [#1424](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1424)
4
+ - Cleanup wrong import path for page-designer component [#1441](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1441) @clavery
5
+ - Modularize country code source for targeting via extensibility [#1445](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1445) @bfeister
6
+ - Export icon helper function for target via overrides [#1420](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1420) @cbrother-csu
7
+ - Migrate Page Designer core types to commerce-sdk-react [#1441](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1441) @clavery
5
8
 
6
- ## v1.1.0-dev (June 15, 2023)
9
+ ## v1.0.1 (Jul 26, 2023)
7
10
 
11
+ - Fix price display when a discounted price is zero [#1361](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1361)
12
+ - Fix price adjustments of a line item when more than one is present [#1362](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1362)
8
13
  - Registered user checkout should set order with an email [#1363](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1363)
9
14
 
10
15
  ## v1.0.0 (June 15, 2023)
@@ -16,9 +21,9 @@
16
21
 
17
22
  ## Older Versions Without Namespace
18
23
 
19
- The older versions below were published without the `@salesforce` namespace.
24
+ The versions published below were not published on npm, and the versioning matched that of the PWA Kit SDK. These versions did not use the `@salesforce` namespace.
20
25
 
21
- ## v2.7.1 (May 11, 2023)
26
+ ### v2.7.1 (May 11, 2023)
22
27
 
23
28
  - Replace invalid row value with nowrap [#1179](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1179)
24
29
  - Add a redirect to login page after user signs out from checkout page [#1172](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1172)
@@ -32,7 +37,7 @@ The older versions below were published without the `@salesforce` namespace.
32
37
  - Fix addresses not having preferred address first. [#1051](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1051)
33
38
  - Changed type of the phone number field to bring up numberic keyboard on mobile devices - W-9871940 [#1016)](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1016)
34
39
 
35
- ## v2.7.0 (Mar 03, 2023)
40
+ ### v2.7.0 (Mar 03, 2023)
36
41
 
37
42
  - Add Page Designer ImageTile component [#967](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/967)
38
43
  - Add Page Designer ImageWithText component [#991](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/991)
@@ -40,7 +45,7 @@ The older versions below were published without the `@salesforce` namespace.
40
45
  - Add Page Designer layout components [#993](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/993)
41
46
  - Support the product-set type [#1019](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1019)
42
47
 
43
- ## v2.6.0 (Jan 25, 2023)
48
+ ### v2.6.0 (Jan 25, 2023)
44
49
 
45
50
  - Mega menu fixes [#875](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/875) and [#910](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/910)
46
51
  - Cache SLAS callback using request processor [#884](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/884)
@@ -49,14 +54,14 @@ The older versions below were published without the `@salesforce` namespace.
49
54
  - Fix PropTypes [#924](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/924)
50
55
  - Remove unnecessary map statement [#929](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/929)
51
56
 
52
- ## v2.5.0 (Jan 5, 2023)
57
+ ### v2.5.0 (Jan 5, 2023)
53
58
 
54
59
  - Add instanceType to Einstein activity body [#858](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/858)
55
60
  - Do not use a proxy to call Einstein [#857](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/857)
56
61
  - Einstein handle variants [#867](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/867)
57
62
  - Fix cc exp year [#874](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/874)
58
63
 
59
- ## v2.4.0 (Dec 1, 2022)
64
+ ### v2.4.0 (Dec 1, 2022)
60
65
 
61
66
  - Dynamic footer Copyright date [#741](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/741)
62
67
  - Footer copyright: remove the remaining hardcoded year [#760](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/760)
@@ -66,7 +71,7 @@ The older versions below were published without the `@salesforce` namespace.
66
71
  - pwa-kit-dev command for tailing logs [#789](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/789)
67
72
  - Update usages of zzrf-001 ODS instance to the new short URL format [#816](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/816)
68
73
 
69
- ## v2.3.0 (Oct 27, 2022)
74
+ ### v2.3.0 (Oct 27, 2022)
70
75
 
71
76
  - Fix locale `alias` by including `locale` object inside the MultiSite Context. [#716](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/716)
72
77
  - Updated translations. [#725](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/725)
@@ -77,20 +82,20 @@ The older versions below were published without the `@salesforce` namespace.
77
82
  - Bugfix: image gallery thumbnails not working without DIS [#786](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/786)
78
83
  - Ensure that a valid target locale is use if none is provided [#788](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/788)
79
84
 
80
- ## v2.2.0 (Aug 25, 2022)
85
+ ### v2.2.0 (Aug 25, 2022)
81
86
 
82
87
  - Update zzrf-001 url [#694](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/694)
83
88
  - Optimize Server-side performance [#667](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/667)
84
89
  - Remove references to session bridging [#684](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/684)
85
90
 
86
- ## v2.1.0 (Jul 05, 2022)
91
+ ### v2.1.0 (Jul 05, 2022)
87
92
 
88
93
  - Update translations [#643](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/643)
89
94
  - Update translations [#653](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/653)
90
95
  - Add bundlesize test back into CI [#652](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/652)
91
96
  - Fix UI bug on notifications badge [#620](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/620)
92
97
 
93
- ## v2.0.0 (May 16, 2022)
98
+ ### v2.0.0 (May 16, 2022)
94
99
 
95
100
  - Update translation docs [#570](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/570)
96
101
  - Fixed loading correct amount of skeletons [#576] (<https://github.com/SalesforceCommerceCloud/pwa-kit/pull/576>)
@@ -110,7 +115,7 @@ The older versions below were published without the `@salesforce` namespace.
110
115
  - Service worker loading for dev server [#464](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/464)
111
116
  - Environment Specific Configuration Support [#477](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/447)
112
117
 
113
- ## v1.5.0 (Mar 17, 2022)
118
+ ### v1.5.0 (Mar 17, 2022)
114
119
 
115
120
  - Support storing authentication tokens in cookie [#429](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/429)
116
121
  - Make sure the forgot-password modal also shows up in the checkout flow [#373](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/373)
@@ -118,7 +123,7 @@ The older versions below were published without the `@salesforce` namespace.
118
123
  - Import cross-fetch to make OCAPI client isomorphic [#382](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/382)
119
124
  - Multi-site implementation for Retail React App [#391](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/391)
120
125
 
121
- ## v1.4.0 (Jan 27, 2022)
126
+ ### v1.4.0 (Jan 27, 2022)
122
127
 
123
128
  - Do not send HSTS header during local development [#288](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/288)
124
129
  - Add constants for `<meta>` tags `theme-color` and `apple-mobile-web-app-title` [#287](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/287)
@@ -126,7 +131,7 @@ The older versions below were published without the `@salesforce` namespace.
126
131
  - Import preliminary translations [#324](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/324)
127
132
  - Remove old dependencies that are no longer used [#317](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/317)
128
133
 
129
- ## v1.3.0 (Jan 06, 2022)
134
+ ### v1.3.0 (Jan 06, 2022)
130
135
 
131
136
  - Remove Einstein from home page [#208](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/208)
132
137
  - Add git2gus config to allow git2gus integration [210](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/210)
@@ -148,7 +153,7 @@ The older versions below were published without the `@salesforce` namespace.
148
153
  - Fix show applied promotion codes case sensitive issue [#224](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/224)
149
154
  - Fix section subtitle incorrect prop warning [#282](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/282)
150
155
 
151
- ## v1.2.0 (Nov 18, 2021)
156
+ ### v1.2.0 (Nov 18, 2021)
152
157
 
153
158
  - Simplify homepage for Retail React App [#201](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/201)
154
159
  - Ensure `cookieId` value is sent always for Einstein recommendations [#179](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/179)
@@ -169,7 +174,7 @@ The older versions below were published without the `@salesforce` namespace.
169
174
  - Add cache control header to product details page [#172](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/172)
170
175
  - Clear SLAS tokens when OID is changed [#178](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/178)
171
176
 
172
- ## v1.1.0 (Sep 27, 2021)
177
+ ### v1.1.0 (Sep 27, 2021)
173
178
 
174
179
  - Fix wishlist bugs and provide better hooks for wishlist features. [#64](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/64)
175
180
  - Lazy load Popover component. [#134](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/134)
@@ -182,6 +187,6 @@ The older versions below were published without the `@salesforce` namespace.
182
187
  - Security - `inquirer` package upgrade. [#121](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/121)
183
188
  - New quantity picker. [#102](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/102)
184
189
 
185
- ## v1.0.0 (Sep 08, 2021)
190
+ ### v1.0.0 (Sep 08, 2021)
186
191
 
187
192
  - PWA Kit General Availability and open source. 🎉
@@ -10,6 +10,7 @@ import {
10
10
  stateOptions,
11
11
  provinceOptions
12
12
  } from '@salesforce/retail-react-app/app/components/forms/state-province-options'
13
+ import {SHIPPING_COUNTRY_CODES} from '@salesforce/retail-react-app/app/constants'
13
14
 
14
15
  const messages = defineMessages({
15
16
  required: {defaultMessage: 'Required', id: 'use_address_fields.error.required'},
@@ -103,10 +104,7 @@ export default function useAddressFields({
103
104
  label: formatMessage(messages.country),
104
105
  defaultValue: 'US',
105
106
  type: 'select',
106
- options: [
107
- {value: 'CA', label: 'Canada'},
108
- {value: 'US', label: 'United States'}
109
- ],
107
+ options: SHIPPING_COUNTRY_CODES,
110
108
  rules: {
111
109
  required: formatMessage({
112
110
  defaultMessage: 'Please select your country.',
@@ -84,7 +84,7 @@ VisaSymbol.viewBox = VisaSymbol.viewBox || '0 0 38 22'
84
84
  * @param {string} name - the filename of the imported svg (does not include extension)
85
85
  */
86
86
  /* istanbul ignore next */
87
- const icon = (name, passProps) => {
87
+ export const icon = (name, passProps) => {
88
88
  const displayName = name
89
89
  .toLowerCase()
90
90
  .replace(/(?:^|[\s-/])\w/g, (match) => match.toUpperCase())
package/app/constants.js CHANGED
@@ -107,3 +107,8 @@ export const EINSTEIN_RECOMMENDERS = {
107
107
  EMPTY_SEARCH_RESULTS_TOP_SELLERS: 'home-top-revenue-for-category',
108
108
  EMPTY_SEARCH_RESULTS_MOST_VIEWED: 'products-in-all-categories'
109
109
  }
110
+
111
+ export const SHIPPING_COUNTRY_CODES = [
112
+ {value: 'CA', label: 'Canada'},
113
+ {value: 'US', label: 'United States'}
114
+ ]
@@ -5,6 +5,6 @@
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
7
 
8
- import {Page, pageType} from '@salesforce/retail-react-app/app/page-designer/core'
8
+ import {Page, pageType} from '@salesforce/commerce-sdk-react/components'
9
9
 
10
10
  export {Page, pageType}
@@ -24,6 +24,7 @@ import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-curre
24
24
  import {useCheckout} from '@salesforce/retail-react-app/app/pages/checkout/util/checkout-context'
25
25
  import {
26
26
  getPaymentInstrumentCardType,
27
+ getMaskCreditCardNumber,
27
28
  getCreditCardIcon
28
29
  } from '@salesforce/retail-react-app/app/utils/cc-utils'
29
30
  import {
@@ -84,7 +85,7 @@ const Payment = () => {
84
85
  paymentMethodId: 'CREDIT_CARD',
85
86
  paymentCard: {
86
87
  holder: formValue.holder,
87
- issueNumber: formValue.number.replace(/ /g, ''),
88
+ maskedNumber: getMaskCreditCardNumber(formValue.number),
88
89
  cardType: getPaymentInstrumentCardType(formValue.cardType),
89
90
  expirationMonth: parseInt(expirationMonth),
90
91
  expirationYear: parseInt(`20${expirationYear}`)
@@ -83,6 +83,21 @@ export const getPaymentInstrumentCardType = (type) => {
83
83
  }[type]
84
84
  }
85
85
 
86
+ /**
87
+ * Returns the masked credit card number by removing white spaces,
88
+ * replacing all digits except the last 4 using the '*' character.
89
+ * @param cardNumber - The card number unmasked
90
+ * @returns {string} - The masked card number
91
+ */
92
+ export const getMaskCreditCardNumber = (cardNumber) => {
93
+ const trimmedCardNumber = cardNumber.replace(/\s/g, '')
94
+
95
+ const maskedDigits = trimmedCardNumber.slice(0, -4).replace(/\d/g, '*')
96
+ const lastFourDigits = trimmedCardNumber.slice(-4)
97
+
98
+ return maskedDigits + lastFourDigits
99
+ }
100
+
86
101
  export const createCreditCardPaymentBodyFromForm = (paymentFormData) => {
87
102
  // Using destructuring to omit properties
88
103
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/retail-react-app",
3
- "version": "1.1.0-preview.0",
3
+ "version": "2.0.0",
4
4
  "license": "See license in LICENSE",
5
5
  "author": "cc-pwa-kit@salesforce.com",
6
6
  "ccExtensibility": {
@@ -45,10 +45,10 @@
45
45
  "@lhci/cli": "^0.11.0",
46
46
  "@loadable/component": "^5.15.3",
47
47
  "@peculiar/webcrypto": "^1.4.2",
48
- "@salesforce/commerce-sdk-react": "1.0.1-preview.0",
49
- "@salesforce/pwa-kit-dev": "3.1.0-preview.4",
50
- "@salesforce/pwa-kit-react-sdk": "3.1.0-preview.4",
51
- "@salesforce/pwa-kit-runtime": "3.1.0-preview.4",
48
+ "@salesforce/commerce-sdk-react": "1.0.2",
49
+ "@salesforce/pwa-kit-dev": "3.1.1",
50
+ "@salesforce/pwa-kit-react-sdk": "3.1.1",
51
+ "@salesforce/pwa-kit-runtime": "3.1.1",
52
52
  "@tanstack/react-query": "^4.28.0",
53
53
  "@tanstack/react-query-devtools": "^4.29.1",
54
54
  "@testing-library/dom": "^9.0.1",
@@ -103,5 +103,5 @@
103
103
  "overrides": {
104
104
  "nwsapi": "2.2.2"
105
105
  },
106
- "gitHead": "8ef8310dabf77dfdc50b76fbe2464f771c6a69c0"
106
+ "gitHead": "0194d62014788b280549e70e6e80da279227b500"
107
107
  }