@payloadcms/plugin-ecommerce 4.0.0-canary.6 → 4.0.0-canary.7

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2025 Payload CMS, Inc. <info@payloadcms.com>
3
+ Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -1 +1 @@
1
- {"version":3,"file":"beforeChange.d.ts","sourceRoot":"","sources":["../../../../src/collections/addresses/hooks/beforeChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEtE,UAAU,KAAK;IACb,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,0BAgBzC,CAAA"}
1
+ {"version":3,"file":"beforeChange.d.ts","sourceRoot":"","sources":["../../../../src/collections/addresses/hooks/beforeChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEtE,UAAU,KAAK;IACb,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,0BAiBzC,CAAA"}
@@ -1,9 +1,10 @@
1
- export const beforeChange = ({ isCustomer })=>async ({ data, req })=>{
1
+ export const beforeChange = ({ isCustomer })=>async (hookArgs)=>{
2
+ const { data, req } = hookArgs;
2
3
  if (!isCustomer) {
3
4
  return data;
4
5
  }
5
6
  const userIsCustomer = await isCustomer({
6
- req
7
+ ...hookArgs
7
8
  });
8
9
  // Ensure that the customer field is set to the current user's ID if the user is a customer.
9
10
  // Admins can set to any customer.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/addresses/hooks/beforeChange.ts"],"sourcesContent":["import type { CollectionBeforeChangeHook, FieldAccess } from 'payload'\n\ninterface Props {\n isCustomer?: FieldAccess\n}\n\nexport const beforeChange: (args: Props) => CollectionBeforeChangeHook =\n ({ isCustomer }) =>\n async ({ data, req }) => {\n if (!isCustomer) {\n return data\n }\n\n const userIsCustomer = await isCustomer({ req })\n\n // Ensure that the customer field is set to the current user's ID if the user is a customer.\n // Admins can set to any customer.\n if (req.user && userIsCustomer) {\n data.customer = req.user.id\n }\n\n return data\n }\n"],"names":["beforeChange","isCustomer","data","req","userIsCustomer","user","customer","id"],"mappings":"AAMA,OAAO,MAAMA,eACX,CAAC,EAAEC,UAAU,EAAE,GACf,OAAO,EAAEC,IAAI,EAAEC,GAAG,EAAE;QAClB,IAAI,CAACF,YAAY;YACf,OAAOC;QACT;QAEA,MAAME,iBAAiB,MAAMH,WAAW;YAAEE;QAAI;QAE9C,4FAA4F;QAC5F,kCAAkC;QAClC,IAAIA,IAAIE,IAAI,IAAID,gBAAgB;YAC9BF,KAAKI,QAAQ,GAAGH,IAAIE,IAAI,CAACE,EAAE;QAC7B;QAEA,OAAOL;IACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/collections/addresses/hooks/beforeChange.ts"],"sourcesContent":["import type { CollectionBeforeChangeHook, FieldAccess } from 'payload'\n\ninterface Props {\n isCustomer?: FieldAccess\n}\n\nexport const beforeChange: (args: Props) => CollectionBeforeChangeHook =\n ({ isCustomer }) =>\n async (hookArgs) => {\n const { data, req } = hookArgs\n if (!isCustomer) {\n return data\n }\n\n const userIsCustomer = await isCustomer({ ...hookArgs })\n\n // Ensure that the customer field is set to the current user's ID if the user is a customer.\n // Admins can set to any customer.\n if (req.user && userIsCustomer) {\n data.customer = req.user.id\n }\n\n return data\n }\n"],"names":["beforeChange","isCustomer","hookArgs","data","req","userIsCustomer","user","customer","id"],"mappings":"AAMA,OAAO,MAAMA,eACX,CAAC,EAAEC,UAAU,EAAE,GACf,OAAOC;QACL,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAE,GAAGF;QACtB,IAAI,CAACD,YAAY;YACf,OAAOE;QACT;QAEA,MAAME,iBAAiB,MAAMJ,WAAW;YAAE,GAAGC,QAAQ;QAAC;QAEtD,4FAA4F;QAC5F,kCAAkC;QAClC,IAAIE,IAAIE,IAAI,IAAID,gBAAgB;YAC9BF,KAAKI,QAAQ,GAAGH,IAAIE,IAAI,CAACE,EAAE;QAC7B;QAEA,OAAOL;IACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-ecommerce",
3
- "version": "4.0.0-canary.6",
3
+ "version": "4.0.0-canary.7",
4
4
  "description": "Ecommerce plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -74,23 +74,23 @@
74
74
  ],
75
75
  "dependencies": {
76
76
  "qs-esm": "8.0.1",
77
- "@payloadcms/translations": "4.0.0-canary.6",
78
- "@payloadcms/ui": "4.0.0-canary.6"
77
+ "@payloadcms/translations": "4.0.0-canary.7",
78
+ "@payloadcms/ui": "4.0.0-canary.7"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/json-schema": "7.0.15",
82
82
  "@types/react": "19.2.14",
83
83
  "@types/react-dom": "19.2.3",
84
84
  "stripe": "18.3.0",
85
- "@payloadcms/translations": "4.0.0-canary.6",
85
+ "@payloadcms/next": "4.0.0-canary.7",
86
86
  "@payloadcms/eslint-config": "3.28.0",
87
- "@payloadcms/next": "4.0.0-canary.6",
88
- "payload": "4.0.0-canary.6"
87
+ "@payloadcms/translations": "4.0.0-canary.7",
88
+ "payload": "4.0.0-canary.7"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
92
92
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
93
- "payload": "4.0.0-canary.6"
93
+ "payload": "4.0.0-canary.7"
94
94
  },
95
95
  "publishConfig": {
96
96
  "registry": "https://registry.npmjs.org/"