@zeniai/client-epic-state 5.1.18 → 5.1.20

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.
@@ -12,7 +12,9 @@ const toCustomerTransaction = (payload) => {
12
12
  const transaction = (0, transactionPayload_1.toTransaction)(payload);
13
13
  return {
14
14
  ...transaction,
15
- customer: payload.customer_id != null ? (0, customerPayload_1.toCustomerBase)(payload, false) : undefined,
15
+ customer: (0, customerPayload_1.getCustomerPayloadIdentifier)(payload) != null
16
+ ? (0, customerPayload_1.toCustomerBase)(payload, false)
17
+ : undefined,
16
18
  documentId: payload.document_id,
17
19
  paymentType: (0, paymentType_1.toPaymentTypeStrict)(payload.payment_type),
18
20
  paymentTypeName: payload.payment_type_name,
@@ -1,5 +1,5 @@
1
1
  import { toAmountWC } from '../../../commonStateTypes/amount';
2
- import { toCustomerBase, toCustomerBasePayload, } from '../../customer/customerPayload';
2
+ import { getCustomerPayloadIdentifier, toCustomerBase, toCustomerBasePayload, } from '../../customer/customerPayload';
3
3
  import { toPaymentTypeStrict } from '../stateTypes/paymentType';
4
4
  import { toCustomerTransactionTypeStrict } from '../stateTypes/transactionType';
5
5
  import { toTransaction, toTransactionPayload, } from './transactionPayload';
@@ -8,7 +8,9 @@ export const toCustomerTransaction = (payload) => {
8
8
  const transaction = toTransaction(payload);
9
9
  return {
10
10
  ...transaction,
11
- customer: payload.customer_id != null ? toCustomerBase(payload, false) : undefined,
11
+ customer: getCustomerPayloadIdentifier(payload) != null
12
+ ? toCustomerBase(payload, false)
13
+ : undefined,
12
14
  documentId: payload.document_id,
13
15
  paymentType: toPaymentTypeStrict(payload.payment_type),
14
16
  paymentTypeName: payload.payment_type_name,
@@ -111,7 +111,11 @@ const setupView = createSlice({
111
111
  saveSetupViewDataInLocalStore(draft, action) {
112
112
  const setupViewLocalData = action.payload;
113
113
  if (setupViewLocalData.companyDetails != null) {
114
- draft.companyDetails.localData = setupViewLocalData.companyDetails;
114
+ const syncToken = setupViewLocalData.companyDetails.syncToken ?? draft.companyDetails.localData?.syncToken;
115
+ draft.companyDetails.localData = {
116
+ ...setupViewLocalData.companyDetails,
117
+ ...(syncToken != null ? { syncToken } : {}),
118
+ };
115
119
  }
116
120
  if (setupViewLocalData.primaryContactDetails != null) {
117
121
  draft.primaryContactDetails.localData =
@@ -115,7 +115,11 @@ const setupView = (0, toolkit_1.createSlice)({
115
115
  saveSetupViewDataInLocalStore(draft, action) {
116
116
  const setupViewLocalData = action.payload;
117
117
  if (setupViewLocalData.companyDetails != null) {
118
- draft.companyDetails.localData = setupViewLocalData.companyDetails;
118
+ const syncToken = setupViewLocalData.companyDetails.syncToken ?? draft.companyDetails.localData?.syncToken;
119
+ draft.companyDetails.localData = {
120
+ ...setupViewLocalData.companyDetails,
121
+ ...(syncToken != null ? { syncToken } : {}),
122
+ };
119
123
  }
120
124
  if (setupViewLocalData.primaryContactDetails != null) {
121
125
  draft.primaryContactDetails.localData =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.18",
3
+ "version": "5.1.20",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -33,42 +33,6 @@
33
33
  "require": "./lib/view/*.js"
34
34
  }
35
35
  },
36
- "scripts": {
37
- "clean": "rimraf lib",
38
- "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
39
- "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=2 ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
40
- "test:typecheck-mocks": "echo 'Typechecking mock files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.mocks.json",
41
- "test:typecheck-mocks-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=2 ./scripts/tsc-modified-files.sh master tsconfig.mocks.json",
42
- "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
43
- "test:full": "pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
44
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
45
- "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
46
- "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
47
- "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
48
- "typecheck": "tsc --noEmit",
49
- "find-dead-code": "ts-prune | grep -v '(used in module)'",
50
- "find-unused-exports": "ts-unused-exports ./tsconfig.json",
51
- "circular-dependency": "npx madge --circular --extensions ts ./src",
52
- "build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
53
- "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
54
- "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
55
- "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
56
- "format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
57
- "check-version": "node ./scripts/check_version.js",
58
- "prepublishOnly": "chmod +x ./scripts/branch_validation.sh && ./scripts/branch_validation.sh && pnpm update-slack-group-topic && pnpm run check-version && pnpm clean && pnpm build",
59
- "version": "git add -A src",
60
- "postversion": "git push && git push --tags",
61
- "check-dependencies": "node ./scripts/check_dependencies.js",
62
- "clean-overrides": "node ./scripts/clean_overrides.js",
63
- "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
64
- "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
65
- "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
66
- "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
67
- "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
68
- "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
69
- "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
70
- "test:file": "scripts/test-file.sh"
71
- },
72
36
  "files": [
73
37
  "lib/**/*"
74
38
  ],
@@ -139,32 +103,39 @@
139
103
  "dayjs": "^1.10.7",
140
104
  "url-parse": "^1.5.10"
141
105
  },
142
- "pnpm": {
143
- "overrides": {
144
- "@babel/helpers": ">=7.26.10",
145
- "@babel/runtime": ">=7.26.10",
146
- "@babel/traverse": ">=7.23.2",
147
- "@eslint/eslintrc>ajv": ">=6.14.0 <7",
148
- "@eslint/plugin-kit": ">=0.3.4",
149
- "@modelcontextprotocol/sdk": ">=1.25.2",
150
- "ajv": ">=8.18.0",
151
- "body-parser": ">=2.2.1",
152
- "brace-expansion": ">=5.0.6",
153
- "cross-spawn": ">=7.0.5",
154
- "eslint>ajv": ">=6.14.0 <7",
155
- "flatted": ">=3.4.2",
156
- "glob": ">=11.1.0",
157
- "hono": ">=4.11.4",
158
- "immutable": ">=4.3.8 <5",
159
- "js-yaml": ">=4.1.1",
160
- "minimatch": ">=10.2.3",
161
- "picomatch": ">=4.0.4",
162
- "postcss": ">=8.5.12",
163
- "qs": "^6.14.1",
164
- "rollup": ">=4.59.0",
165
- "tough-cookie": "=4.1.3",
166
- "vite": ">=7.3.2 <8",
167
- "yaml": ">=1.10.3"
168
- }
106
+ "scripts": {
107
+ "clean": "rimraf lib",
108
+ "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
109
+ "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=2 ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
110
+ "test:typecheck-mocks": "echo 'Typechecking mock files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.mocks.json",
111
+ "test:typecheck-mocks-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=2 ./scripts/tsc-modified-files.sh master tsconfig.mocks.json",
112
+ "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
113
+ "test:full": "pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
114
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
115
+ "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
116
+ "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
117
+ "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
118
+ "typecheck": "tsc --noEmit",
119
+ "find-dead-code": "ts-prune | grep -v '(used in module)'",
120
+ "find-unused-exports": "ts-unused-exports ./tsconfig.json",
121
+ "circular-dependency": "npx madge --circular --extensions ts ./src",
122
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
123
+ "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
124
+ "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
125
+ "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
126
+ "format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
127
+ "check-version": "node ./scripts/check_version.js",
128
+ "version": "git add -A src",
129
+ "postversion": "git push && git push --tags",
130
+ "check-dependencies": "node ./scripts/check_dependencies.js",
131
+ "clean-overrides": "node ./scripts/clean_overrides.js",
132
+ "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
133
+ "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
134
+ "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
135
+ "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
136
+ "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
137
+ "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
138
+ "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
139
+ "test:file": "scripts/test-file.sh"
169
140
  }
170
141
  }